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
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] | |
public class DisableFormValueModelBindingAttribute : Attribute, IResourceFilter | |
{ | |
public void OnResourceExecuting(ResourceExecutingContext context) | |
{ | |
var factories = context.ValueProviderFactories; | |
factories.RemoveType<FormValueProviderFactory>(); | |
factories.RemoveType<JQueryFormValueProviderFactory>(); | |
} |
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
using System; | |
using System.Linq; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.Extensions.Options; | |
namespace AspNetCoreRateLimit.Demo | |
{ | |
public class MPRateLimitConfiguration : RateLimitConfiguration | |
{ | |
public MPRateLimitConfiguration( |
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
// Curiously Recurring Pattern | |
// http://blogs.msdn.com/b/ericlippert/archive/2011/02/03/curiouser-and-curiouser.aspx | |
public class VersionedExecutorBase<T, TFunc> | |
where T : VersionedExecutorBase<T, TFunc> | |
{ | |
private readonly Func<Version> _versionProvider; | |
private readonly Dictionary<Version, TFunc> _functions; | |
private TFunc _default; | |
public VersionedExecutorBase(Func<Version> versionProvider) |
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 ast | |
import os | |
import re | |
from typing import List, Tuple | |
from langchain_chroma import Chroma | |
from langchain_core.documents import Document | |
from langchain_core.messages import SystemMessage | |
from langchain_core.output_parsers import PydanticOutputParser | |
from langchain_openai import ChatOpenAI, OpenAIEmbeddings |
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 ast | |
import os | |
import re | |
def extract_imports(tree: ast.Module): | |
""" | |
Extract all import statements from an AST tree. | |
Args: |
OlderNewer