This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { v4 as uuidv4 } from 'uuid'; | |
import type { ClosedOrder, OpenOrder } from '../types/order.js'; | |
import { balanceState } from '../states/state.js'; | |
export class TradeManager { | |
token: string; | |
price: number; | |
levOrders: Map<string, OpenOrder[]>; | |
openOrders: Map<string, OpenOrder[]>; | |
closeOrders: Map<string, ClosedOrder[]>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface BlogPost { | |
id: string; | |
title: string; | |
author: string; | |
date: string; | |
category: string; | |
excerpt: string; | |
content: string; | |
image: string; | |
featured?: boolean; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
from apps.github.models.mixins.issue import IssueIndexMixin | |
class MockIssue(IssueIndexMixin): | |
def __init__(self, author_login, author_name, project_description, project_level, | |
project_tags, project_topics, project_name, project_url, | |
repository_contributors_count, repository_description, | |
repository_forks_count, repository_languages, repository_name, | |
repository_stars_count, repository_topics, labels, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unittest.mock import MagicMock | |
from datetime import datetime | |
from apps.github.models.mixins.issue import IssueIndexMixin | |
CONTRIBUTORS_COUNT = 10 | |
FORKS_COUNT = 5 | |
STARS_COUNT = 50 | |
COMMENTS_COUNT = 5 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unittest.mock import MagicMock | |
from apps.github.models.mixins.issue import IssueIndexMixin | |
CONTRIBUTORS_COUNT = 10 | |
FORKS_COUNT = 5 | |
STARS_COUNT = 50 | |
COMMENTS_COUNT = 5 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""A command to create querySuggestion index synonyms.""" | |
from django.core.management.base import BaseCommand | |
from algoliasearch.query_suggestions.client import QuerySuggestionsClientSync | |
class Command(BaseCommand): | |
help = 'Create query suggestions for Algolia indices' | |
def handle(self, *args, **kwargs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from algoliasearch.query_suggestions.client import QuerySuggestionsClientSync | |
client = QuerySuggestionsClientSync( | |
"appid", "apikey", "eu" | |
) | |
response = client.create_config( | |
configuration_with_index={ | |
"indexName": "update-2", | |
"sourceIndices": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { SearchResponse } from 'algoliasearch' | |
import { client } from './algoliaClient' | |
import { AlgoliaResponseType } from './types' | |
import { API_URL } from '../utils/credentials' | |
import { NEST_ENV } from '../utils/credentials' | |
import logger from '../utils/logger' | |
import { getAttributesFromIndexName } from '../utils/attributesmap' | |
import { getParamsForIndexName } from '../utils/param' | |
export const loadData = async <T>( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const getParamsForIndexName = ( | |
indexName: string, | |
distinct = false, | |
coordinates?: string | |
) => { | |
switch (indexName) { | |
case 'issues': | |
return { | |
attributesToRetrieve: [ | |
'idx_comments_count', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import logging | |
from pathlib import Path | |
from functools import lru_cache | |
from algoliasearch.search_client import SearchClient | |
from django.conf import settings | |
logger = logging.getLogger(__name__) | |
NewerOlder