text
stringlengths
2
1.04M
meta
dict
using Vulpix; using Vulpix.Objects; public class Startup : VulpixCore { public Startup() { var config = VulpixConfiguration.GetConfiguration(); base.SetRoute(config.GetRoute()); base.SetMiddleware(config.GetMiddleware()); base.SetPublicFolder(config.GetPublicFolder()); } }
{ "content_hash": "b7cc9e598d6fbccddd0a491723fbe933", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 60, "avg_line_length": 24.46153846153846, "alnum_prop": 0.6792452830188679, "repo_name": "nicolasgere/Vulpix", "id": "4a2f40a2d6005d1cee80a94121b3bc36fa5ffb4d", "size": "318", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Vulpix/src/Vulpix/Startup.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "14419" } ], "symlink_target": "" }
import _ from 'lodash'; import PropTypes from 'prop-types'; import React, { PureComponent } from 'react'; import { connect } from 'react-redux'; import { MGDL_UNITS, MMOLL_UNITS } from '../../../utils/constants'; import NonTandem from '../NonTandem'; import Tandem from '../Tandem'; export class PumpSettingsContainer extends PureComponent { static propTypes = { bgUnits: PropTypes.oneOf([MGDL_UNITS, MMOLL_UNITS]).isRequired, copySettingsClicked: PropTypes.func.isRequired, manufacturerKey: PropTypes.oneOf( ['animas', 'carelink', 'insulet', 'medtronic', 'tandem', 'microtech'] ).isRequired, // see more specific schema in NonTandem and Tandem components! pumpSettings: PropTypes.shape({ activeSchedule: PropTypes.string.isRequired, }).isRequired, timePrefs: PropTypes.shape({ timezoneAware: PropTypes.bool.isRequired, timezoneName: PropTypes.string.isRequired, }).isRequired, settingsState: PropTypes.object.isRequired, toggleSettingsSection: PropTypes.func.isRequired, } UNSAFE_componentWillMount() { const { manufacturerKey, pumpSettings: { activeSchedule, lastManualBasalSchedule }, toggleSettingsSection, settingsState: { touched }, } = this.props; if (!touched) { toggleSettingsSection(manufacturerKey, lastManualBasalSchedule || activeSchedule); } } render() { const { settingsState, user } = this.props; if (_.isEmpty(settingsState)) { return null; } const { bgUnits, copySettingsClicked, manufacturerKey, pumpSettings, timePrefs, toggleSettingsSection, } = this.props; const supportedNonTandemPumps = ['animas', 'carelink', 'insulet', 'medtronic', 'microtech']; const toggleFn = _.partial(toggleSettingsSection, manufacturerKey); if (manufacturerKey === 'tandem') { return ( <Tandem bgUnits={bgUnits} copySettingsClicked={copySettingsClicked} deviceKey={manufacturerKey} openedSections={settingsState[manufacturerKey]} pumpSettings={pumpSettings} timePrefs={timePrefs} toggleProfileExpansion={toggleFn} user={user} /> ); } else if (_.includes(supportedNonTandemPumps, manufacturerKey)) { return ( <NonTandem bgUnits={bgUnits} copySettingsClicked={copySettingsClicked} deviceKey={manufacturerKey} openedSections={settingsState[manufacturerKey]} pumpSettings={pumpSettings} timePrefs={timePrefs} toggleBasalScheduleExpansion={toggleFn} user={user} /> ); } // eslint-disable-next-line no-console console.warn(`Unknown manufacturer key: [${manufacturerKey}]!`); return null; } } export function mapStateToProps(state, ownProps) { const userId = _.get(ownProps, 'currentPatientInViewId'); const user = _.get( state.blip.allUsersMap, userId, {}, ); return { user, }; } export default connect( mapStateToProps, )(PumpSettingsContainer);
{ "content_hash": "1de3ae097536bc28f9a0f0a2891ad880", "timestamp": "", "source": "github", "line_count": 105, "max_line_length": 96, "avg_line_length": 29.63809523809524, "alnum_prop": 0.6587403598971723, "repo_name": "tidepool-org/viz", "id": "156c9a006c2845eb45d38ff4de19c0b43f108b0a", "size": "3112", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src/components/settings/common/PumpSettingsContainer.js", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "CSS", "bytes": "70257" }, { "name": "Dockerfile", "bytes": "1555" }, { "name": "HTML", "bytes": "120" }, { "name": "JavaScript", "bytes": "2061229" }, { "name": "Shell", "bytes": "745" } ], "symlink_target": "" }
<?php namespace Ven7ura\Html5Boilerplate; use Illuminate\Support\ServiceProvider; class Html5BoilerplateServiceProvider extends ServiceProvider { /** * Publish the plugin configuration **/ public function boot() { $this->publishes([ __DIR__ . '/config/h5b.php' => config_path('h5b.php') ], 'config'); $this->publishes([ __DIR__ . '/views' => resource_path('views') ], 'views'); } }
{ "content_hash": "b1f2a429b7ec7f9b6228752bafdda7e6", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 65, "avg_line_length": 22.238095238095237, "alnum_prop": 0.5738758029978587, "repo_name": "ven7ura/laravel-html5-boilerplate", "id": "84fdb15a737ce41c182e590b21b2bdfe22ef55dd", "size": "467", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Html5BoilerplateServiceProvider.php", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "3147" }, { "name": "PHP", "bytes": "2401" } ], "symlink_target": "" }
.. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================== Welcome to the Heat developer documentation! ================================================== Heat is a service to :term:`orchestrate` multiple composite cloud applications using the AWS CloudFormation template format, through both an OpenStack-native ReST API and a CloudFormation-compatible Query API. What is the purpose of the project and vision for it? ===================================================== * Heat provides a template based orchestration for describing a cloud application by executing appropriate :term:`OpenStack` API calls to generate running cloud applications. * The software integrates other core components of OpenStack into a one-file template system. The templates allow creation of most OpenStack resource types (such as instances, floating ips, volumes, security groups, users, etc), as well as some more advanced functionality such as instance high availability, instance autoscaling, and nested stacks. By providing very tight integration with other OpenStack core projects, all OpenStack core projects could receive a larger user base. * Allow deployers to integrate with Heat directly or by adding custom plugins. This documentation offers information on how heat works and how to contribute to the project. Getting Started =============== .. toctree:: :maxdepth: 1 getting_started/index templates/index template_guide/index glossary Man Pages ========= .. toctree:: :maxdepth: 2 man/index Developers Documentation ======================== .. toctree:: :maxdepth: 1 architecture API Documentation ======================== - `Heat REST API Reference (OpenStack API Complete Reference - Orchestration)`_ .. _`Heat REST API Reference (OpenStack API Complete Reference - Orchestration)`: http://api.openstack.org/api-ref-orchestration.html Operations Documentation ======================== .. toctree:: :maxdepth: 1 scale_deployment Code Documentation ================== .. toctree:: :maxdepth: 3 sourcecode/autoindex Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search`
{ "content_hash": "c8cd21afdde45742e175c115fd2385a0", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 483, "avg_line_length": 33.47560975609756, "alnum_prop": 0.6790528233151184, "repo_name": "NeCTAR-RC/heat", "id": "90fafc4721ca2ec80ff7c198dd8c931df13dbf04", "size": "2745", "binary": false, "copies": "1", "ref": "refs/heads/nectar/icehouse", "path": "doc/source/index.rst", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Makefile", "bytes": "5565" }, { "name": "Python", "bytes": "4229675" }, { "name": "Shell", "bytes": "25339" } ], "symlink_target": "" }
<?xml version="1.0"?> <qualifications class="FNB99"> <qualification id="FNB20199" title="Certificate II in Financial Services"> <units/> </qualification> <qualification id="FNB30302" title="Certificate III in Financial Services (Accounts Clerical)"> <units/> </qualification> <qualification id="FNB30199" title="Certificate III in Financial Services"> <units/> </qualification> <qualification id="FNB30201" title="Certificate III in Financial Services (General Insurance)"> <units/> </qualification> <qualification id="FNB40299" title="Certificate IV in Financial Services (Personal Trust Administration)"> <units/> </qualification> <qualification id="FNB40602" title="Certificate IV in Financial Services (Accounting)"> <units/> </qualification> <qualification id="FNB40401" title="Certificate IV in Financial Services (General Insurance)"> <units/> </qualification> <qualification id="FNB40199" title="Certificate IV in Financial Services"> <units/> </qualification> <qualification id="FNB40702" title="Certificate IV in Financial Services (Financial Planning Support)"> <units/> </qualification> <qualification id="FNB40803" title="Certificate IV in Financial Services (Superannuation)"> <units/> </qualification> <qualification id="FNB40399" title="Certificate IV in Financial Services (Credit Management &amp; Mercantile Agents)"> <units/> </qualification> <qualification id="FNB40501" title="Certificate IV in Financial Services (Assessment Services)"> <units/> </qualification> <qualification id="FNB50199" title="Diploma of Financial Services"> <units/> </qualification> <qualification id="FNB50601" title="Diploma of Financial Services (Conveyancing)"> <units/> </qualification> <qualification id="FNB50499" title="Diploma of Financial Services (Distribution)"> <units/> </qualification> <qualification id="FNB50299" title="Diploma of Accounting"> <units/> </qualification> <qualification id="FNB50903" title="Diploma of Financial Services (Superannuation)"> <units/> </qualification> <qualification id="FNB50202" title="Diploma of Accounting"> <units/> </qualification> <qualification id="FNB50701" title="Diploma of Financial Services (General Insurance)"> <units/> </qualification> <qualification id="FNB50802" title="Diploma of Financial Services (Financial Planning)"> <units/> </qualification> <qualification id="FNB50599" title="Diploma of Financial Services (Loss Adjusting)"> <units/> </qualification> <qualification id="FNB50399" title="Diploma of Financial Services (Insurance Broking)"> <units/> </qualification> <qualification id="FNB60301" title="Advanced Diploma of Financial Services (Conveyancing)"> <units/> </qualification> <qualification id="FNB60503" title="Advanced Diploma of Financial Services (Superannuation)"> <units/> </qualification> <qualification id="FNB60199" title="Advanced Diploma of Financial Services"> <units/> </qualification> <qualification id="FNB60402" title="Advanced Diploma of Financial Services (Financial Planning)"> <units/> </qualification> <qualification id="FNB60299" title="Advanced Diploma of Accounting"> <units/> </qualification> <qualification id="FNB60202" title="Advanced Diploma of Accounting"> <units/> </qualification> </qualifications>
{ "content_hash": "99787df0e2b6dc797d09f86361b0642c", "timestamp": "", "source": "github", "line_count": 87, "max_line_length": 120, "avg_line_length": 39.4367816091954, "alnum_prop": 0.7228213348877878, "repo_name": "rheinardkorf/oktga", "id": "d08caab0e30e8966bb8948d678a2b9c9f6ddd9a9", "size": "3431", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "xml/FNB99_qualifications.xml", "mode": "33261", "license": "mit", "language": [ { "name": "Ruby", "bytes": "31416" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <sem:triples uri="http://www.lds.org/vrl/objects/plants/agapanthus" xmlns:sem="http://marklogic.com/semantics"> <sem:triple> <sem:subject>http://www.lds.org/vrl/objects/plants/agapanthus</sem:subject> <sem:predicate>http://www.w3.org/2004/02/skos/core#prefLabel</sem:predicate> <sem:object datatype="xsd:string" xml:lang="eng">Agapanthus</sem:object> </sem:triple> <sem:triple> <sem:subject>http://www.lds.org/vrl/objects/plants/agapanthus</sem:subject> <sem:predicate>http://www.w3.org/2004/02/skos/core#inScheme</sem:predicate> <sem:object datatype="sem:iri">http://www.lds.org/concept-scheme/vrl</sem:object> </sem:triple> <sem:triple> <sem:subject>http://www.lds.org/vrl/objects/plants/agapanthus</sem:subject> <sem:predicate>http://www.lds.org/core#entityType</sem:predicate> <sem:object datatype="sem:iri">http://www.lds.org/Topic</sem:object> </sem:triple> </sem:triples>
{ "content_hash": "5ad66e4e7d1c311f8d79a98776a1bb0b", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 111, "avg_line_length": 53.666666666666664, "alnum_prop": 0.7080745341614907, "repo_name": "freshie/ml-taxonomies", "id": "f177416fa16506a94d1d57c98d6d2e6add73ee1e", "size": "966", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "roxy/data/gospel-topical-explorer-v2/taxonomies/vrl/objects/plants/agapanthus.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "4422" }, { "name": "CSS", "bytes": "38665" }, { "name": "HTML", "bytes": "356" }, { "name": "JavaScript", "bytes": "411651" }, { "name": "Ruby", "bytes": "259121" }, { "name": "Shell", "bytes": "7329" }, { "name": "XQuery", "bytes": "857170" }, { "name": "XSLT", "bytes": "13753" } ], "symlink_target": "" }
$: << File.expand_path(File.dirname(__FILE__) + '../lib') require 'rspec' require 'active_record' require 'zeevex_reliability'
{ "content_hash": "db235e6287908d3273e0a7bb10b6c577", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 57, "avg_line_length": 21.5, "alnum_prop": 0.6744186046511628, "repo_name": "zeevex/zeevex_reliability", "id": "629e3b35950109844ff04c07f0bd5b4c0ac5751d", "size": "154", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/spec_helper.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "9321" } ], "symlink_target": "" }
// snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.] // snippet-sourceauthor:[Doug-AWS] // snippet-sourcedescription:[Runs a Lambda function.] // snippet-keyword:[AWS Lambda] // snippet-keyword:[Invoke function] // snippet-keyword:[Go] // snippet-sourcesyntax:[go] // snippet-service:[lambda] // snippet-keyword:[Code Sample] // snippet-sourcetype:[full-example] // snippet-sourcedate:[2018-03-16] package main import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/lambda" "encoding/json" "fmt" "os" "strconv" ) type getItemsRequest struct { SortBy string SortOrder string ItemsToGet int } type getItemsResponseError struct { Message string `json:"message"` } type getItemsResponseData struct { Item string `json:"item"` } type getItemsResponseBody struct { Result string `json:"result"` Data []getItemsResponseData `json:"data"` Error getItemsResponseError `json:"error"` } type getItemsResponseHeaders struct { ContentType string `json:"Content-Type"` } type getItemsResponse struct { StatusCode int `json:"statusCode"` Headers getItemsResponseHeaders `json:"headers"` Body getItemsResponseBody `json:"body"` } func main() { // Create Lambda service client sess := session.Must(session.NewSessionWithOptions(session.Options{ SharedConfigState: session.SharedConfigEnable, })) client := lambda.New(sess, &aws.Config{Region: aws.String("us-west-2")}) // Get the 10 most recent items request := getItemsRequest{"time", "descending", 10} payload, err := json.Marshal(request) if err != nil { fmt.Println("Error marshalling MyGetItemsFunction request") os.Exit(0) } result, err := client.Invoke(&lambda.InvokeInput{FunctionName: aws.String("MyGetItemsFunction"), Payload: payload}) if err != nil { fmt.Println("Error calling MyGetItemsFunction") os.Exit(0) } var resp getItemsResponse err = json.Unmarshal(result.Payload, &resp) if err != nil { fmt.Println("Error unmarshalling MyGetItemsFunction response") os.Exit(0) } // If the status code is NOT 200, the call failed if resp.StatusCode != 200 { fmt.Println("Error getting items, StatusCode: " + strconv.Itoa(resp.StatusCode)) os.Exit(0) } // If the result is failure, we got an error if resp.Body.Result == "failure" { fmt.Println("Failed to get items") os.Exit(0) } // Print out items if len(resp.Body.Data) > 0 { for i := range resp.Body.Data { fmt.Println(resp.Body.Data[i].Item) } } else { fmt.Println("There were no items") } }
{ "content_hash": "9e61375287f065e5d3f7bb1d9faa81cb", "timestamp": "", "source": "github", "line_count": 108, "max_line_length": 119, "avg_line_length": 26.555555555555557, "alnum_prop": 0.6467921896792189, "repo_name": "awsdocs/aws-doc-sdk-examples", "id": "06a7e74f6932f79ab0d1427e10e0df797a55ebbe", "size": "3390", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "go/example_code/lambda/aws-go-sdk-lambda-example-run-function.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ABAP", "bytes": "476653" }, { "name": "Batchfile", "bytes": "900" }, { "name": "C", "bytes": "3852" }, { "name": "C#", "bytes": "2051923" }, { "name": "C++", "bytes": "943634" }, { "name": "CMake", "bytes": "82068" }, { "name": "CSS", "bytes": "33378" }, { "name": "Dockerfile", "bytes": "2243" }, { "name": "Go", "bytes": "1764292" }, { "name": "HTML", "bytes": "319090" }, { "name": "Java", "bytes": "4966853" }, { "name": "JavaScript", "bytes": "1655476" }, { "name": "Jupyter Notebook", "bytes": "9749" }, { "name": "Kotlin", "bytes": "1099902" }, { "name": "Makefile", "bytes": "4922" }, { "name": "PHP", "bytes": "1220594" }, { "name": "Python", "bytes": "2507509" }, { "name": "Ruby", "bytes": "500331" }, { "name": "Rust", "bytes": "558811" }, { "name": "Shell", "bytes": "63776" }, { "name": "Swift", "bytes": "267325" }, { "name": "TypeScript", "bytes": "119632" } ], "symlink_target": "" }
/* Erica Sadun, http://ericasadun.com */ #import "ConstraintUtilities-Matching.h" #import "NSObject-Nametag.h" #pragma mark - Named Constraint Support @implementation VIEW_CLASS (NamedConstraintSupport) /// Returns first constraint with matching name /// Type not checked - (NSLayoutConstraint *) constraintNamed: (NSString *) aName { if (!aName) return nil; for (NSLayoutConstraint *constraint in self.constraints) if (constraint.nametag && [constraint.nametag isEqualToString:aName]) return constraint; // Recurse up the tree if (self.superview) return [self.superview constraintNamed:aName]; return nil; } /// Returns first constraint with matching name and view. /// Type not checked - (NSLayoutConstraint *) constraintNamed: (NSString *) aName matchingView: (VIEW_CLASS *) theView { if (!aName) return nil; for (NSLayoutConstraint *constraint in self.constraints) if (constraint.nametag && [constraint.nametag isEqualToString:aName]) { if (constraint.firstItem == theView) return constraint; if (constraint.secondItem && (constraint.secondItem == theView)) return constraint; } // Recurse up the tree if (self.superview) return [self.superview constraintNamed:aName matchingView:theView]; return nil; } /// Returns all matching constraints /// Type not checked - (NSArray *) constraintsNamed: (NSString *) aName { // For this, all constraints match a nil item if (!aName) return self.constraints; // However, constraints have to have a name to match a non-nil name NSMutableArray *array = [NSMutableArray array]; for (NSLayoutConstraint *constraint in self.constraints) if (constraint.nametag && [constraint.nametag isEqualToString:aName]) [array addObject:constraint]; // recurse upwards if (self.superview) [array addObjectsFromArray:[self.superview constraintsNamed:aName]]; return array; } /// Returns all matching constraints specific to a given view /// Type not checked - (NSArray *) constraintsNamed: (NSString *) aName matchingView: (VIEW_CLASS *) theView { // For this, all constraints match a nil item if (!aName) return self.constraints; // However, constraints have to have a name to match a non-nil name NSMutableArray *array = [NSMutableArray array]; for (NSLayoutConstraint *constraint in self.constraints) if (constraint.nametag && [constraint.nametag isEqualToString:aName]) { if (constraint.firstItem == theView) [array addObject:constraint]; else if (constraint.secondItem && (constraint.secondItem == theView)) [array addObject:constraint]; } // recurse upwards if (self.superview) [array addObjectsFromArray:[self.superview constraintsNamed:aName matchingView:theView]]; return array; } @end #pragma mark - Constraint Matching @implementation NSLayoutConstraint (ConstraintMatching) /// This ignores any priority, looking only at y (R) mx + b - (BOOL) isEqualToLayoutConstraint: (NSLayoutConstraint *) constraint { // I'm still wavering on these two checks if (![self.class isEqual:[NSLayoutConstraint class]]) return NO; if (![self.class isEqual:constraint.class]) return NO; // Compare properties if (self.firstItem != constraint.firstItem) return NO; if (self.secondItem != constraint.secondItem) return NO; if (self.firstAttribute != constraint.firstAttribute) return NO; if (self.secondAttribute != constraint.secondAttribute) return NO; if (self.relation != constraint.relation) return NO; if (self.multiplier != constraint.multiplier) return NO; if (self.constant != constraint.constant) return NO; return YES; } /// This looks at priority too - (BOOL) isEqualToLayoutConstraintConsideringPriority:(NSLayoutConstraint *)constraint { if (![self isEqualToLayoutConstraint:constraint]) return NO; return (self.priority == constraint.priority); } - (BOOL) refersToView: (VIEW_CLASS *) theView { if (!theView) return NO; if (!self.firstItem) // shouldn't happen. Illegal return NO; if (self.firstItem == theView) return YES; if (!self.secondItem) return NO; return (self.secondItem == theView); } - (BOOL) isHorizontal { return IS_HORIZONTAL_ATTRIBUTE(self.firstAttribute); } @end #pragma mark - Managing Matching Constraints @implementation VIEW_CLASS (ConstraintMatching) /// Find first matching constraint. (Priority, Archiving ignored) - (NSLayoutConstraint *) constraintMatchingConstraint: (NSLayoutConstraint *) aConstraint { NSArray *views = [@[self] arrayByAddingObjectsFromArray:self.superviews]; for (VIEW_CLASS *view in views) for (NSLayoutConstraint *constraint in view.constraints) if ([constraint isEqualToLayoutConstraint:aConstraint]) return constraint; return nil; } /// Return all constraints from self and subviews /// Call on self.window for the entire collection - (NSArray *) allConstraints { NSMutableArray *array = [NSMutableArray array]; [array addObjectsFromArray:self.constraints]; for (VIEW_CLASS *view in self.subviews) [array addObjectsFromArray:[view allConstraints]]; return array; } /// Ancestor constraints pointing to self - (NSArray *) referencingConstraintsInSuperviews { NSMutableArray *array = [NSMutableArray array]; for (VIEW_CLASS *view in self.superviews) { for (NSLayoutConstraint *constraint in view.constraints) { if (![constraint.class isEqual:[NSLayoutConstraint class]]) continue; if ([constraint refersToView:self]) [array addObject:constraint]; } } return array; } /// Ancestor *and* self constraints pointing to self - (NSArray *) referencingConstraints { NSMutableArray *array = [self.referencingConstraintsInSuperviews mutableCopy]; for (NSLayoutConstraint *constraint in self.constraints) { if (![constraint.class isEqual:[NSLayoutConstraint class]]) continue; if ([constraint refersToView:self]) [array addObject:constraint]; } return array; } /// Find all matching constraints. (Priority, archiving ignored) /// Use with arrays returned by format strings to find installed versions - (NSArray *) constraintsMatchingConstraints: (NSArray *) constraints { NSMutableArray *array = [NSMutableArray array]; for (NSLayoutConstraint *constraint in constraints) { NSLayoutConstraint *match = [self constraintMatchingConstraint:constraint]; if (match) [array addObject:match]; } return array; } /// All constraints matching view in this ascent /// See also: referencingConstraints and referencingConstraintsInSuperviews - (NSArray *) constraintsReferencingView: (VIEW_CLASS *) theView { NSMutableArray *array = [NSMutableArray array]; NSArray *views = [@[self] arrayByAddingObjectsFromArray:self.superviews]; for (VIEW_CLASS *view in views) for (NSLayoutConstraint *constraint in view.constraints) { if (![constraint.class isEqual:[NSLayoutConstraint class]]) continue; if ([constraint refersToView:theView]) [array addObject:constraint]; } return array; } /// Remove constraint - (void) removeMatchingConstraint: (NSLayoutConstraint *) aConstraint { NSLayoutConstraint *match = [self constraintMatchingConstraint:aConstraint]; if (match) [match remove]; } /// Remove constraints /// Use for removing constraings generated by format - (void) removeMatchingConstraints: (NSArray *) anArray { for (NSLayoutConstraint *constraint in anArray) [self removeMatchingConstraint:constraint]; } /// Remove constraints via name - (void) removeConstraintsNamed: (NSString *) name { NSArray *array = [self constraintsNamed:name]; for (NSLayoutConstraint *constraint in array) [constraint remove]; } /// Remove named constraints matching view - (void) removeConstraintsNamed: (NSString *) name matchingView: (VIEW_CLASS *) theView { NSArray *array = [self constraintsNamed:name matchingView:theView]; for (NSLayoutConstraint *constraint in array) [constraint remove]; } @end
{ "content_hash": "14cbfc72c18492ac2ab16b8e6ddfe860", "timestamp": "", "source": "github", "line_count": 273, "max_line_length": 97, "avg_line_length": 31.706959706959708, "alnum_prop": 0.6757162661737524, "repo_name": "AmitaiB/Librarius", "id": "f047f4c1e0ab389ebe95522b84c4f33f24732c3b", "size": "8656", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Librarius/Constraints/Constraint Matching/ConstraintUtilities-Matching.m", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "7396" }, { "name": "HTML", "bytes": "17237" }, { "name": "JavaScript", "bytes": "1782" }, { "name": "Objective-C", "bytes": "560842" }, { "name": "Ruby", "bytes": "633" }, { "name": "Swift", "bytes": "174" } ], "symlink_target": "" }
from __future__ import absolute_import import xmlrpclib import uuid from .certificate import Certificate from ..util.faults import GidInvalidParentHrn, GidParentHrn from ..util.sfalogging import logger from ..util.xrn import hrn_to_urn, urn_to_hrn, hrn_authfor_hrn ## # Create a new uuid. Returns the UUID as a string. def create_uuid(): return str(uuid.uuid4().int) ## # GID is a tuple: # (uuid, urn, public_key) # # UUID is a unique identifier and is created by the python uuid module # (or the utility function create_uuid() in gid.py). # # HRN is a human readable name. It is a dotted form similar to a backward domain # name. For example, planetlab.us.arizona.bakers. # # URN is a human readable identifier of form: # "urn:publicid:IDN+toplevelauthority[:sub-auth.]*[\res. type]\ +object name" # For example, urn:publicid:IDN+planetlab:us:arizona+user+bakers # # PUBLIC_KEY is the public key of the principal identified by the UUID/HRN. # It is a Keypair object as defined in the cert.py module. # # It is expected that there is a one-to-one pairing between UUIDs and HRN, # but it is uncertain how this would be inforced or if it needs to be enforced. # # These fields are encoded using xmlrpc into the subjectAltName field of the # x509 certificate. Note: Call encode() once the fields have been filled in # to perform this encoding. class GID(Certificate): ## # Create a new GID object # # @param create If true, create the X509 certificate # @param subject If subject!=None, create the X509 cert and set the subject name # @param string If string!=None, load the GID from a string # @param filename If filename!=None, load the GID from a file # @param lifeDays life of GID in days - default is 1825==5 years # @param email Email address to put in subjectAltName - default is None def __init__(self, create=False, subject=None, string=None, filename=None, uuid=None, hrn=None, urn=None, lifeDays=1825, email=None): self.uuid = None self.hrn = None self.urn = None self.email = None # for adding to the SubjectAltName Certificate.__init__(self, lifeDays, create, subject, string, filename) if subject: logger.debug("Creating GID for subject: %s" % subject) if uuid: self.uuid = int(uuid) if hrn: self.hrn = hrn self.urn = hrn_to_urn(hrn, 'unknown') if urn: self.urn = urn self.hrn, type = urn_to_hrn(urn) if email: self.set_email(email) def set_uuid(self, uuid): if isinstance(uuid, str): self.uuid = int(uuid) else: self.uuid = uuid def get_uuid(self): if not self.uuid: self.decode() return self.uuid def set_hrn(self, hrn): self.hrn = hrn def get_hrn(self): if not self.hrn: self.decode() return self.hrn def set_urn(self, urn): self.urn = urn self.hrn, type = urn_to_hrn(urn) def get_urn(self): if not self.urn: self.decode() return self.urn # Will be stuffed into subjectAltName def set_email(self, email): self.email = email def get_email(self): if not self.email: self.decode() return self.email def get_type(self): if not self.urn: self.decode() _, t = urn_to_hrn(self.urn) return t ## # Encode the GID fields and package them into the subject-alt-name field # of the X509 certificate. This must be called prior to signing the # certificate. It may only be called once per certificate. def encode(self): if self.urn: urn = self.urn else: urn = hrn_to_urn(self.hrn, None) str = "URI:" + urn if self.uuid: str += ", " + "URI:" + uuid.UUID(int=self.uuid).urn if self.email: str += ", " + "email:" + self.email self.set_data(str, 'subjectAltName') ## # Decode the subject-alt-name field of the X509 certificate into the # fields of the GID. This is automatically called by the various get_*() # functions in this class. def decode(self): data = self.get_data('subjectAltName') dict = {} if data: if data.lower().startswith('uri:http://<params>'): dict = xmlrpclib.loads(data[11:])[0][0] else: spl = data.split(', ') for val in spl: if val.lower().startswith('uri:urn:uuid:'): dict['uuid'] = uuid.UUID(val[4:]).int elif val.lower().startswith('uri:urn:publicid:idn+'): dict['urn'] = val[4:] elif val.lower().startswith('email:'): # FIXME: Ensure there isn't cruft in that address... # EG look for email:copy,.... dict['email'] = val[6:] self.uuid = dict.get("uuid", None) self.urn = dict.get("urn", None) self.hrn = dict.get("hrn", None) self.email = dict.get("email", None) if self.urn: self.hrn = urn_to_hrn(self.urn)[0] ## # Dump the credential to stdout. # # @param indent specifies a number of spaces to indent the output # @param dump_parents If true, also dump the parents of the GID def dump(self, *args, **kwargs): print self.dump_string(*args,**kwargs) def dump_string(self, indent=0, dump_parents=False): result=" "*(indent-2) + "GID\n" result += " "*indent + "hrn:" + str(self.get_hrn()) +"\n" result += " "*indent + "urn:" + str(self.get_urn()) +"\n" result += " "*indent + "uuid:" + str(self.get_uuid()) + "\n" if self.get_email() is not None: result += " "*indent + "email:" + str(self.get_email()) + "\n" filename=self.get_filename() if filename: result += "Filename %s\n"%filename if self.parent and dump_parents: result += " "*indent + "parent:\n" result += self.parent.dump_string(indent+4, dump_parents) return result ## # Verify the chain of authenticity of the GID. First perform the checks # of the certificate class (verifying that each parent signs the child, # etc). In addition, GIDs also confirm that the parent's HRN is a prefix # of the child's HRN, and the parent is of type 'authority'. # # Verifying these prefixes prevents a rogue authority from signing a GID # for a principal that is not a member of that authority. For example, # planetlab.us.arizona cannot sign a GID for planetlab.us.princeton.foo. def verify_chain(self, trusted_certs = None): # do the normal certificate verification stuff trusted_root = Certificate.verify_chain(self, trusted_certs) if self.parent: # make sure the parent's hrn is a prefix of the child's hrn if not hrn_authfor_hrn(self.parent.get_hrn(), self.get_hrn()): raise GidParentHrn("This cert HRN %s isn't in the namespace for parent HRN %s" % (self.get_hrn(), self.parent.get_hrn())) # Parent must also be an authority (of some type) to sign a GID # There are multiple types of authority - accept them all here if not self.parent.get_type().find('authority') == 0: raise GidInvalidParentHrn("This cert %s's parent %s is not an authority (is a %s)" % (self.get_hrn(), self.parent.get_hrn(), self.parent.get_type())) # Then recurse up the chain - ensure the parent is a trusted # root or is in the namespace of a trusted root self.parent.verify_chain(trusted_certs) else: # make sure that the trusted root's hrn is a prefix of the child's trusted_gid = GID(string=trusted_root.save_to_string()) trusted_type = trusted_gid.get_type() trusted_hrn = trusted_gid.get_hrn() #if trusted_type == 'authority': # trusted_hrn = trusted_hrn[:trusted_hrn.rindex('.')] cur_hrn = self.get_hrn() if not hrn_authfor_hrn(trusted_hrn, cur_hrn): raise GidParentHrn("Trusted root with HRN %s isn't a namespace authority for this cert: %s" % (trusted_hrn, cur_hrn)) # There are multiple types of authority - accept them all here if not trusted_type.find('authority') == 0: raise GidInvalidParentHrn("This cert %s's trusted root signer %s is not an authority (is a %s)" % (self.get_hrn(), trusted_hrn, trusted_type)) return
{ "content_hash": "12c5b94f018b1bd075002744b4547805", "timestamp": "", "source": "github", "line_count": 233, "max_line_length": 165, "avg_line_length": 37.97424892703863, "alnum_prop": 0.5906419529837251, "repo_name": "ahelsing/geni-tools", "id": "7a740a9480d64013ea153995da2c00a143532ff6", "size": "10204", "binary": false, "copies": "4", "ref": "refs/heads/develop", "path": "src/gcf/sfa/trust/gid.py", "mode": "33188", "license": "mit", "language": [ { "name": "Inno Setup", "bytes": "87278" }, { "name": "Python", "bytes": "2610833" }, { "name": "Shell", "bytes": "12644" }, { "name": "Visual Basic", "bytes": "668" } ], "symlink_target": "" }
#region copyright // (C) Copyright 2015 Dinu Marius-Constantin (http://dinu.at) and others. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Contributors: // Dinu Marius-Constantin // Wurm Florian #endregion using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("UFO.Server")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("UFO.Server")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("75df68f2-a526-469f-9cab-35ebbaa3f9e6")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
{ "content_hash": "4d20d78bfd52869a78e20527c72a7f9f", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 84, "avg_line_length": 38.61818181818182, "alnum_prop": 0.7396421845574388, "repo_name": "untitled-no1/ufo", "id": "0b3d067aa3879567649ae28e25745e148091fbd9", "size": "2127", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "ufo/UFO.Server/UFO.Server.Dal/Properties/AssemblyInfo.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "55732" }, { "name": "C#", "bytes": "336122" }, { "name": "CSS", "bytes": "3076" }, { "name": "HTML", "bytes": "22410" }, { "name": "Java", "bytes": "121941" }, { "name": "JavaScript", "bytes": "986" }, { "name": "PLpgSQL", "bytes": "9772" } ], "symlink_target": "" }
from ciscoconfparse import CiscoConfParse import re cisco_cfg = CiscoConfParse("cisco-config-assignment1.txt") crypto_cfg = cisco_cfg.find_objects(r"^crypto map") print "All Crypto Maps:\n" for i in crypto_cfg: print i.text for j in i.children: print j.text print "\n\nCrypto maps using PFS Group 2:\n" group2 = cisco_cfg.find_objects_w_child(r"^crypto map", r"pfs group2") for i in group2: print i.text for j in i.children: print j.text print "\n\nCrypto maps not using AES:\n" not_aes = cisco_cfg.find_objects_wo_child(r"^crypto map", r"AES-SHA") for i in not_aes: for j in i.children: if 'transform' in j.text: print i.text print j.text
{ "content_hash": "a0c38ed558c0bd390912cb35c82b4a5d", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 70, "avg_line_length": 23.03030303030303, "alnum_prop": 0.6223684210526316, "repo_name": "jon-burgess-execulink/pynet-class", "id": "df7e17ab59c4f7f81299227399f34e669dced2a5", "size": "783", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "class1/class1-ciscoconfparse.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "10123" } ], "symlink_target": "" }
class TextureLoader { public: static GLuint LoadTexture(const std::string&); };
{ "content_hash": "c2bad17cafd7e8c7a1a5492270a14113", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 47, "avg_line_length": 16.2, "alnum_prop": 0.7530864197530864, "repo_name": "HarryGogonis/YAGE", "id": "13916a3912ba6ec35e6ee5449d751926dda57ccb", "size": "170", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "OpenGL_01/Rendering/Util/TextureLoader.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "538186" }, { "name": "C++", "bytes": "3436874" }, { "name": "CMake", "bytes": "28121" }, { "name": "GLSL", "bytes": "5582" }, { "name": "HTML", "bytes": "64248" }, { "name": "Lua", "bytes": "977" }, { "name": "Makefile", "bytes": "1422" }, { "name": "Objective-C", "bytes": "40098" } ], "symlink_target": "" }
""" Kubernetes No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: release-1.25 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six from kubernetes.client.configuration import Configuration class V1ExecAction(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ openapi_types = { 'command': 'list[str]' } attribute_map = { 'command': 'command' } def __init__(self, command=None, local_vars_configuration=None): # noqa: E501 """V1ExecAction - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._command = None self.discriminator = None if command is not None: self.command = command @property def command(self): """Gets the command of this V1ExecAction. # noqa: E501 Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy. # noqa: E501 :return: The command of this V1ExecAction. # noqa: E501 :rtype: list[str] """ return self._command @command.setter def command(self, command): """Sets the command of this V1ExecAction. Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy. # noqa: E501 :param command: The command of this V1ExecAction. # noqa: E501 :type: list[str] """ self._command = command def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict()) def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, V1ExecAction): return False return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, V1ExecAction): return True return self.to_dict() != other.to_dict()
{ "content_hash": "cbd591bf1965201edc0d1a232154811d", "timestamp": "", "source": "github", "line_count": 120, "max_line_length": 417, "avg_line_length": 34.708333333333336, "alnum_prop": 0.5983193277310924, "repo_name": "kubernetes-client/python", "id": "decec2edfe5fdbc76c56df6af18d8b825e44d40c", "size": "4182", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "kubernetes/client/models/v1_exec_action.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "356" }, { "name": "Python", "bytes": "11454299" }, { "name": "Shell", "bytes": "43108" } ], "symlink_target": "" }
import uuid # from openstackclient.tests.functional import base from openstackclient.tests.functional.object.v1 import common class ContainerTests(common.ObjectStoreTests): """Functional tests for Object Store container commands""" NAME = uuid.uuid4().hex @classmethod def setUpClass(cls): super(ContainerTests, cls).setUpClass() if cls.haz_object_store: opts = cls.get_opts(['container']) raw_output = cls.openstack('container create ' + cls.NAME + opts) cls.assertOutput(cls.NAME + '\n', raw_output) @classmethod def tearDownClass(cls): try: if cls.haz_object_store: raw_output = cls.openstack('container delete ' + cls.NAME) cls.assertOutput('', raw_output) finally: super(ContainerTests, cls).tearDownClass() def setUp(self): super(ContainerTests, self).setUp() # Skip tests if no object-store is present if not self.haz_object_store: self.skipTest("No object-store service present") def test_container_list(self): opts = self.get_opts(['Name']) raw_output = self.openstack('container list' + opts) self.assertIn(self.NAME, raw_output) def test_container_show(self): opts = self.get_opts(['container']) raw_output = self.openstack('container show ' + self.NAME + opts) self.assertEqual(self.NAME + "\n", raw_output)
{ "content_hash": "f163612b023cacb02ee3b4d574d5a545", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 77, "avg_line_length": 35.04761904761905, "alnum_prop": 0.6290760869565217, "repo_name": "dtroyer/python-openstackclient", "id": "d66aa842b067e09ed489de91f260bd9ad81f330f", "size": "2045", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "openstackclient/tests/functional/object/v1/test_container.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "4040230" }, { "name": "Shell", "bytes": "299" } ], "symlink_target": "" }
// Copyright Frank Mori Hess 2007-2008. // Copyright Timmo Stange 2007. // Copyright Douglas Gregor 2001-2004. Use, modification and // distribution is subject to the Boost Software License, Version // 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // For more information, see http://www.boost.org #ifndef BOOST_SIGNALS2_SLOT_BASE_HPP #define BOOST_SIGNALS2_SLOT_BASE_HPP #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> #include <boost/signals2/expired_slot.hpp> #include <boost/signals2/signal_base.hpp> #include <boost/throw_exception.hpp> #include <vector> namespace boost { namespace signals2 { namespace detail { class tracked_objects_visitor; } class slot_base { public: typedef std::vector<boost::weak_ptr<void> > tracked_container_type; typedef std::vector<boost::shared_ptr<void> > locked_container_type; const tracked_container_type& tracked_objects() const {return _tracked_objects;} locked_container_type lock() const { locked_container_type locked_objects; tracked_container_type::const_iterator it; for(it = tracked_objects().begin(); it != tracked_objects().end(); ++it) { try { locked_objects.push_back(shared_ptr<void>(*it)); } catch(const bad_weak_ptr &) { boost::throw_exception(expired_slot()); } } return locked_objects; } bool expired() const { tracked_container_type::const_iterator it; for(it = tracked_objects().begin(); it != tracked_objects().end(); ++it) { if(it->expired()) return true; } return false; } protected: friend class detail::tracked_objects_visitor; void track_signal(const signal_base &signal) { _tracked_objects.push_back(signal.lock_pimpl()); } tracked_container_type _tracked_objects; }; } } // end namespace boost #endif // BOOST_SIGNALS2_SLOT_BASE_HPP
{ "content_hash": "3d29721d978f894bf0ab3bbb85356857", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 86, "avg_line_length": 28.513157894736842, "alnum_prop": 0.6045223811721273, "repo_name": "benkaraban/anima-games-engine", "id": "6cef4b4ee61b092d7383f40c4ec286d09a2bf364", "size": "2194", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "LibsExternes/Includes/boost/signals2/slot_base.hpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "8772269" }, { "name": "C#", "bytes": "125904" }, { "name": "C++", "bytes": "74431764" }, { "name": "CMake", "bytes": "43555" }, { "name": "Java", "bytes": "95806" }, { "name": "Makefile", "bytes": "17914" }, { "name": "NSIS", "bytes": "17188" }, { "name": "Objective-C", "bytes": "50195" }, { "name": "Perl", "bytes": "6275" }, { "name": "Python", "bytes": "22678" }, { "name": "Shell", "bytes": "21728" } ], "symlink_target": "" }
package org.apache.bookkeeper.common.concurrent; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import com.google.common.base.Stopwatch; import com.google.common.collect.Lists; import java.io.IOException; import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Function; import java.util.stream.LongStream; import org.apache.bookkeeper.common.util.OrderedScheduler; import org.apache.bookkeeper.common.util.SafeRunnable; import org.apache.bookkeeper.stats.OpStatsLogger; import org.junit.Test; /** * Unit Test for {@link FutureUtils}. */ public class TestFutureUtils { /** * Test Exception. */ static class TestException extends IOException { private static final long serialVersionUID = -6256482498453846308L; public TestException() { super("test-exception"); } } @Test public void testComplete() throws Exception { CompletableFuture<Long> future = FutureUtils.createFuture(); FutureUtils.complete(future, 1024L); assertEquals(1024L, FutureUtils.result(future).longValue()); } @Test(expected = TestException.class) public void testCompleteExceptionally() throws Exception { CompletableFuture<Long> future = FutureUtils.createFuture(); FutureUtils.completeExceptionally(future, new TestException()); FutureUtils.result(future); } @Test public void testWhenCompleteAsync() throws Exception { OrderedScheduler scheduler = OrderedScheduler.newSchedulerBuilder() .name("test-when-complete-async") .numThreads(1) .build(); AtomicLong resultHolder = new AtomicLong(0L); CountDownLatch latch = new CountDownLatch(1); CompletableFuture<Long> future = FutureUtils.createFuture(); FutureUtils.whenCompleteAsync( future, (result, cause) -> { resultHolder.set(result); latch.countDown(); }, scheduler, new Object()); FutureUtils.complete(future, 1234L); latch.await(); assertEquals(1234L, resultHolder.get()); } @Test public void testProxyToSuccess() throws Exception { CompletableFuture<Long> src = FutureUtils.createFuture(); CompletableFuture<Long> target = FutureUtils.createFuture(); FutureUtils.proxyTo(src, target); FutureUtils.complete(src, 10L); assertEquals(10L, FutureUtils.result(target).longValue()); } @Test(expected = TestException.class) public void testProxyToFailure() throws Exception { CompletableFuture<Long> src = FutureUtils.createFuture(); CompletableFuture<Long> target = FutureUtils.createFuture(); FutureUtils.proxyTo(src, target); FutureUtils.completeExceptionally(src, new TestException()); FutureUtils.result(target); } @Test public void testVoid() throws Exception { CompletableFuture<Void> voidFuture = FutureUtils.Void(); assertTrue(voidFuture.isDone()); assertFalse(voidFuture.isCompletedExceptionally()); assertFalse(voidFuture.isCancelled()); } @Test public void testCollectEmptyList() throws Exception { List<CompletableFuture<Integer>> futures = Lists.newArrayList(); List<Integer> result = FutureUtils.result(FutureUtils.collect(futures)); assertTrue(result.isEmpty()); } @Test public void testCollectTenItems() throws Exception { List<CompletableFuture<Integer>> futures = Lists.newArrayList(); List<Integer> expectedResults = Lists.newArrayList(); for (int i = 0; i < 10; i++) { futures.add(FutureUtils.value(i)); expectedResults.add(i); } List<Integer> results = FutureUtils.result(FutureUtils.collect(futures)); assertEquals(expectedResults, results); } @Test(expected = TestException.class) public void testCollectFailures() throws Exception { List<CompletableFuture<Integer>> futures = Lists.newArrayList(); List<Integer> expectedResults = Lists.newArrayList(); for (int i = 0; i < 10; i++) { if (i == 9) { futures.add(FutureUtils.value(i)); } else { futures.add(FutureUtils.exception(new TestException())); } expectedResults.add(i); } FutureUtils.result(FutureUtils.collect(futures)); } @Test public void testWithinAlreadyDone() throws Exception { OrderedScheduler scheduler = mock(OrderedScheduler.class); CompletableFuture<Long> doneFuture = FutureUtils.value(1234L); CompletableFuture<Long> withinFuture = FutureUtils.within( doneFuture, 10, TimeUnit.MILLISECONDS, new TestException(), scheduler, 1234L); TimeUnit.MILLISECONDS.sleep(20); assertTrue(withinFuture.isDone()); assertFalse(withinFuture.isCancelled()); assertFalse(withinFuture.isCompletedExceptionally()); verify(scheduler, times(0)) .scheduleOrdered(eq(1234L), isA(SafeRunnable.class), eq(10), eq(TimeUnit.MILLISECONDS)); } @Test public void testWithinZeroTimeout() throws Exception { OrderedScheduler scheduler = mock(OrderedScheduler.class); CompletableFuture<Long> newFuture = FutureUtils.createFuture(); CompletableFuture<Long> withinFuture = FutureUtils.within( newFuture, 0, TimeUnit.MILLISECONDS, new TestException(), scheduler, 1234L); TimeUnit.MILLISECONDS.sleep(20); assertFalse(withinFuture.isDone()); assertFalse(withinFuture.isCancelled()); assertFalse(withinFuture.isCompletedExceptionally()); verify(scheduler, times(0)) .scheduleOrdered(eq(1234L), isA(SafeRunnable.class), eq(10), eq(TimeUnit.MILLISECONDS)); } @Test public void testWithinCompleteBeforeTimeout() throws Exception { OrderedScheduler scheduler = mock(OrderedScheduler.class); ScheduledFuture<?> scheduledFuture = mock(ScheduledFuture.class); when(scheduler.scheduleOrdered(any(Object.class), any(SafeRunnable.class), anyLong(), any(TimeUnit.class))) .thenAnswer(invocationOnMock -> scheduledFuture); CompletableFuture<Long> newFuture = FutureUtils.createFuture(); CompletableFuture<Long> withinFuture = FutureUtils.within( newFuture, Long.MAX_VALUE, TimeUnit.MILLISECONDS, new TestException(), scheduler, 1234L); assertFalse(withinFuture.isDone()); assertFalse(withinFuture.isCancelled()); assertFalse(withinFuture.isCompletedExceptionally()); newFuture.complete(5678L); assertTrue(withinFuture.isDone()); assertFalse(withinFuture.isCancelled()); assertFalse(withinFuture.isCompletedExceptionally()); assertEquals((Long) 5678L, FutureUtils.result(withinFuture)); verify(scheduledFuture, times(1)) .cancel(eq(true)); } @Test public void testIgnoreSuccess() { CompletableFuture<Long> underlyFuture = FutureUtils.createFuture(); CompletableFuture<Void> ignoredFuture = FutureUtils.ignore(underlyFuture); underlyFuture.complete(1234L); assertTrue(ignoredFuture.isDone()); assertFalse(ignoredFuture.isCompletedExceptionally()); assertFalse(ignoredFuture.isCancelled()); } @Test public void testIgnoreFailure() { CompletableFuture<Long> underlyFuture = FutureUtils.createFuture(); CompletableFuture<Void> ignoredFuture = FutureUtils.ignore(underlyFuture); underlyFuture.completeExceptionally(new TestException()); assertTrue(ignoredFuture.isDone()); assertFalse(ignoredFuture.isCompletedExceptionally()); assertFalse(ignoredFuture.isCancelled()); } @Test public void testEnsureSuccess() throws Exception { CountDownLatch ensureLatch = new CountDownLatch(1); CompletableFuture<Long> underlyFuture = FutureUtils.createFuture(); CompletableFuture<Long> ensuredFuture = FutureUtils.ensure(underlyFuture, () -> { ensureLatch.countDown(); }); underlyFuture.complete(1234L); FutureUtils.result(ensuredFuture); assertTrue(ensuredFuture.isDone()); assertFalse(ensuredFuture.isCompletedExceptionally()); assertFalse(ensuredFuture.isCancelled()); ensureLatch.await(); } @Test public void testEnsureFailure() throws Exception { CountDownLatch ensureLatch = new CountDownLatch(1); CompletableFuture<Long> underlyFuture = FutureUtils.createFuture(); CompletableFuture<Long> ensuredFuture = FutureUtils.ensure(underlyFuture, () -> { ensureLatch.countDown(); }); underlyFuture.completeExceptionally(new TestException()); FutureUtils.result(FutureUtils.ignore(ensuredFuture)); assertTrue(ensuredFuture.isDone()); assertTrue(ensuredFuture.isCompletedExceptionally()); assertFalse(ensuredFuture.isCancelled()); ensureLatch.await(); } @Test @SuppressWarnings("unchecked") public void testRescueSuccess() throws Exception { CompletableFuture<Long> underlyFuture = FutureUtils.createFuture(); Function<Throwable, CompletableFuture<Long>> rescueFuc = mock(Function.class); CompletableFuture<Long> rescuedFuture = FutureUtils.rescue(underlyFuture, rescueFuc); underlyFuture.complete(1234L); FutureUtils.result(rescuedFuture); assertTrue(rescuedFuture.isDone()); assertFalse(rescuedFuture.isCompletedExceptionally()); assertFalse(rescuedFuture.isCancelled()); verify(rescueFuc, times(0)).apply(any(Throwable.class)); } @Test public void testRescueFailure() throws Exception { CompletableFuture<Long> futureCompletedAtRescue = FutureUtils.value(3456L); CompletableFuture<Long> underlyFuture = FutureUtils.createFuture(); CompletableFuture<Long> rescuedFuture = FutureUtils.rescue(underlyFuture, (cause) -> futureCompletedAtRescue); underlyFuture.completeExceptionally(new TestException()); FutureUtils.result(rescuedFuture); assertTrue(rescuedFuture.isDone()); assertFalse(rescuedFuture.isCompletedExceptionally()); assertFalse(rescuedFuture.isCancelled()); assertEquals((Long) 3456L, FutureUtils.result(rescuedFuture)); } @Test public void testStatsSuccess() throws Exception { OpStatsLogger statsLogger = mock(OpStatsLogger.class); CompletableFuture<Long> underlyFuture = FutureUtils.createFuture(); CompletableFuture<Long> statsFuture = FutureUtils.stats( underlyFuture, statsLogger, Stopwatch.createStarted()); underlyFuture.complete(1234L); FutureUtils.result(statsFuture); verify(statsLogger, times(1)) .registerSuccessfulEvent(anyLong(), eq(TimeUnit.MICROSECONDS)); } @Test public void testStatsFailure() throws Exception { OpStatsLogger statsLogger = mock(OpStatsLogger.class); CompletableFuture<Long> underlyFuture = FutureUtils.createFuture(); CompletableFuture<Long> statsFuture = FutureUtils.stats( underlyFuture, statsLogger, Stopwatch.createStarted()); underlyFuture.completeExceptionally(new TestException()); FutureUtils.result(FutureUtils.ignore(statsFuture)); verify(statsLogger, times(1)) .registerFailedEvent(anyLong(), eq(TimeUnit.MICROSECONDS)); } @Test public void testProcessListSuccess() throws Exception { List<Long> longList = Lists.newArrayList(LongStream.range(0L, 10L).iterator()); List<Long> expectedList = Lists.transform( longList, aLong -> 2 * aLong); Function<Long, CompletableFuture<Long>> sumFunc = value -> FutureUtils.value(2 * value); CompletableFuture<List<Long>> totalFuture = FutureUtils.processList( longList, sumFunc, null); assertEquals(expectedList, FutureUtils.result(totalFuture)); } @Test public void testProcessEmptyList() throws Exception { List<Long> longList = Lists.newArrayList(); List<Long> expectedList = Lists.transform( longList, aLong -> 2 * aLong); Function<Long, CompletableFuture<Long>> sumFunc = value -> FutureUtils.value(2 * value); CompletableFuture<List<Long>> totalFuture = FutureUtils.processList( longList, sumFunc, null); assertEquals(expectedList, FutureUtils.result(totalFuture)); } @Test public void testProcessListFailures() throws Exception { List<Long> longList = Lists.newArrayList(LongStream.range(0L, 10L).iterator()); AtomicLong total = new AtomicLong(0L); Function<Long, CompletableFuture<Long>> sumFunc = value -> { if (value < 5) { total.addAndGet(value); return FutureUtils.value(2 * value); } else { return FutureUtils.exception(new TestException()); } }; CompletableFuture<List<Long>> totalFuture = FutureUtils.processList( longList, sumFunc, null); try { FutureUtils.result(totalFuture); fail("Should fail with TestException"); } catch (TestException te) { // as expected } assertEquals(10L, total.get()); } }
{ "content_hash": "b985a7f2b9c6ce8313ef989905831447", "timestamp": "", "source": "github", "line_count": 371, "max_line_length": 118, "avg_line_length": 39.17250673854448, "alnum_prop": 0.6675841189018097, "repo_name": "ivankelly/bookkeeper", "id": "fe11e5ac8593ef00529b9ef91b6c40c73e8cf00b", "size": "15338", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "bookkeeper-common/src/test/java/org/apache/bookkeeper/common/concurrent/TestFutureUtils.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C++", "bytes": "323853" }, { "name": "Java", "bytes": "3185683" }, { "name": "Shell", "bytes": "91199" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_14) on Sun Nov 21 13:28:21 BRST 2010 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> Uses of Class detectores.DetNomeNumeros (EnderecoLimpo) </TITLE> <META NAME="date" CONTENT="2010-11-21"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class detectores.DetNomeNumeros (EnderecoLimpo)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../detectores/DetNomeNumeros.html" title="class in detectores"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?detectores/\class-useDetNomeNumeros.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="DetNomeNumeros.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>detectores.DetNomeNumeros</B></H2> </CENTER> No usage of detectores.DetNomeNumeros <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../detectores/DetNomeNumeros.html" title="class in detectores"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?detectores/\class-useDetNomeNumeros.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="DetNomeNumeros.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
{ "content_hash": "44b3ba4453e32c92ea8520b24183b77b", "timestamp": "", "source": "github", "line_count": 145, "max_line_length": 183, "avg_line_length": 40.6551724137931, "alnum_prop": 0.6144189991518236, "repo_name": "chazgps/EnderecoLimpo", "id": "3bfb85e4dd9f5e0a2403c42e1ba11ad8675b3c19", "size": "5895", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "EnderecoLimpo/dist/javadoc/detectores/class-use/DetNomeNumeros.html", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "117411" } ], "symlink_target": "" }
package org.camunda.commons.testing; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface WatchLogger { String[] loggerNames() default {}; String level(); }
{ "content_hash": "66efa45b831b49c9f1bdb98c5cbff387", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 44, "avg_line_length": 22.3125, "alnum_prop": 0.7927170868347339, "repo_name": "camunda/camunda-commons", "id": "e91eb408efb435f53c7389d8b5a728f42d131df1", "size": "1164", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "testing/src/main/java/org/camunda/commons/testing/WatchLogger.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "65947" } ], "symlink_target": "" }
$TOKEN=(cat C:\vagrant\config\swarm-token) $ip=(Get-NetIPAddress -AddressFamily IPv4 ` | Where-Object -FilterScript { $_.InterfaceAlias -Ne "vEthernet (HNS Internal NIC)" } ` | Where-Object -FilterScript { $_.IPAddress -Ne "127.0.0.1" } ` | Where-Object -FilterScript { $_.IPAddress -Ne "10.0.2.15" } ` ).IPAddress Write-Host "Adding host $($ip):2375 to swarm" docker run --restart=always -d stefanscherer/swarm-windows:1.2.6-nano join "--addr=$($ip):2375" "token://$TOKEN"
{ "content_hash": "c5195eed93282b55f68b10c28eb0e8be", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 112, "avg_line_length": 54.111111111111114, "alnum_prop": 0.6735112936344969, "repo_name": "StefanScherer/docker-windows-box", "id": "dfd4421b4c860e5b5c7d1cf05e6b3a905af1dad6", "size": "487", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "swarm-demo/scripts/run-swarm-agent.ps1", "mode": "33188", "license": "mit", "language": [ { "name": "PowerShell", "bytes": "41984" }, { "name": "Ruby", "bytes": "18440" }, { "name": "Shell", "bytes": "3866" } ], "symlink_target": "" }
#include "El.hpp" namespace El { namespace qp { namespace affine { template<typename Real> void IPF ( const Matrix<Real>& Q, const Matrix<Real>& A, const Matrix<Real>& G, const Matrix<Real>& b, const Matrix<Real>& c, const Matrix<Real>& h, Matrix<Real>& x, Matrix<Real>& y, Matrix<Real>& z, Matrix<Real>& s, const IPFCtrl<Real>& ctrl=IPFCtrl<Real>() ); template<typename Real> void IPF ( const AbstractDistMatrix<Real>& Q, const AbstractDistMatrix<Real>& A, const AbstractDistMatrix<Real>& G, const AbstractDistMatrix<Real>& b, const AbstractDistMatrix<Real>& c, const AbstractDistMatrix<Real>& h, AbstractDistMatrix<Real>& x, AbstractDistMatrix<Real>& y, AbstractDistMatrix<Real>& z, AbstractDistMatrix<Real>& s, const IPFCtrl<Real>& ctrl=IPFCtrl<Real>() ); template<typename Real> void IPF ( const SparseMatrix<Real>& Q, const SparseMatrix<Real>& A, const SparseMatrix<Real>& G, const Matrix<Real>& b, const Matrix<Real>& c, const Matrix<Real>& h, Matrix<Real>& x, Matrix<Real>& y, Matrix<Real>& z, Matrix<Real>& s, const IPFCtrl<Real>& ctrl=IPFCtrl<Real>() ); template<typename Real> void IPF ( const DistSparseMatrix<Real>& Q, const DistSparseMatrix<Real>& A, const DistSparseMatrix<Real>& G, const DistMultiVec<Real>& b, const DistMultiVec<Real>& c, const DistMultiVec<Real>& h, DistMultiVec<Real>& x, DistMultiVec<Real>& y, DistMultiVec<Real>& z, DistMultiVec<Real>& s, const IPFCtrl<Real>& ctrl=IPFCtrl<Real>() ); template<typename Real> void Mehrotra ( const Matrix<Real>& Q, const Matrix<Real>& A, const Matrix<Real>& G, const Matrix<Real>& b, const Matrix<Real>& c, const Matrix<Real>& h, Matrix<Real>& x, Matrix<Real>& y, Matrix<Real>& z, Matrix<Real>& s, const MehrotraCtrl<Real>& ctrl=MehrotraCtrl<Real>() ); template<typename Real> void Mehrotra ( const AbstractDistMatrix<Real>& Q, const AbstractDistMatrix<Real>& A, const AbstractDistMatrix<Real>& G, const AbstractDistMatrix<Real>& b, const AbstractDistMatrix<Real>& c, const AbstractDistMatrix<Real>& h, AbstractDistMatrix<Real>& x, AbstractDistMatrix<Real>& y, AbstractDistMatrix<Real>& z, AbstractDistMatrix<Real>& s, const MehrotraCtrl<Real>& ctrl=MehrotraCtrl<Real>() ); template<typename Real> void Mehrotra ( const SparseMatrix<Real>& Q, const SparseMatrix<Real>& A, const SparseMatrix<Real>& G, const Matrix<Real>& b, const Matrix<Real>& c, const Matrix<Real>& h, Matrix<Real>& x, Matrix<Real>& y, Matrix<Real>& z, Matrix<Real>& s, const MehrotraCtrl<Real>& ctrl=MehrotraCtrl<Real>() ); template<typename Real> void Mehrotra ( const DistSparseMatrix<Real>& Q, const DistSparseMatrix<Real>& A, const DistSparseMatrix<Real>& G, const DistMultiVec<Real>& b, const DistMultiVec<Real>& c, const DistMultiVec<Real>& h, DistMultiVec<Real>& x, DistMultiVec<Real>& y, DistMultiVec<Real>& z, DistMultiVec<Real>& s, const MehrotraCtrl<Real>& ctrl=MehrotraCtrl<Real>() ); } // namespace affine } // namespace qp } // namespace El
{ "content_hash": "c766f4acb7d845c7b632a8d407b54038", "timestamp": "", "source": "github", "line_count": 116, "max_line_length": 56, "avg_line_length": 28.017241379310345, "alnum_prop": 0.6615384615384615, "repo_name": "birm/Elemental", "id": "6c4527782ef5e98db6df3d8860ef4a41b6348e48", "size": "3514", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/optimization/solvers/QP/affine/IPM.hpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "765465" }, { "name": "C++", "bytes": "7506377" }, { "name": "CMake", "bytes": "191511" }, { "name": "Makefile", "bytes": "313" }, { "name": "Matlab", "bytes": "13306" }, { "name": "Python", "bytes": "954574" }, { "name": "Ruby", "bytes": "1393" }, { "name": "Shell", "bytes": "1335" }, { "name": "TeX", "bytes": "23728" } ], "symlink_target": "" }
ACCEPTED #### According to Index Fungorum #### Published in Biblthca Mycol. 90: 419 (1982) #### Original name Omphalina microsperma var. microsperma Arnolds ### Remarks null
{ "content_hash": "e289235a21670f4ea6fc0ab0988f3a17", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 46, "avg_line_length": 13.615384615384615, "alnum_prop": 0.7288135593220338, "repo_name": "mdoering/backbone", "id": "256082a681b15d29818f7154dd21cee4058cddc8", "size": "247", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Basidiomycota/Agaricomycetes/Agaricales/Tricholomataceae/Omphalina/Omphalina microsperma/Omphalina microsperma microsperma/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <LicenseInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ProductName>Json.NET</ProductName> <ProductHome>http://www.newtonsoft.com/json</ProductHome> <License>MIT License https://opensource.org/licenses/MIT </License> <LicenseText> The MIT License (MIT) Copyright (c) 2007 James Newton-King 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, distribute, sublicense, and/or sell copies of the Software, 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, 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, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. </LicenseText> </LicenseInfo>
{ "content_hash": "f026e719bcc7fe1d3483cec5de95bc67", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 464, "avg_line_length": 81.83333333333333, "alnum_prop": 0.7746096401900883, "repo_name": "trondr/NCmdLiner.SolutionTemplates", "id": "047e04b191cedd6cdddaa8d4ba5a34b80fe4cb51", "size": "1475", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "Client Service Application/src/_S_ConsoleProjectName_S_/License/09. Json.NET License.xml", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "4680" }, { "name": "C#", "bytes": "383946" }, { "name": "HTML", "bytes": "18060" }, { "name": "PowerShell", "bytes": "100829" }, { "name": "Smalltalk", "bytes": "1820" } ], "symlink_target": "" }
`id8.Class` – as the name suggests – is a convenience method for creating "JavaScript Classes" which mimic classical inheritance: while maintaining the advantages of prototypical inheritance. `id8.Class` accepts two parameters. An **optional** parameter – `path`, which should always be the first parameter, if supplied – defining the name and namespace of the Class, e.g. `id8.Observer` would create a Class called `Observer` under the `id8` namespace. If no `path` is specified, then the Class is simply returned by the `id8.Class` method. The `descriptor` parameter is mandatory and can be either the first parameter – if no `path` is given – or the second. The `descriptor` Object will contain all your properties and methods which will be added to your Class' prototype. The `descriptor` Object also accepts property descriptors as defined for use with [Object.defineProperty](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/defineProperty), see the code for [id8.Hash](https://github.com/constantology/id8/blob/master/src/id8.Hash.js) for an example of using property descriptors in your `id8.Class` descriptor. ## default descriptor options The descriptor has the following **reserved** property names: <table border="0" cellpadding="0" cellspacing="0" width="100%"> <thead><tr><th>property</th><th>type</th><th>description</th></tr></thead> <tbody> <tr><td width="128">constructor</td><td width="96">Function</td><td>This Class' constructor. This is the method that is called when you do: <code>new Foo</code>.</td></tr> <tr><td>extend</td><td>Class|String</td><td><strong>OPTIONAL</strong>. If you want to inherit the properties and methods from an existing Class you reference the Class here.</td></tr> <tr><td>mixin</td><td>Object</td><td><strong>OPTIONAL</strong>. An Object of properties and methods to mix into the Class' prototype.</td></tr> <tr><td>module</td><td>Object</td><td><strong>OPTIONAL</strong>. If you're building functionality to run within Node, then you may fall into issues with your Class' namespace <code>path</code> being <code>bless</code>ed on <code>m8</code>'s Module, rather than your Class' Module. See <strong>Assigning the correct module</strong> below for more information on getting around this.</td></tr> <tr><td>chain</td><td>Boolean</td><td><strong>OPTIONAL</strong>. Unless this is set explicitly to <code>false</code>, the id8.Class instance will return its context – <code>this</code> – Object whenever an instance method of a id8.Class returns <code>undefined</code>.</td></tr> <tr><td>singleton</td><td>Mixed</td><td><strong>OPTIONAL</strong>. Whether or not this Class is a <a href="http://en.wikipedia.org/wiki/Singleton_pattern">Singleton</a>.<br /> If you want a Singleton set this property to be either <code>true</code> or to an Array of arguments you wish to pass to the constructor Function.<br /> <strong>NOTE:</strong> <code>id8.Class</code> will internally resolve any attempt to create a new instance of the singleton by simply returning the existing singleton instance.</td></tr> <tr><td>type</td><td>String</td><td><strong>OPTIONAL</strong>. The type you want your Class instances to return when they are passed to <code>Object.type</code>.<br /> If you pass a <code>path</code> to <code>id8.Class</code> then the <code>type</code> will be created from this.<br /> However, if a <code>type</code> is also supplied it will overwrite the <code>type</code> created from the <code>path</code>.</td></tr> <tr><td>parent</td><td>Function</td><td>This is a special reserved method for calling <code>super</code> methods. Since <code>super</code> is a reserved word in JavaScript, <code>parent</code> has been used in its place.</td></tr> </tbody> </table> ## id8.Class methods These are the methods available on a newly created `id8.Class` ### create( [arg1:Mixed, arg2:Mixed, ..., argN:Mixed] ):ClassInstance A `create` factory method is added to your Class constructor to allow you to: - create an instance of a class using an arbitrary number of arguments; or - not have to use the `new` constructor – if you're one of those developers who thinks it's some type of JavaScript faux pas to use the `new` constructor. See the **id8.Class Examples** below on how to create `id8.Class` instances using the `create` factory on your class or the global `id8` factory. See the **long winded argument** below to (hopefully) answer any questions or complaints you have regarding mimicing classical inheritance in JavaScript. ## instance properties ### this.__super If by any chance you require access to a super class' methods or properties, you can access them from the `__super` property on your Class instance. The `__super` property is read only and is available on the Class `constructor` as well as instances of a Class. See the **id8.Class examples** below for examples. ## instance methods ### this.parent() When you create an instance of a Class created with `id8.Class` you can access the `super` method of a Class you are extending by calling: ```javascript this.parent( arg1, arg2, ..., argN ); ``` Context will be maintained correctyl, unless you use Function `.call` or `.apply`. In which case you should pass the context in as normal. #### Example ```javascript this.parent.call( this, arg1, arg2, ..., argN ); // or this.parent.apply( this, [arg1, arg2, ..., argN] ); ``` ## Assigning the correct module If you are using `id8.Class` to create a "JavaScript Class" within a Commonjs Module and you are using the `path` parameter to assign that Class to a namespace, it is important to remember that when the namespace is `bless`ed – using [m8.bless](/constantology/m8) – it will either be assigned to the Module executing the `bless` code – i.e. `m8`. As mentioned above you can supply the Module instance you want your Class and namespace to be created on. However, you may want the full namespace in your Class' `path` so that you can correctly access it later using the `id8` factory method. This is simple to do, simply insert a carat `^` at the beginning of your Class' `path` and assign the correct Module instance to the Class' `module` property. The rest is handled internally. ### Example #### The wrong way: ```javascript var id8 = require( 'id8' ), m8 = id8.m8.x( Object, Array, Boolean, Function ); // local reference to m8 and extend Native Types if sandboxed. var path = module.exports = {}; // base namespace for our module // WRONG: assigns to Foo Class to m8's Module instance, will be accessible via m8.path.to.Foo // Foo instance types will be path_to_foo id8.Class( 'path.to.Foo', { constructor : function() {} } ); // WRONG: assigns Foo Class to this module as module.exports.path.to.Foo or path.path.to.Foo // Foo instance types will be path_to_foo id8.Class( 'path.to.Foo', { constructor : function() {}, module : module } ); // WRONG: assigns Foo Class to this module as module.exports.to.Foo or path.to.Foo, which is ALMOST what we want, // Foo instance types will be to_foo instead of path_to_foo id8.Class( 'to.Foo', { constructor : function() {}, module : module } ); ``` #### The correct way: ```javascript var id8 = require( 'id8' ), m8 = id8.m8.x( Object, Array, Boolean, Function ); // local reference to m8 and extend Native Types if sandboxed. var path = module.exports = {}; // base namespace for our module // CORRECT: assigns Foo Class to this module as module.exports.to.Foo or path.to.Foo // path.to.Foo instance types will be path_to_foo // this WILL NOT work correctly in a browser though as there is no Module class id8.Class( '^path.to.Foo', { constructor : function() {}, module : module } ); // CORRECT: assigns Foo Class to this module as module.exports.to.Foo or path.to.Foo // path.to.Foo instance types will be path_to_foo // this will also work in node and in a browser id8.Class( '^path.to.Foo', { constructor : function() {}, module : path } ); // CORRECT: assigns Foo Class to this module as module.exports.to.Foo or path.to.Foo // path.to.Foo instance types will be path_to_foo // this will also work in node and in a browser id8.Class( '^path.to.Foo', { constructor : function() {}, module : m8.ENV == 'commonjs' ? module : null } ); ``` ## id8.Class examples: ```javascript id8.Class( 'Foo', { constructor : function( greeting ) { this.greeting = greeting; this.setNum( 10 ); }, getNum : function() { return this.num; }, setNum : function( num ) { return ( this.num = num ); } } ); id8.Class( '^path.to.Bar', { constructor : function( greeting ) { this.parent( 'bar: ' + greeting, true ); }, extend : Foo, module : m8.ENV === 'commonjs' ? module : null, getNum : function() { return this.parent(); } } ); var Zaaz = id8.Class( { constructor : function( greeting ) { this.parent( 'zaaz: ' + greeting, true ); }, extend : path.to.Bar } ); var foo = new Foo( 'hello world!' ), bar = id8( 'path.to.Bar', 'hello world!' ), zaaz = Zaaz.create.apply( this, ['hello world!'] ); foo.greeting; // returns => "hello world!" foo.getNum() === 10 // returns => true foo.setNum( 100 ) === 100 // returns => true foo.getNum() === 100 // returns => true bar.greeting; // returns => "bar: hello world!" bar.getNum() === 10 // returns => true bar.setNum( 200 ) === 200 // returns => true foo.getNum() === 100 // returns => true zaaz.greeting; // returns => "bar: zaaz: hello world!" zaaz.getNum() === 10 // returns => true zaaz.setNum( 400 ) === 400 // returns => true foo.__super.constructor === Object // returns => true bar.__super.constructor === Foo // returns => true zaaz.__super.constructor === Bar // returns => true zaaz.__super.__super.constructor === Foo // returns => true bar.__super === path.to.Bar.__super // returns => true bar.__super.__super === Foo.__super // returns => true ``` # The long winded argument... ## Classical inheritance sucks! If this describes your attitude to the whole JavaScript Classes thing, then think about why you are saying this. Is it because someone else has said it and you take their word as gospel or is there a real reason you think creating highly reusable code with single points of failure is a bad thing? Classical inheritence is a design pattern like Deccorator, Factory, MVC, etc, etc. It has its purpose, you don't need a Class for everything of course, however if you're building large scale applications Classes have proven to be very handy for abstracting out reusable functionality. ### Testing and bug fixing are a b!+ch As a design pattern: having a method that creates your classical inheritance like structure for you can aleviate the potential for various types silly bugs portentially caused by moving functionality around and renaming classes and methods. Consider the following: ```javascript // file: my/weird/package/Foo.js my.weird.package.Foo = function( value ) { this.value = value; } my.weird.package.Foo.prototype.setValue = function( value ) { this.value = value; }; // file: my/other/package/Bar.js my.other.package.Bar = function( id, value ) { my.weird.package.Foo.prototyope.constructor.call( this, value ); this.id = id; } my.other.package.Bar.prototype.setValue = function( value ) { switch ( typeof value ) { case 'number' : this.value = value * 10; break; default : my.weird.package.Foo.prototype.setValue.call( this, value ); } }; ``` Apart from the repetition and general fugliness of this code, it all looks perfectly sane, right? Consider we copy `my.weird.package.Foo` to `my.crazy.package.Foo` and we want `my.other.package.Bar` to inherit from `my.crazy.package.Foo` instead, as the functionality in `my.weird.package.Foo` will be changing. This is a simple example so there are only two super methods we need to change, however, the more functionality you write in this way and the more developers you have working with the same codebase, the more chances there are of something going wrong; the greater the amount of tests you need to write to make sure everything is being called correctly. Yet, even with massive amounts of pointless tests, you could accidentally miss something out – like forgetting to change one of `Bar`'s super method calls – your tests may still pass, yet there may be certain edge cases which can cause nasty behaviour in your production environment which could be near impossible to trace. Abstracting all this out into a reusable component does not only give you a smaller, more readable codebase to work with; it's simply a much safer option: having a single point of failure to debug is much better than potentially hundreds. ### Ecma.next Classes are even proposed in the [ecma harmony](http://wiki.ecmascript.org/doku.php?id=harmony:classes) and [ecma](http://wiki.ecmascript.org/doku.php?id=strawman:class_operator) [strawman](http://wiki.ecmascript.org/doku.php?id=strawman:minimal_classes) [wiki](http://wiki.ecmascript.org/doku.php?id=strawman:maximally_minimal_classes). ## It's not OOJS, use `Object.create()` instead! For the record, `id8.Class` uses `Object.create()` internally. However, in case you did not realise, or are quoting someone else without understanding the problem(s) and solution(s). `Object.create()` **does not** handle calling a constructor function **or** super methods. Yes you can use and reuse Objects as prototypes – we can do this without `Object.create()` too – but it is not the same as sub-classing and definitely nowhere near as powerful. If it where then I would not have written a `id8.Class`.
{ "content_hash": "54d52ecf5a8d3bbebd99856d700045d1", "timestamp": "", "source": "github", "line_count": 260, "max_line_length": 393, "avg_line_length": 54.33846153846154, "alnum_prop": 0.6947197055492639, "repo_name": "constantology/id8", "id": "c6d3e320833f562d0662c3d4009615f2b934247e", "size": "14218", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/id8.Class.md", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "109107" } ], "symlink_target": "" }
@implementation BMCommand - (void)dealloc { [_parameters release]; _parameters = nil; _delegate = nil; _didFinishSelector = nil; _didFailSelector = nil; [super dealloc]; } - (void)send { [[BMServiceManager sharedInstance] sendRequestWithCommand:self]; } + (id)commandWithDelegate:(id<ASIHTTPRequestDelegate>)delegate { return [[[self alloc] initWithDelegate:delegate] autorelease]; } - (id)initWithDelegate:(id<ASIHTTPRequestDelegate>)delegate { if (self = [super init]) { _delegate = delegate; _messageType = kAPIMessageTypeNone; _parameters = nil; _didFinishSelector = nil; _didFailSelector = nil; } return self; } - (id)init { if (self = [super init]) { _delegate = nil; _messageType = kAPIMessageTypeNone; _parameters = nil; _didFinishSelector = nil; _didFailSelector = nil; } return self; } @end
{ "content_hash": "0f7e2a6436c4b407bca3b91f180c9356", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 68, "avg_line_length": 20.41304347826087, "alnum_prop": 0.6283280085197018, "repo_name": "markckim/Scorched", "id": "cde15e9424dbe5704b5a970f5ce6b8825a7b2409", "size": "1121", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Scorched/BMCommand.m", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "353433" }, { "name": "C++", "bytes": "767290" }, { "name": "Matlab", "bytes": "1875" }, { "name": "Objective-C", "bytes": "4122634" }, { "name": "Shell", "bytes": "268" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" tools:context="com.jmperezra.solidadapter.view.football.FootballActivity"> <android.support.v7.widget.RecyclerView android:id="@+id/viewListPlayers" android:layout_marginTop="20dp" android:scrollbars="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:clipToPadding="false" /> </RelativeLayout>
{ "content_hash": "caf90c99a46c13736e45b8db692d985e", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 78, "avg_line_length": 41.89473684210526, "alnum_prop": 0.7160804020100503, "repo_name": "jmperezra/SOLIDAdapter", "id": "9d563cd9a61fd00c4e13f0e499ffbef163ef3725", "size": "796", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/res/layout/activity_main.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "41703" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Data; namespace Scripting { class ReportTable : DataTable { const string defaultTableName = "CSVReportTable"; const string columnNameFormat = "COL{0}"; public ReportTable() : base(defaultTableName) { InitializeColumns(0); } public void InitializeColumns(int columns) { this.Rows.Clear(); this.Columns.Clear(); for(int i = 0; i < columns; i++) { this.Columns.Add(string.Format(columnNameFormat, i), typeof(string)); } } public void WriteValue(int row, int col, object value) { if (col < Columns.Count) { while (row >= Rows.Count) { this.Rows.Add(new string[this.Columns.Count]); } this.Rows[row][col] = value.ToString(); } else { // column not in range return; } } public void Save(string fileName, Encoding encoding) { using (StreamWriter writer = new StreamWriter(fileName, false, encoding)) { for (int line = 0; line < Rows.Count; line++) { for (int col = 0; col < Columns.Count; col++) { writer.Write(Rows[line][col] ?? string.Empty); if (col < (Columns.Count - 1)) { writer.Write(";"); } } writer.WriteLine(); } } } } }
{ "content_hash": "472e2a0dd13dee20899ab42275d2b098", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 76, "avg_line_length": 19.661971830985916, "alnum_prop": 0.5787965616045845, "repo_name": "rsrlab/Scripting", "id": "f50859377b2c0de5d1aff057afc1f8552e2acd51", "size": "1398", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Scripting/ReportTable.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "39606" }, { "name": "Lua", "bytes": "190" } ], "symlink_target": "" }
#include "window.h" #include "../objects/spinningcubedub.h" #include <QCoreApplication> #include <QOpenGLContext> #include <QKeyEvent> #include <QTimer> /** * @brief Constructeur paramétré * * Permet d'initialiser la fenêtre et les propriétés de la zone de rendu OpenGL * * @param screen Propriétés de l'écran */ Window::Window(QScreen *screen) : QWindow(screen), m_scene(new SpinningCubeDUB(this)) { // On définit le type de la zone de rendu, dans notre cas il // s'agit d'une zone OpenGL setSurfaceType(QSurface::OpenGLSurface); // Puis on définit les propriétés de la zone de rendu QSurfaceFormat format; format.setDepthBufferSize(24); format.setMajorVersion(4); format.setMinorVersion(3); format.setSamples(4); // Multisampling x4 format.setProfile(QSurfaceFormat::CoreProfile); // Fonctions obsolètes d'OpenGL non disponibles format.setOption(QSurfaceFormat::DebugContext); // On applique le format et on créer la fenêtre setFormat(format); create(); resize(800, 600); setTitle("OpenGLSBExamplesQt - SpinningCubeDUB"); // On créer le contexte OpenGL et on définit son format m_context = new QOpenGLContext; m_context->setFormat(format); m_context->create(); m_context->makeCurrent(this); // On définit le contexte OpenGL de la scène m_scene->setContext(m_context); m_timer.start(); initializeGL(); connect(this, SIGNAL(widthChanged(int)), this, SLOT(resizeGL())); connect(this, SIGNAL(heightChanged(int)), this, SLOT(resizeGL())); resizeGL(); // Création d'un timer permettant la mise à jour de la zone de rendu 60 fois par seconde QTimer* timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(updateScene())); timer->start(16); // f = 1 / 16.10e-3 = 60Hz } /** * @brief Initialisation de la zone de rendu */ void Window::initializeGL() { m_context->makeCurrent(this); m_scene->initialize(); } /** * @brief Mise à jour de la zone de rendu (redessine la scène) */ void Window::paintGL() { m_context->makeCurrent(this); m_scene->render(static_cast<double>(m_timer.elapsed())/1000); m_context->swapBuffers(this); } /** * @brief Permet de redimensionner la zone de rendu */ void Window::resizeGL() { m_context->makeCurrent(this); m_scene->resize(width(), height()); } /** * @brief Mise à jour de la scène */ void Window::updateScene() { m_scene->update(0.0f); paintGL(); }
{ "content_hash": "44d6a574244129f1187ce18c0388faae", "timestamp": "", "source": "github", "line_count": 100, "max_line_length": 99, "avg_line_length": 24.96, "alnum_prop": 0.6750801282051282, "repo_name": "wang-bin/OpenGLSBExamplesQt", "id": "3139fbb6039c6fd1a595f7d8458bd4bc4bbfd8d3", "size": "2521", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/SpinningCubeDUB/ui/window.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "99430" }, { "name": "GLSL", "bytes": "4585" }, { "name": "QMake", "bytes": "5464" } ], "symlink_target": "" }
package com.amazonaws.services.codepipeline.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * The authentication applied to incoming webhook trigger requests. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/WebhookAuthConfiguration" * target="_top">AWS API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class WebhookAuthConfiguration implements Serializable, Cloneable, StructuredPojo { /** * <p> * The property used to configure acceptance of webhooks within a specific IP range. For IP, only the * <code>AllowedIPRange</code> property must be set, and this property must be set to a valid CIDR range. * </p> */ private String allowedIPRange; /** * <p> * The property used to configure GitHub authentication. For GITHUB_HMAC, only the <code>SecretToken</code> property * must be set. * </p> */ private String secretToken; /** * <p> * The property used to configure acceptance of webhooks within a specific IP range. For IP, only the * <code>AllowedIPRange</code> property must be set, and this property must be set to a valid CIDR range. * </p> * * @param allowedIPRange * The property used to configure acceptance of webhooks within a specific IP range. For IP, only the * <code>AllowedIPRange</code> property must be set, and this property must be set to a valid CIDR range. */ public void setAllowedIPRange(String allowedIPRange) { this.allowedIPRange = allowedIPRange; } /** * <p> * The property used to configure acceptance of webhooks within a specific IP range. For IP, only the * <code>AllowedIPRange</code> property must be set, and this property must be set to a valid CIDR range. * </p> * * @return The property used to configure acceptance of webhooks within a specific IP range. For IP, only the * <code>AllowedIPRange</code> property must be set, and this property must be set to a valid CIDR range. */ public String getAllowedIPRange() { return this.allowedIPRange; } /** * <p> * The property used to configure acceptance of webhooks within a specific IP range. For IP, only the * <code>AllowedIPRange</code> property must be set, and this property must be set to a valid CIDR range. * </p> * * @param allowedIPRange * The property used to configure acceptance of webhooks within a specific IP range. For IP, only the * <code>AllowedIPRange</code> property must be set, and this property must be set to a valid CIDR range. * @return Returns a reference to this object so that method calls can be chained together. */ public WebhookAuthConfiguration withAllowedIPRange(String allowedIPRange) { setAllowedIPRange(allowedIPRange); return this; } /** * <p> * The property used to configure GitHub authentication. For GITHUB_HMAC, only the <code>SecretToken</code> property * must be set. * </p> * * @param secretToken * The property used to configure GitHub authentication. For GITHUB_HMAC, only the <code>SecretToken</code> * property must be set. */ public void setSecretToken(String secretToken) { this.secretToken = secretToken; } /** * <p> * The property used to configure GitHub authentication. For GITHUB_HMAC, only the <code>SecretToken</code> property * must be set. * </p> * * @return The property used to configure GitHub authentication. For GITHUB_HMAC, only the <code>SecretToken</code> * property must be set. */ public String getSecretToken() { return this.secretToken; } /** * <p> * The property used to configure GitHub authentication. For GITHUB_HMAC, only the <code>SecretToken</code> property * must be set. * </p> * * @param secretToken * The property used to configure GitHub authentication. For GITHUB_HMAC, only the <code>SecretToken</code> * property must be set. * @return Returns a reference to this object so that method calls can be chained together. */ public WebhookAuthConfiguration withSecretToken(String secretToken) { setSecretToken(secretToken); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAllowedIPRange() != null) sb.append("AllowedIPRange: ").append(getAllowedIPRange()).append(","); if (getSecretToken() != null) sb.append("SecretToken: ").append(getSecretToken()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof WebhookAuthConfiguration == false) return false; WebhookAuthConfiguration other = (WebhookAuthConfiguration) obj; if (other.getAllowedIPRange() == null ^ this.getAllowedIPRange() == null) return false; if (other.getAllowedIPRange() != null && other.getAllowedIPRange().equals(this.getAllowedIPRange()) == false) return false; if (other.getSecretToken() == null ^ this.getSecretToken() == null) return false; if (other.getSecretToken() != null && other.getSecretToken().equals(this.getSecretToken()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAllowedIPRange() == null) ? 0 : getAllowedIPRange().hashCode()); hashCode = prime * hashCode + ((getSecretToken() == null) ? 0 : getSecretToken().hashCode()); return hashCode; } @Override public WebhookAuthConfiguration clone() { try { return (WebhookAuthConfiguration) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.codepipeline.model.transform.WebhookAuthConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller); } }
{ "content_hash": "eb3c85d10daaae06fdc94cf7097b047f", "timestamp": "", "source": "github", "line_count": 192, "max_line_length": 144, "avg_line_length": 36.96875, "alnum_prop": 0.6487743026204564, "repo_name": "jentfoo/aws-sdk-java", "id": "6c147a4de29a0a365696e8e1b8d449b15d068b60", "size": "7678", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "aws-java-sdk-codepipeline/src/main/java/com/amazonaws/services/codepipeline/model/WebhookAuthConfiguration.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "270" }, { "name": "FreeMarker", "bytes": "173637" }, { "name": "Gherkin", "bytes": "25063" }, { "name": "Java", "bytes": "356214839" }, { "name": "Scilab", "bytes": "3924" }, { "name": "Shell", "bytes": "295" } ], "symlink_target": "" }
<div data-ng-repeat="(offeringId,offering) in (offerings | ofilter:'wash':datefilter)"> <booking data-offering="offering" data-offering-id="{{offeringId}}" data-cart="cart"></booking> </div>
{ "content_hash": "208f964f99f66b4d05870f0f47a203c4", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 96, "avg_line_length": 63.666666666666664, "alnum_prop": 0.7225130890052356, "repo_name": "scottschafer/BespokeCarservice", "id": "bf4dba53e643460dd31ffb53ee5be1f291d1dfb3", "size": "191", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "public/modules/core/views/bookings-partial-wash.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "3636" }, { "name": "HTML", "bytes": "27320" }, { "name": "JavaScript", "bytes": "122465" }, { "name": "Perl", "bytes": "48" }, { "name": "Shell", "bytes": "414" } ], "symlink_target": "" }
package com.monits.agilefant.helper; import android.app.ProgressDialog; import android.content.Context; import android.widget.Toast; import com.android.volley.Response; import com.android.volley.VolleyError; import com.monits.agilefant.AgilefantApplication; import com.monits.agilefant.R; import com.monits.agilefant.activity.ProjectActivity; import com.monits.agilefant.model.Backlog; import com.monits.agilefant.model.Project; import com.monits.agilefant.service.ProjectService; import javax.inject.Inject; /** * Created by lgnanni on 22/10/15. */ public class ProjectHelper { private final Context context; private final Backlog backlog; @Inject /* default */ ProjectService projectService; /** * Project Helper * @param context Context * @param backlog Backlog */ public ProjectHelper(final Context context, final Backlog backlog) { this.context = context; this.backlog = backlog; AgilefantApplication.getObjectGraph().inject(this); } /** * Makes service call and open ProjectActivity on response */ public void openProject() { final ProgressDialog progressDialog = new ProgressDialog(context); progressDialog.setIndeterminate(true); progressDialog.setCancelable(false); progressDialog.setMessage(context.getString(R.string.loading)); progressDialog.show(); projectService.getProjectData( backlog.getId(), new Response.Listener<Project>() { @Override public void onResponse(final Project project) { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } context.startActivity(ProjectActivity.getIntent(context, backlog, project)); } }, new Response.ErrorListener() { @Override public void onErrorResponse(final VolleyError arg0) { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } Toast.makeText(context, R.string.failed_to_retrieve_project_details, Toast.LENGTH_SHORT).show(); } }); } @Override public String toString() { return "ProjectHelper: [context: " + context + ", backlog: " + backlog + ']'; } }
{ "content_hash": "97c6fa13318738d33ea9e8fd37d4ae5e", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 82, "avg_line_length": 27.53846153846154, "alnum_prop": 0.7257914338919925, "repo_name": "Monits/AgilefantAndroid", "id": "beed577f5b3389ab945b00d7dd6b14316ee9dfed", "size": "2148", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "agilefantAndroid/src/main/java/com/monits/agilefant/helper/ProjectHelper.java", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Java", "bytes": "416666" }, { "name": "Shell", "bytes": "283" } ], "symlink_target": "" }
package com.smartdevicelink.proxy.rpc; import android.support.annotation.NonNull; import com.smartdevicelink.proxy.RPCStruct; import java.util.Hashtable; /** * Defines the each Equalizer channel settings. */ public class EqualizerSettings extends RPCStruct { public static final String KEY_CHANNEL_ID = "channelId"; public static final String KEY_CHANNEL_NAME = "channelName"; public static final String KEY_CHANNEL_SETTING = "channelSetting"; /** * Constructs a newly allocated EqualizerSettings object */ public EqualizerSettings() { } /** * Constructs a newly allocated EqualizerSettings object indicated by the Hashtable parameter * * @param hash The Hashtable to use */ public EqualizerSettings(Hashtable<String, Object> hash) { super(hash); } /** * Constructs a newly allocated EqualizerSettings object * * @param channelId Min: 0 Max: 100 * @param channelSetting Min: 0 Max: 100 */ public EqualizerSettings(@NonNull Integer channelId, @NonNull Integer channelSetting) { this(); setChannelId(channelId); setChannelSetting(channelSetting); } /** * Sets the channelId portion of the EqualizerSettings class * * @param channelId ID that represents the channel these settings should be applied */ public void setChannelId(@NonNull Integer channelId) { setValue(KEY_CHANNEL_ID, channelId); } /** * Gets the channelId portion of the EqualizerSettings class * * @return Integer */ public Integer getChannelId() { return getInteger(KEY_CHANNEL_ID); } /** * Sets the channelName portion of the EqualizerSettings class * * @param channelName Read-only channel / frequency name (e.i. "Treble, Midrange, Bass" or "125 Hz"). */ public void setChannelName(String channelName) { setValue(KEY_CHANNEL_NAME, channelName); } /** * Gets the channelName portion of the EqualizerSettings class * * @return String - Read-only channel / frequency name (e.i. "Treble, Midrange, Bass" or "125 Hz"). */ public String getChannelName() { return getString(KEY_CHANNEL_NAME); } /** * Sets the channelSetting portion of the EqualizerSettings class * * @param channelSetting Reflects the setting, from 0%-100%. */ public void setChannelSetting(@NonNull Integer channelSetting) { setValue(KEY_CHANNEL_SETTING, channelSetting); } /** * Gets the channelSetting portion of the EqualizerSettings class * * @return Integer - Reflects the setting, from 0%-100%. */ public Integer getChannelSetting() { return getInteger(KEY_CHANNEL_SETTING); } }
{ "content_hash": "33cb9f1679db4532993c7724f3b29d71", "timestamp": "", "source": "github", "line_count": 98, "max_line_length": 102, "avg_line_length": 26.081632653061224, "alnum_prop": 0.7253521126760564, "repo_name": "anildahiya/sdl_android", "id": "a680cfdb00f3f0973ce6ea8969f3e876afdb7aca", "size": "4162", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "base/src/main/java/com/smartdevicelink/proxy/rpc/EqualizerSettings.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Java", "bytes": "6158140" } ], "symlink_target": "" }
package de.diddiz.codegeneration.visualization; import java.awt.HeadlessException; import javax.swing.JFrame; import com.google.common.eventbus.Subscribe; import de.diddiz.codegeneration.Agent; import de.diddiz.codegeneration.events.GenerationCompleteEvent; public class GraphWindow extends JFrame { private final DrawGraph mainPanel; public GraphWindow() throws HeadlessException { super("DrawGraph"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainPanel = new DrawGraph(); getContentPane().add(mainPanel); pack(); setLocationByPlatform(true); setVisible(true); } @Subscribe public void onGenerationCompleted(GenerationCompleteEvent e) { updateGraph(e.getBestAgent()); } public void updateGraph(Agent bestAgent) { mainPanel.setGraphPoints(0, bestAgent.getFitness().expected.toPoints()); mainPanel.setGraphPoints(1, bestAgent.getFitness().actual.toPoints()); repaint(); } }
{ "content_hash": "b19d1417f811392a6767a993b4318069", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 74, "avg_line_length": 27.696969696969695, "alnum_prop": 0.7855579868708972, "repo_name": "DiddiZ/CodeGeneration", "id": "db74d0b6c90faa41ecac2f609a773b06d2e3d64d", "size": "914", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/de/diddiz/codegeneration/visualization/GraphWindow.java", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "3048" }, { "name": "Java", "bytes": "78187" } ], "symlink_target": "" }
package org.capcaval.c3.sample.tutorial4.numberproducer; import org.capcaval.c3.component.Component; public interface NumberProducer extends Component { }
{ "content_hash": "8dc6f959be4845b3f274217ac45cb95a", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 56, "avg_line_length": 19.875, "alnum_prop": 0.8238993710691824, "repo_name": "MrLoNee/C3", "id": "024d4d590e0061fc0a52b5be2aeab532d1d30d00", "size": "1223", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "01_src/org/capcaval/c3/sample/tutorial4/numberproducer/NumberProducer.java", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
from .parser import CrawledTree # noqa from .nodes import HostNode, URLNode, HarTreeNode # noqa from .har2tree import Har2Tree, HarFile # noqa from .helper import Har2TreeError, Har2TreeLogAdapter # noqa import logging logging.getLogger(__name__).addHandler(logging.NullHandler())
{ "content_hash": "20af489ff91f797d3ffcf98e4043d79e", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 61, "avg_line_length": 40.857142857142854, "alnum_prop": 0.7867132867132867, "repo_name": "viper-framework/har2tree", "id": "926bca5f6cc8a919e8c31082d18baf76ff98e849", "size": "286", "binary": false, "copies": "1", "ref": "refs/heads/dependabot/pip/mypy-0.942", "path": "har2tree/__init__.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "HTML", "bytes": "729894" }, { "name": "Python", "bytes": "47707" }, { "name": "Shell", "bytes": "209" } ], "symlink_target": "" }
/** * @file pchildren.h * @author Emil Nilsson * @license MIT * @date 2014 */ #ifndef PTREE_PCHILDREN_H #define PTREE_PCHILDREN_H // forward declaration typedef struct proc_t proc_t; typedef struct proc_list_t proc_list_t; /** * A child node for a process information structure pointing to a child process. */ typedef struct proc_child_t { proc_t * proc; struct proc_child_t * next; } proc_child_t; /** * Iterates over each child process for a process. */ #define EACH_PROC_CHILD(parent, child) \ for (proc_child_t * node = parent->first_child; node; node = node->next) \ if (child = node->proc) /** * Finds and adds the process children for every process. */ extern int populate_proc_children(proc_list_t * proc_list); /** * Creates and adds a process child node its parent process. */ extern int add_proc_child(proc_t * parent_proc, proc_t * child_proc); /** * Frees a child node structure. */ extern void free_child(proc_child_t * child); #endif
{ "content_hash": "c7ea4b21089e4435043a9e49e84fed54", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 80, "avg_line_length": 21.58695652173913, "alnum_prop": 0.6777442094662638, "repo_name": "enil/tlpi-exercises", "id": "be88ddbbf0e7285d56bb706a4b244a59261e2cca", "size": "993", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ch12/12-2/pchildren.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "111586" }, { "name": "C++", "bytes": "458" }, { "name": "Makefile", "bytes": "4615" }, { "name": "Shell", "bytes": "862" } ], "symlink_target": "" }
////////////////////////////////////////////////////////////////////// // // AkFileLocationBase.h // // Basic file location resolving: Uses simple path concatenation logic. // Exposes basic path functions for convenience. // For more details on resolving file location, refer to section "File Location" inside // "Going Further > Overriding Managers > Streaming / Stream Manager > Low-Level I/O" // of the SDK documentation. // ////////////////////////////////////////////////////////////////////// #ifndef _AK_FILE_LOCATION_BASE_H_ #define _AK_FILE_LOCATION_BASE_H_ struct AkFileSystemFlags; #include <AK/SoundEngine/Common/IAkStreamMgr.h> class CAkFileLocationBase { public: CAkFileLocationBase(); virtual ~CAkFileLocationBase(); // // Global path functions. // ------------------------------------------------------ // Base path is prepended to all file names. // Audio source path is appended to base path whenever uCompanyID is AK and uCodecID specifies an audio source. // Bank path is appended to base path whenever uCompanyID is AK and uCodecID specifies a sound bank. // Language specific dir name is appended to path whenever "bIsLanguageSpecific" is true. AKRESULT SetBasePath( const AkOSChar* in_pszBasePath ); AKRESULT SetBankPath( const AkOSChar* in_pszBankPath ); AKRESULT SetAudioSrcPath( const AkOSChar* in_pszAudioSrcPath ); // Note: SetLangSpecificDirName() does not exist anymore. See release note WG-19397 (Wwise 2011.2). // // Path resolving services. // ------------------------------------------------------ // String overload. // Returns AK_Success if input flags are supported and the resulting path is not too long. // Returns AK_Fail otherwise. AKRESULT GetFullFilePath( const AkOSChar * in_pszFileName, // File name. AkFileSystemFlags * in_pFlags, // Special flags. Can be NULL. AkOpenMode in_eOpenMode, // File open mode (read, write, ...). AkOSChar * out_pszFullFilePath // Full file path. ); // ID overload. // The name of the file will be formatted as ID.ext. This is meant to be used with options // "Use SoundBank Names" unchecked, and/or "Copy Streamed Files" in the SoundBank Settings. // For more details, refer to the SoundBank Settings in Wwise Help, and to section "Identifying Banks" inside // "Sound Engine Integration Walkthrough > Integrate Wwise Elements into Your Game > Integrating Banks > // Integration Details - Banks > General Information" of the SDK documentation. // Returns AK_Success if input flags are supported and the resulting path is not too long. // Returns AK_Fail otherwise. AKRESULT GetFullFilePath( AkFileID in_fileID, // File ID. AkFileSystemFlags * in_pFlags, // Special flags. AkOpenMode in_eOpenMode, // File open mode (read, write, ...). AkOSChar * out_pszFullFilePath // Full file path. ); protected: // Internal user paths. AkOSChar m_szBasePath[AK_MAX_PATH]; AkOSChar m_szBankPath[AK_MAX_PATH]; AkOSChar m_szAudioSrcPath[AK_MAX_PATH]; }; #endif //_AK_FILE_LOCATION_BASE_H_
{ "content_hash": "c3d8f9793a9eb6bc2921e1689d5e6337", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 112, "avg_line_length": 36.464285714285715, "alnum_prop": 0.6696049624551094, "repo_name": "rogerbusquets97/3D-Engine", "id": "ed45571e332a1c5c1340ea86e7e0b7061e6b0be1", "size": "3769", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Wwise/IO/Common/AkFileLocationBase.h", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "3932" }, { "name": "C", "bytes": "6963171" }, { "name": "C++", "bytes": "4910570" }, { "name": "CMake", "bytes": "1212" }, { "name": "CSS", "bytes": "2855" }, { "name": "GLSL", "bytes": "1386" }, { "name": "HTML", "bytes": "247893" }, { "name": "Makefile", "bytes": "4193" }, { "name": "Objective-C", "bytes": "64279" }, { "name": "Objective-C++", "bytes": "30376" }, { "name": "Shell", "bytes": "140" } ], "symlink_target": "" }
layout: model title: Financial English BERT Embeddings (Number shape masking) author: John Snow Labs name: bert_embeddings_sec_bert_sh date: 2022-04-12 tags: [bert, embeddings, en, open_source, financial] task: Embeddings language: en edition: Spark NLP 3.4.2 spark_version: 3.0 supported: true annotator: BertEmbeddings article_header: type: cover use_language_switcher: "Python-Scala-Java" --- ## Description Pretrained Financial BERT Embeddings model, uploaded to Hugging Face, adapted and imported into Spark NLP. `sec-bert-shape` is a English model orginally trained by `nlpaueb`.This model is the same as Bert Base but we replace numbers with pseudo-tokens that represent the number’s shape, so numeric expressions (of known shapes) are no longer fragmented, e.g., '53.2' becomes '[XX.X]' and '40,200.5' becomes '[XX,XXX.X]'. If you are interested in Financial Embeddings, take a look also at these two models: - [sec-base](https://nlp.johnsnowlabs.com/2022/04/12/bert_embeddings_sec_bert_base_en_3_0.html): Same as BERT Base but trained with financial documents. - [sec-num](https://nlp.johnsnowlabs.com/2022/04/12/bert_embeddings_sec_bert_num_en_3_0.html): Same as Bert sec-base but we replace every number token with a [NUM] pseudo-token handling all numeric expressions in a uniform manner, disallowing their fragmentation). {:.btn-box} <button class="button button-orange" disabled>Live Demo</button> <button class="button button-orange" disabled>Open in Colab</button> [Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/models/bert_embeddings_sec_bert_sh_en_3.4.2_3.0_1649758845734.zip){:.button.button-orange.button-orange-trans.arr.button-icon} ## How to use <div class="tabs-box" markdown="1"> {% include programmingLanguageSelectScalaPythonNLU.html %} ```python documentAssembler = DocumentAssembler() \ .setInputCol("text") \ .setOutputCol("document") tokenizer = Tokenizer() \ .setInputCols("document") \ .setOutputCol("token") embeddings = BertEmbeddings.pretrained("bert_embeddings_sec_bert_sh","en") \ .setInputCols(["document", "token"]) \ .setOutputCol("embeddings") pipeline = Pipeline(stages=[documentAssembler, tokenizer, embeddings]) data = spark.createDataFrame([["I love Spark NLP"]]).toDF("text") result = pipeline.fit(data).transform(data) ``` ```scala val documentAssembler = new DocumentAssembler() .setInputCol("text") .setOutputCol("document") val tokenizer = new Tokenizer() .setInputCols(Array("document")) .setOutputCol("token") val embeddings = BertEmbeddings.pretrained("bert_embeddings_sec_bert_sh","en") .setInputCols(Array("document", "token")) .setOutputCol("embeddings") val pipeline = new Pipeline().setStages(Array(documentAssembler, tokenizer, embeddings)) val data = Seq("I love Spark NLP").toDF("text") val result = pipeline.fit(data).transform(data) ``` {:.nlu-block} ```python import nlu nlu.load("en.embed.sec_bert_sh").predict("""I love Spark NLP""") ``` </div> {:.model-param} ## Model Information {:.table-model} |---|---| |Model Name:|bert_embeddings_sec_bert_sh| |Compatibility:|Spark NLP 3.4.2+| |License:|Open Source| |Edition:|Official| |Input Labels:|[sentence, token]| |Output Labels:|[bert]| |Language:|en| |Size:|409.5 MB| |Case sensitive:|true| ## References - https://huggingface.co/nlpaueb/sec-bert-shape - https://arxiv.org/abs/2203.06482 - http://nlp.cs.aueb.gr/
{ "content_hash": "a3ce78a21a88877266ebf9eb179eb613", "timestamp": "", "source": "github", "line_count": 106, "max_line_length": 420, "avg_line_length": 31.90566037735849, "alnum_prop": 0.742755765819042, "repo_name": "JohnSnowLabs/spark-nlp", "id": "a61550f0257bfec50289c609f7308f19aa2caff7", "size": "3388", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/_posts/luca-martial/2022-04-12-bert_embeddings_sec_bert_sh_en_3_0.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "14452" }, { "name": "Java", "bytes": "223289" }, { "name": "Makefile", "bytes": "819" }, { "name": "Python", "bytes": "1694517" }, { "name": "Scala", "bytes": "4116435" }, { "name": "Shell", "bytes": "5286" } ], "symlink_target": "" }
package io.katharsis.jpa.internal.query.backend.criteria; import java.util.List; import java.util.Map; import javax.persistence.EntityManager; import javax.persistence.criteria.CriteriaQuery; import io.katharsis.jpa.internal.query.AbstractJpaQueryImpl; import io.katharsis.jpa.internal.query.ComputedAttributeRegistryImpl; import io.katharsis.jpa.query.criteria.JpaCriteriaQuery; import io.katharsis.meta.MetaLookup; public class JpaCriteriaQueryImpl<T> extends AbstractJpaQueryImpl<T, JpaCriteriaQueryBackend<T>> implements JpaCriteriaQuery<T> { public JpaCriteriaQueryImpl(MetaLookup metaLookup, EntityManager em, Class<T> clazz, ComputedAttributeRegistryImpl virtualAttrs) { super(metaLookup, em, clazz, virtualAttrs); } public JpaCriteriaQueryImpl(MetaLookup metaLookup, EntityManager em, Class<?> clazz, ComputedAttributeRegistryImpl virtualAttrs, String attrName, List<?> entityIds) { super(metaLookup, em, clazz, virtualAttrs, attrName, entityIds); } public CriteriaQuery<T> buildQuery() { return buildExecutor().getQuery(); } @Override public JpaCriteriaQueryExecutorImpl<T> buildExecutor() { return (JpaCriteriaQueryExecutorImpl<T>) super.buildExecutor(); } @Override protected JpaCriteriaQueryBackend<T> newBackend() { return new JpaCriteriaQueryBackend<>(this, em, clazz, parentMeta, parentAttr, parentIdSelection); } @Override protected JpaCriteriaQueryExecutorImpl<T> newExecutor(JpaCriteriaQueryBackend<T> ctx, int numAutoSelections, Map<String, Integer> selectionBindings) { return new JpaCriteriaQueryExecutorImpl<>(em, meta, ctx.getCriteriaQuery(), numAutoSelections, selectionBindings); } }
{ "content_hash": "3f97f8e010ab38aa26ac6974cc8eb226", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 151, "avg_line_length": 36.75555555555555, "alnum_prop": 0.8071342200725514, "repo_name": "apetrucci/katharsis-framework", "id": "57e8b20fa4222975aa21bed8f379df3d2bc40909", "size": "1654", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "katharsis-jpa/src/main/java/io/katharsis/jpa/internal/query/backend/criteria/JpaCriteriaQueryImpl.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "191265" }, { "name": "HTML", "bytes": "8048" }, { "name": "Java", "bytes": "2446402" }, { "name": "JavaScript", "bytes": "2121" }, { "name": "Shell", "bytes": "614" }, { "name": "TypeScript", "bytes": "32723" } ], "symlink_target": "" }
#if (VMS156 || VMS161) using ESAPIX.Helpers.Strings; using System; using System.Collections.Generic; using System.Linq; using VMS.TPS.Common.Model.API; using VMS.TPS.Common.Model.Types; namespace ESAPIX.Helpers.Copiers { public class BeamCopier { public static void CopyBeamToPlan(Beam beam, ExternalPlanSetup plansetup, VVector isocenter) { string energyModeDisp = beam.EnergyModeDisplayName; Char[] sep = { '-' }; string energyMode = energyModeDisp.Split(sep).First(); string pfm = energyModeDisp.Split(sep).Count() > 1 ? energyModeDisp.Split(sep).Last() : null; ExternalBeamMachineParameters extParams = new ExternalBeamMachineParameters(beam.TreatmentUnit.Id, energyMode, beam.DoseRate, beam.Technique.Id, pfm); List<double> metersetWeights = GetControlPointWeights(beam); Beam copyBeam = null; if (beam.MLCPlanType == MLCPlanType.VMAT) { copyBeam = plansetup.AddVMATBeam(extParams, metersetWeights, beam.ControlPoints[0].CollimatorAngle, beam.ControlPoints[0].GantryAngle, beam.ControlPoints[beam.ControlPoints.Count - 1].GantryAngle, beam.GantryDirection, beam.ControlPoints[0].PatientSupportAngle, isocenter); } else if (beam.MLCPlanType == MLCPlanType.ArcDynamic) { copyBeam = plansetup.AddConformalArcBeam(extParams, beam.ControlPoints[0].CollimatorAngle, beam.ControlPoints.Count, beam.ControlPoints[0].GantryAngle, beam.ControlPoints[beam.ControlPoints.Count - 1].GantryAngle, beam.GantryDirection, beam.ControlPoints[0].PatientSupportAngle, isocenter); } else if (beam.MLCPlanType == MLCPlanType.DoseDynamic) { var cppPairs = metersetWeights.Zip(metersetWeights.Skip(1), (a, b) => new Tuple<double, double>(a, b)).ToList(); var oddCppPairs = cppPairs.Where((p, i) => i % 2 == 1); if (metersetWeights.Count >= 4 && metersetWeights.Count % 2 == 0 && oddCppPairs.All(p => p.Item1 == p.Item2)) { copyBeam = plansetup.AddMultipleStaticSegmentBeam(extParams, metersetWeights, beam.ControlPoints[0].CollimatorAngle, beam.ControlPoints[0].GantryAngle, beam.ControlPoints[0].PatientSupportAngle, isocenter); } else { copyBeam = plansetup.AddSlidingWindowBeam(extParams, metersetWeights, beam.ControlPoints[0].CollimatorAngle, beam.ControlPoints[0].GantryAngle, beam.ControlPoints[0].PatientSupportAngle, isocenter); } } else { throw new NotImplementedException("Copying this type of beam not implemented"); } var beamParams = copyBeam.GetEditableParameters(); CopyJawAndLeafPositions(beam, beamParams); beamParams.WeightFactor = beam.WeightFactor; copyBeam.ApplyParameters(beamParams); copyBeam.Id = beam.Id; } static List<double> GetControlPointWeights(Beam beam) { List<double> weights = new List<double>(); foreach (var cp in beam.ControlPoints) weights.Add(cp.MetersetWeight); return weights; } static void CopyJawAndLeafPositions(Beam from, BeamParameters to) { IEnumerable<ControlPointParameters> cps = to.ControlPoints; int ix = 0; foreach (var cp in from.ControlPoints) { cps.ElementAt(ix).JawPositions = cp.JawPositions; cps.ElementAt(ix).LeafPositions = cp.LeafPositions; ix++; } } } } #endif
{ "content_hash": "c4f2365eed6628a9fd47e79329394e8b", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 229, "avg_line_length": 45.523809523809526, "alnum_prop": 0.6210774058577406, "repo_name": "rexcardan/ESAPIX", "id": "8c7e0aa3db905dac04c343c88786170c388e5b58", "size": "3826", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ESAPIX/Helpers/Copiers/BeamCopier.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "318559" }, { "name": "CSS", "bytes": "134625" }, { "name": "HTML", "bytes": "3527" }, { "name": "JavaScript", "bytes": "43342" } ], "symlink_target": "" }
import os import glob import time import traceback from time import sleep import RPi.GPIO as GPIO import picamera # http://picamera.readthedocs.org/en/release-1.4/install2.html import atexit import sys import socket import pygame from pygame.locals import QUIT, KEYDOWN, K_ESCAPE #import pytumblr # https://github.com/tumblr/pytumblr import config # this is the config python file config.py from signal import alarm, signal, SIGALRM, SIGKILL ######################## ### Variables Config ### ######################## led_pin = 7 # LED btn_pin = 18 # pin for the start button total_pics = 4 # number of pics to be taken capture_delay = 1 # delay between pics prep_delay = 5 # number of seconds at step 1 as users prep to have photo taken gif_delay = 100 # How much time between frames in the animated gif restart_delay = 10 # how long to display finished message before beginning a new session test_server = 'www.google.com' # full frame of v1 camera is 2592x1944. Wide screen max is 2592,1555 # if you run into resource issues, try smaller, like 1920x1152. # or increase memory http://picamera.readthedocs.io/en/release-1.12/fov.html#hardware-limits high_res_w = 1296 # width of high res image, if taken high_res_h = 972 # height of high res image, if taken ############################# ### Variables that Change ### ############################# # Do not change these variables, as the code will change it anyway transform_x = config.monitor_w # how wide to scale the jpg when replaying transfrom_y = config.monitor_h # how high to scale the jpg when replaying offset_x = 0 # how far off to left corner to display photos offset_y = 0 # how far off to left corner to display photos replay_delay = 1 # how much to wait in-between showing pics on-screen after taking replay_cycles = 2 # how many times to show each photo on-screen after taking #################### ### Other Config ### #################### real_path = os.path.dirname(os.path.realpath(__file__)) # Setup the tumblr OAuth Client #client = pytumblr.TumblrRestClient( # config.consumer_key, # config.consumer_secret, # config.oath_token, # config.oath_secret, #) # GPIO setup #GPIO.setmode(GPIO.BOARD) #GPIO.setup(led_pin,GPIO.OUT) # LED #GPIO.setup(btn_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP) #GPIO.output(led_pin,False) #for some reason the pin turns on at the beginning of the program. Why? # initialize pygame pygame.init() pygame.display.set_mode((config.monitor_w, config.monitor_h)) screen = pygame.display.get_surface() pygame.display.set_caption('Photo Booth Pics') pygame.mouse.set_visible(False) #hide the mouse cursor pygame.display.toggle_fullscreen() ################# ### Functions ### ################# # clean up running programs as needed when main program exits def cleanup(): print('Ended abruptly') pygame.quit() #GPIO.cleanup() atexit.register(cleanup) # A function to handle keyboard/mouse/device input events def input(events): for event in events: # Hit the ESC key to quit the slideshow. if (event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE)): pygame.quit() #delete files in folder def clear_pics(channel): files = glob.glob(config.file_path + '*') for f in files: os.remove(f) #light the lights in series to show completed print "Deleted previous pics" for x in range(0, 3): #blink light #GPIO.output(led_pin,True); sleep(0.25) #GPIO.output(led_pin,False); sleep(0.25) # check if connected to the internet def is_connected(): try: # see if we can resolve the host name -- tells us if there is a DNS listening host = socket.gethostbyname(test_server) # connect to the host -- tells us if the host is actually # reachable s = socket.create_connection((host, 80), 2) return True except: pass return False # set variables to properly display the image on screen at right ratio def set_demensions(img_w, img_h): # Note this only works when in booting in desktop mode. # When running in terminal, the size is not correct (it displays small). Why? # connect to global vars global transform_y, transform_x, offset_y, offset_x # based on output screen resolution, calculate how to display ratio_h = (config.monitor_w * img_h) / img_w if (ratio_h < config.monitor_h): #Use horizontal black bars #print "horizontal black bars" transform_y = ratio_h transform_x = config.monitor_w offset_y = (config.monitor_h - ratio_h) / 2 offset_x = 0 elif (ratio_h > config.monitor_h): #Use vertical black bars #print "vertical black bars" transform_x = (config.monitor_h * img_w) / img_h transform_y = config.monitor_h offset_x = (config.monitor_w - transform_x) / 2 offset_y = 0 else: #No need for black bars as photo ratio equals screen ratio #print "no black bars" transform_x = config.monitor_w transform_y = config.monitor_h offset_y = offset_x = 0 # uncomment these lines to troubleshoot screen ratios # print str(img_w) + " x " + str(img_h) # print "ratio_h: "+ str(ratio_h) # print "transform_x: "+ str(transform_x) # print "transform_y: "+ str(transform_y) # print "offset_y: "+ str(offset_y) # print "offset_x: "+ str(offset_x) # display one image on screen def show_image(image_path): # clear the screen screen.fill( (0,0,0) ) # load the image img = pygame.image.load(image_path) img = img.convert() # set pixel dimensions based on image set_demensions(img.get_width(), img.get_height()) # rescale the image to fit the current display img = pygame.transform.scale(img, (transform_x,transfrom_y)) screen.blit(img,(offset_x,offset_y)) pygame.display.flip() # display a blank screen def clear_screen(): screen.fill( (0,0,0) ) pygame.display.flip() # display a group of images def display_pics(jpg_group): for i in range(0, replay_cycles): #show pics a few times for i in range(1, total_pics+1): #show each pic show_image(config.file_path + jpg_group + "-0" + str(i) + ".jpg") time.sleep(replay_delay) # pause # define the photo taking function for when the big button is pressed def start_photobooth(): input(pygame.event.get()) # press escape to exit pygame. Then press ctrl-c to exit python. ################################# Begin Step 1 ################################# print "Get Ready" #GPIO.output(led_pin,False); show_image(real_path + "/instructions.png") sleep(prep_delay) # clear the screen clear_screen() camera = picamera.PiCamera() camera.vflip = False camera.hflip = True # flip for preview, showing users a mirror image camera.saturation = -100 # comment out this line if you want color images camera.iso = config.camera_iso pixel_width = 0 # local variable declaration pixel_height = 0 # local variable declaration if config.hi_res_pics: camera.resolution = (high_res_w, high_res_h) # set camera resolution to high res else: pixel_width = 500 # maximum width of animated gif on tumblr pixel_height = config.monitor_h * pixel_width // config.monitor_w camera.resolution = (pixel_width, pixel_height) # set camera resolution to low res ################################# Begin Step 2 ################################# print "Taking pics" now = time.strftime("%Y-%m-%d-%H-%M-%S") #get the current date and time for the start of the filename if config.capture_count_pics: try: # take the photos print "Try" for i in range(1,total_pics+1): camera.hflip = True # preview a mirror image camera.resolution=(config.monitor_w, config.monitor_h) camera.start_preview() # start preview at low res but the right ratio time.sleep(2) #warm up camera #GPIO.output(led_pin,True) #turn on the LED filename = config.file_path + now + '-0' + str(i) + '.jpg' camera.hflip = False # flip back when taking photo camera.capture(filename) print(filename) #GPIO.output(led_pin,False) #turn off the LED camera.stop_preview() show_image(real_path + "/pose" + str(i) + ".png") time.sleep(capture_delay) # pause in-between shots clear_screen() if i == total_pics+1: break finally: camera.close() else: camera.start_preview(resolution=(config.monitor_w, config.monitor_h)) # start preview at low res but the right ratio time.sleep(2) #warm up camera try: #take the photos for i, filename in enumerate(camera.capture_continuous(config.file_path + now + '-' + '{counter:02d}.jpg')): #GPIO.output(led_pin,True) #turn on the LED print(filename) time.sleep(capture_delay) # pause in-between shots #GPIO.output(led_pin,False) #turn off the LED if i == total_pics-1: break finally: camera.stop_preview() camera.close() ########################### Begin Step 3 ################################# input(pygame.event.get()) # press escape to exit pygame. Then press ctrl-c to exit python. print "Creating an animated gif" if config.post_online: show_image(real_path + "/uploading.png") else: show_image(real_path + "/processing.png") if config.make_gifs: # make the gifs if config.hi_res_pics: # first make a small version of each image. Tumblr's max animated gif's are 500 pixels wide. for x in range(1, total_pics+1): #batch process all the images graphicsmagick = "gm convert -size 500x500 " + config.file_path + now + "-0" + str(x) + ".jpg -thumbnail 500x500 " + config.file_path + now + "-0" + str(x) + "-sm.jpg" os.system(graphicsmagick) #do the graphicsmagick action graphicsmagick = "gm convert -delay " + str(gif_delay) + " " + config.file_path + now + "*-sm.jpg " + config.file_path + now + ".gif" os.system(graphicsmagick) #make the .gif else: # make an animated gif with the low resolution images graphicsmagick = "gm convert -delay " + str(gif_delay) + " " + config.file_path + now + "*.jpg " + config.file_path + now + ".gif" os.system(graphicsmagick) #make the .gif if config.post_online: # turn off posting pics online in config.py connected = is_connected() #check to see if you have an internet connection if (connected==False): print "bad internet connection" while connected: if config.make_gifs: try: file_to_upload = config.file_path + now + ".gif" #client.create_photo(config.tumblr_blog, state="published", tags=[config.tagsForTumblr], data=file_to_upload) break except ValueError: print "Oops. No internect connection. Upload later." try: #make a text file as a note to upload the .gif later file = open(config.file_path + now + "-FILENOTUPLOADED.txt",'w') # Trying to create a new file or open one file.close() except: print('Something went wrong. Could not write file.') sys.exit(0) # quit Python else: # upload jpgs instead try: # create an array and populate with file paths to our jpgs myJpgs=[0 for i in range(4)] for i in range(4): myJpgs[i]=config.file_path + now + "-0" + str(i+1) + ".jpg" #client.create_photo(config.tumblr_blog, state="published", tags=[config.tagsForTumblr], format="markdown", data=myJpgs) break except ValueError: print "Oops. No internect connection. Upload later." try: #make a text file as a note to upload the .gif later file = open(config.file_path + now + "-FILENOTUPLOADED.txt",'w') # Trying to create a new file or open one file.close() except: print('Something went wrong. Could not write file.') sys.exit(0) # quit Python ########################### Begin Step 4 ################################# input(pygame.event.get()) # press escape to exit pygame. Then press ctrl-c to exit python. try: display_pics(now) except Exception, e: tb = sys.exc_info()[2] traceback.print_exception(e.__class__, e, tb) pygame.quit() print "Done" if config.post_online: show_image(real_path + "/finished.png") else: show_image(real_path + "/finished2.png") time.sleep(restart_delay) show_image(real_path + "/intro.png"); #GPIO.output(led_pin,True) #turn on the LED #################### ### Main Program ### #################### ## clear the previously stored pics based on config settings if config.clear_on_startup: clear_pics(1) print "Photo booth app running..." for x in range(0, 5): #blink light to show the app is running #GPIO.output(led_pin,True) sleep(0.25) #GPIO.output(led_pin,False) sleep(0.25) show_image(real_path + "/intro.png"); while True: #GPIO.output(led_pin,True); #turn on the light showing users they can push the button input(pygame.event.get()) # press escape to exit pygame. Then press ctrl-c to exit python. #GPIO.wait_for_edge(btn_pin, GPIO.FALLING) time.sleep(config.debounce) #debounce start_photobooth()
{ "content_hash": "d72961390aad0449ea08341605478da7", "timestamp": "", "source": "github", "line_count": 369, "max_line_length": 171, "avg_line_length": 35.010840108401084, "alnum_prop": 0.6571716077095751, "repo_name": "emschimmel/CameraPi", "id": "3158d5084d046276c432bc89ccd7db02e9a6a2bf", "size": "13065", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "drummi/drumminhands_photobooth.py", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "48259" }, { "name": "Shell", "bytes": "35" } ], "symlink_target": "" }
package com.github.mateuszrasinski.fundtracker.sharedkernel; import lombok.EqualsAndHashCode; import lombok.ToString; import java.io.Serializable; import java.time.Instant; import java.util.UUID; @EqualsAndHashCode @ToString public abstract class DomainEvent implements Serializable { private final String id; private final Instant timestamp; protected DomainEvent() { id = UUID.randomUUID().toString(); timestamp = Instant.now(); } }
{ "content_hash": "761a03f90c074cb91d3d45384c4f4f39", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 60, "avg_line_length": 22.476190476190474, "alnum_prop": 0.75, "repo_name": "MateuszRasinski/fund-tracker", "id": "bd4c062be740ef5e5790c553c58db97f61f7f9d4", "size": "1072", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/github/mateuszrasinski/fundtracker/sharedkernel/DomainEvent.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Groovy", "bytes": "29877" }, { "name": "Java", "bytes": "61149" } ], "symlink_target": "" }
import webob import cinder.api.middleware.auth from cinder import test class TestCinderKeystoneContextMiddleware(test.TestCase): def setUp(self): super(TestCinderKeystoneContextMiddleware, self).setUp() @webob.dec.wsgify() def fake_app(req): self.context = req.environ['cinder.context'] return webob.Response() self.context = None self.middleware = (cinder.api.middleware.auth .CinderKeystoneContext(fake_app)) self.request = webob.Request.blank('/') self.request.headers['X_TENANT_ID'] = 'testtenantid' self.request.headers['X_AUTH_TOKEN'] = 'testauthtoken' def test_no_user_or_user_id(self): response = self.request.get_response(self.middleware) self.assertEqual(response.status, '401 Unauthorized') def test_user_only(self): self.request.headers['X_USER'] = 'testuser' response = self.request.get_response(self.middleware) self.assertEqual(response.status, '200 OK') self.assertEqual(self.context.user_id, 'testuser') def test_user_id_only(self): self.request.headers['X_USER_ID'] = 'testuserid' response = self.request.get_response(self.middleware) self.assertEqual(response.status, '200 OK') self.assertEqual(self.context.user_id, 'testuserid') def test_user_id_trumps_user(self): self.request.headers['X_USER_ID'] = 'testuserid' self.request.headers['X_USER'] = 'testuser' response = self.request.get_response(self.middleware) self.assertEqual(response.status, '200 OK') self.assertEqual(self.context.user_id, 'testuserid') def test_tenant_id_name(self): self.request.headers['X_USER_ID'] = 'testuserid' self.request.headers['X_TENANT_NAME'] = 'testtenantname' response = self.request.get_response(self.middleware) self.assertEqual(response.status, '200 OK') self.assertEqual(self.context.project_id, 'testtenantid') self.assertEqual(self.context.project_name, 'testtenantname')
{ "content_hash": "333bf213d4dec74207ca60dc8426618a", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 69, "avg_line_length": 39.679245283018865, "alnum_prop": 0.6600095102234903, "repo_name": "ntt-sic/cinder", "id": "600fed80de9f231c285ef0c6e64cec43ff5ad74d", "size": "2720", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "cinder/tests/api/middleware/test_auth.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "5200214" }, { "name": "Shell", "bytes": "8994" } ], "symlink_target": "" }
'use strict'; var Foo8 = require('./Foo8');
{ "content_hash": "54157f2b701fea9a8802e379acc47e31", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 29, "avg_line_length": 11.5, "alnum_prop": 0.5869565217391305, "repo_name": "kubicle/babyruby2js", "id": "9f3401811030749948a6268b44ff6a9c20e1a3bf", "size": "91", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/js-out/Test8.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "219" }, { "name": "JavaScript", "bytes": "223082" }, { "name": "Ruby", "bytes": "202716" } ], "symlink_target": "" }
#ifndef UTHREAD_H #define UTHREAD_H #include "common/u/u.h" #include "common/u/usecurity.h" #ifdef _WIN32 #else #include <pthread.h> #endif #ifdef _WIN32 #define U_THREAD_PROC(ProcName, arg) DWORD WINAPI ProcName(LPVOID arg) #else #define U_THREAD_PROC(ProcName, arg) void * ProcName(void* arg) #endif #define UEXITTHREAD_OK 0 #define UEXITTHREAD_FAIL (-1) #ifdef _WIN32 typedef HANDLE uResVal; typedef LPVOID uArg; typedef HANDLE UTHANDLE; typedef SIZE_T uStackSize; typedef LPTHREAD_START_ROUTINE uThreadProc; typedef DWORD UTID; typedef volatile LONG uspinlock; #else typedef int uResVal; typedef void* uArg; typedef pthread_t UTHANDLE; typedef size_t uStackSize; typedef void* (*uThreadProc)(void*); typedef int UTID; #ifdef HAVE_SPINLOCKS typedef pthread_spinlock_t uspinlock; #endif #endif #ifdef _WIN32 #define uSpinInit(sl) ((*(sl) = FALSE), 0) #define uSpinDestroy(sl) 0 #define uSpinLock(sl) while (InterlockedExchange(sl, TRUE) == TRUE) { Sleep(0); } #define uSpinUnlock(sl) InterlockedExchange(sl, FALSE) #else #define uSpinInit(sl) pthread_spin_init(sl, 0) #define uSpinDestroy(sl) pthread_spin_destroy(sl) #define uSpinLock(sl) pthread_spin_lock(sl) #define uSpinUnlock(sl) pthread_spin_unlock(sl) #endif #ifdef __cplusplus extern "C" { #endif uResVal uCreateThread( uThreadProc proc, uArg arg, UTHANDLE *id, uStackSize size, USECURITY_ATTRIBUTES* sa, sys_call_error_fun fun ); int uEnableSuspend(sys_call_error_fun fun); int uSuspendThread(UTHANDLE id, sys_call_error_fun fun); int uResumeThread(UTHANDLE id, sys_call_error_fun fun); int uTerminateThread(UTHANDLE id, sys_call_error_fun fun); int uCloseThreadHandle(UTHANDLE id, sys_call_error_fun fun); int uThreadJoin(UTHANDLE id, sys_call_error_fun fun); // use UEXITTHREAD_OK or UEXITTHREAD_FAIL as arguments to uExitThread void uExitThread(unsigned rc, sys_call_error_fun fun); UTHANDLE uGetCurrentThread(sys_call_error_fun fun); int uThreadBlockAllSignals(sys_call_error_fun fun); #ifdef __cplusplus } #endif #endif
{ "content_hash": "7e350ae9fb88b2d85b86f01c5ad887f4", "timestamp": "", "source": "github", "line_count": 92, "max_line_length": 82, "avg_line_length": 24.52173913043478, "alnum_prop": 0.6808510638297872, "repo_name": "sedna/sedna", "id": "bc23b757e03f56144f5fcbe56dfc87af80e739a9", "size": "2386", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "kernel/common/u/uthread.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "2398473" }, { "name": "C++", "bytes": "5347049" }, { "name": "CMake", "bytes": "80864" }, { "name": "CSS", "bytes": "9012" }, { "name": "Java", "bytes": "78184" }, { "name": "Lex", "bytes": "39219" }, { "name": "Objective-C", "bytes": "126674" }, { "name": "Perl", "bytes": "5104" }, { "name": "Python", "bytes": "7145" }, { "name": "Scheme", "bytes": "92231" }, { "name": "Shell", "bytes": "34344" }, { "name": "XQuery", "bytes": "482" }, { "name": "Yacc", "bytes": "118145" } ], "symlink_target": "" }
// // KSYQosInfo.h // IJKMediaPlayer // // Created by 崔崔 on 16/3/14. // Copyright © 2016年 bilibili. All rights reserved. // #import <Foundation/Foundation.h> @interface KSYQosInfo : NSObject /** audio queue size in bytes */ @property (nonatomic, assign)int audioBufferByteLength; /** audio queue time length in ms */ @property (nonatomic, assign)int audioBufferTimeLength; /** size of data have arrived at audio queue since playing. unit:byte */ @property (nonatomic, assign)int64_t audioTotalDataSize; /** video queue size in bytes */ @property (nonatomic, assign)int videoBufferByteLength; /** video queue time length in ms */ @property (nonatomic, assign)int videoBufferTimeLength; /** size of data have arrived at video queue since playing. unit:byte */ @property (nonatomic, assign)int64_t videoTotalDataSize; /** size of total audio and video data since playing. unit: byte */ @property (nonatomic, assign)int64_t totalDataSize; @end
{ "content_hash": "bb7a95aff34b0adab4172a59d5e223c6", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 69, "avg_line_length": 23.404761904761905, "alnum_prop": 0.7192268565615463, "repo_name": "hyf12138/NewLiveProject", "id": "f21c5a9321eeb376ab7f42012606e4c2d136c7d1", "size": "990", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "RongChatRoomDemo/Live/KSY/Engine/KSYMediaPlayer.framework/Headers/KSYQosInfo.h", "mode": "33261", "license": "mit", "language": [ { "name": "C", "bytes": "10168" }, { "name": "HTML", "bytes": "23864" }, { "name": "Objective-C", "bytes": "2563763" }, { "name": "Ruby", "bytes": "542" } ], "symlink_target": "" }
using System; using System.Collections; using NBitcoin.BouncyCastle.Asn1; using NBitcoin.BouncyCastle.Math; namespace NBitcoin.BouncyCastle.Asn1.Pkcs { public class PbeParameter : Asn1Encodable { private readonly Asn1OctetString salt; private readonly DerInteger iterationCount; public static PbeParameter GetInstance(object obj) { if (obj is PbeParameter || obj == null) { return (PbeParameter) obj; } if (obj is Asn1Sequence) { return new PbeParameter((Asn1Sequence) obj); } throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); } private PbeParameter(Asn1Sequence seq) { if (seq.Count != 2) throw new ArgumentException("Wrong number of elements in sequence", "seq"); salt = Asn1OctetString.GetInstance(seq[0]); iterationCount = DerInteger.GetInstance(seq[1]); } public PbeParameter(byte[] salt, int iterationCount) { this.salt = new DerOctetString(salt); this.iterationCount = new DerInteger(iterationCount); } public byte[] GetSalt() { return salt.GetOctets(); } public BigInteger IterationCount { get { return iterationCount.Value; } } public override Asn1Object ToAsn1Object() { return new DerSequence(salt, iterationCount); } } }
{ "content_hash": "48aaf332e6b1da2ae9759bd0a953f0c8", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 94, "avg_line_length": 22.5, "alnum_prop": 0.6762962962962963, "repo_name": "bitcoinbrisbane/NBitcoin", "id": "4e1f586485bbfef575fcd30621fe8abdc55dd641", "size": "1350", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "NBitcoin.BouncyCastle/asn1/pkcs/PBEParameter.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "7374333" }, { "name": "PowerShell", "bytes": "1028" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "22585fad81cde20db353cb312fa241f8", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "1b8b85ea760101634a4767025c419ecb4f684187", "size": "181", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Gentianales/Rubiaceae/Cruciata/Cruciata laevipes/ Syn. Aparine latifolia/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<!doctype html> <html> <title>npm-update</title> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="../../static/style.css"> <link rel="canonical" href="https://www.npmjs.org/doc/cli/npm-update.html"> <script async=true src="../../static/toc.js"></script> <body> <div id="wrapper"> <h1><a href="../cli/npm-update.html">npm-update</a></h1> <p>Update a package</p> <h2 id="synopsis">SYNOPSIS</h2> <pre><code>npm update [-g] [&lt;pkg&gt;...] aliases: up, upgrade </code></pre><h2 id="description">DESCRIPTION</h2> <p>This command will update all the packages listed to the latest version (specified by the <code>tag</code> config), respecting semver.</p> <p>It will also install missing packages. As with all commands that install packages, the <code>--dev</code> flag will cause <code>devDependencies</code> to be processed as well.</p> <p>If the <code>-g</code> flag is specified, this command will update globally installed packages.</p> <p>If no package name is specified, all packages in the specified location (global or local) will be updated.</p> <p>As of <a href="mailto:`npm@2.6.1">`npm@2.6.1</a><code>, the</code>npm update<code>will only inspect top-level packages. Prior versions of</code>npm<code>would also recursively inspect all dependencies. To get the old behavior, use</code>npm --depth 9999 update`.</p> <h2 id="examples">EXAMPLES</h2> <p>IMPORTANT VERSION NOTE: these examples assume <a href="mailto:`npm@2.6.1">`npm@2.6.1</a><code>or later. For older versions of</code>npm<code>, you must specify</code>--depth 0` to get the behavior described below.</p> <p>For the examples below, assume that the current package is <code>app</code> and it depends on dependencies, <code>dep1</code> (<code>dep2</code>, .. etc.). The published versions of <code>dep1</code> are:</p> <pre><code>{ &quot;dist-tags&quot;: { &quot;latest&quot;: &quot;1.2.2&quot; }, &quot;versions&quot;: [ &quot;1.2.2&quot;, &quot;1.2.1&quot;, &quot;1.2.0&quot;, &quot;1.1.2&quot;, &quot;1.1.1&quot;, &quot;1.0.0&quot;, &quot;0.4.1&quot;, &quot;0.4.0&quot;, &quot;0.2.0&quot; ] } </code></pre><h3 id="caret-dependencies">Caret Dependencies</h3> <p>If <code>app</code>&#39;s <code>package.json</code> contains:</p> <pre><code>&quot;dependencies&quot;: { &quot;dep1&quot;: &quot;^1.1.1&quot; } </code></pre><p>Then <code>npm update</code> will install <a href="mailto:`dep1@1.2.2">`dep1@1.2.2</a><code>, because</code>1.2.2<code>is</code>latest<code>and `1.2.2` satisfies</code>^1.1.1`.</p> <h3 id="tilde-dependencies">Tilde Dependencies</h3> <p>However, if <code>app</code>&#39;s <code>package.json</code> contains:</p> <pre><code>&quot;dependencies&quot;: { &quot;dep1&quot;: &quot;~1.1.1&quot; } </code></pre><p>In this case, running <code>npm update</code> will install <a href="mailto:`dep1@1.1.2">`dep1@1.1.2</a><code>. Even though the</code>latest<code>tag points to</code>1.2.2<code>, this version does not satisfy</code>~1.1.1<code>, which is equivalent to</code>&gt;=1.1.1 &lt;1.2.0<code>. So the highest-sorting version that satisfies</code>~1.1.1<code>is used, which is</code>1.1.2`.</p> <h3 id="caret-dependencies-below-1-0-0">Caret Dependencies below 1.0.0</h3> <p>Suppose <code>app</code> has a caret dependency on a version below <code>1.0.0</code>, for example:</p> <pre><code>&quot;dependencies&quot;: { &quot;dep1&quot;: &quot;^0.2.0&quot; } </code></pre><p><code>npm update</code> will install <a href="mailto:`dep1@0.2.0">`dep1@0.2.0</a><code>, because there are no other versions which satisfy</code>^0.2.0`.</p> <p>If the dependence were on <code>^0.4.0</code>:</p> <pre><code>&quot;dependencies&quot;: { &quot;dep1&quot;: &quot;^0.4.0&quot; } </code></pre><p>Then <code>npm update</code> will install <a href="mailto:`dep1@0.4.1">`dep1@0.4.1</a><code>, because that is the highest-sorting version that satisfies</code>^0.4.0<code>(</code>&gt;= 0.4.0 &lt;0.5.0`)</p> <h3 id="recording-updates-with-save">Recording Updates with <code>--save</code></h3> <p>When you want to update a package and save the new version as the minimum required dependency in <code>package.json</code>, you can use <code>npm update -S</code> or <code>npm update --save</code>. For example if <code>package.json</code> contains:</p> <pre><code>&quot;dependencies&quot;: { &quot;dep1&quot;: &quot;^1.1.1&quot; } </code></pre><p>Then <code>npm update --save</code> will install <a href="mailto:`dep1@1.2.2">`dep1@1.2.2</a><code>(i.e.,</code>latest<code>), and</code>package.json` will be modified:</p> <pre><code>&quot;dependencies&quot;: { &quot;dep1&quot;: &quot;^1.2.2&quot; } </code></pre><p>Note that <code>npm</code> will only write an updated version to <code>package.json</code> if it installs a new package.</p> <h3 id="updating-globally-installed-packages">Updating Globally-Installed Packages</h3> <p><code>npm update -g</code> will apply the <code>update</code> action to each globally installed package that is <code>outdated</code> -- that is, has a version that is different from <code>latest</code>.</p> <p>NOTE: If a package has been upgraded to a version newer than <code>latest</code>, it will be <em>downgraded</em>.</p> <h2 id="see-also">SEE ALSO</h2> <ul> <li><a href="../cli/npm-install.html">npm-install(1)</a></li> <li><a href="../cli/npm-outdated.html">npm-outdated(1)</a></li> <li><a href="../cli/npm-shrinkwrap.html">npm-shrinkwrap(1)</a></li> <li><a href="../misc/npm-registry.html">npm-registry(7)</a></li> <li><a href="../files/npm-folders.html">npm-folders(5)</a></li> <li><a href="../cli/npm-ls.html">npm-ls(1)</a></li> </ul> </div> <table border=0 cellspacing=0 cellpadding=0 id=npmlogo> <tr><td style="width:180px;height:10px;background:rgb(237,127,127)" colspan=18>&nbsp;</td></tr> <tr><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td><td style="width:40px;height:10px;background:#fff" colspan=4>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4>&nbsp;</td><td style="width:40px;height:10px;background:#fff" colspan=4>&nbsp;</td><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td><td colspan=6 style="width:60px;height:10px;background:#fff">&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4>&nbsp;</td></tr> <tr><td colspan=2 style="width:20px;height:30px;background:#fff" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:20px;height:10px;background:#fff" rowspan=4 colspan=2>&nbsp;</td><td style="width:10px;height:20px;background:rgb(237,127,127)" rowspan=2>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:20px;height:10px;background:#fff" rowspan=3 colspan=2>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td></tr> <tr><td style="width:10px;height:10px;background:#fff" rowspan=2>&nbsp;</td></tr> <tr><td style="width:10px;height:10px;background:#fff">&nbsp;</td></tr> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6>&nbsp;</td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff">&nbsp;</td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4>&nbsp;</td><td style="width:90px;height:10px;background:#fff" colspan=9>&nbsp;</td></tr> </table> <p id="footer">npm-update &mdash; npm@5.7.1</p>
{ "content_hash": "d83d439b559e7f4138ab61a0da2e1ccf", "timestamp": "", "source": "github", "line_count": 121, "max_line_length": 807, "avg_line_length": 64.39669421487604, "alnum_prop": 0.6892967145790554, "repo_name": "westoncolemanl/tabbr-api", "id": "2292133275fcc972b3b866e2bedb10a38b663606", "size": "7792", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "node_modules/npm/html/doc/cli/npm-update.html", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "171936" } ], "symlink_target": "" }
Given a natural radicand, return its square root. Note that the term "radicand" refers to the number for which the root is to be determined. That is, it is the number under the root symbol. Check out the Wikipedia pages on [square root](https://en.wikipedia.org/wiki/Square_root) and [methods of computing square roots](https://en.wikipedia.org/wiki/Methods_of_computing_square_roots). Recall also that natural numbers are positive real whole numbers (i.e. 1, 2, 3 and up).
{ "content_hash": "3c612ef2100797ff4c1fc9d19c1666c6", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 195, "avg_line_length": 68.14285714285714, "alnum_prop": 0.7693920335429769, "repo_name": "exercism/xelixir", "id": "19b61863e7ad206e14e8921ce296a858acdde91d", "size": "493", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "exercises/practice/square-root/.docs/instructions.md", "mode": "33188", "license": "mit", "language": [ { "name": "Elixir", "bytes": "388221" }, { "name": "Shell", "bytes": "1388" } ], "symlink_target": "" }
'use strict'; const dgram = require('dgram'); const Packet = require('./packet'); const EventEmitter = require('events'); const DeviceManagement = require('./management'); const IDENTITY_MAPPER = v => v; const ERRORS = { '-5001': (method, args, err) => err.message == 'invalid_arg' ? 'Invalid argument' : err.message, '-5005': (method, args, err) => err.message == 'params error' ? 'Invalid argument' : err.message, '-10000': (method) => 'Method `' + method + '` is not supported' }; class Device extends EventEmitter { constructor(options) { super(); this.id = options.id; this.type = 'generic'; this.model = options.model || 'unknown'; this.capabilities = []; this.address = options.address; this.port = options.port || 54321; this.writeOnly = options.writeOnly || false; this.packet = new Packet(); if(typeof options.token === 'string') { this.packet.token = Buffer.from(options.token, 'hex'); } else if(options.token instanceof Buffer) { this.packet.token = options.token; } this.socket = dgram.createSocket('udp4'); this.socket.on('message', this._onMessage.bind(this)); this._id = 0; this._promises = {}; this._hasFailedToken = false; this._properties = {}; this._propertiesToMonitor = []; this._propertyDefinitions = {}; this._reversePropertyDefinitions = {}; this._loadProperties = this._loadProperties.bind(this); this.management = new DeviceManagement(this); this.debug = require('debug')('miio.device.' + (options.id || '[' + options.address + ']')); } init() { // Default setup involves activating monitoring return this.monitor(); } hasCapability(name) { return this.capabilities.indexOf(name) >= 0; } _onMessage(msg) { try { this.packet.raw = msg; } catch(ex) { this.debug('<- Unable to parse packet', ex); return; } if(this._tokenResolve) { this.debug('<-', 'Handshake reply:', this.packet.checksum); this.packet.handleHandshakeReply(); this._lastToken = Date.now(); this._tokenResolve(); } else { let data = this.packet.data; if(! data) { this.debug('<-', null); return; } // Handle null-terminated strings if(data[data.length - 1] == 0) { data = data.slice(0, data.length - 1); } // Parse and handle the JSON message let str = data.toString('utf8'); this.debug('<- Message: `' + str + '`'); try { let object = JSON.parse(str); const p = this._promises[object.id]; if(! p) return; if(typeof object.result !== 'undefined') { p.resolve(object.result); } else { p.reject(object.error); } } catch(ex) { this.debug('<- Invalid JSON'); } } } _ensureToken() { if(! this.packet.needsHandshake) { return Promise.resolve(true); } if(this._hasFailedToken) { return Promise.reject(new Error('Token could not be auto-discovered')); } if(this._tokenPromise) { this.debug('Using existing promise'); return this._tokenPromise; } this._tokenPromise = new Promise((resolve, reject) => { this.debug('-> Handshake'); this.packet.handshake(); const data = this.packet.raw; this.socket.send(data, 0, data.length, this.port, this.address, err => err && reject(err)); this._tokenResolve = () => { delete this._tokenPromise; delete this._tokenResolve; clearTimeout(this._tokenTimeout); delete this._tokenTimeout; if(this.packet.token) { resolve(true); } else { this._hasFailedToken = true; reject(new Error('Token could not be auto-discovered')); } }; // Reject in 1 second this._tokenTimeout = setTimeout(() => { delete this._tokenPromise; delete this._tokenResolve; delete this._tokenTimeout; const err = new Error('Handshake timeout'); err.code = 'timeout'; reject(err); }, 1500); }); return this._tokenPromise; } call(method, args, options) { if(typeof args === 'undefined') { args = []; } const id = this._id = this._id == 10000 ? 1 : this._id + 1; const request = { id: id, method: method, params: args }; if(options && options.sid) { // If we have a sub-device set it (used by Lumi Smart Home Gateway) request.sid = options.sid; } const json = JSON.stringify(request); return new Promise((resolve, reject) => { let resolved = false; const promise = this._promises[id] = { resolve: res => { resolved = true; delete this._promises[id]; if(options && options.refresh) { // Special case for loading properties after setting values // - delay a bit to make sure the device has time to respond setTimeout(() => { const properties = Array.isArray(options.refresh) ? options.refresh : this._propertiesToMonitor; this._loadProperties(properties) .then(() => resolve(res)) .catch(() => resolve(res)) }, (options && options.refreshDelay) || 50); } else { resolve(res); } }, reject: err => { resolved = true; delete this._promises[id]; if(! (err instanceof Error) && typeof err.code !== 'undefined') { const code = err.code; const handler = ERRORS[code]; let msg; if(handler) { msg = handler(method, args, err.message); } else { msg = err.message || err.toString(); } err = new Error(msg); err.code = code; } reject(err); } }; let sendsLeft = (options && options.retries) || 3; const retry = () => { if(--sendsLeft > 0) { send(); } else { const err = new Error('Call to device timed out'); err.code = 'timeout'; promise.reject(err); } }; const send = () => { if(resolved) return; this._ensureToken() .catch(err => { if(err.code === 'timeout') { this.debug('<- Handshake timed out'); retry(); return false; } else { throw err; } }) .then(token => { // Token has timed out - handled via retry if(! token) return; this.debug('-> (' + sendsLeft + ')', json); this.packet.data = Buffer.from(json, 'utf8'); const data = this.packet.raw; this.socket.send(data, 0, data.length, this.port, this.address, err => err && promise.reject(err)); // Queue a retry in 2 seconds setTimeout(retry, 2000); }) .catch(promise.reject); }; send(); }); } /** * Define a property and how the value should be mapped. All defined * properties are monitored if #monitor() is called. */ defineProperty(name, def) { this._propertiesToMonitor.push(name); if(typeof def === 'function') { def = { mapper: def }; } else if(typeof def === 'undefined') { def = { mapper: IDENTITY_MAPPER } } if(! def.mapper) { def.mapper = IDENTITY_MAPPER; } if(def.name) { this._reversePropertyDefinitions[def.name] = name; } this._propertyDefinitions[name] = def; } /** * Indicate that you want to monitor defined properties. */ monitor(interval) { if(this._propertiesToMonitor.length === 0 || this.writeOnly) { // No properties or write only, resolve without doing anything return Promise.resolve(); } clearInterval(this._propertyMonitor); this._propertyMonitor = setInterval(this._loadProperties, interval || this._monitorInterval || 30000); return this._loadProperties(); } _pushProperty(result, name, value) { const def = this._propertyDefinitions[name]; if(! def) { result[name] = value; } else if(def.handler) { def.handler(result, value); } else { result[def.name || name] = def.mapper(value); } } _loadProperties(properties) { if(typeof properties === 'undefined') { properties = this._propertiesToMonitor; } if(properties.length === 0 || this.writeOnly) return Promise.resolve(); return this.loadProperties(properties) .then(values => { Object.keys(values).forEach(key => { this.setProperty(key, values[key]); }); }) .catch(err => { this.debug('Unable to load properties', err && err.stack ? err.stack : err); throw err; }); } setProperty(key, value) { const oldValue = this._properties[key]; if(oldValue !== value) { this._properties[key] = value; this.debug('Property', key, 'changed from', oldValue, 'to', value); this.emit('propertyChanged', { property: key, oldValue: oldValue, value: value }); } } setRawProperty(name, value) { const def = this._propertyDefinitions[name]; if(! def) return; if(def.handler) { const result = {}; def.handler(result, value); Object.keys(result).forEach(key => { this.setProperty(key, result[key]); }); } else { this.setProperty(def.name || name, def.mapper(value)); } } stopMonitoring() { clearInterval(this._propertyMonitor); } property(key) { return this._properties[key]; } get properties() { return Object.assign({}, this._properties); } getProperties(props) { const result = {}; props.forEach(key => { result[key] = this._properties[key]; }); return result; } loadProperties(props) { // Rewrite property names to device internal ones props = props.map(key => this._reversePropertyDefinitions[key] || key); // Call get_prop to map everything return this.call('get_prop', props) .then(result => { const obj = {}; for(let i=0; i<result.length; i++) { this._pushProperty(obj, props[i], result[i]); } return obj; }); } /** * Destroy this instance, this instance will no longer be able to * communicate with the remote device it represents. */ destroy() { this.stopMonitoring(); this.socket.close(); } /** * Check that the current result is equal to the string `ok`. */ static checkOk(result) { if(result != 'ok') throw new Error('Could not perform operation'); return null; } } module.exports = Device;
{ "content_hash": "0fefb3722e08b4600b71fb63a6cc1c8e", "timestamp": "", "source": "github", "line_count": 420, "max_line_length": 105, "avg_line_length": 23.521428571428572, "alnum_prop": 0.611904038870331, "repo_name": "housekit/housekit", "id": "974c017eed4854872e5dd39346bae265b81b9138", "size": "9879", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "node_modules/miio/lib/device.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "JavaScript", "bytes": "376793" }, { "name": "Shell", "bytes": "108" } ], "symlink_target": "" }
<?php /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** * +----------------------------------------------------------------------+ * | This LICENSE is in the BSD license style. | * | http://www.opensource.org/licenses/bsd-license.php | * | | * | 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 conditions and the following disclaimer. | * | | * | * Redistributions in binary form must reproduce the above | * | copyright notice, this list of conditions and the following | * | disclaimer in the documentation and/or other materials provided | * | with the distribution. | * | | * | * Neither the name of Clay Loveless nor the names of contributors | * | may be used to endorse or promote products derived from this | * | software without specific prior written permission. | * | | * | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | * | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | * | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | * | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | * | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | * | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | * | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | * | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | * | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | * | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | * | POSSIBILITY OF SUCH DAMAGE. | * +----------------------------------------------------------------------+ * * PHP version 5 * * @category VersionControl * @package VersionControl_SVN * @author Alexander Opitz <opitz.alexander@gmail.com> * @copyright 2012 Alexander Opitz * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @link http://pear.php.net/package/VersionControl_SVN */ require_once 'VersionControl/SVN/Exception.php'; /** * Exception for errors while parsing the command output. * * @category VersionControl * @package VersionControl_SVN * @author Alexander Opitz <opitz.alexander@gmail.com> * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @version 0.5.1 * @link http://pear.php.net/package/VersionControl_SVN */ class VersionControl_SVN_Parser_Exception extends VersionControl_SVN_Exception { }
{ "content_hash": "3ec1bfdbd703243441872f2a64e359f1", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 76, "avg_line_length": 53.41269841269841, "alnum_prop": 0.549182763744428, "repo_name": "PatidarWeb/pimcore", "id": "505b540b3af5bb67814e642c8195830f2090c2cf", "size": "3365", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "pimcore/lib/PEAR/VersionControl/SVN/Parser/Exception.php", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
package animal; public abstract class Animal implements Comparable<Animal>{ private String raca; private double peso; private int idade; private String nome; public void setNome(String nome){ this.nome = nome; } public String getNome(){ return nome; } public String getRaca(){ return raca; } public void setRaca(String raca){ this.raca = raca; } public double getPeso(){ return peso; } public void setPeso(double peso){ this.peso = peso; } public int getIdade(){ return idade; } public void setIdade(int idade){ this.idade = idade; } public abstract String fazerBarulho(); @Override public String toString() { if(this.getNome() != null) return this.nome + ": " + this.peso; return "Sem nome"; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Animal other = (Animal) obj; if(other.getRaca() == raca) return true; return false; } @Override public int compareTo(Animal animal) { if (this.peso < animal.peso) { return -1; } if (this.peso > animal.peso) { return 1; } return 0; } }
{ "content_hash": "f33c1ad96e67b770a8c02fdc9a73bf72", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 59, "avg_line_length": 16.2987012987013, "alnum_prop": 0.6207171314741036, "repo_name": "deniscampos/poo-java", "id": "7a433f0f0876e6b55848dec71dd5174ddc16e051", "size": "1255", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/animal/Animal.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "6205" } ], "symlink_target": "" }
/* A simple Bézier tool. It requires a canvas to draw things. * By Marcel Bruse, 2014. MIT licence. */ function BezierTool(canvas) { /* Reference to the requestAnimationFrame function. */ window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; /* A reference to the 2d context of the canvas. */ var context = canvas.getContext("2d"); /* The global bezier spline object. */ this.bezierSpline = new BezierSpline(); /* The maximum number of points of the bezier spline. */ var MAX_NUMBER_OF_POINTS = 12; /* The number of control points of a single bezier curve. */ var NUMBER_OF_CONTROL_POINTS = 4; /* The resolution of a single bezier curve. */ var BEZIER_CURVE_RESOLUTION = 0.025; /* Mouse state and position indicators. */ var mouseDown = false; var mouseDownAtX = 0; var mouseDownAtY = 0; var downTime = 0; var upTime = 0; var relativeX = 0; var relativeY = 0; var MOUSE_UP_DELAY = 500; var MOUSE_POSITION_OFFSET = 2; /* The currently selected point and handle. */ var selectedPoint = null; var selectedHandle = null; /* Grid specific constants. */ var GRID_CELL_WIDTH = 20; /* Color settings and shape settings. */ var GRID_COLOR = "#000000"; var POINT_COLOR = "#aaaaaa"; var HIGHLIGHTED_POINT_COLOR = "#2200ff"; var HANDLE_COLOR = "#2200ff"; var BEZIER_SPLINE_COLOR = "#444444"; var PROFILE_COLOR = "#fbc4ff"; var PROFILE_FILL_COLOR = "#fbeafc"; var DASH_SPACING = [4]; /* Key codes for keyboard events. */ var DELETE_POINT_KEY_CODE = 46; /* Indicates if the canvas will be refreshed or not. */ this.refreshActivated = true; /* The scope of this application. */ var scope = this; /****************************************/ /* Definition of the BezierSpline class */ /****************************************/ function BezierSpline() { this.firstPoint = null; this.lastPoint = null; this.size = 0; /* Adds a new point to the bezier spline. */ this.addPoint = function(point) { if (this.size < MAX_NUMBER_OF_POINTS) { if (point != null) { if (this.lastPoint != null) { point.previous = this.lastPoint; this.lastPoint.next = point; } if (this.firstPoint == null) { this.firstPoint = point; } this.lastPoint = point; this.size++; } } } /* Removes a given point from the bezier spline. */ this.removePoint = function(aPoint) { var point = this.firstPoint; while (point != null) { if (point.x == aPoint.x && point.y == aPoint.y) { if (point.previous != null & point.next != null) { point.previous.next = point.next; point.next.previous = point.previous; } else if (point.previous != null) { this.lastPoint = point.previous; point.previous.next = null; } else if (point.next != null) { this.firstPoint = point.next; this.firstPoint.leftHandle.x = this.firstPoint.x; this.firstPoint.leftHandle.y = this.firstPoint.y; point.next.previous = null; } else { this.firstPoint = null; this.lastPoint = null; } this.size--; break; } point = point.next; } } /* Calculates the resulting path from the bezier spline which is a polyline represented by a path object. */ this.calculatePath = function() { var path = new Path(); if (this.size > 1) { var point = this.firstPoint; while (point != this.lastPoint) { var position = new Position(point.x, point.y); position.mappedPointList.push(point); path.addPosition(position); var t = BEZIER_CURVE_RESOLUTION; while (t <= 1) { var m = 1 - t; var x = 0; var y = 0; for (var i = 0; i < NUMBER_OF_CONTROL_POINTS; i++) { var controlPoint; var binomial; if (i == 0) { controlPoint = point; binomial = 1; } else if (i == 1) { controlPoint = point.rightHandle; binomial = 3; } else if (i == 2) { controlPoint = point.next.leftHandle; binomial = 3; } else { controlPoint = point.next; binomial = 1; } var ni = NUMBER_OF_CONTROL_POINTS - i - 1; var factor = binomial * Math.pow(t, i) * Math.pow(m, ni); x = x + factor * controlPoint.x; y = y + factor * controlPoint.y; } path.addPositionXY(x, y); t = t + BEZIER_CURVE_RESOLUTION; } point = point.next; } path.addPositionXY(this.lastPoint.x, this.lastPoint.y); } return path; } /* Draws the bezier spline. */ this.draw = function() { this.calculatePath().draw(); } } /********************************/ /* Definition of the Path class */ /********************************/ function Path() { this.firstPosition = null; this.lastPosition = null; this.size = 0; /* Adds a given position to the path. */ this.addPosition = function(position) { if (this.firstPosition == null) { this.firstPosition = position; this.lastPosition = position; } else { this.lastPosition.next = position; this.lastPosition = position; } this.size++; } /* Adds a given position to the path by the positions coordinates. */ this.addPositionXY = function(x, y) { var position = new Position(x, y); this.addPosition(position); } /* Draws the path as a polyline. */ this.draw = function() { if (this.size > 1) { context.strokeStyle = BEZIER_SPLINE_COLOR; context.beginPath(); context.moveTo(this.firstPosition, this.lastPosition); var position = this.firstPosition; while (position != null) { context.lineTo(position.x, position.y); position = position.next; } context.stroke(); } } /* Calculates the length of the path. */ this.length = function() { var length = 0; var position = this.firstPosition; while (position != null) { length = length + position.distance(position.next); position = position.next; } return length; } } /************************************/ /* Definition of the Position class */ /************************************/ function Position(x, y) { this.x = x; this.y = y; this.next = null; this.mappedPointList = new Array(); /* Calculates the euclidean distance between this position and a given position. */ this.distance = function(position) { if (position != null) { return Math.sqrt(Math.pow(position.x - this.x, 2) + Math.pow(position.y - this.y, 2)); } else { return 0; } } } /*********************************/ /* Definition of the Point class */ /*********************************/ function Point(x, y) { this.x = x; this.y = y; this.previous = null; this.next = null; this.leftHandle = new Handle(this); this.rightHandle = new Handle(this); this.highlight = false; this.moved = false; /* The radius of the perimeter around a point. */ Point.radius = 10; /* Draws this point. */ this.draw = function() { if (this.highlight) { context.strokeStyle = HIGHLIGHTED_POINT_COLOR; context.fillStyle = HIGHLIGHTED_POINT_COLOR; } else { context.strokeStyle = POINT_COLOR; context.fillStyle = POINT_COLOR; } context.beginPath(); context.fillRect(this.x - 1, this.y - 1, 2, 2); context.arc(this.x, this.y, Point.radius, 0, 2 * Math.PI); context.stroke(); } /* Moves this point and its associated handles to the given coordinates. */ this.moveTo = function(x, y) { var u = x - this.x; var v = y - this.y; this.x = x; this.y = y; this.leftHandle.x = this.leftHandle.x + u; this.leftHandle.y = this.leftHandle.y + v; this.rightHandle.x = this.rightHandle.x + u; this.rightHandle.y = this.rightHandle.y + v; } } /**********************************/ /* Definition of the Handle class */ /**********************************/ function Handle(parent) { this.x = parent.x; this.y = parent.y; this.visible = true; this.parent = parent; /* The radius of the perimeter around a handle. */ Handle.radius = 6; /* Draws this handle. */ this.draw = function() { if (this.visible) { context.strokeStyle = HANDLE_COLOR; context.fillStyle = HANDLE_COLOR; context.fillRect(this.x - 1, this.y - 1, 2, 2); context.beginPath(); context.arc(this.x, this.y, Handle.radius, 0, 2 * Math.PI); context.stroke(); if (!context.setLineDash) { context.setLineDash = function() {}; } else { context.setLineDash([DASH_SPACING]); } context.moveTo(this.x, this.y); context.lineTo(this.parent.x, this.parent.y); context.stroke(); if (!context.setLineDash) { context.setLineDash = function() {}; } else { context.setLineDash([]); } } } } /* Activates or deactivates refreshing of the canvas. */ this.setRefreshActivated = function(refreshActivated) { this.refreshActivated = refreshActivated; if (refreshActivated) { requestAnimationFrame(refreshCanvas); } } /*********************/ /* Gloabal Functions */ /*********************/ /* Draws a grid on the workbench. */ function drawGrid() { context.fillStyle = GRID_COLOR; for (var i = GRID_CELL_WIDTH; i < canvas.width; i = i + GRID_CELL_WIDTH) { for (var j = GRID_CELL_WIDTH; j < canvas.height; j = j + GRID_CELL_WIDTH) { context.fillRect(i, j, 1, 1); } } } /* Clears the canvas and redraws the bezier spline. */ function refreshCanvas() { if (scope.refreshActivated) { context.clearRect(0, 0, canvas.width, canvas.height); drawGrid(); scope.bezierSpline.draw(); if (selectedPoint != null) { selectedPoint.leftHandle.draw(); selectedPoint.rightHandle.draw(); } var point = scope.bezierSpline.firstPoint; while (point != null) { point.draw(); point = point.next; } requestAnimationFrame(refreshCanvas); } } /* Searches for a point at the given coordinates. */ function searchPointAt(x, y) { var result = null; var point = scope.bezierSpline.firstPoint; while (point != null) { if (x <= point.x + Point.radius && x >= point.x - Point.radius && y <= point.y + Point.radius && y >= point.y - Point.radius) { result = point; break; } point = point.next; } return result; } /* Searches for a handle at the given coordiantes. */ function searchHandleAt(x, y) { var result = null; var point = scope.bezierSpline.firstPoint; while (point != null) { if (x <= point.leftHandle.x + Handle.radius && x >= point.leftHandle.x - Handle.radius && y <= point.leftHandle.y + Handle.radius && y >= point.leftHandle.y - Handle.radius) { result = point.leftHandle; break; } else if (x <= point.rightHandle.x + Handle.radius && x >= point.rightHandle.x - Handle.radius && y <= point.rightHandle.y + Handle.radius && y >= point.rightHandle.y - Handle.radius) { result = point.rightHandle; break; } point = point.next; } return result; } /* Handles mouse down events. */ function handleMouseDownEvent(event) { downTime = +new Date(); mouseDown = true; if (selectedPoint != null) { selectedPoint.highlight = false; selectedPoint.moved = false; selectedPoint = null; } selectedHandle = searchHandleAt(relativeX, relativeY); var evt = event ? event:window.event; if (selectedHandle != null && evt.ctrlKey) { selectedPoint = selectedHandle.parent; if (selectedPoint == scope.bezierSpline.firstPoint) { selectedHandle = selectedPoint.rightHandle; } selectedPoint.highlight = true; } else { var point = searchPointAt(relativeX, relativeY); if (point != null) { selectedPoint = point; selectedPoint.highlight = true; } } } /* Handles mouse up events. */ function handleMouseUpEvent(event) { upTime = +new Date(); mouseDown = false; if (selectedPoint != null && selectedPoint.moved) { selectedPoint.moved = false; } else { var point = searchPointAt(relativeX, relativeY); if (point == null & upTime < downTime + MOUSE_UP_DELAY & mouseDownAtX == relativeX & mouseDownAtY == relativeY) { if (selectedPoint != null) { selectedPoint.highlight = false; } if (scope.bezierSpline.size < MAX_NUMBER_OF_POINTS) { var newPoint = new Point(relativeX, relativeY); scope.bezierSpline.addPoint(newPoint); selectedPoint = newPoint; selectedPoint.highlight = true; } else { selectedPoint = null; } } } } /* Handles mouse move events. */ function handleMouseMoveEvent(event) { if (mouseDown && selectedPoint != null) { var evt = event ? event:window.event; if (!selectedPoint.moved && evt.ctrlKey) { if (selectedHandle != null) { selectedHandle.x = relativeX; selectedHandle.y = relativeY; selectedPoint.highlight = true; } } else { if (evt.shiftKey) { relativeX = Math.floor(relativeX / GRID_CELL_WIDTH) * GRID_CELL_WIDTH; relativeY = Math.floor(relativeY / GRID_CELL_WIDTH) * GRID_CELL_WIDTH; } selectedPoint.moveTo(relativeX, relativeY); selectedPoint.moved = true; } } } /* Calculates and stores the current mouse position relative to DOM elements offset. */ function storeRelativeMousePosition(event, offsetLeft, offsetTop) { relativeX = event.pageX - offsetLeft - MOUSE_POSITION_OFFSET; relativeY = event.pageY - offsetTop - MOUSE_POSITION_OFFSET; } /* Register the mouse down event. */ $(canvas).mousedown(function(event) { storeRelativeMousePosition(event, this.offsetLeft, this.offsetTop); mouseDownAtX = relativeX; mouseDownAtY = relativeY; handleMouseDownEvent(event); }); /* Register the mouse up event. */ $(canvas).mouseup(function(event) { storeRelativeMousePosition(event, this.offsetLeft, this.offsetTop); handleMouseUpEvent(event); }); /* Register the mouse move event. */ $(canvas).mousemove(function(event) { storeRelativeMousePosition(event, this.offsetLeft, this.offsetTop); handleMouseMoveEvent(event); }); /* Registers keyboard events. */ window.addEventListener("keyup", function(event) { if (event.which != null && event.which == DELETE_POINT_KEY_CODE && selectedPoint != null) { scope.bezierSpline.removePoint(selectedPoint); selectedPoint = null; } }); /* Start rendering. */ requestAnimationFrame(refreshCanvas); }
{ "content_hash": "84b4e3a2925a87f7b33663a2445bbb44", "timestamp": "", "source": "github", "line_count": 516, "max_line_length": 110, "avg_line_length": 27.93217054263566, "alnum_prop": 0.6217303822937625, "repo_name": "900k/bezier-tool", "id": "9d04fef03852636372e3e7f7fb30b617c414a8f3", "size": "14414", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bezier-tool.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "14414" } ], "symlink_target": "" }
#include <linux/highmem.h> #include <linux/module.h> #include <linux/pagemap.h> #include <asm/homecache.h> #define kmap_get_pte(vaddr) \ pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)),\ (vaddr)), (vaddr)) void *kmap(struct page *page) { void *kva; unsigned long flags; pte_t *ptep; might_sleep(); if (!PageHighMem(page)) return page_address(page); kva = kmap_high(page); /* * Rewrite the PTE under the lock. This ensures that the page * is not currently migrating. */ ptep = kmap_get_pte((unsigned long)kva); flags = homecache_kpte_lock(); set_pte_at(&init_mm, kva, ptep, mk_pte(page, page_to_kpgprot(page))); homecache_kpte_unlock(flags); return kva; } EXPORT_SYMBOL(kmap); void kunmap(struct page *page) { if (in_interrupt()) BUG(); if (!PageHighMem(page)) return; kunmap_high(page); } EXPORT_SYMBOL(kunmap); /* * Describe a single atomic mapping of a page on a given cpu at a * given address, and allow it to be linked into a list. */ struct atomic_mapped_page { struct list_head list; struct page *page; int cpu; unsigned long va; }; static spinlock_t amp_lock = __SPIN_LOCK_UNLOCKED(&amp_lock); static struct list_head amp_list = LIST_HEAD_INIT(amp_list); /* * Combining this structure with a per-cpu declaration lets us give * each cpu an atomic_mapped_page structure per type. */ struct kmap_amps { struct atomic_mapped_page per_type[KM_TYPE_NR]; }; static DEFINE_PER_CPU(struct kmap_amps, amps); /* * Add a page and va, on this cpu, to the list of kmap_atomic pages, * and write the new pte to memory. Writing the new PTE under the * lock guarantees that it is either on the list before migration starts * (if we won the race), or set_pte() sets the migrating bit in the PTE * (if we lost the race). And doing it under the lock guarantees * that when kmap_atomic_fix_one_pte() comes along, it finds a valid * PTE in memory, iff the mapping is still on the amp_list. * * Finally, doing it under the lock lets us safely examine the page * to see if it is immutable or not, for the generic kmap_atomic() case. * If we examine it earlier we are exposed to a race where it looks * writable earlier, but becomes immutable before we write the PTE. */ static void kmap_atomic_register(struct page *page, int type, unsigned long va, pte_t *ptep, pte_t pteval) { unsigned long flags; struct atomic_mapped_page *amp; flags = homecache_kpte_lock(); spin_lock(&amp_lock); /* With interrupts disabled, now fill in the per-cpu info. */ amp = this_cpu_ptr(&amps.per_type[type]); amp->page = page; amp->cpu = smp_processor_id(); amp->va = va; /* For generic kmap_atomic(), choose the PTE writability now. */ if (!pte_read(pteval)) pteval = mk_pte(page, page_to_kpgprot(page)); list_add(&amp->list, &amp_list); set_pte(ptep, pteval); spin_unlock(&amp_lock); homecache_kpte_unlock(flags); } /* * Remove a page and va, on this cpu, from the list of kmap_atomic pages. * Linear-time search, but we count on the lists being short. * We don't need to adjust the PTE under the lock (as opposed to the * kmap_atomic_register() case), since we're just unconditionally * zeroing the PTE after it's off the list. */ static void kmap_atomic_unregister(struct page *page, unsigned long va) { unsigned long flags; struct atomic_mapped_page *amp; int cpu = smp_processor_id(); spin_lock_irqsave(&amp_lock, flags); list_for_each_entry(amp, &amp_list, list) { if (amp->page == page && amp->cpu == cpu && amp->va == va) break; } BUG_ON(&amp->list == &amp_list); list_del(&amp->list); spin_unlock_irqrestore(&amp_lock, flags); } /* Helper routine for kmap_atomic_fix_kpte(), below. */ static void kmap_atomic_fix_one_kpte(struct atomic_mapped_page *amp, int finished) { pte_t *ptep = kmap_get_pte(amp->va); if (!finished) { set_pte(ptep, pte_mkmigrate(*ptep)); flush_remote(0, 0, NULL, amp->va, PAGE_SIZE, PAGE_SIZE, cpumask_of(amp->cpu), NULL, 0); } else { /* * Rewrite a default kernel PTE for this page. * We rely on the fact that set_pte() writes the * present+migrating bits last. */ pte_t pte = mk_pte(amp->page, page_to_kpgprot(amp->page)); set_pte(ptep, pte); } } /* * This routine is a helper function for homecache_fix_kpte(); see * its comments for more information on the "finished" argument here. * * Note that we hold the lock while doing the remote flushes, which * will stall any unrelated cpus trying to do kmap_atomic operations. * We could just update the PTEs under the lock, and save away copies * of the structs (or just the va+cpu), then flush them after we * release the lock, but it seems easier just to do it all under the lock. */ void kmap_atomic_fix_kpte(struct page *page, int finished) { struct atomic_mapped_page *amp; unsigned long flags; spin_lock_irqsave(&amp_lock, flags); list_for_each_entry(amp, &amp_list, list) { if (amp->page == page) kmap_atomic_fix_one_kpte(amp, finished); } spin_unlock_irqrestore(&amp_lock, flags); } /* * kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap * because the kmap code must perform a global TLB invalidation when * the kmap pool wraps. * * Note that they may be slower than on x86 (etc.) because unlike on * those platforms, we do have to take a global lock to map and unmap * pages on Tile (see above). * * When holding an atomic kmap is is not legal to sleep, so atomic * kmaps are appropriate for short, tight code paths only. */ void *kmap_atomic_prot(struct page *page, pgprot_t prot) { unsigned long vaddr; int idx, type; pte_t *pte; preempt_disable(); pagefault_disable(); /* Avoid icache flushes by disallowing atomic executable mappings. */ BUG_ON(pte_exec(prot)); if (!PageHighMem(page)) return page_address(page); type = kmap_atomic_idx_push(); idx = type + KM_TYPE_NR*smp_processor_id(); vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); pte = kmap_get_pte(vaddr); BUG_ON(!pte_none(*pte)); /* Register that this page is mapped atomically on this cpu. */ kmap_atomic_register(page, type, vaddr, pte, mk_pte(page, prot)); return (void *)vaddr; } EXPORT_SYMBOL(kmap_atomic_prot); void *kmap_atomic(struct page *page) { /* PAGE_NONE is a magic value that tells us to check immutability. */ return kmap_atomic_prot(page, PAGE_NONE); } EXPORT_SYMBOL(kmap_atomic); void __kunmap_atomic(void *kvaddr) { unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; if (vaddr >= __fix_to_virt(FIX_KMAP_END) && vaddr <= __fix_to_virt(FIX_KMAP_BEGIN)) { pte_t *pte = kmap_get_pte(vaddr); pte_t pteval = *pte; int idx, type; type = kmap_atomic_idx(); idx = type + KM_TYPE_NR*smp_processor_id(); /* * Force other mappings to Oops if they try to access this pte * without first remapping it. Keeping stale mappings around * is a bad idea. */ BUG_ON(!pte_present(pteval) && !pte_migrating(pteval)); kmap_atomic_unregister(pte_page(pteval), vaddr); kpte_clear_flush(pte, vaddr); kmap_atomic_idx_pop(); } else { /* Must be a lowmem page */ BUG_ON(vaddr < PAGE_OFFSET); BUG_ON(vaddr >= (unsigned long)high_memory); } pagefault_enable(); preempt_enable(); } EXPORT_SYMBOL(__kunmap_atomic); /* * This API is supposed to allow us to map memory without a "struct page". * Currently we don't support this, though this may change in the future. */ void *kmap_atomic_pfn(unsigned long pfn) { return kmap_atomic(pfn_to_page(pfn)); } void *kmap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot) { return kmap_atomic_prot(pfn_to_page(pfn), prot); }
{ "content_hash": "d44ea75a30047606baa022e7012d9ebb", "timestamp": "", "source": "github", "line_count": 265, "max_line_length": 74, "avg_line_length": 28.649056603773584, "alnum_prop": 0.6898050579557429, "repo_name": "KristFoundation/Programs", "id": "eca28551b22d418d0252145e79d8565125a246d5", "size": "8148", "binary": false, "copies": "597", "ref": "refs/heads/master", "path": "luaide/arch/tile/mm/highmem.c", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "10201036" }, { "name": "Awk", "bytes": "30879" }, { "name": "C", "bytes": "539626448" }, { "name": "C++", "bytes": "3413466" }, { "name": "Clojure", "bytes": "1570" }, { "name": "Cucumber", "bytes": "4809" }, { "name": "Groff", "bytes": "46837" }, { "name": "Lex", "bytes": "55541" }, { "name": "Lua", "bytes": "59745" }, { "name": "Makefile", "bytes": "1601043" }, { "name": "Objective-C", "bytes": "521706" }, { "name": "Perl", "bytes": "730609" }, { "name": "Perl6", "bytes": "3783" }, { "name": "Python", "bytes": "296036" }, { "name": "Shell", "bytes": "357961" }, { "name": "SourcePawn", "bytes": "4687" }, { "name": "UnrealScript", "bytes": "12797" }, { "name": "XS", "bytes": "1239" }, { "name": "Yacc", "bytes": "115572" } ], "symlink_target": "" }
#ifndef test_hc_documentcreateelementcasesensitive #define test_hc_documentcreateelementcasesensitive /** * The tagName parameter in the "createElement(tagName)" * method is case-sensitive for XML documents. * Retrieve the entire DOM document and invoke its * "createElement(tagName)" method twice. Once for tagName * equal to "acronym" and once for tagName equal to "ACRONYM" * Each call should create a distinct Element node. The * newly created Elements are then assigned attributes * that are retrieved. * Modified on 27 June 2003 to avoid setting an invalid style * values and checked the node names to see if they matched expectations. * @author Curt Arnold * @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547</a> * @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=243">http://www.w3.org/Bugs/Public/show_bug.cgi?id=243</a> */ template<class string_type, class string_adaptor> class hc_documentcreateelementcasesensitive : public DOMTestCase<string_type, string_adaptor> { typedef DOMTestCase<string_type, string_adaptor> baseT; public: hc_documentcreateelementcasesensitive(std::string name) : baseT(name) { // check if loaded documents are supported for content type const std::string contentType = baseT::getContentType(); baseT::preload(contentType, "hc_staff", true); } typedef typename Arabica::DOM::DOMImplementation<string_type, string_adaptor> DOMImplementation; typedef typename Arabica::DOM::Document<string_type, string_adaptor> Document; typedef typename Arabica::DOM::DocumentType<string_type, string_adaptor> DocumentType; typedef typename Arabica::DOM::DocumentFragment<string_type, string_adaptor> DocumentFragment; typedef typename Arabica::DOM::Node<string_type, string_adaptor> Node; typedef typename Arabica::DOM::Element<string_type, string_adaptor> Element; typedef typename Arabica::DOM::Attr<string_type, string_adaptor> Attr; typedef typename Arabica::DOM::NodeList<string_type, string_adaptor> NodeList; typedef typename Arabica::DOM::NamedNodeMap<string_type, string_adaptor> NamedNodeMap; typedef typename Arabica::DOM::Entity<string_type, string_adaptor> Entity; typedef typename Arabica::DOM::EntityReference<string_type, string_adaptor> EntityReference; typedef typename Arabica::DOM::CharacterData<string_type, string_adaptor> CharacterData; typedef typename Arabica::DOM::CDATASection<string_type, string_adaptor> CDATASection; typedef typename Arabica::DOM::Text<string_type, string_adaptor> Text; typedef typename Arabica::DOM::Comment<string_type, string_adaptor> Comment; typedef typename Arabica::DOM::ProcessingInstruction<string_type, string_adaptor> ProcessingInstruction; typedef typename Arabica::DOM::Notation<string_type, string_adaptor> Notation; typedef typename Arabica::DOM::DOMException DOMException; typedef string_type String; typedef string_adaptor SA; typedef bool boolean; /* * Runs the test case. */ void runTest() { Document doc; Element newElement1; Element newElement2; String attribute1; String attribute2; String nodeName1; String nodeName2; doc = (Document) baseT::load("hc_staff", true); newElement1 = doc.createElement(SA::construct_from_utf8("ACRONYM")); newElement2 = doc.createElement(SA::construct_from_utf8("acronym")); newElement1.setAttribute(SA::construct_from_utf8("lang"), SA::construct_from_utf8("EN")); newElement2.setAttribute(SA::construct_from_utf8("title"), SA::construct_from_utf8("Dallas")); attribute1 = newElement1.getAttribute(SA::construct_from_utf8("lang")); attribute2 = newElement2.getAttribute(SA::construct_from_utf8("title")); baseT::assertEquals("EN", attribute1, __LINE__, __FILE__); baseT::assertEquals("Dallas", attribute2, __LINE__, __FILE__); nodeName1 = newElement1.getNodeName(); nodeName2 = newElement2.getNodeName(); baseT::assertEquals("ACRONYM", nodeName1, __LINE__, __FILE__); baseT::assertEquals("acronym", nodeName2, __LINE__, __FILE__); } /* * Gets URI that identifies the test. */ std::string getTargetURI() const { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateelementcasesensitive"; } }; #endif
{ "content_hash": "00d485d7b8c3caae870594dc20bddbd7", "timestamp": "", "source": "github", "line_count": 96, "max_line_length": 180, "avg_line_length": 46.6875, "alnum_prop": 0.7280232039268184, "repo_name": "draekko/arabica", "id": "2124f9e996a4b821db4bbaaf0ecf661664a4ca5f", "size": "5193", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "tests/DOM/conformance/level1/core/hc_documentcreateelementcasesensitive.hpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ASP", "bytes": "161" }, { "name": "Assembly", "bytes": "2142" }, { "name": "Batchfile", "bytes": "1233939" }, { "name": "C++", "bytes": "4842960" }, { "name": "CMake", "bytes": "37886" }, { "name": "Eagle", "bytes": "1012" }, { "name": "HTML", "bytes": "245557" }, { "name": "PHP", "bytes": "2212" }, { "name": "Pascal", "bytes": "499" }, { "name": "Python", "bytes": "755" }, { "name": "Shell", "bytes": "314884" }, { "name": "XSLT", "bytes": "3773971" } ], "symlink_target": "" }
/* * $Id$ */ /* * isotpsend.c * * Copyright (c) 2008 Volkswagen Group Electronic Research * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Volkswagen nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * Alternatively, provided that this notice is retained in full, this * software may be distributed under the terms of the GNU General * Public License ("GPL") version 2, in which case the provisions of the * GPL apply INSTEAD OF those given above. * * The provided data structures and external interfaces from this code * are not restricted to be used by modules with a GPL compatible license. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * * Send feedback to <linux-can@vger.kernel.org> * */ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <libgen.h> #include <net/if.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <linux/can.h> #include <linux/can/isotp.h> #define NO_CAN_ID 0xFFFFFFFFU void print_usage(char *prg) { fprintf(stderr, "\nUsage: %s [options] <CAN interface>\n", prg); fprintf(stderr, "Options: -s <can_id> (source can_id. Use 8 digits for extended IDs)\n"); fprintf(stderr, " -d <can_id> (destination can_id. Use 8 digits for extended IDs)\n"); fprintf(stderr, " -x <addr> (extended addressing mode. Use 'any' for all addresses)\n"); fprintf(stderr, " -p <byte> (set and enable padding byte)\n"); fprintf(stderr, " -P <mode> (check padding in FC. (l)ength (c)ontent (a)ll)\n"); fprintf(stderr, " -t <time ns> (frame transmit time (N_As) in nanosecs)\n"); fprintf(stderr, " -f <time ns> (ignore FC and force local tx stmin value in nanosecs)\n"); fprintf(stderr, "\nCAN IDs and addresses are given and expected in hexadecimal values.\n"); fprintf(stderr, "The pdu data is expected on STDIN in space separated ASCII hex values.\n"); fprintf(stderr, "\n"); } int main(int argc, char **argv) { int s; struct sockaddr_can addr; struct ifreq ifr; static struct can_isotp_options opts; int opt; extern int optind, opterr, optopt; __u32 force_tx_stmin = 0; unsigned char buf[4096]; int buflen = 0; addr.can_addr.tp.tx_id = addr.can_addr.tp.rx_id = NO_CAN_ID; while ((opt = getopt(argc, argv, "s:d:x:p:P:t:f:?")) != -1) { switch (opt) { case 's': addr.can_addr.tp.tx_id = strtoul(optarg, (char **)NULL, 16); if (strlen(optarg) > 7) addr.can_addr.tp.tx_id |= CAN_EFF_FLAG; break; case 'd': addr.can_addr.tp.rx_id = strtoul(optarg, (char **)NULL, 16); if (strlen(optarg) > 7) addr.can_addr.tp.rx_id |= CAN_EFF_FLAG; break; case 'x': opts.flags |= CAN_ISOTP_EXTEND_ADDR; opts.ext_address = strtoul(optarg, (char **)NULL, 16) & 0xFF; break; case 'p': opts.flags |= CAN_ISOTP_TX_PADDING; opts.txpad_content = strtoul(optarg, (char **)NULL, 16) & 0xFF; break; case 'P': if (optarg[0] == 'l') opts.flags |= CAN_ISOTP_CHK_PAD_LEN; else if (optarg[0] == 'c') opts.flags |= CAN_ISOTP_CHK_PAD_DATA; else if (optarg[0] == 'a') opts.flags |= (CAN_ISOTP_CHK_PAD_DATA | CAN_ISOTP_CHK_PAD_DATA); else { printf("unknown padding check option '%c'.\n", optarg[0]); print_usage(basename(argv[0])); exit(0); } break; case 't': opts.frame_txtime = strtoul(optarg, (char **)NULL, 10); break; case 'f': opts.flags |= CAN_ISOTP_FORCE_TXSTMIN; force_tx_stmin = strtoul(optarg, (char **)NULL, 10); break; case '?': print_usage(basename(argv[0])); exit(0); break; default: fprintf(stderr, "Unknown option %c\n", opt); print_usage(basename(argv[0])); exit(1); break; } } if ((argc - optind != 1) || (addr.can_addr.tp.tx_id == NO_CAN_ID) || (addr.can_addr.tp.rx_id == NO_CAN_ID)) { print_usage(basename(argv[0])); exit(1); } if ((s = socket(PF_CAN, SOCK_DGRAM, CAN_ISOTP)) < 0) { perror("socket"); exit(1); } setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_OPTS, &opts, sizeof(opts)); if (opts.flags & CAN_ISOTP_FORCE_TXSTMIN) setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_TX_STMIN, &force_tx_stmin, sizeof(force_tx_stmin)); addr.can_family = AF_CAN; strcpy(ifr.ifr_name, argv[optind]); ioctl(s, SIOCGIFINDEX, &ifr); addr.can_ifindex = ifr.ifr_ifindex; if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) { perror("bind"); close(s); exit(1); } while (buflen < 4096 && scanf("%hhx", &buf[buflen]) == 1) buflen++; write(s, buf, buflen); /* * due to a Kernel internal wait queue the PDU is sent completely * before close() returns. */ close(s); return 0; }
{ "content_hash": "5587ab4675b6ff3e491b5acc7c0791ff", "timestamp": "", "source": "github", "line_count": 193, "max_line_length": 100, "avg_line_length": 32.310880829015545, "alnum_prop": 0.6401539448364336, "repo_name": "mxcd/CANnon", "id": "9cdfcd2e3ea3921dd374de59a4ba6e5edc351814", "size": "6236", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "RasPi/isotpsend.c", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "49046" }, { "name": "C", "bytes": "4387710" }, { "name": "C++", "bytes": "118258" }, { "name": "M4", "bytes": "1918" }, { "name": "Makefile", "bytes": "4741" }, { "name": "Objective-C", "bytes": "646" }, { "name": "Shell", "bytes": "1330" } ], "symlink_target": "" }
@implementation DyldInfoUtil //|++++++++++++++++++++++++++++++++++++|// + (NSString*)extractOutputForArchitecture:(NSString*)arch fromInput:(NSString*)input { NSMutableArray *result = [NSMutableArray array]; NSArray *lines = [input componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; if ([lines.firstObject rangeOfString:@"for arch "].location != 0) // Only a single arch. return input; for (NSUInteger i = 0; i < lines.count; i++) { NSString *line = lines[i]; if ([line rangeOfString:[NSString stringWithFormat:@"for arch %@:", arch]].location == 0) { for (i = i+1; i < lines.count; i++) { line = lines[i]; if ([line rangeOfString:@"for arch "].location == 0) break; [result addObject:line]; } } } return [result componentsJoinedByString:@"\n"]; } //|++++++++++++++++++++++++++++++++++++|// + (NSArray*)parseDylibs:(NSString*)input { NSMutableArray *result = [NSMutableArray array]; NSArray *lines = [input componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; for (NSString *line in lines) { if ([line rangeOfString:@"/"].location == NSNotFound) { if (result.count > 0) break; else continue; } NSArray *components = [line componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; components = [components filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^(NSString* evaluatedObject, __unused id bindings) { return (BOOL)([evaluatedObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]].length > 0); }]]; if (components.count > 1) [result addObject:@{ @"name": components[1], @"attributes": components[0] }]; else [result addObject:@{ @"name": components[0] }]; } return result; } //|++++++++++++++++++++++++++++++++++++|// + (NSArray*)parseRebaseCommands:(NSString*)input { NSMutableArray *result = nil; NSArray *lines = [input componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; for (NSString *line in lines) { if ([line rangeOfString:@"rebase opcodes"].location == 0) { result = [NSMutableArray array]; continue; } else if ([line rangeOfString:@"REBASE_"].location != NSNotFound) [result addObject:line]; else if (result.count > 0) // dyldinfo -arch x86_64 ... prints the rebase commands for both // x86_64_all and x86_64h. Fortunately, it prints the x86_64_all // slice first so we stop parsing when we hit then end of the first // set of rebase opcodes. break; } return result; } //|++++++++++++++++++++++++++++++++++++|// + (NSArray*)parseBindCommands:(NSString*)input { NSMutableArray *result = nil; NSArray *lines = [input componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; for (NSString *line in lines) { if ([line rangeOfString:@"binding opcodes"].location == 0) { result = [NSMutableArray array]; } else if ([line rangeOfString:@"BIND_"].location != NSNotFound) [result addObject:line]; else if (result.count > 0) break; } return result; } //|++++++++++++++++++++++++++++++++++++|// + (NSArray*)parseWeakBindCommands:(NSString*)input { NSMutableArray *result = nil; NSArray *lines = [input componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; for (NSString *line in lines) { if ([line rangeOfString:@"weak binding opcodes"].location == 0) { result = [NSMutableArray array]; continue; } else if ([line rangeOfString:@"BIND_"].location != NSNotFound) [result addObject:line]; else if (result.count > 0) break; } return result; } //|++++++++++++++++++++++++++++++++++++|// + (NSArray*)parseLazyBindCommands:(NSString*)input { NSMutableArray *result = nil; NSArray *lines = [input componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; for (NSString *line in lines) { if ([line rangeOfString:@"lazy binding opcodes"].location == 0) { result = [NSMutableArray array]; continue; } else if ([line rangeOfString:@"BIND_"].location != NSNotFound) [result addObject:line]; else if (result.count > 0) break; } return result; } //|++++++++++++++++++++++++++++++++++++|// + (NSArray*)parseFixups:(NSString*)input { NSMutableArray *result = [NSMutableArray array]; NSArray *lines = [input componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; for (NSString *line in lines) { NSArray *components = [line componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; if (components.count > 1 && [components[0] rangeOfString:@"__"].location == 0) { components = [components filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^(NSString* evaluatedObject, __unused id bindings) { return (BOOL)([evaluatedObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]].length > 0); }]]; [result addObject:@{ @"segment": components[0], @"section": components[1], @"address": components[2], @"type": [[components subarrayWithRange:NSMakeRange(3, components.count - 3)] componentsJoinedByString:@" "] }]; } else if (result.count > 0) // dyldinfo -arch x86_64 ... prints the fixups for both // x86_64_all and x86_64h. Fortunately, it prints the x86_64_all // slice first so we stop parsing when we hit then end of the first // set of fixups. break; } return result; } //|++++++++++++++++++++++++++++++++++++|// + (NSArray*)parseBindings:(NSString*)input { NSMutableArray *result = [NSMutableArray array]; NSArray *lines = [input componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; for (NSString *line in lines) { NSArray *components = [line componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; if (components.count > 1 && [components[0] rangeOfString:@"__"].location == 0) { components = [components filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^(NSString* evaluatedObject, __unused id bindings) { return (BOOL)([evaluatedObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]].length > 0); }]]; [result addObject:@{ @"segment": components[0], @"section": components[1], @"address": components[2], @"type": components[3], @"addend": components[4], @"dylib": components[5], @"symbol": components[6] }]; } else if (result.count > 0) // dyldinfo -arch x86_64 ... prints the bindings for both // x86_64_all and x86_64h. Fortunately, it prints the x86_64_all // slice first so we stop parsing when we hit then end of the first // set of bindings. break; } return result; } //|++++++++++++++++++++++++++++++++++++|// + (NSArray*)parseWeakBindings:(NSString*)input { NSMutableArray *result = [NSMutableArray array]; NSArray *lines = [input componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; for (NSString *line in lines) { NSArray *components = [line componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; if (components.count > 1 && [components[0] rangeOfString:@"__"].location == 0) { components = [components filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^(NSString* evaluatedObject, __unused id bindings) { return (BOOL)([evaluatedObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]].length > 0); }]]; [result addObject:@{ @"segment": components[0], @"section": components[1], @"address": components[2], @"type": components[3], @"addend": components[4], @"symbol": components[5] }]; } else if (result.count > 0) // dyldinfo -arch x86_64 ... prints the bindings for both // x86_64_all and x86_64h. Fortunately, it prints the x86_64_all // slice first so we stop parsing when we hit then end of the first // set of bindings. break; } return result; } //|++++++++++++++++++++++++++++++++++++|// + (NSArray*)parseLazyBindings:(NSString*)input { NSMutableArray *result = [NSMutableArray array]; NSArray *lines = [input componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; for (NSString *line in lines) { NSArray *components = [line componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; if (components.count > 1 && [components[0] rangeOfString:@"__"].location == 0) { components = [components filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^(NSString* evaluatedObject, __unused id bindings) { return (BOOL)([evaluatedObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]].length > 0); }]]; [result addObject:@{ @"segment": components[0], @"section": components[1], @"address": components[2], @"index": components[3], @"dylib": components[4], @"symbol": components[5] }]; } else if (result.count > 0) // dyldinfo -arch x86_64 ... prints the bindings for both // x86_64_all and x86_64h. Fortunately, it prints the x86_64_all // slice first so we stop parsing when we hit then end of the first // set of bindings. break; } return result; } //|++++++++++++++++++++++++++++++++++++|// + (NSArray*)parseExports:(NSString*)input { NSMutableArray *result = nil; NSArray *lines = [input componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; for (NSString *line in lines) { if (result == nil && [line rangeOfString:@"export information"].location == 0) { result = [NSMutableArray array]; continue; } else if ([line rangeOfString:@"0x"].location != NSNotFound || [line rangeOfString:@"[re-export]"].location != NSNotFound) [result addObject:line]; else if (result.count > 0) break; } return result; } //|++++++++++++++++++++++++++++++++++++|// + (NSArray*)parseFunctionStarts:(NSString*)input { unsigned long long previous = 0; NSMutableArray *result = [NSMutableArray array]; NSArray *lines = [input componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; for (NSString *line in lines) { NSArray *components = [line componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; if (components.count > 0 && [components[0] rangeOfString:@"0x"].location == 0) { NSScanner *scanner = [[NSScanner alloc] initWithString:components[0]]; unsigned long long address; if ([scanner scanHexLongLong:&address] == NO || address < previous) break; else previous = address; components = [components filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^(NSString* evaluatedObject, __unused id bindings) { return (BOOL)([evaluatedObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]].length > 0); }]]; BOOL isThumb = [components[1] isEqualToString:@"[thumb]"]; NSString *symbolName = components.count > 2 ? components[2] : components[1]; if ([symbolName isEqualToString:@"?"]) symbolName = nil; if (symbolName) { [result addObject:@{ @"address": components[0], @"thumb" : [NSNumber numberWithBool:isThumb], @"symbol": symbolName }]; } else { [result addObject:@{ @"address": components[0], @"thumb" : [NSNumber numberWithBool:isThumb] }]; } } } return result; } @end
{ "content_hash": "707349c32851c902c69650647e91c811", "timestamp": "", "source": "github", "line_count": 331, "max_line_length": 149, "avg_line_length": 39.78851963746224, "alnum_prop": 0.5763097949886105, "repo_name": "DeVaukz/MachO-Kit", "id": "14e4a54aca99718a9f50f21343cbffc5b911646e", "size": "14723", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Tests/Support/DyldInfoUtil.m", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "790612" }, { "name": "C++", "bytes": "18252" }, { "name": "Objective-C", "bytes": "2873883" }, { "name": "Ruby", "bytes": "1823" } ], "symlink_target": "" }
class AddUserIdIndexToFolders < ActiveRecord::Migration def change add_index :folders, [:user_id], name: 'index_folders_on_user_id' end end
{ "content_hash": "3e4d1229b370c9f208ec5cae693c9a28", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 68, "avg_line_length": 29.6, "alnum_prop": 0.7364864864864865, "repo_name": "jmwenda/feedbunch", "id": "e226670c4d4a2d55f7e00c5a8b183bc50ab8a4a7", "size": "148", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "db/migrate/20140519115517_add_user_id_index_to_folders.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "18781" }, { "name": "CoffeeScript", "bytes": "167500" }, { "name": "HTML", "bytes": "127629" }, { "name": "JavaScript", "bytes": "1402" }, { "name": "Ruby", "bytes": "1119814" } ], "symlink_target": "" }
/** * Residue Molecule. * * @param {Complex} complex - Molecular complex this Molecule belongs to. * @param {String} name - Molecule's name. * @param {Integer} index - Molecule's index in file. * * @exports Molecule * @constructor */ class Molecule { constructor(complex, name, index) { this.complex = complex this.name = name || '' this.residues = [] this.mask = 1 | 0 this.index = index || -1 // start with 1 } forEachResidue(process) { const { residues } = this for (let i = 0, n = residues.length; i < n; ++i) { process(residues[i]) } } collectMask() { let mask = 0xffffffff const { residues } = this for (let i = 0, n = residues.length; i < n; ++i) { mask &= residues[i]._mask } this.mask = mask } } export default Molecule
{ "content_hash": "3376fa6bfb88e2472f7682a03f26838b", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 73, "avg_line_length": 22.08108108108108, "alnum_prop": 0.587515299877601, "repo_name": "epam/miew", "id": "bf913520a22e5e9d06812903579186cc81230f7b", "size": "817", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "packages/miew/src/chem/Molecule.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1833" }, { "name": "Dockerfile", "bytes": "290" }, { "name": "GLSL", "bytes": "65825" }, { "name": "HTML", "bytes": "516" }, { "name": "Handlebars", "bytes": "3604" }, { "name": "JavaScript", "bytes": "1298478" }, { "name": "Python", "bytes": "11096" }, { "name": "SCSS", "bytes": "7628" }, { "name": "Shell", "bytes": "1064" }, { "name": "TypeScript", "bytes": "137209" }, { "name": "Yacc", "bytes": "17904" } ], "symlink_target": "" }
ACCEPTED #### According to NUB Generator [autonym] #### Published in null #### Original name null ### Remarks null
{ "content_hash": "2b6fe1eb0c1f1731566ccd1832b9af5b", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 23, "avg_line_length": 9.076923076923077, "alnum_prop": 0.6779661016949152, "repo_name": "mdoering/backbone", "id": "e87a6626b6c2081c4c9d982d3fb5bb4819c914e2", "size": "172", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malvales/Bixaceae/Amoreuxia/Amoreuxia unipora/Amoreuxia unipora unipora/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_25) on Thu May 29 13:56:25 PDT 2014 --> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> <title>Uses of Class com.fasterxml.jackson.jr.ob.impl.EnumReader (jackson-jr-objects 2.4.0 API)</title> <meta name="date" content="2014-05-29"> <link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class com.fasterxml.jackson.jr.ob.impl.EnumReader (jackson-jr-objects 2.4.0 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../com/fasterxml/jackson/jr/ob/impl/EnumReader.html" title="class in com.fasterxml.jackson.jr.ob.impl">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../index.html?com/fasterxml/jackson/jr/ob/impl/class-use/EnumReader.html" target="_top">Frames</a></li> <li><a href="EnumReader.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class com.fasterxml.jackson.jr.ob.impl.EnumReader" class="title">Uses of Class<br>com.fasterxml.jackson.jr.ob.impl.EnumReader</h2> </div> <div class="classUseContainer">No usage of com.fasterxml.jackson.jr.ob.impl.EnumReader</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../com/fasterxml/jackson/jr/ob/impl/EnumReader.html" title="class in com.fasterxml.jackson.jr.ob.impl">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../index.html?com/fasterxml/jackson/jr/ob/impl/class-use/EnumReader.html" target="_top">Frames</a></li> <li><a href="EnumReader.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2014 <a href="http://fasterxml.com/">FasterXML</a>. All Rights Reserved.</small></p> </body> </html>
{ "content_hash": "4b623be3c6ee9f91f01ecdd1b95efb0c", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 149, "avg_line_length": 38.88034188034188, "alnum_prop": 0.6058474389975819, "repo_name": "FasterXML/jackson-jr", "id": "73b01ace0d1ecf153d87bd7225227965763b1275", "size": "4549", "binary": false, "copies": "1", "ref": "refs/heads/2.14", "path": "docs/javadoc/2.4/com/fasterxml/jackson/jr/ob/impl/class-use/EnumReader.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "562477" }, { "name": "Logos", "bytes": "7741" } ], "symlink_target": "" }
package nam.model; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; @XmlType(name = "CommandName", namespace = "http://nam/model") @XmlEnum public enum CommandName { @XmlEnumValue("New") NEW("New"), @XmlEnumValue("Call") CALL("Call"), @XmlEnumValue("Send") SEND("Send"), @XmlEnumValue("Invoke") INVOKE("Invoke"), @XmlEnumValue("Listen") LISTEN("Listen"), @XmlEnumValue("Receive") RECEIVE("Receive"), @XmlEnumValue("Reply") REPLY("Reply"), @XmlEnumValue("Post") POST("Post"), @XmlEnumValue("Throw") THROW("Throw"), @XmlEnumValue("Execute") EXECUTE("Execute"), @XmlEnumValue("Expression") EXPRESSION("Expression"), @XmlEnumValue("Option") OPTION("Option"), @XmlEnumValue("Branch") BRANCH("Branch"), @XmlEnumValue("Call") DONE("Call"); private final String value; private CommandName(String value) { this.value = value; } public String getValue() { return value; } public static CommandName fromValue(String name) { return valueOf(name); } public String value() { return name(); } }
{ "content_hash": "7faaa9293336ba563a2977cd65163b3e", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 62, "avg_line_length": 15.932432432432432, "alnum_prop": 0.6598812553011026, "repo_name": "tfisher1226/ARIES", "id": "b3cc7fc95ac5501696b1d82a1e6fae28be2c0b34", "size": "1179", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "nam/nam-model/src/main/java/nam/model/CommandName.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "1606" }, { "name": "CSS", "bytes": "660469" }, { "name": "Common Lisp", "bytes": "91717" }, { "name": "Emacs Lisp", "bytes": "12403" }, { "name": "GAP", "bytes": "86009" }, { "name": "HTML", "bytes": "9381408" }, { "name": "Java", "bytes": "25671734" }, { "name": "JavaScript", "bytes": "304513" }, { "name": "Shell", "bytes": "51942" } ], "symlink_target": "" }
package eu.ehealth.util.threading; import java.util.ArrayList; import java.util.List; import java.util.concurrent.RecursiveTask; import eu.ehealth.StorageComponentMain; import eu.ehealth.db.xsd.CarerInfo; import eu.ehealth.security.DataBasePasswords; /** * * @author a572832 * */ public class DecryptCarerInfoTask extends RecursiveTask<List<CarerInfo>> { private static final long serialVersionUID = 5806774193022301800L; private List<Object[]> _l; private List<CarerInfo> _qiList; /** * * @param l */ public DecryptCarerInfoTask(List<Object[]> l) { super(); this._l = l; _qiList = new ArrayList<CarerInfo>(); } @Override protected List<CarerInfo> compute() { try { int totalProcessors = Runtime.getRuntime().availableProcessors(); if ((totalProcessors == 1) || ((_l != null) && (_l.size() < 10))) { for (Object[] objRes : _l) { Integer id = (Integer) objRes[0]; String name = DataBasePasswords.decryptDBValue((String) objRes[1]); String surname = DataBasePasswords.decryptDBValue((String) objRes[2]); CarerInfo qi = new CarerInfo(); qi.setID(id.toString()); qi.setSurname(name); qi.setName(surname); _qiList.add(qi); } } else if (_l != null) { int ini = 0; int mid = ((_l.size() / 2) - 1); int end = _l.size(); DecryptCarerInfoTask leftTask = new DecryptCarerInfoTask(_l.subList(ini, mid)); DecryptCarerInfoTask rightTask = new DecryptCarerInfoTask(_l.subList(mid, end)); // asynchronously execute both left and right tasks in the pool the current task is running in leftTask.fork(); rightTask.fork(); // wait for the left half result _qiList.addAll( leftTask.join() ); // wait for the right half result _qiList.addAll( rightTask.join() ); } } catch (Exception ex) { StorageComponentMain.logException(ex); } return _qiList; } }
{ "content_hash": "0f7e7878c0982941b237b17f81238ad6", "timestamp": "", "source": "github", "line_count": 87, "max_line_length": 111, "avg_line_length": 23.908045977011493, "alnum_prop": 0.6067307692307692, "repo_name": "modaclouds-atos/ehealth-app-final-prototype", "id": "b857357a4f27658801c78102d8a1ddeac49ca372", "size": "2080", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "ehealth-storage-component/src/main/java/eu/ehealth/util/threading/DecryptCarerInfoTask.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "1025142" }, { "name": "CSS", "bytes": "142176" }, { "name": "HTML", "bytes": "22022" }, { "name": "Java", "bytes": "2219006" }, { "name": "JavaScript", "bytes": "98766" }, { "name": "XSLT", "bytes": "21697" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="50dp" android:background="#484E61"> <TextView android:id="@+id/title_text" android:layout_centerInParent="true" android:textColor="#fff" android:textSize="24sp" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout> <ListView android:id="@+id/list_view" android:layout_width="match_parent" android:layout_height="match_parent"> </ListView> </LinearLayout>
{ "content_hash": "fc81029bf0bcd6c3e57d3eccff9285f6", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 72, "avg_line_length": 30.142857142857142, "alnum_prop": 0.6303317535545023, "repo_name": "feng510/coolweather", "id": "9aa710fa58c34a30c61627104df81105e82bcae2", "size": "844", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/res/layout/choose_area.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "35055" } ], "symlink_target": "" }
package flens.typing.scripting; import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.ISODateTimeFormat; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; public class ElasticSearchUtil { private static DateTimeFormatter format = ISODateTimeFormat.dateTime(); private Map<String, Object> out; private Set<String> tags; public ElasticSearchUtil(Map<String, Object> out, Set<String> tags) { this.out = out; this.tags = tags; } public void addTag(String tag) { tags.add(tag); } public void clean() { List<String> badkeys = new LinkedList<String>(); for (String key : out.keySet()) { if (key.startsWith("@")) { badkeys.add(key); } } for (String key : badkeys) { out.put(key.substring(1), out.remove(key)); } } public void cleanTime() { out.put("time", format.parseMillis((String) out.remove("@timestamp"))); } public Set<String> getTags() { return tags; } }
{ "content_hash": "72f08d4bf245a905f69acd121cdab030", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 79, "avg_line_length": 21.71153846153846, "alnum_prop": 0.6023029229406555, "repo_name": "wouterdb/flens", "id": "650374ba2b868112e501f61fed73c7cec17ccc00", "size": "1941", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/flens/typing/scripting/ElasticSearchUtil.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "525623" }, { "name": "Shell", "bytes": "8356" } ], "symlink_target": "" }
from __future__ import unicode_literals import logging from django.utils.translation import ugettext as _ from pygments.lexers import TextLexer from reviewboard.reviews.chunk_generators import MarkdownDiffChunkGenerator from reviewboard.reviews.ui.text import TextBasedReviewUI from reviewboard.reviews.markdown_utils import (iter_markdown_lines, render_markdown_from_file) class MarkdownReviewUI(TextBasedReviewUI): """A Review UI for markdown files. This renders the markdown to HTML, and allows users to comment on each top-level block (header, paragraph, list, code block, etc). """ supported_mimetypes = ['text/x-markdown'] object_key = 'markdown' can_render_text = True rendered_chunk_generator_cls = MarkdownDiffChunkGenerator extra_css_classes = ['markdown-review-ui'] js_view_class = 'RB.MarkdownReviewableView' def generate_render(self): with self.obj.file as f: f.open() rendered = render_markdown_from_file(f) try: for line in iter_markdown_lines(rendered): yield line except Exception as e: logging.error('Failed to parse resulting Markdown XHTML for ' 'file attachment %d: %s', self.obj.pk, e, exc_info=True) yield _('Error while rendering Markdown content: %s') % e def get_source_lexer(self, filename, data): return TextLexer()
{ "content_hash": "d325b976686500a9eac639e9e643e2c6", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 75, "avg_line_length": 34.15555555555556, "alnum_prop": 0.6376057254391672, "repo_name": "custode/reviewboard", "id": "db19cd6b9c7cca6e5b68c963c8abbc409d54f7a6", "size": "1537", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "reviewboard/reviews/ui/markdownui.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "202938" }, { "name": "HTML", "bytes": "179113" }, { "name": "JavaScript", "bytes": "1443998" }, { "name": "Python", "bytes": "3617214" }, { "name": "Shell", "bytes": "20225" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <CrawlItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Text>danas sam naručio pizzu napolitanu, zaista prva liga. .. puno smo naručivali i pizze su im zaista uvijek dobre.</Text> <Rating>6</Rating> <Source>http://pauza.hr/menu/piccolo-pizzeria</Source> </CrawlItem>
{ "content_hash": "bd73eaacb64d2921c40eebb4bf5613c7", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 126, "avg_line_length": 62, "alnum_prop": 0.717741935483871, "repo_name": "Tweety-FER/tar-polarity", "id": "3040074009b4e0090af3b293d0c638cae67ea09e", "size": "374", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "CropinionDataset/reviews_original/Train/comment1349.xml", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "4796" }, { "name": "Python", "bytes": "9870" } ], "symlink_target": "" }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Generic; using System.Linq; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests { /// <summary> /// Tests related to use site errors. /// </summary> public class UseSiteErrorTests : CSharpTestBase { [Fact] public void TestFields() { var text = @" public class C { public CSharpErrors.Subclass1 Field; }"; CompileWithMissingReference(text).VerifyDiagnostics(); } [Fact] public void TestOverrideMethodReturnType() { var text = @" class C : CSharpErrors.ClassMethods { public override UnavailableClass ReturnType1() { return null; } public override UnavailableClass[] ReturnType2() { return null; } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,21): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public override UnavailableClass ReturnType1() { return null; } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass"), // (5,21): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public override UnavailableClass[] ReturnType2() { return null; } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass"), // (4,38): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override UnavailableClass ReturnType1() { return null; } Diagnostic(ErrorCode.ERR_NoTypeDef, "ReturnType1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (5,40): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override UnavailableClass[] ReturnType2() { return null; } Diagnostic(ErrorCode.ERR_NoTypeDef, "ReturnType2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestOverrideMethodReturnTypeModOpt() { var text = @" class C : ILErrors.ClassMethods { public override int ReturnType1() { return 0; } public override int[] ReturnType2() { return null; } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,25): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override int ReturnType1() { return 0; } Diagnostic(ErrorCode.ERR_NoTypeDef, "ReturnType1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (5,27): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override int[] ReturnType2() { return null; } Diagnostic(ErrorCode.ERR_NoTypeDef, "ReturnType2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestOverrideMethodParameterType() { var text = @" class C : CSharpErrors.ClassMethods { public override void ParameterType1(UnavailableClass x) { } public override void ParameterType2(UnavailableClass[] x) { } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,41): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public override void ParameterType1(UnavailableClass x) { } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass"), // (5,41): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public override void ParameterType2(UnavailableClass[] x) { } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass")); } [Fact] public void TestOverrideMethodParameterTypeModOpt() { var text = @" class C : ILErrors.ClassMethods { public override void ParameterType1(int x) { } public override void ParameterType2(int[] x) { } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,26): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override void ParameterType1(int x) { } Diagnostic(ErrorCode.ERR_NoTypeDef, "ParameterType1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (5,26): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override void ParameterType2(int[] x) { } Diagnostic(ErrorCode.ERR_NoTypeDef, "ParameterType2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestImplicitlyImplementMethod() { var text = @" class C : CSharpErrors.InterfaceMethods { public UnavailableClass ReturnType1() { return null; } public UnavailableClass[] ReturnType2() { return null; } public void ParameterType1(UnavailableClass x) { } public void ParameterType2(UnavailableClass[] x) { } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (5,12): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public UnavailableClass[] ReturnType2() { return null; } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(5, 12), // (6,32): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public void ParameterType1(UnavailableClass x) { } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(6, 32), // (7,32): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public void ParameterType2(UnavailableClass[] x) { } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(7, 32), // (4,12): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public UnavailableClass ReturnType1() { return null; } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(4, 12), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceMethods Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceMethods").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceMethods Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceMethods").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceMethods Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceMethods").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceMethods Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceMethods").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11) ); } [Fact] public void TestImplicitlyImplementMethodModOpt() { var text = @" class C : ILErrors.InterfaceMethods { public int ReturnType1() { return 0; } public int[] ReturnType2() { return null; } public void ParameterType1(int x) { } public void ParameterType2(int[] x) { } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,16): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public int ReturnType1() { return 0; } Diagnostic(ErrorCode.ERR_NoTypeDef, "ReturnType1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (5,18): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public int[] ReturnType2() { return null; } Diagnostic(ErrorCode.ERR_NoTypeDef, "ReturnType2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (6,17): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public void ParameterType1(int x) { } Diagnostic(ErrorCode.ERR_NoTypeDef, "ParameterType1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (7,17): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public void ParameterType2(int[] x) { } Diagnostic(ErrorCode.ERR_NoTypeDef, "ParameterType2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestExplicitlyImplementMethod() { var text = @" class C : CSharpErrors.InterfaceMethods { UnavailableClass CSharpErrors.InterfaceMethods.ReturnType1() { return null; } UnavailableClass[] CSharpErrors.InterfaceMethods.ReturnType2() { return null; } void CSharpErrors.InterfaceMethods.ParameterType1(UnavailableClass x) { } void CSharpErrors.InterfaceMethods.ParameterType2(UnavailableClass[] x) { } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (5,5): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // UnavailableClass[] CSharpErrors.InterfaceMethods.ReturnType2() { return null; } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(5, 5), // (5,54): error CS0539: 'C.ReturnType2()' in explicit interface declaration is not a member of interface // UnavailableClass[] CSharpErrors.InterfaceMethods.ReturnType2() { return null; } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "ReturnType2").WithArguments("C.ReturnType2()").WithLocation(5, 54), // (6,55): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // void CSharpErrors.InterfaceMethods.ParameterType1(UnavailableClass x) { } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(6, 55), // (6,40): error CS0539: 'C.ParameterType1(UnavailableClass)' in explicit interface declaration is not a member of interface // void CSharpErrors.InterfaceMethods.ParameterType1(UnavailableClass x) { } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "ParameterType1").WithArguments("C.ParameterType1(UnavailableClass)").WithLocation(6, 40), // (7,55): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // void CSharpErrors.InterfaceMethods.ParameterType2(UnavailableClass[] x) { } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(7, 55), // (7,40): error CS0539: 'C.ParameterType2(UnavailableClass[])' in explicit interface declaration is not a member of interface // void CSharpErrors.InterfaceMethods.ParameterType2(UnavailableClass[] x) { } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "ParameterType2").WithArguments("C.ParameterType2(UnavailableClass[])").WithLocation(7, 40), // (4,5): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // UnavailableClass CSharpErrors.InterfaceMethods.ReturnType1() { return null; } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(4, 5), // (4,52): error CS0539: 'C.ReturnType1()' in explicit interface declaration is not a member of interface // UnavailableClass CSharpErrors.InterfaceMethods.ReturnType1() { return null; } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "ReturnType1").WithArguments("C.ReturnType1()").WithLocation(4, 52), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceMethods Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceMethods").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceMethods Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceMethods").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceMethods Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceMethods").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceMethods Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceMethods").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11) ); } [Fact] public void TestExplicitlyImplementMethodModOpt() { var text = @" class C : ILErrors.InterfaceMethods { int ILErrors.InterfaceMethods.ReturnType1() { return 0; } int[] ILErrors.InterfaceMethods.ReturnType2() { return null; } void ILErrors.InterfaceMethods.ParameterType1(int x) { } void ILErrors.InterfaceMethods.ParameterType2(int[] x) { } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,16): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public int ReturnType1() { return 0; } Diagnostic(ErrorCode.ERR_NoTypeDef, "ReturnType1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (5,18): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public int[] ReturnType2() { return null; } Diagnostic(ErrorCode.ERR_NoTypeDef, "ReturnType2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (6,17): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public void ParameterType1(int x) { } Diagnostic(ErrorCode.ERR_NoTypeDef, "ParameterType1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (7,17): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public void ParameterType2(int[] x) { } Diagnostic(ErrorCode.ERR_NoTypeDef, "ParameterType2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestOverridePropertyType() { var text = @" class C : CSharpErrors.ClassProperties { public override UnavailableClass Get1 { get { return null; } } public override UnavailableClass[] Get2 { get { return null; } } public override UnavailableClass Set1 { set { } } public override UnavailableClass[] Set2 { set { } } public override UnavailableClass GetSet1 { get { return null; } set { } } public override UnavailableClass[] GetSet2 { get { return null; } set { } } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,21): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public override UnavailableClass Get1 { get { return null; } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass"), // (5,21): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public override UnavailableClass[] Get2 { get { return null; } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass"), // (7,21): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public override UnavailableClass Set1 { set { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass"), // (8,21): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public override UnavailableClass[] Set2 { set { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass"), // (10,21): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public override UnavailableClass GetSet1 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass"), // (11,21): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public override UnavailableClass[] GetSet2 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass"), // (4,38): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override UnavailableClass Get1 { get { return null; } } Diagnostic(ErrorCode.ERR_NoTypeDef, "Get1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (5,40): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override UnavailableClass[] Get2 { get { return null; } } Diagnostic(ErrorCode.ERR_NoTypeDef, "Get2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (7,38): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override UnavailableClass Set1 { set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "Set1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (8,40): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override UnavailableClass[] Set2 { set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "Set2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (10,38): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override UnavailableClass GetSet1 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "GetSet1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (11,40): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override UnavailableClass[] GetSet2 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "GetSet2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestOverridePropertyTypeModOpt() { var text = @" class C : ILErrors.ClassProperties { public override int Get1 { get { return 0; } } public override int[] Get2 { get { return null; } } public override int Set1 { set { } } public override int[] Set2 { set { } } public override int GetSet1 { get { return 0; } set { } } public override int[] GetSet2 { get { return null; } set { } } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,25): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override int Get1 { get { return 0; } } Diagnostic(ErrorCode.ERR_NoTypeDef, "Get1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (5,27): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override int[] Get2 { get { return null; } } Diagnostic(ErrorCode.ERR_NoTypeDef, "Get2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (7,25): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override int Set1 { set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "Set1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (8,27): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override int[] Set2 { set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "Set2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (10,25): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override int GetSet1 { get { return 0; } set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "GetSet1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (11,27): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override int[] GetSet2 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "GetSet2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestImplicitlyImplementProperty() { var text = @" class C : CSharpErrors.InterfaceProperties { public UnavailableClass Get1 { get { return null; } } public UnavailableClass[] Get2 { get { return null; } } public UnavailableClass Set1 { set { } } public UnavailableClass[] Set2 { set { } } public UnavailableClass GetSet1 { get { return null; } set { } } public UnavailableClass[] GetSet2 { get { return null; } set { } } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (5,12): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public UnavailableClass[] Get2 { get { return null; } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(5, 12), // (7,12): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public UnavailableClass Set1 { set { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(7, 12), // (8,12): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public UnavailableClass[] Set2 { set { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(8, 12), // (10,12): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public UnavailableClass GetSet1 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(10, 12), // (11,12): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public UnavailableClass[] GetSet2 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(11, 12), // (4,12): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public UnavailableClass Get1 { get { return null; } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(4, 12), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceProperties Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceProperties").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceProperties Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceProperties").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceProperties Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceProperties").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceProperties Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceProperties").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceProperties Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceProperties").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceProperties Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceProperties").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11) ); } [Fact] public void TestImplicitlyImplementPropertyModOpt() { var text = @" class C : ILErrors.InterfaceProperties { public int Get1 { get { return 0; } } public int[] Get2 { get { return null; } } public int Set1 { set { } } public int[] Set2 { set { } } public int GetSet1 { get { return 0; } set { } } public int[] GetSet2 { get { return null; } set { } } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (10,44): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public int GetSet1 { get { return 0; } set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "set").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (11,28): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public int[] GetSet2 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "get").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (11,49): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public int[] GetSet2 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "set").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (4,23): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public int Get1 { get { return 0; } } Diagnostic(ErrorCode.ERR_NoTypeDef, "get").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (5,25): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public int[] Get2 { get { return null; } } Diagnostic(ErrorCode.ERR_NoTypeDef, "get").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (7,23): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public int Set1 { set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "set").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (8,25): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public int[] Set2 { set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "set").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (10,26): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public int GetSet1 { get { return 0; } set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "get").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestExplicitlyImplementProperty() { var text = @" class C : CSharpErrors.InterfaceProperties { UnavailableClass CSharpErrors.InterfaceProperties.Get1 { get { return null; } } UnavailableClass[] CSharpErrors.InterfaceProperties.Get2 { get { return null; } } UnavailableClass CSharpErrors.InterfaceProperties.Set1 { set { } } UnavailableClass[] CSharpErrors.InterfaceProperties.Set2 { set { } } UnavailableClass CSharpErrors.InterfaceProperties.GetSet1 { get { return null; } set { } } UnavailableClass[] CSharpErrors.InterfaceProperties.GetSet2 { get { return null; } set { } } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,5): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // UnavailableClass CSharpErrors.InterfaceProperties.Get1 { get { return null; } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(4, 5), // (4,55): error CS0539: 'C.Get1' in explicit interface declaration is not a member of interface // UnavailableClass CSharpErrors.InterfaceProperties.Get1 { get { return null; } } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "Get1").WithArguments("C.Get1").WithLocation(4, 55), // (5,5): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // UnavailableClass[] CSharpErrors.InterfaceProperties.Get2 { get { return null; } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(5, 5), // (5,57): error CS0539: 'C.Get2' in explicit interface declaration is not a member of interface // UnavailableClass[] CSharpErrors.InterfaceProperties.Get2 { get { return null; } } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "Get2").WithArguments("C.Get2").WithLocation(5, 57), // (7,5): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // UnavailableClass CSharpErrors.InterfaceProperties.Set1 { set { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(7, 5), // (7,55): error CS0539: 'C.Set1' in explicit interface declaration is not a member of interface // UnavailableClass CSharpErrors.InterfaceProperties.Set1 { set { } } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "Set1").WithArguments("C.Set1").WithLocation(7, 55), // (8,5): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // UnavailableClass[] CSharpErrors.InterfaceProperties.Set2 { set { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(8, 5), // (8,57): error CS0539: 'C.Set2' in explicit interface declaration is not a member of interface // UnavailableClass[] CSharpErrors.InterfaceProperties.Set2 { set { } } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "Set2").WithArguments("C.Set2").WithLocation(8, 57), // (10,5): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // UnavailableClass CSharpErrors.InterfaceProperties.GetSet1 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(10, 5), // (10,55): error CS0539: 'C.GetSet1' in explicit interface declaration is not a member of interface // UnavailableClass CSharpErrors.InterfaceProperties.GetSet1 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "GetSet1").WithArguments("C.GetSet1").WithLocation(10, 55), // (11,5): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // UnavailableClass[] CSharpErrors.InterfaceProperties.GetSet2 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(11, 5), // (11,57): error CS0539: 'C.GetSet2' in explicit interface declaration is not a member of interface // UnavailableClass[] CSharpErrors.InterfaceProperties.GetSet2 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "GetSet2").WithArguments("C.GetSet2").WithLocation(11, 57), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceProperties Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceProperties").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceProperties Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceProperties").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceProperties Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceProperties").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceProperties Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceProperties").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceProperties Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceProperties").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceProperties Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceProperties").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11) ); } [Fact] public void TestExplicitlyImplementPropertyModOpt() { var text = @" class C : ILErrors.InterfaceProperties { int ILErrors.InterfaceProperties.Get1 { get { return 0; } } int[] ILErrors.InterfaceProperties.Get2 { get { return null; } } int ILErrors.InterfaceProperties.Set1 { set { } } int[] ILErrors.InterfaceProperties.Set2 { set { } } int ILErrors.InterfaceProperties.GetSet1 { get { return 0; } set { } } int[] ILErrors.InterfaceProperties.GetSet2 { get { return null; } set { } } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (10,66): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // int ILErrors.InterfaceProperties.GetSet1 { get { return 0; } set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "set").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (11,50): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // int[] ILErrors.InterfaceProperties.GetSet2 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "get").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (11,71): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // int[] ILErrors.InterfaceProperties.GetSet2 { get { return null; } set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "set").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (4,45): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // int ILErrors.InterfaceProperties.Get1 { get { return 0; } } Diagnostic(ErrorCode.ERR_NoTypeDef, "get").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (5,47): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // int[] ILErrors.InterfaceProperties.Get2 { get { return null; } } Diagnostic(ErrorCode.ERR_NoTypeDef, "get").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (7,45): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // int ILErrors.InterfaceProperties.Set1 { set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "set").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (8,47): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // int[] ILErrors.InterfaceProperties.Set2 { set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "set").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (10,48): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // int ILErrors.InterfaceProperties.GetSet1 { get { return 0; } set { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "get").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestPropertyAccessorModOpt() { var text = @"class C : ILErrors.ClassProperties { static void M(ILErrors.ClassProperties c) { c.GetSet1 = c.GetSet1; c.GetSet2 = c.GetSet2; c.GetSet3 = c.GetSet3; } void M() { GetSet3 = GetSet3; } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (5,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // c.GetSet1 = c.GetSet1; Diagnostic(ErrorCode.ERR_NoTypeDef, "GetSet1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(5, 11), // (5,23): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // c.GetSet1 = c.GetSet1; Diagnostic(ErrorCode.ERR_NoTypeDef, "GetSet1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(5, 23), // (6,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // c.GetSet2 = c.GetSet2; Diagnostic(ErrorCode.ERR_NoTypeDef, "GetSet2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(6, 11), // (6,23): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // c.GetSet2 = c.GetSet2; Diagnostic(ErrorCode.ERR_NoTypeDef, "GetSet2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(6, 23), // (7,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // c.GetSet3 = c.GetSet3; Diagnostic(ErrorCode.ERR_NoTypeDef, "GetSet3").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(7, 11), // (7,23): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // c.GetSet3 = c.GetSet3; Diagnostic(ErrorCode.ERR_NoTypeDef, "GetSet3").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(7, 23), // (11,9): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // GetSet3 = GetSet3; Diagnostic(ErrorCode.ERR_NoTypeDef, "GetSet3").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(11, 9), // (11,19): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // GetSet3 = GetSet3; Diagnostic(ErrorCode.ERR_NoTypeDef, "GetSet3").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(11, 19)); } [Fact] public void TestOverrideEventType_FieldLike() { var text = @" class C : CSharpErrors.ClassEvents { public override event UnavailableDelegate Event1; public override event CSharpErrors.EventDelegate<UnavailableClass> Event2; public override event CSharpErrors.EventDelegate<UnavailableClass[]> Event3; void UseEvent() { Event1(); Event2(); Event3(); } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,27): error CS0246: The type or namespace name 'UnavailableDelegate' could not be found (are you missing a using directive or an assembly reference?) // public override event UnavailableDelegate Event1; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableDelegate").WithArguments("UnavailableDelegate"), // (5,54): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public override event CSharpErrors.EventDelegate<UnavailableClass> Event2; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass"), // (6,54): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public override event CSharpErrors.EventDelegate<UnavailableClass[]> Event3; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass"), // (4,47): error CS0012: The type 'UnavailableDelegate' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override event UnavailableDelegate Event1; Diagnostic(ErrorCode.ERR_NoTypeDef, "Event1").WithArguments("UnavailableDelegate", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (5,72): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override event CSharpErrors.EventDelegate<UnavailableClass> Event2; Diagnostic(ErrorCode.ERR_NoTypeDef, "Event2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (6,74): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override event CSharpErrors.EventDelegate<UnavailableClass[]> Event3; Diagnostic(ErrorCode.ERR_NoTypeDef, "Event3").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestOverrideEventType_Custom() { var text = @" class C : CSharpErrors.ClassEvents { public override event UnavailableDelegate Event1 { add { } remove { } } public override event CSharpErrors.EventDelegate<UnavailableClass> Event2 { add { } remove { } } public override event CSharpErrors.EventDelegate<UnavailableClass[]> Event3 { add { } remove { } } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,27): error CS0246: The type or namespace name 'UnavailableDelegate' could not be found (are you missing a using directive or an assembly reference?) // public override event UnavailableDelegate Event1; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableDelegate").WithArguments("UnavailableDelegate"), // (5,54): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public override event CSharpErrors.EventDelegate<UnavailableClass> Event2; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass"), // (6,54): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public override event CSharpErrors.EventDelegate<UnavailableClass[]> Event3; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass"), // (4,47): error CS0012: The type 'UnavailableDelegate' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override event UnavailableDelegate Event1; Diagnostic(ErrorCode.ERR_NoTypeDef, "Event1").WithArguments("UnavailableDelegate", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (5,72): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override event CSharpErrors.EventDelegate<UnavailableClass> Event2; Diagnostic(ErrorCode.ERR_NoTypeDef, "Event2").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (6,74): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override event CSharpErrors.EventDelegate<UnavailableClass[]> Event3; Diagnostic(ErrorCode.ERR_NoTypeDef, "Event3").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestOverrideEventTypeModOpt_FieldLike() { var text = @" class C : ILErrors.ClassEvents { public override event System.Action<int[]> Event1; void UseEvent() { Event1(null); } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,48): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override event System.Action<int[]> Event1; Diagnostic(ErrorCode.ERR_NoTypeDef, "Event1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestOverrideEventTypeModOpt_Custom() { var text = @" class C : ILErrors.ClassEvents { public override event System.Action<int[]> Event1 { add { } remove { } } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,48): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public override event System.Action<int[]> Event1; Diagnostic(ErrorCode.ERR_NoTypeDef, "Event1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestImplicitlyImplementEvent_FieldLike() { var text = @" class C : CSharpErrors.InterfaceEvents { public event UnavailableDelegate Event1 = () => { }; public event CSharpErrors.EventDelegate<UnavailableClass> Event2 = () => { }; public event CSharpErrors.EventDelegate<UnavailableClass[]> Event3 = () => { }; }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,18): error CS0246: The type or namespace name 'UnavailableDelegate' could not be found (are you missing a using directive or an assembly reference?) // public event UnavailableDelegate Event1 = () => { }; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableDelegate").WithArguments("UnavailableDelegate").WithLocation(4, 18), // (5,45): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public event CSharpErrors.EventDelegate<UnavailableClass> Event2 = () => { }; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(5, 45), // (6,45): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public event CSharpErrors.EventDelegate<UnavailableClass[]> Event3 = () => { }; Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(6, 45), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceEvents Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceEvents").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableDelegate' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceEvents Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceEvents").WithArguments("UnavailableDelegate", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceEvents Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceEvents").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11) ); } [Fact] public void TestImplicitlyImplementEvent_Custom() { var text = @" class C : CSharpErrors.InterfaceEvents { public event UnavailableDelegate Event1 { add { } remove { } } public event CSharpErrors.EventDelegate<UnavailableClass> Event2 { add { } remove { } } public event CSharpErrors.EventDelegate<UnavailableClass[]> Event3 { add { } remove { } } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,18): error CS0246: The type or namespace name 'UnavailableDelegate' could not be found (are you missing a using directive or an assembly reference?) // public event UnavailableDelegate Event1 { add { } remove { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableDelegate").WithArguments("UnavailableDelegate").WithLocation(4, 18), // (5,45): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public event CSharpErrors.EventDelegate<UnavailableClass> Event2 { add { } remove { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(5, 45), // (6,45): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // public event CSharpErrors.EventDelegate<UnavailableClass[]> Event3 { add { } remove { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(6, 45), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceEvents Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceEvents").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableDelegate' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceEvents Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceEvents").WithArguments("UnavailableDelegate", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceEvents Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceEvents").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11) ); } [Fact] public void TestImplicitlyImplementEventModOpt_FieldLike() { var text = @" class C : ILErrors.InterfaceEvents { public event System.Action<int[]> Event1 = x => { }; }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,39): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public event System.Action<int[]> Event1 = x => { }; Diagnostic(ErrorCode.ERR_NoTypeDef, "Event1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (4,39): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public event System.Action<int[]> Event1 = x => { }; Diagnostic(ErrorCode.ERR_NoTypeDef, "Event1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestImplicitlyImplementEventModOpt_Custom() { var text = @" class C : ILErrors.InterfaceEvents { public event System.Action<int[]> Event1 { add { } remove { } } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,56): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public event System.Action<int[]> Event1 { add { } remove { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "remove").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (4,48): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // public event System.Action<int[]> Event1 { add { } remove { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "add").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestExplicitlyImplementEvent_Custom() //NB: can't explicitly implement with field-like { var text = @" class C : CSharpErrors.InterfaceEvents { event UnavailableDelegate CSharpErrors.InterfaceEvents.Event1 { add { } remove { } } event CSharpErrors.EventDelegate<UnavailableClass> CSharpErrors.InterfaceEvents.Event2 { add { } remove { } } event CSharpErrors.EventDelegate<UnavailableClass[]> CSharpErrors.InterfaceEvents.Event3 { add { } remove { } } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,11): error CS0246: The type or namespace name 'UnavailableDelegate' could not be found (are you missing a using directive or an assembly reference?) // event UnavailableDelegate CSharpErrors.InterfaceEvents.Event1 { add { } remove { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableDelegate").WithArguments("UnavailableDelegate").WithLocation(4, 11), // (4,60): error CS0539: 'C.Event1' in explicit interface declaration is not a member of interface // event UnavailableDelegate CSharpErrors.InterfaceEvents.Event1 { add { } remove { } } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "Event1").WithArguments("C.Event1").WithLocation(4, 60), // (5,38): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // event CSharpErrors.EventDelegate<UnavailableClass> CSharpErrors.InterfaceEvents.Event2 { add { } remove { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(5, 38), // (5,85): error CS0539: 'C.Event2' in explicit interface declaration is not a member of interface // event CSharpErrors.EventDelegate<UnavailableClass> CSharpErrors.InterfaceEvents.Event2 { add { } remove { } } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "Event2").WithArguments("C.Event2").WithLocation(5, 85), // (6,38): error CS0246: The type or namespace name 'UnavailableClass' could not be found (are you missing a using directive or an assembly reference?) // event CSharpErrors.EventDelegate<UnavailableClass[]> CSharpErrors.InterfaceEvents.Event3 { add { } remove { } } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "UnavailableClass").WithArguments("UnavailableClass").WithLocation(6, 38), // (6,87): error CS0539: 'C.Event3' in explicit interface declaration is not a member of interface // event CSharpErrors.EventDelegate<UnavailableClass[]> CSharpErrors.InterfaceEvents.Event3 { add { } remove { } } Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "Event3").WithArguments("C.Event3").WithLocation(6, 87), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceEvents Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceEvents").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableDelegate' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceEvents Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceEvents").WithArguments("UnavailableDelegate", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11), // (2,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class C : CSharpErrors.InterfaceEvents Diagnostic(ErrorCode.ERR_NoTypeDef, "CSharpErrors.InterfaceEvents").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 11) ); } [Fact] public void TestExplicitlyImplementEventModOpt_Custom() //NB: can't explicitly implement with field-like { var text = @" class C : ILErrors.InterfaceEvents { event System.Action<int[]> ILErrors.InterfaceEvents.Event1 { add { } remove { } } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (4,74): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // event System.Action<int[]> ILErrors.InterfaceEvents.Event1 { add { } remove { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "remove").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (4,66): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // event System.Action<int[]> ILErrors.InterfaceEvents.Event1 { add { } remove { } } Diagnostic(ErrorCode.ERR_NoTypeDef, "add").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestEventAccess() { var text = @"class C { static void M(CSharpErrors.ClassEvents c, ILErrors.ClassEvents i) { c.Event1 += null; i.Event1 += null; } }"; CompileWithMissingReference(text).VerifyDiagnostics( // (5,11): error CS0012: The type 'UnavailableDelegate' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // c.Event1 += null; Diagnostic(ErrorCode.ERR_NoTypeDef, "Event1").WithArguments("UnavailableDelegate", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (6,11): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // i.Event1 += null; Diagnostic(ErrorCode.ERR_NoTypeDef, "Event1").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void TestDelegatesWithNoInvoke() { var text = @"class C { public static T goo<T>(DelegateWithoutInvoke.DelegateGenericFunctionWithoutInvoke<T> del) { return del(""goo""); // will show ERR_InvalidDelegateType instead of ERR_NoSuchMemberOrExtension } public static void Main() { DelegateWithoutInvoke.DelegateSubWithoutInvoke myDelegate1 = bar; myDelegate1.Invoke(""goo""); // will show an ERR_NoSuchMemberOrExtension DelegateWithoutInvoke.DelegateSubWithoutInvoke myDelegate2 = new DelegateWithoutInvoke.DelegateSubWithoutInvoke(myDelegate1); object myDelegate3 = new DelegateWithoutInvoke.DelegateSubWithoutInvoke(bar2); DelegateWithoutInvoke.DelegateSubWithoutInvoke myDelegate4 = x => System.Console.WriteLine(""Hello World""); object myDelegate6 = new DelegateWithoutInvoke.DelegateFunctionWithoutInvoke( x => ""Hello World""); } public static void bar(string p) { System.Console.WriteLine(""Hello World""); } public static void bar2(int p) { System.Console.WriteLine(""Hello World 2""); } }"; var delegatesWithoutInvokeReference = TestReferences.SymbolsTests.DelegateImplementation.DelegatesWithoutInvoke; CreateCompilation(text, new MetadataReference[] { delegatesWithoutInvokeReference }).VerifyDiagnostics( // (7,16): error CS7024: Delegate 'DelegateWithoutInvoke.DelegateGenericFunctionWithoutInvoke<T>' has no invoke method or an invoke method with a return type or parameter types that are not supported. // return del("goo"); // will show ERR_InvalidDelegateType instead of ERR_NoSuchMemberOrExtension Diagnostic(ErrorCode.ERR_InvalidDelegateType, @"del(""goo"")").WithArguments("DelegateWithoutInvoke.DelegateGenericFunctionWithoutInvoke<T>").WithLocation(7, 16), // (13,70): error CS7024: Delegate 'DelegateWithoutInvoke.DelegateSubWithoutInvoke' has no invoke method or an invoke method with a return type or parameter types that are not supported. // DelegateWithoutInvoke.DelegateSubWithoutInvoke myDelegate1 = bar; Diagnostic(ErrorCode.ERR_InvalidDelegateType, "bar").WithArguments("DelegateWithoutInvoke.DelegateSubWithoutInvoke").WithLocation(13, 70), // (14,21): error CS1061: 'DelegateWithoutInvoke.DelegateSubWithoutInvoke' does not contain a definition for 'Invoke' and no accessible extension method 'Invoke' accepting a first argument of type 'DelegateWithoutInvoke.DelegateSubWithoutInvoke' could be found (are you missing a using directive or an assembly reference?) // myDelegate1.Invoke("goo"); // will show an ERR_NoSuchMemberOrExtension Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "Invoke").WithArguments("DelegateWithoutInvoke.DelegateSubWithoutInvoke", "Invoke").WithLocation(14, 21), // (15,70): error CS7024: Delegate 'DelegateWithoutInvoke.DelegateSubWithoutInvoke' has no invoke method or an invoke method with a return type or parameter types that are not supported. // DelegateWithoutInvoke.DelegateSubWithoutInvoke myDelegate2 = new DelegateWithoutInvoke.DelegateSubWithoutInvoke(myDelegate1); Diagnostic(ErrorCode.ERR_InvalidDelegateType, "new DelegateWithoutInvoke.DelegateSubWithoutInvoke(myDelegate1)").WithArguments("DelegateWithoutInvoke.DelegateSubWithoutInvoke").WithLocation(15, 70), // (16,30): error CS7024: Delegate 'DelegateWithoutInvoke.DelegateSubWithoutInvoke' has no invoke method or an invoke method with a return type or parameter types that are not supported. // object myDelegate3 = new DelegateWithoutInvoke.DelegateSubWithoutInvoke(bar2); Diagnostic(ErrorCode.ERR_InvalidDelegateType, "new DelegateWithoutInvoke.DelegateSubWithoutInvoke(bar2)").WithArguments("DelegateWithoutInvoke.DelegateSubWithoutInvoke").WithLocation(16, 30), // (17,70): error CS7024: Delegate 'DelegateWithoutInvoke.DelegateSubWithoutInvoke' has no invoke method or an invoke method with a return type or parameter types that are not supported. // DelegateWithoutInvoke.DelegateSubWithoutInvoke myDelegate4 = x => System.Console.WriteLine("Hello World"); Diagnostic(ErrorCode.ERR_InvalidDelegateType, @"x => System.Console.WriteLine(""Hello World"")").WithArguments("DelegateWithoutInvoke.DelegateSubWithoutInvoke").WithLocation(17, 70), // (18,87): error CS7024: Delegate 'DelegateWithoutInvoke.DelegateFunctionWithoutInvoke' has no invoke method or an invoke method with a return type or parameter types that are not supported. // object myDelegate6 = new DelegateWithoutInvoke.DelegateFunctionWithoutInvoke( x => "Hello World"); Diagnostic(ErrorCode.ERR_InvalidDelegateType, @"x => ""Hello World""").WithArguments("DelegateWithoutInvoke.DelegateFunctionWithoutInvoke").WithLocation(18, 87)); } [Fact] public void TestDelegatesWithUseSiteErrors() { var text = @"class C { public static T goo<T>(CSharpErrors.DelegateParameterType3<T> del) { return del.Invoke(""goo""); } public static void Main() { CSharpErrors.DelegateReturnType1 myDelegate1 = bar; myDelegate1(""goo""); CSharpErrors.DelegateReturnType1 myDelegate2 = new CSharpErrors.DelegateReturnType1(myDelegate1); object myDelegate3 = new CSharpErrors.DelegateReturnType1(bar); CSharpErrors.DelegateReturnType1 myDelegate4 = x => System.Console.WriteLine(""Hello World""); object myDelegate6 = new CSharpErrors.DelegateReturnType1( x => ""Hello World""); } public static void bar(string p) { System.Console.WriteLine(""Hello World""); } public static void bar2(int p) { System.Console.WriteLine(""Hello World 2""); } }"; var csharpAssemblyReference = TestReferences.SymbolsTests.UseSiteErrors.CSharp; var ilAssemblyReference = TestReferences.SymbolsTests.UseSiteErrors.IL; CreateCompilation(text, new MetadataReference[] { csharpAssemblyReference, ilAssemblyReference }).VerifyDiagnostics( // (7,16): error CS0012: The type 'UnavailableClass<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // return del.Invoke("goo"); Diagnostic(ErrorCode.ERR_NoTypeDef, "del.Invoke").WithArguments("UnavailableClass<>", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(7, 16), // (13,56): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // CSharpErrors.DelegateReturnType1 myDelegate1 = bar; Diagnostic(ErrorCode.ERR_NoTypeDef, "bar").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(13, 56), // (14,9): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // myDelegate1("goo"); Diagnostic(ErrorCode.ERR_NoTypeDef, @"myDelegate1(""goo"")").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(14, 9), // (15,56): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // CSharpErrors.DelegateReturnType1 myDelegate2 = new CSharpErrors.DelegateReturnType1(myDelegate1); Diagnostic(ErrorCode.ERR_NoTypeDef, "new CSharpErrors.DelegateReturnType1(myDelegate1)").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(15, 56), // (16,30): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // object myDelegate3 = new CSharpErrors.DelegateReturnType1(bar); Diagnostic(ErrorCode.ERR_NoTypeDef, "new CSharpErrors.DelegateReturnType1(bar)").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(16, 30), // (17,56): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // CSharpErrors.DelegateReturnType1 myDelegate4 = x => System.Console.WriteLine("Hello World"); Diagnostic(ErrorCode.ERR_NoTypeDef, @"x => System.Console.WriteLine(""Hello World"")").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(17, 56), // (18,68): error CS0012: The type 'UnavailableClass' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // object myDelegate6 = new CSharpErrors.DelegateReturnType1( x => "Hello World"); Diagnostic(ErrorCode.ERR_NoTypeDef, @"x => ""Hello World""").WithArguments("UnavailableClass", "Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(18, 68)); } [Fact, WorkItem(531090, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531090")] public void Constructor() { string srcLib1 = @" using System; public sealed class A { public A(int a, Func<string, string> example) {} public A(Func<string, string> example) {} } "; var lib1 = CreateEmptyCompilation( new[] { Parse(srcLib1) }, new[] { TestMetadata.Net20.mscorlib, TestMetadata.Net35.SystemCore }, TestOptions.ReleaseDll.WithAssemblyIdentityComparer(DesktopAssemblyIdentityComparer.Default)); string srcLib2 = @" class Program { static void Main() { new A(x => x); } } "; var lib2 = CreateEmptyCompilation( new[] { Parse(srcLib2) }, new[] { MscorlibRef, new CSharpCompilationReference(lib1) }, TestOptions.ReleaseDll.WithAssemblyIdentityComparer(DesktopAssemblyIdentityComparer.Default)); lib2.VerifyDiagnostics( // (6,13): error CS0012: The type 'System.Func<,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. // new A(x => x); Diagnostic(ErrorCode.ERR_NoTypeDef, "A").WithArguments("System.Func<,>", "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); } [Fact, WorkItem(530974, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530974")] public void SynthesizedInterfaceImplementation() { var xSource = @" public class X {} "; var xRef = CreateCompilation(xSource, assemblyName: "Test").EmitToImageReference(); var libSource = @" public interface I { void Goo(X a); } public class C { public void Goo(X a) { } } "; var lib = CreateCompilation(libSource, new[] { xRef }, assemblyName: "Test"); var mainSource = @" class B : C, I { } "; var main = CreateCompilation(mainSource, new[] { new CSharpCompilationReference(lib) }, assemblyName: "Main"); main.VerifyDiagnostics( // (2,7): error CS7068: Reference to type 'X' claims it is defined in this assembly, but it is not defined in source or any added modules // class B : C, I { } Diagnostic(ErrorCode.ERR_MissingTypeInSource, "B").WithArguments("X")); } [Fact, WorkItem(530974, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530974")] public void NoSynthesizedInterfaceImplementation() { var xSource = @" public class X {} "; var xRef = CreateCompilation(xSource, assemblyName: "X").EmitToImageReference(); var libSource = @" public interface I { void Goo(X a); } public class C { public virtual void Goo(X a) { } } "; var lib = CreateCompilation(libSource, new[] { xRef }, assemblyName: "Lib"); var mainSource = @" class B : C, I { } "; var main = CreateCompilation(mainSource, new[] { new CSharpCompilationReference(lib) }, assemblyName: "Main"); main.VerifyEmitDiagnostics(); } [Fact, WorkItem(530974, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530974")] public void SynthesizedInterfaceImplementation_Indexer() { var xSource = @" public class X {} "; var xRef = CreateCompilation(xSource, assemblyName: "X").EmitToImageReference(); var libSource = @" public interface I { int this[X a] { get; set; } } public class C { public int this[X a] { get { return 1; } set { } } } "; var lib = CreateCompilation(libSource, new[] { xRef }, assemblyName: "Lib"); var mainSource = @" class B : C, I { } "; var main = CreateCompilation(mainSource, new[] { new CSharpCompilationReference(lib) }, assemblyName: "Main"); main.VerifyDiagnostics( // (2,7): error CS0012: The type 'X' is defined in an assembly that is not referenced. You must add a reference to assembly 'X, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class B : C, I { } Diagnostic(ErrorCode.ERR_NoTypeDef, "B").WithArguments("X", "X, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (2,7): error CS0012: The type 'X' is defined in an assembly that is not referenced. You must add a reference to assembly 'X, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // class B : C, I { } Diagnostic(ErrorCode.ERR_NoTypeDef, "B").WithArguments("X", "X, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact, WorkItem(530974, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530974")] public void SynthesizedInterfaceImplementation_ModOpt() { var unavailableRef = TestReferences.SymbolsTests.UseSiteErrors.Unavailable; var ilRef = TestReferences.SymbolsTests.UseSiteErrors.IL; var mainSource = @" class B : ILErrors.ClassEventsNonVirtual, ILErrors.InterfaceEvents { } "; var main = CreateCompilation(mainSource, new[] { ilRef, unavailableRef }); CompileAndVerify(main); } [Fact, WorkItem(530974, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530974")] public void NoSynthesizedInterfaceImplementation_ModOpt() { var unavailableRef = TestReferences.SymbolsTests.UseSiteErrors.Unavailable; var ilRef = TestReferences.SymbolsTests.UseSiteErrors.IL; var mainSource = @" class B : ILErrors.ClassEvents, ILErrors.InterfaceEvents { } "; var main = CreateCompilation(mainSource, new[] { ilRef, unavailableRef }); CompileAndVerify(main); } [Fact, WorkItem(530974, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530974")] public void SynthesizedInterfaceImplementation_ModReq() { var unavailableRef = TestReferences.SymbolsTests.UseSiteErrors.Unavailable; var ilRef = TestReferences.SymbolsTests.UseSiteErrors.IL; var mainSource = @" class B : ILErrors.ModReqClassEventsNonVirtual, ILErrors.ModReqInterfaceEvents { } "; var main = CreateCompilation(mainSource, new[] { ilRef, unavailableRef }); main.VerifyDiagnostics( // (2,7): error CS0570: 'ModReqInterfaceEvents.Event1.remove' is not supported by the language // class B : ILErrors.ModReqClassEventsNonVirtual, ILErrors.ModReqInterfaceEvents { } Diagnostic(ErrorCode.ERR_BindToBogus, "B").WithArguments("ILErrors.ModReqInterfaceEvents.Event1.remove").WithLocation(2, 7), // (2,7): error CS0570: 'ModReqInterfaceEvents.Event1.add' is not supported by the language // class B : ILErrors.ModReqClassEventsNonVirtual, ILErrors.ModReqInterfaceEvents { } Diagnostic(ErrorCode.ERR_BindToBogus, "B").WithArguments("ILErrors.ModReqInterfaceEvents.Event1.add").WithLocation(2, 7) ); } [Fact] public void CompilerGeneratedAttributeNotRequired() { var text = @"class C { public int AProperty { get; set; } }"; var compilation = CreateEmptyCompilation(text).VerifyDiagnostics( // (1,7): error CS0518: Predefined type 'System.Object' is not defined or imported // class C Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "C").WithArguments("System.Object"), // (3,11): error CS0518: Predefined type 'System.Int32' is not defined or imported // public int AProperty { get; set; } Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "int").WithArguments("System.Int32"), // (3,32): error CS0518: Predefined type 'System.Void' is not defined or imported // public int AProperty { get; set; } Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "set;").WithArguments("System.Void"), // (1,7): error CS1729: 'object' does not contain a constructor that takes 0 arguments // class C Diagnostic(ErrorCode.ERR_BadCtorArgCount, "C").WithArguments("object", "0")); foreach (var diag in compilation.GetDiagnostics()) { Assert.DoesNotContain("System.Runtime.CompilerServices.CompilerGeneratedAttribute", diag.GetMessage(), StringComparison.Ordinal); } } [Fact] public void UseSiteErrorsForSwitchSubsumption() { var baseSource = @"public class Base {}"; var baseLib = CreateCompilation(baseSource, assemblyName: "BaseAssembly"); var derivedSource = @"public class Derived : Base {}"; var derivedLib = CreateCompilation(derivedSource, assemblyName: "DerivedAssembly", references: new[] { new CSharpCompilationReference(baseLib) }); var programSource = @" class Program { public static void Main(string[] args) { object o = args; switch (o) { case string s: break; case Derived d: break; } } } "; CreateCompilation(programSource, references: new[] { new CSharpCompilationReference(derivedLib) }).VerifyDiagnostics( // (9,18): error CS0012: The type 'Base' is defined in an assembly that is not referenced. You must add a reference to assembly 'BaseAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // case string s: break; Diagnostic(ErrorCode.ERR_NoTypeDef, "string s").WithArguments("Base", "BaseAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(9, 18) ); } #region Attributes for unsafe code /// <summary> /// Simple test to verify that the infrastructure for the other UnsafeAttributes_* tests works correctly. /// </summary> [Fact] public void UnsafeAttributes_NoErrors() { var text = unsafeAttributeSystemTypes + @" namespace System.Security { public class UnverifiableCodeAttribute : Attribute { } namespace Permissions { public enum SecurityAction { RequestMinimum } public class CodeAccessSecurityAttribute : Attribute { public CodeAccessSecurityAttribute(SecurityAction action) { } } public class SecurityPermissionAttribute : CodeAccessSecurityAttribute { public SecurityPermissionAttribute(SecurityAction action) : base(action) { } public bool SkipVerification { get; set; } } } } "; CompileUnsafeAttributesAndCheckDiagnostics(text, false, // (19,21): error CS0518: Predefined type 'System.Int32' is not defined or imported // public enum SecurityAction Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "SecurityAction").WithArguments("System.Int32")); CompileUnsafeAttributesAndCheckDiagnostics(text, true, // (19,21): error CS0518: Predefined type 'System.Int32' is not defined or imported // public enum SecurityAction Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "SecurityAction").WithArguments("System.Int32")); } /// <summary> /// If the attribute type is missing, just skip emitting the attributes. /// No diagnostics. /// </summary> [Fact] public void UnsafeAttributes_MissingUnverifiableCodeAttribute() { var text = unsafeAttributeSystemTypes + @" namespace System.Security { public class UnverifiableCodeAttribute : Attribute { } namespace Permissions { public enum SecurityAction { RequestMinimum } public class CodeAccessSecurityAttribute : Attribute { public CodeAccessSecurityAttribute(SecurityAction action) { } } public class SecurityPermissionAttribute : CodeAccessSecurityAttribute { public SecurityPermissionAttribute(SecurityAction action) : base(action) { } public bool SkipVerification { get; set; } } } } "; CompileUnsafeAttributesAndCheckDiagnostics(text, false, // (19,21): error CS0518: Predefined type 'System.Int32' is not defined or imported // public enum SecurityAction Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "SecurityAction").WithArguments("System.Int32")); CompileUnsafeAttributesAndCheckDiagnostics(text, true, // (19,21): error CS0518: Predefined type 'System.Int32' is not defined or imported // public enum SecurityAction Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "SecurityAction").WithArguments("System.Int32")); } /// <summary> /// If the attribute type is missing, just skip emitting the attributes. /// No diagnostics. /// </summary> [Fact] public void UnsafeAttributes_MissingSecurityPermissionAttribute() { var text = unsafeAttributeSystemTypes + @" namespace System.Security { public class UnverifiableCodeAttribute : Attribute { } namespace Permissions { public enum SecurityAction { RequestMinimum } } } "; CompileUnsafeAttributesAndCheckDiagnostics(text, false, // (19,21): error CS0518: Predefined type 'System.Int32' is not defined or imported // public enum SecurityAction Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "SecurityAction").WithArguments("System.Int32")); CompileUnsafeAttributesAndCheckDiagnostics(text, true, // (19,21): error CS0518: Predefined type 'System.Int32' is not defined or imported // public enum SecurityAction Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "SecurityAction").WithArguments("System.Int32")); } /// <summary> /// If the enum type is missing, just skip emitting the attributes. /// No diagnostics. /// </summary> [Fact] public void UnsafeAttributes_MissingSecurityAction() { var text = unsafeAttributeSystemTypes + @" namespace System.Security { public class UnverifiableCodeAttribute : Attribute { } namespace Permissions { public class CodeAccessSecurityAttribute : Attribute { } public class SecurityPermissionAttribute : CodeAccessSecurityAttribute { public bool SkipVerification { get; set; } } } } "; CompileUnsafeAttributesAndCheckDiagnostics(text, false); CompileUnsafeAttributesAndCheckDiagnostics(text, true); } /// <summary> /// If the attribute constructor is missing, report a use site error. /// </summary> [Fact] public void UnsafeAttributes_MissingUnverifiableCodeAttributeCtorMissing() { var text = unsafeAttributeSystemTypes + @" namespace System.Security { public class UnverifiableCodeAttribute : Attribute { public UnverifiableCodeAttribute(object o1, object o2) { } //wrong signature, won't be found } namespace Permissions { public enum SecurityAction { RequestMinimum } public class CodeAccessSecurityAttribute : Attribute { public CodeAccessSecurityAttribute(SecurityAction action) { } } public class SecurityPermissionAttribute : CodeAccessSecurityAttribute { public SecurityPermissionAttribute(SecurityAction action) : base(action) { } public bool SkipVerification { get; set; } } } } "; CompileUnsafeAttributesAndCheckDiagnostics(text, false, // error CS0656: Missing compiler required member 'System.Security.UnverifiableCodeAttribute..ctor' Diagnostic(ErrorCode.ERR_MissingPredefinedMember).WithArguments("System.Security.UnverifiableCodeAttribute", ".ctor"), // (22,21): error CS0518: Predefined type 'System.Int32' is not defined or imported // public enum SecurityAction Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "SecurityAction").WithArguments("System.Int32")); CompileUnsafeAttributesAndCheckDiagnostics(text, true, // error CS0656: Missing compiler required member 'System.Security.UnverifiableCodeAttribute..ctor' Diagnostic(ErrorCode.ERR_MissingPredefinedMember).WithArguments("System.Security.UnverifiableCodeAttribute", ".ctor"), // (22,21): error CS0518: Predefined type 'System.Int32' is not defined or imported // public enum SecurityAction Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "SecurityAction").WithArguments("System.Int32")); } /// <summary> /// If the attribute constructor is missing, report a use site error. /// </summary> [Fact] public void UnsafeAttributes_SecurityPermissionAttributeCtorMissing() { var text = unsafeAttributeSystemTypes + @" namespace System.Security { public class UnverifiableCodeAttribute : Attribute { } namespace Permissions { public enum SecurityAction { RequestMinimum } public class CodeAccessSecurityAttribute : Attribute { public CodeAccessSecurityAttribute(SecurityAction action) { } } public class SecurityPermissionAttribute : CodeAccessSecurityAttribute { public SecurityPermissionAttribute(SecurityAction action, object o) //extra parameter will fail to match well-known signature : base(action) { } public bool SkipVerification { get; set; } } } } "; CompileUnsafeAttributesAndCheckDiagnostics(text, false, // error CS0656: Missing compiler required member 'System.Security.Permissions.SecurityPermissionAttribute..ctor' Diagnostic(ErrorCode.ERR_MissingPredefinedMember).WithArguments("System.Security.Permissions.SecurityPermissionAttribute", ".ctor"), // (21,21): error CS0518: Predefined type 'System.Int32' is not defined or imported // public enum SecurityAction Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "SecurityAction").WithArguments("System.Int32")); CompileUnsafeAttributesAndCheckDiagnostics(text, true, // error CS0656: Missing compiler required member 'System.Security.Permissions.SecurityPermissionAttribute..ctor' Diagnostic(ErrorCode.ERR_MissingPredefinedMember).WithArguments("System.Security.Permissions.SecurityPermissionAttribute", ".ctor"), // (21,21): error CS0518: Predefined type 'System.Int32' is not defined or imported // public enum SecurityAction Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "SecurityAction").WithArguments("System.Int32")); } /// <summary> /// If the attribute property is missing, report a use site error. /// </summary> [Fact] public void UnsafeAttributes_SecurityPermissionAttributePropertyMissing() { var text = unsafeAttributeSystemTypes + @" namespace System.Security { public class UnverifiableCodeAttribute : Attribute { } namespace Permissions { public enum SecurityAction { RequestMinimum } public class CodeAccessSecurityAttribute : Attribute { public CodeAccessSecurityAttribute(SecurityAction action) { } } public class SecurityPermissionAttribute : CodeAccessSecurityAttribute { public SecurityPermissionAttribute(SecurityAction action) : base(action) { } } } } "; CompileUnsafeAttributesAndCheckDiagnostics(text, false, // error CS0656: Missing compiler required member 'System.Security.Permissions.SecurityPermissionAttribute.SkipVerification' Diagnostic(ErrorCode.ERR_MissingPredefinedMember).WithArguments("System.Security.Permissions.SecurityPermissionAttribute", "SkipVerification"), // (21,21): error CS0518: Predefined type 'System.Int32' is not defined or imported // public enum SecurityAction Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "SecurityAction").WithArguments("System.Int32")); CompileUnsafeAttributesAndCheckDiagnostics(text, true, // error CS0656: Missing compiler required member 'System.Security.Permissions.SecurityPermissionAttribute.SkipVerification' Diagnostic(ErrorCode.ERR_MissingPredefinedMember).WithArguments("System.Security.Permissions.SecurityPermissionAttribute", "SkipVerification"), // (21,21): error CS0518: Predefined type 'System.Int32' is not defined or imported // public enum SecurityAction Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "SecurityAction").WithArguments("System.Int32")); } [WorkItem(708169, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/708169")] [Fact] public void OverloadResolutionWithUseSiteErrors() { var missingSource = @" public class Missing { } "; var libSource = @" public class Methods { public static void M1(int x) { } public static void M1(Missing x) { } public static void M2(Missing x) { } public static void M2(int x) { } } public class Indexer1 { public int this[int x] { get { return 0; } } public int this[Missing x] { get { return 0; } } } public class Indexer2 { public int this[Missing x] { get { return 0; } } public int this[int x] { get { return 0; } } } public class Constructor1 { public Constructor1(int x) { } public Constructor1(Missing x) { } } public class Constructor2 { public Constructor2(Missing x) { } public Constructor2(int x) { } } "; var testSource = @" using System; class C { static void Main() { var c1 = new Constructor1(1); var c2 = new Constructor2(2); Methods.M1(1); Methods.M2(2); Action<int> a1 = Methods.M1; Action<int> a2 = Methods.M2; var i1 = new Indexer1()[1]; var i2 = new Indexer2()[2]; } } "; var missingRef = CreateCompilation(missingSource, assemblyName: "Missing").EmitToImageReference(); var libRef = CreateCompilation(libSource, new[] { missingRef }).EmitToImageReference(); CreateCompilation(testSource, new[] { libRef /* and not missingRef */ }).VerifyDiagnostics( // (8,22): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // var c1 = new Constructor1(1); Diagnostic(ErrorCode.ERR_NoTypeDef, "Constructor1").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (9,22): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // var c2 = new Constructor2(2); Diagnostic(ErrorCode.ERR_NoTypeDef, "Constructor2").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (9,9): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // Methods.M1(1); Diagnostic(ErrorCode.ERR_NoTypeDef, "Methods.M1").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (10,9): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // Methods.M2(2); Diagnostic(ErrorCode.ERR_NoTypeDef, "Methods.M2").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (14,26): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // Action<int> a1 = Methods.M1; Diagnostic(ErrorCode.ERR_NoTypeDef, "Methods.M1").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (15,26): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // Action<int> a2 = Methods.M2; Diagnostic(ErrorCode.ERR_NoTypeDef, "Methods.M2").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (17,18): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // var i1 = new Indexer1()[1]; Diagnostic(ErrorCode.ERR_NoTypeDef, "new Indexer1()[1]").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (18,18): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // var i2 = new Indexer2()[2]; Diagnostic(ErrorCode.ERR_NoTypeDef, "new Indexer2()[2]").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [WorkItem(708169, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/708169")] [Fact] public void OverloadResolutionWithUseSiteErrors_LessDerived() { var missingSource = @" public class Missing { } "; var libSource = @" public class Base { public int M(int x) { return 0; } public int M(Missing x) { return 0; } public int this[int x] { get { return 0; } } public int this[Missing x] { get { return 0; } } } "; var testSource = @" class Derived : Base { static void Main() { var d = new Derived(); int i; i = d.M(1); i = d.M(""A""); i = d[1]; i = d[""A""]; } public int M(string x) { return 0; } public int this[string x] { get { return 0; } } } "; var missingRef = CreateCompilation(missingSource, assemblyName: "Missing").EmitToImageReference(); var libRef = CreateCompilation(libSource, new[] { missingRef }).EmitToImageReference(); CreateCompilation(testSource, new[] { libRef, missingRef }).VerifyDiagnostics(); // NOTE: No errors reported when the Derived member wins. CreateCompilation(testSource, new[] { libRef /* and not missingRef */ }).VerifyDiagnostics( // (9,13): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // i = d.M(1); Diagnostic(ErrorCode.ERR_NoTypeDef, "d.M").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (12,13): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // i = d[1]; Diagnostic(ErrorCode.ERR_NoTypeDef, "d[1]").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [WorkItem(708169, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/708169")] [Fact] public void OverloadResolutionWithUseSiteErrors_NoCorrespondingParameter() { var missingSource = @" public class Missing { } "; var libSource = @" public class C { public C(string x, int y = 1) { } public C(Missing x) { } public int M(string x, int y = 1) { return 0; } public int M(Missing x) { return 0; } public int this[string x, int y = 1] { get { return 0; } } public int this[Missing x] { get { return 0; } } } "; var testSource = @" class Test { static void Main() { C c; int i; c = new C(null, 1); // Fine c = new C(""A""); // Error i = c.M(null, 1); // Fine i = c.M(""A""); // Error i = c[null, 1]; // Fine i = c[""A""]; // Error } } "; var missingRef = CreateCompilation(missingSource, assemblyName: "Missing").EmitToImageReference(); var libRef = CreateCompilation(libSource, new[] { missingRef }).EmitToImageReference(); CreateCompilation(testSource, new[] { libRef, missingRef }).VerifyDiagnostics(); CreateCompilation(testSource, new[] { libRef /* and not missingRef */ }).VerifyDiagnostics( // (10,17): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // c = new C("A"); // Error Diagnostic(ErrorCode.ERR_NoTypeDef, "C").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (13,13): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // i = c.M("A"); // Error Diagnostic(ErrorCode.ERR_NoTypeDef, "c.M").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (16,13): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // i = c["A"]; // Error Diagnostic(ErrorCode.ERR_NoTypeDef, @"c[""A""]").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [WorkItem(708169, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/708169")] [Fact] public void OverloadResolutionWithUseSiteErrors_NameUsedForPositional() { var missingSource = @" public class Missing { } "; var libSource = @" public class C { public C(string x, string y) { } public C(Missing y, string x) { } public int M(string x, string y) { return 0; } public int M(Missing y, string x) { return 0; } public int this[string x, string y] { get { return 0; } } public int this[Missing y, string x] { get { return 0; } } } "; var testSource = @" class Test { static void Main() { C c; int i; c = new C(""A"", y: null); // Fine c = new C(""A"", null); // Error i = c.M(""A"", y: null); // Fine i = c.M(""A"", null); // Error i = c[""A"", y: null]; // Fine i = c[""A"", null]; // Error } } "; var missingRef = CreateCompilation(missingSource, assemblyName: "Missing").EmitToImageReference(); var libRef = CreateCompilation(libSource, new[] { missingRef }).EmitToImageReference(); CreateCompilation(testSource, new[] { libRef, missingRef }).VerifyDiagnostics(); CreateCompilation(testSource, new[] { libRef /* and not missingRef */ }).VerifyDiagnostics( // (10,17): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // c = new C("A", null); // Error Diagnostic(ErrorCode.ERR_NoTypeDef, "C").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (13,13): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // i = c.M("A", null); // Error Diagnostic(ErrorCode.ERR_NoTypeDef, "c.M").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (16,13): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // i = c["A", null]; // Error Diagnostic(ErrorCode.ERR_NoTypeDef, @"c[""A"", null]").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [WorkItem(708169, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/708169")] [Fact] public void OverloadResolutionWithUseSiteErrors_RequiredParameterMissing() { var missingSource = @" public class Missing { } "; var libSource = @" public class C { public C(string x, object y = null) { } public C(Missing x, string y) { } public int M(string x, object y = null) { return 0; } public int M(Missing x, string y) { return 0; } public int this[string x, object y = null] { get { return 0; } } public int this[Missing x, string y] { get { return 0; } } } "; var testSource = @" class Test { static void Main() { C c; int i; c = new C(null); // Fine c = new C(null, ""A""); // Error i = c.M(null); // Fine i = c.M(null, ""A""); // Error i = c[null]; // Fine i = c[null, ""A""]; // Error } } "; var missingRef = CreateCompilation(missingSource, assemblyName: "Missing").EmitToImageReference(); var libRef = CreateCompilation(libSource, new[] { missingRef }).EmitToImageReference(); CreateCompilation(testSource, new[] { libRef, missingRef }).VerifyDiagnostics(); CreateCompilation(testSource, new[] { libRef /* and not missingRef */ }).VerifyDiagnostics( // (10,17): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // c = new C(null, "A"); // Error Diagnostic(ErrorCode.ERR_NoTypeDef, "C").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (13,13): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // i = c.M(null, "A"); // Error Diagnostic(ErrorCode.ERR_NoTypeDef, "c.M").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"), // (16,13): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // i = c[null, "A"]; // Error Diagnostic(ErrorCode.ERR_NoTypeDef, @"c[null, ""A""]").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")); } [Fact] public void OverloadResolutionWithUseSiteErrors_WithParamsArguments_ReturnsUseSiteErrors() { var missingSource = @" public class Missing { } "; var libSource = @" public class C { public static Missing GetMissing(params int[] args) { return null; } public static void SetMissing(params Missing[] args) { } public static Missing GetMissing(string firstArgument, params int[] args) { return null; } public static void SetMissing(string firstArgument, params Missing[] args) { } } "; var testSource = @" class Test { static void Main() { C.GetMissing(); C.GetMissing(1, 1); C.SetMissing(); C.GetMissing(string.Empty); C.GetMissing(string.Empty, 1, 1); C.SetMissing(string.Empty); } } "; var missingRef = CreateCompilation(missingSource, assemblyName: "Missing").EmitToImageReference(); var libRef = CreateCompilation(libSource, new[] { missingRef }).EmitToImageReference(); CreateCompilation(testSource, new[] { libRef, missingRef }).VerifyDiagnostics(); var getMissingDiagnostic = Diagnostic(ErrorCode.ERR_NoTypeDef, @"C.GetMissing").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"); var setMissingDiagnostic = Diagnostic(ErrorCode.ERR_NoTypeDef, @"C.SetMissing").WithArguments("Missing", "Missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"); CreateCompilation(testSource, new[] { libRef /* and not missingRef */ }).VerifyDiagnostics( getMissingDiagnostic, getMissingDiagnostic, setMissingDiagnostic, getMissingDiagnostic, getMissingDiagnostic, setMissingDiagnostic); } [WorkItem(708169, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/708169")] [ClrOnlyFact(ClrOnlyReason.Ilasm)] public void OverloadResolutionWithUnsupportedMetadata_UnsupportedMetadata_SupportedExists() { var il = @" .class public auto ansi beforefieldinit Methods extends [mscorlib]System.Object { .method public hidebysig static void M(int32 x) cil managed { ret } .method public hidebysig static void M(string modreq(int16) x) cil managed { ret } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } // end of class Methods .class public auto ansi beforefieldinit Indexers extends [mscorlib]System.Object { .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = {string('Item')} .method public hidebysig specialname instance int32 get_Item(int32 x) cil managed { ldc.i4.0 ret } .method public hidebysig specialname instance int32 get_Item(string modreq(int16) x) cil managed { ldc.i4.0 ret } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } .property instance int32 Item(int32) { .get instance int32 Indexers::get_Item(int32) } .property instance int32 Item(string modreq(int16)) { .get instance int32 Indexers::get_Item(string modreq(int16)) } } // end of class Indexers .class public auto ansi beforefieldinit Constructors extends [mscorlib]System.Object { .method public hidebysig specialname rtspecialname instance void .ctor(int32 x) cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } .method public hidebysig specialname rtspecialname instance void .ctor(string modreq(int16) x) cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } // end of class Constructors "; var source = @" using System; class C { static void Main() { var c1 = new Constructors(1); var c2 = new Constructors(null); Methods.M(1); Methods.M(null); Action<int> a1 = Methods.M; Action<string> a2 = Methods.M; var i1 = new Indexers()[1]; var i2 = new Indexers()[null]; } } "; CreateCompilationWithILAndMscorlib40(source, il).VerifyDiagnostics( // (9,35): error CS1503: Argument 1: cannot convert from '<null>' to 'int' // var c2 = new Constructors(null); Diagnostic(ErrorCode.ERR_BadArgType, "null").WithArguments("1", "<null>", "int"), // (12,19): error CS1503: Argument 1: cannot convert from '<null>' to 'int' // Methods.M(null); Diagnostic(ErrorCode.ERR_BadArgType, "null").WithArguments("1", "<null>", "int"), // (15,37): error CS0123: No overload for 'M' matches delegate 'System.Action<string>' // Action<string> a2 = Methods.M; Diagnostic(ErrorCode.ERR_MethDelegateMismatch, "M").WithArguments("M", "System.Action<string>"), // (18,33): error CS1503: Argument 1: cannot convert from '<null>' to 'int' // var i2 = new Indexers()[null]; Diagnostic(ErrorCode.ERR_BadArgType, "null").WithArguments("1", "<null>", "int")); } [WorkItem(708169, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/708169")] [ClrOnlyFact(ClrOnlyReason.Ilasm)] public void OverloadResolutionWithUnsupportedMetadata_UnsupportedMetadata_SupportedDoesNotExist() { var il = @" .class public auto ansi beforefieldinit Methods extends [mscorlib]System.Object { .method public hidebysig static void M(string modreq(int16) x) cil managed { ret } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } // end of class Methods .class public auto ansi beforefieldinit Indexers extends [mscorlib]System.Object { .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = {string('Item')} .method public hidebysig specialname instance int32 get_Item(string modreq(int16) x) cil managed { ldc.i4.0 ret } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } .property instance int32 Item(string modreq(int16)) { .get instance int32 Indexers::get_Item(string modreq(int16)) } } // end of class Indexers .class public auto ansi beforefieldinit Constructors extends [mscorlib]System.Object { .method public hidebysig specialname rtspecialname instance void .ctor(string modreq(int16) x) cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } // end of class Constructors "; var source = @" using System; class C { static void Main() { var c2 = new Constructors(null); Methods.M(null); Action<string> a2 = Methods.M; var i2 = new Indexers()[null]; } } "; CreateCompilationWithILAndMscorlib40(source, il).VerifyDiagnostics( // (8,22): error CS0570: 'Constructors.Constructors(string)' is not supported by the language // var c2 = new Constructors(null); Diagnostic(ErrorCode.ERR_BindToBogus, "Constructors").WithArguments("Constructors.Constructors(string)").WithLocation(8, 22), // (10,17): error CS0570: 'Methods.M(string)' is not supported by the language // Methods.M(null); Diagnostic(ErrorCode.ERR_BindToBogus, "M").WithArguments("Methods.M(string)").WithLocation(10, 17), // (12,29): error CS0570: 'Methods.M(string)' is not supported by the language // Action<string> a2 = Methods.M; Diagnostic(ErrorCode.ERR_BindToBogus, "Methods.M").WithArguments("Methods.M(string)").WithLocation(12, 29), // (14,18): error CS1546: Property, indexer, or event 'Indexers.this[string]' is not supported by the language; try directly calling accessor method 'Indexers.get_Item(string)' // var i2 = new Indexers()[null]; Diagnostic(ErrorCode.ERR_BindToBogusProp1, "new Indexers()[null]").WithArguments("Indexers.this[string]", "Indexers.get_Item(string)").WithLocation(14, 18)); } [WorkItem(939928, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/939928")] [WorkItem(132, "CodePlex")] [Fact] public void MissingBaseTypeForCatch() { var source1 = @" using System; public class GeneralException : Exception {}"; CSharpCompilation comp1 = CreateCompilation(source1, assemblyName: "Base"); var source2 = @" public class SpecificException : GeneralException {}"; CSharpCompilation comp2 = CreateCompilation(source2, new MetadataReference[] { new CSharpCompilationReference(comp1) }); var source3 = @" class Test { static void Main(string[] args) { try { SpecificException e = null; throw e; } catch (SpecificException) { } } }"; CSharpCompilation comp3 = CreateCompilation(source3, new MetadataReference[] { new CSharpCompilationReference(comp2) }); DiagnosticDescription[] expected = { // (9,23): error CS0012: The type 'GeneralException' is defined in an assembly that is not referenced. You must add a reference to assembly 'Base, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // throw e; Diagnostic(ErrorCode.ERR_NoTypeDef, "e").WithArguments("GeneralException", "Base, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(9, 23), // (9,23): error CS0029: Cannot implicitly convert type 'SpecificException' to 'System.Exception' // throw e; Diagnostic(ErrorCode.ERR_NoImplicitConv, "e").WithArguments("SpecificException", "System.Exception").WithLocation(9, 23), // (11,20): error CS0155: The type caught or thrown must be derived from System.Exception // catch (SpecificException) Diagnostic(ErrorCode.ERR_BadExceptionType, "SpecificException").WithLocation(11, 20), // (11,20): error CS0012: The type 'GeneralException' is defined in an assembly that is not referenced. You must add a reference to assembly 'Base, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // catch (SpecificException) Diagnostic(ErrorCode.ERR_NoTypeDef, "SpecificException").WithArguments("GeneralException", "Base, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(11, 20) }; comp3.VerifyDiagnostics(expected); comp3 = CreateCompilation(source3, new MetadataReference[] { comp2.EmitToImageReference() }); comp3.VerifyDiagnostics(expected); } /// <summary> /// Trivial definitions of special types that will be required for testing use site errors in /// the attributes emitted for unsafe assemblies. /// </summary> private const string unsafeAttributeSystemTypes = @" namespace System { public class Object { } public class ValueType { } public class Enum { } // Diagnostic if this extends ValueType public struct Boolean { } public struct Void { } public class Attribute { } } "; /// <summary> /// Compile without corlib, and then verify semantic diagnostics, emit-metadata diagnostics, and emit diagnostics. /// </summary> private static void CompileUnsafeAttributesAndCheckDiagnostics(string corLibText, bool moduleOnly, params DiagnosticDescription[] expectedDiagnostics) { CSharpCompilationOptions options = TestOptions.UnsafeReleaseDll; if (moduleOnly) { options = options.WithOutputKind(OutputKind.NetModule); } var compilation = CreateEmptyCompilation( new[] { Parse(corLibText) }, options: options); compilation.VerifyDiagnostics(expectedDiagnostics); } #endregion Attributes for unsafe code /// <summary> /// First, compile the provided source with all assemblies and confirm that there are no errors. /// Then, compile the provided source again without the unavailable assembly and return the result. /// </summary> private static CSharpCompilation CompileWithMissingReference(string source) { var unavailableAssemblyReference = TestReferences.SymbolsTests.UseSiteErrors.Unavailable; var csharpAssemblyReference = TestReferences.SymbolsTests.UseSiteErrors.CSharp; var ilAssemblyReference = TestReferences.SymbolsTests.UseSiteErrors.IL; var successfulCompilation = CreateCompilation(source, new MetadataReference[] { unavailableAssemblyReference, csharpAssemblyReference, ilAssemblyReference }); successfulCompilation.VerifyDiagnostics(); // No diagnostics when reference is present var failingCompilation = CreateCompilation(source, new MetadataReference[] { csharpAssemblyReference, ilAssemblyReference }); return failingCompilation; } [Fact] [WorkItem(14267, "https://github.com/dotnet/roslyn/issues/14267")] public void MissingTypeKindBasisTypes() { var source1 = @" public struct A {} public enum B {} public class C {} public delegate void D(); public interface I1 {} "; var parseOptions = TestOptions.Regular.WithNoRefSafetyRulesAttribute(); var compilation1 = CreateEmptyCompilation(source1, parseOptions: parseOptions, options: TestOptions.ReleaseDll, references: new[] { MinCorlibRef }); compilation1.VerifyEmitDiagnostics(); Assert.Equal(TypeKind.Struct, compilation1.GetTypeByMetadataName("A").TypeKind); Assert.Equal(TypeKind.Enum, compilation1.GetTypeByMetadataName("B").TypeKind); Assert.Equal(TypeKind.Class, compilation1.GetTypeByMetadataName("C").TypeKind); Assert.Equal(TypeKind.Delegate, compilation1.GetTypeByMetadataName("D").TypeKind); Assert.Equal(TypeKind.Interface, compilation1.GetTypeByMetadataName("I1").TypeKind); var source2 = @" interface I2 { I1 M(A a, B b, C c, D d); } "; var compilation2 = CreateEmptyCompilation(source2, parseOptions: parseOptions, options: TestOptions.ReleaseDll, references: new[] { compilation1.EmitToImageReference(), MinCorlibRef }); compilation2.VerifyEmitDiagnostics(); CompileAndVerify(compilation2); Assert.Equal(TypeKind.Struct, compilation2.GetTypeByMetadataName("A").TypeKind); Assert.Equal(TypeKind.Enum, compilation2.GetTypeByMetadataName("B").TypeKind); Assert.Equal(TypeKind.Class, compilation2.GetTypeByMetadataName("C").TypeKind); Assert.Equal(TypeKind.Delegate, compilation2.GetTypeByMetadataName("D").TypeKind); Assert.Equal(TypeKind.Interface, compilation2.GetTypeByMetadataName("I1").TypeKind); var compilation3 = CreateEmptyCompilation(source2, parseOptions: parseOptions, options: TestOptions.ReleaseDll, references: new[] { compilation1.ToMetadataReference(), MinCorlibRef }); compilation3.VerifyEmitDiagnostics(); CompileAndVerify(compilation3); Assert.Equal(TypeKind.Struct, compilation3.GetTypeByMetadataName("A").TypeKind); Assert.Equal(TypeKind.Enum, compilation3.GetTypeByMetadataName("B").TypeKind); Assert.Equal(TypeKind.Class, compilation3.GetTypeByMetadataName("C").TypeKind); Assert.Equal(TypeKind.Delegate, compilation3.GetTypeByMetadataName("D").TypeKind); Assert.Equal(TypeKind.Interface, compilation3.GetTypeByMetadataName("I1").TypeKind); var compilation4 = CreateEmptyCompilation(source2, parseOptions: parseOptions, options: TestOptions.ReleaseDll, references: new[] { compilation1.EmitToImageReference() }); compilation4.VerifyDiagnostics( // (4,10): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'mincorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=ce65828c82a341f2'. // I1 M(A a, B b, C c, D d); Diagnostic(ErrorCode.ERR_NoTypeDef, "A").WithArguments("System.ValueType", "mincorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=ce65828c82a341f2").WithLocation(4, 10), // (4,15): error CS0012: The type 'Enum' is defined in an assembly that is not referenced. You must add a reference to assembly 'mincorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=ce65828c82a341f2'. // I1 M(A a, B b, C c, D d); Diagnostic(ErrorCode.ERR_NoTypeDef, "B").WithArguments("System.Enum", "mincorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=ce65828c82a341f2").WithLocation(4, 15), // (4,25): error CS0012: The type 'MulticastDelegate' is defined in an assembly that is not referenced. You must add a reference to assembly 'mincorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=ce65828c82a341f2'. // I1 M(A a, B b, C c, D d); Diagnostic(ErrorCode.ERR_NoTypeDef, "D").WithArguments("System.MulticastDelegate", "mincorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=ce65828c82a341f2").WithLocation(4, 25) ); var a = compilation4.GetTypeByMetadataName("A"); var b = compilation4.GetTypeByMetadataName("B"); var c = compilation4.GetTypeByMetadataName("C"); var d = compilation4.GetTypeByMetadataName("D"); var i1 = compilation4.GetTypeByMetadataName("I1"); Assert.Equal(TypeKind.Class, a.TypeKind); Assert.NotNull(a.GetUseSiteDiagnostic()); Assert.Equal(TypeKind.Class, b.TypeKind); Assert.NotNull(b.GetUseSiteDiagnostic()); Assert.Equal(TypeKind.Class, c.TypeKind); Assert.Null(c.GetUseSiteDiagnostic()); Assert.Equal(TypeKind.Class, d.TypeKind); Assert.NotNull(d.GetUseSiteDiagnostic()); Assert.Equal(TypeKind.Interface, i1.TypeKind); Assert.Null(i1.GetUseSiteDiagnostic()); var compilation5 = CreateEmptyCompilation(source2, parseOptions: parseOptions, options: TestOptions.ReleaseDll, references: new[] { compilation1.ToMetadataReference() }); compilation5.VerifyEmitDiagnostics( // warning CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options. Diagnostic(ErrorCode.WRN_NoRuntimeMetadataVersion).WithLocation(1, 1) ); // ILVerify: no corlib CompileAndVerify(compilation5, verify: Verification.FailsILVerify); Assert.Equal(TypeKind.Struct, compilation5.GetTypeByMetadataName("A").TypeKind); Assert.Equal(TypeKind.Enum, compilation5.GetTypeByMetadataName("B").TypeKind); Assert.Equal(TypeKind.Class, compilation5.GetTypeByMetadataName("C").TypeKind); Assert.Equal(TypeKind.Delegate, compilation5.GetTypeByMetadataName("D").TypeKind); Assert.Equal(TypeKind.Interface, compilation5.GetTypeByMetadataName("I1").TypeKind); var compilation6 = CreateEmptyCompilation(source2, parseOptions: parseOptions, options: TestOptions.ReleaseDll, references: new[] { compilation1.EmitToImageReference(), MscorlibRef }); compilation6.VerifyDiagnostics( // (4,10): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'mincorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=ce65828c82a341f2'. // I1 M(A a, B b, C c, D d); Diagnostic(ErrorCode.ERR_NoTypeDef, "A").WithArguments("System.ValueType", "mincorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=ce65828c82a341f2").WithLocation(4, 10), // (4,15): error CS0012: The type 'Enum' is defined in an assembly that is not referenced. You must add a reference to assembly 'mincorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=ce65828c82a341f2'. // I1 M(A a, B b, C c, D d); Diagnostic(ErrorCode.ERR_NoTypeDef, "B").WithArguments("System.Enum", "mincorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=ce65828c82a341f2").WithLocation(4, 15), // (4,25): error CS0012: The type 'MulticastDelegate' is defined in an assembly that is not referenced. You must add a reference to assembly 'mincorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=ce65828c82a341f2'. // I1 M(A a, B b, C c, D d); Diagnostic(ErrorCode.ERR_NoTypeDef, "D").WithArguments("System.MulticastDelegate", "mincorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=ce65828c82a341f2").WithLocation(4, 25) ); a = compilation6.GetTypeByMetadataName("A"); b = compilation6.GetTypeByMetadataName("B"); c = compilation6.GetTypeByMetadataName("C"); d = compilation6.GetTypeByMetadataName("D"); i1 = compilation6.GetTypeByMetadataName("I1"); Assert.Equal(TypeKind.Class, a.TypeKind); Assert.NotNull(a.GetUseSiteDiagnostic()); Assert.Equal(TypeKind.Class, b.TypeKind); Assert.NotNull(b.GetUseSiteDiagnostic()); Assert.Equal(TypeKind.Class, c.TypeKind); Assert.Null(c.GetUseSiteDiagnostic()); Assert.Equal(TypeKind.Class, d.TypeKind); Assert.NotNull(d.GetUseSiteDiagnostic()); Assert.Equal(TypeKind.Interface, i1.TypeKind); Assert.Null(i1.GetUseSiteDiagnostic()); var compilation7 = CreateEmptyCompilation(source2, parseOptions: parseOptions, options: TestOptions.ReleaseDll, references: new[] { compilation1.ToMetadataReference(), MscorlibRef }); compilation7.VerifyEmitDiagnostics(); CompileAndVerify(compilation7); Assert.Equal(TypeKind.Struct, compilation7.GetTypeByMetadataName("A").TypeKind); Assert.Equal(TypeKind.Enum, compilation7.GetTypeByMetadataName("B").TypeKind); Assert.Equal(TypeKind.Class, compilation7.GetTypeByMetadataName("C").TypeKind); Assert.Equal(TypeKind.Delegate, compilation7.GetTypeByMetadataName("D").TypeKind); Assert.Equal(TypeKind.Interface, compilation7.GetTypeByMetadataName("I1").TypeKind); } [Fact, WorkItem(15435, "https://github.com/dotnet/roslyn/issues/15435")] public void TestGettingAssemblyIdsFromDiagnostic1() { var text = @" class C : CSharpErrors.ClassMethods { public override UnavailableClass ReturnType1() { return null; } public override UnavailableClass[] ReturnType2() { return null; } }"; var compilation = CompileWithMissingReference(text); var diagnostics = compilation.GetDiagnostics(); Assert.True(diagnostics.Any(d => d.Code == (int)ErrorCode.ERR_NoTypeDef)); foreach (var diagnostic in diagnostics) { if (diagnostic.Code == (int)ErrorCode.ERR_NoTypeDef) { var actualAssemblyId = compilation.GetUnreferencedAssemblyIdentities(diagnostic).Single(); AssemblyIdentity expectedAssemblyId; AssemblyIdentity.TryParseDisplayName("Unavailable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", out expectedAssemblyId); Assert.Equal(actualAssemblyId, expectedAssemblyId); } } } private static readonly MetadataReference UnmanagedUseSiteError_Ref1 = CreateCompilation(@" public struct S1 { public int i; }", assemblyName: "libS1").ToMetadataReference(); private static readonly MetadataReference UnmanagedUseSiteError_Ref2 = CreateCompilation(@" public struct S2 { public S1 s1; } ", references: new[] { UnmanagedUseSiteError_Ref1 }, assemblyName: "libS2").ToMetadataReference(); [Fact] public void Unmanaged_UseSiteError_01() { var source = @" class C { unsafe void M(S2 s2) { var ptr = &s2; } } "; var comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics( // (6,19): error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // var ptr = &s2; Diagnostic(ErrorCode.ERR_NoTypeDef, "&s2").WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(6, 19), // (6,19): warning CS8500: This takes the address of, gets the size of, or declares a pointer to a managed type ('S2') // var ptr = &s2; Diagnostic(ErrorCode.WRN_ManagedAddr, "&s2").WithArguments("S2").WithLocation(6, 19) ); comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref1, UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics(); } [Fact] public void Unmanaged_UseSiteError_02() { var source = @" class C { unsafe void M() { var size = sizeof(S2); } } "; var comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics( // (6,20): error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // var size = sizeof(S2); Diagnostic(ErrorCode.ERR_NoTypeDef, "sizeof(S2)").WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(6, 20), // (6,20): warning CS8500: This takes the address of, gets the size of, or declares a pointer to a managed type ('S2') // var size = sizeof(S2); Diagnostic(ErrorCode.WRN_ManagedAddr, "sizeof(S2)").WithArguments("S2").WithLocation(6, 20)); comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref1, UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics(); } [Fact] public void Unmanaged_UseSiteError_03() { var source = @" class C { unsafe void M(S2* ptr) { } } "; var comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics( // (4,23): error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // unsafe void M(S2* ptr) Diagnostic(ErrorCode.ERR_NoTypeDef, "ptr").WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(4, 23), // (4,23): warning CS8500: This takes the address of, gets the size of, or declares a pointer to a managed type ('S2') // unsafe void M(S2* ptr) Diagnostic(ErrorCode.WRN_ManagedAddr, "ptr").WithArguments("S2").WithLocation(4, 23)); comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref1, UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics(); } [Fact] public void Unmanaged_UseSiteError_04() { var source = @" class C { unsafe void M() { S2* span = stackalloc S2[16]; S2* span2 = stackalloc [] { default(S2) }; } } "; var comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics( // (6,9): error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // S2* span = stackalloc S2[16]; Diagnostic(ErrorCode.ERR_NoTypeDef, "S2*").WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(6, 9), // (6,9): warning CS8500: This takes the address of, gets the size of, or declares a pointer to a managed type ('S2') // S2* span = stackalloc S2[16]; Diagnostic(ErrorCode.WRN_ManagedAddr, "S2*").WithArguments("S2").WithLocation(6, 9), // (6,31): error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // S2* span = stackalloc S2[16]; Diagnostic(ErrorCode.ERR_NoTypeDef, "S2").WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(6, 31), // (6,31): error CS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('S2') // S2* span = stackalloc S2[16]; Diagnostic(ErrorCode.ERR_ManagedAddr, "S2").WithArguments("S2").WithLocation(6, 31), // (7,9): error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // S2* span2 = stackalloc [] { default(S2) }; Diagnostic(ErrorCode.ERR_NoTypeDef, "S2*").WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(7, 9), // (7,9): warning CS8500: This takes the address of, gets the size of, or declares a pointer to a managed type ('S2') // S2* span2 = stackalloc [] { default(S2) }; Diagnostic(ErrorCode.WRN_ManagedAddr, "S2*").WithArguments("S2").WithLocation(7, 9), // (7,21): error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // S2* span2 = stackalloc [] { default(S2) }; Diagnostic(ErrorCode.ERR_NoTypeDef, "stackalloc [] { default(S2) }").WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(7, 21), // (7,21): error CS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('S2') // S2* span2 = stackalloc [] { default(S2) }; Diagnostic(ErrorCode.ERR_ManagedAddr, "stackalloc [] { default(S2) }").WithArguments("S2").WithLocation(7, 21)); comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref1, UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics(); } [Fact] public void Unmanaged_UseSiteError_05() { var source = @" class C { S2 s2; unsafe void M() { fixed (S2* ptr = &s2) { } } } "; var comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics( // (7,16): error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // fixed (S2* ptr = &s2) Diagnostic(ErrorCode.ERR_NoTypeDef, "S2*").WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(7, 16), // (7,16): warning CS8500: This takes the address of, gets the size of, or declares a pointer to a managed type ('S2') // fixed (S2* ptr = &s2) Diagnostic(ErrorCode.WRN_ManagedAddr, "S2*").WithArguments("S2").WithLocation(7, 16), // (7,26): error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // fixed (S2* ptr = &s2) Diagnostic(ErrorCode.ERR_NoTypeDef, "&s2").WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(7, 26), // (7,26): warning CS8500: This takes the address of, gets the size of, or declares a pointer to a managed type ('S2') // fixed (S2* ptr = &s2) Diagnostic(ErrorCode.WRN_ManagedAddr, "&s2").WithArguments("S2").WithLocation(7, 26), // (7,26): error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // fixed (S2* ptr = &s2) Diagnostic(ErrorCode.ERR_NoTypeDef, "&s2").WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(7, 26), // (7,26): warning CS8500: This takes the address of, gets the size of, or declares a pointer to a managed type ('S2') // fixed (S2* ptr = &s2) Diagnostic(ErrorCode.WRN_ManagedAddr, "&s2").WithArguments("S2").WithLocation(7, 26) ); comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref1, UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics(); } [Fact] public void Unmanaged_UseSiteError_06() { var source = @" class C { void M<T>(T t) where T : unmanaged { } void M1() { M(default(S2)); // 1, 2 M(default(S2)); // 3, 4 } } "; var comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics( // (8,9): error CS8377: The type 'S2' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'C.M<T>(T)' // M(default(S2)); // 1, 2 Diagnostic(ErrorCode.ERR_UnmanagedConstraintNotSatisfied, "M").WithArguments("C.M<T>(T)", "T", "S2").WithLocation(8, 9), // (8,9): error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // M(default(S2)); // 1, 2 Diagnostic(ErrorCode.ERR_NoTypeDef, "M").WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(8, 9), // (9,9): error CS8377: The type 'S2' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'C.M<T>(T)' // M(default(S2)); // 3, 4 Diagnostic(ErrorCode.ERR_UnmanagedConstraintNotSatisfied, "M").WithArguments("C.M<T>(T)", "T", "S2").WithLocation(9, 9), // (9,9): error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // M(default(S2)); // 3, 4 Diagnostic(ErrorCode.ERR_NoTypeDef, "M").WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(9, 9)); comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref1, UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics(); } [Fact] public void Unmanaged_UseSiteError_07() { var source = @" public struct S3 { public S2 s2; } class C { void M<T>(T t) where T : unmanaged { } void M1() { M(default(S3)); // 1, 2 M(default(S3)); // 3, 4 } } "; var comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics( // (13,9): error CS8377: The type 'S3' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'C.M<T>(T)' // M(default(S3)); // 1, 2 Diagnostic(ErrorCode.ERR_UnmanagedConstraintNotSatisfied, "M").WithArguments("C.M<T>(T)", "T", "S3").WithLocation(13, 9), // (13,9): error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // M(default(S3)); // 1, 2 Diagnostic(ErrorCode.ERR_NoTypeDef, "M").WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(13, 9), // (14,9): error CS8377: The type 'S3' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'C.M<T>(T)' // M(default(S3)); // 3, 4 Diagnostic(ErrorCode.ERR_UnmanagedConstraintNotSatisfied, "M").WithArguments("C.M<T>(T)", "T", "S3").WithLocation(14, 9), // (14,9): error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. // M(default(S3)); // 3, 4 Diagnostic(ErrorCode.ERR_NoTypeDef, "M").WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(14, 9)); comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref1, UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics(); } [Fact] public void Unmanaged_UseSiteError_08() { var source = @" using System.Threading.Tasks; using System; class C { async Task M1() { S2 s2 = M2(); await M1(); Console.Write(s2); } S2 M2() => default; } "; var comp = CreateCompilation(source, references: new[] { UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics( // error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Diagnostic(ErrorCode.ERR_NoTypeDef).WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(1, 1), // error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Diagnostic(ErrorCode.ERR_NoTypeDef).WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(1, 1)); comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref1, UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics(); } [Fact] public void Unmanaged_UseSiteError_09() { var source = @" public struct S3 { public S2 s2; } "; var comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics(); var s3 = comp.GetMember<NamedTypeSymbol>("S3"); verifyIsManagedType(); verifyIsManagedType(); void verifyIsManagedType() { var managedKindUseSiteInfo = new CompoundUseSiteInfo<AssemblySymbol>(s3.ContainingAssembly); Assert.True(s3.IsManagedType(ref managedKindUseSiteInfo)); managedKindUseSiteInfo.Diagnostics.Verify( // error CS0012: The type 'S1' is defined in an assembly that is not referenced. You must add a reference to assembly 'libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Diagnostic(ErrorCode.ERR_NoTypeDef).WithArguments("S1", "libS1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(1, 1) ); } comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll, references: new[] { UnmanagedUseSiteError_Ref1, UnmanagedUseSiteError_Ref2 }); comp.VerifyEmitDiagnostics(); s3 = comp.GetMember<NamedTypeSymbol>("S3"); verifyIsUnmanagedType(); verifyIsUnmanagedType(); void verifyIsUnmanagedType() { var managedKindUseSiteInfo = new CompoundUseSiteInfo<AssemblySymbol>(s3.ContainingAssembly); Assert.False(s3.IsManagedType(ref managedKindUseSiteInfo)); Assert.Null(managedKindUseSiteInfo.Diagnostics); } } [Fact] public void OverrideWithModreq_01() { var il = @" .class public auto ansi beforefieldinit CL1 extends[mscorlib] System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 1 IL_0000: ldarg.0 IL_0001: call instance void[mscorlib] System.Object::.ctor() IL_0006: ret } .method public hidebysig newslot virtual instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) get_P() cil managed { .maxstack 8 ldc.i4.s 123 ret } } // end of class CL1 "; var source = @" class Test : CL1 { public override int get_P() { return default; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (4,25): error CS0570: 'CL1.get_P()' is not supported by the language // public override int get_P() Diagnostic(ErrorCode.ERR_BindToBogus, "get_P").WithArguments("CL1.get_P()").WithLocation(4, 25) ); } [Fact] public void OverrideWithModreq_02() { var il = @" .class public auto ansi beforefieldinit CL1 extends[mscorlib] System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 1 IL_0000: ldarg.0 IL_0001: call instance void[mscorlib] System.Object::.ctor() IL_0006: ret } .method public hidebysig newslot virtual instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) get_P() cil managed { .maxstack 8 ldc.i4.s 123 ret } .property instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) P() { .get instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) CL1::get_P() } } // end of class CL1 "; var source = @" class Test : CL1 { public override int P { get => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (4,25): error CS0569: 'Test.P': cannot override 'CL1.P' because it is not supported by the language // public override int P Diagnostic(ErrorCode.ERR_CantOverrideBogusMethod, "P").WithArguments("Test.P", "CL1.P").WithLocation(4, 25) ); } [Fact] public void OverrideWithModreq_03() { var il = @" .class public auto ansi beforefieldinit CL1 extends[mscorlib] System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 1 IL_0000: ldarg.0 IL_0001: call instance void[mscorlib] System.Object::.ctor() IL_0006: ret } .method public hidebysig newslot virtual instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) get_P() cil managed { .maxstack 8 ldc.i4.s 123 ret } .property instance int32 P() { .get instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) CL1::get_P() } } // end of class CL1 "; var source = @" class Test : CL1 { public override int P { get => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (6,9): error CS0570: 'CL1.P.get' is not supported by the language // get => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "get").WithArguments("CL1.P.get").WithLocation(6, 9) ); } [Fact] public void OverrideWithModreq_04() { var il = @" .class public auto ansi beforefieldinit CL1 extends[mscorlib] System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 1 IL_0000: ldarg.0 IL_0001: call instance void[mscorlib] System.Object::.ctor() IL_0006: ret } .method public hidebysig newslot virtual instance void modreq([mscorlib]System.Runtime.CompilerServices.IsConst) set_P(int32 x) cil managed { .maxstack 8 ret } .property instance int32 P() { .set instance void modreq([mscorlib]System.Runtime.CompilerServices.IsConst) CL1::set_P(int32) } } // end of class CL1 "; var source = @" class Test : CL1 { public override int P { set => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (6,9): error CS0570: 'CL1.P.set' is not supported by the language // set => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "set").WithArguments("CL1.P.set").WithLocation(6, 9) ); } [Fact] public void OverrideWithModreq_05() { var il = @" .class public auto ansi beforefieldinit CL1 extends[mscorlib] System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 1 IL_0000: ldarg.0 IL_0001: call instance void[mscorlib] System.Object::.ctor() IL_0006: ret } .method public hidebysig newslot virtual instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) get_P() cil managed { .maxstack 8 ldc.i4.s 123 ret } .method public hidebysig newslot virtual instance void modreq([mscorlib]System.Runtime.CompilerServices.IsConst) set_P(int32 x) cil managed { .maxstack 8 ret } .property instance int32 P() { .get instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) CL1::get_P() .set instance void modreq([mscorlib]System.Runtime.CompilerServices.IsConst) CL1::set_P(int32) } } // end of class CL1 "; var source = @" class Test : CL1 { public override int P { get => throw null; set => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (6,9): error CS0570: 'CL1.P.get' is not supported by the language // get => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "get").WithArguments("CL1.P.get").WithLocation(6, 9), // (7,9): error CS0570: 'CL1.P.set' is not supported by the language // set => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "set").WithArguments("CL1.P.set").WithLocation(7, 9) ); } [Fact] public void OverrideWithModreq_06() { var il = @" .class public auto ansi beforefieldinit CL1 extends[mscorlib] System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 1 IL_0000: ldarg.0 IL_0001: call instance void[mscorlib] System.Object::.ctor() IL_0006: ret } .method public hidebysig newslot virtual instance int32 get_P() cil managed { .maxstack 8 ldc.i4.s 123 ret } .method public hidebysig newslot virtual instance void modreq([mscorlib]System.Runtime.CompilerServices.IsConst) set_P(int32 x) cil managed { .maxstack 8 ret } .property instance int32 P() { .get instance int32 CL1::get_P() .set instance void modreq([mscorlib]System.Runtime.CompilerServices.IsConst) CL1::set_P(int32) } } // end of class CL1 "; var source = @" class Test : CL1 { public override int P { get => throw null; set => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (7,9): error CS0570: 'CL1.P.set' is not supported by the language // set => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "set").WithArguments("CL1.P.set").WithLocation(7, 9) ); } [Fact] public void OverrideWithModreq_07() { var il = @" .class public auto ansi beforefieldinit CL1 extends[mscorlib] System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 1 IL_0000: ldarg.0 IL_0001: call instance void[mscorlib] System.Object::.ctor() IL_0006: ret } .method public hidebysig newslot virtual instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) get_P() cil managed { .maxstack 8 ldc.i4.s 123 ret } .method public hidebysig newslot virtual instance void set_P(int32 x) cil managed { .maxstack 8 ret } .property instance int32 P() { .get instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) CL1::get_P() .set instance void CL1::set_P(int32) } } // end of class CL1 "; var source = @" class Test : CL1 { public override int P { get => throw null; set => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (6,9): error CS0570: 'CL1.P.get' is not supported by the language // get => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "get").WithArguments("CL1.P.get").WithLocation(6, 9) ); } [Fact] public void OverrideWithModreq_08() { var il = @" .class public auto ansi beforefieldinit CL1 extends[mscorlib] System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 1 IL_0000: ldarg.0 IL_0001: call instance void[mscorlib] System.Object::.ctor() IL_0006: ret } .method public hidebysig specialname newslot virtual instance void add_E ( class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst) 'value' ) cil managed { ret } .method public hidebysig specialname newslot virtual instance void remove_E ( class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst) 'value' ) cil managed { ret } .event [mscorlib]System.Action E { .addon instance void CL1::add_E(class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst)) .removeon instance void CL1::remove_E(class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst)) } } // end of class CL1 "; var source = @" class Test : CL1 { public override event System.Action E { add => throw null; remove => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (6,9): error CS0570: 'CL1.E.add' is not supported by the language // add => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "add").WithArguments("CL1.E.add").WithLocation(6, 9), // (7,9): error CS0570: 'CL1.E.remove' is not supported by the language // remove => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "remove").WithArguments("CL1.E.remove").WithLocation(7, 9) ); } [Fact] public void OverrideWithModreq_09() { var il = @" .class public auto ansi beforefieldinit CL1 extends[mscorlib] System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 1 IL_0000: ldarg.0 IL_0001: call instance void[mscorlib] System.Object::.ctor() IL_0006: ret } .method public hidebysig specialname newslot virtual instance void add_E ( class [mscorlib]System.Action 'value' ) cil managed { ret } .method public hidebysig specialname newslot virtual instance void remove_E ( class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst) 'value' ) cil managed { ret } .event [mscorlib]System.Action E { .addon instance void CL1::add_E(class [mscorlib]System.Action) .removeon instance void CL1::remove_E(class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst)) } } // end of class CL1 "; var source = @" class Test : CL1 { public override event System.Action E { add => throw null; remove => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (7,9): error CS0570: 'CL1.E.remove' is not supported by the language // remove => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "remove").WithArguments("CL1.E.remove").WithLocation(7, 9) ); } [Fact] public void OverrideWithModreq_10() { var il = @" .class public auto ansi beforefieldinit CL1 extends[mscorlib] System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 1 IL_0000: ldarg.0 IL_0001: call instance void[mscorlib] System.Object::.ctor() IL_0006: ret } .method public hidebysig specialname newslot virtual instance void add_E ( class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst) 'value' ) cil managed { ret } .method public hidebysig specialname newslot virtual instance void remove_E ( class [mscorlib]System.Action 'value' ) cil managed { ret } .event [mscorlib]System.Action E { .addon instance void CL1::add_E(class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst)) .removeon instance void CL1::remove_E(class [mscorlib]System.Action) } } // end of class CL1 "; var source = @" class Test : CL1 { public override event System.Action E { add => throw null; remove => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (6,9): error CS0570: 'CL1.E.add' is not supported by the language // add => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "add").WithArguments("CL1.E.add").WithLocation(6, 9) ); } [Fact] public void ImplementWithModreq_01() { var il = @" .class interface public abstract auto ansi CL1 { .method public hidebysig newslot specialname abstract virtual instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) get_P() cil managed { } } // end of class CL1 "; var source = @" class Test : CL1 { public int get_P() { return default; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (4,16): error CS0570: 'CL1.get_P()' is not supported by the language // public int get_P() Diagnostic(ErrorCode.ERR_BindToBogus, "get_P").WithArguments("CL1.get_P()").WithLocation(4, 16) ); } [Fact] public void ImplementWithModreq_02() { var il = @" .class interface public abstract auto ansi CL1 { .method public hidebysig newslot specialname abstract virtual instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) get_P() cil managed { } .property instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) P() { .get instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) CL1::get_P() } } // end of class CL1 "; var source = @" class Test1 : CL1 { public int P { get => throw null; } } class Test2 : CL1 { int CL1.P { get => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (6,9): error CS0686: Accessor 'Test1.P.get' cannot implement interface member 'CL1.get_P()' for type 'Test1'. Use an explicit interface implementation. // get => throw null; Diagnostic(ErrorCode.ERR_AccessorImplementingMethod, "get").WithArguments("Test1.P.get", "CL1.get_P()", "Test1").WithLocation(6, 9), // (12,13): error CS0682: 'Test2.CL1.P' cannot implement 'CL1.P' because it is not supported by the language // int CL1.P Diagnostic(ErrorCode.ERR_BogusExplicitImpl, "P").WithArguments("Test2.CL1.P", "CL1.P").WithLocation(12, 13), // (14,9): error CS0570: 'CL1.get_P()' is not supported by the language // get => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "get").WithArguments("CL1.get_P()").WithLocation(14, 9) ); } [Fact] public void ImplementWithModreq_03() { var il = @" .class interface public abstract auto ansi CL1 { .method public hidebysig newslot specialname abstract virtual instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) get_P() cil managed { } .property instance int32 P() { .get instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) CL1::get_P() } } // end of class CL1 "; var source = @" class Test1 : CL1 { public int P { get => throw null; } } class Test2 : CL1 { int CL1.P { get => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (6,9): error CS0570: 'CL1.P.get' is not supported by the language // get => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "get").WithArguments("CL1.P.get").WithLocation(6, 9), // (14,9): error CS0570: 'CL1.P.get' is not supported by the language // get => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "get").WithArguments("CL1.P.get").WithLocation(14, 9) ); } [Fact] public void ImplementWithModreq_04() { var il = @" .class interface public abstract auto ansi CL1 { .method public hidebysig newslot specialname abstract virtual instance void modreq([mscorlib]System.Runtime.CompilerServices.IsConst) set_P(int32 x) cil managed { } .property instance int32 P() { .set instance void modreq([mscorlib]System.Runtime.CompilerServices.IsConst) CL1::set_P(int32) } } // end of class CL1 "; var source = @" class Test1 : CL1 { public int P { set => throw null; } } class Test2 : CL1 { int CL1.P { set => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (6,9): error CS0570: 'CL1.P.set' is not supported by the language // set => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "set").WithArguments("CL1.P.set").WithLocation(6, 9), // (14,9): error CS0570: 'CL1.P.set' is not supported by the language // set => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "set").WithArguments("CL1.P.set").WithLocation(14, 9) ); } [Fact] public void ImplementWithModreq_05() { var il = @" .class interface public abstract auto ansi CL1 { .method public hidebysig newslot specialname abstract virtual instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) get_P() cil managed { } .method public hidebysig newslot specialname abstract virtual instance void modreq([mscorlib]System.Runtime.CompilerServices.IsConst) set_P(int32 x) cil managed { } .property instance int32 P() { .get instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) CL1::get_P() .set instance void modreq([mscorlib]System.Runtime.CompilerServices.IsConst) CL1::set_P(int32) } } // end of class CL1 "; var source = @" class Test1 : CL1 { public int P { get => throw null; set => throw null; } } class Test2 : CL1 { int CL1.P { get => throw null; set => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (6,9): error CS0570: 'CL1.P.get' is not supported by the language // get => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "get").WithArguments("CL1.P.get").WithLocation(6, 9), // (7,9): error CS0570: 'CL1.P.set' is not supported by the language // set => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "set").WithArguments("CL1.P.set").WithLocation(7, 9), // (15,9): error CS0570: 'CL1.P.get' is not supported by the language // get => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "get").WithArguments("CL1.P.get").WithLocation(15, 9), // (16,9): error CS0570: 'CL1.P.set' is not supported by the language // set => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "set").WithArguments("CL1.P.set").WithLocation(16, 9) ); } [Fact] public void ImplementWithModreq_06() { var il = @" .class interface public abstract auto ansi CL1 { .method public hidebysig newslot specialname abstract virtual instance int32 get_P() cil managed { } .method public hidebysig newslot specialname abstract virtual instance void modreq([mscorlib]System.Runtime.CompilerServices.IsConst) set_P(int32 x) cil managed { } .property instance int32 P() { .get instance int32 CL1::get_P() .set instance void modreq([mscorlib]System.Runtime.CompilerServices.IsConst) CL1::set_P(int32) } } // end of class CL1 "; var source = @" class Test1 : CL1 { public int P { get => throw null; set => throw null; } } class Test2 : CL1 { int CL1.P { get => throw null; set => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (7,9): error CS0570: 'CL1.P.set' is not supported by the language // set => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "set").WithArguments("CL1.P.set").WithLocation(7, 9), // (16,9): error CS0570: 'CL1.P.set' is not supported by the language // set => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "set").WithArguments("CL1.P.set").WithLocation(16, 9) ); } [Fact] public void ImplementWithModreq_07() { var il = @" .class interface public abstract auto ansi CL1 { .method public hidebysig newslot specialname abstract virtual instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) get_P() cil managed { } .method public hidebysig newslot specialname abstract virtual instance void set_P(int32 x) cil managed { } .property instance int32 P() { .get instance int32 modreq([mscorlib]System.Runtime.CompilerServices.IsConst) CL1::get_P() .set instance void CL1::set_P(int32) } } // end of class CL1 "; var source = @" class Test1 : CL1 { public int P { get => throw null; set => throw null; } } class Test2 : CL1 { int CL1.P { get => throw null; set => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (6,9): error CS0570: 'CL1.P.get' is not supported by the language // get => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "get").WithArguments("CL1.P.get").WithLocation(6, 9), // (15,9): error CS0570: 'CL1.P.get' is not supported by the language // get => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "get").WithArguments("CL1.P.get").WithLocation(15, 9) ); } [Fact] public void ImplementWithModreq_08() { var il = @" .class interface public abstract auto ansi CL1 { .method public hidebysig specialname newslot abstract virtual instance void add_E ( class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst) 'value' ) cil managed { } .method public hidebysig specialname newslot abstract virtual instance void remove_E ( class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst) 'value' ) cil managed { } .event [mscorlib]System.Action E { .addon instance void CL1::add_E(class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst)) .removeon instance void CL1::remove_E(class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst)) } } // end of class CL1 "; var source = @" class Test1 : CL1 { public event System.Action E { add => throw null; remove => throw null; } } class Test2 : CL1 { event System.Action CL1.E { add => throw null; remove => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (6,9): error CS0570: 'CL1.E.add' is not supported by the language // add => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "add").WithArguments("CL1.E.add").WithLocation(6, 9), // (7,9): error CS0570: 'CL1.E.remove' is not supported by the language // remove => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "remove").WithArguments("CL1.E.remove").WithLocation(7, 9), // (15,9): error CS0570: 'CL1.E.add' is not supported by the language // add => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "add").WithArguments("CL1.E.add").WithLocation(15, 9), // (16,9): error CS0570: 'CL1.E.remove' is not supported by the language // remove => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "remove").WithArguments("CL1.E.remove").WithLocation(16, 9) ); } [Fact] public void ImplementWithModreq_09() { var il = @" .class interface public abstract auto ansi CL1 { .method public hidebysig specialname newslot abstract virtual instance void add_E ( class [mscorlib]System.Action 'value' ) cil managed { } .method public hidebysig specialname newslot abstract virtual instance void remove_E ( class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst) 'value' ) cil managed { } .event [mscorlib]System.Action E { .addon instance void CL1::add_E(class [mscorlib]System.Action) .removeon instance void CL1::remove_E(class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst)) } } // end of class CL1 "; var source = @" class Test1 : CL1 { public event System.Action E { add => throw null; remove => throw null; } } class Test2 : CL1 { event System.Action CL1.E { add => throw null; remove => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (7,9): error CS0570: 'CL1.E.remove' is not supported by the language // remove => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "remove").WithArguments("CL1.E.remove").WithLocation(7, 9), // (16,9): error CS0570: 'CL1.E.remove' is not supported by the language // remove => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "remove").WithArguments("CL1.E.remove").WithLocation(16, 9) ); } [Fact] public void ImplementWithModreq_10() { var il = @" .class interface public abstract auto ansi CL1 { .method public hidebysig specialname newslot abstract virtual instance void add_E ( class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst) 'value' ) cil managed { } .method public hidebysig specialname newslot abstract virtual instance void remove_E ( class [mscorlib]System.Action 'value' ) cil managed { } .event [mscorlib]System.Action E { .addon instance void CL1::add_E(class [mscorlib]System.Action modreq([mscorlib]System.Runtime.CompilerServices.IsConst)) .removeon instance void CL1::remove_E(class [mscorlib]System.Action) } } // end of class CL1 "; var source = @" class Test1 : CL1 { public event System.Action E { add => throw null; remove => throw null; } } class Test2 : CL1 { event System.Action CL1.E { add => throw null; remove => throw null; } } "; CreateCompilationWithIL(source, il).VerifyDiagnostics( // (6,9): error CS0570: 'CL1.E.add' is not supported by the language // add => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "add").WithArguments("CL1.E.add").WithLocation(6, 9), // (15,9): error CS0570: 'CL1.E.add' is not supported by the language // add => throw null; Diagnostic(ErrorCode.ERR_BindToBogus, "add").WithArguments("CL1.E.add").WithLocation(15, 9) ); } } }
{ "content_hash": "2d2fc2fc64cd6f6ffc47720891686d7a", "timestamp": "", "source": "github", "line_count": 3836, "max_line_length": 338, "avg_line_length": 52.0247653806048, "alnum_prop": 0.6516207589431119, "repo_name": "shyamnamboodiripad/roslyn", "id": "ed7857c8f5f9151a4105a70d0a4d592d09088e81", "size": "199569", "binary": false, "copies": "3", "ref": "refs/heads/main", "path": "src/Compilers/CSharp/Test/Semantic/Semantics/UseSiteErrorTests.cs", "mode": "33188", "license": "mit", "language": [ { "name": "1C Enterprise", "bytes": "257760" }, { "name": "Batchfile", "bytes": "8186" }, { "name": "C#", "bytes": "175466619" }, { "name": "C++", "bytes": "5602" }, { "name": "CMake", "bytes": "12939" }, { "name": "Dockerfile", "bytes": "441" }, { "name": "F#", "bytes": "549" }, { "name": "PowerShell", "bytes": "285141" }, { "name": "Shell", "bytes": "133800" }, { "name": "Vim Snippet", "bytes": "6353" }, { "name": "Visual Basic .NET", "bytes": "73892766" } ], "symlink_target": "" }
import type { FC } from 'react' import React from 'react' import type { DateTimeFormatProps } from '../../../Form/Inputs/DateTimeFormat' import { DateTimeFormat } from '../../../Form/Inputs/DateTimeFormat' export const TimeFormat: FC<DateTimeFormatProps> = props => ( <DateTimeFormat {...props} date={false} /> )
{ "content_hash": "451e47e5d62518965c4467fa8aace94e", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 78, "avg_line_length": 31.8, "alnum_prop": 0.6949685534591195, "repo_name": "looker-open-source/components", "id": "2721a3faddbe83883610c62e0ef48390bef509a9", "size": "1426", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "packages/components/src/Calendar/utils/TimeFormat/TimeFormat.tsx", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "10788" }, { "name": "HTML", "bytes": "10602733" }, { "name": "JavaScript", "bytes": "125821" }, { "name": "Shell", "bytes": "5731" }, { "name": "TypeScript", "bytes": "6564851" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name Botrychium californicum Underwood ### Remarks null
{ "content_hash": "78a092c217f8c1eeedd13ae5c8831c9f", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 33, "avg_line_length": 11.923076923076923, "alnum_prop": 0.7483870967741936, "repo_name": "mdoering/backbone", "id": "707fd63f50078b25fe8bc3191c45e670322a85bf", "size": "218", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Pteridophyta/Psilotopsida/Ophioglossales/Ophioglossaceae/Sceptridium/Sceptridium californicum/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
#ifndef INDEX_H_ #define INDEX_H_ #include <vector> #include <algorithm> #include <string.h> #include <iostream> #define INITIAL_SIZE 128 class FileIndex { private: int lengthArrays; int lengthAdditionalArrays; long *keys; short *files; int *positions; int size; int additionalSize; long *additionalKeys; FileIndex **additionalIndices; void checkLengthArrays(int size) { if (size >= lengthArrays) { int newsize = std::max(std::max(size * 2, INITIAL_SIZE), (int) (lengthArrays * 1.5)); long *newkeys = new long[newsize]; int *newpositions = new int[newsize]; short *newfiles = new short[newsize]; if (size > 0) { memcpy(newkeys, keys, sizeof(long) * lengthArrays); memcpy(newpositions, positions, sizeof(int) * lengthArrays); memcpy(newfiles, files, sizeof(short) * lengthArrays); delete[] keys; delete[] positions; delete[] files; } keys = newkeys; positions = newpositions; files = newfiles; lengthArrays = newsize; } } void checkLengthAdditionalArrays(int size) { if (size >= lengthAdditionalArrays) { int newsize = std::max(std::max(size * 2, INITIAL_SIZE), (int) (lengthAdditionalArrays * 1.5)); long *newkeys = new long[newsize]; FileIndex **newindices = new FileIndex*[newsize]; if (size > 0) { memcpy(newkeys, additionalKeys, sizeof(long) * lengthAdditionalArrays); memcpy(newindices, additionalIndices, sizeof(FileIndex*) * lengthAdditionalArrays); delete[] additionalKeys; delete[] additionalIndices; } additionalKeys = newkeys; additionalIndices = newindices; lengthAdditionalArrays = newsize; } } public: FileIndex(); void unserialize(char* buffer, int *offset); short file(int idx); int pos(int idx); long key(int idx); int idx(const long key); int idx(const int startIdx, const long key); FileIndex *additional_idx(long key); int sizeIndex(); ~FileIndex(); //Used for insert bool isEmpty(); char* serialize(char *buffer, int &offset, int &maxSize); void add(long key, short file, int pos); void addAdditionalIndex(long key, FileIndex *idx); }; #endif /* INDEX_H_ */
{ "content_hash": "e1791828f6a95cd8c887c16c92eefdcb", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 107, "avg_line_length": 29.732558139534884, "alnum_prop": 0.5737192021900664, "repo_name": "jrbn/trident", "id": "ef238f3ae11c6ab3a5b5ce38c068fce12b465234", "size": "3397", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "include/trident/binarytables/fileindex.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "7046" }, { "name": "C++", "bytes": "5206676" }, { "name": "CMake", "bytes": "8333" }, { "name": "CSS", "bytes": "6693" }, { "name": "HTML", "bytes": "1424" }, { "name": "Makefile", "bytes": "12042" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>perfect-scrollbar example</title> <link href="../dist/css/perfect-scrollbar.css" rel="stylesheet"> <script src="../dist/js/perfect-scrollbar.js"></script> <style> .contentHolder { position:relative; margin:0px auto; padding:0px; width: 600px; height: 400px; overflow: auto; } .contentHolder .content { background-image: url('./azusa.jpg'); width: 1280px; height: 720px; } .my-list, textarea { position: absolute; top: 0; left: 0; width: 130px; height: 200px; overflow: scroll; background-color: rgba(255,255,255,0.6); } .my-list { left: 140px; } .my-list-two { left: 280px; overflow: auto; } ul { margin: 0; padding: 0; } li { box-sizing: border-box; padding: 10px 5px; border-width: 0 0 1px 0; list-style-type: none; margin: 0; } li:nth-child(even) { background-color: rgba(0,0,0,0.5); } textarea { font-size: 120%; } </style> </head> <div id="Default" class="contentHolder"> <div class="content"> <textarea cols="20" rows="50"> Children inside perfect scrollbar can be natively scrolled by the mousewheel. It automatically works for textarea elements, other elements need the .ps-child class. </textarea> <div class="ps-child my-list"> <code>overflow: scroll</code> <ul><li>One</li><li>Two</li><li>Three</li><li>Four</li><li>Five</li><li>Six</li><li>Seven</li><li>Eight</li></ul> </div> <div class="ps-child my-list my-list-two"> <code>overflow: auto</code> <ul><li>One</li><li>Two</li><li>Three</li><li>Four</li><li>Five</li><li>Six</li><li>Seven</li><li>Eight</li></ul> </div> </div> </div> <script type="text/javascript"> window.onload = function () { Ps.initialize(document.querySelector('#Default')); }; </script> </body> </html>
{ "content_hash": "b022b146dba3492e9bcc48e7feb89ae3", "timestamp": "", "source": "github", "line_count": 73, "max_line_length": 174, "avg_line_length": 30.931506849315067, "alnum_prop": 0.5323294951284322, "repo_name": "guandai/perfect-scrollbar", "id": "5bd02730a7543cd84c72e37d6050b42981e624cd", "size": "2258", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "examples/children-native-scroll.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "4695" }, { "name": "JavaScript", "bytes": "47810" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <phpunit backupGlobals="false" backupStaticAttributes="false" cacheTokens="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" forceCoversAnnotation="false" mapTestClassNameToCoveredClassName="false" processIsolation="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" strict="true" verbose="false"> <testsuites> <testsuite name="Test_Suite"> <directory suffix='Test.php'>./Tests/</directory> <directory suffix='Test.php'>../app/Tests/</directory> </testsuite> </testsuites> <filter> <blacklist> <directory>tests</directory> </blacklist> </filter> <logging> <log type="coverage-html" target="../tmp/reports/code_coverage" charset="UTF-8" yui="true" highlight="false" lowUpperBound="35" highLowerBound="70"/> </logging> </phpunit>
{ "content_hash": "b8036233906a5681d77b2ddbea7ac578", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 157, "avg_line_length": 31.757575757575758, "alnum_prop": 0.6507633587786259, "repo_name": "fabiocicerchia/Silex-Setup", "id": "aa8a3a521f870743b2b022f38e6e2b16cc4bb5ab", "size": "1048", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/test_suite.xml", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "0" }, { "name": "JavaScript", "bytes": "0" }, { "name": "PHP", "bytes": "30393" }, { "name": "Shell", "bytes": "2410" } ], "symlink_target": "" }
package activiti.spring.javnaNabavka.enitity; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Ponuda { @Id @GeneratedValue private Long id; private String user; private String nazivNarucioca; private String adresaNarucioca; private Double procenjenaVrednost; private Double predlozenaCena; private Double koeficijent; public Ponuda() { super(); } public Ponuda(String user, String nazivNarucioca, String adresaNarucioca, Double procenjenaVrednost, Double predlozenaCena, Double koeficijent) { super(); this.user = user; this.nazivNarucioca = nazivNarucioca; this.adresaNarucioca = adresaNarucioca; this.procenjenaVrednost = procenjenaVrednost; this.predlozenaCena = predlozenaCena; this.koeficijent = koeficijent; } public String getUser() { return user; } public void setUser(String user) { this.user = user; } public String getNazivNarucioca() { return nazivNarucioca; } public void setNazivNarucioca(String nazivNarucioca) { this.nazivNarucioca = nazivNarucioca; } public String getAdresaNarucioca() { return adresaNarucioca; } public void setAdresaNarucioca(String adresaNarucioca) { this.adresaNarucioca = adresaNarucioca; } public Double getProcenjenaVrednost() { return procenjenaVrednost; } public void setProcenjenaVrednost(Double procenjenaVrednost) { this.procenjenaVrednost = procenjenaVrednost; } public Double getPredlozenaCena() { return predlozenaCena; } public void setPredlozenaCena(Double predlozenaCena) { this.predlozenaCena = predlozenaCena; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Double getKoeficijent() { return koeficijent; } public void setKoeficijent(Double koeficijent) { this.koeficijent = koeficijent; } }
{ "content_hash": "897d56a8ca523d19dc072fc15695e3a0", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 146, "avg_line_length": 21.204545454545453, "alnum_prop": 0.7652733118971061, "repo_name": "LaudaDev/upp-javna-nabavka", "id": "67b23d18130916d45fada3a110b7ff7cac45d230", "size": "1866", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/activiti/spring/javnaNabavka/enitity/Ponuda.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "4451" }, { "name": "Java", "bytes": "216074" } ], "symlink_target": "" }
import React, { Component } from 'react'; import { connect } from 'react-redux'; import autobind from 'autobind-decorator'; import history from '../../module/history'; import { injectAsyncReducer } from '../../store'; import { load, } from './_actions'; import { Alert, Table, Modal, Button, FormGroup, Col, Checkbox, ControlLabel, Form, FormControl, Glyphicon, Pagination, InputGroup, Row } from 'react-bootstrap'; import Wait from '../../tag/wait'; import BlockError from '../../tag/block-error'; import Menu from '../../container/menu'; import './styles.css'; @autobind export class TruckList extends Component { componentWillMount(){ this.props.load(); } onClickEdit(id){ history.push('/project/'+id); } onClickNew(){ history.push('/project/new'); } renderLine(line){ const { id, description, pts, technical_card, } = line; return ( <tr onClick={this.onClickEdit.bind(this, id)}> <td>{description}</td> <td>{pts}</td> <td>{technical_card}</td> </tr> ) } render() { const { data, locked, error } = this.props; const lines = [] for (var i in data) lines.push( this.renderLine(data[i]) ) return ( <div className="container"> {locked && <Wait size={1} type="cover" />} <Row> <Menu/> </Row> <Row> {!locked && error && <BlockError error={error} />} {!locked && !error && <div> <Col> <Table bordered hover> <thead> <tr> <th> Название </th> <th> ПТС </th> <th> Техталон </th> </tr> </thead> <tbody> {lines} </tbody> </Table> </Col> {<Button key='button-edit' bsStyle="primary" onClick={this.onClickNew}>+</Button>} </div> } </Row> </div> ); } } const mapStateToProps = state => ({ locked : state.truckList.locked, error : state.truckList.error, data : state.truckList.data, }); const mapDispatchToProps = { load, } injectAsyncReducer('truckList', require('./_reducer').default); export default connect(mapStateToProps, mapDispatchToProps)(TruckList);
{ "content_hash": "bb9dd86ad935f1e5a79e6b24963f72c5", "timestamp": "", "source": "github", "line_count": 124, "max_line_length": 86, "avg_line_length": 17.838709677419356, "alnum_prop": 0.5669077757685352, "repo_name": "artemdudkin/gtd", "id": "691a78ce1e3ada207798ac59256430f26897ef02", "size": "2231", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/container-page/project-list/index.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2301" }, { "name": "HTML", "bytes": "339" }, { "name": "JavaScript", "bytes": "81927" } ], "symlink_target": "" }
#import "UAAction.h" /** * Closes a rich content window. * * This action is registered under the reserved name __close_window_action. * * Expected argument type: UAWebInvocationActionArguments * * Expected argument value: none * * Valid situations: UASituationWebViewInvocation. * * Result value: nil * */ @interface UACloseWindowAction : UAAction @end
{ "content_hash": "71da151e801cc68dd78abc977413786d", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 75, "avg_line_length": 16.863636363636363, "alnum_prop": 0.7250673854447439, "repo_name": "seth-hayward/authie", "id": "8f849471b63f9a3c83777c4bf6cfba82908c3cb5", "size": "1672", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "authie/authie/Airship/Common/UACloseWindowAction.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "55563" }, { "name": "C++", "bytes": "2869" }, { "name": "Objective-C", "bytes": "1035236" }, { "name": "Ruby", "bytes": "606" } ], "symlink_target": "" }
""" .. module: security_monkey.tests.core.test_audit_issue_cleanup :platform: Unix .. version:: $$VERSION$$ .. moduleauthor:: Bridgewater OSS <opensource@bwater.com> """ from security_monkey.tests import SecurityMonkeyTestCase from security_monkey.auditor import Auditor from security_monkey.datastore import Account, AccountType, Technology from security_monkey.datastore import Item, ItemAudit, AuditorSettings from security_monkey.auditor import auditor_registry from security_monkey import db, app, ARN_PREFIX from mock import patch from collections import defaultdict class MockAuditor(Auditor): def __init__(self, accounts=None, debug=False): super(MockAuditor, self).__init__(accounts=accounts, debug=debug) def applies_to_account(self, account): return self.applies test_auditor_registry = defaultdict(list) auditor_configs = [ { 'type': 'MockAuditor1', 'index': 'index1', 'applies': True }, { 'type': 'MockAuditor2', 'index': 'index2', 'applies': False }, ] for config in auditor_configs: auditor = type( config['type'], (MockAuditor,), { 'applies': config['applies'] } ) app.logger.debug(auditor.__name__) test_auditor_registry[config['index']].append(auditor) class AuditIssueCleanupTestCase(SecurityMonkeyTestCase): def pre_test_setup(self): account_type_result = AccountType.query.filter(AccountType.name == 'AWS').first() if not account_type_result: account_type_result = AccountType(name='AWS') db.session.add(account_type_result) db.session.commit() self.account = Account(identifier="012345678910", name="testing", account_type_id=account_type_result.id) self.technology = Technology(name="iamrole") item = Item(region="us-west-2", name="testrole", arn=ARN_PREFIX + ":iam::012345678910:role/testrole", technology=self.technology, account=self.account) db.session.add(self.account) db.session.add(self.technology) db.session.add(item) db.session.commit() @patch.dict(auditor_registry, test_auditor_registry, clear=True) def test_clean_stale_issues(self): from security_monkey.common.audit_issue_cleanup import clean_stale_issues items = Item.query.all() assert len(items) == 1 item = items[0] item.issues.append(ItemAudit(score=1, issue='Test Issue', auditor_setting=AuditorSettings(disabled=False, technology=self.technology, account=self.account, auditor_class='MockAuditor1'))) item.issues.append(ItemAudit(score=1, issue='Issue with missing auditor', auditor_setting=AuditorSettings(disabled=False, technology=self.technology, account=self.account, auditor_class='MissingAuditor'))) db.session.commit() clean_stale_issues() items = Item.query.all() assert len(items) == 1 item = items[0] assert len(item.issues) == 1 assert item.issues[0].issue == 'Test Issue' @patch.dict(auditor_registry, test_auditor_registry, clear=True) def test_clean_account_issues(self): from security_monkey.common.audit_issue_cleanup import clean_account_issues items = Item.query.all() assert len(items) == 1 item = items[0] item.issues.append(ItemAudit(score=1, issue='Test Issue 1', auditor_setting=AuditorSettings(disabled=False, technology=self.technology, account=self.account, auditor_class='MockAuditor1'))) item.issues.append(ItemAudit(score=1, issue='Test Issue 2', auditor_setting=AuditorSettings(disabled=False, technology=self.technology, account=self.account, auditor_class='MockAuditor2'))) db.session.commit() clean_account_issues(self.account) items = Item.query.all() assert len(items) == 1 item = items[0] assert len(item.issues) == 1 assert item.issues[0].issue == 'Test Issue 1'
{ "content_hash": "f130bf9ea5aac351999e125c5fc56e19", "timestamp": "", "source": "github", "line_count": 133, "max_line_length": 102, "avg_line_length": 38.29323308270677, "alnum_prop": 0.5301394070292559, "repo_name": "stackArmor/security_monkey", "id": "c6b27086f34d72ed4c66de9ef98fc03e259d8db6", "size": "5719", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "security_monkey/tests/core/test_audit_issue_cleanup.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "33462" }, { "name": "Dart", "bytes": "137774" }, { "name": "Dockerfile", "bytes": "3798" }, { "name": "HTML", "bytes": "165572" }, { "name": "JavaScript", "bytes": "984069" }, { "name": "Mako", "bytes": "412" }, { "name": "Python", "bytes": "1682110" }, { "name": "Shell", "bytes": "29978" } ], "symlink_target": "" }
export default function fetchComponentData(store, components, params) { const needs = components.reduce((prev, current) => { if (current && current.fetchData) { prev.push(current.fetchData); } return prev; }, []); const promises = needs.map(need => need(store.state, store.dispatch, params)); return Promise.all(promises); }
{ "content_hash": "91986c7bee9c2cdd227d4f386a5ddaab", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 80, "avg_line_length": 32, "alnum_prop": 0.6761363636363636, "repo_name": "Dattaya/isomorphic-redux-plus", "id": "fd4de4f4b9356e7a66b985b8d8f3e72a6e8d4527", "size": "352", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/shared/lib/fetchComponentData.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "26424" } ], "symlink_target": "" }
from future import standard_library standard_library.install_aliases() import serial, urllib.request, time # mbed super class class mbed(object): def __init__(self): print("This will work as a demo but no transport mechanism has been selected") def rpc(self, name, method, args): print("Superclass method not overridden") # Transport mechanisms, derived from mbed class SerialRPC(mbed): def __init__(self, port, baud): self.ser = serial.Serial(port) self.ser.setBaudrate(baud) def rpc(self, name, method, args): # creates the command to be sent serially - /name/method arg1 arg2 arg3 ... argN str = "/" + name + "/" + method + " " + " ".join(args) + "\n" # prints the command being executed print(str) # writes the command to serial self.ser.write(str) # strips trailing characters from the line just written ret_val = self.ser.readline().strip() return ret_val class HTTPRPC(mbed): def __init__(self, ip): self.host = "http://" + ip def rpc(self, name, method, args): response = urllib.request.urlopen(self.host + "/rpc/" + name + "/" + method + "%20" + "%20".join(args)) return response.read().strip() # generic mbed interface super class class mbed_interface(object): # initialize an mbed interface with a transport mechanism and pin name def __init__(self, this_mbed, mpin): self.mbed = this_mbed if isinstance(mpin, str): self.name = mpin def __del__(self): r = self.mbed.rpc(self.name, "delete", []) def new(self, class_name, name, pin1, pin2 = "", pin3 = ""): args = [arg for arg in [pin1,pin2,pin3,name] if arg != ""] r = self.mbed.rpc(class_name, "new", args) # generic read def read(self): r = self.mbed.rpc(self.name, "read", []) return int(r) # for classes that need write functionality - inherits from the generic reading interface class mbed_interface_write(mbed_interface): def __init__(self, this_mbed, mpin): mbed_interface.__init__(self, this_mbed, mpin) # generic write def write(self, value): r = self.mbed.rpc(self.name, "write", [str(value)]) # mbed interfaces class DigitalOut(mbed_interface_write): def __init__(self, this_mbed, mpin): mbed_interface_write.__init__(self, this_mbed, mpin) class AnalogIn(mbed_interface): def __init__(self, this_mbed, mpin): mbed_interface.__init__(self, this_mbed, mpin) def read_u16(self): r = self.mbed.rpc(self.name, "read_u16", []) return int(r) class AnalogOut(mbed_interface_write): def __init__(self, this_mbed, mpin): mbed_interface_write.__init__(self, this_mbed, mpin) def write_u16(self, value): self.mbed.rpc(self.name, "write_u16", [str(value)]) def read(self): r = self.mbed.rpc(self.name, "read", []) return float(r) class DigitalIn(mbed_interface): def __init__(self, this_mbed, mpin): mbed_interface.__init__(self, this_mbed, mpin) class PwmOut(mbed_interface_write): def __init__(self, this_mbed, mpin): mbed_interface_write.__init__(self, this_mbed, mpin) def read(self): r = self.mbed.rpc(self.name, "read", []) return r def period(self, value): self.mbed.rpc(self.name, "period", [str(value)]) def period_ms(self, value): self.mbed.rpc(self.name, "period_ms", [str(value)]) def period_us(self, value): self.mbed.rpc(self.name, "period_us", [str(value)]) def pulsewidth(self, value): self.mbed.rpc(self.name, "pulsewidth", [str(value)]) def pulsewidth_ms(self, value): self.mbed.rpc(self.name, "pulsewidth_ms", [str(value)]) def pulsewidth_us(self, value): self.mbed.rpc(self.name, "pulsewidth_us", [str(value)]) class RPCFunction(mbed_interface): def __init__(self, this_mbed, name): mbed_interface.__init__(self, this_mbed, name) def run(self, input): r = self.mbed.rpc(self.name, "run", [input]) return r class RPCVariable(mbed_interface_write): def __init__(self, this_mbed, name): mbed_interface_write.__init__(self, this_mbed, name) def read(self): r = self.mbed.rpc(self.name, "read", []) return r class Timer(mbed_interface): def __init__(self, this_mbed, name): mbed_interface.__init__(self, this_mbed, name) def start(self): r = self.mbed.rpc(self.name, "start", []) def stop(self): r = self.mbed.rpc(self.name, "stop", []) def reset(self): r = self.mbed.rpc(self.name, "reset", []) def read(self): r = self.mbed.rpc(self.name, "read", []) return float(re.search('\d+\.*\d*', r).group(0)) def read_ms(self): r = self.mbed.rpc(self.name, "read_ms", []) return float(re.search('\d+\.*\d*', r).group(0)) def read_us(self): r = self.mbed.rpc(self.name, "read_us", []) return float(re.search('\d+\.*\d*', r).group(0)) # Serial class Serial(object): def __init__(self, this_mbed, tx, rx=""): self.mbed = this_mbed if isinstance(tx, str): self.name = tx def __del__(self): r = self.mbed.rpc(self.name, "delete", []) def baud(self, value): r = self.mbed.rpc(self.name, "baud", [str(value)]) def putc(self, value): r = self.mbed.rpc(self.name, "putc", [str(value)]) def puts(self, value): r = self.mbed.rpc(self.name, "puts", ["\"" + str(value) + "\""]) def getc(self): r = self.mbed.rpc(self.name, "getc", []) return int(r) def wait(s): time.sleep(s)
{ "content_hash": "85fba395611d1966f160675f448f7deb", "timestamp": "", "source": "github", "line_count": 198, "max_line_length": 111, "avg_line_length": 28.98989898989899, "alnum_prop": 0.5867595818815331, "repo_name": "andcor02/mbed-os", "id": "efafce39cec6c7596ca894df591e845c8232c1ef", "size": "7153", "binary": false, "copies": "11", "ref": "refs/heads/master", "path": "tools/host_tests/mbedrpc.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "6601399" }, { "name": "Batchfile", "bytes": "22" }, { "name": "C", "bytes": "295194591" }, { "name": "C++", "bytes": "9038670" }, { "name": "CMake", "bytes": "5285" }, { "name": "HTML", "bytes": "2063156" }, { "name": "Makefile", "bytes": "103497" }, { "name": "Objective-C", "bytes": "460244" }, { "name": "Perl", "bytes": "2589" }, { "name": "Python", "bytes": "38809" }, { "name": "Shell", "bytes": "16862" }, { "name": "XSLT", "bytes": "5596" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>mathcomp-solvable: 8 m 39 s 🏆</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.8.0 / mathcomp-solvable - 1.10.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> mathcomp-solvable <small> 1.10.0 <span class="label label-success">8 m 39 s 🏆</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-02-19 02:36:57 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-02-19 02:36:57 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base camlp5 7.14 Preprocessor-pretty-printer of OCaml conf-findutils 1 Virtual package relying on findutils conf-perl 2 Virtual package relying on perl coq 8.8.0 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.09.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.09.1 Official release 4.09.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.3 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Mathematical Components &lt;mathcomp-dev@sympa.inria.fr&gt;&quot; homepage: &quot;https://math-comp.github.io/&quot; bug-reports: &quot;https://github.com/math-comp/math-comp/issues&quot; dev-repo: &quot;git+https://github.com/math-comp/math-comp.git&quot; license: &quot;CeCILL-B&quot; build: [ make &quot;-C&quot; &quot;mathcomp/solvable&quot; &quot;-j&quot; &quot;%{jobs}%&quot; ] install: [ make &quot;-C&quot; &quot;mathcomp/solvable&quot; &quot;install&quot; ] depends: [ &quot;coq-mathcomp-algebra&quot; { = version } ] tags: [ &quot;keyword:finite groups&quot; &quot;keyword:Feit Thompson theorem&quot; &quot;keyword:small scale reflection&quot; &quot;keyword:mathematical components&quot; &quot;keyword:odd order theorem&quot; &quot;logpath:mathcomp.solvable&quot; ] authors: [ &quot;Jeremy Avigad &lt;&gt;&quot; &quot;Andrea Asperti &lt;&gt;&quot; &quot;Stephane Le Roux &lt;&gt;&quot; &quot;Yves Bertot &lt;&gt;&quot; &quot;Laurence Rideau &lt;&gt;&quot; &quot;Enrico Tassi &lt;&gt;&quot; &quot;Ioana Pasca &lt;&gt;&quot; &quot;Georges Gonthier &lt;&gt;&quot; &quot;Sidi Ould Biha &lt;&gt;&quot; &quot;Cyril Cohen &lt;&gt;&quot; &quot;Francois Garillot &lt;&gt;&quot; &quot;Alexey Solovyev &lt;&gt;&quot; &quot;Russell O&#39;Connor &lt;&gt;&quot; &quot;Laurent Théry &lt;&gt;&quot; &quot;Assia Mahboubi &lt;&gt;&quot; ] synopsis: &quot;Mathematical Components Library on finite groups (II)&quot; description:&quot;&quot;&quot; This library contains more definitions and theorems about finite groups. &quot;&quot;&quot; url { src: &quot;http://github.com/math-comp/math-comp/archive/mathcomp-1.10.0.tar.gz&quot; checksum: &quot;sha256=3f8a88417f3456da05e2755ea0510c1bd3fd13b13c41e62fbaa3de06be040166&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-mathcomp-solvable.1.10.0 coq.8.8.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-mathcomp-solvable.1.10.0 coq.8.8.0</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>12 m 14 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-mathcomp-solvable.1.10.0 coq.8.8.0</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>8 m 39 s</dd> </dl> <h2>Installation size</h2> <p>Total: 17 M</p> <ul> <li>2 M <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/extremal.vo</code></li> <li>1 M <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/extremal.glob</code></li> <li>1 M <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/burnside_app.vo</code></li> <li>952 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/abelian.vo</code></li> <li>891 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/maximal.vo</code></li> <li>774 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/abelian.glob</code></li> <li>736 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/burnside_app.glob</code></li> <li>664 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/maximal.glob</code></li> <li>532 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/extraspecial.vo</code></li> <li>455 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/hall.vo</code></li> <li>451 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/pgroup.glob</code></li> <li>391 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/center.vo</code></li> <li>379 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/hall.glob</code></li> <li>372 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/frobenius.vo</code></li> <li>364 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/pgroup.vo</code></li> <li>344 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/extraspecial.glob</code></li> <li>312 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/finmodule.vo</code></li> <li>308 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/cyclic.vo</code></li> <li>299 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/alt.vo</code></li> <li>293 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/sylow.vo</code></li> <li>284 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/frobenius.glob</code></li> <li>283 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/cyclic.glob</code></li> <li>267 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/nilpotent.glob</code></li> <li>257 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/nilpotent.vo</code></li> <li>254 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/jordanholder.vo</code></li> <li>248 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/sylow.glob</code></li> <li>239 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/finmodule.glob</code></li> <li>222 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/gseries.vo</code></li> <li>205 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/center.glob</code></li> <li>200 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/primitive_action.vo</code></li> <li>194 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/jordanholder.glob</code></li> <li>186 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/alt.glob</code></li> <li>159 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/commutator.glob</code></li> <li>141 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/commutator.vo</code></li> <li>131 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/gseries.glob</code></li> <li>128 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/gfunctor.vo</code></li> <li>120 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/extremal.v</code></li> <li>109 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/primitive_action.glob</code></li> <li>88 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/gfunctor.glob</code></li> <li>88 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/abelian.v</code></li> <li>73 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/maximal.v</code></li> <li>50 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/pgroup.v</code></li> <li>47 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/burnside_app.v</code></li> <li>41 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/hall.v</code></li> <li>41 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/extraspecial.v</code></li> <li>35 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/all_solvable.vo</code></li> <li>35 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/frobenius.v</code></li> <li>33 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/cyclic.v</code></li> <li>29 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/jordanholder.v</code></li> <li>28 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/nilpotent.v</code></li> <li>27 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/sylow.v</code></li> <li>27 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/finmodule.v</code></li> <li>24 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/center.v</code></li> <li>23 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/alt.v</code></li> <li>20 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/gseries.v</code></li> <li>20 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/gfunctor.v</code></li> <li>15 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/primitive_action.v</code></li> <li>13 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/commutator.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/all_solvable.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/mathcomp/solvable/all_solvable.v</code></li> </ul> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq-mathcomp-solvable.1.10.0</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "06d2a8045cb8a7c3f03fea70e27db222", "timestamp": "", "source": "github", "line_count": 214, "max_line_length": 554, "avg_line_length": 68.80373831775701, "alnum_prop": 0.6024857375713122, "repo_name": "coq-bench/coq-bench.github.io", "id": "bc5164169309f57a9fb04ea5ea3c2290666b4a5d", "size": "14750", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.09.1-2.0.6/released/8.8.0/mathcomp-solvable/1.10.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
'use strict'; /** * @ngdoc overview * @name aiselApp * @description * * E2E Search test */ describe("E2E: We check that our app is feeling nice", function() { console.log('Test loaded: Search'); it('should have a title', function() { browser.get('http://aisel.dev/en/search/mockup'); expect(browser.getTitle()).toEqual('Aisel - open source project'); }); });
{ "content_hash": "20c938e5f1f0ccc00980c288f8dc0dd3", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 74, "avg_line_length": 22, "alnum_prop": 0.6186868686868687, "repo_name": "kamilkisiela/Aisel", "id": "7c12ba4dc2146536f9b067ff8b9c1d60a27fffaa", "size": "396", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "frontend/protractor/modules/search.js", "mode": "33261", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "600" }, { "name": "CSS", "bytes": "16382" }, { "name": "HTML", "bytes": "139777" }, { "name": "JavaScript", "bytes": "192240" }, { "name": "PHP", "bytes": "491082" }, { "name": "Shell", "bytes": "225" } ], "symlink_target": "" }
ACCEPTED #### According to World Register of Marine Species #### Published in null #### Original name null ### Remarks null
{ "content_hash": "c5be158e22ff0b6704fb5e12a3007735", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 32, "avg_line_length": 9.76923076923077, "alnum_prop": 0.7007874015748031, "repo_name": "mdoering/backbone", "id": "7d451d9c9a2cd6be3cb51e29394cf7e0043debf0", "size": "180", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Protozoa/Granuloreticulosea/Foraminiferida/Cassidulinidae/Lernella/Lernella crispa/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
function statusChangeCallback(response) { console.log('statusChangeCallback'); console.log(response); // The response object is returned with a status field that lets the // app know the current login status of the person. // Full docs on the response object can be found in the documentation // for FB.getLoginStatus(). if (response.status === 'connected') { // Logged into your app and Facebook. //testAPI(); console.log('Connected to facebook'); window.postMessage('fbLoginCompleted', window.location.href); } else if (response.status === 'not_authorized') { // The person is logged into Facebook, but not your app. document.getElementById('status').innerHTML = 'Please log ' + 'into this app.'; } else { // The person is not logged into Facebook, so we're not sure if // they are logged into this app or not. document.getElementById('status').innerHTML = 'Please log ' + 'into Facebook.'; } } // This function is called when someone finishes with the Login // Button. See the onlogin handler attached to it in the sample // code below. window.addEventListener = window.addEventListener?window.addEventListener:attachEvent function checkLoginState() { FB.getLoginStatus(function(response) { statusChangeCallback(response); }); } window.fbAsyncInit = function() { FB.init({ appId: '721619241271066', cookie: true, xfbml: true, version: 'v2.5' }); FB.getLoginStatus(checkLoginState); window.postMessage('fbInitCompleted', window.location.href); }; (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id))return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));
{ "content_hash": "a6a3fbc16cab85427465876bfa5162b3", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 85, "avg_line_length": 33.81481481481482, "alnum_prop": 0.6960569550930996, "repo_name": "reliable-report/facebook-report", "id": "0535a1f8a5729c82fb6557f03e607a0278fc8c93", "size": "1892", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "public/js/facebook-auth.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "110" }, { "name": "HTML", "bytes": "15998" }, { "name": "JavaScript", "bytes": "75216" }, { "name": "Shell", "bytes": "7864" } ], "symlink_target": "" }
module ActiveAny::Associations module ForeignAssociation def foreign_key_present? if reflection.klass.primary_key owner.attribute_present?(reflection.record_class_primary_key) else false end end end end
{ "content_hash": "1d51bcf3f46e25f204c67550e98ba1f1", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 69, "avg_line_length": 22.636363636363637, "alnum_prop": 0.6867469879518072, "repo_name": "yuemori/active_any", "id": "0632e245eed25bd1ad9b75c9aeb59c8cd0c5db2d", "size": "280", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/active_any/associations/foreign_association.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "62736" }, { "name": "Shell", "bytes": "131" } ], "symlink_target": "" }
FROM balenalib/jetson-xavier-nx-devkit-debian:buster-run ENV NODE_VERSION 15.14.0 ENV YARN_VERSION 1.22.4 RUN buildDeps='curl libatomic1' \ && set -x \ && for key in \ 6A010C5166006599AA17F08146C2130DFD2497F5 \ ; do \ gpg --batch --keyserver pgp.mit.edu --recv-keys "$key" || \ gpg --batch --keyserver keyserver.pgp.com --recv-keys "$key" || \ gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \ done \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends \ && rm -rf /var/lib/apt/lists/* \ && curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-arm64.tar.gz" \ && echo "6d5e0074fe4a45d444bc581aa1fd7ce7081b8491b0f785414a6e5cc30c42854a node-v$NODE_VERSION-linux-arm64.tar.gz" | sha256sum -c - \ && tar -xzf "node-v$NODE_VERSION-linux-arm64.tar.gz" -C /usr/local --strip-components=1 \ && rm "node-v$NODE_VERSION-linux-arm64.tar.gz" \ && curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \ && curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \ && gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ && mkdir -p /opt/yarn \ && tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn --strip-components=1 \ && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \ && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg \ && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ && npm config set unsafe-perm true -g --unsafe-perm \ && rm -rf /tmp/* CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@node.sh" \ && echo "Running test-stack@node" \ && chmod +x test-stack@node.sh \ && bash test-stack@node.sh \ && rm -rf test-stack@node.sh RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v8 \nOS: Debian Buster \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nNode.js v15.14.0, Yarn v1.22.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
{ "content_hash": "ee2694a360e7a44eb772b06423fb9230", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 692, "avg_line_length": 65.11111111111111, "alnum_prop": 0.7044368600682593, "repo_name": "nghiant2710/base-images", "id": "66a277893e545ab833522dfa78a147b72d073cf9", "size": "2951", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "balena-base-images/node/jetson-xavier-nx-devkit/debian/buster/15.14.0/run/Dockerfile", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "144558581" }, { "name": "JavaScript", "bytes": "16316" }, { "name": "Shell", "bytes": "368690" } ], "symlink_target": "" }
<?php namespace api\modules\v3\controllers; use Yii; use yii\rest\ActiveController; use yii\data\ActiveDataProvider; use yii\web\NotFoundHttpException; use yii\helpers\Response; class HeartStoryController extends ActiveController { public $modelClass = 'api\modules\v3\models\HeartStory'; public $serializer = [ 'class' => 'yii\rest\Serializer', 'collectionEnvelope' => 'items', ]; public function behaviors() { $behaviors = parent::behaviors(); return $behaviors; } public function actions() { $actions = parent::actions(); // 注销系统自带的实现方法 unset($actions['index'], $actions['update'], $actions['create'], $actions['delete'], $actions['view']); return $actions; } public function actionIndex() { $modelClass = $this->modelClass; $query = $modelClass::find()->where(['status'=>1])->orderBy('created_at desc'); return new ActiveDataProvider([ 'query' => $query, ]); } public function actionView($id) { $query = $this->findModel($id); return $query; } public function actionCreate() { /* $model = new $this->modelClass(); $model->load(Yii::$app->getRequest()->getBodyParams(), ''); if (!$model->save()) { return array_values($model->getFirstErrors())[0]; } $model->PostCuntPlus();*/ Response::show(402,'不允许的操作'); } public function actionUpdate($id) { /* $model = $this->findModel($id); $model->load(Yii::$app->getRequest()->getBodyParams(), ''); if (!$model->save()) { return array_values($model->getFirstErrors())[0]; }*/ Response::show(402,'不允许的操作'); } public function actionDelete($id) { /* $model = new $this->modelClass(); $thread_id = $_GET['thread_id']; if($this->findModel($id)->delete()){ $model->PostCuntDel($thread_id); Response::show('202','删除成功'); }*/ Response::show(402,'不允许的操作'); } protected function findModel($id) { $modelClass = $this->modelClass; if (($model = $modelClass::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } } }
{ "content_hash": "4dee3a88e08e97237613d54e385b68f0", "timestamp": "", "source": "github", "line_count": 102, "max_line_length": 111, "avg_line_length": 23.715686274509803, "alnum_prop": 0.5473336089293096, "repo_name": "tqlovemm/api", "id": "beb56965700459f50be29b577ced15076c8119a2", "size": "2485", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "api/modules/v3/controllers/HeartStoryController.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "269" }, { "name": "Batchfile", "bytes": "5176" }, { "name": "CSS", "bytes": "3981" }, { "name": "PHP", "bytes": "275382" } ], "symlink_target": "" }
package com.coredump.hc.android; import android.os.Bundle; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.coredump.hc.HCGame; public class AndroidLauncher extends AndroidApplication { @Override protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); initialize(new HCGame(), config); } }
{ "content_hash": "d9d1e360f957ee9f45c03824b3f42177", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 81, "avg_line_length": 32.0625, "alnum_prop": 0.8245614035087719, "repo_name": "m-bishop/HC", "id": "d041b25df56121d06bd12898829b5f4651fe8005", "size": "513", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "android/src/com/coredump/hc/android/AndroidLauncher.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1069" }, { "name": "HTML", "bytes": "1515" }, { "name": "Java", "bytes": "97412" }, { "name": "JavaScript", "bytes": "24" } ], "symlink_target": "" }
<?php /************************************************************************************************************************* ************************************************************************************************************************** ************************************************************************************************************************** WARNING!!! - THIS FILE SHOULD NOT BE EDITED - IT WILL BE AUTOGENERATED EACH TIME THE MODELS ARE BUILT! ************************************************************************************************************************** ************************************************************************************************************************** *************************************************************************************************************************/ namespace project\db\om\{{ database }}\map; /** * Map class * * Map * * @author Christopher Beck <cwbeck@gmail.com> * @version SVN: $id * @package {{ database }} * @subpackage templates */ class Map { {{ classBody }} public static function getModelNameFromTableName($tableName){ return isset(self::$tableNameToModelName[$tableName])? self::$tableNameToModelName[$tableName] : null; } public static function getTableNameFromModelName($modelName){ return isset(self::$modelNameToTableName[$modelName])? self::$modelNameToTableName[$modelName] : null; } }
{ "content_hash": "9102f6f8a39a30d478e635bf8a616232", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 122, "avg_line_length": 44.5, "alnum_prop": 0.34480337078651685, "repo_name": "mjmartin/adm", "id": "6753b12e3fe3a0a2364608551eccf5e3657e2b94", "size": "1424", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "project/cli/generate/views/newMap.php", "mode": "33261", "license": "mit", "language": [ { "name": "C", "bytes": "28831" }, { "name": "JavaScript", "bytes": "128539" }, { "name": "PHP", "bytes": "3868327" }, { "name": "Perl", "bytes": "81495" }, { "name": "Racket", "bytes": "16840" }, { "name": "Ruby", "bytes": "328" }, { "name": "Shell", "bytes": "12" } ], "symlink_target": "" }
<LINK REL="stylesheet" HREF="../static/styles.css"> <HTML> <HEAD> <TITLE>Studio::System::setAdvancedSettings</TITLE> </HEAD> <BODY TOPMARGIN="0" class="api_reference"> <p class="header">Firelight Technologies FMOD Studio API</p> <H1>Studio::System::setAdvancedSettings</H1> <P> <p>Sets advanced features like configuring memory and cpu usage.</p> </P> <h3>C++ Syntax</h3> <PRE class=syntax><CODE>FMOD_RESULT Studio::System::setAdvancedSettings( FMOD_STUDIO_ADVANCEDSETTINGS *<I>settings</I> ); </CODE></PRE> <h3>C Syntax</h3> <PRE class=syntax><CODE>FMOD_RESULT FMOD_Studio_System_SetAdvancedSettings( FMOD_STUDIO_SYSTEM *<I>system</I>, FMOD_STUDIO_ADVANCEDSETTINGS *<I>settings</I> ); </CODE></PRE> <h3>C# Syntax</h3> <PRE class=syntax><CODE>RESULT Studio.System.setAdvancedSettings( ADVANCEDSETTINGS <i>settings</i> ); </CODE></PRE> <h2>Parameters</h2> <dl> <dt>settings</dt> <dd>Pointer to <A HREF="FMOD_STUDIO_ADVANCEDSETTINGS.html">FMOD_STUDIO_ADVANCEDSETTINGS</A> structure.</dd> </dl> <h2>Return Values</h2><P> If the function succeeds then the return value is <A HREF="FMOD_RESULT.html">FMOD_OK</A>.<BR> If the function fails then the return value will be one of the values defined in the <A HREF="FMOD_RESULT.html">FMOD_RESULT</A> enumeration.<BR> </P> <h2>Remarks</h2><P> <p>This function should be called before Studio initialization. The cbSize field must be set to sizeof(<A HREF="FMOD_STUDIO_ADVANCEDSETTINGS.html">FMOD_STUDIO_ADVANCEDSETTINGS</A>) before calling this function.</p> </P> <h2>See Also</h2> <UL type=disc> <LI><A HREF="FMOD_STUDIO_ADVANCEDSETTINGS.html">FMOD_STUDIO_ADVANCEDSETTINGS</A></LI> <LI><A HREF="FMOD_Studio_System_GetAdvancedSettings.html">Studio::System::getAdvancedSettings</A></LI> <LI><A HREF="FMOD_Studio_System_Initialize.html">Studio::System::initialize</A></LI> </UL> <BR><BR><BR> <P align=center><font size=-2>Version 1.08.02 Built on Apr 14, 2016</font></P> <BR> </HTML>
{ "content_hash": "b12dc2e5ac5a70da7fc10c36ee70d26f", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 150, "avg_line_length": 38.56, "alnum_prop": 0.7287344398340249, "repo_name": "Silveryard/Car_System", "id": "1f9c691f75d6071539cd04c6940fccd8d123fdf7", "size": "1928", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Old/3rdParty/fmodstudioapi10802linux/doc/FMOD Studio Programmers API for Linux/content/generated/FMOD_Studio_System_SetAdvancedSettings.html", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1067" }, { "name": "C", "bytes": "50059951" }, { "name": "C#", "bytes": "62366" }, { "name": "C++", "bytes": "48819993" }, { "name": "CMake", "bytes": "94005" }, { "name": "CSS", "bytes": "8053" }, { "name": "FORTRAN", "bytes": "109708" }, { "name": "HTML", "bytes": "2447714" }, { "name": "JavaScript", "bytes": "5283" }, { "name": "Logos", "bytes": "214154" }, { "name": "Objective-C", "bytes": "2032834" }, { "name": "Protocol Buffer", "bytes": "28889" }, { "name": "Shell", "bytes": "670" } ], "symlink_target": "" }
package com.zuppelli.living.docs; import com.sun.javadoc.LanguageVersion; import com.sun.javadoc.RootDoc; import com.sun.tools.doclets.formats.html.HtmlDoclet; import com.thoughtworks.qdox.JavaProjectBuilder; import com.thoughtworks.qdox.model.*; import com.zuppelli.living.docs.render.JClass; import com.zuppelli.living.docs.render.JDerived; import com.zuppelli.living.docs.render.JMethod; import freemarker.template.Configuration; import freemarker.template.Template; import freemarker.template.TemplateException; import freemarker.template.TemplateExceptionHandler; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.util.*; /** * Doclet que genera una pagina usando la libreria qox. */ public class AnnotationHTMLDoclet { private final PrintWriter writer; private final Template template; private final Map<String, Object> root; public static int optionLength( String option ) { return HtmlDoclet.optionLength( option ); } public static LanguageVersion languageVersion() { return LanguageVersion.JAVA_1_5; } public AnnotationHTMLDoclet( PrintWriter writer ) { root = new HashMap<>( ); try { final Configuration configuration = new Configuration( Configuration.VERSION_2_3_21 ); configuration.setClassForTemplateLoading( this.getClass(), "/templates" ); configuration.setDefaultEncoding( "UTF-8" ); configuration.setTemplateExceptionHandler( TemplateExceptionHandler.RETHROW_HANDLER ); template = configuration.getTemplate( "glossario.ftl" ); this.writer = writer; } catch ( IOException ex ) { throw new RuntimeException( String.format( "Error initializing freemarker context: %s", ex.getMessage() ) ); } } public AnnotationHTMLDoclet begin() { return this; } public void end() { try { template.process( root, writer ); } catch ( TemplateException | IOException ex ) { System.out.println( "Error tratando de escribir con el template" ); } finally { writer.close(); } } public static boolean start( RootDoc root ) { String sourcepath = ""; for ( String[] tag : root.options() ) { if ( tag[0].equals( "-sourcepath" ) ) { sourcepath = tag[1]; break; } } AnnotationHTMLDoclet doclet = null; try { doclet = new AnnotationHTMLDoclet( new PrintWriter( "glossary.html" ) ).begin(); JavaProjectBuilder builder = new JavaProjectBuilder(); // Adding all .java files in a source tree (recursively). builder.addSourceTree( new File( sourcepath ) ); doclet.process( builder.getPackages() ); } catch ( FileNotFoundException e ) { //... } finally { if ( null != doclet ) { doclet.end(); } } return true; } public Map<String, Object> process( Collection<JavaPackage> packages ) { List<JClass> classes = new ArrayList<JClass>( ); for ( JavaPackage pckge : packages ) { for ( JavaClass clss : pckge.getClasses() ) { if ( isBusinessMeaningful( clss.getAnnotations() ) ) { classes.add( process( clss ) ); } } } root.put( "classes", classes ); return root; } public JClass process( JavaClass clss ) { JClass current = new JClass(); current.setName( clss.getName() ); current.setComment( clss.getComment() ); for ( JavaAnnotation annotation : clss.getAnnotations() ) { try { Class clzz = Class.forName( annotation.getType().getFullyQualifiedName() ); if (clzz.equals( Deprecated.class ) ) { current.setDeprecated( true ); break; } } catch ( Exception ex ) { // ignore error on class load. } } if ( clss.isEnum() ) { for ( JavaField field : clss.getEnumConstants() ) { printEnumConstant( field ); } for ( JavaMethod method : clss.getMethods( false ) ) { current.addMethod( printMethod( method ) ); } } else if ( clss.isInterface() ) { for ( JavaClass subClass : clss.getDerivedClasses() ) { current.addDerived( printSubClass( subClass ) ); } } else { for ( JavaField field : clss.getFields() ) { printField( field ); } for ( JavaMethod method : clss.getMethods( false ) ) { current.addMethod( printMethod( method ) ); } } return current; } protected boolean isBusinessMeaningful( List<JavaAnnotation> annotations ) { for ( JavaAnnotation annotation : annotations ) { if ( isBusinessMeaningful( annotation.getType() ) ) { return true; } } return false; } boolean isBusinessMeaningful( final JavaClass annotationClass ) { return annotationClass.getClassNamePrefix().contains( "livingdocs" ); } private void printField( JavaField field ) { } private JDerived printSubClass( JavaClass clss ) { return new JDerived( clss.getName(), clss.getComment() ); } private void printEnumConstant( JavaField field ) { } private JMethod printMethod( JavaMethod m ) { if ( !m.isPublic() || !hasComment( m ) ) { return null; } return new JMethod( m.getCallSignature() + ": " + m.getReturnType().getCanonicalName(), m.getComment() ); } private boolean hasComment( JavaAnnotatedElement doc ) { return null != doc.getComment() && doc.getComment().trim().length() > 0; } }
{ "content_hash": "bd9323f2003f0d4043ea103bcd9fbae0", "timestamp": "", "source": "github", "line_count": 226, "max_line_length": 120, "avg_line_length": 28.24778761061947, "alnum_prop": 0.5604636591478697, "repo_name": "aoxa/cake-world", "id": "611e9020ee8149af85569890d7a333384b6a0738", "size": "6384", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "glossary-maven-plugin/src/main/java/com/zuppelli/living/docs/AnnotationHTMLDoclet.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2284" }, { "name": "Cucumber", "bytes": "8313" }, { "name": "FreeMarker", "bytes": "4248" }, { "name": "HTML", "bytes": "2945" }, { "name": "Java", "bytes": "150254" }, { "name": "JavaScript", "bytes": "55123" } ], "symlink_target": "" }
Provide the SCM root -relative path to the Faux Pas configuration file to use.
{ "content_hash": "4f23f8574d883ff2842277cb1d5b1eda", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 78, "avg_line_length": 79, "alnum_prop": 0.7974683544303798, "repo_name": "FauxPasApp/fauxpas-jenkins-plugin", "id": "4c3a3dfa488585417517d0e2fff6040abeef1733", "size": "79", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/resources/jenkins/plugins/fauxpasapp/FauxPasBuilder/help-configFilePath.html", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "43124" }, { "name": "Shell", "bytes": "489" } ], "symlink_target": "" }
using pb = global::Google.Protobuf; using pbc = global::Google.Protobuf.Collections; using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace POGOProtos.Networking.Responses { /// <summary>Holder for reflection information generated from POGOProtos/Networking/Responses/FortSearchResponse.proto</summary> public static partial class FortSearchResponseReflection { #region Descriptor /// <summary>File descriptor for POGOProtos/Networking/Responses/FortSearchResponse.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; static FortSearchResponseReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CjhQT0dPUHJvdG9zL05ldHdvcmtpbmcvUmVzcG9uc2VzL0ZvcnRTZWFyY2hS", "ZXNwb25zZS5wcm90bxIfUE9HT1Byb3Rvcy5OZXR3b3JraW5nLlJlc3BvbnNl", "cxohUE9HT1Byb3Rvcy9EYXRhL1Bva2Vtb25EYXRhLnByb3RvGilQT0dPUHJv", "dG9zL0ludmVudG9yeS9JdGVtL0l0ZW1Bd2FyZC5wcm90byLWAwoSRm9ydFNl", "YXJjaFJlc3BvbnNlEkoKBnJlc3VsdBgBIAEoDjI6LlBPR09Qcm90b3MuTmV0", "d29ya2luZy5SZXNwb25zZXMuRm9ydFNlYXJjaFJlc3BvbnNlLlJlc3VsdBI7", "Cg1pdGVtc19hd2FyZGVkGAIgAygLMiQuUE9HT1Byb3Rvcy5JbnZlbnRvcnku", "SXRlbS5JdGVtQXdhcmQSFAoMZ2Vtc19hd2FyZGVkGAMgASgFEjYKEHBva2Vt", "b25fZGF0YV9lZ2cYBCABKAsyHC5QT0dPUHJvdG9zLkRhdGEuUG9rZW1vbkRh", "dGESGgoSZXhwZXJpZW5jZV9hd2FyZGVkGAUgASgFEiYKHmNvb2xkb3duX2Nv", "bXBsZXRlX3RpbWVzdGFtcF9tcxgGIAEoAxIiChpjaGFpbl9oYWNrX3NlcXVl", "bmNlX251bWJlchgHIAEoBSKAAQoGUmVzdWx0EhEKDU5PX1JFU1VMVF9TRVQQ", "ABILCgdTVUNDRVNTEAESEAoMT1VUX09GX1JBTkdFEAISFgoSSU5fQ09PTERP", "V05fUEVSSU9EEAMSEgoOSU5WRU5UT1JZX0ZVTEwQBBIYChRFWENFRURFRF9E", "QUlMWV9MSU1JVBAFYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::POGOProtos.Data.PokemonDataReflection.Descriptor, global::POGOProtos.Inventory.Item.ItemAwardReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::POGOProtos.Networking.Responses.FortSearchResponse), global::POGOProtos.Networking.Responses.FortSearchResponse.Parser, new[]{ "Result", "ItemsAwarded", "GemsAwarded", "PokemonDataEgg", "ExperienceAwarded", "CooldownCompleteTimestampMs", "ChainHackSequenceNumber" }, null, new[]{ typeof(global::POGOProtos.Networking.Responses.FortSearchResponse.Types.Result) }, null) })); } #endregion } #region Messages public sealed partial class FortSearchResponse : pb::IMessage<FortSearchResponse> { private static readonly pb::MessageParser<FortSearchResponse> _parser = new pb::MessageParser<FortSearchResponse>(() => new FortSearchResponse()); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<FortSearchResponse> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::POGOProtos.Networking.Responses.FortSearchResponseReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FortSearchResponse() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FortSearchResponse(FortSearchResponse other) : this() { result_ = other.result_; itemsAwarded_ = other.itemsAwarded_.Clone(); gemsAwarded_ = other.gemsAwarded_; PokemonDataEgg = other.pokemonDataEgg_ != null ? other.PokemonDataEgg.Clone() : null; experienceAwarded_ = other.experienceAwarded_; cooldownCompleteTimestampMs_ = other.cooldownCompleteTimestampMs_; chainHackSequenceNumber_ = other.chainHackSequenceNumber_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FortSearchResponse Clone() { return new FortSearchResponse(this); } /// <summary>Field number for the "result" field.</summary> public const int ResultFieldNumber = 1; private global::POGOProtos.Networking.Responses.FortSearchResponse.Types.Result result_ = 0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::POGOProtos.Networking.Responses.FortSearchResponse.Types.Result Result { get { return result_; } set { result_ = value; } } /// <summary>Field number for the "items_awarded" field.</summary> public const int ItemsAwardedFieldNumber = 2; private static readonly pb::FieldCodec<global::POGOProtos.Inventory.Item.ItemAward> _repeated_itemsAwarded_codec = pb::FieldCodec.ForMessage(18, global::POGOProtos.Inventory.Item.ItemAward.Parser); private readonly pbc::RepeatedField<global::POGOProtos.Inventory.Item.ItemAward> itemsAwarded_ = new pbc::RepeatedField<global::POGOProtos.Inventory.Item.ItemAward>(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::POGOProtos.Inventory.Item.ItemAward> ItemsAwarded { get { return itemsAwarded_; } } /// <summary>Field number for the "gems_awarded" field.</summary> public const int GemsAwardedFieldNumber = 3; private int gemsAwarded_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int GemsAwarded { get { return gemsAwarded_; } set { gemsAwarded_ = value; } } /// <summary>Field number for the "pokemon_data_egg" field.</summary> public const int PokemonDataEggFieldNumber = 4; private global::POGOProtos.Data.PokemonData pokemonDataEgg_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::POGOProtos.Data.PokemonData PokemonDataEgg { get { return pokemonDataEgg_; } set { pokemonDataEgg_ = value; } } /// <summary>Field number for the "experience_awarded" field.</summary> public const int ExperienceAwardedFieldNumber = 5; private int experienceAwarded_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int ExperienceAwarded { get { return experienceAwarded_; } set { experienceAwarded_ = value; } } /// <summary>Field number for the "cooldown_complete_timestamp_ms" field.</summary> public const int CooldownCompleteTimestampMsFieldNumber = 6; private long cooldownCompleteTimestampMs_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long CooldownCompleteTimestampMs { get { return cooldownCompleteTimestampMs_; } set { cooldownCompleteTimestampMs_ = value; } } /// <summary>Field number for the "chain_hack_sequence_number" field.</summary> public const int ChainHackSequenceNumberFieldNumber = 7; private int chainHackSequenceNumber_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int ChainHackSequenceNumber { get { return chainHackSequenceNumber_; } set { chainHackSequenceNumber_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as FortSearchResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(FortSearchResponse other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (Result != other.Result) return false; if(!itemsAwarded_.Equals(other.itemsAwarded_)) return false; if (GemsAwarded != other.GemsAwarded) return false; if (!object.Equals(PokemonDataEgg, other.PokemonDataEgg)) return false; if (ExperienceAwarded != other.ExperienceAwarded) return false; if (CooldownCompleteTimestampMs != other.CooldownCompleteTimestampMs) return false; if (ChainHackSequenceNumber != other.ChainHackSequenceNumber) return false; return true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Result != 0) hash ^= Result.GetHashCode(); hash ^= itemsAwarded_.GetHashCode(); if (GemsAwarded != 0) hash ^= GemsAwarded.GetHashCode(); if (pokemonDataEgg_ != null) hash ^= PokemonDataEgg.GetHashCode(); if (ExperienceAwarded != 0) hash ^= ExperienceAwarded.GetHashCode(); if (CooldownCompleteTimestampMs != 0L) hash ^= CooldownCompleteTimestampMs.GetHashCode(); if (ChainHackSequenceNumber != 0) hash ^= ChainHackSequenceNumber.GetHashCode(); return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Result != 0) { output.WriteRawTag(8); output.WriteEnum((int) Result); } itemsAwarded_.WriteTo(output, _repeated_itemsAwarded_codec); if (GemsAwarded != 0) { output.WriteRawTag(24); output.WriteInt32(GemsAwarded); } if (pokemonDataEgg_ != null) { output.WriteRawTag(34); output.WriteMessage(PokemonDataEgg); } if (ExperienceAwarded != 0) { output.WriteRawTag(40); output.WriteInt32(ExperienceAwarded); } if (CooldownCompleteTimestampMs != 0L) { output.WriteRawTag(48); output.WriteInt64(CooldownCompleteTimestampMs); } if (ChainHackSequenceNumber != 0) { output.WriteRawTag(56); output.WriteInt32(ChainHackSequenceNumber); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Result != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Result); } size += itemsAwarded_.CalculateSize(_repeated_itemsAwarded_codec); if (GemsAwarded != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(GemsAwarded); } if (pokemonDataEgg_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(PokemonDataEgg); } if (ExperienceAwarded != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(ExperienceAwarded); } if (CooldownCompleteTimestampMs != 0L) { size += 1 + pb::CodedOutputStream.ComputeInt64Size(CooldownCompleteTimestampMs); } if (ChainHackSequenceNumber != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(ChainHackSequenceNumber); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(FortSearchResponse other) { if (other == null) { return; } if (other.Result != 0) { Result = other.Result; } itemsAwarded_.Add(other.itemsAwarded_); if (other.GemsAwarded != 0) { GemsAwarded = other.GemsAwarded; } if (other.pokemonDataEgg_ != null) { if (pokemonDataEgg_ == null) { pokemonDataEgg_ = new global::POGOProtos.Data.PokemonData(); } PokemonDataEgg.MergeFrom(other.PokemonDataEgg); } if (other.ExperienceAwarded != 0) { ExperienceAwarded = other.ExperienceAwarded; } if (other.CooldownCompleteTimestampMs != 0L) { CooldownCompleteTimestampMs = other.CooldownCompleteTimestampMs; } if (other.ChainHackSequenceNumber != 0) { ChainHackSequenceNumber = other.ChainHackSequenceNumber; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: input.SkipLastField(); break; case 8: { result_ = (global::POGOProtos.Networking.Responses.FortSearchResponse.Types.Result) input.ReadEnum(); break; } case 18: { itemsAwarded_.AddEntriesFrom(input, _repeated_itemsAwarded_codec); break; } case 24: { GemsAwarded = input.ReadInt32(); break; } case 34: { if (pokemonDataEgg_ == null) { pokemonDataEgg_ = new global::POGOProtos.Data.PokemonData(); } input.ReadMessage(pokemonDataEgg_); break; } case 40: { ExperienceAwarded = input.ReadInt32(); break; } case 48: { CooldownCompleteTimestampMs = input.ReadInt64(); break; } case 56: { ChainHackSequenceNumber = input.ReadInt32(); break; } } } } #region Nested types /// <summary>Container for nested types declared in the FortSearchResponse message type.</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { public enum Result { [pbr::OriginalName("NO_RESULT_SET")] NoResultSet = 0, [pbr::OriginalName("SUCCESS")] Success = 1, [pbr::OriginalName("OUT_OF_RANGE")] OutOfRange = 2, [pbr::OriginalName("IN_COOLDOWN_PERIOD")] InCooldownPeriod = 3, [pbr::OriginalName("INVENTORY_FULL")] InventoryFull = 4, [pbr::OriginalName("EXCEEDED_DAILY_LIMIT")] ExceededDailyLimit = 5, } } #endregion } #endregion } #endregion Designer generated code
{ "content_hash": "b6c5c155e7ded0eee126e0de26673c38", "timestamp": "", "source": "github", "line_count": 348, "max_line_length": 425, "avg_line_length": 40.367816091954026, "alnum_prop": 0.6838695899772209, "repo_name": "PoGo-Devs/PoGo", "id": "b05d76d893dfe57a05c28a7c2d1ff54024f2daac", "size": "14250", "binary": false, "copies": "8", "ref": "refs/heads/master", "path": "src/PoGo.ApiClient/Proto/Networking/Responses/FortSearchResponse.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "3126013" } ], "symlink_target": "" }
describe Travis::API::V3::Services::Queues::Stats, set_app: true do describe 'jobs stats' do let(:repo) { FactoryBot.create(:repository, name: 'travis-web') } before do FactoryBot.create(:job, repository: repo, queue: 'builds.linux', state: 'queued') FactoryBot.create(:job, repository: repo, queue: 'builds.linux', state: 'queued') FactoryBot.create(:job, repository: repo, queue: 'builds.linux', state: 'started') end context 'when authenticated by user token' do let(:user) { FactoryBot.create(:user) } let(:token) { Travis::Api::App::AccessToken.create(user: user, app_id: 1) } let(:headers) { { 'HTTP_AUTHORIZATION' => "token #{token}" } } it 'renders error' do get("/v3/queues/builds.linux/stats", {}, headers) expect(parsed_body['error_message']).to eql('login required') end end context 'when authenticated by internal token' do let(:token) { Travis.config.applications[:autoscaler][:token] } let(:headers) { { 'HTTP_AUTHORIZATION' => "internal autoscaler:#{token}" } } before do Travis.config.applications[:autoscaler] = { token: 'sometoken', full_access: true } end after do Travis.config.applications.delete(:autoscaler) end it 'returns jobs stats by state' do get("/v3/queues/builds.linux/stats", {}, headers) expect(parsed_body['started']).to eql(1) expect(parsed_body['queued']).to eql(2) expect(parsed_body['queue_name']).to eql('builds.linux') end end end end
{ "content_hash": "9e0bc45b60608f33de7d5d424207e3b9", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 91, "avg_line_length": 35.97727272727273, "alnum_prop": 0.6272899557801642, "repo_name": "travis-ci/travis-api", "id": "eb6cf2969c0ae114abb26beea01c09be441d2d22", "size": "1583", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/v3/services/queues/stats_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "798" }, { "name": "HTML", "bytes": "404856" }, { "name": "Makefile", "bytes": "1429" }, { "name": "Procfile", "bytes": "99" }, { "name": "Ruby", "bytes": "2366301" }, { "name": "Shell", "bytes": "5062" } ], "symlink_target": "" }
package org.jetbrains.idea.maven.buildtool; import com.intellij.build.BuildDescriptor; import com.intellij.build.BuildProgressListener; import com.intellij.build.events.StartBuildEvent; import com.intellij.build.events.impl.StartBuildEventImpl; import com.intellij.build.output.BuildOutputInstantReaderImpl; import com.intellij.execution.process.AnsiEscapeDecoder; import com.intellij.execution.process.ProcessOutputType; import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.maven.externalSystemIntegration.output.MavenLogOutputParser; import org.jetbrains.idea.maven.externalSystemIntegration.output.MavenOutputParserProvider; import org.jetbrains.idea.maven.externalSystemIntegration.output.MavenParsingContext; import org.jetbrains.idea.maven.project.MavenConsoleImpl; import org.jetbrains.idea.maven.project.MavenProjectBundle; import org.jetbrains.idea.maven.utils.MavenUtil; import java.util.Collections; import java.util.function.Function; @ApiStatus.Experimental public class MavenBuildEventProcessor implements AnsiEscapeDecoder.ColoredTextAcceptor { @NotNull private final BuildProgressListener myBuildProgressListener; @NotNull private final Project myProject; @NotNull private final BuildOutputInstantReaderImpl myInstantReader; @NotNull private final ExternalSystemTaskId myTaskId; @NotNull private final String myWorkingDir; @NotNull private final MavenLogOutputParser myParser; private boolean closed = false; private final BuildDescriptor myDescriptor; @NotNull private final Function<MavenParsingContext, StartBuildEvent> myStartBuildEventSupplier; public MavenBuildEventProcessor(@NotNull Project project, @NotNull String workingDir, @NotNull BuildProgressListener buildProgressListener, @NotNull BuildDescriptor descriptor, @NotNull ExternalSystemTaskId taskId, @NotNull Function<String, String> targetFileMapper, @Nullable Function<MavenParsingContext, StartBuildEvent> startBuildEventSupplier) { myBuildProgressListener = buildProgressListener; myProject = project; myTaskId = taskId; myWorkingDir = workingDir; myDescriptor = descriptor; myStartBuildEventSupplier = startBuildEventSupplier != null ? startBuildEventSupplier : ctx -> new StartBuildEventImpl(myDescriptor, "") .withExecutionFilters(MavenConsoleImpl.getMavenConsoleFilters(myProject)); myParser = MavenOutputParserProvider.createMavenOutputParser(project, myTaskId, targetFileMapper); myInstantReader = new BuildOutputInstantReaderImpl( myTaskId, myTaskId, wrapListener(project, myBuildProgressListener, myWorkingDir), Collections.singletonList(myParser)); } private static BuildProgressListener wrapListener(@NotNull Project project, @NotNull BuildProgressListener listener, @NotNull String workingDir) { return new MavenProgressListener(project, listener, workingDir); } public synchronized void finish() { myParser.finish(e -> myBuildProgressListener.onEvent(myDescriptor.getId(), e)); myInstantReader.close(); closed = true; } public void start() { StartBuildEvent startEvent = myStartBuildEventSupplier.apply(getParsingContext()); myBuildProgressListener.onEvent(myDescriptor.getId(), startEvent); } public void notifyException(Throwable throwable) { new Notification(MavenUtil.MAVEN_NOTIFICATION_GROUP, MavenProjectBundle.message("maven.build.messages.cannot.run.task"), throwable.getMessage(), NotificationType.ERROR, null) .notify(myProject); } public synchronized void onTextAvailable(String text, boolean stdError) { if (!closed) { myInstantReader.append(text); } } public MavenParsingContext getParsingContext() { return myParser.getParsingContext(); } @Override public void coloredTextAvailable(@NotNull String text, @NotNull Key outputType) { onTextAvailable(text, ProcessOutputType.isStderr(outputType)); } }
{ "content_hash": "0cbb27703fa0fe9588559d3184d678d9", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 178, "avg_line_length": 45.0990099009901, "alnum_prop": 0.7600439077936334, "repo_name": "zdary/intellij-community", "id": "04fb2bdf629a0337cb331e6ae689b35998f997e2", "size": "4696", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "plugins/maven/src/main/java/org/jetbrains/idea/maven/buildtool/MavenBuildEventProcessor.java", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
from .base import FieldType, indexPredicates from dedupe import predicates from affinegap import normalizedAffineGapDistance as affineGap from highered import CRFEditDistance from simplecosine.cosine import CosineTextSimilarity crfEd = CRFEditDistance() base_predicates = (predicates.wholeFieldPredicate, predicates.firstTokenPredicate, predicates.commonIntegerPredicate, predicates.nearIntegersPredicate, predicates.firstIntegerPredicate, predicates.sameThreeCharStartPredicate, predicates.sameFiveCharStartPredicate, predicates.sameSevenCharStartPredicate, predicates.commonTwoTokens, predicates.commonThreeTokens, predicates.fingerprint, predicates.oneGramFingerprint, predicates.twoGramFingerprint, predicates.sortedAcronym) class BaseStringType(FieldType) : type = None _Predicate = predicates.StringPredicate def __init__(self, definition) : super(BaseStringType, self).__init__(definition) self.predicates += indexPredicates((predicates.LevenshteinCanopyPredicate, predicates.LevenshteinSearchPredicate), (1, 2, 3, 4), self.field) class ShortStringType(BaseStringType) : type = "ShortString" _predicate_functions = (base_predicates + (predicates.commonFourGram, predicates.commonSixGram, predicates.tokenFieldPredicate, predicates.suffixArray, predicates.doubleMetaphone, predicates.metaphoneToken)) _index_predicates = (predicates.TfidfNGramCanopyPredicate, predicates.TfidfNGramSearchPredicate) _index_thresholds = (0.2, 0.4, 0.6, 0.8) def __init__(self, definition) : super(ShortStringType, self).__init__(definition) if definition.get('crf', False) == True : self.comparator = crfEd else : self.comparator = affineGap class StringType(ShortStringType) : type = "String" _index_predicates = (predicates.TfidfNGramCanopyPredicate, predicates.TfidfNGramSearchPredicate, predicates.TfidfTextCanopyPredicate, predicates.TfidfTextSearchPredicate) class TextType(BaseStringType) : type = "Text" _predicate_functions = base_predicates _index_predicates = (predicates.TfidfTextCanopyPredicate, predicates.TfidfTextSearchPredicate) _index_thresholds = (0.2, 0.4, 0.6, 0.8) def __init__(self, definition) : super(TextType, self).__init__(definition) if 'corpus' not in definition : definition['corpus'] = [] self.comparator = CosineTextSimilarity(definition['corpus'])
{ "content_hash": "9d032ce256c33dd7ee1b537021f6b1c0", "timestamp": "", "source": "github", "line_count": 90, "max_line_length": 83, "avg_line_length": 35, "alnum_prop": 0.5923809523809523, "repo_name": "tfmorris/dedupe", "id": "1d05b974897b139322d8e1fa85c64ff6c6441cec", "size": "3150", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "dedupe/variables/string.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "198229" }, { "name": "Shell", "bytes": "850" } ], "symlink_target": "" }
using System; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; namespace MastersThesisCountDown.I2C { public class RX8025NB : I2C { private enum RegisterAddress : byte { Seconds = 0x00, Minutes = 0x01, Hours = 0x02, Weekdays = 0x03, Days = 0x04, Months = 0x05, Years = 0x06, DigitalOffset = 0x07, AlarmDMinute = 0x08, AlarmDHour = 0x09, AlarmDWeekday = 0x0A, AlarmWMinute = 0x0B, AlarmWHour = 0x0C, Reserved = 0x0D, Control1 = 0x0E, Control2 = 0x0F } /// <summary> /// Š„‚荞‚݃‚[ƒh /// </summary> public enum InterruptMode : byte { /// <summary>OFF (Hi-z)</summary> Off = 0x00, /// <summary>OFF (LOWŒÅ’è)</summary> LowFixed = 0x01, /// <summary>ƒpƒ‹ƒXƒ‚[ƒhi2Hzj</summary> Pulse2Hz = 0x02, /// <summary>ƒpƒ‹ƒXƒ‚[ƒhi1Hzj</summary> Pulse1Hz = 0x03, /// <summary>ƒŒƒxƒ‹ƒ‚[ƒhi1•b‚É1“xj</summary> LevelSecond = 0x04, /// <summary>ƒŒƒxƒ‹ƒ‚[ƒhi1•ª‚É1“xj</summary> LevelMinute = 0x05, /// <summary>ƒŒƒxƒ‹ƒ‚[ƒhi1ŽžŠÔ‚É1“xj</summary> LevelHour = 0x06, /// <summary>ƒŒƒxƒ‹ƒ‚[ƒhi1ŒŽ‚É1“xj</summary> LevelMonth = 0x07 } private const byte HourMode24 = 0x20; private const byte PowerOnReset = 0x00; public RX8025NB() : base(0x32, 100, 500) { } public void Initialize() { WriteToRegister(RegisterAddress.Control1, HourMode24); WriteToRegister(RegisterAddress.Control2, PowerOnReset); Thread.Sleep(1); } public DateTime CurrentTime { get { var second = BinaryCodeToInteger(ReadFromRegister(RegisterAddress.Seconds)); var minute = BinaryCodeToInteger(ReadFromRegister(RegisterAddress.Minutes)); var hour = BinaryCodeToInteger(ReadFromRegister(RegisterAddress.Hours)); var day = BinaryCodeToInteger(ReadFromRegister(RegisterAddress.Days)); var month = BinaryCodeToInteger(ReadFromRegister(RegisterAddress.Months)); var year = 2000 + BinaryCodeToInteger(ReadFromRegister(RegisterAddress.Years)); return new DateTime(year, month, day, hour, minute, second); } set { WriteToRegister(RegisterAddress.Seconds, IntegerToBinaryCode(value.Second)); WriteToRegister(RegisterAddress.Minutes, IntegerToBinaryCode(value.Minute)); WriteToRegister(RegisterAddress.Hours, IntegerToBinaryCode(value.Hour)); WriteToRegister(RegisterAddress.Weekdays, DayOfWeekToBinaryCode(value.DayOfWeek)); WriteToRegister(RegisterAddress.Days, IntegerToBinaryCode(value.Day)); WriteToRegister(RegisterAddress.Months, IntegerToBinaryCode(value.Month)); WriteToRegister(RegisterAddress.Years, IntegerToBinaryCode(value.Year % 100)); Thread.Sleep(1); } } public void ClearInterruptFlag() { WriteToRegister(RegisterAddress.Control2, PowerOnReset); } public bool HasInitialized => ((ReadFromRegister(RegisterAddress.Control2) >> 4) & 0x01) == 0; public InterruptMode Interrupt { get { return (InterruptMode)(ReadFromRegister(RegisterAddress.Control1) & 0x07); } set { WriteToRegister(RegisterAddress.Control1, (byte)((byte)value | HourMode24)); } } private int BinaryCodeToInteger(byte bcd) => ((bcd >> 4) & 0x0F) * 10 + (bcd & 0x0F); private byte IntegerToBinaryCode(int value) { if (value < 0 || value >= 100) { throw new ArgumentOutOfRangeException("BCDŒ`Ž®‚ɕϊ·‚·‚鐔’l‚Í0`99‚͈͓̔à‚ɂȂ¯‚ê‚΂Ȃè‚Ü‚¹‚ñB"); } var digit2 = value / 10; var digit1 = value % 10; return (byte)(digit2 * 16 + digit1); } private byte DayOfWeekToBinaryCode(DayOfWeek day) { switch (day) { case DayOfWeek.Sunday: return 0; case DayOfWeek.Monday: return 1; case DayOfWeek.Tuesday: return 2; case DayOfWeek.Wednesday: return 3; case DayOfWeek.Thursday: return 4; case DayOfWeek.Friday: return 5; case DayOfWeek.Saturday: return 6; default: throw new ArgumentException("—j“ú‚ª•s³‚Å‚·B"); } } private void WriteToRegister(RegisterAddress address, byte value) { Write((byte)(((byte)address) << 4), value); } private byte ReadFromRegister(RegisterAddress address) { return ReadFromRegister((byte)(((byte)address) << 4), 1)[0]; } } }
{ "content_hash": "804bcb6a1c08d52c8bb2c4d05290768d", "timestamp": "", "source": "github", "line_count": 159, "max_line_length": 116, "avg_line_length": 34.18867924528302, "alnum_prop": 0.5182119205298014, "repo_name": "terry-u16/MastersThesisCountDown", "id": "fda7698d236028a294368772a739f2e0bbe06430", "size": "5436", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "MastersThesisCountDown/I2C/RX8025NB.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "36521" } ], "symlink_target": "" }
from pyparsing import * src = """ class a ... end a; class b ... end b; class c ... end d;""" identifier = Word(alphas) classIdent = identifier("classname") # note that this also makes a copy of identifier classHead = "class" + classIdent classBody = "..." classEnd = "end" + matchPreviousLiteral(classIdent) + ';' classDefn = classHead + classBody + classEnd # use this form to catch syntax error # classDefn = classHead + classBody - classEnd for tokens in classDefn.searchString(src): print(tokens.classname)
{ "content_hash": "c2fb21fa76946ca9efad68220b90de43", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 87, "avg_line_length": 18.566666666666666, "alnum_prop": 0.6588868940754039, "repo_name": "synap5e/pyparsing", "id": "f0812e96ac65c33837362cafed60aff7331dbbd9", "size": "587", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "examples/matchPreviousDemo.py", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "29378" }, { "name": "Pascal", "bytes": "82867" }, { "name": "Python", "bytes": "778111" }, { "name": "Shell", "bytes": "1078" } ], "symlink_target": "" }
- Added the "redraw" command, to show the current build/slide again ## [1.1] - 2015-02-25 ### Added - Emoji support ## [1.0] - 2015-02-19 ### Added - Updated tutorial slideshow - Updated instructions in README.md - Added Quick Reference Guide - Added sample screencast tour ### Changed - No space between a horizontal ruler command and its pattern ## [0.9] - 2015-02-18 ### Added - Support for running code straight from the slides ## [0.8] - 2015-02-17 ### Added - Horizontal ruler support ## [0.7] - 2015-02-16 ### Added - Basic syntax highlighting ## [0.6] - 2015-02-10 ### Added - Slide counter/total ## [0.5] - 2015-02-09 ### Added - Line alignment ## [0.4] - 2015-02-09 ### Added - ANSI color support ## [0.3] - 2015-02-08 ### Added - Navigation options: by slides or by builds - Unit tests ## [0.2] - 2015-02-01 ### Added - Experimental screen size auto-detection for Mac OS X, Linux, and Unix-like systems ## [0.1] - 2015-02-01 ### Added - Initial public release - Basic navigation - Build (incremental slides) support - Margin (border) configuration - Tutorial / sample slideshow [unreleased]: https://github.com/marconilanna/REPLesent/compare/v1.1...HEAD [1.1]: https://github.com/marconilanna/REPLesent/compare/v1.0...v1.1 [1.0]: https://github.com/marconilanna/REPLesent/compare/v0.9...v1.0 [0.9]: https://github.com/marconilanna/REPLesent/compare/v0.8...v0.9 [0.8]: https://github.com/marconilanna/REPLesent/compare/v0.7...v0.8 [0.7]: https://github.com/marconilanna/REPLesent/compare/v0.6...v0.7 [0.6]: https://github.com/marconilanna/REPLesent/compare/v0.5...v0.6 [0.5]: https://github.com/marconilanna/REPLesent/compare/v0.4...v0.5 [0.4]: https://github.com/marconilanna/REPLesent/compare/v0.3...v0.4 [0.3]: https://github.com/marconilanna/REPLesent/compare/v0.2...v0.3 [0.2]: https://github.com/marconilanna/REPLesent/compare/v0.1...v0.2 [0.1]: https://github.com/marconilanna/REPLesent/tree/v0.1
{ "content_hash": "fcf953e92a8384d4214a4a73d36f0192", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 84, "avg_line_length": 28.323529411764707, "alnum_prop": 0.6993769470404985, "repo_name": "hardvain/REPLesent", "id": "0184fb3bea52e2adc3c3152c21db5d63aa4addf6", "size": "1968", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "CHANGELOG.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Scala", "bytes": "63935" } ], "symlink_target": "" }
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["className", "children", "weight", "Component", "getRootRef"]; import * as React from "react"; import { useAdaptivity } from "../../../hooks/useAdaptivity"; import { classNamesString } from "../../../lib/classNames"; import { warnOnce } from "../../../lib/warnOnce"; import { getSizeYClassName } from "../../../helpers/getSizeYClassName"; import "./Text.module.css"; var warn = warnOnce("Text"); /** * @see https://vkcom.github.io/VKUI/#/Text */ export var Text = function Text(_ref) { var className = _ref.className, children = _ref.children, weight = _ref.weight, _ref$Component = _ref.Component, Component = _ref$Component === void 0 ? "span" : _ref$Component, getRootRef = _ref.getRootRef, restProps = _objectWithoutProperties(_ref, _excluded); if (process.env.NODE_ENV === "development" && typeof Component !== "string" && getRootRef) { warn("\u0421\u0432\u043E\u0439\u0441\u0442\u0432\u043E \"getRootRef\" \u043C\u043E\u0436\u0435\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u0441 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u0430\u043C\u0438 DOM", "error"); } var _useAdaptivity = useAdaptivity(), sizeY = _useAdaptivity.sizeY; return /*#__PURE__*/React.createElement(Component, _extends({}, restProps, { ref: getRootRef, className: classNamesString(className, "vkuiText", getSizeYClassName("vkuiText", sizeY), weight && styles["Text--weight-".concat(weight)]) }), children); }; var styles = { "Text--weight-1": "vkuiText--weight-1", "Text--weight-2": "vkuiText--weight-2", "Text--weight-3": "vkuiText--weight-3" }; //# sourceMappingURL=Text.js.map
{ "content_hash": "14a85ef84d608653bc2fe21bb1259710", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 322, "avg_line_length": 50.54054054054054, "alnum_prop": 0.6925133689839572, "repo_name": "cdnjs/cdnjs", "id": "809cf6e9e9d5193db1dec417cab5ce5fc2373ccf", "size": "1870", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ajax/libs/vkui/5.0.0-beta.3/cssm/components/Typography/Text/Text.js", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }