├── twml ├── twml_common │ └── __init__.py ├── twml │ ├── tensorboard │ │ └── __init__.py │ ├── saved_model_cli │ │ ├── __init__.py │ │ └── __main__.py │ ├── contrib │ │ ├── feature_importances │ │ │ └── __init__.py │ │ ├── export │ │ │ └── __init__.py │ │ ├── metrics │ │ │ └── __init__.py │ │ ├── optimizers │ │ │ └── __init__.py │ │ ├── readers │ │ │ ├── batch_prediction_request.py │ │ │ ├── hashed_batch_prediction_request.py │ │ │ ├── __init__.py │ │ │ └── data_record.py │ │ └── trainers │ │ │ └── __init__.py │ ├── tracking │ │ └── __init__.py │ ├── optimizers │ │ └── __init__.py │ ├── readers │ │ ├── batch_prediction_request.py │ │ ├── hashed_batch_prediction_request.py │ │ ├── hashed_data_record.py │ │ └── __init__.py │ ├── summary │ │ └── __init__.py │ ├── filters.py │ ├── errors.py │ ├── trainers │ │ └── __init__.py │ ├── lookup │ │ └── __init__.py │ └── constants.py ├── libtwml │ ├── src │ │ ├── lib │ │ │ ├── CPPLINT.cfg │ │ │ └── internal │ │ │ │ ├── utf_converter.h │ │ │ │ └── linear_search.h │ │ └── ops │ │ │ └── scripts │ │ │ ├── get_inc.sh │ │ │ ├── get_lib.sh │ │ │ ├── get_inc.py │ │ │ └── get_lib.py │ ├── setup.cfg │ ├── BUILD │ └── setup.py └── setup.cfg ├── .gitignore ├── ci └── ci.sh ├── tweetypie ├── server │ ├── config │ │ ├── decider_staging.yml │ │ ├── BUILD │ │ └── logging │ │ │ └── logback-without-loglens.xml │ └── src │ │ └── main │ │ └── scala │ │ └── com │ │ └── twitter │ │ └── tweetypie │ │ ├── core │ │ ├── GeoSearchRequestId.scala │ │ └── package.scala │ │ ├── federated │ │ └── columns │ │ │ ├── FederatedFieldReq.scala │ │ │ └── TweetypieContactInfo.scala │ │ ├── repository │ │ ├── package.scala │ │ └── ConversationMutedRepository.scala │ │ └── service │ │ └── observer │ │ └── package.scala ├── servo │ ├── repo │ │ ├── BUILD │ │ └── src │ │ │ └── main │ │ │ └── thrift │ │ │ └── BUILD │ ├── decider │ │ ├── BUILD │ │ └── src │ │ │ └── main │ │ │ └── scala │ │ │ └── com │ │ │ └── twitter │ │ │ └── servo │ │ │ └── decider │ │ │ ├── DeciderKeyEnum.scala │ │ │ └── package.scala │ ├── request │ │ └── BUILD │ ├── json │ │ └── BUILD │ ├── util │ │ ├── BUILD │ │ └── src │ │ │ └── main │ │ │ └── scala │ │ │ └── com │ │ │ └── twitter │ │ │ └── servo │ │ │ └── util │ │ │ ├── SynchronizedHashMap.scala │ │ │ ├── package.scala │ │ │ └── ThreadLocalStringBuilder.scala │ └── README.md └── common │ └── src │ ├── scala │ └── com │ │ └── twitter │ │ └── tweetypie │ │ ├── media │ │ └── package.scala │ │ ├── util │ │ └── package.scala │ │ ├── decider │ │ └── overrides │ │ │ └── BUILD │ │ ├── storage │ │ └── package.scala │ │ └── thriftscala │ │ └── NotImplementedTweetService.scala │ └── thrift │ └── com │ └── twitter │ └── tweetypie │ └── storage_internal │ └── BUILD ├── trust_and_safety_models └── toxicity │ ├── __init__.py │ ├── data │ └── __init__.py │ ├── optim │ └── __init__.py │ ├── settings │ └── __init__.py │ └── utils │ └── __init__.py ├── pushservice └── src │ └── main │ ├── python │ └── models │ │ ├── libs │ │ └── __init__.py │ │ ├── heavy_ranking │ │ └── __init__.py │ │ └── light_ranking │ │ └── __init__.py │ └── scala │ └── com │ └── twitter │ └── frigate │ └── pushservice │ ├── params │ └── ShardParams.scala │ ├── exception │ ├── TweetNTabRequestHydratorException.scala │ ├── UnsupportedCrtException.scala │ ├── DisplayLocationNotSupportedException.scala │ └── InvalidSportDomainException.scala │ ├── util │ └── FunctionalUtil.scala │ ├── target │ └── TargetAppPermissions.scala │ ├── model │ └── ntab │ │ └── NTabRequest.scala │ └── take │ └── predicates │ └── BasicRFPHPredicates.scala ├── ann └── src │ └── main │ ├── java │ └── com │ │ └── twitter │ │ └── ann │ │ ├── faiss │ │ ├── swig │ │ │ └── resources │ │ │ │ ├── .gitkeep │ │ │ │ ├── .gitignore │ │ │ │ └── BUILD │ │ └── BUILD │ │ └── hnsw │ │ ├── DistanceFunction.java │ │ └── IllegalDuplicateInsertException.java │ ├── scala │ └── com │ │ └── twitter │ │ └── ann │ │ ├── dataflow │ │ └── offline │ │ │ ├── BaseEmbeddingData.scala │ │ │ ├── FlatEmbeddingData.scala │ │ │ └── GroupedEmbeddingData.scala │ │ ├── scalding │ │ └── offline │ │ │ └── README │ │ ├── util │ │ └── BUILD │ │ ├── featurestore │ │ └── BUILD │ │ ├── service │ │ └── query_server │ │ │ └── common │ │ │ ├── QueryableProvider.scala │ │ │ └── warmup │ │ │ └── BUILD │ │ └── manhattan │ │ └── README │ ├── thrift │ └── com │ │ └── twitter │ │ └── ann │ │ ├── knn │ │ └── BUILD │ │ └── serialization │ │ ├── serialization.thrift │ │ └── BUILD │ └── python │ └── dataflow │ ├── worker_harness │ └── cloudbuild.yml │ └── bq.sql ├── src ├── python │ └── twitter │ │ └── deepbird │ │ └── projects │ │ └── timelines │ │ └── scripts │ │ └── models │ │ └── earlybird │ │ ├── __init__.py │ │ ├── lolly │ │ ├── __init__.py │ │ └── reader.py │ │ ├── tf_model │ │ ├── __init__.py │ │ └── BUILD │ │ └── earlybird_features.png ├── scala │ └── com │ │ └── twitter │ │ ├── simclusters_v2 │ │ ├── scio │ │ │ └── bq_generation │ │ │ │ ├── sql │ │ │ │ └── BUILD │ │ │ │ ├── ftr_tweet │ │ │ │ └── sql │ │ │ │ │ └── BUILD │ │ │ │ └── common │ │ │ │ └── BUILD │ │ ├── images │ │ │ ├── knownfor.png │ │ │ ├── interestedin.png │ │ │ ├── bipartite_graph.png │ │ │ ├── topic_embeddings.png │ │ │ ├── producer_embeddings.png │ │ │ └── producer_producer_similarity.png │ │ ├── scalding │ │ │ ├── common │ │ │ │ └── matrix │ │ │ │ │ └── BUILD │ │ │ ├── offline_job │ │ │ │ └── adhoc │ │ │ │ │ └── README │ │ │ └── embedding │ │ │ │ └── tfg │ │ │ │ └── README │ │ ├── summingbird │ │ │ ├── README.md │ │ │ └── common │ │ │ │ └── SimClustersHashUtil.scala │ │ └── score │ │ │ └── BUILD │ │ ├── interaction_graph │ │ ├── bqe │ │ │ ├── training │ │ │ │ └── check_labels_exist.sql │ │ │ └── scoring │ │ │ │ └── check_models.sql │ │ └── scio │ │ │ └── README.md │ │ ├── timelines │ │ └── prediction │ │ │ ├── features │ │ │ ├── ppmi │ │ │ │ ├── BUILD │ │ │ │ └── PpmiFeatures.scala │ │ │ ├── followsource │ │ │ │ └── BUILD.bazel │ │ │ ├── itl │ │ │ │ └── BUILD │ │ │ ├── recap │ │ │ │ └── BUILD │ │ │ ├── list_features │ │ │ │ └── BUILD │ │ │ ├── p_home_latest │ │ │ │ └── BUILD │ │ │ ├── request_context │ │ │ │ └── BUILD │ │ │ ├── time_features │ │ │ │ └── BUILD │ │ │ ├── user_health │ │ │ │ └── BUILD │ │ │ └── two_hop_features │ │ │ │ └── BUILD │ │ │ └── common │ │ │ └── aggregates │ │ │ └── real_time │ │ │ ├── TimelinesOnlineAggregationSources.scala │ │ │ └── TypeSafeRunner.scala │ │ └── recos │ │ ├── decider │ │ └── BUILD │ │ ├── user_tweet_graph │ │ └── store │ │ │ └── BUILD │ │ ├── user_video_graph │ │ └── store │ │ │ └── BUILD │ │ └── graph_common │ │ └── BUILD ├── java │ └── com │ │ └── twitter │ │ └── search │ │ ├── common │ │ ├── README.md │ │ ├── search │ │ │ ├── QueryCostProvider.java │ │ │ └── DocIdTracker.java │ │ ├── relevance │ │ │ └── features │ │ │ │ └── QueryFeatureType.java │ │ └── query │ │ │ ├── CollectVariantVisitor.java │ │ │ └── HitAttributeProvider.java │ │ ├── img │ │ ├── foryou.png │ │ ├── indexing.png │ │ ├── serving.png │ │ ├── in-network.png │ │ └── top-search.png │ │ ├── earlybird │ │ ├── CONFIG.ini │ │ ├── exception │ │ │ ├── MissingUserException.java │ │ │ ├── EarlybirdRuntimeException.java │ │ │ ├── ClientException.java │ │ │ ├── BadRequestException.java │ │ │ ├── MissingKafkaTopicException.java │ │ │ └── TransientException.java │ │ ├── EarlybirdMain.java │ │ ├── archive │ │ │ └── segmentbuilder │ │ │ │ ├── SegmentBuilderMain.java │ │ │ │ ├── SegmentUpdaterException.java │ │ │ │ └── SegmentInfoConstructionException.java │ │ ├── util │ │ │ └── CoordinatedEarlybirdActionLockFailed.java │ │ ├── segment │ │ │ └── SegmentProvider.java │ │ └── QualityFactor.java │ │ ├── earlybird_root │ │ ├── img │ │ │ └── serving.png │ │ ├── config │ │ │ └── BUILD.bazel │ │ ├── validators │ │ │ ├── BUILD │ │ │ └── ServiceResponseValidator.java │ │ ├── filters │ │ │ ├── PostCacheRequestTypeCountFilter.java │ │ │ └── PreCacheRequestTypeCountFilter.java │ │ ├── common │ │ │ └── InjectionNames.java │ │ └── collectors │ │ │ └── BUILD │ │ ├── ingester │ │ ├── pipeline │ │ │ ├── util │ │ │ │ ├── PipelineV2CreationException.java │ │ │ │ ├── PipelineStageRuntimeException.java │ │ │ │ └── ResponseNotReturnedException.java │ │ │ └── twitter │ │ │ │ └── thriftparse │ │ │ │ └── ThriftTweetParsingException.java │ │ ├── util │ │ │ └── jndi │ │ │ │ └── BUILD │ │ └── model │ │ │ └── IndexerStatus.java │ │ ├── core │ │ └── earlybird │ │ │ └── index │ │ │ └── column │ │ │ └── DocValuesUpdate.java │ │ └── feature_update_service │ │ ├── README.md │ │ └── stats │ │ └── BUILD └── thrift │ └── com │ └── twitter │ └── recos │ ├── user_user_graph │ └── CONFIG.ini │ ├── user_tweet_graph │ └── CONFIG.ini │ ├── user_video_graph │ └── CONFIG.ini │ └── user_tweet_entity_graph │ └── CONFIG.ini ├── unified_user_actions ├── .gitignore ├── BUILD.bazel ├── enricher │ ├── BUILD.bazel │ └── src │ │ ├── test │ │ └── resources │ │ │ └── BUILD.bazel │ │ └── main │ │ └── scala │ │ └── com │ │ └── twitter │ │ └── unified_user_actions │ │ └── enricher │ │ ├── BUILD │ │ └── hcache │ │ └── BUILD ├── kafka │ └── src │ │ └── test │ │ └── resources │ │ └── BUILD.bazel ├── service │ └── src │ │ ├── test │ │ └── resources │ │ │ ├── BUILD.bazel │ │ │ └── decider.yml │ │ └── main │ │ ├── resources │ │ └── BUILD │ │ └── scala │ │ └── com │ │ └── twitter │ │ └── unified_user_actions │ │ └── service │ │ └── module │ │ └── TopicsMapping.scala ├── adapter │ └── src │ │ └── main │ │ └── scala │ │ └── com │ │ └── twitter │ │ └── unified_user_actions │ │ └── adapter │ │ ├── common │ │ └── BUILD │ │ └── BUILD └── graphql │ ├── README.md │ └── TweetHydration.graphql ├── docs └── system-diagram.png ├── navi ├── thrift_bpr_adapter │ └── thrift │ │ ├── src │ │ └── lib.rs │ │ └── Cargo.toml ├── segdense │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── dr_transform │ └── src │ │ └── lib.rs └── navi │ ├── proto │ ├── tensorflow │ │ └── core │ │ │ ├── framework │ │ │ └── dataset_metadata.proto │ │ │ └── protobuf │ │ │ ├── transport_options.proto │ │ │ └── status.proto │ └── tensorflow_serving │ │ ├── config │ │ └── log_collector_config.proto │ │ └── apis │ │ └── model_management.proto │ └── scripts │ └── run_tf2.sh ├── simclusters-ann ├── BUILD.bazel └── server │ └── src │ └── main │ ├── resources │ └── BUILD │ └── scala │ └── com │ └── twitter │ └── simclustersann │ ├── common │ └── BUILD │ └── exceptions │ └── MissingClusterConfigForSimClustersAnnVariantException.scala ├── representation-manager ├── BUILD.bazel ├── server │ └── src │ │ └── main │ │ ├── resources │ │ └── BUILD │ │ └── scala │ │ └── com │ │ └── twitter │ │ └── representation_manager │ │ └── columns │ │ └── BUILD ├── bin │ └── deploy.sh └── README.md ├── representation-scorer ├── BUILD.bazel ├── bin │ ├── deploy.sh │ └── canary-check.sh └── server │ └── src │ └── main │ ├── scala │ └── com │ │ └── twitter │ │ └── representationscorer │ │ ├── common │ │ ├── package.scala │ │ ├── BUILD │ │ └── DeciderConstants.scala │ │ └── twistlyfeatures │ │ └── ScoreResult.scala │ └── resources │ └── BUILD ├── timelineranker ├── server │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── BUILD.bazel │ │ │ └── scala │ │ │ └── com │ │ │ └── twitter │ │ │ └── timelineranker │ │ │ ├── recap │ │ │ └── BUILD │ │ │ ├── decider │ │ │ └── BUILD │ │ │ ├── core │ │ │ └── HydratedTweets.scala │ │ │ ├── config │ │ │ ├── StagingUnderlyingConfiguration.scala │ │ │ └── TimelineRankerConstants.scala │ │ │ ├── parameters │ │ │ └── monitoring │ │ │ │ ├── BUILD │ │ │ │ └── MonitoringParams.scala │ │ │ └── contentfeatures │ │ │ └── package.scala │ └── config │ │ └── BUILD ├── client │ └── builder │ │ ├── BUILD │ │ └── README.md └── common │ ├── src │ └── main │ │ └── scala │ │ ├── BUILD │ │ └── com │ │ └── twitter │ │ └── timelineranker │ │ └── model │ │ └── UtegLikedByTweetsOptions.scala │ └── BUILD ├── recos-injector ├── BUILD.bazel ├── CONFIG.ini └── server │ ├── config │ └── change_log_config.ini │ └── src │ └── main │ └── scala │ └── com │ └── twitter │ └── recosinjector │ ├── decider │ └── BUILD │ └── filters │ └── BUILD ├── follow-recommendations-service ├── FRS_architecture.png ├── common │ └── src │ │ └── main │ │ └── scala │ │ └── com │ │ └── twitter │ │ └── follow_recommendations │ │ └── common │ │ ├── candidate_sources │ │ ├── promoted_accounts │ │ │ └── README.md │ │ ├── stp │ │ │ └── img.png │ │ ├── top_organic_follows_accounts │ │ │ └── README.md │ │ ├── recent_engagement │ │ │ └── README.md │ │ └── addressbook │ │ │ └── README.md │ │ ├── models │ │ ├── HasTopicId.scala │ │ ├── HasProfileId.scala │ │ ├── HasScores.scala │ │ ├── HasIsSoftUser.scala │ │ ├── UserIdAndTimestamp.scala │ │ ├── HasQualityFactor.scala │ │ ├── HasByfSeedUserIds.scala │ │ ├── HasDisplayLocation.scala │ │ ├── HasEngagements.scala │ │ ├── GeohashAndCountryCode.scala │ │ ├── TweetCandidate.scala │ │ ├── HasGeohashAndCountryCode.scala │ │ ├── HasRecentlyEngagedUserIds.scala │ │ ├── HasRecommendationFlowIdentifier.scala │ │ ├── HasInfoPerRankingStage.scala │ │ ├── HasUserState.scala │ │ ├── HasExcludedUserIds.scala │ │ ├── HasDismissedUserIds.scala │ │ ├── HasSimilarToContext.scala │ │ ├── HasInvalidRelationshipUserIds.scala │ │ ├── HasInterestIds.scala │ │ └── WtfImpression.scala │ │ ├── rankers │ │ ├── weighted_candidate_source_ranker │ │ │ └── WeightMethod.scala │ │ ├── utils │ │ │ └── BUILD │ │ ├── interleave_ranker │ │ │ └── InterleaveRankerParams.scala │ │ └── common │ │ │ └── BUILD │ │ ├── transforms │ │ └── dedup │ │ │ └── BUILD │ │ ├── constants │ │ └── BUILD │ │ └── features │ │ └── UserStateFeature.scala ├── server │ └── src │ │ └── main │ │ └── scala │ │ └── com │ │ └── twitter │ │ └── follow_recommendations │ │ ├── models │ │ ├── CandidateUserDebugParams.scala │ │ ├── failures │ │ │ └── BUILD │ │ └── CandidateSourceType.scala │ │ ├── configapi │ │ ├── common │ │ │ └── BUILD │ │ └── deciders │ │ │ ├── DeciderParams.scala │ │ │ └── BUILD │ │ ├── products │ │ ├── sidebar │ │ │ └── configapi │ │ │ │ ├── BUILD │ │ │ │ └── SidebarParams.scala │ │ ├── home_timeline_tweet_recs │ │ │ └── configapi │ │ │ │ └── HomeTimelineTweetRecsParams.scala │ │ ├── explore_tab │ │ │ └── configapi │ │ │ │ └── BUILD │ │ └── home_timeline │ │ │ └── configapi │ │ │ └── BUILD │ │ └── assembler │ │ └── models │ │ ├── Title.scala │ │ ├── Header.scala │ │ ├── Footer.scala │ │ ├── Action.scala │ │ ├── Config.scala │ │ └── RecommendationOptions.scala └── thrift │ └── src │ └── main │ └── thrift │ ├── engagementType.thrift │ └── logging │ ├── engagementType.thrift │ └── debug.thrift ├── timelines └── data_processing │ ├── ml_util │ └── aggregation_framework │ │ ├── docs │ │ ├── AUTOMATED_COMMIT_FILES │ │ └── index.rst │ │ ├── AggregateStore.scala │ │ ├── AggregationConfig.scala │ │ ├── metrics │ │ └── ConversionUtils.scala │ │ ├── heron │ │ ├── package.scala │ │ └── OnlineAggregationStoresTrait.scala │ │ └── AggregateSource.scala │ └── ad_hoc │ └── earlybird_ranking │ └── earlybird_ranking │ └── BUILD ├── user-signal-service └── server │ └── src │ └── main │ └── resources │ ├── BUILD │ └── config │ └── decider.yml ├── product-mixer ├── core │ └── src │ │ └── main │ │ ├── scala │ │ └── com │ │ │ └── twitter │ │ │ └── product_mixer │ │ │ └── core │ │ │ ├── service │ │ │ ├── ExecutorResult.scala │ │ │ ├── gate_executor │ │ │ │ ├── GateExecutorResult.scala │ │ │ │ └── ExecutedGateResult.scala │ │ │ ├── pipeline_execution_logger │ │ │ │ └── PipelineExecutionLogger.scala │ │ │ ├── pipeline_selector_executor │ │ │ │ └── PipelineSelectorExecutorResult.scala │ │ │ ├── pipeline_executor │ │ │ │ └── PipelineExecutorResult.scala │ │ │ └── candidate_decorator_executor │ │ │ │ └── CandidateDecoratorExecutorResult.scala │ │ │ ├── model │ │ │ ├── marshalling │ │ │ │ ├── HasMarshalling.scala │ │ │ │ ├── response │ │ │ │ │ ├── urt │ │ │ │ │ │ ├── Cover.scala │ │ │ │ │ │ ├── metadata │ │ │ │ │ │ │ ├── Callback.scala │ │ │ │ │ │ │ ├── DismissInfo.scala │ │ │ │ │ │ │ ├── LiveEventDetails.scala │ │ │ │ │ │ │ ├── PinnableEntry.scala │ │ │ │ │ │ │ ├── ArticleDetails.scala │ │ │ │ │ │ │ ├── ConversationDetails.scala │ │ │ │ │ │ │ ├── ReplaceableEntry.scala │ │ │ │ │ │ │ ├── ImageAnimationType.scala │ │ │ │ │ │ │ ├── TimelinesDetails.scala │ │ │ │ │ │ │ ├── MarkUnreadableEntry.scala │ │ │ │ │ │ │ ├── ConfirmationDisplayType.scala │ │ │ │ │ │ │ ├── CommerceDetails.scala │ │ │ │ │ │ │ ├── ImageDisplayType.scala │ │ │ │ │ │ │ ├── ReplyPinState.scala │ │ │ │ │ │ │ ├── Badge.scala │ │ │ │ │ │ │ ├── ImageVariant.scala │ │ │ │ │ │ │ └── ConversationSection.scala │ │ │ │ │ │ ├── media │ │ │ │ │ │ │ ├── MediaKey.scala │ │ │ │ │ │ │ ├── AspectRatio.scala │ │ │ │ │ │ │ ├── Rect.scala │ │ │ │ │ │ │ └── Media.scala │ │ │ │ │ │ ├── item │ │ │ │ │ │ │ ├── tweet │ │ │ │ │ │ │ │ └── TimelinesScoreInfo.scala │ │ │ │ │ │ │ ├── highlight │ │ │ │ │ │ │ │ └── HighlightedSection.scala │ │ │ │ │ │ │ ├── message │ │ │ │ │ │ │ │ ├── MessageTextAction.scala │ │ │ │ │ │ │ │ ├── MessageActionType.scala │ │ │ │ │ │ │ │ ├── MessageImage.scala │ │ │ │ │ │ │ │ └── UserFacepileDisplayType.scala │ │ │ │ │ │ │ ├── article │ │ │ │ │ │ │ │ └── ArticleDisplayType.scala │ │ │ │ │ │ │ ├── thread │ │ │ │ │ │ │ │ └── ThreadHeaderContent.scala │ │ │ │ │ │ │ ├── generic_summary │ │ │ │ │ │ │ │ └── GenericSummaryDisplayType.scala │ │ │ │ │ │ │ ├── user │ │ │ │ │ │ │ │ ├── UserReactiveTriggers.scala │ │ │ │ │ │ │ │ └── UserDisplayType.scala │ │ │ │ │ │ │ ├── label │ │ │ │ │ │ │ │ └── LabelDisplayType.scala │ │ │ │ │ │ │ ├── tweet_composer │ │ │ │ │ │ │ │ └── TweetComposerDisplayType.scala │ │ │ │ │ │ │ ├── card │ │ │ │ │ │ │ │ └── CardDisplayType.scala │ │ │ │ │ │ │ ├── conversation_annotation │ │ │ │ │ │ │ │ └── ConversationAnnotationType.scala │ │ │ │ │ │ │ ├── tombstone │ │ │ │ │ │ │ │ └── TombstoneInfo.scala │ │ │ │ │ │ │ ├── topic │ │ │ │ │ │ │ │ └── TopicFollowPromptDisplayType.scala │ │ │ │ │ │ │ ├── forward_pivot │ │ │ │ │ │ │ │ └── ForwardPivotDisplayType.scala │ │ │ │ │ │ │ └── vertical_grid_item │ │ │ │ │ │ │ │ └── VerticalGridItemTileStyle.scala │ │ │ │ │ │ ├── color │ │ │ │ │ │ │ ├── ColorPalette.scala │ │ │ │ │ │ │ ├── Color.scala │ │ │ │ │ │ │ └── BUILD │ │ │ │ │ │ ├── timeline_module │ │ │ │ │ │ │ ├── AdsMetadata.scala │ │ │ │ │ │ │ ├── GridCarouselMetadata.scala │ │ │ │ │ │ │ ├── ModuleFooter.scala │ │ │ │ │ │ │ ├── ModuleShowMoreBehavior.scala │ │ │ │ │ │ │ └── ModuleHeaderDisplayType.scala │ │ │ │ │ │ ├── alert │ │ │ │ │ │ │ ├── ShowAlertNavigationMetadata.scala │ │ │ │ │ │ │ ├── ShowAlertIcon.scala │ │ │ │ │ │ │ ├── ShowAlertType.scala │ │ │ │ │ │ │ ├── ShowAlertDisplayLocation.scala │ │ │ │ │ │ │ ├── ShowAlertIconDisplayInfo.scala │ │ │ │ │ │ │ └── ShowAlertColorConfiguration.scala │ │ │ │ │ │ ├── ReaderModeConfig.scala │ │ │ │ │ │ ├── promoted │ │ │ │ │ │ │ ├── CallToAction.scala │ │ │ │ │ │ │ ├── PrerollMetadata.scala │ │ │ │ │ │ │ ├── VideoVariant.scala │ │ │ │ │ │ │ ├── Preroll.scala │ │ │ │ │ │ │ ├── DisclaimerType.scala │ │ │ │ │ │ │ ├── UrlOverrideType.scala │ │ │ │ │ │ │ ├── BUILD │ │ │ │ │ │ │ ├── ClickTrackingInfo.scala │ │ │ │ │ │ │ ├── DynamicPrerollType.scala │ │ │ │ │ │ │ ├── DisclosureType.scala │ │ │ │ │ │ │ └── SponsorshipType.scala │ │ │ │ │ │ ├── cover │ │ │ │ │ │ │ ├── FullCoverDisplayType.scala │ │ │ │ │ │ │ └── HalfCoverDisplayType.scala │ │ │ │ │ │ ├── TimelineScribeConfig.scala │ │ │ │ │ │ ├── operation │ │ │ │ │ │ │ └── CursorDisplayTreatment.scala │ │ │ │ │ │ ├── reaction │ │ │ │ │ │ │ ├── TimelineReaction.scala │ │ │ │ │ │ │ └── BUILD │ │ │ │ │ │ ├── contextual_ref │ │ │ │ │ │ │ ├── ContextualTweetRef.scala │ │ │ │ │ │ │ ├── OuterTweetContext.scala │ │ │ │ │ │ │ └── TweetHydrationContext.scala │ │ │ │ │ │ ├── HasSortIndex.scala │ │ │ │ │ │ ├── richtext │ │ │ │ │ │ │ ├── RichTextAlignment.scala │ │ │ │ │ │ │ ├── RichText.scala │ │ │ │ │ │ │ ├── RichTextEntity.scala │ │ │ │ │ │ │ ├── BUILD │ │ │ │ │ │ │ └── RichTextFormat.scala │ │ │ │ │ │ ├── TimelineMetadata.scala │ │ │ │ │ │ ├── icon │ │ │ │ │ │ │ └── BUILD │ │ │ │ │ │ └── HasExpirationTime.scala │ │ │ │ │ └── urp │ │ │ │ │ │ ├── TopicPageHeaderFacepile.scala │ │ │ │ │ │ ├── TopicPageHeaderDisplayType.scala │ │ │ │ │ │ └── PageBody.scala │ │ │ │ ├── request │ │ │ │ │ ├── ProductContext.scala │ │ │ │ │ ├── HasExcludedIds.scala │ │ │ │ │ ├── Request.scala │ │ │ │ │ └── DebugParams.scala │ │ │ │ └── BUILD │ │ │ └── common │ │ │ │ ├── presentation │ │ │ │ ├── ModulePresentation.scala │ │ │ │ ├── ItemPresentation.scala │ │ │ │ ├── slice │ │ │ │ │ └── BaseSliceItemPresentation.scala │ │ │ │ └── urt │ │ │ │ │ ├── BaseUrtItemPresentation.scala │ │ │ │ │ └── BaseUrtModulePresentation.scala │ │ │ │ └── UniversalNoun.scala │ │ │ ├── pipeline │ │ │ ├── state │ │ │ │ ├── HasParams.scala │ │ │ │ ├── HasRequest.scala │ │ │ │ ├── HasQuery.scala │ │ │ │ ├── HasCandidates.scala │ │ │ │ ├── HasAsyncFeatureMap.scala │ │ │ │ └── HasResult.scala │ │ │ ├── product │ │ │ │ └── ProductPipelineRequest.scala │ │ │ ├── CandidatePipelineFeatures.scala │ │ │ └── InvalidStepStateException.scala │ │ │ ├── controllers │ │ │ └── QualityFactorMonitoringConfig.scala │ │ │ ├── functional_component │ │ │ ├── filter │ │ │ │ └── FilterResult.scala │ │ │ ├── gate │ │ │ │ └── ShouldContinue.scala │ │ │ ├── candidate_source │ │ │ │ └── strato │ │ │ │ │ └── StratoKeyView.scala │ │ │ ├── access_policy │ │ │ │ └── BUILD │ │ │ ├── configapi │ │ │ │ ├── registry │ │ │ │ │ └── GlobalParamConfig.scala │ │ │ │ └── StaticParam.scala │ │ │ └── common │ │ │ │ └── alert │ │ │ │ └── predicate │ │ │ │ └── BUILD │ │ │ └── feature │ │ │ └── BUILD │ │ └── java │ │ └── com │ │ └── twitter │ │ └── product_mixer │ │ └── core │ │ └── product │ │ └── guice │ │ └── scope │ │ └── BUILD ├── shared-library │ └── src │ │ └── main │ │ └── scala │ │ └── com │ │ └── twitter │ │ └── product_mixer │ │ └── shared_library │ │ └── http_client │ │ └── HttpHostPort.scala └── component-library │ └── src │ └── main │ └── scala │ └── com │ └── twitter │ └── product_mixer │ └── component_library │ ├── selector │ └── sorter │ │ └── SortOrder.scala │ ├── candidate_source │ └── social_graph │ │ └── SocialgraphCursorConstants.scala │ ├── decorator │ └── urt │ │ └── builder │ │ └── richtext │ │ └── twitter_text │ │ └── TwitterTextRendererProcessor.scala │ └── experiments │ └── metrics │ └── BUILD ├── visibilitylib └── src │ └── main │ ├── scala │ └── com │ │ └── twitter │ │ └── visibility │ │ ├── models │ │ ├── MutedKeyword.scala │ │ ├── package.scala │ │ ├── SemanticCoreAnnotation.scala │ │ ├── TweetDeleteReason.scala │ │ └── SafetyLabelType.scala │ │ ├── rules │ │ ├── package.scala │ │ ├── generators │ │ │ └── RuleGenerator.scala │ │ └── providers │ │ │ └── PolicyProvider.scala │ │ ├── interfaces │ │ ├── search │ │ │ ├── BatchSearchVisibilityResponse.scala │ │ │ ├── CombinedVisibilityResult.scala │ │ │ ├── TweetContext.scala │ │ │ └── BatchSearchVisibilityRequest.scala │ │ ├── blender │ │ │ └── CombinedVisibilityResult.scala │ │ ├── conversations │ │ │ └── TimelineConversationsVisibilityResponse.scala │ │ ├── dms │ │ │ ├── DmEventVisibilityRequest.scala │ │ │ └── DmConversationVisibilityRequest.scala │ │ ├── notifications │ │ │ └── NotificationVFRequest.scala │ │ ├── spaces │ │ │ └── SpaceVisibilityRequest.scala │ │ └── media │ │ │ └── MediaVisibilityRequest.scala │ │ ├── util │ │ └── NamingUtils.scala │ │ ├── configapi │ │ └── configs │ │ │ └── overrides │ │ │ └── BUILD │ │ └── features │ │ └── Feature.scala │ └── resources │ └── config │ └── BUILD ├── cr-mixer └── server │ └── src │ └── main │ ├── resources │ └── BUILD.bazel │ └── scala │ └── com │ └── twitter │ └── cr_mixer │ ├── exception │ ├── InvalidSANNConfigException.scala │ └── BUILD │ └── model │ ├── TweetWithAuthor.scala │ ├── TweetWithScore.scala │ ├── HealthThreshold.scala │ └── EarlybirdSimilarityEngineType.scala ├── topic-social-proof └── server │ └── src │ └── main │ └── resources │ └── BUILD ├── home-mixer └── server │ └── src │ └── main │ └── scala │ └── com │ └── twitter │ └── home_mixer │ ├── module │ └── HomeMixerResourcesModule.scala │ ├── util │ ├── MissingKeyException.scala │ └── tweetypie │ │ └── BUILD.bazel │ ├── model │ └── request │ │ ├── HasListId.scala │ │ ├── HomeMixerDebugOptions.scala │ │ └── HasSeenTweetIds.scala │ ├── product │ ├── for_you │ │ ├── model │ │ │ └── ForYouTweetsResponse.scala │ │ └── scorer │ │ │ └── BUILD.bazel │ ├── scored_tweets │ │ └── model │ │ │ └── ScoredTweetsResponse.scala │ └── HomeMixerProductModule.scala │ └── param │ ├── decider │ └── BUILD.bazel │ ├── BUILD.bazel │ └── GlobalParamConfigModule.scala ├── graph-feature-service ├── src │ └── main │ │ ├── scala │ │ └── com │ │ │ └── twitter │ │ │ └── graph_feature_service │ │ │ ├── common │ │ │ └── BUILD.bazel │ │ │ └── util │ │ │ └── BUILD │ │ └── scalding │ │ └── com │ │ └── twitter │ │ └── graph_feature_service │ │ └── scalding │ │ └── EdgeFeature.scala └── README.md └── science └── search └── ingester └── config └── README.md /twml/twml_common/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | -------------------------------------------------------------------------------- /twml/twml/tensorboard/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ci/ci.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /twml/twml/saved_model_cli/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tweetypie/server/config/decider_staging.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /trust_and_safety_models/toxicity/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pushservice/src/main/python/models/libs/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /trust_and_safety_models/toxicity/data/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /trust_and_safety_models/toxicity/optim/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /trust_and_safety_models/toxicity/settings/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /trust_and_safety_models/toxicity/utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /twml/twml/contrib/feature_importances/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ann/src/main/java/com/twitter/ann/faiss/swig/resources/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pushservice/src/main/python/models/heavy_ranking/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pushservice/src/main/python/models/light_ranking/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /twml/libtwml/src/lib/CPPLINT.cfg: -------------------------------------------------------------------------------- 1 | exclude_files=murmur_hash3.cpp -------------------------------------------------------------------------------- /src/python/twitter/deepbird/projects/timelines/scripts/models/earlybird/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /unified_user_actions/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | CONFIG.ini 3 | PROJECT 4 | docs 5 | -------------------------------------------------------------------------------- /src/python/twitter/deepbird/projects/timelines/scripts/models/earlybird/lolly/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/python/twitter/deepbird/projects/timelines/scripts/models/earlybird/tf_model/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/system-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/docs/system-diagram.png -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/scio/bq_generation/sql/BUILD: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = ["*"], 3 | ) 4 | -------------------------------------------------------------------------------- /navi/thrift_bpr_adapter/thrift/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod prediction_service; 2 | pub mod data; 3 | pub mod tensor; 4 | 5 | -------------------------------------------------------------------------------- /twml/twml/contrib/export/__init__.py: -------------------------------------------------------------------------------- 1 | from . import export_fn # noqa: F401 2 | from . import exporters # noqa: F401 3 | -------------------------------------------------------------------------------- /simclusters-ann/BUILD.bazel: -------------------------------------------------------------------------------- 1 | # This prevents SQ query from grabbing //:all since it traverses up once to find a BUILD 2 | -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/scio/bq_generation/ftr_tweet/sql/BUILD: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = ["*"], 3 | ) 4 | -------------------------------------------------------------------------------- /representation-manager/BUILD.bazel: -------------------------------------------------------------------------------- 1 | # This prevents SQ query from grabbing //:all since it traverses up once to find a BUILD 2 | -------------------------------------------------------------------------------- /representation-scorer/BUILD.bazel: -------------------------------------------------------------------------------- 1 | # This prevents SQ query from grabbing //:all since it traverses up once to find a BUILD 2 | -------------------------------------------------------------------------------- /timelineranker/server/src/main/resources/BUILD.bazel: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = [ 3 | "*.xml", 4 | ], 5 | ) 6 | -------------------------------------------------------------------------------- /unified_user_actions/BUILD.bazel: -------------------------------------------------------------------------------- 1 | # This prevents SQ query from grabbing //:all since it traverses up once to find a BUILD 2 | -------------------------------------------------------------------------------- /recos-injector/BUILD.bazel: -------------------------------------------------------------------------------- 1 | # This prevents SQ query from grabbing //:all since it traverses up once to find a BUILD (DPB-14048) 2 | -------------------------------------------------------------------------------- /tweetypie/servo/repo/BUILD: -------------------------------------------------------------------------------- 1 | target( 2 | dependencies = [ 3 | "tweetypie/servo/repo/src/main/scala", 4 | ], 5 | ) 6 | -------------------------------------------------------------------------------- /twml/libtwml/src/ops/scripts/get_inc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PEX_INTERPRETER=1 "$PYTHON_ENV" "$LIBTWML_HOME"/src/ops/scripts/get_inc.py 3 | -------------------------------------------------------------------------------- /twml/libtwml/src/ops/scripts/get_lib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PEX_INTERPRETER=1 "$PYTHON_ENV" "$LIBTWML_HOME"/src/ops/scripts/get_lib.py 3 | -------------------------------------------------------------------------------- /twml/setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal=1 3 | 4 | [build] 5 | build-lib=build_dir 6 | 7 | [bdist] 8 | bdist-base=build_dir 9 | -------------------------------------------------------------------------------- /navi/segdense/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod error; 2 | pub mod mapper; 3 | pub mod segdense_transform_spec_home_recap_2022; 4 | pub mod util; 5 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/common/README.md: -------------------------------------------------------------------------------- 1 | Contains code that is common to multiple earlybird services (ingesters, roots and earlybird). -------------------------------------------------------------------------------- /tweetypie/servo/decider/BUILD: -------------------------------------------------------------------------------- 1 | target( 2 | dependencies = [ 3 | "tweetypie/servo/decider/src/main/scala", 4 | ], 5 | ) 6 | -------------------------------------------------------------------------------- /tweetypie/servo/request/BUILD: -------------------------------------------------------------------------------- 1 | target( 2 | dependencies = [ 3 | "tweetypie/servo/request/src/main/scala", 4 | ], 5 | ) 6 | -------------------------------------------------------------------------------- /unified_user_actions/enricher/BUILD.bazel: -------------------------------------------------------------------------------- 1 | # This prevents SQ query from grabbing //:all since it traverses up once to find a BUILD 2 | -------------------------------------------------------------------------------- /ann/src/main/java/com/twitter/ann/faiss/swig/resources/.gitignore: -------------------------------------------------------------------------------- 1 | *.so 2 | *.so.0 3 | *.so.1 4 | *.so.3 5 | *.so.5 6 | *.so.6 7 | *.dylib 8 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/img/foryou.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/src/java/com/twitter/search/img/foryou.png -------------------------------------------------------------------------------- /unified_user_actions/enricher/src/test/resources/BUILD.bazel: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = ["*.*"], 3 | tags = ["bazel-compatible"], 4 | ) 5 | -------------------------------------------------------------------------------- /unified_user_actions/kafka/src/test/resources/BUILD.bazel: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = ["*.xml"], 3 | tags = ["bazel-compatible"], 4 | ) 5 | -------------------------------------------------------------------------------- /unified_user_actions/service/src/test/resources/BUILD.bazel: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = ["*.*"], 3 | tags = ["bazel-compatible"], 4 | ) 5 | -------------------------------------------------------------------------------- /navi/dr_transform/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod all_config; 2 | pub mod converter; 3 | #[cfg(test)] 4 | mod test; 5 | pub mod util; 6 | pub extern crate ort; 7 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/img/indexing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/src/java/com/twitter/search/img/indexing.png -------------------------------------------------------------------------------- /src/java/com/twitter/search/img/serving.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/src/java/com/twitter/search/img/serving.png -------------------------------------------------------------------------------- /src/thrift/com/twitter/recos/user_user_graph/CONFIG.ini: -------------------------------------------------------------------------------- 1 | ; See http://go/CONFIG.ini 2 | 3 | [jira] 4 | project: SD 5 | 6 | [kite] 7 | project: recos 8 | -------------------------------------------------------------------------------- /tweetypie/server/config/BUILD: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = [ 3 | "!**/*.pyc", 4 | "!BUILD*", 5 | "**/*", 6 | ], 7 | ) 8 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird/CONFIG.ini: -------------------------------------------------------------------------------- 1 | ; See http://go/CONFIG.ini 2 | 3 | [jira] 4 | project: SEARCH 5 | 6 | [kite] 7 | project: earlybird 8 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/img/in-network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/src/java/com/twitter/search/img/in-network.png -------------------------------------------------------------------------------- /src/java/com/twitter/search/img/top-search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/src/java/com/twitter/search/img/top-search.png -------------------------------------------------------------------------------- /src/thrift/com/twitter/recos/user_tweet_graph/CONFIG.ini: -------------------------------------------------------------------------------- 1 | ; See http://go/CONFIG.ini 2 | 3 | [jira] 4 | project: SD 5 | 6 | [kite] 7 | project: recos 8 | -------------------------------------------------------------------------------- /src/thrift/com/twitter/recos/user_video_graph/CONFIG.ini: -------------------------------------------------------------------------------- 1 | ; See http://go/CONFIG.ini 2 | 3 | [jira] 4 | project: SD 5 | 6 | [kite] 7 | project: recos 8 | -------------------------------------------------------------------------------- /tweetypie/servo/json/BUILD: -------------------------------------------------------------------------------- 1 | target( 2 | dependencies = [ 3 | "tweetypie/servo/json/src/main/scala/com/twitter/servo/json", 4 | ], 5 | ) 6 | -------------------------------------------------------------------------------- /src/thrift/com/twitter/recos/user_tweet_entity_graph/CONFIG.ini: -------------------------------------------------------------------------------- 1 | ; See http://go/CONFIG.ini 2 | 3 | [jira] 4 | project: SD 5 | 6 | [kite] 7 | project: recos 8 | -------------------------------------------------------------------------------- /follow-recommendations-service/FRS_architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/follow-recommendations-service/FRS_architecture.png -------------------------------------------------------------------------------- /tweetypie/servo/util/BUILD: -------------------------------------------------------------------------------- 1 | target( 2 | tags = ["bazel-compatible"], 3 | dependencies = [ 4 | "tweetypie/servo/util/src/main/scala", 5 | ], 6 | ) 7 | -------------------------------------------------------------------------------- /timelines/data_processing/ml_util/aggregation_framework/docs/AUTOMATED_COMMIT_FILES: -------------------------------------------------------------------------------- 1 | aggregation.rst 2 | batch.rst 3 | index.rst 4 | real-time.rst 5 | troubleshooting.rst 6 | -------------------------------------------------------------------------------- /tweetypie/servo/decider/src/main/scala/com/twitter/servo/decider/DeciderKeyEnum.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.servo.decider 2 | 3 | trait DeciderKeyEnum extends Enumeration 4 | -------------------------------------------------------------------------------- /twml/twml/tracking/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module contains the ExperimentTracker class. 3 | """ 4 | 5 | from .experiment_tracker import ExperimentTracker # noqa: F401 6 | -------------------------------------------------------------------------------- /user-signal-service/server/src/main/resources/BUILD: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = [ 3 | "*.xml", 4 | "*.yml", 5 | "config/*.yml", 6 | ], 7 | ) 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/service/ExecutorResult.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.service 2 | 3 | trait ExecutorResult 4 | -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/images/knownfor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/src/scala/com/twitter/simclusters_v2/images/knownfor.png -------------------------------------------------------------------------------- /twml/libtwml/setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal=1 3 | 4 | [build] 5 | build-lib=build_dir 6 | build-temp=build_dir 7 | 8 | [bdist] 9 | bdist-base=build_dir 10 | -------------------------------------------------------------------------------- /twml/twml/optimizers/__init__.py: -------------------------------------------------------------------------------- 1 | from twitter.deepbird.compat.v1.optimizers import ( 2 | LazyAdamOptimizer, 3 | optimize_loss, 4 | OPTIMIZER_SUMMARIES) # noqa: F401 5 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/models/MutedKeyword.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.models 2 | 3 | case class MutedKeyword(keyword: Option[String]) 4 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/models/package.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility 2 | 3 | package object models { 4 | type CommunityId = Long 5 | } 6 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/rules/package.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility 2 | 3 | package object rules { 4 | type LabelTypeId = Short 5 | } 6 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird_root/img/serving.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/src/java/com/twitter/search/earlybird_root/img/serving.png -------------------------------------------------------------------------------- /tweetypie/server/src/main/scala/com/twitter/tweetypie/core/GeoSearchRequestId.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.tweetypie.core 2 | 3 | case class GeoSearchRequestId(requestID: String) 4 | -------------------------------------------------------------------------------- /simclusters-ann/server/src/main/resources/BUILD: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = [ 3 | "*.xml", 4 | "config/*.yml", 5 | ], 6 | tags = ["bazel-compatible"], 7 | ) 8 | -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/images/interestedin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/src/scala/com/twitter/simclusters_v2/images/interestedin.png -------------------------------------------------------------------------------- /timelineranker/client/builder/BUILD: -------------------------------------------------------------------------------- 1 | target( 2 | tags = ["bazel-compatible"], 3 | dependencies = [ 4 | "timelineranker/client/builder/src/main/scala", 5 | ], 6 | ) 7 | -------------------------------------------------------------------------------- /visibilitylib/src/main/resources/config/BUILD: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = [ 3 | "com/twitter/visibility/*.csv", 4 | "com/twitter/visibility/*.yml", 5 | ], 6 | ) 7 | -------------------------------------------------------------------------------- /representation-manager/server/src/main/resources/BUILD: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = [ 3 | "*.xml", 4 | "config/*.yml", 5 | ], 6 | tags = ["bazel-compatible"], 7 | ) 8 | -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/images/bipartite_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/src/scala/com/twitter/simclusters_v2/images/bipartite_graph.png -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/images/topic_embeddings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/src/scala/com/twitter/simclusters_v2/images/topic_embeddings.png -------------------------------------------------------------------------------- /tweetypie/server/src/main/scala/com/twitter/tweetypie/core/package.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.tweetypie 2 | 3 | package object core { 4 | type TweetResult = ValueState[TweetData] 5 | } 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/HasMarshalling.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling 2 | 3 | trait HasMarshalling 4 | -------------------------------------------------------------------------------- /pushservice/src/main/scala/com/twitter/frigate/pushservice/params/ShardParams.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.frigate.pushservice.params 2 | 3 | case class ShardParams(numShards: Int, shardId: Int) 4 | -------------------------------------------------------------------------------- /recos-injector/CONFIG.ini: -------------------------------------------------------------------------------- 1 | ; See http://go/CONFIG.ini 2 | 3 | [jira] 4 | project: SD 5 | 6 | [docbird] 7 | project_name = recos-injector 8 | 9 | [kite] 10 | project: recos-injector 11 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird/exception/MissingUserException.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird.exception; 2 | 3 | public class MissingUserException extends Exception { 4 | } 5 | -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/images/producer_embeddings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/src/scala/com/twitter/simclusters_v2/images/producer_embeddings.png -------------------------------------------------------------------------------- /tweetypie/servo/README.md: -------------------------------------------------------------------------------- 1 | # Servo 2 | 3 | Servo is a collection of classes and patterns for building services in Scala. It's a grab-bag of code that was deemed useful for service development. 4 | -------------------------------------------------------------------------------- /tweetypie/servo/decider/src/main/scala/com/twitter/servo/decider/package.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.servo 2 | 3 | package object decider { 4 | type DeciderKeyName = DeciderKeyEnum#Value 5 | } 6 | -------------------------------------------------------------------------------- /twml/libtwml/BUILD: -------------------------------------------------------------------------------- 1 | python3_library( 2 | name = "libtwml-python", 3 | sources = ["libtwml/**/*.py"], 4 | tags = [ 5 | "no-mypy", 6 | "bazel-compatible", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /twml/libtwml/src/ops/scripts/get_inc.py: -------------------------------------------------------------------------------- 1 | """Gets the path of headers for the current Tensorflow library""" 2 | 3 | import tensorflow.compat.v1 as tf 4 | 5 | print(tf.sysconfig.get_include(), end='') 6 | -------------------------------------------------------------------------------- /twml/libtwml/src/ops/scripts/get_lib.py: -------------------------------------------------------------------------------- 1 | """Gets the path of headers for the current Tensorflow library""" 2 | 3 | import tensorflow.compat.v1 as tf 4 | 5 | print(tf.sysconfig.get_lib(), end='') 6 | -------------------------------------------------------------------------------- /cr-mixer/server/src/main/resources/BUILD.bazel: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = [ 3 | "*.xml", 4 | "*.yml", 5 | "config/*.yml", 6 | ], 7 | tags = ["bazel-compatible"], 8 | ) 9 | -------------------------------------------------------------------------------- /recos-injector/server/config/change_log_config.ini: -------------------------------------------------------------------------------- 1 | [Configs] 2 | DCS = all 3 | ROLE = recos-injector 4 | JOB = recos-injector 5 | ENV = prod 6 | PACKAGE = recos-injector-release 7 | PATH = recos-injector 8 | -------------------------------------------------------------------------------- /timelineranker/client/builder/README.md: -------------------------------------------------------------------------------- 1 | # TimelineRanker client 2 | 3 | Library for creating a client to talk to TLR. It contains a ClientBuilder implementation 4 | with some preferred settings for clients. 5 | -------------------------------------------------------------------------------- /topic-social-proof/server/src/main/resources/BUILD: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = [ 3 | "*.xml", 4 | "*.yml", 5 | "config/*.yml", 6 | ], 7 | tags = ["bazel-compatible"], 8 | ) 9 | -------------------------------------------------------------------------------- /unified_user_actions/enricher/src/main/scala/com/twitter/unified_user_actions/enricher/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | tags = ["bazel-compatible"], 4 | dependencies = [], 5 | ) 6 | -------------------------------------------------------------------------------- /simclusters-ann/server/src/main/scala/com/twitter/simclustersann/common/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | compiler_option_sets = ["fatal_warnings"], 3 | tags = ["bazel-compatible"], 4 | dependencies = [], 5 | ) 6 | -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/images/producer_producer_similarity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/src/scala/com/twitter/simclusters_v2/images/producer_producer_similarity.png -------------------------------------------------------------------------------- /timelineranker/common/src/main/scala/BUILD: -------------------------------------------------------------------------------- 1 | target( 2 | tags = ["bazel-compatible"], 3 | dependencies = [ 4 | "timelineranker/common/src/main/scala/com/twitter/timelineranker/model", 5 | ], 6 | ) 7 | -------------------------------------------------------------------------------- /tweetypie/common/src/scala/com/twitter/tweetypie/media/package.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.tweetypie 2 | 3 | package object media { 4 | type TweetId = Long 5 | type UserId = Long 6 | type MediaId = Long 7 | } 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/Cover.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt 2 | 3 | trait Cover extends TimelineItem 4 | -------------------------------------------------------------------------------- /representation-scorer/bin/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | JOB=representation-scorer bazel run --ui_event_filters=-info,-stdout,-stderr --noshow_progress \ 4 | //relevance-platform/src/main/python/deploy -- "$@" 5 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/models/SemanticCoreAnnotation.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.models 2 | 3 | case class SemanticCoreAnnotation(groupId: Long, domainId: Long, entityId: Long) 4 | -------------------------------------------------------------------------------- /ann/src/main/scala/com/twitter/ann/dataflow/offline/BaseEmbeddingData.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.ann.dataflow.offline 2 | 3 | trait BaseEmbeddingData { 4 | val entityId: Option[Long] 5 | val embedding: Seq[Double] 6 | } 7 | -------------------------------------------------------------------------------- /representation-manager/bin/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | JOB=representation-manager bazel run --ui_event_filters=-info,-stdout,-stderr --noshow_progress \ 4 | //relevance-platform/src/main/python/deploy -- "$@" 5 | -------------------------------------------------------------------------------- /cr-mixer/server/src/main/scala/com/twitter/cr_mixer/exception/InvalidSANNConfigException.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.cr_mixer 2 | package exception 3 | 4 | case class InvalidSANNConfigException(msg: String) extends Exception(msg) 5 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/candidate_sources/promoted_accounts/README.md: -------------------------------------------------------------------------------- 1 | # Promoted Accounts Candidate Source 2 | Promoted accounts returned from Ads server. 3 | -------------------------------------------------------------------------------- /navi/thrift_bpr_adapter/thrift/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bpr_thrift" 3 | description = "Thrift parser for Batch Prediction Request" 4 | version = "0.1.0" 5 | edition = "2021" 6 | 7 | [dependencies] 8 | thrift = "0.17.0" 9 | -------------------------------------------------------------------------------- /representation-scorer/server/src/main/scala/com/twitter/representationscorer/common/package.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.representationscorer 2 | 3 | package object common { 4 | type UserId = Long 5 | type TweetId = Long 6 | } 7 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasTopicId.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasTopicId { 4 | def topicId: Long 5 | } 6 | -------------------------------------------------------------------------------- /representation-scorer/server/src/main/scala/com/twitter/representationscorer/twistlyfeatures/ScoreResult.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.representationscorer.twistlyfeatures 2 | 3 | case class ScoreResult(id: Long, score: Option[Double]) 4 | -------------------------------------------------------------------------------- /timelines/data_processing/ml_util/aggregation_framework/AggregateStore.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelines.data_processing.ml_util.aggregation_framework 2 | 3 | trait AggregateStore extends Serializable { 4 | def name: String 5 | } 6 | -------------------------------------------------------------------------------- /ann/src/main/java/com/twitter/ann/hnsw/DistanceFunction.java: -------------------------------------------------------------------------------- 1 | package com.twitter.ann.hnsw; 2 | 3 | public interface DistanceFunction { 4 | /** 5 | * Distance between two items. 6 | */ 7 | float distance(T t, Q q); 8 | } 9 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasProfileId.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasProfileId { 4 | def profileId: Long 5 | } 6 | -------------------------------------------------------------------------------- /recos-injector/server/src/main/scala/com/twitter/recosinjector/decider/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | platform = "java11", 3 | tags = ["bazel-compatible"], 4 | dependencies = [ 5 | "decider/src/main/scala", 6 | ], 7 | ) 8 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasScores.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasScores { 4 | def scores: Option[Scores] 5 | } 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/ModulePresentation.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.common.presentation 2 | 3 | trait ModulePresentation extends UniversalPresentation 4 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasIsSoftUser.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasIsSoftUser { 4 | def isSoftUser: Boolean 5 | } 6 | -------------------------------------------------------------------------------- /home-mixer/server/src/main/scala/com/twitter/home_mixer/module/HomeMixerResourcesModule.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.home_mixer.module 2 | 3 | import com.twitter.inject.TwitterModule 4 | 5 | object HomeMixerResourcesModule extends TwitterModule {} 6 | -------------------------------------------------------------------------------- /home-mixer/server/src/main/scala/com/twitter/home_mixer/util/MissingKeyException.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.home_mixer.util 2 | 3 | object MissingKeyException extends Exception("Missing key") { 4 | override def toString: String = getMessage 5 | } 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/Callback.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | case class Callback(endpoint: String) 4 | -------------------------------------------------------------------------------- /src/python/twitter/deepbird/projects/timelines/scripts/models/earlybird/earlybird_features.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/src/python/twitter/deepbird/projects/timelines/scripts/models/earlybird/earlybird_features.png -------------------------------------------------------------------------------- /ann/src/main/scala/com/twitter/ann/scalding/offline/README: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | This pipeline uses hnsw and scalding to create an hnsw index based on producers embeddings, which 4 | it then uses to construct lists of producer suggestions for each user. 5 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/UserIdAndTimestamp.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | case class UserIdWithTimestamp(userId: Long, timeInMs: Long) 4 | -------------------------------------------------------------------------------- /representation-manager/README.md: -------------------------------------------------------------------------------- 1 | # Representation Manager # 2 | 3 | **Representation Manager** (RMS) serves as a centralized embedding management system, providing SimClusters or other embeddings as facade of the underlying storage or services. 4 | 5 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/media/MediaKey.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.media 2 | 3 | case class MediaKey( 4 | id: Long, 5 | category: Int) 6 | -------------------------------------------------------------------------------- /representation-scorer/server/src/main/resources/BUILD: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = [ 3 | "*.xml", 4 | "*.yml", 5 | "com/twitter/slo/slo.json", 6 | "config/*.yml", 7 | ], 8 | tags = ["bazel-compatible"], 9 | ) 10 | -------------------------------------------------------------------------------- /timelines/data_processing/ml_util/aggregation_framework/AggregationConfig.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelines.data_processing.ml_util.aggregation_framework 2 | 3 | trait AggregationConfig { 4 | def aggregatesToCompute: Set[TypedAggregateGroup[_]] 5 | } 6 | -------------------------------------------------------------------------------- /cr-mixer/server/src/main/scala/com/twitter/cr_mixer/exception/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | strict_deps = True, 5 | tags = ["bazel-compatible"], 6 | dependencies = [], 7 | ) 8 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasQualityFactor.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasQualityFactor { 4 | def qualityFactor: Option[Double] 5 | } 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/state/HasParams.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.pipeline.state 2 | 3 | import com.twitter.timelines.configapi.Params 4 | 5 | trait HasParams { 6 | def params: Params 7 | } 8 | -------------------------------------------------------------------------------- /tweetypie/servo/util/src/main/scala/com/twitter/servo/util/SynchronizedHashMap.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.servo.util 2 | 3 | import scala.collection.mutable 4 | 5 | class SynchronizedHashMap[K, V] extends mutable.HashMap[K, V] with mutable.SynchronizedMap[K, V] 6 | -------------------------------------------------------------------------------- /unified_user_actions/service/src/test/resources/decider.yml: -------------------------------------------------------------------------------- 1 | PublishServerTweetFav: 2 | default_availability: 10000 3 | RekeyUUAIesourceClientTweetRenderImpression: 4 | default_availability: 10000 5 | EnrichmentPlannerSampling: 6 | default_availability: 10000 7 | -------------------------------------------------------------------------------- /user-signal-service/server/src/main/resources/config/decider.yml: -------------------------------------------------------------------------------- 1 | test_value: 2 | comment: Test Value 3 | default_availability: 10000 4 | dark_traffic_percent: 5 | comment: Percentage of traffic to send to dark traffic destination 6 | default_availability: 0 -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/models/TweetDeleteReason.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.models 2 | 3 | object TweetDeleteReason extends Enumeration { 4 | type TweetDeleteReason = Value 5 | val Deleted, BounceDeleted = Value 6 | } 7 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasByfSeedUserIds.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasByfSeedUserIds { 4 | def byfSeedUserIds: Option[Seq[Long]] 5 | } 6 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasDisplayLocation.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasDisplayLocation { 4 | def displayLocation: DisplayLocation 5 | } 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/tweet/TimelinesScoreInfo.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.tweet 2 | 3 | case class TimelinesScoreInfo(score: Double) 4 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/DismissInfo.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | case class DismissInfo(callbacks: Option[Seq[Callback]]) 4 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/LiveEventDetails.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | case class LiveEventDetails(eventId: Option[Long]) 4 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird_root/config/BUILD.bazel: -------------------------------------------------------------------------------- 1 | java_library( 2 | sources = ["*.java"], 3 | dependencies = [ 4 | "src/java/com/twitter/common/util:system-mocks", 5 | "src/java/com/twitter/search/earlybird/config", 6 | ], 7 | ) 8 | -------------------------------------------------------------------------------- /src/scala/com/twitter/interaction_graph/bqe/training/check_labels_exist.sql: -------------------------------------------------------------------------------- 1 | SELECT dateHour FROM `twttr-bq-cassowary-prod.user.interaction_graph_labels_daily` 2 | WHERE dateHour = (SELECT TIMESTAMP_ADD(TIMESTAMP_MILLIS($start_time$), INTERVAL 1 DAY)) 3 | LIMIT 1 4 | 5 | -------------------------------------------------------------------------------- /src/scala/com/twitter/timelines/prediction/features/ppmi/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "src/java/com/twitter/ml/api:api-base", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /timelines/data_processing/ml_util/aggregation_framework/docs/index.rst: -------------------------------------------------------------------------------- 1 | .. markdowninclude:: ../README.md 2 | 3 | .. toctree:: 4 | :maxdepth: 2 5 | :hidden: 6 | 7 | aggregation 8 | batch 9 | real-time 10 | joining 11 | troubleshooting 12 | -------------------------------------------------------------------------------- /tweetypie/servo/util/src/main/scala/com/twitter/servo/util/package.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.servo 2 | 3 | package object util { 4 | /* aliases to preserve compatibility after classes moved to different package */ 5 | val Memoize = com.twitter.util.Memoize 6 | } 7 | -------------------------------------------------------------------------------- /twml/twml/contrib/metrics/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """This module contains experimental metric(s) for search and ranking""" 3 | 4 | from .search_metrics import get_search_metric_fn, ndcg # noqa: F401 5 | from .metrics import * # noqa: F401 6 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasEngagements.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasEngagements { 4 | 5 | def engagements: Seq[EngagementType] 6 | 7 | } 8 | -------------------------------------------------------------------------------- /navi/segdense/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "segdense" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | 7 | [dependencies] 8 | env_logger = "0.10.0" 9 | serde = { version = "1.0.104", features = ["derive"] } 10 | serde_json = "1.0.48" 11 | log = "0.4.17" 12 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/color/ColorPalette.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.color 2 | 3 | case class ColorPalette( 4 | rgb: Color, 5 | percentage: Double) 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/timeline_module/AdsMetadata.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module 2 | 3 | case class AdsMetadata(carouselId: Option[Long]) 4 | -------------------------------------------------------------------------------- /representation-scorer/bin/canary-check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export CANARY_CHECK_ROLE="representation-scorer" 4 | export CANARY_CHECK_NAME="representation-scorer" 5 | export CANARY_CHECK_INSTANCES="0-19" 6 | 7 | python3 relevance-platform/tools/canary_check.py "$@" 8 | 9 | -------------------------------------------------------------------------------- /twml/twml/saved_model_cli/__main__.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module is responsible for running saved_model_cli. 3 | """ 4 | import sys 5 | 6 | from tensorflow.python.tools import saved_model_cli 7 | 8 | if __name__ == '__main__': 9 | sys.exit(saved_model_cli.main()) 10 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/media/AspectRatio.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.media 2 | 3 | case class AspectRatio( 4 | numerator: Short, 5 | denominator: Short) 6 | -------------------------------------------------------------------------------- /src/python/twitter/deepbird/projects/timelines/scripts/models/earlybird/tf_model/BUILD: -------------------------------------------------------------------------------- 1 | python3_library( 2 | name = "libs_py3", 3 | sources = ["*.py"], 4 | dependencies = [ 5 | "src/python/twitter/deepbird/io", 6 | "twml:twml-nodeps", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /timelineranker/server/src/main/scala/com/twitter/timelineranker/recap/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | strict_deps = True, 5 | tags = ["bazel-compatible"], 6 | dependencies = [ 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /ann/src/main/java/com/twitter/ann/hnsw/IllegalDuplicateInsertException.java: -------------------------------------------------------------------------------- 1 | package com.twitter.ann.hnsw; 2 | 3 | public class IllegalDuplicateInsertException extends Exception { 4 | public IllegalDuplicateInsertException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/GeohashAndCountryCode.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | case class GeohashAndCountryCode(geohash: Option[String], countryCode: Option[String]) 4 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/media/Rect.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.media 2 | 3 | case class Rect( 4 | left: Int, 5 | top: Int, 6 | width: Int, 7 | height: Int) 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/PinnableEntry.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | trait PinnableEntry { 4 | def isPinned: Option[Boolean] = None 5 | } 6 | -------------------------------------------------------------------------------- /tweetypie/common/src/scala/com/twitter/tweetypie/util/package.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.tweetypie 2 | 3 | package object util { 4 | type TweetId = Long 5 | type UserId = Long 6 | type MediaId = Long 7 | type ConversationId = Long 8 | type PlaceId = String 9 | } 10 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/TweetCandidate.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | case class TweetCandidate( 4 | tweetId: Long, 5 | authorId: Long, 6 | score: Option[Double]) 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/alert/ShowAlertNavigationMetadata.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.alert 2 | 3 | case class ShowAlertNavigationMetadata(navigateToEntryId: String) 4 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/timeline_module/GridCarouselMetadata.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module 2 | 3 | case class GridCarouselMetadata(numRows: Option[Int]) 4 | -------------------------------------------------------------------------------- /timelines/data_processing/ml_util/aggregation_framework/metrics/ConversionUtils.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelines.data_processing.ml_util.aggregation_framework.metrics 2 | 3 | object ConversionUtils { 4 | def booleanToDouble(value: Boolean): Double = if (value) 1.0 else 0.0 5 | } 6 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/models/SafetyLabelType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.models 2 | 3 | trait SafetyLabelType { 4 | val DeprecatedEnumValue: Short = -1 5 | val UnknownEnumValue: Short = -2 6 | val StratoOnlyLabelEnumValue: Short = -3 7 | } 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/java/com/twitter/product_mixer/core/product/guice/scope/BUILD: -------------------------------------------------------------------------------- 1 | java_library( 2 | sources = ["*.java"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "3rdparty/jvm/com/google/inject:guice", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/highlight/HighlightedSection.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.highlight 2 | 3 | case class HighlightedSection(startIndex: Int, endIndex: Int) 4 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/ArticleDetails.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | case class ArticleDetails( 4 | articlePosition: Int, 5 | shareCount: Int) 6 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird/EarlybirdMain.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird; 2 | 3 | public final class EarlybirdMain { 4 | private EarlybirdMain() { 5 | } 6 | 7 | public static void main(String[] args) { 8 | new Earlybird().main(args); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/scalding/common/matrix/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "src/scala/com/twitter/scalding_internal/job/analytics_batch", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /src/scala/com/twitter/timelines/prediction/features/followsource/BUILD.bazel: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | dependencies = [ 4 | "src/java/com/twitter/ml/api:api-base", 5 | "src/thrift/com/twitter/dal/personal_data:personal_data-java", 6 | ], 7 | ) 8 | -------------------------------------------------------------------------------- /twml/twml/readers/batch_prediction_request.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=invalid-name 2 | """ 3 | This module implements the reader for BatchPredictionRequest. 4 | """ 5 | 6 | from twitter.deepbird.io.legacy.readers.batch_prediction_request import ( 7 | BatchPredictionRequest # noqa: F401 8 | ) 9 | -------------------------------------------------------------------------------- /cr-mixer/server/src/main/scala/com/twitter/cr_mixer/model/TweetWithAuthor.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.cr_mixer.model 2 | 3 | import com.twitter.simclusters_v2.common.TweetId 4 | import com.twitter.simclusters_v2.common.UserId 5 | 6 | case class TweetWithAuthor(tweetId: TweetId, authorId: UserId) 7 | -------------------------------------------------------------------------------- /graph-feature-service/src/main/scala/com/twitter/graph_feature_service/common/BUILD.bazel: -------------------------------------------------------------------------------- 1 | scala_library( 2 | platform = "java8", 3 | tags = [ 4 | "bazel-compatible", 5 | "bazel-only", 6 | ], 7 | dependencies = ["src/scala/com/twitter/storehaus_internal/util"], 8 | ) 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/controllers/QualityFactorMonitoringConfig.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.controllers 2 | 3 | // Bounds here are inclusive 4 | case class QualityFactorMonitoringConfig( 5 | boundMin: Double, 6 | boundMax: Double) 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/ProductContext.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.request 2 | 3 | trait ProductContext 4 | 5 | trait HasProductContext { 6 | def productContext: Option[ProductContext] 7 | } 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/ConversationDetails.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | case class ConversationDetails(conversationSection: Option[ConversationSection]) 4 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/ReplaceableEntry.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | trait ReplaceableEntry { 4 | def entryIdToReplace: Option[String] = None 5 | } 6 | -------------------------------------------------------------------------------- /product-mixer/shared-library/src/main/scala/com/twitter/product_mixer/shared_library/http_client/HttpHostPort.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.shared_library.http_client 2 | 3 | case class HttpHostPort(host: String, port: Int) { 4 | override val toString: String = s"$host:$port" 5 | } 6 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird/exception/EarlybirdRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird.exception; 2 | 3 | public class EarlybirdRuntimeException extends RuntimeException { 4 | public EarlybirdRuntimeException(Throwable cause) { 5 | super(cause); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/scala/com/twitter/timelines/prediction/features/ppmi/PpmiFeatures.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelines.prediction.features.ppmi 2 | 3 | import com.twitter.ml.api.Feature.Continuous 4 | 5 | object PpmiDataRecordFeatures { 6 | val PPMI_SCORE = new Continuous("ppmi.source_author.score") 7 | } 8 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasGeohashAndCountryCode.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasGeohashAndCountryCode { 4 | def geohashAndCountryCode: Option[GeohashAndCountryCode] 5 | } 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/ReaderModeConfig.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt 2 | 3 | import metadata.Url 4 | 5 | case class ReaderModeConfig(isReaderModeAvailable: Boolean, landingUrl: Url) 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/color/Color.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.color 2 | 3 | case class Color( 4 | red: Short, 5 | green: Short, 6 | blue: Short, 7 | opacity: Option[Short]) 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/message/MessageTextAction.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.message 2 | 3 | case class MessageTextAction( 4 | text: String, 5 | action: MessageAction) 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/ImageAnimationType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | sealed trait ImageAnimationType 4 | 5 | case object Bounce extends ImageAnimationType 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/promoted/CallToAction.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.promoted 2 | 3 | case class CallToAction( 4 | callToActionType: Option[String], 5 | url: Option[String]) 6 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/ingester/pipeline/util/PipelineV2CreationException.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.ingester.pipeline.util; 2 | 3 | public class PipelineV2CreationException extends Exception { 4 | public PipelineV2CreationException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/scala/com/twitter/recos/decider/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "decider/src/main/scala", 7 | "src/scala/com/twitter/recos/util:recos-util", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /twml/twml/contrib/optimizers/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """This module contains experimental optimizer classes""" 3 | from .deep_gradient_compression_optimizer import DeepGradientCompressionOptimizer # noqa: F401 4 | from .pruning_optimizer import PruningOptimizer # noqa: F401 5 | -------------------------------------------------------------------------------- /twml/twml/summary/__init__.py: -------------------------------------------------------------------------------- 1 | from tensorflow.python.ops.summary_ops_v2 import flush # noqa: F401 2 | 3 | """ 4 | NOTE: Using `from tensorflow.python.ops.summary_ops_v2 import flush` in the code works. 5 | This stub exists because it was easier to refactor code because twml is widely used. 6 | """ 7 | -------------------------------------------------------------------------------- /unified_user_actions/service/src/main/resources/BUILD: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = ["*.*"], 3 | tags = ["bazel-compatible"], 4 | ) 5 | 6 | files( 7 | name = "files", 8 | sources = [ 9 | "!BUILD", 10 | "**/*", 11 | ], 12 | tags = ["bazel-compatible"], 13 | ) 14 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/interfaces/search/BatchSearchVisibilityResponse.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.interfaces.search 2 | 3 | case class BatchSearchVisibilityResponse( 4 | visibilityResults: Map[Long, CombinedVisibilityResult], 5 | failedTweetIds: Seq[Long]) 6 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/candidate_sources/stp/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CryptoMonkey21/the-algorithm/HEAD/follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/candidate_sources/stp/img.png -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/candidate_sources/top_organic_follows_accounts/README.md: -------------------------------------------------------------------------------- 1 | # Top Organic Follows Accounts 2 | Provides the most organically followed (i.e. not followed through the Who-To-Follow module) accounts for a given country. 3 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasRecentlyEngagedUserIds.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasRecentlyEngagedUserIds { 4 | val recentlyEngagedUserIds: Option[Seq[RecentlyEngagedUserId]] 5 | } 6 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasRecommendationFlowIdentifier.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasRecommendationFlowIdentifier { 4 | def recommendationFlowIdentifier: Option[String] 5 | } 6 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/models/CandidateUserDebugParams.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.models 2 | 3 | import com.twitter.timelines.configapi.Params 4 | 5 | case class CandidateUserDebugParams(paramsMap: Map[Long, Params]) 6 | -------------------------------------------------------------------------------- /home-mixer/server/src/main/scala/com/twitter/home_mixer/model/request/HasListId.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.home_mixer.model.request 2 | 3 | /** 4 | * [[HasListId]] enables shared components to access the list id shared by all list timeline products. 5 | */ 6 | trait HasListId { 7 | def listId: Long 8 | } 9 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/common/search/QueryCostProvider.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.common.search; 2 | 3 | /** 4 | * Any class that can track and return query cost. 5 | */ 6 | public interface QueryCostProvider { 7 | /** Returns the total cost. */ 8 | double getTotalCost(); 9 | } 10 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/ingester/pipeline/util/PipelineStageRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.ingester.pipeline.util; 2 | 3 | public class PipelineStageRuntimeException extends RuntimeException { 4 | public PipelineStageRuntimeException(String msg) { 5 | super(msg); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /twml/libtwml/src/lib/internal/utf_converter.h: -------------------------------------------------------------------------------- 1 | #ifndef _UTF_CONVERTER_H_ 2 | #define _UTF_CONVERTER_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | ssize_t utf8_to_utf16(const uint8_t *in, uint64_t in_len, uint16_t *out, uint64_t max_out); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /twml/twml/contrib/readers/batch_prediction_request.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=invalid-name 2 | """ 3 | This module implements the reader for BatchPredictionRequest. 4 | """ 5 | 6 | from twitter.deepbird.io.legacy.contrib.readers.batch_prediction_request import ( 7 | BatchPredictionRequest # noqa: F401 8 | ) 9 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasInfoPerRankingStage.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasInfoPerRankingStage { 4 | def infoPerRankingStage: Option[scala.collection.Map[String, RankingInfo]] 5 | } 6 | -------------------------------------------------------------------------------- /product-mixer/component-library/src/main/scala/com/twitter/product_mixer/component_library/selector/sorter/SortOrder.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.component_library.selector.sorter 2 | 3 | sealed trait SortOrder 4 | case object Ascending extends SortOrder 5 | case object Descending extends SortOrder 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | platform = "java8", 5 | strict_deps = True, 6 | tags = ["bazel-compatible"], 7 | dependencies = [], 8 | ) 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/article/ArticleDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.article 2 | 3 | sealed trait ArticleDisplayType 4 | 5 | case object Default extends ArticleDisplayType 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/state/HasRequest.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.pipeline.state 2 | 3 | import com.twitter.product_mixer.core.model.marshalling.request.Request 4 | 5 | trait HasRequest[TRequest <: Request] { 6 | def request: TRequest 7 | } 8 | -------------------------------------------------------------------------------- /src/scala/com/twitter/timelines/prediction/common/aggregates/real_time/TimelinesOnlineAggregationSources.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelines.prediction.common.aggregates.real_time 2 | 3 | object TimelinesOnlineAggregationSources { 4 | val timelinesOnlineAggregateSource = new TimelinesStormAggregateSource 5 | } 6 | -------------------------------------------------------------------------------- /timelineranker/server/src/main/scala/com/twitter/timelineranker/decider/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "servo/decider", 7 | "timelineranker/server/config", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /timelines/data_processing/ml_util/aggregation_framework/heron/package.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelines.data_processing.ml_util.aggregation_framework 2 | 3 | package object heron { 4 | // NOTE: please sort alphabetically 5 | type AuthorId = Long 6 | type UserId = Long 7 | type TimestampMs = Long 8 | } 9 | -------------------------------------------------------------------------------- /twml/libtwml/setup.py: -------------------------------------------------------------------------------- 1 | """ 2 | libtwml setup.py module 3 | """ 4 | from setuptools import setup, find_packages 5 | 6 | setup( 7 | name='libtwml', 8 | version='2.0', 9 | description="Tensorflow C++ ops for twml", 10 | packages=find_packages(), 11 | data_files=[('', ['libtwml_tf.so'])], 12 | ) 13 | -------------------------------------------------------------------------------- /twml/twml/filters.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Includes functions to filter features dict build from 3 | data records. 4 | ''' 5 | 6 | from twitter.deepbird.io.legacy.filters import ( 7 | balance_binary_class_samples, # noqa: F401 8 | sparse_keep_feature_if, # noqa: F401 9 | sparse_keep_sample_if) # noqa: F401 10 | -------------------------------------------------------------------------------- /unified_user_actions/service/src/main/scala/com/twitter/unified_user_actions/service/module/TopicsMapping.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.unified_user_actions.service.module 2 | 3 | case class TopicsMapping( 4 | all: String = "unified_user_actions", 5 | engagementsOnly: String = "unified_user_actions_engagements") 6 | -------------------------------------------------------------------------------- /ann/src/main/scala/com/twitter/ann/util/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | compiler_option_sets = ["fatal_warnings"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "ann/src/main/scala/com/twitter/ann/common", 7 | "util/util-logging", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /navi/navi/proto/tensorflow/core/framework/dataset_metadata.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorflow.data; 4 | 5 | option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/dataset_metadata_go_proto"; 6 | 7 | // next: 2 8 | message Metadata { 9 | bytes name = 1; 10 | } 11 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/product/ProductPipelineRequest.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.pipeline.product 2 | 3 | import com.twitter.timelines.configapi.Params 4 | 5 | case class ProductPipelineRequest[RequestType](request: RequestType, params: Params) 6 | -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/summingbird/README.md: -------------------------------------------------------------------------------- 1 | Simclusters v2 Online Tweet Embedding Pipeline 2 | ============================================== 3 | 4 | The Heron jobs generate the tweet embedding and index of tweets for SimClusters, as well as persistenting the tweet embeddings from MemCache into Manhattan. -------------------------------------------------------------------------------- /timelineranker/server/src/main/scala/com/twitter/timelineranker/core/HydratedTweets.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelineranker.core 2 | 3 | import com.twitter.timelines.model.tweet.HydratedTweet 4 | 5 | case class HydratedTweets( 6 | outerTweets: Seq[HydratedTweet], 7 | innerTweets: Seq[HydratedTweet] = Seq.empty) 8 | -------------------------------------------------------------------------------- /twml/twml/readers/hashed_batch_prediction_request.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=invalid-name 2 | """ 3 | This module implements the reader for HashedBatchPredictionRequest. 4 | """ 5 | 6 | from twitter.deepbird.io.legacy.readers.hashed_batch_prediction_request import ( 7 | HashedBatchPredictionRequest # noqa: F401 8 | ) 9 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/util/NamingUtils.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.util 2 | 3 | object NamingUtils { 4 | def getFriendlyName(a: Any): String = getFriendlyNameFromClass(a.getClass) 5 | def getFriendlyNameFromClass(a: Class[_]): String = a.getSimpleName.stripSuffix("$") 6 | } 7 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/configapi/common/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | compiler_option_sets = ["fatal_warnings"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "configapi/configapi-core", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/cover/FullCoverDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.cover 2 | 3 | sealed trait FullCoverDisplayType 4 | 5 | case object CoverFullCoverDisplayType extends FullCoverDisplayType 6 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/configapi/configs/overrides/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | strict_deps = True, 5 | tags = ["bazel-compatible"], 6 | dependencies = [ 7 | "decider", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/candidate_sources/recent_engagement/README.md: -------------------------------------------------------------------------------- 1 | # Recent Engagement Candidate Source 2 | Provides recently engaged accounts for a given user: 3 | * Explicit engagements: like, retweet, reply 4 | * Implicit engagements: profile visit 5 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasUserState.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | import com.twitter.core_workflows.user_model.thriftscala.UserState 4 | 5 | trait HasUserState { 6 | def userState: Option[UserState] 7 | } 8 | -------------------------------------------------------------------------------- /graph-feature-service/src/main/scala/com/twitter/graph_feature_service/util/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | platform = "java8", 3 | tags = ["bazel-compatible"], 4 | dependencies = [ 5 | "graph-feature-service/src/main/thrift/com/twitter/graph_feature_service:graph_feature_service_thrift-scala", 6 | ], 7 | ) 8 | -------------------------------------------------------------------------------- /home-mixer/server/src/main/scala/com/twitter/home_mixer/product/for_you/model/ForYouTweetsResponse.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.home_mixer.product.for_you.model 2 | 3 | import com.twitter.product_mixer.core.model.marshalling.HasMarshalling 4 | 5 | case class ForYouTweetsResponse(tweetCandidates: Seq[Long]) extends HasMarshalling 6 | -------------------------------------------------------------------------------- /navi/navi/scripts/run_tf2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | RUST_LOG=info LD_LIBRARY_PATH=so/tf2 cargo run --bin navi --features tf -- --port 30 --num-worker-threads 8 --intra-op-parallelism 8 --inter-op-parallelism 8 \ 3 | --model-check-interval-secs 30 \ 4 | --model-dir models/click/ \ 5 | --input "" \ 6 | --output output_0 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/TimelineScribeConfig.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt 2 | 3 | case class TimelineScribeConfig( 4 | page: Option[String], 5 | section: Option[String], 6 | entityToken: Option[String]) 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/alert/ShowAlertIcon.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.alert 2 | 3 | sealed trait ShowAlertIcon 4 | case object UpArrow extends ShowAlertIcon 5 | case object DownArrow extends ShowAlertIcon 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/alert/ShowAlertType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.alert 2 | 3 | sealed trait ShowAlertType 4 | case object NewTweets extends ShowAlertType 5 | case object Navigate extends ShowAlertType 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/message/MessageActionType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.message 2 | 3 | sealed trait MessageActionType 4 | 5 | case object FollowAllMessageActionType extends MessageActionType 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/operation/CursorDisplayTreatment.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.operation 2 | 3 | case class CursorDisplayTreatment( 4 | actionText: Option[String], 5 | labelText: Option[String]) 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/promoted/PrerollMetadata.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.promoted 2 | 3 | case class PrerollMetadata( 4 | preroll: Option[Preroll], 5 | videoAnalyticsScribePassthrough: Option[String]) 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/promoted/VideoVariant.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.promoted 2 | 3 | case class VideoVariant( 4 | url: Option[String], 5 | contentType: Option[String], 6 | bitrate: Option[Int]) 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/reaction/TimelineReaction.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.reaction 2 | 3 | case class TimelineReaction( 4 | execution: TimelineReactionExecution, 5 | maxExecutionCount: Option[Short]) 6 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/core/earlybird/index/column/DocValuesUpdate.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.core.earlybird.index.column; 2 | 3 | public interface DocValuesUpdate { 4 | /** 5 | * Performs an doc values update on the given document. 6 | */ 7 | void update(ColumnStrideFieldIndex docValues, int docID); 8 | } 9 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/feature_update_service/README.md: -------------------------------------------------------------------------------- 1 | ## Feature Update Service 2 | Feature update service is a service that sends tweet feature updates e.g number of retweets, replies and favorites to Earlybird. Earlybird then indexes and uses these features to rank in-network Home Timeline tweets. 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/ingester/util/jndi/BUILD: -------------------------------------------------------------------------------- 1 | java_library( 2 | sources = ["*.java"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | platform = "java8", 5 | tags = ["bazel-compatible"], 6 | dependencies = [ 7 | "3rdparty/jvm/com/twitter/search/ingester:legacy", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /src/scala/com/twitter/interaction_graph/bqe/scoring/check_models.sql: -------------------------------------------------------------------------------- 1 | (SELECT * FROM ML.FEATURE_IMPORTANCE(MODEL `twttr-recos-ml-prod.realgraph.prod`) 2 | ORDER BY importance_gain DESC) 3 | UNION ALL 4 | (SELECT * FROM ML.FEATURE_IMPORTANCE(MODEL `twttr-recos-ml-prod.realgraph.prod_explicit`) 5 | ORDER BY importance_gain DESC) 6 | -------------------------------------------------------------------------------- /timelines/data_processing/ml_util/aggregation_framework/heron/OnlineAggregationStoresTrait.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelines.data_processing.ml_util.aggregation_framework.heron 2 | 3 | trait OnlineAggregationStoresTrait { 4 | def ProductionStore: RealTimeAggregateStore 5 | def StagingStore: RealTimeAggregateStore 6 | } 7 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasExcludedUserIds.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasExcludedUserIds { 4 | // user ids that are going to be excluded from recommendations 5 | def excludedUserIds: Seq[Long] 6 | } 7 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/products/sidebar/configapi/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | compiler_option_sets = ["fatal_warnings"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "configapi/configapi-core", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/color/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | platform = "java8", 5 | strict_deps = True, 6 | tags = ["bazel-compatible"], 7 | dependencies = [], 8 | ) 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/contextual_ref/ContextualTweetRef.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.contextual_ref 2 | 3 | case class ContextualTweetRef( 4 | id: Long, 5 | hydrationContext: Option[TweetHydrationContext]) 6 | -------------------------------------------------------------------------------- /twml/twml/contrib/readers/hashed_batch_prediction_request.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=invalid-name 2 | """ 3 | This module implements the reader for HashedBatchPredictionRequest. 4 | """ 5 | 6 | from twitter.deepbird.io.legacy.contrib.readers.hashed_batch_prediction_request import ( 7 | HashedBatchPredictionRequest # noqa: F401 8 | ) 9 | -------------------------------------------------------------------------------- /cr-mixer/server/src/main/scala/com/twitter/cr_mixer/model/TweetWithScore.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.cr_mixer.model 2 | 3 | import com.twitter.simclusters_v2.common.TweetId 4 | 5 | /*** 6 | * Bind a tweetId with a raw score generated from one single Similarity Engine 7 | */ 8 | case class TweetWithScore(tweetId: TweetId, score: Double) 9 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasDismissedUserIds.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasDismissedUserIds { 4 | // user ids that are recently followed by the target user 5 | def dismissedUserIds: Option[Seq[Long]] 6 | } 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/filter/FilterResult.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.functional_component.filter 2 | 3 | /** `Candidate`s were `kept` and `removed` by a [[Filter]] */ 4 | case class FilterResult[+Candidate](kept: Seq[Candidate], removed: Seq[Candidate]) 5 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/thread/ThreadHeaderContent.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.thread 2 | 3 | sealed trait ThreadHeaderContent 4 | 5 | case class UserThreadHeader(userId: Long) extends ThreadHeaderContent 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/state/HasQuery.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.pipeline.state 2 | 3 | import com.twitter.product_mixer.core.pipeline.PipelineQuery 4 | 5 | trait HasQuery[Query <: PipelineQuery, T] { 6 | def query: Query 7 | def updateQuery(query: Query): T 8 | } 9 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/ingester/pipeline/twitter/thriftparse/ThriftTweetParsingException.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.ingester.pipeline.twitter.thriftparse; 2 | 3 | public final class ThriftTweetParsingException extends Exception { 4 | public ThriftTweetParsingException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /timelineranker/common/src/main/scala/com/twitter/timelineranker/model/UtegLikedByTweetsOptions.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelineranker.model 2 | 3 | import com.twitter.timelines.model.UserId 4 | 5 | case class UtegLikedByTweetsOptions( 6 | utegCount: Int, 7 | isInNetwork: Boolean, 8 | weightedFollowings: Map[UserId, Double]) 9 | -------------------------------------------------------------------------------- /tweetypie/common/src/scala/com/twitter/tweetypie/decider/overrides/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | platform = "java8", 5 | strict_deps = True, 6 | tags = ["bazel-compatible"], 7 | dependencies = [ 8 | "decider", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /twml/twml/errors.py: -------------------------------------------------------------------------------- 1 | """ 2 | Error classes for twml 3 | """ 4 | 5 | 6 | class EarlyStopError(Exception): 7 | """Exception used to indicate evaluator needs to early stop.""" 8 | pass 9 | 10 | 11 | class CheckpointNotFoundError(Exception): 12 | """Exception used to indicate a checkpoint hasnt been found.""" 13 | pass 14 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/rules/generators/RuleGenerator.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.rules.generators 2 | 3 | import com.twitter.visibility.models.SafetyLevel 4 | import com.twitter.visibility.rules.Rule 5 | 6 | trait RuleGenerator { 7 | def rulesForSurface(safetyLevel: SafetyLevel): Seq[Rule] 8 | } 9 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasSimilarToContext.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasSimilarToContext { 4 | 5 | // user ids that are used to generate similar to recommendations 6 | def similarToUserIds: Seq[Long] 7 | } 8 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/common/relevance/features/QueryFeatureType.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.common.relevance.features; 2 | 3 | /** 4 | * An enum to hold different types of query-specific features (these are not indexed in Earlybird) 5 | */ 6 | public enum QueryFeatureType { 7 | SOCIAL_ENGAGEMENTS, 8 | CLICKS 9 | } 10 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/gate/ShouldContinue.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.functional_component.gate 2 | 3 | import com.twitter.product_mixer.core.pipeline.PipelineQuery 4 | 5 | trait ShouldContinue[Query <: PipelineQuery] { 6 | def apply(query: Query): Boolean 7 | } 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/HasSortIndex.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt 2 | 3 | trait HasSortIndex { timelineEntry: TimelineEntry => 4 | def sortIndex: Option[Long] 5 | 6 | def withSortIndex(sortIndex: Long): TimelineEntry 7 | } 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/promoted/Preroll.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.promoted 2 | 3 | case class Preroll( 4 | prerollId: Option[String], 5 | dynamicPrerollType: Option[DynamicPrerollType], 6 | mediaInfo: Option[MediaInfo]) 7 | -------------------------------------------------------------------------------- /pushservice/src/main/scala/com/twitter/frigate/pushservice/exception/TweetNTabRequestHydratorException.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.frigate.pushservice.exception 2 | 3 | import scala.util.control.NoStackTrace 4 | 5 | class TweetNTabRequestHydratorException(private val message: String) 6 | extends Exception(message) 7 | with NoStackTrace 8 | -------------------------------------------------------------------------------- /pushservice/src/main/scala/com/twitter/frigate/pushservice/util/FunctionalUtil.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.frigate.pushservice.util 2 | 3 | import com.twitter.finagle.stats.Counter 4 | 5 | object FunctionalUtil { 6 | def incr[T](counter: Counter): T => T = { x => 7 | { 8 | counter.incr() 9 | x 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird/exception/ClientException.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird.exception; 2 | 3 | public class ClientException extends Exception { 4 | public ClientException(Throwable t) { 5 | super(t); 6 | } 7 | 8 | public ClientException(String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird_root/validators/BUILD: -------------------------------------------------------------------------------- 1 | java_library( 2 | sources = ["*.java"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "src/java/com/twitter/search/common/schema/earlybird", 7 | "src/thrift/com/twitter/search:earlybird-java", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/ingester/pipeline/util/ResponseNotReturnedException.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.ingester.pipeline.util; 2 | 3 | public class ResponseNotReturnedException extends Exception { 4 | ResponseNotReturnedException(Object request) { 5 | super("Response not returned in batch for request: " + request); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/scio/bq_generation/common/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = [ 3 | "*.scala", 4 | ], 5 | platform = "java8", 6 | tags = ["bazel-compatible"], 7 | dependencies = [ 8 | "src/scala/com/twitter/wtf/beam/bq_embedding_export:bq_embedding_export_lib", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /tweetypie/server/src/main/scala/com/twitter/tweetypie/federated/columns/FederatedFieldReq.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.tweetypie.federated.columns 2 | 3 | import com.twitter.tweetypie.TweetId 4 | 5 | // Case class to be used for grouping Stitch requests 6 | // for Federated Fields 7 | case class FederatedFieldReq(tweetId: TweetId, fieldId: Short) 8 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/candidate_sources/addressbook/README.md: -------------------------------------------------------------------------------- 1 | # Address Book Candidate Source 2 | Provides the accounts of a given user's forward and reverse phone and email book contacts. 3 | It is only available when the user has synced their address book with the service. 4 | 5 | -------------------------------------------------------------------------------- /home-mixer/server/src/main/scala/com/twitter/home_mixer/param/decider/BUILD.bazel: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | platform = "java8", 5 | strict_deps = True, 6 | tags = ["bazel-compatible"], 7 | dependencies = [ 8 | "servo/decider", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/feature/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | platform = "java8", 5 | strict_deps = True, 6 | tags = ["bazel-compatible"], 7 | dependencies = [ 8 | "util/util-core", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/TimelinesDetails.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | case class TimelinesDetails( 4 | injectionType: Option[String], 5 | controllerData: Option[String], 6 | sourceData: Option[String]) 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/promoted/DisclaimerType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.promoted 2 | 3 | sealed trait DisclaimerType 4 | 5 | object DisclaimerPolitical extends DisclaimerType 6 | object DisclaimerIssue extends DisclaimerType 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/richtext/RichTextAlignment.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.richtext 2 | 3 | sealed trait RichTextAlignment 4 | 5 | case object Natural extends RichTextAlignment 6 | case object Center extends RichTextAlignment 7 | -------------------------------------------------------------------------------- /src/scala/com/twitter/timelines/prediction/features/itl/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "src/java/com/twitter/ml/api:api-base", 7 | "src/thrift/com/twitter/dal/personal_data:personal_data-java", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /src/scala/com/twitter/timelines/prediction/features/recap/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "src/java/com/twitter/ml/api:api-base", 7 | "src/thrift/com/twitter/dal/personal_data:personal_data-java", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/richtext/RichText.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.richtext 2 | 3 | case class RichText( 4 | text: String, 5 | entities: List[RichTextEntity], 6 | rtl: Option[Boolean], 7 | alignment: Option[RichTextAlignment]) 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/richtext/RichTextEntity.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.richtext 2 | 3 | case class RichTextEntity( 4 | fromIndex: Int, 5 | toIndex: Int, 6 | ref: Option[ReferenceObject], 7 | format: Option[RichTextFormat]) 8 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird/archive/segmentbuilder/SegmentBuilderMain.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird.archive.segmentbuilder; 2 | 3 | public final class SegmentBuilderMain { 4 | 5 | private SegmentBuilderMain() { } 6 | 7 | public static void main(String[] args) { 8 | new SegmentBuilderApp().main(args); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/score/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | platform = "java8", 3 | tags = ["bazel-compatible"], 4 | dependencies = [ 5 | "finagle/finagle-stats", 6 | "hermit/hermit-core/src/main/scala/com/twitter/hermit/store/common", 7 | "src/scala/com/twitter/simclusters_v2/stores", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /twml/twml/contrib/readers/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """This module contains experimental readers classes""" 3 | from .batch_prediction_request import BatchPredictionRequest # noqa: F401 4 | from .data_record import DataRecord # noqa: F401 5 | from .hashed_batch_prediction_request import HashedBatchPredictionRequest # noqa: F401 6 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/rules/providers/PolicyProvider.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.rules.providers 2 | 3 | import com.twitter.visibility.models.SafetyLevel 4 | import com.twitter.visibility.rules.VisibilityPolicy 5 | 6 | trait PolicyProvider { 7 | def policyForSurface(safetyLevel: SafetyLevel): VisibilityPolicy 8 | } 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/HasExcludedIds.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.request 2 | 3 | /** 4 | * Allow clients to pass in a set of IDs that would be excluded from the results. 5 | */ 6 | trait HasExcludedIds { 7 | val excludedIds: Set[Long] = Set.empty 8 | } 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/TimelineMetadata.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt 2 | 3 | case class TimelineMetadata( 4 | title: Option[String], 5 | scribeConfig: Option[TimelineScribeConfig], 6 | readerModeConfig: Option[ReaderModeConfig] = None) 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/alert/ShowAlertDisplayLocation.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.alert 2 | 3 | sealed trait ShowAlertDisplayLocation 4 | case object Top extends ShowAlertDisplayLocation 5 | case object Bottom extends ShowAlertDisplayLocation 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/icon/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | platform = "java8", 5 | strict_deps = True, 6 | tags = ["bazel-compatible"], 7 | dependencies = [], 8 | exports = [], 9 | ) 10 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/MarkUnreadableEntry.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | // Track unread entries for the MarkUnread URT instruction. 4 | trait MarkUnreadableEntry { 5 | def isMarkUnread: Option[Boolean] = None 6 | } 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/promoted/UrlOverrideType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.promoted 2 | 3 | sealed trait UrlOverrideType 4 | 5 | object UnknownUrlOverrideType extends UrlOverrideType 6 | object DcmUrlOverrideType extends UrlOverrideType 7 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird_root/validators/ServiceResponseValidator.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird_root.validators; 2 | 3 | import com.twitter.util.Future; 4 | 5 | public interface ServiceResponseValidator { 6 | /** 7 | * Interface for validating Service responses 8 | */ 9 | Future validate(R response); 10 | } 11 | -------------------------------------------------------------------------------- /src/scala/com/twitter/timelines/prediction/features/list_features/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "src/java/com/twitter/ml/api:api-base", 7 | "src/thrift/com/twitter/dal/personal_data:personal_data-java", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /src/scala/com/twitter/timelines/prediction/features/p_home_latest/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "src/java/com/twitter/ml/api:api-base", 7 | "src/thrift/com/twitter/dal/personal_data:personal_data-java", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /src/scala/com/twitter/timelines/prediction/features/request_context/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "src/java/com/twitter/ml/api:api-base", 7 | "src/thrift/com/twitter/dal/personal_data:personal_data-java", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /tweetypie/common/src/thrift/com/twitter/tweetypie/storage_internal/BUILD: -------------------------------------------------------------------------------- 1 | create_thrift_libraries( 2 | base_name = "storage_internal", 3 | sources = ["*.thrift"], 4 | platform = "java8", 5 | strict_deps = True, 6 | tags = ["bazel-compatible"], 7 | generate_languages = [ 8 | "java", 9 | "scala", 10 | ], 11 | ) 12 | -------------------------------------------------------------------------------- /ann/src/main/scala/com/twitter/ann/dataflow/offline/FlatEmbeddingData.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.ann.dataflow.offline 2 | 3 | import com.twitter.beam.schemas.SchemaFieldName 4 | 5 | case class FlatEmbeddingData( 6 | @SchemaFieldName("entityId") entityId: Option[Long], 7 | @SchemaFieldName("embedding") embedding: Seq[Double]) 8 | extends BaseEmbeddingData 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/candidate_source/strato/StratoKeyView.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.functional_component.candidate_source.strato 2 | 3 | /** Represents a Strato column's Key and View arguments */ 4 | case class StratoKeyView[StratoKey, StratoView](key: StratoKey, view: StratoView) 5 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/UniversalNoun.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.common 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeInfo 4 | 5 | @JsonTypeInfo(include = JsonTypeInfo.As.PROPERTY, use = JsonTypeInfo.Id.NAME) 6 | trait UniversalNoun[+T] extends Equals { 7 | def id: T 8 | } 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/generic_summary/GenericSummaryDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.generic_summary 2 | 3 | sealed trait GenericSummaryItemDisplayType 4 | 5 | case object HeroDisplayType extends GenericSummaryItemDisplayType 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/service/gate_executor/GateExecutorResult.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.service.gate_executor 2 | 3 | import com.twitter.product_mixer.core.service.ExecutorResult 4 | 5 | case class GateExecutorResult( 6 | individualGateResults: Seq[ExecutedGateResult]) 7 | extends ExecutorResult 8 | -------------------------------------------------------------------------------- /pushservice/src/main/scala/com/twitter/frigate/pushservice/target/TargetAppPermissions.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.frigate.pushservice.target 2 | 3 | import com.twitter.permissions_storage.thriftscala.AppPermission 4 | import com.twitter.util.Future 5 | 6 | trait TargetAppPermissions { 7 | 8 | def appPermissions: Future[Option[AppPermission]] 9 | 10 | } 11 | -------------------------------------------------------------------------------- /representation-scorer/server/src/main/scala/com/twitter/representationscorer/common/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | compiler_option_sets = ["fatal_warnings"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "decider/src/main/scala", 7 | "src/scala/com/twitter/simclusters_v2/common", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /src/scala/com/twitter/recos/user_tweet_graph/store/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | tags = ["bazel-compatible"], 4 | dependencies = [ 5 | "3rdparty/jvm/com/twitter/storehaus:core", 6 | "src/scala/com/twitter/simclusters_v2/common", 7 | "src/thrift/com/twitter/socialgraph:thrift-scala", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /src/scala/com/twitter/recos/user_video_graph/store/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | tags = ["bazel-compatible"], 4 | dependencies = [ 5 | "3rdparty/jvm/com/twitter/storehaus:core", 6 | "src/scala/com/twitter/simclusters_v2/common", 7 | "src/thrift/com/twitter/socialgraph:thrift-scala", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /timelines/data_processing/ml_util/aggregation_framework/AggregateSource.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelines.data_processing.ml_util.aggregation_framework 2 | 3 | import com.twitter.ml.api.Feature 4 | import java.lang.{Long => JLong} 5 | 6 | trait AggregateSource extends Serializable { 7 | def name: String 8 | def timestampFeature: Feature[JLong] 9 | } 10 | -------------------------------------------------------------------------------- /twml/twml/readers/hashed_data_record.py: -------------------------------------------------------------------------------- 1 | # checkstyle: noqa 2 | # pylint: disable=invalid-name 3 | """ 4 | This module includes facilities for manipulating hashed data records. 5 | """ 6 | 7 | from twitter.deepbird.io.legacy.readers.hashed_data_record import ( 8 | _HASHED_FIELDS, 9 | _FEATURE_NAMES, 10 | _FEATURE_TYPES, 11 | HashedDataRecord, 12 | ) 13 | -------------------------------------------------------------------------------- /unified_user_actions/adapter/src/main/scala/com/twitter/unified_user_actions/adapter/common/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = [ 3 | "*.scala", 4 | ], 5 | tags = ["bazel-compatible"], 6 | dependencies = [ 7 | "snowflake/src/main/scala/com/twitter/snowflake/id", 8 | "util/util-core:util-core-util", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/interfaces/blender/CombinedVisibilityResult.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.interfaces.blender 2 | 3 | import com.twitter.visibility.builder.VisibilityResult 4 | 5 | case class CombinedVisibilityResult( 6 | tweetVisibilityResult: VisibilityResult, 7 | quotedTweetVisibilityResult: Option[VisibilityResult]) 8 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/interfaces/search/CombinedVisibilityResult.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.interfaces.search 2 | 3 | import com.twitter.visibility.builder.VisibilityResult 4 | 5 | case class CombinedVisibilityResult( 6 | tweetVisibilityResult: VisibilityResult, 7 | quotedTweetVisibilityResult: Option[VisibilityResult]) 8 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasInvalidRelationshipUserIds.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasInvalidRelationshipUserIds { 4 | // user ids that have invalid relationship with the target user 5 | def invalidRelationshipUserIds: Option[Set[Long]] 6 | } 7 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/assembler/models/Title.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.assembler.models 2 | 3 | import com.twitter.follow_recommendations.{thriftscala => t} 4 | 5 | case class Title(text: String) { 6 | lazy val toThrift: t.Title = { 7 | t.Title(text) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/scala/com/twitter/timelines/prediction/common/aggregates/real_time/TypeSafeRunner.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelines.prediction.common.aggregates.real_time 2 | 3 | import com.twitter.summingbird_internal.runner.storm.GenericRunner 4 | 5 | object TypeSafeRunner { 6 | def main(args: Array[String]): Unit = GenericRunner(args, TimelinesRealTimeAggregatesJob(_)) 7 | } 8 | -------------------------------------------------------------------------------- /tweetypie/common/src/scala/com/twitter/tweetypie/storage/package.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.tweetypie 2 | 3 | import com.twitter.storage.client.manhattan.kv.ManhattanValue 4 | import java.nio.ByteBuffer 5 | 6 | package object storage { 7 | type TweetId = Long 8 | type FieldId = Short 9 | 10 | type TweetManhattanValue = ManhattanValue[ByteBuffer] 11 | } 12 | -------------------------------------------------------------------------------- /tweetypie/common/src/scala/com/twitter/tweetypie/thriftscala/NotImplementedTweetService.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.tweetypie.thriftscala 2 | 3 | import com.twitter.finagle.service.FailedService 4 | 5 | class NotImplementedTweetService 6 | extends TweetService$FinagleClient( 7 | new FailedService(new UnsupportedOperationException("not implemented")) 8 | ) 9 | -------------------------------------------------------------------------------- /twml/twml/contrib/trainers/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """This module contains experimental trainer classes""" 3 | from .batch_prediction_request_trainer import BatchPredictionRequestTrainer # noqa: F401 4 | from .pruning_data_record_trainer import PruningDataRecordTrainer # noqa: F401 5 | from .trainer_utils import build_keras_trainer # noqa: F401 6 | -------------------------------------------------------------------------------- /home-mixer/server/src/main/scala/com/twitter/home_mixer/param/BUILD.bazel: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | strict_deps = True, 5 | tags = ["bazel-compatible"], 6 | dependencies = [ 7 | "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/product", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/media/Media.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.media 2 | 3 | case class Media( 4 | mediaEntity: Option[MediaEntity], 5 | mediaKey: Option[MediaKey], 6 | imagePossibleCropping: Option[List[Rect]], 7 | aspectRatio: Option[AspectRatio]) 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/ConfirmationDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | sealed trait ConfirmationDisplayType 4 | 5 | case object Inline extends ConfirmationDisplayType 6 | case object BottomSheet extends ConfirmationDisplayType 7 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird_root/filters/PostCacheRequestTypeCountFilter.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird_root.filters; 2 | 3 | import javax.inject.Inject; 4 | 5 | public class PostCacheRequestTypeCountFilter extends RequestTypeCountFilter { 6 | @Inject 7 | public PostCacheRequestTypeCountFilter() { 8 | super("post_cache"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird_root/filters/PreCacheRequestTypeCountFilter.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird_root.filters; 2 | 3 | import javax.inject.Inject; 4 | 5 | public class PreCacheRequestTypeCountFilter extends RequestTypeCountFilter { 6 | @Inject 7 | public PreCacheRequestTypeCountFilter() { 8 | super("pre_cache"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /unified_user_actions/graphql/README.md: -------------------------------------------------------------------------------- 1 | Documents 2 | ========= 3 | 4 | TweetHydration 5 | -------------- 6 | 7 | Upload 8 | ------ 9 | 10 | ``` 11 | $ graphql stored_document put unified_user_actions/graphql/TweetHydration.graphql 12 | ``` 13 | 14 | DocumentId: `M5sHxua-RDiRtTn48CAhng` 15 | Test: https://graphql.twitter.com/snaptest/tests/1580340324727017472/ 16 | -------------------------------------------------------------------------------- /navi/navi/proto/tensorflow/core/protobuf/transport_options.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorflow; 4 | 5 | option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto"; 6 | 7 | // Extra data needed on a non-RDMA RecvBufResponse. 8 | message RecvBufRespExtra { 9 | repeated bytes tensor_content = 1; 10 | } 11 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/service/pipeline_execution_logger/PipelineExecutionLogger.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.service.pipeline_execution_logger 2 | 3 | import com.twitter.product_mixer.core.pipeline.PipelineQuery 4 | 5 | trait PipelineExecutionLogger { 6 | def apply(pipelineQuery: PipelineQuery, message: Any): Unit 7 | } 8 | -------------------------------------------------------------------------------- /ann/src/main/thrift/com/twitter/ann/knn/BUILD: -------------------------------------------------------------------------------- 1 | create_thrift_libraries( 2 | base_name = "thrift", 3 | sources = ["*.thrift"], 4 | platform = "java8", 5 | tags = ["bazel-compatible"], 6 | dependency_roots = ["src/thrift/com/twitter/ml/featurestore:ml-feature-store"], 7 | generate_languages = [ 8 | "java", 9 | "scala", 10 | ], 11 | ) 12 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/assembler/models/Header.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.assembler.models 2 | 3 | import com.twitter.follow_recommendations.{thriftscala => t} 4 | 5 | case class Header(title: Title) { 6 | lazy val toThrift: t.Header = { 7 | t.Header(title.toThrift) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/models/failures/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | compiler_option_sets = ["fatal_warnings"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/pipeline_failure", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /home-mixer/server/src/main/scala/com/twitter/home_mixer/model/request/HomeMixerDebugOptions.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.home_mixer.model.request 2 | 3 | import com.twitter.product_mixer.core.model.marshalling.request.DebugOptions 4 | import com.twitter.util.Time 5 | 6 | case class HomeMixerDebugOptions( 7 | override val requestTimeOverride: Option[Time]) 8 | extends DebugOptions 9 | -------------------------------------------------------------------------------- /product-mixer/component-library/src/main/scala/com/twitter/product_mixer/component_library/candidate_source/social_graph/SocialgraphCursorConstants.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.component_library.candidate_source.social_graph 2 | 3 | object SocialgraphCursorConstants { 4 | val EndCursor: Long = 0L 5 | val StartCursor: Long = -1L 6 | val LastSortIndex: Long = 0L 7 | } 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/contextual_ref/OuterTweetContext.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.contextual_ref 2 | 3 | sealed trait OuterTweetContext 4 | 5 | case class QuoteTweetId(id: Long) extends OuterTweetContext 6 | case class RetweetId(id: Long) extends OuterTweetContext 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/promoted/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | platform = "java8", 5 | strict_deps = True, 6 | tags = ["bazel-compatible"], 7 | dependencies = [ 8 | ], 9 | exports = [ 10 | ], 11 | ) 12 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/reaction/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | platform = "java8", 5 | strict_deps = True, 6 | tags = ["bazel-compatible"], 7 | dependencies = [ 8 | ], 9 | exports = [ 10 | ], 11 | ) 12 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/richtext/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | platform = "java8", 5 | strict_deps = True, 6 | tags = ["bazel-compatible"], 7 | dependencies = [ 8 | ], 9 | exports = [ 10 | ], 11 | ) 12 | -------------------------------------------------------------------------------- /tweetypie/server/src/main/scala/com/twitter/tweetypie/repository/package.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.tweetypie 2 | 3 | import com.twitter.context.TwitterContext 4 | package object repository { 5 | // Bring Tweetypie permitted TwitterContext into scope 6 | val TwitterContext: TwitterContext = 7 | com.twitter.context.TwitterContext(com.twitter.tweetypie.TwitterContextPermit) 8 | } 9 | -------------------------------------------------------------------------------- /ann/src/main/python/dataflow/worker_harness/cloudbuild.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - name: 'gcr.io/cloud-builders/docker' 3 | args: ['build', '-t', 'gcr.io/twttr-recos-ml-prod/dataflow-gpu/beam2_39_0_py3_7', '.'] 4 | - name: 'gcr.io/cloud-builders/docker' 5 | args: ['push', 'gcr.io/twttr-recos-ml-prod/dataflow-gpu/beam2_39_0_py3_7'] 6 | images: ['gcr.io/twttr-recos-ml-prod/dataflow-gpu/beam2_39_0_py3_7'] -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/access_policy/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | strict_deps = True, 5 | tags = ["bazel-compatible"], 6 | dependencies = [ 7 | "3rdparty/jvm/com/fasterxml/jackson/core:jackson-annotations", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/alert/ShowAlertIconDisplayInfo.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.alert 2 | 3 | import com.twitter.product_mixer.core.model.marshalling.response.urt.color.RosettaColor 4 | 5 | case class ShowAlertIconDisplayInfo(icon: ShowAlertIcon, tint: RosettaColor) 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/user/UserReactiveTriggers.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.user 2 | 3 | import com.twitter.product_mixer.core.model.marshalling.response.urt.reaction.TimelineReaction 4 | 5 | case class UserReactiveTriggers(onFollow: Option[TimelineReaction]) 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/timeline_module/ModuleFooter.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module 2 | 3 | import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.Url 4 | 5 | case class ModuleFooter( 6 | text: String, 7 | landingUrl: Option[Url]) 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/service/pipeline_selector_executor/PipelineSelectorExecutorResult.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.service.pipeline_selector_executor 2 | 3 | import com.twitter.product_mixer.core.model.common.identifier.ComponentIdentifier 4 | 5 | case class PipelineSelectorExecutorResult(pipelineIdentifier: ComponentIdentifier) 6 | -------------------------------------------------------------------------------- /pushservice/src/main/scala/com/twitter/frigate/pushservice/model/ntab/NTabRequest.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.frigate.pushservice.model.ntab 2 | 3 | import com.twitter.notificationservice.thriftscala.CreateGenericNotificationRequest 4 | import com.twitter.util.Future 5 | 6 | trait NTabRequest { 7 | 8 | def ntabRequest: Future[Option[CreateGenericNotificationRequest]] 9 | 10 | } 11 | -------------------------------------------------------------------------------- /pushservice/src/main/scala/com/twitter/frigate/pushservice/take/predicates/BasicRFPHPredicates.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.frigate.pushservice.take.predicates 2 | import com.twitter.frigate.pushservice.model.PushTypes.PushCandidate 3 | import com.twitter.hermit.predicate.NamedPredicate 4 | 5 | trait BasicRFPHPredicates[C <: PushCandidate] { 6 | val predicates: List[NamedPredicate[C]] 7 | } 8 | -------------------------------------------------------------------------------- /timelineranker/server/src/main/scala/com/twitter/timelineranker/config/StagingUnderlyingConfiguration.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelineranker.config 2 | 3 | import com.twitter.finagle.stats.StatsReceiver 4 | 5 | class StagingUnderlyingClientConfiguration(flags: TimelineRankerFlags, statsReceiver: StatsReceiver) 6 | extends DefaultUnderlyingClientConfiguration(flags, statsReceiver) 7 | -------------------------------------------------------------------------------- /tweetypie/servo/util/src/main/scala/com/twitter/servo/util/ThreadLocalStringBuilder.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.servo.util 2 | 3 | class ThreadLocalStringBuilder(initialSize: Int) extends ThreadLocal[StringBuilder] { 4 | override def initialValue = new StringBuilder(initialSize) 5 | 6 | def apply() = { 7 | val buf = get 8 | buf.setLength(0) 9 | buf 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/interfaces/conversations/TimelineConversationsVisibilityResponse.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.interfaces.conversations 2 | 3 | import com.twitter.visibility.builder.VisibilityResult 4 | 5 | case class TimelineConversationsVisibilityResponse( 6 | visibilityResults: Map[Long, VisibilityResult], 7 | failedTweetIds: Seq[Long]) 8 | -------------------------------------------------------------------------------- /ann/src/main/thrift/com/twitter/ann/serialization/serialization.thrift: -------------------------------------------------------------------------------- 1 | #@namespace scala com.twitter.ann.serialization.thriftscala 2 | 3 | include "com/twitter/ml/api/embedding.thrift" 4 | /** 5 | * Thrift schema for storing embeddings in a file 6 | */ 7 | struct PersistedEmbedding { 8 | 1: required binary id 9 | 2: required embedding.Embedding embedding 10 | }(persisted = 'true') 11 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/rankers/weighted_candidate_source_ranker/WeightMethod.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.rankers.weighted_candidate_source_ranker 2 | 3 | object WeightMethod extends Enumeration { 4 | type WeightMethod = Value 5 | val WeightedRandomSampling, WeightedRoundRobin = Value 6 | } 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TopicPageHeaderFacepile.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urp 2 | 3 | import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.Url 4 | 5 | case class TopicPageHeaderFacepile( 6 | userIds: Seq[Long], 7 | facepileUrl: Option[Url] = None) 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/CommerceDetails.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | case class CommerceDetails( 4 | dropId: Option[Long], 5 | shopV2Id: Option[Long], 6 | productKey: Option[Long], 7 | merchantId: Option[Long], 8 | productIndex: Option[Int]) 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/ImageDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | sealed trait ImageDisplayType 4 | 5 | case object Icon extends ImageDisplayType 6 | case object FullWidth extends ImageDisplayType 7 | case object IconSmall extends ImageDisplayType 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/state/HasCandidates.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.pipeline.state 2 | 3 | import com.twitter.product_mixer.core.model.common.UniversalNoun 4 | 5 | trait HasCandidates[Candidate <: UniversalNoun[Any], T] { 6 | def candidates: Seq[Candidate] 7 | def updateCandidates(newCandidates: Seq[Candidate]): T 8 | } 9 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/common/search/DocIdTracker.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.common.search; 2 | 3 | /** 4 | * Provide an accessor for a doc ID. This is useful for classes that iterate through doc IDs 5 | * and maintain a "last seen" doc ID. 6 | */ 7 | public interface DocIdTracker { 8 | /** 9 | * Retrieve current doc ID 10 | */ 11 | int getCurrentDocId(); 12 | } 13 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird.exception; 2 | 3 | public class BadRequestException extends Exception { 4 | public BadRequestException(String message, Throwable cause) { 5 | super(message, cause); 6 | } 7 | 8 | public BadRequestException(String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/python/twitter/deepbird/projects/timelines/scripts/models/earlybird/lolly/reader.py: -------------------------------------------------------------------------------- 1 | class LollyModelReader(object): 2 | def __init__(self, lolly_model_file_path): 3 | self._lolly_model_file_path = lolly_model_file_path 4 | 5 | def read(self, process_line_fn): 6 | with open(self._lolly_model_file_path, "r") as file: 7 | for line in file: 8 | process_line_fn(line) 9 | -------------------------------------------------------------------------------- /timelineranker/server/src/main/scala/com/twitter/timelineranker/config/TimelineRankerConstants.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelineranker.config 2 | 3 | object TimelineRankerConstants { 4 | val ClientPrefix = "timelineranker." 5 | val ManhattanStarbuckAppId = "timelineranker" 6 | val WarmupClientName = "timelineranker.warmup" 7 | val ForwardedClientName = "timelineranker.forwarded" 8 | } 9 | -------------------------------------------------------------------------------- /tweetypie/server/src/main/scala/com/twitter/tweetypie/federated/columns/TweetypieContactInfo.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.tweetypie.federated.columns 2 | 3 | import com.twitter.strato.config.ContactInfo 4 | 5 | object TweetypieContactInfo 6 | extends ContactInfo( 7 | contactEmail = "", 8 | ldapGroup = "", 9 | jiraProject = "", 10 | slackRoomId = "" 11 | ) 12 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/rankers/utils/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | compiler_option_sets = ["fatal_warnings"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/assembler/models/Footer.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.assembler.models 2 | 3 | import com.twitter.follow_recommendations.{thriftscala => t} 4 | 5 | case class Footer(action: Option[Action]) { 6 | lazy val toThrift: t.Footer = { 7 | t.Footer(action.map(_.toThrift)) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/ItemPresentation.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.common.presentation 2 | 3 | trait ItemPresentation extends UniversalPresentation { 4 | // Optional field which if populated, will group the items into the specified module 5 | def modulePresentation: Option[ModulePresentation] = None 6 | } 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/cover/HalfCoverDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.cover 2 | 3 | sealed trait HalfCoverDisplayType 4 | 5 | case object CoverHalfCoverDisplayType extends HalfCoverDisplayType 6 | case object CenterCoverHalfCoverDisplayType extends HalfCoverDisplayType 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/promoted/ClickTrackingInfo.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.promoted 2 | 3 | import scala.collection.Map 4 | 5 | case class ClickTrackingInfo( 6 | urlParams: Map[String, String], 7 | urlOverride: Option[String], 8 | urlOverrideType: Option[UrlOverrideType]) 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/promoted/DynamicPrerollType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.promoted 2 | 3 | sealed trait DynamicPrerollType 4 | 5 | object Amplify extends DynamicPrerollType 6 | object Marketplace extends DynamicPrerollType 7 | object LiveTvEvent extends DynamicPrerollType 8 | -------------------------------------------------------------------------------- /representation-manager/server/src/main/scala/com/twitter/representation_manager/columns/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | compiler_option_sets = ["fatal_warnings"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "strato/src/main/scala/com/twitter/strato/fed", 7 | "strato/src/main/scala/com/twitter/strato/fed/server", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /representation-scorer/server/src/main/scala/com/twitter/representationscorer/common/DeciderConstants.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.representationscorer 2 | 3 | object DeciderConstants { 4 | val enableSimClustersEmbeddingStoreTimeouts = "enable_sim_clusters_embedding_store_timeouts" 5 | val simClustersEmbeddingStoreTimeoutValueMillis = 6 | "sim_clusters_embedding_store_timeout_value_millis" 7 | } 8 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird_root/common/InjectionNames.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird_root.common; 2 | 3 | public final class InjectionNames { 4 | 5 | public static final String FULL_ARCHIVE = "full_archive"; 6 | public static final String REALTIME = "realtime"; 7 | public static final String PROTECTED = "protected"; 8 | 9 | private InjectionNames() { } 10 | } 11 | -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/scalding/offline_job/adhoc/README: -------------------------------------------------------------------------------- 1 | To reproduce, you need to run 2 | 3 | 1. SimClustersTweetEmbeddingAdhocApp to generate cluster -> top tweets and tweet -> top clusters data sets 4 | 2. TweetSimilarityEvaluationSamplingAdhocApp to sample a subset of tweets that you want to compute some metrics on 5 | 3. TweetSimilarityEvaluationAdhocApp to perform the evaluation 6 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/interfaces/dms/DmEventVisibilityRequest.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.interfaces.dms 2 | 3 | import com.twitter.visibility.models.SafetyLevel 4 | import com.twitter.visibility.models.ViewerContext 5 | 6 | case class DmEventVisibilityRequest( 7 | dmEventId: Long, 8 | safetyLevel: SafetyLevel, 9 | viewerContext: ViewerContext) 10 | -------------------------------------------------------------------------------- /cr-mixer/server/src/main/scala/com/twitter/cr_mixer/model/HealthThreshold.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.cr_mixer.model 2 | 3 | object HealthThreshold { 4 | object Enum extends Enumeration { 5 | val Off: Value = Value(1) 6 | val Moderate: Value = Value(2) 7 | val Strict: Value = Value(3) 8 | val Stricter: Value = Value(4) 9 | val StricterPlus: Value = Value(5) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/transforms/dedup/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | compiler_option_sets = ["fatal_warnings"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/base", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/assembler/models/Action.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.assembler.models 2 | 3 | import com.twitter.follow_recommendations.{thriftscala => t} 4 | 5 | case class Action(text: String, actionURL: String) { 6 | lazy val toThrift: t.Action = { 7 | t.Action(text, actionURL) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /product-mixer/component-library/src/main/scala/com/twitter/product_mixer/component_library/decorator/urt/builder/richtext/twitter_text/TwitterTextRendererProcessor.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.component_library.decorator.urt.builder.richtext.twitter_text 2 | 3 | trait TwitterTextRendererProcessor { 4 | def process(twitterTextRichTextBuilder: TwitterTextRenderer): TwitterTextRenderer 5 | } 6 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/label/LabelDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.label 2 | 3 | sealed trait LabelDisplayType 4 | 5 | case object InlineHeaderLabelDisplayType extends LabelDisplayType 6 | case object OtherRepliesSectionHeaderLabelDisplayType extends LabelDisplayType 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/user/UserDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.user 2 | 3 | sealed trait UserDisplayType 4 | 5 | case object User extends UserDisplayType 6 | case object UserDetailed extends UserDisplayType 7 | case object PendingFollowUser extends UserDisplayType 8 | -------------------------------------------------------------------------------- /timelines/data_processing/ad_hoc/earlybird_ranking/earlybird_ranking/BUILD: -------------------------------------------------------------------------------- 1 | target( 2 | name = "earlybird_ranking", 3 | dependencies = [ 4 | "timelines/data_processing/ad_hoc/earlybird_ranking/common", 5 | "timelines/data_processing/ad_hoc/earlybird_ranking/model_evaluation", 6 | "timelines/data_processing/ad_hoc/earlybird_ranking/training_data_generation", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /ann/src/main/thrift/com/twitter/ann/serialization/BUILD: -------------------------------------------------------------------------------- 1 | create_thrift_libraries( 2 | base_name = "serialization", 3 | sources = ["*.thrift"], 4 | platform = "java8", 5 | tags = ["bazel-compatible"], 6 | dependency_roots = [ 7 | "src/thrift/com/twitter/ml/api:embedding", 8 | ], 9 | generate_languages = [ 10 | "java", 11 | "scala", 12 | ], 13 | ) 14 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/configapi/deciders/DeciderParams.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.configapi.deciders 2 | 3 | import com.twitter.timelines.configapi.Param 4 | 5 | object DeciderParams { 6 | object EnableRecommendations extends Param[Boolean](false) 7 | object EnableScoreUserCandidates extends Param[Boolean](false) 8 | } 9 | -------------------------------------------------------------------------------- /follow-recommendations-service/thrift/src/main/thrift/engagementType.thrift: -------------------------------------------------------------------------------- 1 | namespace java com.twitter.follow_recommendations.thriftjava 2 | #@namespace scala com.twitter.follow_recommendations.thriftscala 3 | #@namespace strato com.twitter.follow_recommendations 4 | 5 | enum EngagementType { 6 | Click = 0 7 | Like = 1 8 | Mention = 2 9 | Retweet = 3 10 | ProfileView = 4 11 | } 12 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/ReplyPinState.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | sealed trait ReplyPinState 4 | 5 | object PinnedReplyPinState extends ReplyPinState 6 | object PinnableReplyPinState extends ReplyPinState 7 | object NotPinnableReplyPinState extends ReplyPinState 8 | -------------------------------------------------------------------------------- /simclusters-ann/server/src/main/scala/com/twitter/simclustersann/exceptions/MissingClusterConfigForSimClustersAnnVariantException.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.simclustersann.exceptions 2 | 3 | case class MissingClusterConfigForSimClustersAnnVariantException(sannServiceName: String) 4 | extends IllegalStateException( 5 | s"No cluster configuration found for service ($sannServiceName)", 6 | null) 7 | -------------------------------------------------------------------------------- /src/scala/com/twitter/interaction_graph/scio/README.md: -------------------------------------------------------------------------------- 1 | # Interaction Graph 2 | 3 | This folder contains the code used in the offline pipeline for real graph v2. 4 | 5 | The ETL jobs are contained in folders prefaced with `agg_*`, while the jobs powering the ml pipeline are in the ml folder. 6 | 7 | Note that the jobs in the ml folder are mostly ETL jobs; the main training and scoring happens within BQML. 8 | -------------------------------------------------------------------------------- /tweetypie/server/src/main/scala/com/twitter/tweetypie/service/observer/package.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.tweetypie 2 | package service 3 | 4 | import com.twitter.util.Try 5 | 6 | package object observer { 7 | 8 | /** 9 | * Generic Request/Result observer container for making observations on both requests/results. 10 | */ 11 | type ObserveExchange[Req, Res] = (Req, Try[Res]) 12 | 13 | } 14 | -------------------------------------------------------------------------------- /unified_user_actions/adapter/src/main/scala/com/twitter/unified_user_actions/adapter/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | name = "base", 3 | sources = [ 4 | "AbstractAdapter.scala", 5 | ], 6 | compiler_option_sets = ["fatal_warnings"], 7 | tags = ["bazel-compatible"], 8 | dependencies = [ 9 | "util/util-stats/src/main/scala/com/twitter/finagle/stats", 10 | ], 11 | ) 12 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/interfaces/notifications/NotificationVFRequest.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.interfaces.notifications 2 | 3 | import com.twitter.visibility.models.ContentId 4 | import com.twitter.visibility.models.SafetyLevel 5 | 6 | case class NotificationVFRequest( 7 | recipientId: Long, 8 | subject: ContentId.UserId, 9 | safetyLevel: SafetyLevel) 10 | -------------------------------------------------------------------------------- /ann/src/main/scala/com/twitter/ann/featurestore/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "ann/src/main/scala/com/twitter/ann/common", 7 | "src/scala/com/twitter/ml/featurestore/lib", 8 | "src/scala/com/twitter/ml/featurestore/lib/online", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/products/home_timeline_tweet_recs/configapi/HomeTimelineTweetRecsParams.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.products.home_timeline_tweet_recs.configapi 2 | 3 | import com.twitter.timelines.configapi.Param 4 | 5 | object HomeTimelineTweetRecsParams { 6 | object EnableProduct extends Param[Boolean](false) 7 | } 8 | -------------------------------------------------------------------------------- /graph-feature-service/README.md: -------------------------------------------------------------------------------- 1 | # Graph Feature Service 2 | 3 | Graph Feature Service (GFS) is a distributed system that can provide various graph features for given pairs of users. For instance, given source user A and candidate user C, GFS can answer questions like “how many of A’s followings have favorited C”, “how many of A’s followings are following C”, and “how much C is similar to the users that A has favorited“. -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/Request.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.request 2 | 3 | trait Request 4 | extends HasClientContext 5 | with HasProduct 6 | with HasProductContext 7 | with HasSerializedRequestCursor { 8 | def maxResults: Option[Int] 9 | def debugParams: Option[DebugParams] 10 | } 11 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/HasExpirationTime.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt 2 | 3 | import com.twitter.util.Time 4 | 5 | trait HasExpirationTime { 6 | def expirationTime: Option[Time] = None 7 | 8 | final def expirationTimeInMillis: Option[Long] = expirationTime.map(_.inMillis) 9 | } 10 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/tweet_composer/TweetComposerDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.tweet_composer 2 | 3 | sealed trait TweetComposerDisplayType 4 | 5 | case object TweetComposerSelfThread extends TweetComposerDisplayType 6 | case object Reply extends TweetComposerDisplayType 7 | -------------------------------------------------------------------------------- /timelineranker/server/config/BUILD: -------------------------------------------------------------------------------- 1 | resources( 2 | sources = ["**/*.yml"], 3 | ) 4 | 5 | # Created for Bazel compatibility. 6 | # In Bazel, loose files must be part of a target to be included into a bundle. 7 | # See also http://go/bazel-compatibility/bundle_does_not_match_any_files 8 | files( 9 | name = "files", 10 | sources = [ 11 | "!BUILD", 12 | "**/*", 13 | ], 14 | ) 15 | -------------------------------------------------------------------------------- /twml/twml/trainers/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """ 3 | This module contains the Trainer and DataRecordTrainer classes. 4 | Trainers wrap a 5 | `tf.estimator.Estimator 6 | `_. 7 | """ 8 | 9 | from .trainer import Trainer # noqa: F401 10 | from .data_record_trainer import DataRecordTrainer # noqa: F401 11 | -------------------------------------------------------------------------------- /unified_user_actions/graphql/TweetHydration.graphql: -------------------------------------------------------------------------------- 1 | query TweetHydration($rest_id: NumericString!) { 2 | tweet_result_by_rest_id(rest_id: $rest_id, safety_level: ForDevelopmentOnly) { 3 | result { 4 | ... on Tweet { 5 | core { 6 | user { 7 | legacy { 8 | id_str 9 | } 10 | } 11 | } 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ann/src/main/scala/com/twitter/ann/service/query_server/common/QueryableProvider.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.ann.service.query_server.common 2 | 3 | import com.twitter.ann.common.{Distance, Queryable, RuntimeParams} 4 | import com.twitter.search.common.file.AbstractFile 5 | 6 | trait QueryableProvider[T, P <: RuntimeParams, D <: Distance[D]] { 7 | def provideQueryable(indexDir: AbstractFile): Queryable[T, P, D] 8 | } 9 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/products/sidebar/configapi/SidebarParams.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.products.sidebar.configapi 2 | 3 | import com.twitter.timelines.configapi.Param 4 | 5 | object SidebarParams { 6 | object EnableProduct extends Param[Boolean](false) 7 | 8 | object DefaultMaxResults extends Param[Int](20) 9 | } 10 | -------------------------------------------------------------------------------- /navi/navi/proto/tensorflow_serving/config/log_collector_config.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorflow.serving; 4 | option cc_enable_arenas = true; 5 | 6 | message LogCollectorConfig { 7 | // Identifies the type of the LogCollector we will use to collect these logs. 8 | string type = 1; 9 | 10 | // The prefix to use for the filenames of the logs. 11 | string filename_prefix = 2; 12 | } 13 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/card/CardDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.card 2 | 3 | sealed trait CardDisplayType 4 | 5 | case object HeroDisplayType extends CardDisplayType 6 | case object CellDisplayType extends CardDisplayType 7 | case object TweetCardDisplayType extends CardDisplayType 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/message/MessageImage.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.message 2 | 3 | import com.twitter.product_mixer.core.model.marshalling.response.urt.metadata.ImageVariant 4 | 5 | case class MessageImage( 6 | imageVariants: Set[ImageVariant], 7 | backgroundColor: Option[String]) 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/service/gate_executor/ExecutedGateResult.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.service.gate_executor 2 | 3 | import com.twitter.product_mixer.core.functional_component.gate.GateResult 4 | import com.twitter.product_mixer.core.model.common.identifier.GateIdentifier 5 | 6 | case class ExecutedGateResult(identifier: GateIdentifier, result: GateResult) 7 | -------------------------------------------------------------------------------- /recos-injector/server/src/main/scala/com/twitter/recosinjector/filters/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | platform = "java11", 3 | strict_deps = False, 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "finagle/finagle-stats", 7 | "recos-injector/server/src/main/scala/com/twitter/recosinjector/clients", 8 | "src/thrift/com/twitter/gizmoduck:thrift-scala", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird/exception/MissingKafkaTopicException.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird.exception; 2 | 3 | public class MissingKafkaTopicException extends Exception { 4 | public MissingKafkaTopicException(String message) { 5 | super(message); 6 | } 7 | 8 | public MissingKafkaTopicException(String message, Throwable cause) { 9 | super(message, cause); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/TopicPageHeaderDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urp 2 | 3 | sealed trait TopicPageHeaderDisplayType 4 | 5 | case object BasicTopicPageHeaderDisplayType extends TopicPageHeaderDisplayType 6 | case object PersonalizedTopicPageHeaderDisplayType extends TopicPageHeaderDisplayType 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/conversation_annotation/ConversationAnnotationType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.conversation_annotation 2 | 3 | sealed trait ConversationAnnotationType 4 | 5 | case object Political extends ConversationAnnotationType 6 | case object Large extends ConversationAnnotationType 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/message/UserFacepileDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.message 2 | 3 | sealed trait UserFacepileDisplayType 4 | 5 | case object LargeUserFacepileDisplayType extends UserFacepileDisplayType 6 | case object CompactUserFacepileDisplayType extends UserFacepileDisplayType 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/timeline_module/ModuleShowMoreBehavior.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module 2 | 3 | sealed trait ModuleShowMoreBehavior 4 | 5 | case class ModuleShowMoreBehaviorRevealByCount( 6 | initialItemsCount: Int, 7 | showMoreItemsCount: Int) 8 | extends ModuleShowMoreBehavior 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/CandidatePipelineFeatures.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.pipeline 2 | 3 | import com.twitter.product_mixer.core.feature.Feature 4 | import com.twitter.product_mixer.core.model.common.presentation.CandidateWithDetails 5 | 6 | private[core] object CandidatePipelineResults 7 | extends Feature[PipelineQuery, Seq[CandidateWithDetails]] 8 | -------------------------------------------------------------------------------- /twml/twml/lookup/__init__.py: -------------------------------------------------------------------------------- 1 | from tensorflow.python.ops.lookup_ops import ( 2 | index_table_from_file, 3 | index_table_from_tensor, 4 | index_to_string_table_from_file 5 | ) # noqa: F401 6 | 7 | 8 | """ 9 | NOTE: Using `from tensorflow.python.ops.lookup_ops import index_table_from_tensor` in the code works. 10 | This stub exists because it was easier to refactor code because twml is widely used. 11 | """ 12 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/interfaces/dms/DmConversationVisibilityRequest.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.interfaces.dms 2 | 3 | import com.twitter.visibility.models.SafetyLevel 4 | import com.twitter.visibility.models.ViewerContext 5 | 6 | case class DmConversationVisibilityRequest( 7 | dmConversationId: String, 8 | safetyLevel: SafetyLevel, 9 | viewerContext: ViewerContext) 10 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/interfaces/search/TweetContext.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.interfaces.search 2 | 3 | import com.twitter.tweetypie.thriftscala.Tweet 4 | import com.twitter.visibility.models.SafetyLevel 5 | 6 | case class TweetContext( 7 | tweet: Tweet, 8 | quotedTweet: Option[Tweet], 9 | retweetSourceTweet: Option[Tweet] = None, 10 | safetyLevel: SafetyLevel) 11 | -------------------------------------------------------------------------------- /ann/src/main/scala/com/twitter/ann/service/query_server/common/warmup/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "ann/src/main/scala/com/twitter/ann/common", 7 | "util/util-core:scala", 8 | "util/util-slf4j-api/src/main/scala/com/twitter/util/logging", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/configapi/deciders/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | compiler_option_sets = ["fatal_warnings"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "3rdparty/jvm/com/google/inject:guice", 7 | "configapi/configapi-core", 8 | "configapi/configapi-decider", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /tweetypie/servo/repo/src/main/thrift/BUILD: -------------------------------------------------------------------------------- 1 | create_thrift_libraries( 2 | base_name = "thrift", 3 | sources = ["**/*.thrift"], 4 | platform = "java8", 5 | tags = ["bazel-compatible"], 6 | generate_languages = [ 7 | "java", 8 | "scala", 9 | "strato", 10 | ], 11 | provides_java_name = "servo-repo-thrift-java", 12 | provides_scala_name = "servo-repo-thrift-scala", 13 | ) 14 | -------------------------------------------------------------------------------- /ann/src/main/scala/com/twitter/ann/dataflow/offline/GroupedEmbeddingData.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.ann.dataflow.offline 2 | 3 | import com.twitter.beam.schemas.SchemaFieldName 4 | 5 | case class GroupedEmbeddingData( 6 | @SchemaFieldName("entityId") entityId: Option[Long], 7 | @SchemaFieldName("embedding") embedding: Seq[Double], 8 | @SchemaFieldName("groupId") groupId: Option[String], 9 | ) extends BaseEmbeddingData 10 | -------------------------------------------------------------------------------- /graph-feature-service/src/main/scalding/com/twitter/graph_feature_service/scalding/EdgeFeature.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.graph_feature_service.scalding 2 | 3 | case class EdgeFeature( 4 | realGraphScore: Float, 5 | followScore: Option[Float] = None, 6 | mutualFollowScore: Option[Float] = None, 7 | favoriteScore: Option[Float] = None, 8 | retweetScore: Option[Float] = None, 9 | mentionScore: Option[Float] = None) 10 | -------------------------------------------------------------------------------- /home-mixer/server/src/main/scala/com/twitter/home_mixer/model/request/HasSeenTweetIds.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.home_mixer.model.request 2 | 3 | /** 4 | * [[HasSeenTweetIds]] enables shared components to access the list of impressed tweet IDs 5 | * sent by clients across different Home Mixer query types (e.g. FollowingQuery, ForYouQuery) 6 | */ 7 | trait HasSeenTweetIds { 8 | def seenTweetIds: Option[Seq[Long]] 9 | } 10 | -------------------------------------------------------------------------------- /home-mixer/server/src/main/scala/com/twitter/home_mixer/util/tweetypie/BUILD.bazel: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | strict_deps = True, 5 | tags = ["bazel-compatible"], 6 | dependencies = [ 7 | "home-mixer/server/src/main/scala/com/twitter/home_mixer/model", 8 | "home-mixer/thrift/src/main/thrift:thrift-scala", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/configapi/registry/GlobalParamConfig.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.functional_component.configapi.registry 2 | 3 | /** 4 | * Register Params that do not relate to a specific product. 5 | * See [[ParamConfig]] for hooks to register Params based on type. 6 | */ 7 | trait GlobalParamConfig extends ParamConfig with ParamConfigBuilder 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/Badge.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | import com.twitter.product_mixer.core.model.marshalling.response.urt.color.RosettaColor 4 | 5 | case class Badge( 6 | text: Option[String], 7 | textColorName: Option[RosettaColor], 8 | backgroundColorName: Option[RosettaColor]) 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/promoted/DisclosureType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.promoted 2 | 3 | sealed trait DisclosureType 4 | 5 | case object NoDisclosure extends DisclosureType 6 | case object Political extends DisclosureType 7 | case object Earned extends DisclosureType 8 | case object Issue extends DisclosureType 9 | -------------------------------------------------------------------------------- /twml/twml/readers/__init__.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=wildcard-import 2 | """ This module contains data readers """ 3 | 4 | from .batch_prediction_request import BatchPredictionRequest # noqa: F401 5 | from .data_record import DataRecord, SPARSE_DATA_RECORD_FEATURE_FIELDS # noqa: F401 6 | from .hashed_batch_prediction_request import HashedBatchPredictionRequest # noqa: F401 7 | from .hashed_data_record import HashedDataRecord # noqa: F401 -------------------------------------------------------------------------------- /ann/src/main/java/com/twitter/ann/faiss/swig/resources/BUILD: -------------------------------------------------------------------------------- 1 | resources( 2 | name = "resources", 3 | sources = [ 4 | "*.dylib", 5 | "*.so", 6 | "*.so.0", 7 | "*.so.1", 8 | "*.so.3", 9 | "*.so.5", 10 | "*.so.6", 11 | ], 12 | tags = [ 13 | "bazel-compatible", 14 | "bazel-only", 15 | "visibility://visibility:private", 16 | ], 17 | ) 18 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/HasInterestIds.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | trait HasCustomInterests { 4 | def customInterests: Option[Seq[String]] 5 | } 6 | 7 | trait HasUttInterests { 8 | def uttInterestIds: Option[Seq[Long]] 9 | } 10 | 11 | trait HasInterestIds extends HasCustomInterests with HasUttInterests {} 12 | -------------------------------------------------------------------------------- /follow-recommendations-service/thrift/src/main/thrift/logging/engagementType.thrift: -------------------------------------------------------------------------------- 1 | namespace java com.twitter.follow_recommendations.logging.thriftjava 2 | #@namespace scala com.twitter.follow_recommendations.logging.thriftscala 3 | #@namespace strato com.twitter.follow_recommendations.logging 4 | 5 | enum EngagementType { 6 | Click = 0 7 | Like = 1 8 | Mention = 2 9 | Retweet = 3 10 | ProfileView = 4 11 | } 12 | -------------------------------------------------------------------------------- /home-mixer/server/src/main/scala/com/twitter/home_mixer/product/scored_tweets/model/ScoredTweetsResponse.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.home_mixer.product.scored_tweets.model 2 | 3 | import com.twitter.product_mixer.core.model.common.presentation.CandidateWithDetails 4 | import com.twitter.product_mixer.core.model.marshalling.HasMarshalling 5 | 6 | case class ScoredTweetsResponse(scoredTweets: Seq[CandidateWithDetails]) extends HasMarshalling 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/configapi/StaticParam.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.functional_component.configapi 2 | 3 | import com.twitter.timelines.configapi.Param 4 | 5 | /** A [[Param]] used for constant values where we do not require backing by feature switches or deciders */ 6 | case class StaticParam[ValueType](value: ValueType) extends Param[ValueType](value) 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/tombstone/TombstoneInfo.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.tombstone 2 | 3 | import com.twitter.product_mixer.core.model.marshalling.response.urt.richtext.RichText 4 | 5 | case class TombstoneInfo( 6 | text: String, 7 | richText: Option[RichText], 8 | richRevealText: Option[RichText]) 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/ImageVariant.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | import com.twitter.product_mixer.core.model.marshalling.response.urt.color.ColorPalette 4 | 5 | case class ImageVariant( 6 | url: String, 7 | width: Int, 8 | height: Int, 9 | palette: Option[List[ColorPalette]]) 10 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/promoted/SponsorshipType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.promoted 2 | 3 | sealed trait SponsorshipType 4 | 5 | case object DirectSponsorshipType extends SponsorshipType 6 | case object IndirectSponsorshipType extends SponsorshipType 7 | case object NoSponsorshipSponsorshipType extends SponsorshipType 8 | -------------------------------------------------------------------------------- /src/scala/com/twitter/timelines/prediction/features/time_features/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "src/java/com/twitter/ml/api:api-base", 7 | "src/thrift/com/twitter/dal/personal_data:personal_data-java", 8 | "src/thrift/com/twitter/timelines/time_features:time_features-scala", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/request/DebugParams.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.request 2 | 3 | import com.twitter.timelines.configapi.{FeatureValue => ConfigApiFeatureValue} 4 | 5 | case class DebugParams( 6 | featureOverrides: Option[Map[String, ConfigApiFeatureValue]], 7 | override val debugOptions: Option[DebugOptions]) 8 | extends HasDebugOptions 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/InvalidStepStateException.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.pipeline 2 | 3 | import com.twitter.product_mixer.core.model.common.identifier.PipelineStepIdentifier 4 | 5 | case class InvalidStepStateException(step: PipelineStepIdentifier, missingData: String) 6 | extends Exception( 7 | s"Invalid Step State: Step $step requires $missingData" 8 | ) 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/state/HasAsyncFeatureMap.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.pipeline.state 2 | 3 | import com.twitter.product_mixer.core.feature.featuremap.asyncfeaturemap.AsyncFeatureMap 4 | 5 | trait HasAsyncFeatureMap[State] { 6 | def asyncFeatureMap: AsyncFeatureMap 7 | 8 | private[core] def addAsyncFeatureMap(newFeatureMap: AsyncFeatureMap): State 9 | } 10 | -------------------------------------------------------------------------------- /src/scala/com/twitter/timelines/prediction/features/user_health/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "src/java/com/twitter/ml/api:api-base", 7 | "src/thrift/com/twitter/dal/personal_data:personal_data-java", 8 | "src/thrift/com/twitter/timelines/author_features/user_health:thrift-scala", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /ann/src/main/java/com/twitter/ann/faiss/BUILD: -------------------------------------------------------------------------------- 1 | target( 2 | name = "faiss", 3 | dependencies = [ 4 | "ann/src/main/java/com/twitter/ann/faiss/swig:swig-artifactory", 5 | ], 6 | ) 7 | 8 | java_library( 9 | name = "swig-native-utils", 10 | sources = ["*.java"], 11 | compiler_option_sets = ["fatal_warnings"], 12 | platform = "java8", 13 | tags = ["bazel-compatible"], 14 | dependencies = [], 15 | ) 16 | -------------------------------------------------------------------------------- /navi/navi/proto/tensorflow/core/protobuf/status.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorflow; 4 | 5 | option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto"; 6 | 7 | // If included as a payload, this message flags the Status to be a "derived" 8 | // Status. Used by StatusGroup to ignore certain Statuses when reporting 9 | // errors to end users. 10 | message DerivedStatus {} 11 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/ingester/model/IndexerStatus.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.ingester.model; 2 | 3 | import com.twitter.search.common.debug.DebugEventAccumulator; 4 | 5 | /** 6 | * Interface used for stages that process both TwitterMessages and ThriftVersionedEvents. 7 | */ 8 | public interface IndexerStatus extends DebugEventAccumulator { 9 | /** 10 | * Needed by the SortStage. 11 | */ 12 | long getId(); 13 | } 14 | -------------------------------------------------------------------------------- /cr-mixer/server/src/main/scala/com/twitter/cr_mixer/model/EarlybirdSimilarityEngineType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.cr_mixer.model 2 | 3 | sealed trait EarlybirdSimilarityEngineType 4 | object EarlybirdSimilarityEngineType_RecencyBased extends EarlybirdSimilarityEngineType 5 | object EarlybirdSimilarityEngineType_ModelBased extends EarlybirdSimilarityEngineType 6 | object EarlybirdSimilarityEngineType_TensorflowBased extends EarlybirdSimilarityEngineType 7 | -------------------------------------------------------------------------------- /navi/navi/proto/tensorflow_serving/apis/model_management.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorflow.serving; 4 | 5 | import "tensorflow_serving/apis/status.proto"; 6 | import "tensorflow_serving/config/model_server_config.proto"; 7 | 8 | option cc_enable_arenas = true; 9 | 10 | message ReloadConfigRequest { 11 | ModelServerConfig config = 1; 12 | } 13 | 14 | message ReloadConfigResponse { 15 | StatusProto status = 1; 16 | } 17 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urp/PageBody.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urp 2 | 3 | sealed trait PageBody 4 | 5 | case class TimelineKeyPageBody(timeline: TimelineKey) extends PageBody 6 | 7 | case class SegmentedTimelinesPageBody( 8 | initialTimeline: SegmentedTimeline, 9 | timelines: Seq[SegmentedTimeline]) 10 | extends PageBody 11 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/service/pipeline_executor/PipelineExecutorResult.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.service.pipeline_executor 2 | 3 | import com.twitter.product_mixer.core.pipeline.PipelineResult 4 | import com.twitter.product_mixer.core.service.ExecutorResult 5 | 6 | case class PipelineExecutorResult[ResultType]( 7 | pipelineResult: PipelineResult[ResultType]) 8 | extends ExecutorResult 9 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/common/query/CollectVariantVisitor.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.common.query; 2 | 3 | import com.twitter.search.queryparser.query.annotation.Annotation; 4 | 5 | 6 | /** 7 | * A visitor that collects the nodes that have :v annotation 8 | */ 9 | public class CollectVariantVisitor extends CollectAnnotationsVisitor { 10 | public CollectVariantVisitor() { 11 | super(Annotation.Type.VARIANT); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/common/query/HitAttributeProvider.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.common.query; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | /** 7 | * The interface for objects that can provide hit attributes for a document. 8 | */ 9 | public interface HitAttributeProvider { 10 | /** Returns the hit attributes for the given document. */ 11 | Map> getHitAttribution(int docId); 12 | } 13 | -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/scalding/embedding/tfg/README: -------------------------------------------------------------------------------- 1 | TFG stands for Topic Follow Graph 2 | The TFG topic embeddings are embeddings built from Topic Follow Graph. 3 | Each topic is represented by the sum of its followers' user InterestedIn embeddings. 4 | 5 | There are two types of embeddings: 6 | logfav - topic embeddings built from followers' logfav-based InterestedIn 7 | fav - topic embeddings built from followers' fav-based InterestedIn 8 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/interfaces/spaces/SpaceVisibilityRequest.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.interfaces.spaces 2 | 3 | import com.twitter.visibility.models.SafetyLevel 4 | import com.twitter.visibility.models.ViewerContext 5 | 6 | case class SpaceVisibilityRequest( 7 | spaceId: String, 8 | safetyLevel: SafetyLevel, 9 | viewerContext: ViewerContext, 10 | spaceHostAndAdminUserIds: Option[Seq[Long]]) 11 | -------------------------------------------------------------------------------- /ann/src/main/python/dataflow/bq.sql: -------------------------------------------------------------------------------- 1 | WITH maxts as (SELECT as value MAX(ts) as ts FROM `twttr-recos-ml-prod.ssedhain.twhin_tweet_avg_embedding`) 2 | SELECT entityId, embedding 3 | FROM `twttr-recos-ml-prod.ssedhain.twhin_tweet_avg_embedding` 4 | WHERE ts >= (select max(maxts) from maxts) 5 | AND DATE(TIMESTAMP_MILLIS(createdAt)) <= (select max(maxts) from maxts) 6 | AND DATE(TIMESTAMP_MILLIS(createdAt)) >= DATE_SUB((select max(maxts) from maxts), INTERVAL 1 DAY) -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/rankers/interleave_ranker/InterleaveRankerParams.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.rankers.interleave_ranker 2 | 3 | import com.twitter.timelines.configapi.FSParam 4 | 5 | object InterleaveRankerParams { 6 | case object ScribeRankingInfoInInterleaveRanker 7 | extends FSParam[Boolean]("interleave_ranker_scribe_ranking_info", true) 8 | } 9 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/models/CandidateSourceType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.models 2 | 3 | object CandidateSourceType extends Enumeration { 4 | type CandidateSourceType = Value 5 | val Social = Value("social") 6 | val GeoAndInterests = Value("geo_and_interests") 7 | val ActivityContextual = Value("activity_contextual") 8 | val None = Value("none") 9 | } 10 | -------------------------------------------------------------------------------- /product-mixer/component-library/src/main/scala/com/twitter/product_mixer/component_library/experiments/metrics/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | platform = "java8", 5 | strict_deps = True, 6 | tags = ["bazel-compatible"], 7 | dependencies = [ 8 | "3rdparty/jvm/com/github/scopt", 9 | "util/util-core/src/main/java/com/twitter/io", 10 | ], 11 | ) 12 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/functional_component/common/alert/predicate/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | platform = "java8", 5 | strict_deps = True, 6 | tags = ["bazel-compatible"], 7 | dependencies = [ 8 | "util/util-core:scala", 9 | ], 10 | exports = [ 11 | "util/util-core:scala", 12 | ], 13 | ) 14 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/timeline_module/ModuleHeaderDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.timeline_module 2 | 3 | sealed trait ModuleHeaderDisplayType 4 | 5 | case object Classic extends ModuleHeaderDisplayType 6 | case object ContextEmphasis extends ModuleHeaderDisplayType 7 | case object ClassicNoDivider extends ModuleHeaderDisplayType 8 | -------------------------------------------------------------------------------- /src/scala/com/twitter/recos/graph_common/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | platform = "java8", 4 | strict_deps = False, 5 | tags = ["bazel-compatible"], 6 | dependencies = [ 7 | "3rdparty/jvm/com/twitter/graphjet", 8 | "finagle/finagle-stats/src/main/scala", 9 | "src/scala/com/twitter/recos/util:recos-util", 10 | "src/thrift/com/twitter/recos:recos-common-scala", 11 | ], 12 | ) 13 | -------------------------------------------------------------------------------- /timelineranker/server/src/main/scala/com/twitter/timelineranker/parameters/monitoring/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | strict_deps = True, 5 | tags = ["bazel-compatible"], 6 | dependencies = [ 7 | "configapi/configapi-core/src/main/scala/com/twitter/timelines/configapi", 8 | "servo/decider", 9 | "servo/util/src/main/scala", 10 | ], 11 | ) 12 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/features/Feature.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.features 2 | 3 | import com.twitter.visibility.util.NamingUtils 4 | 5 | abstract class Feature[T] protected ()(implicit val manifest: Manifest[T]) { 6 | 7 | lazy val name: String = NamingUtils.getFriendlyName(this) 8 | 9 | override lazy val toString: String = 10 | "Feature[%s](name=%s)".format(manifest, getClass.getSimpleName) 11 | } 12 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/products/explore_tab/configapi/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | compiler_option_sets = ["fatal_warnings"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "configapi/configapi-core", 7 | "follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/configapi/common", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/products/home_timeline/configapi/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | compiler_option_sets = ["fatal_warnings"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "configapi/configapi-core", 7 | "follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/configapi/common", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /home-mixer/server/src/main/scala/com/twitter/home_mixer/param/GlobalParamConfigModule.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.home_mixer.param 2 | 3 | import com.twitter.inject.TwitterModule 4 | import com.twitter.product_mixer.core.functional_component.configapi.registry.GlobalParamConfig 5 | 6 | object GlobalParamConfigModule extends TwitterModule { 7 | override def configure(): Unit = { 8 | bind[GlobalParamConfig].to[HomeGlobalParamConfig] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /home-mixer/server/src/main/scala/com/twitter/home_mixer/product/for_you/scorer/BUILD.bazel: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | compiler_option_sets = ["fatal_warnings"], 4 | strict_deps = True, 5 | dependencies = [ 6 | "home-mixer/server/src/main/scala/com/twitter/home_mixer/model", 7 | "home-mixer/server/src/main/scala/com/twitter/home_mixer/util", 8 | "timelineservice/common:model", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/alert/ShowAlertColorConfiguration.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.alert 2 | 3 | import com.twitter.product_mixer.core.model.marshalling.response.urt.color.RosettaColor 4 | 5 | case class ShowAlertColorConfiguration( 6 | background: RosettaColor, 7 | text: RosettaColor, 8 | border: Option[RosettaColor], 9 | ) 10 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/contextual_ref/TweetHydrationContext.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.contextual_ref 2 | 3 | import com.twitter.product_mixer.core.model.marshalling.response.rtf.safety_level.SafetyLevel 4 | 5 | case class TweetHydrationContext( 6 | safetyLevelOverride: Option[SafetyLevel], 7 | outerTweetContext: Option[OuterTweetContext]) 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/topic/TopicFollowPromptDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.topic 2 | 3 | sealed trait TopicFollowPromptDisplayType 4 | 5 | case object IncentiveFocusTopicFollowPromptDisplayType extends TopicFollowPromptDisplayType 6 | case object TopicFocusTopicFollowPromptDisplayType extends TopicFollowPromptDisplayType 7 | -------------------------------------------------------------------------------- /science/search/ingester/config/README.md: -------------------------------------------------------------------------------- 1 | ## Ingester Configs 2 | This directory contains pipeline configurations for the tweet ingesters (realtime, protected and realtime_cg) and the user-updates ingester. The pipeline configurations define an ordered sequence of stages that the tweet or user update goes through before reaching Earlybird. Source code for the various stages referenced in the configs can be found at src/java/com/twitter/search/ingester/pipeline/twitter. -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird/archive/segmentbuilder/SegmentUpdaterException.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird.archive.segmentbuilder; 2 | 3 | import com.google.common.annotations.VisibleForTesting; 4 | 5 | /** 6 | * Used when when SegmentUpdater fails processing segments. 7 | */ 8 | @VisibleForTesting 9 | class SegmentUpdaterException extends Exception { 10 | SegmentUpdaterException(String msg) { 11 | super(msg); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tweetypie/server/config/logging/logback-without-loglens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /tweetypie/server/src/main/scala/com/twitter/tweetypie/repository/ConversationMutedRepository.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.tweetypie 2 | package repository 3 | 4 | import com.twitter.stitch.Stitch 5 | 6 | object ConversationMutedRepository { 7 | 8 | /** 9 | * Same type as com.twitter.stitch.timelineservice.TimelineService.GetConversationMuted but 10 | * without using Arrow. 11 | */ 12 | type Type = (UserId, TweetId) => Stitch[Boolean] 13 | } 14 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/forward_pivot/ForwardPivotDisplayType.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.forward_pivot 2 | 3 | sealed trait ForwardPivotDisplayType 4 | 5 | case object LiveEvent extends ForwardPivotDisplayType 6 | case object SoftIntervention extends ForwardPivotDisplayType 7 | case object CommunityNotes extends ForwardPivotDisplayType 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/service/candidate_decorator_executor/CandidateDecoratorExecutorResult.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.service.candidate_decorator_executor 2 | 3 | import com.twitter.product_mixer.core.functional_component.decorator.Decoration 4 | import com.twitter.product_mixer.core.service.ExecutorResult 5 | 6 | case class CandidateDecoratorExecutorResult(result: Seq[Decoration]) extends ExecutorResult 7 | -------------------------------------------------------------------------------- /pushservice/src/main/scala/com/twitter/frigate/pushservice/exception/UnsupportedCrtException.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.frigate.pushservice.exception 2 | 3 | import scala.util.control.NoStackTrace 4 | 5 | /** 6 | * Exception for CRT not expected in the scope 7 | * @param message Exception message to log the UnsupportedCrt 8 | */ 9 | class UnsupportedCrtException(private val message: String) 10 | extends Exception(message) 11 | with NoStackTrace 12 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird/exception/TransientException.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird.exception; 2 | 3 | public class TransientException extends Exception { 4 | public TransientException(Throwable t) { 5 | super(t); 6 | } 7 | 8 | public TransientException(String message, Throwable cause) { 9 | super(message, cause); 10 | } 11 | 12 | public TransientException(String message) { 13 | super(message); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird/util/CoordinatedEarlybirdActionLockFailed.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird.util; 2 | 3 | /** 4 | * This class represents that coordindated earlybird action can not acquire the lock so that it 5 | * throws this exception. 6 | */ 7 | public class CoordinatedEarlybirdActionLockFailed extends Exception { 8 | public CoordinatedEarlybirdActionLockFailed(String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/feature_update_service/stats/BUILD: -------------------------------------------------------------------------------- 1 | java_library( 2 | sources = ["*.java"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "3rdparty/jvm/com/google/inject:guice", 7 | "src/java/com/twitter/common/base", 8 | "src/java/com/twitter/search/common/metrics", 9 | "src/thrift/com/twitter/search/feature_update_service/thrift:thrift-java", 10 | ], 11 | ) 12 | -------------------------------------------------------------------------------- /timelineranker/common/BUILD: -------------------------------------------------------------------------------- 1 | target( 2 | name = "adapter", 3 | dependencies = ["timelineranker/common/src/main/scala/com/twitter/timelineranker/adapter"], 4 | ) 5 | 6 | target( 7 | name = "model", 8 | dependencies = ["timelineranker/common/src/main/scala/com/twitter/timelineranker/model"], 9 | ) 10 | 11 | target( 12 | tags = ["bazel-compatible"], 13 | dependencies = [ 14 | ":adapter", 15 | ":model", 16 | ], 17 | ) 18 | -------------------------------------------------------------------------------- /timelineranker/server/src/main/scala/com/twitter/timelineranker/parameters/monitoring/MonitoringParams.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelineranker.parameters.monitoring 2 | 3 | import com.twitter.timelines.configapi.FSParam 4 | 5 | object MonitoringParams { 6 | 7 | object DebugAuthorsAllowListParam 8 | extends FSParam[Seq[Long]]( 9 | name = "monitoring_debug_authors_allow_list", 10 | default = Seq.empty[Long] 11 | ) 12 | 13 | } 14 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/constants/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | compiler_option_sets = ["fatal_warnings"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models", 7 | "util/util-core/src/main/scala/com/twitter/conversions", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/features/UserStateFeature.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.features 2 | 3 | import com.twitter.core_workflows.user_model.thriftscala.UserState 4 | import com.twitter.product_mixer.core.feature.Feature 5 | import com.twitter.product_mixer.core.pipeline.PipelineQuery 6 | 7 | case object UserStateFeature extends Feature[PipelineQuery, Option[UserState]] {} 8 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/slice/BaseSliceItemPresentation.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.common.presentation.slice 2 | 3 | import com.twitter.product_mixer.core.model.common.presentation.ItemPresentation 4 | import com.twitter.product_mixer.core.model.marshalling.response.slice.SliceItem 5 | 6 | trait BaseSliceItemPresentation extends ItemPresentation { 7 | def sliceItem: SliceItem 8 | } 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/pipeline/state/HasResult.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.pipeline.state 2 | 3 | /** 4 | * Defines how to build a result from a pipeline state. Pipeline States should extend this and 5 | * implement [[buildResult]] which computes the final result from their current state. 6 | * @tparam Result Type of result 7 | */ 8 | trait HasResult[+Result] { 9 | def buildResult(): Result 10 | } 11 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird/segment/SegmentProvider.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird.segment; 2 | 3 | import java.io.IOException; 4 | import java.util.List; 5 | 6 | import com.twitter.search.common.partitioning.base.Segment; 7 | 8 | public interface SegmentProvider { 9 | /** 10 | * Returns a *new* sorted list of all available segments on disk / db / hdfs / etc. 11 | */ 12 | List newSegmentList() throws IOException; 13 | } 14 | -------------------------------------------------------------------------------- /src/scala/com/twitter/simclusters_v2/summingbird/common/SimClustersHashUtil.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.simclusters_v2.summingbird.common 2 | 3 | /** 4 | * Provides int to int hash function. Used to batch clusterIds together. 5 | */ 6 | object SimClustersHashUtil { 7 | def clusterIdToBucket(clusterId: Int): Int = { 8 | clusterId % numBuckets 9 | } 10 | 11 | val numBuckets: Int = 200 12 | 13 | val getAllBuckets: Seq[Int] = 0.until(numBuckets) 14 | } 15 | -------------------------------------------------------------------------------- /twml/twml/contrib/readers/data_record.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module includes facilities for manipulating data records in DeepBird v2. 3 | This contains a submodule that allows for easy feature access as Tensors. 4 | The result of this subclass methods are dictionaries of Tensors and SparseTensors 5 | """ 6 | 7 | from twitter.deepbird.io.legacy.contrib.readers.data_record import ( 8 | SUPPORTED_DENSE_FEATURE_TYPES, # noqa: F401 9 | DataRecord, # noqa: F401 10 | ) 11 | -------------------------------------------------------------------------------- /unified_user_actions/enricher/src/main/scala/com/twitter/unified_user_actions/enricher/hcache/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | name = "hcache", 3 | sources = ["*.scala"], 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "3rdparty/jvm/com/google/guava", 7 | "util/util-cache-guava/src/main/scala", 8 | "util/util-cache/src/main/scala", 9 | "util/util-stats/src/main/scala/com/twitter/finagle/stats", 10 | ], 11 | ) 12 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/interfaces/media/MediaVisibilityRequest.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.interfaces.media 2 | 3 | import com.twitter.mediaservices.media_util.GenericMediaKey 4 | import com.twitter.visibility.models.SafetyLevel 5 | import com.twitter.visibility.models.ViewerContext 6 | 7 | case class MediaVisibilityRequest( 8 | mediaKey: GenericMediaKey, 9 | safetyLevel: SafetyLevel, 10 | viewerContext: ViewerContext) 11 | -------------------------------------------------------------------------------- /ann/src/main/scala/com/twitter/ann/manhattan/README: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | The ManhattanEmbeddingProducer is an EmbeddingProducer that is backed by a static manhattan dataset. 4 | 5 | # Setting up Data 6 | 7 | Data needs to be setup correctly in manhattan in order to be able to read the data using the 8 | ManhattanEmbeddingProducer. You can use the EmbeddingSamplingJob to do this. The job can reads 9 | embedding data from HDFS and re-writes it in the manhattan data format on HDFS. -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/models/WtfImpression.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.common.models 2 | 3 | import com.twitter.util.Time 4 | 5 | /** 6 | * Domain model for representing impressions on wtf recommendations in the past 16 days 7 | */ 8 | case class WtfImpression( 9 | candidateId: Long, 10 | displayLocation: DisplayLocation, 11 | latestTime: Time, 12 | counts: Int) 13 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/metadata/ConversationSection.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.metadata 2 | 3 | sealed trait ConversationSection 4 | 5 | case object HighQuality extends ConversationSection 6 | case object LowQuality extends ConversationSection 7 | case object AbusiveQuality extends ConversationSection 8 | case object RelatedTweet extends ConversationSection 9 | -------------------------------------------------------------------------------- /twml/libtwml/src/lib/internal/linear_search.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | #include 5 | namespace twml { 6 | 7 | template 8 | static int64_t linear_search(const Tx *xsData, const Tx val, const int64_t mainSize) { 9 | int64_t left = 0; 10 | int64_t right = mainSize-1; 11 | while(left <= right && val > xsData[left]) 12 | left++; 13 | return left; 14 | } 15 | 16 | } // namespace twml 17 | #endif 18 | -------------------------------------------------------------------------------- /twml/twml/constants.py: -------------------------------------------------------------------------------- 1 | # These should coincide with 'enum class DecodeMode' values in HashedDataRecordReader.h 2 | 3 | from twitter.deepbird.io.legacy.constants import ( 4 | DECODE_MODES, # noqa: F401 5 | DEFAULT_DECODE_MODE, # noqa: F401 6 | HASH_FNAME_AND_VALNAME, # noqa: F401 7 | HASH_VALNAME, # noqa: F401 8 | HashingDiscretizerOptions, # noqa: F401 9 | DEFAULT_ZOOKEEPER_BASE_ZNODE, # noqa: F401 10 | DEFAULT_ZOOKEEPER_HOST, # noqa: F401 11 | ) 12 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/assembler/models/Config.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.assembler.models 2 | 3 | import com.twitter.stringcenter.client.core.ExternalString 4 | 5 | case class HeaderConfig(title: TitleConfig) 6 | case class TitleConfig(text: ExternalString) 7 | case class FooterConfig(actionConfig: Option[ActionConfig]) 8 | case class ActionConfig(footerText: ExternalString, actionURL: String) 9 | -------------------------------------------------------------------------------- /home-mixer/server/src/main/scala/com/twitter/home_mixer/product/HomeMixerProductModule.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.home_mixer.product 2 | 3 | import com.twitter.inject.TwitterModule 4 | import com.twitter.product_mixer.core.product.registry.ProductPipelineRegistryConfig 5 | 6 | object HomeMixerProductModule extends TwitterModule { 7 | 8 | override def configure(): Unit = { 9 | bind[ProductPipelineRegistryConfig].to[HomeProductPipelineRegistryConfig] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/item/vertical_grid_item/VerticalGridItemTileStyle.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.item.vertical_grid_item 2 | 3 | sealed trait VerticalGridItemTileStyle 4 | 5 | case object SingleStateDefaultVerticalGridItemTileStyle extends VerticalGridItemTileStyle 6 | case object DoubleStateDefaultVerticalGridItemTileStyle extends VerticalGridItemTileStyle 7 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/marshalling/response/urt/richtext/RichTextFormat.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.marshalling.response.urt.richtext 2 | 3 | sealed trait RichTextFormat { 4 | def name: String 5 | } 6 | 7 | case object Plain extends RichTextFormat { 8 | override val name: String = "Plain" 9 | } 10 | 11 | case object Strong extends RichTextFormat { 12 | override val name: String = "Strong" 13 | } 14 | -------------------------------------------------------------------------------- /pushservice/src/main/scala/com/twitter/frigate/pushservice/exception/DisplayLocationNotSupportedException.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.frigate.pushservice.exception 2 | 3 | import scala.util.control.NoStackTrace 4 | 5 | /** 6 | * Throw exception if DisplayLocation is not supported 7 | * 8 | * @param message Exception message 9 | */ 10 | class DisplayLocationNotSupportedException(private val message: String) 11 | extends Exception(message) 12 | with NoStackTrace 13 | -------------------------------------------------------------------------------- /src/scala/com/twitter/timelines/prediction/features/two_hop_features/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | sources = ["*.scala"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "graph-feature-service/src/main/thrift/com/twitter/graph_feature_service:graph_feature_service_thrift-scala", 7 | "src/java/com/twitter/ml/api:api-base", 8 | "src/thrift/com/twitter/dal/personal_data:personal_data-java", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /visibilitylib/src/main/scala/com/twitter/visibility/interfaces/search/BatchSearchVisibilityRequest.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.visibility.interfaces.search 2 | 3 | import com.twitter.visibility.interfaces.common.search.SearchVFRequestContext 4 | import com.twitter.visibility.models.ViewerContext 5 | 6 | case class BatchSearchVisibilityRequest( 7 | tweetContexts: Seq[TweetContext], 8 | viewerContext: ViewerContext, 9 | searchVFRequestContext: SearchVFRequestContext) 10 | -------------------------------------------------------------------------------- /follow-recommendations-service/common/src/main/scala/com/twitter/follow_recommendations/common/rankers/common/BUILD: -------------------------------------------------------------------------------- 1 | scala_library( 2 | compiler_option_sets = ["fatal_warnings"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "3rdparty/jvm/org/slf4j:slf4j-api", 7 | "product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common", 8 | "util/util-slf4j-api/src/main/scala", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /follow-recommendations-service/server/src/main/scala/com/twitter/follow_recommendations/assembler/models/RecommendationOptions.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.follow_recommendations.assembler.models 2 | 3 | sealed trait RecommendationOptions 4 | 5 | case class UserListOptions( 6 | userBioEnabled: Boolean, 7 | userBioTruncated: Boolean, 8 | userBioMaxLines: Option[Long], 9 | ) extends RecommendationOptions 10 | 11 | case class CarouselOptions() extends RecommendationOptions 12 | -------------------------------------------------------------------------------- /follow-recommendations-service/thrift/src/main/thrift/logging/debug.thrift: -------------------------------------------------------------------------------- 1 | namespace java com.twitter.follow_recommendations.logging.thriftjava 2 | #@namespace scala com.twitter.follow_recommendations.logging.thriftscala 3 | #@namespace strato com.twitter.follow_recommendation.logging 4 | 5 | // subset of DebugParams 6 | struct OfflineDebugParams { 7 | 1: optional i64 randomizationSeed // track if the request was randomly ranked or not 8 | }(persisted='true', hasPersonalData='false') 9 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtItemPresentation.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.common.presentation.urt 2 | 3 | import com.twitter.product_mixer.core.model.common.presentation.ItemPresentation 4 | import com.twitter.product_mixer.core.model.marshalling.response.urt.TimelineItem 5 | 6 | trait BaseUrtItemPresentation extends ItemPresentation { 7 | 8 | def timelineItem: TimelineItem 9 | } 10 | -------------------------------------------------------------------------------- /product-mixer/core/src/main/scala/com/twitter/product_mixer/core/model/common/presentation/urt/BaseUrtModulePresentation.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.product_mixer.core.model.common.presentation.urt 2 | 3 | import com.twitter.product_mixer.core.model.common.presentation.ModulePresentation 4 | import com.twitter.product_mixer.core.model.marshalling.response.urt.TimelineModule 5 | 6 | trait BaseUrtModulePresentation extends ModulePresentation { 7 | def timelineModule: TimelineModule 8 | } 9 | -------------------------------------------------------------------------------- /pushservice/src/main/scala/com/twitter/frigate/pushservice/exception/InvalidSportDomainException.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.frigate.pushservice.exception 2 | 3 | import scala.util.control.NoStackTrace 4 | 5 | /** 6 | * Throw exception if the sport domain is not supported by MagicFanoutSports 7 | * 8 | * @param message Exception message 9 | */ 10 | class InvalidSportDomainException(private val message: String) 11 | extends Exception(message) 12 | with NoStackTrace 13 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird/QualityFactor.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird; 2 | 3 | /** 4 | * Interface defining a quality factor. 5 | */ 6 | public interface QualityFactor { 7 | /** 8 | * Returns the current quality factor. 9 | * @return The quality factor; a number between 0.0 and 1.0. 10 | */ 11 | double get(); 12 | 13 | /** 14 | * Starts a thread to update the quality factor periodically. 15 | */ 16 | void startUpdates(); 17 | } 18 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird/archive/segmentbuilder/SegmentInfoConstructionException.java: -------------------------------------------------------------------------------- 1 | package com.twitter.search.earlybird.archive.segmentbuilder; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * Used if exceptions are thrown during creating new SegmentInfo during the indexing loop 7 | */ 8 | class SegmentInfoConstructionException extends Exception { 9 | SegmentInfoConstructionException(String msg, IOException e) { 10 | super(msg, e); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/java/com/twitter/search/earlybird_root/collectors/BUILD: -------------------------------------------------------------------------------- 1 | java_library( 2 | sources = ["*.java"], 3 | platform = "java8", 4 | tags = ["bazel-compatible"], 5 | dependencies = [ 6 | "3rdparty/jvm/com/google/guava", 7 | "3rdparty/jvm/log4j", 8 | "src/java/com/twitter/search/common/relevance:utils", 9 | "src/java/com/twitter/search/common/util/earlybird", 10 | "src/thrift/com/twitter/search:earlybird-java", 11 | ], 12 | ) 13 | -------------------------------------------------------------------------------- /timelineranker/server/src/main/scala/com/twitter/timelineranker/contentfeatures/package.scala: -------------------------------------------------------------------------------- 1 | package com.twitter.timelineranker 2 | 3 | import com.twitter.timelineranker.core.FutureDependencyTransformer 4 | import com.twitter.timelineranker.recap.model.ContentFeatures 5 | import com.twitter.timelines.model.TweetId 6 | 7 | package object contentfeatures { 8 | type ContentFeaturesProvider = 9 | FutureDependencyTransformer[Seq[TweetId], Map[TweetId, ContentFeatures]] 10 | } 11 | --------------------------------------------------------------------------------