id int64 0 1.29M | original_id stringlengths 32 32 | swhid stringlengths 100 170 | sha1 stringlengths 40 40 | repo_name stringlengths 2 45 | repo_group stringclasses 12
values | filepath stringlengths 5 153 | name stringlengths 1 14.9k | type stringclasses 3
values | code stringlengths 7 2.12M |
|---|---|---|---|---|---|---|---|---|---|
500 | eeae50bca2ec65769563b4e98949ec10 | swh:1:cnt:098543290ba7bd3332b3b3d8a6fab672e08ceb75;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=15-37/ | 93cbad46572cbd623c4719ad0c93d44314eb17c3 | jsonschema-tools | analytics | lib/tests/robustness.js | ajv | function | /**
* Retuns a new Ajv instance. We need multiple ajv insttances
* for tests here because we may be adding the same schema
* from multiple files (.yaml, json, etc.) which will have the same
* $id. AJV will fail if the a schema with the same $id is added multiple times.
*/
function ajv() {
const ajv = new Ajv({... |
501 | c8dcbc9001e59898adb96a3139c31143 | swh:1:cnt:098543290ba7bd3332b3b3d8a6fab672e08ceb75;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=43-134/ | 93cbad46572cbd623c4719ad0c93d44314eb17c3 | jsonschema-tools | analytics | lib/tests/robustness.js | assertDeterministicTypes | function | function assertDeterministicTypes(node, path = '') {
// if node type is union type, fail.
if (Array.isArray(node.type)) {
throw new assert.AssertionError({
message: `Polymorphic type property at #${path}`
});
}
// if node type is array, assert items.type
if (node.type ==... |
502 | 5452f3ee4f7f14ddfd74f7fded0b7a3e | swh:1:cnt:098543290ba7bd3332b3b3d8a6fab672e08ceb75;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=136-149/ | 93cbad46572cbd623c4719ad0c93d44314eb17c3 | jsonschema-tools | analytics | lib/tests/robustness.js | assertSnakeCaseProperties | function | function assertSnakeCaseProperties(node, path = '') {
(node.allOf || []).forEach((schema) => {
assertSnakeCaseProperties(schema, path);
});
Object.keys(node.properties || {}).forEach((prop) => {
const propPath = `${path}/properties/${prop}`;
if (!/^[$a-z]+[a-z0-9_]*$/.test(prop)) {
... |
503 | 412500ff79e22b7d8c391f01fd1197de | swh:1:cnt:098543290ba7bd3332b3b3d8a6fab672e08ceb75;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=166-174/ | 93cbad46572cbd623c4719ad0c93d44314eb17c3 | jsonschema-tools | analytics | lib/tests/robustness.js | assertSchemaIsValid | function | function assertSchemaIsValid(schema) {
if (!isSchemaValid(schema)) {
throw new assert.AssertionError({
message: 'Schema is invalid',
expected: [],
actual: isSchemaValid.errors
});
}
} |
504 | 33ebf452be9de6063c101de8b0e63a6d | swh:1:cnt:098543290ba7bd3332b3b3d8a6fab672e08ceb75;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=151-164/ | 93cbad46572cbd623c4719ad0c93d44314eb17c3 | jsonschema-tools | analytics | lib/tests/robustness.js | assertRequired | function | function assertRequired(node, path = '') {
if (node.required) {
assert.ok(node.properties, `#${path}/properties must exist`);
node.required.forEach((prop) => {
assert.ok(
node.properties[prop],
`#${path}/properties/${prop} is required but does not exist`
... |
505 | 61307312c0669dd5d74685aa33c02725 | swh:1:cnt:098543290ba7bd3332b3b3d8a6fab672e08ceb75;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=176-184/ | 93cbad46572cbd623c4719ad0c93d44314eb17c3 | jsonschema-tools | analytics | lib/tests/robustness.js | assertSchemaIsSecure | function | function assertSchemaIsSecure(schema) {
if (!isSchemaSecure(schema)) {
throw new assert.AssertionError({
message: 'Schema insecure errors',
expected: [],
actual: isSchemaSecure.errors
});
}
} |
506 | f597ad19863dfa417e4df39de43f10eb | swh:1:cnt:098543290ba7bd3332b3b3d8a6fab672e08ceb75;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=186-193/ | 93cbad46572cbd623c4719ad0c93d44314eb17c3 | jsonschema-tools | analytics | lib/tests/robustness.js | assertExamplesId | function | function assertExamplesId(schema) {
schema.examples.forEach((example, index) => {
assert.strictEqual(
example.$schema, schema.$id,
`example ${index} $schema value does not match schema\'s $id value`
);
});
} |
507 | 6bafc3015cb35c38fd78e38f88ca5ebe | swh:1:cnt:098543290ba7bd3332b3b3d8a6fab672e08ceb75;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=195-204/ | 93cbad46572cbd623c4719ad0c93d44314eb17c3 | jsonschema-tools | analytics | lib/tests/robustness.js | assertValidExamples | function | function assertValidExamples(schema) {
schema.examples.forEach((example, index) => {
const validator = ajv();
if (!validator.validate(schema, example)) {
throw new assert.AssertionError({
message: `example ${index} did not validate against schema: ${validator.errorsText()... |
508 | c1c179cc01aa5a02e0ecdf15f0573a42 | swh:1:cnt:098543290ba7bd3332b3b3d8a6fab672e08ceb75;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=206-220/ | 93cbad46572cbd623c4719ad0c93d44314eb17c3 | jsonschema-tools | analytics | lib/tests/robustness.js | assertEnforcedNumericBounds | function | function assertEnforcedNumericBounds(schema, options = {}) {
options = jsonschemaTools.readConfig(options);
const enforcedMin = options.enforcedNumericBounds[0];
const enforcedMax = options.enforcedNumericBounds[1];
traverseSchema(schema, (obj, _1, _2, _3, _4, _5, fieldName) => {
if (['number',... |
509 | faadcfdf1bff8731bba100dd951da749 | swh:1:cnt:098543290ba7bd3332b3b3d8a6fab672e08ceb75;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=299-332/ | 93cbad46572cbd623c4719ad0c93d44314eb17c3 | jsonschema-tools | analytics | lib/tests/robustness.js | declareTests | function | function declareTests(options = {}) {
options = jsonschemaTools.readConfig(options);
const allSchemas = jsonschemaTools.findSchemasByTitle(options);
describe(`Schema Robustness in Repository ${options.schemaBasePath}`, () => {
for (const title of Object.keys(allSchemas)) {
describe(title... |
510 | e7f7d7e3a4943e9b68d01430e0efa868 | swh:1:cnt:a6c7460a5d1a6c5f39985efc100e9126c9ddfef6;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=10-16/ | b6c61bc9a6a2f2ae2ee77d97d348f36608fbb033 | jsonschema-tools | analytics | lib/tests/structure.js | assertIdMatchesDirectory | function | function assertIdMatchesDirectory(schemaInfo, options) {
const relativeSchemaPath = path.relative(options.schemaBasePath, schemaInfo.path);
assert.ok(
relativeSchemaPath.includes(schemaInfo.schema['$id'].substring(1)),
'schema $id must match relative schema directory'
);
} |
511 | 1bd34a80017e00fe17f999e1cfd94407 | swh:1:cnt:a6c7460a5d1a6c5f39985efc100e9126c9ddfef6;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=18-223/ | b6c61bc9a6a2f2ae2ee77d97d348f36608fbb033 | jsonschema-tools | analytics | lib/tests/structure.js | declareTests | function | function declareTests(options = { logLevel: 'warn' }) {
options = jsonschemaTools.readConfig(options);
const allSchemaInfos = jsonschemaTools.findSchemasByTitle(options);
describe(`Schema Repository Structure in ${options.schemaBasePath}`, () => {
Object.keys(allSchemaInfos).forEach((schemaTitle) ... |
512 | 6dbf30fd280d6f637033d99e53c1585e | swh:1:cnt:9d9052241bb2a9b9cd958dcabc8d78499679a609;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=6-18/ | fd10d9ed6fc42fd19d7cfdd0f6baa196eb2d5d4d | jsonschema-tools | analytics | lib/tests/util.js | shouldDeclareTestCase | function | /**
* Not all test cases should be run for every schema file.
* If a condition fn is declared on the test case, it will be evalulated.
* If the condition returns false, the test case should not be declared.
* @param {Object} testCase
* @param {Object} schemaInfo
* @param {Object} options
* @return {boolean}
*/
... |
513 | be3dd479178467195dbd0a3f628fe057 | swh:1:cnt:9d9052241bb2a9b9cd958dcabc8d78499679a609;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=20-40/ | fd10d9ed6fc42fd19d7cfdd0f6baa196eb2d5d4d | jsonschema-tools | analytics | lib/tests/util.js | shouldSkipTestCase | function | /**
* If options.skipSchemaTestCases contains matches for
* this schema, any test cases listed there should be ignored.
* @param {Object} testCase
* @param {Object} schemaInfo
* @param {Object} options
* @return {boolean}
*/
function shouldSkipTestCase(testCase, schemaInfo, options = {}) {
options = jsonsche... |
514 | 563f17a8ff96ca3072c0472acb6cc44d | swh:1:cnt:93afb89d67906740b674d6f4fe7ac20fe5c38f39;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=21-28/ | cac637cbece86f604d10fe2ee262ed578b96f1ab | jsonschema-tools | analytics | scripts/jsonschema-tools.js | coerceArrayOption | function | /**
* Allows for specifying comma separated array types with yargs.
* @param {Array} arr
* @return {Array}
*/
function coerceArrayOption(arr) {
return _.uniq(_.flatMap(arr, e => e.split(',')));
} |
515 | 226ccf3ac8bccc25df546f900da3c707 | swh:1:cnt:93afb89d67906740b674d6f4fe7ac20fe5c38f39;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=243-250/ | cac637cbece86f604d10fe2ee262ed578b96f1ab | jsonschema-tools | analytics | scripts/jsonschema-tools.js | materializeModified | function | /**
* Looks for git modified files that match currentName and materializes them.
* @param {Object} args
*/
async function materializeModified(args) {
const options = argsToOptions(args);
await materializeModifiedSchemas(options);
} |
516 | bf8cd27eb5a7b8973f7c698ded381366 | swh:1:cnt:93afb89d67906740b674d6f4fe7ac20fe5c38f39;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=174-203/ | cac637cbece86f604d10fe2ee262ed578b96f1ab | jsonschema-tools | analytics | scripts/jsonschema-tools.js | dereference | function | /**
* Given yargs args, reads schemas from files and writes them to stdout.
* @param {Object} args
*/
async function dereference(args) {
const options = argsToOptions(args);
let schemaPaths = args.schemaPath;
// If not given any schema paths, read from stdin.
if (_.isEmpty(schemaPaths)) {
sc... |
517 | ae5077c054c230980a8647fabb333368 | swh:1:cnt:93afb89d67906740b674d6f4fe7ac20fe5c38f39;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=205-241/ | cac637cbece86f604d10fe2ee262ed578b96f1ab | jsonschema-tools | analytics | scripts/jsonschema-tools.js | materialize | function | /**
* Given yargs args, reads schemas from files and materializes them to version files.
* @param {Object} args
*/
async function materialize(args) {
const options = argsToOptions(args);
let schemaPaths = args.schemaPath;
// Read from stdin if no schema-path was given.
if (_.isEmpty(schemaPaths)) {
... |
518 | 87626821b0b6a0fc1b8f4d4fec16775e | swh:1:cnt:93afb89d67906740b674d6f4fe7ac20fe5c38f39;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=141-172/ | cac637cbece86f604d10fe2ee262ed578b96f1ab | jsonschema-tools | analytics | scripts/jsonschema-tools.js | argsToOptions | function | /**
* Converts yargs parsed args to jsonschema-tools options.
* @param {Object} args
* @return {Object}
*/
function argsToOptions(args) {
const options = {};
_.keys(args).forEach((key) => {
// NOTE: --no* options are provided as args keys without the no*
// prefix negated, e.g. --no-symlink-... |
519 | 34eb7c906afeb945640e29548839eb5a | swh:1:cnt:93afb89d67906740b674d6f4fe7ac20fe5c38f39;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=252-255/ | cac637cbece86f604d10fe2ee262ed578b96f1ab | jsonschema-tools | analytics | scripts/jsonschema-tools.js | materializeAll | function | async function materializeAll(args) {
const options = argsToOptions(args);
await materializeAllSchemas(args.schemaBasePath, options);
} |
520 | 68bef96e457719d7282af78e6d62216b | swh:1:cnt:93afb89d67906740b674d6f4fe7ac20fe5c38f39;origin=https://gitlab.wikimedia.org/repos/data-engineering/jsonschema-tools.git;lines=257-265/ | cac637cbece86f604d10fe2ee262ed578b96f1ab | jsonschema-tools | analytics | scripts/jsonschema-tools.js | installGitPreCommitHook | function | /**
* Installs a git pre-commit hook in gitRoot that will
* materialize any staged modified files currentName schema files.
* @param {Object} args
*/
function installGitPreCommitHook(args) {
const options = argsToOptions(args);
installGitHook(options);
} |
521 | 2c7b58cedc5ca2a4382532a558e949c1 | swh:1:cnt:9aef241ef886ebfe81e1d66c0107d4be1a3d150a;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=52-78/ | 4dc1661e1231bc2e1df115176ca9e264ad2acf8c | eventgate-wikimedia | analytics | eventgate-wikimedia-dev.js | makeProduce | function | /**
* Creates a function that writes events to output_path.
* @param {Object} options
* @param {Object} options.output_path
* @param {Object} logger
* @return {EventGate~produce} (event, context) => Promise<event>
*/
function makeProduce(options, logger) {
const writeOptions = { flags: 'as' };
if (!option... |
522 | 5d928615487f4f2ae7ee583a4261da85 | swh:1:cnt:9aef241ef886ebfe81e1d66c0107d4be1a3d150a;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=80-138/ | 4dc1661e1231bc2e1df115176ca9e264ad2acf8c | eventgate-wikimedia | analytics | eventgate-wikimedia-dev.js | wikimediaDevEventGateFactory | function | /**
* Returns a Promise of an instantiated EventGate that uses EventValidator
* and event schema URL lookup and Kafka to produce messages.
* @param {Object} options
* @param {string} options.schema_uri_field
* Used to extract the event's schema URI.
* @param {string} options.schema_base_uris
* If set, ... |
523 | 801bcd1266785b6704942e870acd779a | swh:1:cnt:4f4ab458f200730766fe6b117b2428a3438b25aa;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=46-199/ | c26b882cabc9d5a5928565f2f0558fde5939fd5a | eventgate-wikimedia | analytics | eventgate-wikimedia.js | requireOptional | function | /**
* This module can be used as the value of app.options.eventgate_factory_module. It exports
* a factory function that given options and a logger, returns an instantiated EventGate instance
* that will produce to Kafka, and a mapToEventError function for transforming
* errors into events that can be produced to ... |
524 | 6e027ad7b9a36ab5fd8c761728b326ca | swh:1:cnt:4f4ab458f200730766fe6b117b2428a3438b25aa;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=201-229/ | c26b882cabc9d5a5928565f2f0558fde5939fd5a | eventgate-wikimedia | analytics | eventgate-wikimedia.js | makeExtractTimestamp | function | /**
* All wikimedia events should have stream_field set. The function
* created by this function returns the value extracted from event at stream_field.
*
* @param {Object} options
* @param {string} options.stream_field
* @return {function(Object, Object): string}
*/
/**
* Returns a function that extracts opti... |
525 | d88a6bb2cab31a489943423453e830c9 | swh:1:cnt:4f4ab458f200730766fe6b117b2428a3438b25aa;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=310-366/ | c26b882cabc9d5a5928565f2f0558fde5939fd5a | eventgate-wikimedia | analytics | eventgate-wikimedia.js | makeEventValidator | function | /**
* Returns a function that given an event, will ensure that it is allowed in a stream (optionally),
* and that the event validates with its JSONSchema (using EventValidator).
*
* @param {Object} options
* @param {Array<string>} options.schema_base_uris
* @param {string} options.schema_uri_field
* @param {stri... |
526 | 1010ad38d96dcc9f24cf90939171a3e2 | swh:1:cnt:4f4ab458f200730766fe6b117b2428a3438b25aa;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=368-478/ | c26b882cabc9d5a5928565f2f0558fde5939fd5a | eventgate-wikimedia | analytics | eventgate-wikimedia.js | makeEnsureEventAllowedInStream | function | /**
* Returns a function that given an event, will either return true, or throw
* UnauthorizedSchemaForStreamError if the event is not allowed in its destined
* stream.
*
* @param {Object} options
* @param {string} options.stream_config_uri
* @param {string} options.stream_config_uri_options
* @param {int} opti... |
527 | 4c3ec41ce5e87946f6d2568df39c12be | swh:1:cnt:4f4ab458f200730766fe6b117b2428a3438b25aa;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=231-308/ | c26b882cabc9d5a5928565f2f0558fde5939fd5a | eventgate-wikimedia | analytics | eventgate-wikimedia.js | makeApplyTransforms | function | /**
* Makes a function that will set some Wikimedia required fields with
* values if they are not set by the client. These event fields
* will only be set if they are present in the event's schema.
*
* This function will default event[schema_uri_field] and event[stream_field] from
* query parameters. This helps ... |
528 | fc595918d4c9411c9585717bdd3503a9 | swh:1:cnt:4f4ab458f200730766fe6b117b2428a3438b25aa;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=480-542/ | c26b882cabc9d5a5928565f2f0558fde5939fd5a | eventgate-wikimedia | analytics | eventgate-wikimedia.js | makeWikimediaValidate | function | /**
* Creates a new schema URI based validate(event) function.
* The returned function first checks the stream config to ensure that
* the event's schema title is allowed in the event's destination stream.
* It then uses an EventValidator instance to validate
* the event against its schema.
*
* @param {Object} o... |
529 | 89a4a1997116bda3de55a488c229f113 | swh:1:cnt:4f4ab458f200730766fe6b117b2428a3438b25aa;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=544-565/ | c26b882cabc9d5a5928565f2f0558fde5939fd5a | eventgate-wikimedia | analytics | eventgate-wikimedia.js | getKafkaTopicForStream | function | /**
* Returns the Kafka topic that events in this stream should be produced to.
* If the stream starts with 'eventlogging_', we assume it is a legacy
* EventLogging analytics stream. These streams are older and don't use
* any (datacenter) topic prefixes. The topic name should match the stream name
* exactly.
*... |
530 | d05e76c491fbd402fd7c5018ca7eba12 | swh:1:cnt:4f4ab458f200730766fe6b117b2428a3438b25aa;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=567-610/ | c26b882cabc9d5a5928565f2f0558fde5939fd5a | eventgate-wikimedia | analytics | eventgate-wikimedia.js | getKafkaProducerConf | function | /**
* Returns rdkafka conf and topic_conf by merging
* options.kafka.{conf|topic_conf} and options.kafka[producerType].{conf|topic_conf}.
* Allows for defaults in e.g. options.kafka.conf with producerType specific
* overrides in options.kafka[producerType]. Also sets some defaults
* like client.id if not provided... |
531 | fcf9dd275bd59584f73cef158b1b2b91 | swh:1:cnt:4f4ab458f200730766fe6b117b2428a3438b25aa;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=612-708/ | c26b882cabc9d5a5928565f2f0558fde5939fd5a | eventgate-wikimedia | analytics | eventgate-wikimedia.js | makeKafkaProducer | function | /**
* Instantiates and connects either a guaranteed or hasty Kafka Producer
* with logging and metrics configured.
*
* @param {Object} options
* @param {Object} options.kafka
* @param {Object} options.kafka.conf
* node-rdkafka KafkaProducer configuration
* @param {Object} options.kafka.topic_conf
* n... |
532 | 704ebdecf019093bd728ca9bc3f56112 | swh:1:cnt:4f4ab458f200730766fe6b117b2428a3438b25aa;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=710-733/ | c26b882cabc9d5a5928565f2f0558fde5939fd5a | eventgate-wikimedia | analytics | eventgate-wikimedia.js | createMessageKey | function | /**
* Creates a message key object from fields in the event.
*
* @param {Object} event
* @param {Object<string, string>} keyFieldToEventFieldMap
* This maps field paths in the key to field paths in the event.
* The key field will be set to the value of the event field.
* E.g. `{ key.fieldA: a.b.c }` will resu... |
533 | e75da5a7ee2ac525a8fd529537c5c175 | swh:1:cnt:4f4ab458f200730766fe6b117b2428a3438b25aa;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=735-829/ | c26b882cabc9d5a5928565f2f0558fde5939fd5a | eventgate-wikimedia | analytics | eventgate-wikimedia.js | makeProduce | function | /**
* Creates a function that returns a Kafka produce function
* suitable for passing to EventGate as the produce function argument.
* This conditionally uses either a GuaranteedProducer or a HastyProducer
* depending on the value of the context.req.query.hasty request query parameter.
*
* @param {Object} options... |
534 | 01bb4e0d0a9ef860207ae30af0e0e078 | swh:1:cnt:4f4ab458f200730766fe6b117b2428a3438b25aa;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=831-915/ | c26b882cabc9d5a5928565f2f0558fde5939fd5a | eventgate-wikimedia | analytics | eventgate-wikimedia.js | wikimediaEventGateFactory | function | /**
* Returns a Promise of an instantiated EventGate that uses EventValidator
* and event schema URL lookup and Kafka to produce messages. error events
* will be created and produced upon ValidationErrors.
*
* @param {Object} options
* @param {string} options.schema_uri_field
* Used to extract the event's ... |
535 | e0626de308a86c1cde0f1afab4c6d009 | swh:1:cnt:49e393d831b471df90f4c0747721eb52fa2fefdb;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=23-23/ | 5833575d5f1cd02cdf318d8002e0b66c8b55d80f | eventgate-wikimedia | analytics | lib/error.js | UnauthorizedSchemaForStreamError | type | class UnauthorizedSchemaForStreamError extends ContextualError {} |
536 | 34f47145219d1e4ad3e81cb9e20b693e | swh:1:cnt:49e393d831b471df90f4c0747721eb52fa2fefdb;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=27-29/ | 5833575d5f1cd02cdf318d8002e0b66c8b55d80f | eventgate-wikimedia | analytics | lib/error.js | HoistingError | type | // Used to distinguish vaidation errors specifically
// by the experiment hoisting mechanism
class HoistingError extends ContextualError {} |
537 | 5c55048efbbb30bb8b74b992db1506d2 | swh:1:cnt:49e393d831b471df90f4c0747721eb52fa2fefdb;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=25-25/ | 5833575d5f1cd02cdf318d8002e0b66c8b55d80f | eventgate-wikimedia | analytics | lib/error.js | MalformedHeaderError | type | class MalformedHeaderError extends ContextualError {} |
538 | cbc9cb34c116fc7f700a68bf77926c62 | swh:1:cnt:49e393d831b471df90f4c0747721eb52fa2fefdb;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=48-65/ | 5833575d5f1cd02cdf318d8002e0b66c8b55d80f | eventgate-wikimedia | analytics | lib/error.js | getToString | function | /**
* Like lodash _.get().toString(), except if the value is defined and it is null,
* returns 'null'. Most values have a toString method, but null does
* not.
*
* @param {Object} object
* @param {string} path
* @param {*} defaultValue
* @return {string}
*/
function getToString(object, path, defaultValue) {
... |
539 | 65c90e9328525bb553234b57dfc20ac6 | swh:1:cnt:49e393d831b471df90f4c0747721eb52fa2fefdb;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=67-184/ | 5833575d5f1cd02cdf318d8002e0b66c8b55d80f | eventgate-wikimedia | analytics | lib/error.js | makeMapToErrorEvent | function | /**
* Returns a new mapToErrorEvent function that uses options.error_schema_uri
* and options.error_stream to return an error event that conforms to the
* error event schema used by Wikimedia. This function only returns
* error events for ValidationErrors and HoistingErrors.
*
* The returned function also handle... |
540 | c37c29198d453edd10f9e960f82ad657 | swh:1:cnt:30e016a525b246969f34a78b408a9a440622be6b;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=9-20/ | 910ecd17303923bf53736f8c823ffe29830b7457 | eventgate-wikimedia | analytics | lib/experiments.js | isValidExperimentName | function | /**
* @typedef Enrollment
* @type {Object}
* @property {string} experimentName
* @property {string} groupName
* @property {string} subjectId
*/
function isValidExperimentName(name) {
const regex = /^[A-Za-z0-9][-_.A-Za-z0-9]{7,62}$/;
return regex.test(name);
} |
541 | 004626928bb80ae2c1a693537543c638 | swh:1:cnt:30e016a525b246969f34a78b408a9a440622be6b;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=27-36/ | 910ecd17303923bf53736f8c823ffe29830b7457 | eventgate-wikimedia | analytics | lib/experiments.js | isValidSubjectId | function | /**
* A valid experiment subject id must be base64 decodable and meet a certain length
*
* @param {string} id
* @return {boolean}
*/
function isValidSubjectId(id) {
const regex = /^[-_A-Za-z0-9]*$/;
return regex.test(id) && id.length === 22;
} |
542 | 0e78d6e725ebdf93f0d517ab65dbbd55 | swh:1:cnt:30e016a525b246969f34a78b408a9a440622be6b;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=22-25/ | 910ecd17303923bf53736f8c823ffe29830b7457 | eventgate-wikimedia | analytics | lib/experiments.js | isValidGroupName | function | function isValidGroupName(name) {
const regex = /^[A-Za-z0-9][-_.A-Za-z0-9]{1,62}$/;
return regex.test(name);
} |
543 | 3dd2bc79e96e77e4f235b8fc59b277e2 | swh:1:cnt:30e016a525b246969f34a78b408a9a440622be6b;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=58-81/ | 910ecd17303923bf53736f8c823ffe29830b7457 | eventgate-wikimedia | analytics | lib/experiments.js | formatXExperimentEnrollmentsForError | function | /**
* Formats the `x-experiment-enrollments` header for use in an error message.
*
* In general, we don't want to store subject IDs anywhere other than in the Data Lake where they
* will be stored for a maximum of 90 days. Therefore, we format the `x-experiment-enrollments`
* header for use in an error message by ... |
544 | c87e0abc521c54f26db0ed630bdde899 | swh:1:cnt:30e016a525b246969f34a78b408a9a440622be6b;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=38-56/ | 910ecd17303923bf53736f8c823ffe29830b7457 | eventgate-wikimedia | analytics | lib/experiments.js | formatSubjectIdForError | function | /**
* Formats a subject ID for use in an error message.
*
* In general, we don't want to store subject IDs anywhere other than in the Data Lake where they
* will be stored for a maximum of 90 days. However, we do want to know _something_ about a subject
* ID that might have caused an error. Therefore, we format a ... |
545 | 4e07692cfaae2ffbda6ef29ef06029ea | swh:1:cnt:30e016a525b246969f34a78b408a9a440622be6b;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=83-197/ | 910ecd17303923bf53736f8c823ffe29830b7457 | eventgate-wikimedia | analytics | lib/experiments.js | getXExperimentEnrollments | function | /**
* Gets a list of experiment enrollments form the headers of a request
*
* @param {string} xExperimentEnrollmentsHeader
* @return {Array<Enrollment>}
* @throws {MalformedHeaderError}
*/
function getXExperimentEnrollments(xExperimentEnrollmentsHeader) {
if (xExperimentEnrollmentsHeader.trim() !== xExperimen... |
546 | 7cb7ea341002dc404de55a66e3cdb401 | swh:1:cnt:30e016a525b246969f34a78b408a9a440622be6b;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=199-209/ | 910ecd17303923bf53736f8c823ffe29830b7457 | eventgate-wikimedia | analytics | lib/experiments.js | isValidEventSubjectId | function | /**
* Validates the subject_id that's inside of an event according to T391959.
* This is different from {@link isValidSubjectId}, which validates the subject id format itself.
*
* @param {Object} event
* @return {boolean}
*/
function isValidEventSubjectId(event) {
const subjectId = _.get(event, 'experiment.su... |
547 | b5a648e29fc4981016ec3c57e90460d9 | swh:1:cnt:30e016a525b246969f34a78b408a9a440622be6b;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=211-227/ | 910ecd17303923bf53736f8c823ffe29830b7457 | eventgate-wikimedia | analytics | lib/experiments.js | getEnrolledExperiment | function | /**
* Gets the enrolled experiment referred to in the event from the request
*
* @param {Object} event
* @param {string} xExperimentEnrollmentsHeader
* @return {Enrollment|undefined}
* @throws {MalformedHeaderError}
*/
function getEnrolledExperiment(event, xExperimentEnrollmentsHeader) {
const enrollments = ... |
548 | 59750e849abf180c7f8b8a4caca5ad74 | swh:1:cnt:f36905d75415c167d0af4e50be7cface5a47602e;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=13-42/ | 6b86e5524aaeb4a8dfd61d07bf8f41b3642aca5a | eventgate-wikimedia | analytics | lib/stream-configs.js | retryFn | function | /**
* Retries calling the provided async fn up to retryLimit times.
*
* @param {Function} fn
* @param {int} retryLimit
* @param {string} customRetryWarnMessage
* If set, this message will be used in the warning log message on errors
* caught before retry limit is reached.
* @param {Object} logger
* @... |
549 | 76c4d9eeab5f0a30951a0f98ea97169a | swh:1:cnt:f36905d75415c167d0af4e50be7cface5a47602e;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=106-143/ | 6b86e5524aaeb4a8dfd61d07bf8f41b3642aca5a | eventgate-wikimedia | analytics | lib/stream-configs.js | StreamConfigs::init | function | /**
* Fetches initial stream configs from stream_config_uri.
* If stream_config_ttl was configured, an interval timer will be set
* up to periodically refetch from stream_config_uri.
*
* NOTE: if a refetch attempt fails, the previously fetched stream configs
* will continue to be used. Th... |
550 | 0354b69e445b4bef349bfe2f11af0111 | swh:1:cnt:f36905d75415c167d0af4e50be7cface5a47602e;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=44-64/ | 6b86e5524aaeb4a8dfd61d07bf8f41b3642aca5a | eventgate-wikimedia | analytics | lib/stream-configs.js | compileStreamConfigRegexes | function | /**
* Compiles any stream name regex keys in streamConfigsData to stream_regex RegExps settings.
*
* @param {Object} streamConfigsData
* Object containing stream name => stream settings.
* Stream name might be regex patterns.
* @return {Object}
* The same streamConfigs object, but with keys that l... |
551 | 792ea6d8e3c6c01e6174cf3294bfb44a | swh:1:cnt:f36905d75415c167d0af4e50be7cface5a47602e;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=145-156/ | 6b86e5524aaeb4a8dfd61d07bf8f41b3642aca5a | eventgate-wikimedia | analytics | lib/stream-configs.js | StreamConfigs::keys | function | /**
* Returns a list of all currently known stream config keys.
*
* @return {Array}
*/
keys() {
if (this._streamConfigs === null) {
throw new Error('Must call init() before accessing stream configs');
}
return _.keys(this._streamConfigs);
} |
552 | 2e8beabe375375126e1900f782b9c0e8 | swh:1:cnt:f36905d75415c167d0af4e50be7cface5a47602e;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=83-104/ | 6b86e5524aaeb4a8dfd61d07bf8f41b3642aca5a | eventgate-wikimedia | analytics | lib/stream-configs.js | StreamConfigs::constructor | function | /**
* @param {Object} options
* @param {string} options.stream_config_uri
* @param {string} options.stream_config_uri_options
* @param {string} options.stream_config_object_path
* @param {string} options.stream_config_ttl
* @param {string} options.stream_config_retries
* @param {Objec... |
553 | 4b334a9bde3fbd03b8f03f6a65c84b19 | swh:1:cnt:f36905d75415c167d0af4e50be7cface5a47602e;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=158-170/ | 6b86e5524aaeb4a8dfd61d07bf8f41b3642aca5a | eventgate-wikimedia | analytics | lib/stream-configs.js | StreamConfigs::get | function | /**
* Gets the settings for the given stream.
*
* @param {string} stream
* @return {Object}
*/
get(stream) {
if (this._streamConfigs === null) {
throw new Error('Must call init() before accessing stream configs');
}
return this._getConfigsForStreams([str... |
554 | 8e787f226997cf1e3dd42d8f5da2d69d | swh:1:cnt:f36905d75415c167d0af4e50be7cface5a47602e;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=172-185/ | 6b86e5524aaeb4a8dfd61d07bf8f41b3642aca5a | eventgate-wikimedia | analytics | lib/stream-configs.js | StreamConfigs::mget | function | /**
* Gets settings for multiple streams.
* The returned Object will be keyed by stream name.
*
* @param {Array} streams
* @return {Object}
*/
mget(streams) {
if (this._streamConfigs === null) {
throw new Error('Must call init() before accessing stream configs');
... |
555 | 6275f60c51b4b2e62bc40f1d03e912c5 | swh:1:cnt:f36905d75415c167d0af4e50be7cface5a47602e;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=187-263/ | 6b86e5524aaeb4a8dfd61d07bf8f41b3642aca5a | eventgate-wikimedia | analytics | lib/stream-configs.js | StreamConfigs::_getConfigsForStreams | function | /**
* Collects the matching stream configs for the requested streams.
* If any stream config keys are regex patterns, the requested streams
* will be attemtped to match against these keys at this time.
*
* If a stream name happens to match more than one regex, this stream match
* will be c... |
556 | 342e351cd961124add95ef199d8ffb05 | swh:1:cnt:f36905d75415c167d0af4e50be7cface5a47602e;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=265-317/ | 6b86e5524aaeb4a8dfd61d07bf8f41b3642aca5a | eventgate-wikimedia | analytics | lib/stream-configs.js | StreamConfigs::_fetchStreamConfigs | function | /**
* Fetches stream configs from the configured stream_config_uri,
* with configured stream_config_retries.
*
* @return {Object}
*/
async _fetchStreamConfigs() {
const fetchStreamConfigs = async () => {
this.log.info(`Fetching stream configs from ${this.stream_config_ur... |
557 | b005db06cbe98c9293d55396a5f8ff67 | swh:1:cnt:f36905d75415c167d0af4e50be7cface5a47602e;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=320-331/ | 6b86e5524aaeb4a8dfd61d07bf8f41b3642aca5a | eventgate-wikimedia | analytics | lib/stream-configs.js | makeStreamConfigs | function | /**
* Returns an initalized StreamConfigs instance.
*
* @param {Object} options
* @param {Object} logger
* @return {StreamConfigs}
*/
async function makeStreamConfigs(options, logger) {
const streamConfigs = new StreamConfigs(options, logger);
await streamConfigs.init();
return streamConfigs;
} |
558 | f24005e85b6cf397a02229799342d965 | swh:1:cnt:f36905d75415c167d0af4e50be7cface5a47602e;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=66-318/ | 6b86e5524aaeb4a8dfd61d07bf8f41b3642aca5a | eventgate-wikimedia | analytics | lib/stream-configs.js | StreamConfigs | type | /**
* A StreamConfigs instance looks up stream configs from a configured URI,
* and provides functions to get config for a specific stream.
* This is its own class, rather than a simple object, so we can
* wrap re-fetching the stream configs after a TTL, as well as handle
* getting configs for a stream by regex pa... |
559 | a0b46d56c1db30ad1e7cbecb489e9f34 | swh:1:cnt:16a522d04794047e3bc5ab735f26a4039df4f54b;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=720-731/ | 120f54a6e01d8fd9c3140adf48788138eba25410 | eventgate-wikimedia | analytics | test/eventgate-wikimedia.js | mockProduceFunction | function | function mockProduceFunction(producerName, topic, partition, message, key, timestamp) {
return Promise.resolve([{
topic,
partition: 0,
offset: 1,
key: key,
opaque: { },
timestamp: timestamp,
size: message.length,
pro... |
560 | 1b9cbf4c0bdf141d0361e5fc5458b507 | swh:1:cnt:c5f4df2b0569fe27737aaf5554ca7f1cd7d00885;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=36-52/ | 441c6b8c88b25bbefe880f9fd1ad2891f7fdf383 | eventgate-wikimedia | analytics | transforms/eventgateWikimediaDefaults.js | makeExtractSchemaUri | function | /**
* Returns a function that extracts the event's schema URI.
*
* @param {Object} options
* @param {string|Array<string>} options.schema_uri_field
* Field(s) used to extract the schema_uri from an event.
* If this is an array, the event will be searched for a field
* named by each element. The fi... |
561 | 5c0b73ef51ce8d0ab4b3c38d808d1c19 | swh:1:cnt:c5f4df2b0569fe27737aaf5554ca7f1cd7d00885;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=119-250/ | 441c6b8c88b25bbefe880f9fd1ad2891f7fdf383 | eventgate-wikimedia | analytics | transforms/eventgateWikimediaDefaults.js | fieldNameToSchemaName | function | /**
* This file contains various functions for configuring and creating the main 'wikimedia'
* EventGate instance. These functions all use a options object
* to make new functions that extract information from events (e.g. schema_uri_field)
* and to create validate and produce functions for constructing the EventGa... |
562 | c73d7f6241246ab1955dbdcd100ccc4d | swh:1:cnt:c5f4df2b0569fe27737aaf5554ca7f1cd7d00885;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=66-117/ | 441c6b8c88b25bbefe880f9fd1ad2891f7fdf383 | eventgate-wikimedia | analytics | transforms/eventgateWikimediaDefaults.js | makeEventRepr | function | /**
* Creates a function that returns a string representation of an event useful for logging.
*
* @param {Object} options
* @param {string} options.id_field
* Used to extract the event's 'id'.
* @param {string} options.schema_uri_field
* Used to extract the event's schema URI.
* @param {string} option... |
563 | bef1f8fc84e795a989c48c970128b533 | swh:1:cnt:c5f4df2b0569fe27737aaf5554ca7f1cd7d00885;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=84-105/ | 441c6b8c88b25bbefe880f9fd1ad2891f7fdf383 | eventgate-wikimedia | analytics | transforms/eventgateWikimediaDefaults.js | makeEventRepr::extractOrElse | function | /**
* Returns f(args), unless an MissingFieldError is thrown, in which case defaultValue
* will be returned.
* eventRepr() should never throw, and it gets called with possibly-incomplete objects
* as part of debug logging, so we need to be defensive here.
*
* @param {Function} f
* @pa... |
564 | a9ebd02ec24a76d728364824d5cd5524 | swh:1:cnt:c5f4df2b0569fe27737aaf5554ca7f1cd7d00885;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=54-64/ | 441c6b8c88b25bbefe880f9fd1ad2891f7fdf383 | eventgate-wikimedia | analytics | transforms/eventgateWikimediaDefaults.js | makeExtractStream | function | /**
* All wikimedia events should have stream_field set. The function
* created by this function returns the value extracted from event at stream_field.
*
* @param {Object} options
* @param {string} options.stream_field
* @return {function(Object, Object): string}
*/
function makeExtractStream(options) {
re... |
565 | 75735fdecc14df77acbfe1dd831cc041 | swh:1:cnt:c5f4df2b0569fe27737aaf5554ca7f1cd7d00885;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=252-261/ | 441c6b8c88b25bbefe880f9fd1ad2891f7fdf383 | eventgate-wikimedia | analytics | transforms/eventgateWikimediaDefaults.js | parentOfField | function | /**
* Given a field name (e.g. `meta.request_id`), returns the name of the parent field
* (e.g. `meta`). Field must be non-empty.
*
* @param {string} field
* @return {string}
*/
function parentOfField(field) {
return field.split('.').slice(0, -1).join('.');
} |
566 | c57ca6c243856e1d1faefdd710d31312 | swh:1:cnt:c5f4df2b0569fe27737aaf5554ca7f1cd7d00885;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=263-273/ | 441c6b8c88b25bbefe880f9fd1ad2891f7fdf383 | eventgate-wikimedia | analytics | transforms/eventgateWikimediaDefaults.js | isCanaryEvent | function | /**
* Returns true if the event is a canary event.
* This is true if meta.domain === 'canary'.
* https://wikitech.wikimedia.org/wiki/Data_Platform/Systems/Hadoop_Event_Ingestion_Lifecycle#Canary_Events
*
* @param {Object} event
* @return {boolean}
*/
function isCanaryEvent(event) {
return _.get(event, 'met... |
567 | 94d7a4c08e5514965357d811e8f6ae7f | swh:1:cnt:c5f4df2b0569fe27737aaf5554ca7f1cd7d00885;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=275-533/ | 441c6b8c88b25bbefe880f9fd1ad2891f7fdf383 | eventgate-wikimedia | analytics | transforms/eventgateWikimediaDefaults.js | makeSetWikimediaDefaults | function | /**
* Makes a function that will set some Wikimedia required fields with
* values if they are not set by the client. These event fields
* will only be set if they are present in the event's schema.
*
* This function will default event[schema_uri_field] and event[stream_field] from
* query parameters. This helps ... |
568 | be791833f061db73fddd74cd85b4529b | swh:1:cnt:c5f4df2b0569fe27737aaf5554ca7f1cd7d00885;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=345-367/ | 441c6b8c88b25bbefe880f9fd1ad2891f7fdf383 | eventgate-wikimedia | analytics | transforms/eventgateWikimediaDefaults.js | makeSetWikimediaDefaults::getClientIp | function | /**
* Given a request object, examines headers and socket remote addrs
* to return a best guest at the requestor's client IP address.
*
* Choices in order of preferences:
* - X-Client-IP header,
* - Leftmost IP in X-Forwarded-For header
* - req.socket.remoteAddress
*
* @para... |
569 | daca3c08e0987f17e1c44110c4da27b2 | swh:1:cnt:26248b97760f5cf89e5cc94963465d46d46713c4;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=5-28/ | d29b91ef2442890c61019ff42fd1c03c3a4fdbb8 | eventgate-wikimedia | analytics | transforms/index.js | getTransformFunctions | function | /**
* Gets transform functions by their filename (without .js).
* The transform functions are expected to be named makeTransformFunction.
* @param {Object} options
* @param {Object} logger
* @param {string[]} transformNames
* @returns {Object} A map of transform filename (without .js) to transform function
*/
... |
570 | 60532531c79d2403d419bb6be369ac9f | swh:1:cnt:26248b97760f5cf89e5cc94963465d46d46713c4;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=30-54/ | d29b91ef2442890c61019ff42fd1c03c3a4fdbb8 | eventgate-wikimedia | analytics | transforms/index.js | makeTransform | function | /**
* Initializes the enabled transforms in the order listed in options.transforms.
*
* @param {Object} options
* @param {Object} logger
* @return {function(Object, Object): Promise<Object>} async (event, context) => ({ event, context })
* A function that applies the enabled transforms to the event and conte... |
571 | a65e91074f34a0f07993c44912c5e20e | swh:1:cnt:5084a636a062e148a05055326eec39105c15ac7e;origin=https://gitlab.wikimedia.org/repos/data-engineering/eventgate-wikimedia.git;lines=15-107/ | 198cf098da4eacea18b6ac867c7b519c9ec41b0d | eventgate-wikimedia | analytics | transforms/processEdgeUniques.js | makeTransformFunction | function | function makeTransformFunction(options, logger) {
return (event, context) => {
if (!context.req) {
logger.warn(
`Cannot augment ${context.eventString} with HTTP request info: ` +
'req was not given in context parameter.'
);
return { event, ... |
572 | 3a85c812a50ed71318a31c12f61fde84 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=293-294/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | VersioneerConfig | type | class VersioneerConfig:
"""Container for Versioneer configuration parameters.""" |
573 | 93b60cb18a11f0f97b781748d7f2289c | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1797-1809/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | get_cmdclass::cmd_build_py | type | class cmd_build_py(_build_py):
def run(self):
root = get_root()
cfg = get_config_from_root(root)
versions = get_versions()
_build_py.run(self)
# now locate _version.py in the new build/ directory and replace
# it with an updated value
... |
574 | 995e48f8b71ee48d78b73870fc4c5066 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1642-1643/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | VersioneerBadRootError | type | class VersioneerBadRootError(Exception):
"""The project root directory is unknown or missing key files.""" |
575 | 24c4da3b7a6e2fea8ce922a917e15242 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1905-1924/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | get_cmdclass::cmd_sdist | type | class cmd_sdist(_sdist):
def run(self):
versions = get_versions()
self._versioneer_generated_versions = versions
# unless we update this, the command will keep using the old
# version
self.distribution.metadata.version = versions["version"]
... |
576 | 2e53a91b90732126d6b597af422de3a4 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1753-1771/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | get_cmdclass::cmd_version | type | class cmd_version(Command):
description = "report generated version string"
user_options = []
boolean_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
vers = get_versions(verbose=True)
... |
577 | fc97020548280451e7ad0d7e16b2f023 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=364-365/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | NotThisMethod | type | class NotThisMethod(Exception):
"""Exception raised if a method is not valid for the current scenario.""" |
578 | 4d9916f1f9a9f5e3f9456a292c006cf2 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1819-1836/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | get_cmdclass::cmd_build_ext | type | class cmd_build_ext(_build_ext):
def run(self):
root = get_root()
cfg = get_config_from_root(root)
versions = get_versions()
_build_ext.run(self)
if self.inplace:
# build_ext --inplace will only build extensions in
# bui... |
579 | 40a2da58f2cae0b648049d894fe8856d | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1875-1894/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | get_cmdclass::cmd_py2exe | type | class cmd_py2exe(_py2exe):
def run(self):
root = get_root()
cfg = get_config_from_root(root)
versions = get_versions()
target_versionfile = cfg.versionfile_source
print("UPDATING %s" % target_versionfile)
write_t... |
580 | c2ce0efdc19623c7688ac9406947bb62 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1842-1868/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | get_cmdclass::cmd_build_exe | type | # nczeczulin reports that py2exe won't like the pep440-style string
# as FILEVERSION, but it can be used for PRODUCTVERSION, e.g.
# setup(console=[{
# "version": versioneer.get_version().split("+", 1)[0], # FILEVERSION
# "product_version": versioneer.get_version(),
# ...
... |
581 | 6ad80a8ccf42ff6c21008d0d3917d816 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=373-379/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | register_vcs_handler(vcs, method) | function | def register_vcs_handler(vcs, method): # decorator
"""Create decorator to mark a method as the handler of a VCS."""
def decorate(f):
"""Store f in HANDLERS[vcs][method]."""
HANDLERS.setdefault(vcs, {})[method] = f
return f
return decorate |
582 | c2b44fee6cc4ac342da4329f9fcb16d0 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1399-1421/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | render_pep440(pieces) | function | def render_pep440(pieces):
"""Build up version string, with post-release "local version identifier".
Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
Exceptions:
1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHE... |
583 | 6810be19af8f1d158eeddd0f70c6e15a | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1454-1461/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | pep440_split_post(ver) | function | def pep440_split_post(ver):
"""Split pep440 version string at the post-release segment.
Returns the release segments before the post-release and the
post-release version number (or -1 if no post-release segment is present).
"""
vc = str.split(ver, ".post")
return vc[0], int(vc[1] or 0) if len(v... |
584 | fcb36ced64896efff6d0e50c488be72d | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1850-1868/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | get_cmdclass::cmd_build_exe::run(self) | function | def run(self):
root = get_root()
cfg = get_config_from_root(root)
versions = get_versions()
target_versionfile = cfg.versionfile_source
print("UPDATING %s" % target_versionfile)
write_to_version_file(target_versionfile, vers... |
585 | bf42006ba941cc2708952bb05ec9e2e6 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1979-2064/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | do_setup() | function | def do_setup():
"""Do main VCS-independent setup function for installing Versioneer."""
root = get_root()
try:
cfg = get_config_from_root(root)
except (OSError, configparser.NoSectionError,
configparser.NoOptionError) as e:
if isinstance(e, (OSError, configparser.NoSectionErr... |
586 | 2b28297d4526449d3ff20ed4ade4171a | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=382-414/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
env=None) | function | def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
env=None):
"""Call the given command(s)."""
assert isinstance(commands, list)
process = None
for command in commands:
try:
dispcmd = str([command] + args)
# remember shell=False, s... |
587 | 33b41790fcf90b00654fd005616f18ae | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=375-378/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | register_vcs_handler::decorate(f) | function | def decorate(f):
"""Store f in HANDLERS[vcs][method]."""
HANDLERS.setdefault(vcs, {})[method] = f
return f |
588 | c1cf2311f683a43f62b1f168197c96ce | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1065-1089/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | git_get_keywords(versionfile_abs) | function | def git_get_keywords(versionfile_abs):
"""Extract version information from the given file."""
# the code embedded in _version.py can just fetch the value of these
# keywords. When used from setup.py, we don't want to import _version.py,
# so we do it with a regexp instead. This function is not used from... |
589 | a1c01441088cf5b1f41028ea5f4a8744 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1093-1153/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | git_versions_from_keywords(keywords, tag_prefix, verbose) | function | def git_versions_from_keywords(keywords, tag_prefix, verbose):
"""Get version information from git keywords."""
if "refnames" not in keywords:
raise NotThisMethod("Short version file found")
date = keywords.get("date")
if date is not None:
# Use only the last line. Previous lines may co... |
590 | db354ab331a725b315310ae35cf97f38 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1157-1282/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command) | function | def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
"""Get version from 'git describe' in the root of the source tree.
This only gets called if the git-archive 'subst' keywords were *not*
expanded, and _version.py hasn't already been rewritten with a short
version string, meaning we... |
591 | f1a6d697a13cc8f4b1270d2cff5cb8d5 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1424-1451/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | render_pep440_branch(pieces) | function | def render_pep440_branch(pieces):
"""TAG[[.dev0]+DISTANCE.gHEX[.dirty]] .
The ".dev0" means not master branch. Note that .dev0 sorts backwards
(a feature branch will appear "older" than the master branch).
Exceptions:
1: no tags. 0[.dev0]+untagged.DISTANCE.gHEX[.dirty]
"""
if pieces["close... |
592 | 1d856fcb1f9eb53dcf3a18709a950438 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1464-1485/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | render_pep440_pre(pieces) | function | def render_pep440_pre(pieces):
"""TAG[.postN.devDISTANCE] -- No -dirty.
Exceptions:
1: no tags. 0.post0.devDISTANCE
"""
if pieces["closest-tag"]:
if pieces["distance"]:
# update the post release segment
tag_version, post_version = pep440_split_post(pieces["closest-ta... |
593 | b897480634b46f8b0ee3bc4b342c876d | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=2067-2101/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | scan_setup_py() | function | def scan_setup_py():
"""Validate the contents of setup.py against Versioneer's expectations."""
found = set()
setters = False
errors = 0
with open("setup.py", "r") as f:
for line in f.readlines():
if "import versioneer" in line:
found.add("import")
if ... |
594 | 0ae49ed29b85fab71a8219d33e09958f | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=336-361/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | get_config_from_root(root) | function | def get_config_from_root(root):
"""Read the project setup.cfg file to determine Versioneer config."""
# This might raise OSError (if setup.cfg is missing), or
# configparser.NoSectionError (if it lacks a [versioneer] section), or
# configparser.NoOptionError (if it lacks "VCS="). See the docstring at
... |
595 | c2c26b7cf4f2b1e97689ffe17871ba76 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1758-1759/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | get_cmdclass::cmd_version::initialize_options(self) | function | def initialize_options(self):
pass |
596 | e3a038af157eecc97b67b181980d0689 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1820-1836/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | get_cmdclass::cmd_build_ext::run(self) | function | def run(self):
root = get_root()
cfg = get_config_from_root(root)
versions = get_versions()
_build_ext.run(self)
if self.inplace:
# build_ext --inplace will only build extensions in
# build/lib<..> dir with no _version.py to wri... |
597 | 14216bd8de64dda1652ee8a2e5202f90 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1876-1894/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | get_cmdclass::cmd_py2exe::run(self) | function | def run(self):
root = get_root()
cfg = get_config_from_root(root)
versions = get_versions()
target_versionfile = cfg.versionfile_source
print("UPDATING %s" % target_versionfile)
write_to_version_file(target_versionfile, vers... |
598 | 86d585aac3bc77634c3804a9a002a21d | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1364-1378/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | versions_from_file(filename) | function | def versions_from_file(filename):
"""Try to determine the version from _version.py if present."""
try:
with open(filename) as f:
contents = f.read()
except OSError:
raise NotThisMethod("unable to read _version.py")
mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_J... |
599 | 1d282ef19c78e94f6cd85b980b4114c6 | swh:1:cnt:1d6cd0796676e39ceb64a1eca3de4a68f1f79c28;origin=https://gitlab.wikimedia.org/repos/data-engineering/conda-pack.git;lines=1761-1762/ | 2b6a520e2d20303fc551d84a0a9b2b550c676698 | conda-pack | analytics | versioneer.py | get_cmdclass::cmd_version::finalize_options(self) | function | def finalize_options(self):
pass |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.