text
stringlengths
185
73.3k
repo
stringlengths
7
100
path
stringlengths
4
146
language
stringclasses
7 values
hash
stringlengths
16
16
score
float64
7
8.5
stars
int64
0
237k
#!/usr/bin/env python3 """ Blog Post Translation Script This script translates Portuguese blog posts to English using ollama with llama3. It extracts content from HTML files, translates them, and creates new English versions. """ import os import re import json import subprocess from pathlib import Path from bs4 impo...
helmedeiros/blog
scripts/translate_blog.py
.py
362c5dd43b134c31
7
0
#!/usr/bin/env python3 """ Translate Hugo Portuguese posts to English This script translates Hugo markdown posts from content/pt/posts/ to content/en/posts/ using ollama with llama3, preserving Hugo frontmatter structure. """ import os import re import subprocess from pathlib import Path import argparse import time ...
helmedeiros/blog
scripts/translate_hugo_markdown.py
.py
439fa75d26f1062d
7
0
#!/usr/bin/env python3 """ Translate Portuguese markdown files to English This script translates the extracted Portuguese markdown files to English using ollama with llama3, creating clean English versions. """ import os import re import subprocess from pathlib import Path import argparse def clean_markdown_content(...
helmedeiros/blog
scripts/translate_markdown.py
.py
946cc398aef1df0a
7
0
#!/usr/bin/env python3 """ Translate Hugo Portuguese posts to English while preserving links and formatting This script improves upon the original translation by: 1. Preserving markdown reference-style links 2. Preserving HTML links with all attributes 3. Preserving HTML formatting tags 4. Better handling of mixed con...
helmedeiros/blog
scripts/translate_with_preserved_links_fixed.py
.py
e38fc40c76040e79
7
0
from collections.abc import Sequence from cs.util import Comparable def binary_search[T: Comparable](arr: Sequence[T], target: T) -> int: """ Returns the index of target element, or -1 if it cannot be found. Performs a left binary search, which is equivalent to: bisect.bisect_left(arr, target) ...
TylerYep/workshop
cs/algorithms/binary_search.py
.py
79e436a6acae2fe8
7.15
1
""" https://en.wikipedia.org/wiki/Burrows%E2%80%93Wheeler_transform The Burrows-Wheeler transform (BWT, also called block-sorting compression) rearranges a character string into runs of similar characters. This is useful for compression, since it tends to be easy to compress a string that has runs of repeated characte...
TylerYep/workshop
cs/algorithms/compression/burrows_wheeler.py
.py
93e5aab4d9682703
7.15
1
from __future__ import annotations import heapq from dataclasses import dataclass, field from typing import TYPE_CHECKING, cast from cs.util import dfield if TYPE_CHECKING: from pathlib import Path @dataclass(order=True, slots=True) class HuffmanTreeNode: freq: int letter: str = field(default="") l...
TylerYep/workshop
cs/algorithms/compression/huffman.py
.py
04d3ab10b8bdf4e6
7.15
1
from __future__ import annotations from typing import TYPE_CHECKING from cs.util import Comparable if TYPE_CHECKING: from cs.structures import Graph def depth_first_search[V: Comparable](graph: Graph[V], start: V, end: V) -> list[V]: """ Iterative version of DFS. Runtime: O(V + E) """ stac...
TylerYep/workshop
cs/algorithms/graph/dfs.py
.py
f3cdf80e811a8a21
7.15
1
from __future__ import annotations from collections.abc import Iterable, Mapping from typing import Any, cast from cs.structures import Edge, Graph from cs.util import Comparable def bipartite_matching[V: Comparable]( graph: Graph[V], left: Iterable[V] | Mapping[V, int], right: Iterable[V] ) -> tuple[Graph[V], ...
TylerYep/workshop
cs/algorithms/graph/ford_fulkerson.py
.py
1991d1e7cd7f887f
7.15
1
""" A Hamiltonian cycle (Hamiltonian circuit) is a graph cycle through a graph that visits each node exactly once. Determining whether such paths and cycles exist in graphs is the 'Hamiltonian path problem', which is NP-complete. Wikipedia: https://en.wikipedia.org/wiki/Hamiltonian_path """ from __future__ import anno...
TylerYep/workshop
cs/algorithms/graph/hamiltonian_cycle.py
.py
3ae4388ade4f5cca
7.15
1
from __future__ import annotations from cs.structures import FibonacciHeap, Graph from cs.util import Comparable def prims_mst[V: Comparable](graph: Graph[V], start_node: V | None = None) -> Graph[V]: """ Given a connected, undirected graph with real-valued edge costs, returns an MST of that graph. ...
TylerYep/workshop
cs/algorithms/graph/prims.py
.py
318eb9b9814beebc
7.15
1
from cs.structures import Graph from cs.util import Comparable def topological_sort[V: Comparable](graph: Graph[V]) -> list[V]: """ Perform topological sort on a directed acyclic graph. Node never seen = not in visited Node being processed = in visited but not in stack Node done = in stack R...
TylerYep/workshop
cs/algorithms/graph/toposort.py
.py
65ab7201715e89e1
7.15
1
from __future__ import annotations from typing import TYPE_CHECKING from cs.structures import BinarySearchTree, BinaryTreeNode, Graph from cs.util import Comparable if TYPE_CHECKING: from collections.abc import Sequence def build_optimal_bst[T: Comparable]( nodes: Sequence[BinaryTreeNode[T]], ) -> tuple[Bi...
TylerYep/workshop
cs/algorithms/optimal_bst.py
.py
79f5805000ca1574
7.15
1
from cs.util import Comparable def merge_sort[T: Comparable](array: list[T]) -> list[T]: """ Merge sort algorithm implementation. Runtime: O(n log n) """ def merge(left: list[T], right: list[T]) -> list[T]: """Merge sort merging function.""" left_index, right_index = 0, 0 ...
TylerYep/workshop
cs/algorithms/sort/merge_sort.py
.py
9c1d5974d536958d
7.15
1
def _longest_common_subsequence(s1: str, s2: str) -> int: """ Let m and n be the lengths of two strings. Build L[m+1][n+1] from the bottom up. Note: L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] Runtime: O(mn) Space Complexity: O(mn) """ m, n = len(s1), len(s2) L = [[0] ...
TylerYep/workshop
cs/algorithms/strings/lcs.py
.py
47848ba3453bca29
7.15
1
from collections import Counter from dataclasses import dataclass from enum import Enum, unique @unique class SuffixType(Enum): S, L = "S", "L" @dataclass(slots=True) class LMSBlock: start: int end: int block_num: int = -1 def build_suffix_array_naive(source: str) -> list[int]: """ A naive...
TylerYep/workshop
cs/algorithms/strings/sais.py
.py
7e864fa3fdcf8ae0
7.15
1
from __future__ import annotations import math from typing import TYPE_CHECKING, Self, override if TYPE_CHECKING: from collections.abc import Iterator class Bits: """ Personal bits implementation. For all real purposes, use the bitarray library. https://docs.python.org/3/library/operator.html ""...
TylerYep/workshop
cs/maths/bits.py
.py
bf72dbb5c697b259
7.15
1
import math def fibonacci_recursive(n: int) -> list[int]: cache: dict[int, int] = {0: 0, 1: 1} def _fib(n: int) -> int: if n in cache: return cache[n] result = _fib(n - 1) + _fib(n - 2) cache[n] = result return result _ = _fib(n - 1) return list(cache.valu...
TylerYep/workshop
cs/maths/fibonacci.py
.py
f38b12a9a82179e2
7.15
1
""" See docs/karatsuba.md for code credits and implementation details. Author: Keith Schwarz (htiek@cs.stanford.edu) """ def add(lhs: list[int], rhs: list[int], base: int) -> list[int]: """ Adds two arbitrary-precision values in some base together. Given two arrays lhs and rhs of digits in some base 'bas...
TylerYep/workshop
cs/maths/karatsuba.py
.py
b27df4d21c6ceec7
7.15
1
import pygame from pygame.sprite import Sprite class Alien(Sprite): """Uma classe que representa um único alienígena da frota.""" def __init__(self, ai_settings, screen): """Inicializa o alienígena e define sua posição inicial.""" super(Alien, self).__init__() self.screen = screen ...
leandrofratel/Alien_invasion
src/alien.py
.py
e4509a65ae9261d4
7
0
import pygame from pygame.sprite import Sprite class Bullet(Sprite): """Uma classe que administr projéteis disparados pela espaçonave.""" def __init__(self, ai_settings, screen, ship): """Cria um objeto para o projétil na posição atual da espaçonave.""" super(Bullet, self).__init__() s...
leandrofratel/Alien_invasion
src/bullet.py
.py
63bbe470267a4438
7
0
import pygame.font class Button(): def __init__(self, ai_settings, screen, msg): """Atributos do botão.""" self.screen = screen self.screen_rect = screen.get_rect() # Dimensões do botão e propriedades. self.widht, self.height = 200, 50 self.button_color = (25, 25, ...
leandrofratel/Alien_invasion
src/button.py
.py
92aadc3c0bbd23cc
7
0
import sys import pygame from time import sleep from alien import Alien from bullet import Bullet def check_aliens_bottom(ai_settings, screen, stats, sb, ship, aliens, bullets): """Identifica se um alien atingil a borda da tela.""" screen_rect = screen.get_rect() for alien in aliens.sprites(): if a...
leandrofratel/Alien_invasion
src/game_functions.py
.py
da46634f1d61e476
7
0
class GameStats(): """Armazena dados estatísticos do jogo.""" def __init__(self, ai_settings): """Inicializa os dados estatísticos.""" self.ai_settings = ai_settings self.reset_stats() # Informa a pontuação máxima (essa pontuação não é zerada apos fechar o jogo). self.h...
leandrofratel/Alien_invasion
src/game_stats.py
.py
24595ae03402ce0f
7
0
import pygame.font from pygame.sprite import Group from ship import Ship class Scoreboard(): """Uma classe que mostra informações sobre pontuação.""" def __init__(self, ai_settings, screen, stats): """Inicializa os atributos da pontuação.""" self.screen = screen self.screen_rect = scr...
leandrofratel/Alien_invasion
src/scoreboard.py
.py
66cbd8eede8f1bda
7
0
class Settings(): """Uma classe para armazenar todas as configurações do jogo.""" def __init__(self): """Inicializa as configurações estáticas do jogo.""" # Configurações da tela. self.screen_width = 800 self.screen_height = 600 # Configurações de cor da tela se...
leandrofratel/Alien_invasion
src/settings.py
.py
944570f528047534
7
0
import pygame from pygame.sprite import Sprite class Ship(Sprite): def __init__(self, ai_settings, screen): """"Inicializa a espaçonave e define sua posição inicial.""" super(Ship, self).__init__() self.screen = screen self.ai_settings = ai_settings # Carrega a imagem da e...
leandrofratel/Alien_invasion
src/ship.py
.py
7415e0c71d03328f
7
0
import subprocess import sys def _subprocess_run(cmd, exit_on_error=True): print("*** Running %r" % " ".join(cmd)) output = [] pipe = subprocess.Popen( cmd, encoding="utf8", stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) # Await command completion and print lines as they come in ...
wellcomecollection/archivematica-infrastructure
.buildkite/scripts/commands.py
.py
b985e448c4f8098b
7.3
3
import json import logging from collections import OrderedDict import django.core.exceptions import django.utils from django import forms from django.db.models import Count from django.utils.translation import gettext_lazy as _ from archivematica.storage_service.common import gpgutils from archivematica.storage_servi...
wellcomecollection/archivematica-infrastructure
archivematica-apps/archivematica-storage-service/overlay/src/archivematica/storage_service/locations/forms.artefactual.py
.py
629964e8b7c2be68
7.3
3
import json import logging from collections import OrderedDict import django.core.exceptions import django.utils from django import forms from django.db.models import Count from django.utils.translation import gettext_lazy as _ from archivematica.storage_service.common import gpgutils from archivematica.storage_servi...
wellcomecollection/archivematica-infrastructure
archivematica-apps/archivematica-storage-service/overlay/src/archivematica/storage_service/locations/forms.wellcome.py
.py
4fbfa2ddd4edbafe
7.3
3
# Provides a mechanism for running background tasks (as threads) and keeping # track of what's running, finished and failed. # # Information about each task is captured in an Async model, stored in the # database. It's assumed that whoever submitted each task will poll for # completion in some fashion and consume resu...
wellcomecollection/archivematica-infrastructure
archivematica-apps/archivematica-storage-service/overlay/src/archivematica/storage_service/locations/models/async_manager.artefactual.py
.py
4a2db27b8f230799
7.3
3
# Provides a mechanism for running background tasks (as threads) and keeping # track of what's running, finished and failed. # # Information about each task is captured in an Async model, stored in the # database. It's assumed that whoever submitted each task will poll for # completion in some fashion and consume resu...
wellcomecollection/archivematica-infrastructure
archivematica-apps/archivematica-storage-service/overlay/src/archivematica/storage_service/locations/models/async_manager.wellcome.py
.py
fdae7b9350e9248a
7.3
3
import logging import os import pprint import re from functools import wraps from urllib.parse import urlparse import boto3 import botocore from boto3.s3.transfer import TransferConfig from django.conf import settings from django.db import models from django.utils.translation import gettext_lazy as _ from archivemati...
wellcomecollection/archivematica-infrastructure
archivematica-apps/archivematica-storage-service/overlay/src/archivematica/storage_service/locations/models/s3.artefactual.py
.py
ee84a8a06de20a35
7.3
3
import logging import os import pprint import re from functools import wraps from urllib.parse import urlparse import boto3 import botocore from boto3.s3.transfer import TransferConfig from django.conf import settings from django.db import models from django.utils.translation import gettext_lazy as _ from archivemati...
wellcomecollection/archivematica-infrastructure
archivematica-apps/archivematica-storage-service/overlay/src/archivematica/storage_service/locations/models/s3.wellcome.py
.py
42da98fa6eb595ec
7.3
3
"""Protect the complete Wellcome branch of the Storage Service migrations. The overlay adds Wellcome migrations alongside the migrations in the pinned upstream revision. ``UPSTREAM_LEAF`` identifies the end of the upstream-only branch, while ``WELLCOME_MIGRATION_DEPENDENCIES`` is the explicit manifest of everything ad...
wellcomecollection/archivematica-infrastructure
archivematica-apps/archivematica-storage-service/overlay/tests/locations/test_wellcome_migrations.wellcome.py
.py
5410673a63500eb5
7.8
3
#!/usr/bin/env python # This file is part of Archivematica. # # Copyright 2010-2013 Artefactual Systems Inc. <http://artefactual.com> # # Archivematica is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, ei...
wellcomecollection/archivematica-infrastructure
archivematica-apps/archivematica/overlay/src/archivematica/MCPClient/clientScripts/rights_from_csv.artefactual.py
.py
f09564f0aed3ea1e
7.3
3
#!/usr/bin/env python # This file is part of Archivematica. # # Copyright 2010-2013 Artefactual Systems Inc. <http://artefactual.com> # # Archivematica is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, ei...
wellcomecollection/archivematica-infrastructure
archivematica-apps/archivematica/overlay/src/archivematica/MCPClient/clientScripts/rights_from_csv.wellcome.py
.py
ea542a55b21a5ae3
7.3
3
#!/usr/bin/env python """ Create a new Azure AD client secret for Archivematica. The secret is added to Azure AD and Secrets Manager, and the relevant ECS tasks are restarted so they pick up a new copy of the secrets. """ import datetime as dt import functools import json import secrets import subprocess import sys ...
wellcomecollection/archivematica-infrastructure
azure_ad_login/create_azure_client_secret.py
.py
54d7237178769760
7.3
3
""" Code for talking to Archivematica. """ import base64 import collections import json import os import urllib.parse import urllib.request class StartTransferException(Exception): pass class StoragePathException(Exception): pass def am_api_post_json(api_path, data, headers=None): """ POST json t...
wellcomecollection/archivematica-infrastructure
lambdas/s3_start_transfer/src/archivematica.py
.py
e751584d24149cbe
7.3
3
""" This is some code for treating objects in S3 as if they're file-like objects in Python. It's useful if you're working in an environment where you don't want to download the entire object (e.g. a Lambda function). This potentially makes many more GetObject calls than downloading a big object from S3, so user bewar...
wellcomecollection/archivematica-infrastructure
lambdas/s3_start_transfer/src/big_s3.py
.py
d2eca3e54b5b6a28
7.3
3
"""Serialise a run into the flat record the QA auditor reads. The auditor deliberately knows nothing about ``RunResult``, ``Deal`` or the HTML template — it reads this payload and the raw price history, and re-derives the numbers itself. Keeping the hand-off explicit means the checker cannot accidentally start trustin...
faeezmnoor/cheapflightstracker
flightdeals/artifact.py
.py
df1489b04a8ec79b
7
0
"""The far-horizon lane: two contiguous 30-day blocks, scanned exhaustively. Separate from the daily scan on purpose, and the separation is the design: * **Exhaustive within each block, like the near window.** The first version sampled every 15th day and could not support its own conclusion — on our own data, 10 ...
faeezmnoor/cheapflightstracker
flightdeals/horizon.py
.py
7de8329878c4c10e
7
0
"""Core data structures shared across the pipeline.""" from __future__ import annotations from dataclasses import asdict, dataclass, field from typing import List, Optional @dataclass class Offer: """A single priced flight option returned by a provider.""" origin: str destination: str departure_dat...
faeezmnoor/cheapflightstracker
flightdeals/models.py
.py
d47d95fc12dfdfc2
7
0
"""Provider interface.""" from __future__ import annotations from typing import List, Optional from ..config import Config from ..models import Offer class ProviderError(RuntimeError): """Raised when a provider cannot fulfil a request.""" class FlightProvider: """Base class. Subclasses implement :meth:`s...
faeezmnoor/cheapflightstracker
flightdeals/providers/base.py
.py
be6732a8a7967f19
7
0
"""Deterministic mock provider. Generates realistic-looking fares without any API key so the whole pipeline (search -> baseline -> deal detection -> email) can be exercised in tests, CI dry-runs, and local demos. Prices are a stable function of the route and date, with a couple of routes deliberately discounted so a d...
faeezmnoor/cheapflightstracker
flightdeals/providers/mock.py
.py
cc9f9d046c9746c2
7
0
"""Plan and execute the day's searches across all routes and dates.""" from __future__ import annotations import random import time from datetime import date, timedelta from typing import Dict, List, Optional, Tuple from .config import Config, Route from .models import Offer from .providers.base import FlightProvide...
faeezmnoor/cheapflightstracker
flightdeals/search.py
.py
7f32618bb0266231
7
0
"""What the auditor reports, and how loudly.""" from __future__ import annotations from dataclasses import dataclass, field from typing import Iterable, List # Severity ladder. "block" is reserved for things that make the digest # actively misleading — a wrong price, an alert built on one observation. Those # suppre...
faeezmnoor/cheapflightstracker
qa/findings.py
.py
8fa5350557a03f90
7
0
"""A second, independent derivation of the numbers the digest claims. Written from the *specification* rather than from ``flightdeals.stats``, and kept import-free of that package on purpose. Two implementations that agree are evidence; one implementation checking itself is not. The specification, in full: * A route...
faeezmnoor/cheapflightstracker
qa/recompute.py
.py
84d395a061137c90
7
0
import os import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from flightdeals.config import Config try: import fast_flights # noqa: F401 from flightdeals.providers.googleflights import GoogleFlightsProvider HAS_FF = True except Exception: # pragma...
faeezmnoor/cheapflightstracker
tests/test_googleflights.py
.py
f561289f4fed295d
7.5
0
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Download a bibliography from zotero, write the output to a bibtex file. Zotero has a way of checking if things have changed, which we use. If the bibliography has not changed, then we do not write anything to the file. Docs: * https://www.zotero.org/support/dev/web_a...
gipplab/zotero-backup
download.py
.py
23954eac1330cabe
7.39
5
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging import os import dotenv __ready__ = False def _get_log_level(): loglevel = os.getenv("LOG_LEVEL", "INFO") numeric_level = getattr(logging, loglevel.upper(), None) if not isinstance(numeric_level, int): raise ValueError('Invalid log lev...
gipplab/zotero-backup
env.py
.py
68826ae85a12efb6
7.39
5
# coding=utf-8 import html import json import os import requests from lxml import etree headers = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch', 'Accept-Language': 'zh-CN,zh;q=0.8', 'Cache-Control': 'no-cache', '...
ZhangPeibin/weixin_gzh_services
request/gzh_info_request.py
.py
e8be08998b639cdc
7
0
#!/usr/bin/env python # coding=utf-8 from __future__ import with_statement import time from uiautomator import device as d import sys import activity import os tmp = "tmp/" DOWN_AND_UP = 'DOWN_AND_UP' pnp_data = "pnp_data/" biz_name_json_path = pnp_data + "biz_name_json" MAX_COUNT = 5000 drag_count = 0 def wait_upd...
ZhangPeibin/weixin_gzh_services
uiauto.py
.py
63e917a78d2e2a54
7
0
""" Cache module for fernand0 README generator. Provides file-based caching with TTL (time-to-live) for API responses. """ import hashlib import json import logging import time from datetime import datetime from pathlib import Path from typing import Any logger = logging.getLogger(__name__) # Default TTL values in ...
fernand0/fernand0
cache.py
.py
943801fae6e7498a
7.15
1
"""Tests for cache module.""" import pytest import time from pathlib import Path from cache import ( get_cache_key, load_cache, save_cache, clear_cache, get_cache_stats, CACHE_DIR, DEFAULT_TTL, ) class TestGetCacheKey: """Tests for get_cache_key function.""" def test_cache_key_un...
fernand0/fernand0
tests/test_cache.py
.py
e3606e9f61aaf346
7.65
1
"""Tests for CLI argument parsing.""" import pytest import sys from io import StringIO from build_readme import create_parser, main class TestCreateParser: """Tests for create_parser function.""" def test_parser_creation(self): """Test parser is created correctly.""" parser = create_parser()...
fernand0/fernand0
tests/test_cli.py
.py
55664dc96e4c2082
7.65
1
"""Tests for markdown formatting functions.""" import pytest from build_readme import ( replace_chunk, format_repository, format_blog_entry, format_repositories_md, format_blog_entries_md, format_mastodon_posts_md, RepositoryEntry, BlogEntry, BlogConfig, MastodonConfig, ) clas...
fernand0/fernand0
tests/test_formatting.py
.py
06d6bef7894fa143
7.65
1
"""Tests for validation functions.""" import pytest from unittest.mock import MagicMock, patch from build_readme import ( validate_token_format, validate_url, validate_token, TokenValidationError, ) class TestValidateUrl: """Tests for validate_url function.""" def test_valid_https_url(self):...
fernand0/fernand0
tests/test_validation.py
.py
0a7166cde2f9ef97
7.65
1
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. ''' This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code ''' CSI = '\033[' OSC = '\033]' BEL = '\007' def code_to_chars(code): return CSI + str(code) + ...
TencentCloud/tencentcloud-cli-intl-en
tccli/colorama/ansi.py
.py
fc27e0e7d7962502
7.3
3
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import re import sys import os from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style from .winterm import WinTerm, WinColor, WinStyle from .win32 import windll winterm = None if windll is not None: winterm = WinTerm() de...
TencentCloud/tencentcloud-cli-intl-en
tccli/colorama/ansitowin32.py
.py
df06eb529f26f491
7.3
3
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. # from winbase.h STDOUT = -11 STDERR = -12 try: import ctypes from ctypes import LibraryLoader windll = LibraryLoader(ctypes.WinDLL) from ctypes import wintypes except (AttributeError, ImportError): windll = Non...
TencentCloud/tencentcloud-cli-intl-en
tccli/colorama/win32.py
.py
1803759638837a77
7.3
3
""" To understand why this file is here, please read: http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django """ from django.conf import settings from django.db import migrations def update_site_forward(apps, schema_editor): """Set site d...
LinusMain/linus
linus/contrib/sites/migrations/0003_set_site_domain_and_name.py
.py
65d6e0bdd84ba54a
7
0
""" fetch_batman.py --------------- Pass 1 — Search Trove for Keith Dunstan's 'Batman' column in The Bulletin. Searches for articles containing 'Batman' within The Bulletin across multiple search terms to catch all column title variants. The Bulletin is indexed in Trove under: category: magazine response key:...
Batmanian/KeithDunstan
trove/fetch_batman.py
.py
9de0c8d8217bd4f5
7.15
1
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
NeCTAR-RC/python-placementclient
placementclient/base.py
.py
86daaf925e763521
7
0
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
NeCTAR-RC/python-placementclient
placementclient/exceptions.py
.py
a35c01b505e15f8f
7
0
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
NeCTAR-RC/python-placementclient
placementclient/v1/client.py
.py
a00745c3842d4607
7
0
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
NeCTAR-RC/python-nectarallocationclient
nectarallocationclient/base.py
.py
c0ef9264bf0ea37c
7.3
3
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
NeCTAR-RC/python-nectarallocationclient
nectarallocationclient/exceptions.py
.py
8add587f3edb8522
7.3
3
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
NeCTAR-RC/python-nectarallocationclient
nectarallocationclient/osc/plugin.py
.py
571abfa8bfd70b63
7.3
3
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
NeCTAR-RC/python-nectarallocationclient
nectarallocationclient/tests/unit/utils.py
.py
7ff8fc873ab61dfb
7.8
3
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
NeCTAR-RC/python-nectarallocationclient
nectarallocationclient/v1/client.py
.py
23bf57e28307e8fc
7.3
3
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
NeCTAR-RC/python-manukaclient
manukaclient/osc/plugin.py
.py
be0785ed0ca2e954
7
0
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
NeCTAR-RC/python-manukaclient
manukaclient/v1/client.py
.py
b25585b38577975c
7
0
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
NeCTAR-RC/nectar-osc
nectar_osc/compute.py
.py
3f05892a68592b70
7.24
2
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
NeCTAR-RC/nectar-osc
nectar_osc/identity.py
.py
12af17e875bbe946
7.24
2
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
NeCTAR-RC/nectar-osc
nectar_osc/plugin.py
.py
ce8f6376b85d2aac
7.24
2
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
NeCTAR-RC/nectar-osc
nectar_osc/rating.py
.py
66730e8c8d713ac2
7.24
2
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
NeCTAR-RC/nectar-osc
nectar_osc/show.py
.py
ff0a27059bbcef42
7.24
2
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
NeCTAR-RC/nectar-osc
nectar_osc/util.py
.py
a18ae5f676ba5a3b
7.24
2
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/nectar-freshdesk
nectar_freshdesk/config.py
.py
6032b7ac9944b237
7
0
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/nectar-freshdesk
nectar_freshdesk/openstack/clients.py
.py
9a2028534b0f8e7f
7
0
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
NeCTAR-RC/nectar-freshdesk
nectar_freshdesk/openstack/messaging.py
.py
fb37a44487945916
7
0
import os import pytest from unittest.mock import patch, MagicMock from pathlib import Path from gitbatch.cli import GitBatch @pytest.fixture def gitbatch_instance() -> GitBatch: """Create a GitBatch instance with run() method mocked to prevent execution.""" with patch("argparse.ArgumentParser.parse_args") as...
thegeeklab/git-batch
gitbatch/test/unit/test_cli.py
.py
9c1652c34cf01709
7.85
4
import os import sys import tempfile import shutil from unittest.mock import patch, MagicMock import pytest from typing import List, Optional, Union, Any, Callable, Tuple from pathlib import Path from gitbatch.utils.copy import ( _islink, _copytree, simple_copy_tree, simple_copy_stat, simple_copy, ...
thegeeklab/git-batch
gitbatch/test/unit/test_copy.py
.py
c134a79df117a9e0
7.85
4
"""Global utility methods and classes.""" import os from typing import Any def normalize_path(path: str | None) -> str | None: if path: return os.path.abspath(os.path.expanduser(os.path.expandvars(path))) return None def strtobool(value: Any) -> bool: """Convert a string representation of trut...
thegeeklab/git-batch
gitbatch/utils/__init__.py
.py
c57c922be8555adf
7.35
4
""" Copy file utils. Provides a copy of the shutil.copytree function and its dependencies. The copystat function used to preserve extended attributes has side effects with SELinux in combination with files copied from temporary directories. """ import contextlib import os import stat import sys from collections.abc i...
thegeeklab/git-batch
gitbatch/utils/copy.py
.py
c7af20b52f21136e
7.35
4
# examples/_resnet_backbone.py from __future__ import annotations from dataclasses import dataclass from typing import Optional, Literal, Final import torch from torch import nn # --- policy knobs (edit here, no CLI) --- PRETRAINED: bool = True # edit here # FINE_TUNE is a set of layer names: # {"none"} ...
fanfan45/bandexa
examples/_resnet_backbone.py
.py
e020487f12c8ba10
7.15
1
# src/bandexa/buffers/disk_dataset.py from __future__ import annotations from typing import Iterator, Optional import torch from torch.utils.data import IterableDataset from bandexa.buffers.disk_replay import DiskReplayBuffer, ReplayBatch class DiskReplayDataset(IterableDataset): """ Infinite iterable datas...
fanfan45/bandexa
src/bandexa/buffers/disk_dataset.py
.py
e96934c324a0fc1f
7.15
1
from __future__ import annotations from dataclasses import dataclass from pathlib import Path from typing import Iterator, Optional, Union import os import json import bisect from collections import OrderedDict import torch Tensor = torch.Tensor PathLike = Union[str, os.PathLike[str]] @dataclass class ReplayBatch:...
fanfan45/bandexa
src/bandexa/buffers/disk_replay.py
.py
4fbb213b159fd15a
7.15
1
from __future__ import annotations """ In-memory replay buffer. The goal is to satisfy the ReplayBufferProtocol defined in buffers/base.py so that policies (e.g. NeuralLinearTS) can be buffer-backend agnostic. This buffer: - stores experiences in RAM (optionally on GPU if device is cuda) - supports uniform sampli...
fanfan45/bandexa
src/bandexa/buffers/memory_replay.py
.py
fa49617db24a4fe8
7.15
1
# src/bandexa/posterior/bayes_linear.py from __future__ import annotations from dataclasses import dataclass from typing import Optional import torch @dataclass(frozen=True) class BLRConfig: """Configuration for Bayesian linear regression posterior.""" dim: int prior_var: float = 1.0 # scalar p...
fanfan45/bandexa
src/bandexa/posterior/bayes_linear.py
.py
113ea9b48f31ef4f
7.15
1
# This python module is a stub # TODO implement the Bayesian Logistic Regression Posterior # src/bandexa/posterior/bayes_logistic.py from __future__ import annotations from dataclasses import dataclass from typing import Optional import torch @dataclass(frozen=True) class BLOGRConfig: """Configuration stub for...
fanfan45/bandexa
src/bandexa/posterior/bayes_logistic.py
.py
4906cdf36c156152
7.15
1
import os import torch import torch.nn as nn from bandexa.buffers.base import MemoryReplayConfig from bandexa.policies.neural_linear_ts import NeuralLinearTS, NeuralLinearTSConfig """NeuralLinearTS save/load inference (no replay buffer needed)""" class TinyEncoder(nn.Module): """Simple deterministic encoder wit...
fanfan45/bandexa
tests/test_neural_linear_ts_checkpoint.py
.py
5f35054d0f7119f7
7.65
1
from django.conf import settings from django.utils.text import gettext_lazy as _ from django_ical.views import ICalFeed from packman.membership.models import Family from .models import Event class EventFeed(ICalFeed): """ A simple event calendar feed """ product_id = f"-//{settings.PACK_NAME}//ica...
Pack144/packman
packman/calendars/feeds.py
.py
b90f8a39cb2ac0a6
7.3
3
from django.core.cache import cache from django.db import models from django.utils import timezone class PackYearManager(models.Manager): def for_date(self, date): """Given a date, return the PackYear for that date.""" return self.get(start_date__lte=date, end_date__gte=date) def current(self...
Pack144/packman
packman/calendars/managers.py
.py
63f0bf74df459d6c
7.3
3
from django.contrib import admin, messages from django.utils.translation import gettext as _ from django.utils.translation import ngettext from packman.calendars.models import PackYear from .models import ( Campaign, Category, Customer, Order, OrderItem, Prize, PrizePoint, PrizeSelecti...
Pack144/packman
packman/campaigns/admin.py
.py
0f18cb6e885223d5
7.3
3
"""Database connection commands for myquery CLI.""" import typer from typing import Optional from rich.console import Console from rich.prompt import Prompt, Confirm from rich.panel import Panel from core.agent import QueryAgent from config import get_logger, settings from cli.utils import SESSION_FILE import json impo...
lemarocain1962/myquery
cli/commands/connect.py
.py
6a5ad96f94b26e61
7
0
"""Query execution commands for myquery CLI.""" import typer from typing import Optional from rich.console import Console from rich.panel import Panel from rich.syntax import Syntax from core.agent import QueryAgent from config import get_logger from cli.utils import auto_connect, ensure_connected app = typer.Typer() ...
lemarocain1962/myquery
cli/commands/query.py
.py
feb2c096e896ef28
7
0
"""Main CLI entrypoint for myquery.""" import typer from typing import Optional from rich.console import Console from rich.panel import Panel from rich.markdown import Markdown from config import setup_logging, get_logger, settings from cli.commands import chat, connect, query, server, visualize, web, multidb, export ...
lemarocain1962/myquery
cli/main.py
.py
ad8ccda508e63b0f
7
0
"""Utility functions for CLI commands.""" from typing import Optional, Tuple from rich.console import Console from rich.prompt import Prompt from core.agent import QueryAgent from config import settings import json import os console = Console() SESSION_FILE = ".myquery_session.json" def get_db_credentials() -> Tuple...
lemarocain1962/myquery
cli/utils.py
.py
38489f2beab91c24
7
0