Text Classification
Transformers
Safetensors
Spanish
English
bert
NLP
Bert
sentiment-analysis
text-embeddings-inference
Run this model with HF Jobs
Run Light-Dav/sentiment-analysis-full-project on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Light-Dav/sentiment-analysis-full-project. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Light-Dav/sentiment-analysis-full-project on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Light-Dav/sentiment-analysis-full-project with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Light-Dav/sentiment-analysis-full-project with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Light-Dav/sentiment-analysis-full-project")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Light-Dav/sentiment-analysis-full-project") model = AutoModelForSequenceClassification.from_pretrained("Light-Dav/sentiment-analysis-full-project", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add files using upload-large-folder tool
Browse filesFiles changed (50)
- notebooks/results/checkpoint-3000/config.jsonAdded+26
- notebooks/results/checkpoint-3000/trainer_state.jsonAdded+244
- notebooks/results/checkpoint-3500/config.jsonAdded+26
- notebooks/results/checkpoint-3500/trainer_state.jsonAdded+279
- notebooks/results/checkpoint-4000/config.jsonAdded+26
- notebooks/results/checkpoint-4000/trainer_state.jsonAdded+314
- notebooks/results/checkpoint-4500/config.jsonAdded+26
- notebooks/results/checkpoint-4500/trainer_state.jsonAdded+349
- notebooks/results/checkpoint-4689/config.jsonAdded+26
- notebooks/results/checkpoint-4689/trainer_state.jsonAdded+356
- notebooks/results/checkpoint-500/config.jsonAdded+26
- notebooks/results/checkpoint-500/trainer_state.jsonAdded+69
- venv/Lib/site-packages/anyio-4.9.0.dist-info/LICENSEAdded+20
- venv/Lib/site-packages/anyio-4.9.0.dist-info/METADATAAdded+105
- venv/Lib/site-packages/anyio-4.9.0.dist-info/RECORDAdded+88
- venv/Lib/site-packages/anyio-4.9.0.dist-info/WHEELAdded+5
- venv/Lib/site-packages/anyio-4.9.0.dist-info/top_level.txtAdded+1
- venv/Lib/site-packages/argon2/__init__.pyAdded+92
- venv/Lib/site-packages/argon2/__main__.pyAdded+90
- venv/Lib/site-packages/argon2/_legacy.pyAdded+91
- venv/Lib/site-packages/argon2/_password_hasher.pyAdded+251
- venv/Lib/site-packages/argon2/_typing.pyAdded+15
- venv/Lib/site-packages/argon2/_utils.pyAdded+140
- venv/Lib/site-packages/argon2/exceptions.pyAdded+56
- venv/Lib/site-packages/argon2/low_level.pyAdded+238
- venv/Lib/site-packages/argon2/profiles.pyAdded+60
- venv/Lib/site-packages/argon2/py.typedAdded
- venv/Lib/site-packages/argon2_cffi-23.1.0.dist-info/INSTALLERAdded+1
- venv/Lib/site-packages/argon2_cffi-23.1.0.dist-info/METADATAAdded+128
- venv/Lib/site-packages/argon2_cffi-23.1.0.dist-info/RECORDAdded+24
- venv/Lib/site-packages/argon2_cffi-23.1.0.dist-info/WHEELAdded+4
- venv/Lib/site-packages/argon2_cffi_bindings-21.2.0.dist-info/INSTALLERAdded+1
- venv/Lib/site-packages/argon2_cffi_bindings-21.2.0.dist-info/LICENSEAdded+21
- venv/Lib/site-packages/argon2_cffi_bindings-21.2.0.dist-info/METADATAAdded+152
- venv/Lib/site-packages/argon2_cffi_bindings-21.2.0.dist-info/RECORDAdded+11
- venv/Lib/site-packages/argon2_cffi_bindings-21.2.0.dist-info/WHEELAdded+5
- venv/Lib/site-packages/argon2_cffi_bindings-21.2.0.dist-info/top_level.txtAdded+2
- venv/Lib/site-packages/arrow/api.pyAdded+126
- venv/Scripts/Activate.ps1Added+528
- venv/Scripts/activateAdded+76
- venv/Scripts/activate.batAdded+34
- venv/Scripts/deactivate.batAdded+22
- venv/Scripts/get_gprofAdded+75
- venv/Scripts/get_objgraphAdded+54
- venv/Scripts/jsonpointerAdded+67
- venv/Scripts/pywin32_postinstall.pyAdded+733
- venv/Scripts/pywin32_testall.pyAdded+120
- venv/Scripts/undillAdded+22
- venv/etc/jupyter/jupyter_notebook_config.d/jupyterlab.jsonAdded+7
- venv/etc/jupyter/jupyter_server_config.d/jupyter-lsp-jupyter-server.jsonAdded+7
1234567891011121314151617181920212223242526{
"architectures": [
"BertForSequenceClassification"
],
"attention_probs_dropout_prob": 0.1,
"classifier_dropout": null,
"gradient_checkpointing": false,
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"hidden_size": 768,
"initializer_range": 0.02,
"intermediate_size": 3072,
"layer_norm_eps": 1e-12,
"max_position_embeddings": 512,
"model_type": "bert",
"num_attention_heads": 12,
"num_hidden_layers": 12,
"pad_token_id": 0,
"position_embedding_type": "absolute",
"problem_type": "single_label_classification",
"torch_dtype": "float32",
"transformers_version": "4.51.3",
"type_vocab_size": 2,
"use_cache": true,
"vocab_size": 30522
}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244{
"best_global_step": null,
"best_metric": null,
"best_model_checkpoint": null,
"epoch": 1.9193857965451055,
"eval_steps": 500,
"global_step": 3000,
"is_hyper_param_search": false,
"is_local_process_zero": true,
"is_world_process_zero": true,
"log_history": [
{
"epoch": 0.06397952655150352,
"grad_norm": 5.188015460968018,
"learning_rate": 4.8944337811900195e-05,
"loss": 0.5162,
"step": 100
},
{
"epoch": 0.12795905310300704,
"grad_norm": 8.62886905670166,
"learning_rate": 4.7878012369375135e-05,
"loss": 0.4123,
"step": 200
},
{
"epoch": 0.19193857965451055,
"grad_norm": 6.661285877227783,
"learning_rate": 4.681168692685008e-05,
"loss": 0.4106,
"step": 300
},
{
"epoch": 0.2559181062060141,
"grad_norm": 7.992310523986816,
"learning_rate": 4.5745361484325014e-05,
"loss": 0.3619,
"step": 400
},
{
"epoch": 0.3198976327575176,
"grad_norm": 8.48903751373291,
"learning_rate": 4.467903604179996e-05,
"loss": 0.3724,
"step": 500
},
{
"epoch": 0.3838771593090211,
"grad_norm": 7.3620219230651855,
"learning_rate": 4.3612710599274906e-05,
"loss": 0.3582,
"step": 600
},
{
"epoch": 0.44785668586052463,
"grad_norm": 7.127757549285889,
"learning_rate": 4.254638515674984e-05,
"loss": 0.351,
"step": 700
},
{
"epoch": 0.5118362124120281,
"grad_norm": 8.284778594970703,
"learning_rate": 4.1480059714224785e-05,
"loss": 0.3517,
"step": 800
},
{
"epoch": 0.5758157389635317,
"grad_norm": 6.389641284942627,
"learning_rate": 4.0413734271699725e-05,
"loss": 0.3197,
"step": 900
},
{
"epoch": 0.6397952655150352,
"grad_norm": 8.652924537658691,
"learning_rate": 3.9347408829174664e-05,
"loss": 0.3457,
"step": 1000
},
{
"epoch": 0.7037747920665387,
"grad_norm": 9.87730598449707,
"learning_rate": 3.828108338664961e-05,
"loss": 0.3152,
"step": 1100
},
{
"epoch": 0.7677543186180422,
"grad_norm": 9.235931396484375,
"learning_rate": 3.721475794412455e-05,
"loss": 0.3312,
"step": 1200
},
{
"epoch": 0.8317338451695457,
"grad_norm": 8.75272274017334,
"learning_rate": 3.614843250159949e-05,
"loss": 0.3098,
"step": 1300
},
{
"epoch": 0.8957133717210493,
"grad_norm": 3.6930184364318848,
"learning_rate": 3.508210705907443e-05,
"loss": 0.3057,
"step": 1400
},
{
"epoch": 0.9596928982725528,
"grad_norm": 15.71256160736084,
"learning_rate": 3.4015781616549375e-05,
"loss": 0.2994,
"step": 1500
},
{
"epoch": 1.0236724248240563,
"grad_norm": 10.11008071899414,
"learning_rate": 3.2949456174024315e-05,
"loss": 0.2945,
"step": 1600
},
{
"epoch": 1.0876519513755598,
"grad_norm": 1.052371859550476,
"learning_rate": 3.1883130731499254e-05,
"loss": 0.2072,
"step": 1700
},
{
"epoch": 1.1516314779270633,
"grad_norm": 0.17214666306972504,
"learning_rate": 3.08168052889742e-05,
"loss": 0.1915,
"step": 1800
},
{
"epoch": 1.2156110044785668,
"grad_norm": 3.5573925971984863,
"learning_rate": 2.9750479846449137e-05,
"loss": 0.2268,
"step": 1900
},
{
"epoch": 1.2795905310300704,
"grad_norm": 12.984672546386719,
"learning_rate": 2.868415440392408e-05,
"loss": 0.1639,
"step": 2000
},
{
"epoch": 1.3435700575815739,
"grad_norm": 0.8138177990913391,
"learning_rate": 2.7617828961399022e-05,
"loss": 0.1866,
"step": 2100
},
{
"epoch": 1.4075495841330774,
"grad_norm": 10.373751640319824,
"learning_rate": 2.6551503518873962e-05,
"loss": 0.2171,
"step": 2200
},
{
"epoch": 1.471529110684581,
"grad_norm": 5.024399757385254,
"learning_rate": 2.5485178076348905e-05,
"loss": 0.1796,
"step": 2300
},
{
"epoch": 1.5355086372360844,
"grad_norm": 7.260871887207031,
"learning_rate": 2.4418852633823844e-05,
"loss": 0.1878,
"step": 2400
},
{
"epoch": 1.599488163787588,
"grad_norm": 6.540918350219727,
"learning_rate": 2.3352527191298784e-05,
"loss": 0.1675,
"step": 2500
},
{
"epoch": 1.6634676903390915,
"grad_norm": 2.625058650970459,
"learning_rate": 2.2286201748773727e-05,
"loss": 0.2044,
"step": 2600
},
{
"epoch": 1.727447216890595,
"grad_norm": 7.691290855407715,
"learning_rate": 2.1219876306248666e-05,
"loss": 0.1827,
"step": 2700
},
{
"epoch": 1.7914267434420985,
"grad_norm": 8.49361515045166,
"learning_rate": 2.015355086372361e-05,
"loss": 0.1954,
"step": 2800
},
{
"epoch": 1.855406269993602,
"grad_norm": 0.37825897336006165,
"learning_rate": 1.9087225421198552e-05,
"loss": 0.1838,
"step": 2900
},
{
"epoch": 1.9193857965451055,
"grad_norm": 22.31838035583496,
"learning_rate": 1.802089997867349e-05,
"loss": 0.1847,
"step": 3000
}
],
"logging_steps": 100,
"max_steps": 4689,
"num_input_tokens_seen": 0,
"num_train_epochs": 3,
"save_steps": 500,
"stateful_callbacks": {
"TrainerControl": {
"args": {
"should_epoch_stop": false,
"should_evaluate": false,
"should_log": false,
"should_save": true,
"should_training_stop": false
},
"attributes": {}
}
},
"total_flos": 3156806442209280.0,
"train_batch_size": 16,
"trial_name": null,
"trial_params": null
}1234567891011121314151617181920212223242526{
"architectures": [
"BertForSequenceClassification"
],
"attention_probs_dropout_prob": 0.1,
"classifier_dropout": null,
"gradient_checkpointing": false,
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"hidden_size": 768,
"initializer_range": 0.02,
"intermediate_size": 3072,
"layer_norm_eps": 1e-12,
"max_position_embeddings": 512,
"model_type": "bert",
"num_attention_heads": 12,
"num_hidden_layers": 12,
"pad_token_id": 0,
"position_embedding_type": "absolute",
"problem_type": "single_label_classification",
"torch_dtype": "float32",
"transformers_version": "4.51.3",
"type_vocab_size": 2,
"use_cache": true,
"vocab_size": 30522
}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279{
"best_global_step": null,
"best_metric": null,
"best_model_checkpoint": null,
"epoch": 2.239283429302623,
"eval_steps": 500,
"global_step": 3500,
"is_hyper_param_search": false,
"is_local_process_zero": true,
"is_world_process_zero": true,
"log_history": [
{
"epoch": 0.06397952655150352,
"grad_norm": 5.188015460968018,
"learning_rate": 4.8944337811900195e-05,
"loss": 0.5162,
"step": 100
},
{
"epoch": 0.12795905310300704,
"grad_norm": 8.62886905670166,
"learning_rate": 4.7878012369375135e-05,
"loss": 0.4123,
"step": 200
},
{
"epoch": 0.19193857965451055,
"grad_norm": 6.661285877227783,
"learning_rate": 4.681168692685008e-05,
"loss": 0.4106,
"step": 300
},
{
"epoch": 0.2559181062060141,
"grad_norm": 7.992310523986816,
"learning_rate": 4.5745361484325014e-05,
"loss": 0.3619,
"step": 400
},
{
"epoch": 0.3198976327575176,
"grad_norm": 8.48903751373291,
"learning_rate": 4.467903604179996e-05,
"loss": 0.3724,
"step": 500
},
{
"epoch": 0.3838771593090211,
"grad_norm": 7.3620219230651855,
"learning_rate": 4.3612710599274906e-05,
"loss": 0.3582,
"step": 600
},
{
"epoch": 0.44785668586052463,
"grad_norm": 7.127757549285889,
"learning_rate": 4.254638515674984e-05,
"loss": 0.351,
"step": 700
},
{
"epoch": 0.5118362124120281,
"grad_norm": 8.284778594970703,
"learning_rate": 4.1480059714224785e-05,
"loss": 0.3517,
"step": 800
},
{
"epoch": 0.5758157389635317,
"grad_norm": 6.389641284942627,
"learning_rate": 4.0413734271699725e-05,
"loss": 0.3197,
"step": 900
},
{
"epoch": 0.6397952655150352,
"grad_norm": 8.652924537658691,
"learning_rate": 3.9347408829174664e-05,
"loss": 0.3457,
"step": 1000
},
{
"epoch": 0.7037747920665387,
"grad_norm": 9.87730598449707,
"learning_rate": 3.828108338664961e-05,
"loss": 0.3152,
"step": 1100
},
{
"epoch": 0.7677543186180422,
"grad_norm": 9.235931396484375,
"learning_rate": 3.721475794412455e-05,
"loss": 0.3312,
"step": 1200
},
{
"epoch": 0.8317338451695457,
"grad_norm": 8.75272274017334,
"learning_rate": 3.614843250159949e-05,
"loss": 0.3098,
"step": 1300
},
{
"epoch": 0.8957133717210493,
"grad_norm": 3.6930184364318848,
"learning_rate": 3.508210705907443e-05,
"loss": 0.3057,
"step": 1400
},
{
"epoch": 0.9596928982725528,
"grad_norm": 15.71256160736084,
"learning_rate": 3.4015781616549375e-05,
"loss": 0.2994,
"step": 1500
},
{
"epoch": 1.0236724248240563,
"grad_norm": 10.11008071899414,
"learning_rate": 3.2949456174024315e-05,
"loss": 0.2945,
"step": 1600
},
{
"epoch": 1.0876519513755598,
"grad_norm": 1.052371859550476,
"learning_rate": 3.1883130731499254e-05,
"loss": 0.2072,
"step": 1700
},
{
"epoch": 1.1516314779270633,
"grad_norm": 0.17214666306972504,
"learning_rate": 3.08168052889742e-05,
"loss": 0.1915,
"step": 1800
},
{
"epoch": 1.2156110044785668,
"grad_norm": 3.5573925971984863,
"learning_rate": 2.9750479846449137e-05,
"loss": 0.2268,
"step": 1900
},
{
"epoch": 1.2795905310300704,
"grad_norm": 12.984672546386719,
"learning_rate": 2.868415440392408e-05,
"loss": 0.1639,
"step": 2000
},
{
"epoch": 1.3435700575815739,
"grad_norm": 0.8138177990913391,
"learning_rate": 2.7617828961399022e-05,
"loss": 0.1866,
"step": 2100
},
{
"epoch": 1.4075495841330774,
"grad_norm": 10.373751640319824,
"learning_rate": 2.6551503518873962e-05,
"loss": 0.2171,
"step": 2200
},
{
"epoch": 1.471529110684581,
"grad_norm": 5.024399757385254,
"learning_rate": 2.5485178076348905e-05,
"loss": 0.1796,
"step": 2300
},
{
"epoch": 1.5355086372360844,
"grad_norm": 7.260871887207031,
"learning_rate": 2.4418852633823844e-05,
"loss": 0.1878,
"step": 2400
},
{
"epoch": 1.599488163787588,
"grad_norm": 6.540918350219727,
"learning_rate": 2.3352527191298784e-05,
"loss": 0.1675,
"step": 2500
},
{
"epoch": 1.6634676903390915,
"grad_norm": 2.625058650970459,
"learning_rate": 2.2286201748773727e-05,
"loss": 0.2044,
"step": 2600
},
{
"epoch": 1.727447216890595,
"grad_norm": 7.691290855407715,
"learning_rate": 2.1219876306248666e-05,
"loss": 0.1827,
"step": 2700
},
{
"epoch": 1.7914267434420985,
"grad_norm": 8.49361515045166,
"learning_rate": 2.015355086372361e-05,
"loss": 0.1954,
"step": 2800
},
{
"epoch": 1.855406269993602,
"grad_norm": 0.37825897336006165,
"learning_rate": 1.9087225421198552e-05,
"loss": 0.1838,
"step": 2900
},
{
"epoch": 1.9193857965451055,
"grad_norm": 22.31838035583496,
"learning_rate": 1.802089997867349e-05,
"loss": 0.1847,
"step": 3000
},
{
"epoch": 1.983365323096609,
"grad_norm": 20.675575256347656,
"learning_rate": 1.695457453614843e-05,
"loss": 0.1817,
"step": 3100
},
{
"epoch": 2.0473448496481126,
"grad_norm": 0.051862724125385284,
"learning_rate": 1.5888249093623374e-05,
"loss": 0.1106,
"step": 3200
},
{
"epoch": 2.111324376199616,
"grad_norm": 31.099328994750977,
"learning_rate": 1.4821923651098315e-05,
"loss": 0.0715,
"step": 3300
},
{
"epoch": 2.1753039027511196,
"grad_norm": 17.968420028686523,
"learning_rate": 1.3755598208573256e-05,
"loss": 0.0986,
"step": 3400
},
{
"epoch": 2.239283429302623,
"grad_norm": 11.89964485168457,
"learning_rate": 1.2689272766048199e-05,
"loss": 0.0842,
"step": 3500
}
],
"logging_steps": 100,
"max_steps": 4689,
"num_input_tokens_seen": 0,
"num_train_epochs": 3,
"save_steps": 500,
"stateful_callbacks": {
"TrainerControl": {
"args": {
"should_epoch_stop": false,
"should_evaluate": false,
"should_log": false,
"should_save": true,
"should_training_stop": false
},
"attributes": {}
}
},
"total_flos": 3682502330818560.0,
"train_batch_size": 16,
"trial_name": null,
"trial_params": null
}1234567891011121314151617181920212223242526{
"architectures": [
"BertForSequenceClassification"
],
"attention_probs_dropout_prob": 0.1,
"classifier_dropout": null,
"gradient_checkpointing": false,
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"hidden_size": 768,
"initializer_range": 0.02,
"intermediate_size": 3072,
"layer_norm_eps": 1e-12,
"max_position_embeddings": 512,
"model_type": "bert",
"num_attention_heads": 12,
"num_hidden_layers": 12,
"pad_token_id": 0,
"position_embedding_type": "absolute",
"problem_type": "single_label_classification",
"torch_dtype": "float32",
"transformers_version": "4.51.3",
"type_vocab_size": 2,
"use_cache": true,
"vocab_size": 30522
}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314{
"best_global_step": null,
"best_metric": null,
"best_model_checkpoint": null,
"epoch": 2.5591810620601407,
"eval_steps": 500,
"global_step": 4000,
"is_hyper_param_search": false,
"is_local_process_zero": true,
"is_world_process_zero": true,
"log_history": [
{
"epoch": 0.06397952655150352,
"grad_norm": 5.188015460968018,
"learning_rate": 4.8944337811900195e-05,
"loss": 0.5162,
"step": 100
},
{
"epoch": 0.12795905310300704,
"grad_norm": 8.62886905670166,
"learning_rate": 4.7878012369375135e-05,
"loss": 0.4123,
"step": 200
},
{
"epoch": 0.19193857965451055,
"grad_norm": 6.661285877227783,
"learning_rate": 4.681168692685008e-05,
"loss": 0.4106,
"step": 300
},
{
"epoch": 0.2559181062060141,
"grad_norm": 7.992310523986816,
"learning_rate": 4.5745361484325014e-05,
"loss": 0.3619,
"step": 400
},
{
"epoch": 0.3198976327575176,
"grad_norm": 8.48903751373291,
"learning_rate": 4.467903604179996e-05,
"loss": 0.3724,
"step": 500
},
{
"epoch": 0.3838771593090211,
"grad_norm": 7.3620219230651855,
"learning_rate": 4.3612710599274906e-05,
"loss": 0.3582,
"step": 600
},
{
"epoch": 0.44785668586052463,
"grad_norm": 7.127757549285889,
"learning_rate": 4.254638515674984e-05,
"loss": 0.351,
"step": 700
},
{
"epoch": 0.5118362124120281,
"grad_norm": 8.284778594970703,
"learning_rate": 4.1480059714224785e-05,
"loss": 0.3517,
"step": 800
},
{
"epoch": 0.5758157389635317,
"grad_norm": 6.389641284942627,
"learning_rate": 4.0413734271699725e-05,
"loss": 0.3197,
"step": 900
},
{
"epoch": 0.6397952655150352,
"grad_norm": 8.652924537658691,
"learning_rate": 3.9347408829174664e-05,
"loss": 0.3457,
"step": 1000
},
{
"epoch": 0.7037747920665387,
"grad_norm": 9.87730598449707,
"learning_rate": 3.828108338664961e-05,
"loss": 0.3152,
"step": 1100
},
{
"epoch": 0.7677543186180422,
"grad_norm": 9.235931396484375,
"learning_rate": 3.721475794412455e-05,
"loss": 0.3312,
"step": 1200
},
{
"epoch": 0.8317338451695457,
"grad_norm": 8.75272274017334,
"learning_rate": 3.614843250159949e-05,
"loss": 0.3098,
"step": 1300
},
{
"epoch": 0.8957133717210493,
"grad_norm": 3.6930184364318848,
"learning_rate": 3.508210705907443e-05,
"loss": 0.3057,
"step": 1400
},
{
"epoch": 0.9596928982725528,
"grad_norm": 15.71256160736084,
"learning_rate": 3.4015781616549375e-05,
"loss": 0.2994,
"step": 1500
},
{
"epoch": 1.0236724248240563,
"grad_norm": 10.11008071899414,
"learning_rate": 3.2949456174024315e-05,
"loss": 0.2945,
"step": 1600
},
{
"epoch": 1.0876519513755598,
"grad_norm": 1.052371859550476,
"learning_rate": 3.1883130731499254e-05,
"loss": 0.2072,
"step": 1700
},
{
"epoch": 1.1516314779270633,
"grad_norm": 0.17214666306972504,
"learning_rate": 3.08168052889742e-05,
"loss": 0.1915,
"step": 1800
},
{
"epoch": 1.2156110044785668,
"grad_norm": 3.5573925971984863,
"learning_rate": 2.9750479846449137e-05,
"loss": 0.2268,
"step": 1900
},
{
"epoch": 1.2795905310300704,
"grad_norm": 12.984672546386719,
"learning_rate": 2.868415440392408e-05,
"loss": 0.1639,
"step": 2000
},
{
"epoch": 1.3435700575815739,
"grad_norm": 0.8138177990913391,
"learning_rate": 2.7617828961399022e-05,
"loss": 0.1866,
"step": 2100
},
{
"epoch": 1.4075495841330774,
"grad_norm": 10.373751640319824,
"learning_rate": 2.6551503518873962e-05,
"loss": 0.2171,
"step": 2200
},
{
"epoch": 1.471529110684581,
"grad_norm": 5.024399757385254,
"learning_rate": 2.5485178076348905e-05,
"loss": 0.1796,
"step": 2300
},
{
"epoch": 1.5355086372360844,
"grad_norm": 7.260871887207031,
"learning_rate": 2.4418852633823844e-05,
"loss": 0.1878,
"step": 2400
},
{
"epoch": 1.599488163787588,
"grad_norm": 6.540918350219727,
"learning_rate": 2.3352527191298784e-05,
"loss": 0.1675,
"step": 2500
},
{
"epoch": 1.6634676903390915,
"grad_norm": 2.625058650970459,
"learning_rate": 2.2286201748773727e-05,
"loss": 0.2044,
"step": 2600
},
{
"epoch": 1.727447216890595,
"grad_norm": 7.691290855407715,
"learning_rate": 2.1219876306248666e-05,
"loss": 0.1827,
"step": 2700
},
{
"epoch": 1.7914267434420985,
"grad_norm": 8.49361515045166,
"learning_rate": 2.015355086372361e-05,
"loss": 0.1954,
"step": 2800
},
{
"epoch": 1.855406269993602,
"grad_norm": 0.37825897336006165,
"learning_rate": 1.9087225421198552e-05,
"loss": 0.1838,
"step": 2900
},
{
"epoch": 1.9193857965451055,
"grad_norm": 22.31838035583496,
"learning_rate": 1.802089997867349e-05,
"loss": 0.1847,
"step": 3000
},
{
"epoch": 1.983365323096609,
"grad_norm": 20.675575256347656,
"learning_rate": 1.695457453614843e-05,
"loss": 0.1817,
"step": 3100
},
{
"epoch": 2.0473448496481126,
"grad_norm": 0.051862724125385284,
"learning_rate": 1.5888249093623374e-05,
"loss": 0.1106,
"step": 3200
},
{
"epoch": 2.111324376199616,
"grad_norm": 31.099328994750977,
"learning_rate": 1.4821923651098315e-05,
"loss": 0.0715,
"step": 3300
},
{
"epoch": 2.1753039027511196,
"grad_norm": 17.968420028686523,
"learning_rate": 1.3755598208573256e-05,
"loss": 0.0986,
"step": 3400
},
{
"epoch": 2.239283429302623,
"grad_norm": 11.89964485168457,
"learning_rate": 1.2689272766048199e-05,
"loss": 0.0842,
"step": 3500
},
{
"epoch": 2.3032629558541267,
"grad_norm": 0.15594251453876495,
"learning_rate": 1.162294732352314e-05,
"loss": 0.0859,
"step": 3600
},
{
"epoch": 2.36724248240563,
"grad_norm": 0.04546676576137543,
"learning_rate": 1.0556621880998081e-05,
"loss": 0.0831,
"step": 3700
},
{
"epoch": 2.4312220089571337,
"grad_norm": 0.08984202891588211,
"learning_rate": 9.490296438473023e-06,
"loss": 0.0859,
"step": 3800
},
{
"epoch": 2.495201535508637,
"grad_norm": 25.065441131591797,
"learning_rate": 8.423970995947964e-06,
"loss": 0.0972,
"step": 3900
},
{
"epoch": 2.5591810620601407,
"grad_norm": 0.09699796140193939,
"learning_rate": 7.357645553422905e-06,
"loss": 0.0777,
"step": 4000
}
],
"logging_steps": 100,
"max_steps": 4689,
"num_input_tokens_seen": 0,
"num_train_epochs": 3,
"save_steps": 500,
"stateful_callbacks": {
"TrainerControl": {
"args": {
"should_epoch_stop": false,
"should_evaluate": false,
"should_log": false,
"should_save": true,
"should_training_stop": false
},
"attributes": {}
}
},
"total_flos": 4208724441538560.0,
"train_batch_size": 16,
"trial_name": null,
"trial_params": null
}1234567891011121314151617181920212223242526{
"architectures": [
"BertForSequenceClassification"
],
"attention_probs_dropout_prob": 0.1,
"classifier_dropout": null,
"gradient_checkpointing": false,
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"hidden_size": 768,
"initializer_range": 0.02,
"intermediate_size": 3072,
"layer_norm_eps": 1e-12,
"max_position_embeddings": 512,
"model_type": "bert",
"num_attention_heads": 12,
"num_hidden_layers": 12,
"pad_token_id": 0,
"position_embedding_type": "absolute",
"problem_type": "single_label_classification",
"torch_dtype": "float32",
"transformers_version": "4.51.3",
"type_vocab_size": 2,
"use_cache": true,
"vocab_size": 30522
}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349{
"best_global_step": null,
"best_metric": null,
"best_model_checkpoint": null,
"epoch": 2.8790786948176583,
"eval_steps": 500,
"global_step": 4500,
"is_hyper_param_search": false,
"is_local_process_zero": true,
"is_world_process_zero": true,
"log_history": [
{
"epoch": 0.06397952655150352,
"grad_norm": 5.188015460968018,
"learning_rate": 4.8944337811900195e-05,
"loss": 0.5162,
"step": 100
},
{
"epoch": 0.12795905310300704,
"grad_norm": 8.62886905670166,
"learning_rate": 4.7878012369375135e-05,
"loss": 0.4123,
"step": 200
},
{
"epoch": 0.19193857965451055,
"grad_norm": 6.661285877227783,
"learning_rate": 4.681168692685008e-05,
"loss": 0.4106,
"step": 300
},
{
"epoch": 0.2559181062060141,
"grad_norm": 7.992310523986816,
"learning_rate": 4.5745361484325014e-05,
"loss": 0.3619,
"step": 400
},
{
"epoch": 0.3198976327575176,
"grad_norm": 8.48903751373291,
"learning_rate": 4.467903604179996e-05,
"loss": 0.3724,
"step": 500
},
{
"epoch": 0.3838771593090211,
"grad_norm": 7.3620219230651855,
"learning_rate": 4.3612710599274906e-05,
"loss": 0.3582,
"step": 600
},
{
"epoch": 0.44785668586052463,
"grad_norm": 7.127757549285889,
"learning_rate": 4.254638515674984e-05,
"loss": 0.351,
"step": 700
},
{
"epoch": 0.5118362124120281,
"grad_norm": 8.284778594970703,
"learning_rate": 4.1480059714224785e-05,
"loss": 0.3517,
"step": 800
},
{
"epoch": 0.5758157389635317,
"grad_norm": 6.389641284942627,
"learning_rate": 4.0413734271699725e-05,
"loss": 0.3197,
"step": 900
},
{
"epoch": 0.6397952655150352,
"grad_norm": 8.652924537658691,
"learning_rate": 3.9347408829174664e-05,
"loss": 0.3457,
"step": 1000
},
{
"epoch": 0.7037747920665387,
"grad_norm": 9.87730598449707,
"learning_rate": 3.828108338664961e-05,
"loss": 0.3152,
"step": 1100
},
{
"epoch": 0.7677543186180422,
"grad_norm": 9.235931396484375,
"learning_rate": 3.721475794412455e-05,
"loss": 0.3312,
"step": 1200
},
{
"epoch": 0.8317338451695457,
"grad_norm": 8.75272274017334,
"learning_rate": 3.614843250159949e-05,
"loss": 0.3098,
"step": 1300
},
{
"epoch": 0.8957133717210493,
"grad_norm": 3.6930184364318848,
"learning_rate": 3.508210705907443e-05,
"loss": 0.3057,
"step": 1400
},
{
"epoch": 0.9596928982725528,
"grad_norm": 15.71256160736084,
"learning_rate": 3.4015781616549375e-05,
"loss": 0.2994,
"step": 1500
},
{
"epoch": 1.0236724248240563,
"grad_norm": 10.11008071899414,
"learning_rate": 3.2949456174024315e-05,
"loss": 0.2945,
"step": 1600
},
{
"epoch": 1.0876519513755598,
"grad_norm": 1.052371859550476,
"learning_rate": 3.1883130731499254e-05,
"loss": 0.2072,
"step": 1700
},
{
"epoch": 1.1516314779270633,
"grad_norm": 0.17214666306972504,
"learning_rate": 3.08168052889742e-05,
"loss": 0.1915,
"step": 1800
},
{
"epoch": 1.2156110044785668,
"grad_norm": 3.5573925971984863,
"learning_rate": 2.9750479846449137e-05,
"loss": 0.2268,
"step": 1900
},
{
"epoch": 1.2795905310300704,
"grad_norm": 12.984672546386719,
"learning_rate": 2.868415440392408e-05,
"loss": 0.1639,
"step": 2000
},
{
"epoch": 1.3435700575815739,
"grad_norm": 0.8138177990913391,
"learning_rate": 2.7617828961399022e-05,
"loss": 0.1866,
"step": 2100
},
{
"epoch": 1.4075495841330774,
"grad_norm": 10.373751640319824,
"learning_rate": 2.6551503518873962e-05,
"loss": 0.2171,
"step": 2200
},
{
"epoch": 1.471529110684581,
"grad_norm": 5.024399757385254,
"learning_rate": 2.5485178076348905e-05,
"loss": 0.1796,
"step": 2300
},
{
"epoch": 1.5355086372360844,
"grad_norm": 7.260871887207031,
"learning_rate": 2.4418852633823844e-05,
"loss": 0.1878,
"step": 2400
},
{
"epoch": 1.599488163787588,
"grad_norm": 6.540918350219727,
"learning_rate": 2.3352527191298784e-05,
"loss": 0.1675,
"step": 2500
},
{
"epoch": 1.6634676903390915,
"grad_norm": 2.625058650970459,
"learning_rate": 2.2286201748773727e-05,
"loss": 0.2044,
"step": 2600
},
{
"epoch": 1.727447216890595,
"grad_norm": 7.691290855407715,
"learning_rate": 2.1219876306248666e-05,
"loss": 0.1827,
"step": 2700
},
{
"epoch": 1.7914267434420985,
"grad_norm": 8.49361515045166,
"learning_rate": 2.015355086372361e-05,
"loss": 0.1954,
"step": 2800
},
{
"epoch": 1.855406269993602,
"grad_norm": 0.37825897336006165,
"learning_rate": 1.9087225421198552e-05,
"loss": 0.1838,
"step": 2900
},
{
"epoch": 1.9193857965451055,
"grad_norm": 22.31838035583496,
"learning_rate": 1.802089997867349e-05,
"loss": 0.1847,
"step": 3000
},
{
"epoch": 1.983365323096609,
"grad_norm": 20.675575256347656,
"learning_rate": 1.695457453614843e-05,
"loss": 0.1817,
"step": 3100
},
{
"epoch": 2.0473448496481126,
"grad_norm": 0.051862724125385284,
"learning_rate": 1.5888249093623374e-05,
"loss": 0.1106,
"step": 3200
},
{
"epoch": 2.111324376199616,
"grad_norm": 31.099328994750977,
"learning_rate": 1.4821923651098315e-05,
"loss": 0.0715,
"step": 3300
},
{
"epoch": 2.1753039027511196,
"grad_norm": 17.968420028686523,
"learning_rate": 1.3755598208573256e-05,
"loss": 0.0986,
"step": 3400
},
{
"epoch": 2.239283429302623,
"grad_norm": 11.89964485168457,
"learning_rate": 1.2689272766048199e-05,
"loss": 0.0842,
"step": 3500
},
{
"epoch": 2.3032629558541267,
"grad_norm": 0.15594251453876495,
"learning_rate": 1.162294732352314e-05,
"loss": 0.0859,
"step": 3600
},
{
"epoch": 2.36724248240563,
"grad_norm": 0.04546676576137543,
"learning_rate": 1.0556621880998081e-05,
"loss": 0.0831,
"step": 3700
},
{
"epoch": 2.4312220089571337,
"grad_norm": 0.08984202891588211,
"learning_rate": 9.490296438473023e-06,
"loss": 0.0859,
"step": 3800
},
{
"epoch": 2.495201535508637,
"grad_norm": 25.065441131591797,
"learning_rate": 8.423970995947964e-06,
"loss": 0.0972,
"step": 3900
},
{
"epoch": 2.5591810620601407,
"grad_norm": 0.09699796140193939,
"learning_rate": 7.357645553422905e-06,
"loss": 0.0777,
"step": 4000
},
{
"epoch": 2.6231605886116443,
"grad_norm": 9.286548614501953,
"learning_rate": 6.291320110897847e-06,
"loss": 0.0896,
"step": 4100
},
{
"epoch": 2.6871401151631478,
"grad_norm": 26.573453903198242,
"learning_rate": 5.224994668372787e-06,
"loss": 0.0966,
"step": 4200
},
{
"epoch": 2.7511196417146513,
"grad_norm": 8.264235496520996,
"learning_rate": 4.158669225847729e-06,
"loss": 0.0734,
"step": 4300
},
{
"epoch": 2.815099168266155,
"grad_norm": 29.1925048828125,
"learning_rate": 3.09234378332267e-06,
"loss": 0.0863,
"step": 4400
},
{
"epoch": 2.8790786948176583,
"grad_norm": 0.08194595575332642,
"learning_rate": 2.0260183407976117e-06,
"loss": 0.0607,
"step": 4500
}
],
"logging_steps": 100,
"max_steps": 4689,
"num_input_tokens_seen": 0,
"num_train_epochs": 3,
"save_steps": 500,
"stateful_callbacks": {
"TrainerControl": {
"args": {
"should_epoch_stop": false,
"should_evaluate": false,
"should_log": false,
"should_save": true,
"should_training_stop": false
},
"attributes": {}
}
},
"total_flos": 4734946552258560.0,
"train_batch_size": 16,
"trial_name": null,
"trial_params": null
}1234567891011121314151617181920212223242526{
"architectures": [
"BertForSequenceClassification"
],
"attention_probs_dropout_prob": 0.1,
"classifier_dropout": null,
"gradient_checkpointing": false,
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"hidden_size": 768,
"initializer_range": 0.02,
"intermediate_size": 3072,
"layer_norm_eps": 1e-12,
"max_position_embeddings": 512,
"model_type": "bert",
"num_attention_heads": 12,
"num_hidden_layers": 12,
"pad_token_id": 0,
"position_embedding_type": "absolute",
"problem_type": "single_label_classification",
"torch_dtype": "float32",
"transformers_version": "4.51.3",
"type_vocab_size": 2,
"use_cache": true,
"vocab_size": 30522
}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356{
"best_global_step": null,
"best_metric": null,
"best_model_checkpoint": null,
"epoch": 3.0,
"eval_steps": 500,
"global_step": 4689,
"is_hyper_param_search": false,
"is_local_process_zero": true,
"is_world_process_zero": true,
"log_history": [
{
"epoch": 0.06397952655150352,
"grad_norm": 5.188015460968018,
"learning_rate": 4.8944337811900195e-05,
"loss": 0.5162,
"step": 100
},
{
"epoch": 0.12795905310300704,
"grad_norm": 8.62886905670166,
"learning_rate": 4.7878012369375135e-05,
"loss": 0.4123,
"step": 200
},
{
"epoch": 0.19193857965451055,
"grad_norm": 6.661285877227783,
"learning_rate": 4.681168692685008e-05,
"loss": 0.4106,
"step": 300
},
{
"epoch": 0.2559181062060141,
"grad_norm": 7.992310523986816,
"learning_rate": 4.5745361484325014e-05,
"loss": 0.3619,
"step": 400
},
{
"epoch": 0.3198976327575176,
"grad_norm": 8.48903751373291,
"learning_rate": 4.467903604179996e-05,
"loss": 0.3724,
"step": 500
},
{
"epoch": 0.3838771593090211,
"grad_norm": 7.3620219230651855,
"learning_rate": 4.3612710599274906e-05,
"loss": 0.3582,
"step": 600
},
{
"epoch": 0.44785668586052463,
"grad_norm": 7.127757549285889,
"learning_rate": 4.254638515674984e-05,
"loss": 0.351,
"step": 700
},
{
"epoch": 0.5118362124120281,
"grad_norm": 8.284778594970703,
"learning_rate": 4.1480059714224785e-05,
"loss": 0.3517,
"step": 800
},
{
"epoch": 0.5758157389635317,
"grad_norm": 6.389641284942627,
"learning_rate": 4.0413734271699725e-05,
"loss": 0.3197,
"step": 900
},
{
"epoch": 0.6397952655150352,
"grad_norm": 8.652924537658691,
"learning_rate": 3.9347408829174664e-05,
"loss": 0.3457,
"step": 1000
},
{
"epoch": 0.7037747920665387,
"grad_norm": 9.87730598449707,
"learning_rate": 3.828108338664961e-05,
"loss": 0.3152,
"step": 1100
},
{
"epoch": 0.7677543186180422,
"grad_norm": 9.235931396484375,
"learning_rate": 3.721475794412455e-05,
"loss": 0.3312,
"step": 1200
},
{
"epoch": 0.8317338451695457,
"grad_norm": 8.75272274017334,
"learning_rate": 3.614843250159949e-05,
"loss": 0.3098,
"step": 1300
},
{
"epoch": 0.8957133717210493,
"grad_norm": 3.6930184364318848,
"learning_rate": 3.508210705907443e-05,
"loss": 0.3057,
"step": 1400
},
{
"epoch": 0.9596928982725528,
"grad_norm": 15.71256160736084,
"learning_rate": 3.4015781616549375e-05,
"loss": 0.2994,
"step": 1500
},
{
"epoch": 1.0236724248240563,
"grad_norm": 10.11008071899414,
"learning_rate": 3.2949456174024315e-05,
"loss": 0.2945,
"step": 1600
},
{
"epoch": 1.0876519513755598,
"grad_norm": 1.052371859550476,
"learning_rate": 3.1883130731499254e-05,
"loss": 0.2072,
"step": 1700
},
{
"epoch": 1.1516314779270633,
"grad_norm": 0.17214666306972504,
"learning_rate": 3.08168052889742e-05,
"loss": 0.1915,
"step": 1800
},
{
"epoch": 1.2156110044785668,
"grad_norm": 3.5573925971984863,
"learning_rate": 2.9750479846449137e-05,
"loss": 0.2268,
"step": 1900
},
{
"epoch": 1.2795905310300704,
"grad_norm": 12.984672546386719,
"learning_rate": 2.868415440392408e-05,
"loss": 0.1639,
"step": 2000
},
{
"epoch": 1.3435700575815739,
"grad_norm": 0.8138177990913391,
"learning_rate": 2.7617828961399022e-05,
"loss": 0.1866,
"step": 2100
},
{
"epoch": 1.4075495841330774,
"grad_norm": 10.373751640319824,
"learning_rate": 2.6551503518873962e-05,
"loss": 0.2171,
"step": 2200
},
{
"epoch": 1.471529110684581,
"grad_norm": 5.024399757385254,
"learning_rate": 2.5485178076348905e-05,
"loss": 0.1796,
"step": 2300
},
{
"epoch": 1.5355086372360844,
"grad_norm": 7.260871887207031,
"learning_rate": 2.4418852633823844e-05,
"loss": 0.1878,
"step": 2400
},
{
"epoch": 1.599488163787588,
"grad_norm": 6.540918350219727,
"learning_rate": 2.3352527191298784e-05,
"loss": 0.1675,
"step": 2500
},
{
"epoch": 1.6634676903390915,
"grad_norm": 2.625058650970459,
"learning_rate": 2.2286201748773727e-05,
"loss": 0.2044,
"step": 2600
},
{
"epoch": 1.727447216890595,
"grad_norm": 7.691290855407715,
"learning_rate": 2.1219876306248666e-05,
"loss": 0.1827,
"step": 2700
},
{
"epoch": 1.7914267434420985,
"grad_norm": 8.49361515045166,
"learning_rate": 2.015355086372361e-05,
"loss": 0.1954,
"step": 2800
},
{
"epoch": 1.855406269993602,
"grad_norm": 0.37825897336006165,
"learning_rate": 1.9087225421198552e-05,
"loss": 0.1838,
"step": 2900
},
{
"epoch": 1.9193857965451055,
"grad_norm": 22.31838035583496,
"learning_rate": 1.802089997867349e-05,
"loss": 0.1847,
"step": 3000
},
{
"epoch": 1.983365323096609,
"grad_norm": 20.675575256347656,
"learning_rate": 1.695457453614843e-05,
"loss": 0.1817,
"step": 3100
},
{
"epoch": 2.0473448496481126,
"grad_norm": 0.051862724125385284,
"learning_rate": 1.5888249093623374e-05,
"loss": 0.1106,
"step": 3200
},
{
"epoch": 2.111324376199616,
"grad_norm": 31.099328994750977,
"learning_rate": 1.4821923651098315e-05,
"loss": 0.0715,
"step": 3300
},
{
"epoch": 2.1753039027511196,
"grad_norm": 17.968420028686523,
"learning_rate": 1.3755598208573256e-05,
"loss": 0.0986,
"step": 3400
},
{
"epoch": 2.239283429302623,
"grad_norm": 11.89964485168457,
"learning_rate": 1.2689272766048199e-05,
"loss": 0.0842,
"step": 3500
},
{
"epoch": 2.3032629558541267,
"grad_norm": 0.15594251453876495,
"learning_rate": 1.162294732352314e-05,
"loss": 0.0859,
"step": 3600
},
{
"epoch": 2.36724248240563,
"grad_norm": 0.04546676576137543,
"learning_rate": 1.0556621880998081e-05,
"loss": 0.0831,
"step": 3700
},
{
"epoch": 2.4312220089571337,
"grad_norm": 0.08984202891588211,
"learning_rate": 9.490296438473023e-06,
"loss": 0.0859,
"step": 3800
},
{
"epoch": 2.495201535508637,
"grad_norm": 25.065441131591797,
"learning_rate": 8.423970995947964e-06,
"loss": 0.0972,
"step": 3900
},
{
"epoch": 2.5591810620601407,
"grad_norm": 0.09699796140193939,
"learning_rate": 7.357645553422905e-06,
"loss": 0.0777,
"step": 4000
},
{
"epoch": 2.6231605886116443,
"grad_norm": 9.286548614501953,
"learning_rate": 6.291320110897847e-06,
"loss": 0.0896,
"step": 4100
},
{
"epoch": 2.6871401151631478,
"grad_norm": 26.573453903198242,
"learning_rate": 5.224994668372787e-06,
"loss": 0.0966,
"step": 4200
},
{
"epoch": 2.7511196417146513,
"grad_norm": 8.264235496520996,
"learning_rate": 4.158669225847729e-06,
"loss": 0.0734,
"step": 4300
},
{
"epoch": 2.815099168266155,
"grad_norm": 29.1925048828125,
"learning_rate": 3.09234378332267e-06,
"loss": 0.0863,
"step": 4400
},
{
"epoch": 2.8790786948176583,
"grad_norm": 0.08194595575332642,
"learning_rate": 2.0260183407976117e-06,
"loss": 0.0607,
"step": 4500
},
{
"epoch": 2.943058221369162,
"grad_norm": 0.2947525084018707,
"learning_rate": 9.596928982725527e-07,
"loss": 0.059,
"step": 4600
}
],
"logging_steps": 100,
"max_steps": 4689,
"num_input_tokens_seen": 0,
"num_train_epochs": 3,
"save_steps": 500,
"stateful_callbacks": {
"TrainerControl": {
"args": {
"should_epoch_stop": false,
"should_evaluate": false,
"should_log": false,
"should_save": true,
"should_training_stop": true
},
"attributes": {}
}
},
"total_flos": 4933332288000000.0,
"train_batch_size": 16,
"trial_name": null,
"trial_params": null
}1234567891011121314151617181920212223242526{
"architectures": [
"BertForSequenceClassification"
],
"attention_probs_dropout_prob": 0.1,
"classifier_dropout": null,
"gradient_checkpointing": false,
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"hidden_size": 768,
"initializer_range": 0.02,
"intermediate_size": 3072,
"layer_norm_eps": 1e-12,
"max_position_embeddings": 512,
"model_type": "bert",
"num_attention_heads": 12,
"num_hidden_layers": 12,
"pad_token_id": 0,
"position_embedding_type": "absolute",
"problem_type": "single_label_classification",
"torch_dtype": "float32",
"transformers_version": "4.51.3",
"type_vocab_size": 2,
"use_cache": true,
"vocab_size": 30522
}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869{
"best_global_step": null,
"best_metric": null,
"best_model_checkpoint": null,
"epoch": 0.3198976327575176,
"eval_steps": 500,
"global_step": 500,
"is_hyper_param_search": false,
"is_local_process_zero": true,
"is_world_process_zero": true,
"log_history": [
{
"epoch": 0.06397952655150352,
"grad_norm": 5.188015460968018,
"learning_rate": 4.8944337811900195e-05,
"loss": 0.5162,
"step": 100
},
{
"epoch": 0.12795905310300704,
"grad_norm": 8.62886905670166,
"learning_rate": 4.7878012369375135e-05,
"loss": 0.4123,
"step": 200
},
{
"epoch": 0.19193857965451055,
"grad_norm": 6.661285877227783,
"learning_rate": 4.681168692685008e-05,
"loss": 0.4106,
"step": 300
},
{
"epoch": 0.2559181062060141,
"grad_norm": 7.992310523986816,
"learning_rate": 4.5745361484325014e-05,
"loss": 0.3619,
"step": 400
},
{
"epoch": 0.3198976327575176,
"grad_norm": 8.48903751373291,
"learning_rate": 4.467903604179996e-05,
"loss": 0.3724,
"step": 500
}
],
"logging_steps": 100,
"max_steps": 4689,
"num_input_tokens_seen": 0,
"num_train_epochs": 3,
"save_steps": 500,
"stateful_callbacks": {
"TrainerControl": {
"args": {
"should_epoch_stop": false,
"should_evaluate": false,
"should_log": false,
"should_save": true,
"should_training_stop": false
},
"attributes": {}
}
},
"total_flos": 526222110720000.0,
"train_batch_size": 16,
"trial_name": null,
"trial_params": null
}1234567891011121314151617181920The MIT License (MIT)
Copyright (c) 2018 Alex Grönholm
Permission is hereby granted, free of charge, to any person obtaining a copy ofthis software and associated documentation files (the "Software"), to deal inthe Software without restriction, including without limitation the rights touse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies ofthe Software, and to permit persons to whom the Software is furnished to do so,subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESSFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS ORCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHERIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR INCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105Metadata-Version: 2.2Name: anyioVersion: 4.9.0Summary: High level compatibility layer for multiple asynchronous event loop implementationsAuthor-email: Alex Grönholm <alex.gronholm@nextday.fi>License: MITProject-URL: Documentation, https://anyio.readthedocs.io/en/latest/Project-URL: Changelog, https://anyio.readthedocs.io/en/stable/versionhistory.htmlProject-URL: Source code, https://github.com/agronholm/anyioProject-URL: Issue tracker, https://github.com/agronholm/anyio/issuesClassifier: Development Status :: 5 - Production/StableClassifier: Intended Audience :: DevelopersClassifier: License :: OSI Approved :: MIT LicenseClassifier: Framework :: AnyIOClassifier: Typing :: TypedClassifier: Programming Language :: PythonClassifier: Programming Language :: Python :: 3Classifier: Programming Language :: Python :: 3.9Classifier: Programming Language :: Python :: 3.10Classifier: Programming Language :: Python :: 3.11Classifier: Programming Language :: Python :: 3.12Classifier: Programming Language :: Python :: 3.13Requires-Python: >=3.9Description-Content-Type: text/x-rstLicense-File: LICENSERequires-Dist: exceptiongroup>=1.0.2; python_version < "3.11"Requires-Dist: idna>=2.8Requires-Dist: sniffio>=1.1Requires-Dist: typing_extensions>=4.5; python_version < "3.13"Provides-Extra: trioRequires-Dist: trio>=0.26.1; extra == "trio"Provides-Extra: testRequires-Dist: anyio[trio]; extra == "test"Requires-Dist: blockbuster>=1.5.23; extra == "test"Requires-Dist: coverage[toml]>=7; extra == "test"Requires-Dist: exceptiongroup>=1.2.0; extra == "test"Requires-Dist: hypothesis>=4.0; extra == "test"Requires-Dist: psutil>=5.9; extra == "test"Requires-Dist: pytest>=7.0; extra == "test"Requires-Dist: trustme; extra == "test"Requires-Dist: truststore>=0.9.1; python_version >= "3.10" and extra == "test"Requires-Dist: uvloop>=0.21; (platform_python_implementation == "CPython" and platform_system != "Windows" and python_version < "3.14") and extra == "test"Provides-Extra: docRequires-Dist: packaging; extra == "doc"Requires-Dist: Sphinx~=8.2; extra == "doc"Requires-Dist: sphinx_rtd_theme; extra == "doc"Requires-Dist: sphinx-autodoc-typehints>=1.2.0; extra == "doc"
.. image:: https://github.com/agronholm/anyio/actions/workflows/test.yml/badge.svg :target: https://github.com/agronholm/anyio/actions/workflows/test.yml :alt: Build Status.. image:: https://coveralls.io/repos/github/agronholm/anyio/badge.svg?branch=master :target: https://coveralls.io/github/agronholm/anyio?branch=master :alt: Code Coverage.. image:: https://readthedocs.org/projects/anyio/badge/?version=latest :target: https://anyio.readthedocs.io/en/latest/?badge=latest :alt: Documentation.. image:: https://badges.gitter.im/gitterHQ/gitter.svg :target: https://gitter.im/python-trio/AnyIO :alt: Gitter chat
AnyIO is an asynchronous networking and concurrency library that works on top of either asyncio_ ortrio_. It implements trio-like `structured concurrency`_ (SC) on top of asyncio and works in harmonywith the native SC of trio itself.
Applications and libraries written against AnyIO's API will run unmodified on either asyncio_ ortrio_. AnyIO can also be adopted into a library or application incrementally – bit by bit, no fullrefactoring necessary. It will blend in with the native libraries of your chosen backend.
Documentation-------------
View full documentation at: https://anyio.readthedocs.io/
Features--------
AnyIO offers the following functionality:
* Task groups (nurseries_ in trio terminology)* High-level networking (TCP, UDP and UNIX sockets)
* `Happy eyeballs`_ algorithm for TCP connections (more robust than that of asyncio on Python 3.8) * async/await style UDP sockets (unlike asyncio where you still have to use Transports and Protocols)
* A versatile API for byte streams and object streams* Inter-task synchronization and communication (locks, conditions, events, semaphores, object streams)* Worker threads* Subprocesses* Asynchronous file I/O (using worker threads)* Signal handling
AnyIO also comes with its own pytest_ plugin which also supports asynchronous fixtures.It even works with the popular Hypothesis_ library.
.. _asyncio: https://docs.python.org/3/library/asyncio.html.. _trio: https://github.com/python-trio/trio.. _structured concurrency: https://en.wikipedia.org/wiki/Structured_concurrency.. _nurseries: https://trio.readthedocs.io/en/stable/reference-core.html#nurseries-and-spawning.. _Happy eyeballs: https://en.wikipedia.org/wiki/Happy_Eyeballs.. _pytest: https://docs.pytest.org/en/latest/.. _Hypothesis: https://hypothesis.works/12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788anyio-4.9.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
anyio-4.9.0.dist-info/LICENSE,sha256=U2GsncWPLvX9LpsJxoKXwX8ElQkJu8gCO9uC6s8iwrA,1081
anyio-4.9.0.dist-info/METADATA,sha256=vvkWPXXTbrpTCFK7zdcYwQcSQhx6Q4qITM9t_PEQCrY,4682
anyio-4.9.0.dist-info/RECORD,,
anyio-4.9.0.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
anyio-4.9.0.dist-info/entry_points.txt,sha256=_d6Yu6uiaZmNe0CydowirE9Cmg7zUL2g08tQpoS3Qvc,39
anyio-4.9.0.dist-info/top_level.txt,sha256=QglSMiWX8_5dpoVAEIHdEYzvqFMdSYWmCj6tYw2ITkQ,6
anyio/__init__.py,sha256=t8bZuNXa5ncwXBaNKbv48BDgZt48RT_zCEtrnPmjNU8,4993
anyio/__pycache__/__init__.cpython-312.pyc,,
anyio/__pycache__/from_thread.cpython-312.pyc,,
anyio/__pycache__/lowlevel.cpython-312.pyc,,
anyio/__pycache__/pytest_plugin.cpython-312.pyc,,
anyio/__pycache__/to_interpreter.cpython-312.pyc,,
anyio/__pycache__/to_process.cpython-312.pyc,,
anyio/__pycache__/to_thread.cpython-312.pyc,,
anyio/_backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
anyio/_backends/__pycache__/__init__.cpython-312.pyc,,
anyio/_backends/__pycache__/_asyncio.cpython-312.pyc,,
anyio/_backends/__pycache__/_trio.cpython-312.pyc,,
anyio/_backends/_asyncio.py,sha256=AT1oaTfCE-9YFxooMlvld2yDqY5U2A-ANMcBDh9eRfI,93455
anyio/_backends/_trio.py,sha256=HVfDqRGQ7Xj3JfTcYdgzmC7pZEplqU4NOO5kxNNSZnk,40429
anyio/_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
anyio/_core/__pycache__/__init__.cpython-312.pyc,,
anyio/_core/__pycache__/_asyncio_selector_thread.cpython-312.pyc,,
anyio/_core/__pycache__/_eventloop.cpython-312.pyc,,
anyio/_core/__pycache__/_exceptions.cpython-312.pyc,,
anyio/_core/__pycache__/_fileio.cpython-312.pyc,,
anyio/_core/__pycache__/_resources.cpython-312.pyc,,
anyio/_core/__pycache__/_signals.cpython-312.pyc,,
anyio/_core/__pycache__/_sockets.cpython-312.pyc,,
anyio/_core/__pycache__/_streams.cpython-312.pyc,,
anyio/_core/__pycache__/_subprocesses.cpython-312.pyc,,
anyio/_core/__pycache__/_synchronization.cpython-312.pyc,,
anyio/_core/__pycache__/_tasks.cpython-312.pyc,,
anyio/_core/__pycache__/_tempfile.cpython-312.pyc,,
anyio/_core/__pycache__/_testing.cpython-312.pyc,,
anyio/_core/__pycache__/_typedattr.cpython-312.pyc,,
anyio/_core/_asyncio_selector_thread.py,sha256=2PdxFM3cs02Kp6BSppbvmRT7q7asreTW5FgBxEsflBo,5626
anyio/_core/_eventloop.py,sha256=t_tAwBFPjF8jrZGjlJ6bbYy6KA3bjsbZxV9mvh9t1i0,4695
anyio/_core/_exceptions.py,sha256=RlPRlwastdmfDPoskdXNO6SI8_l3fclA2wtW6cokU9I,3503
anyio/_core/_fileio.py,sha256=qFZhkLIz0cGXluvih_vcPUTucgq8UFVgsTCtYbijZIg,23340
anyio/_core/_resources.py,sha256=NbmU5O5UX3xEyACnkmYX28Fmwdl-f-ny0tHym26e0w0,435
anyio/_core/_signals.py,sha256=vulT1M1xdLYtAR-eY5TamIgaf1WTlOwOrMGwswlTTr8,905
anyio/_core/_sockets.py,sha256=5Okc_UThGDEN9KCnsIhqWPRHBNuSy6b4NmG1i51TVF4,27150
anyio/_core/_streams.py,sha256=OnaKgoDD-FcMSwLvkoAUGP51sG2ZdRvMpxt9q2w1gYA,1804
anyio/_core/_subprocesses.py,sha256=EXm5igL7dj55iYkPlbYVAqtbqxJxjU-6OndSTIx9SRg,8047
anyio/_core/_synchronization.py,sha256=DwUh8Tl6cG_UMVC_GyzPoC_U9BpfDfjMl9SINSxcZN4,20320
anyio/_core/_tasks.py,sha256=f3CuWwo06cCZ6jaOv-JHFKWkgpgf2cvaF25Oh4augMA,4757
anyio/_core/_tempfile.py,sha256=s-_ucacXbxBH5Bo5eo65lN0lPwZQd5B8yNN_9nARpCM,19696
anyio/_core/_testing.py,sha256=YUGwA5cgFFbUTv4WFd7cv_BSVr4ryTtPp8owQA3JdWE,2118
anyio/_core/_typedattr.py,sha256=P4ozZikn3-DbpoYcvyghS_FOYAgbmUxeoU8-L_07pZM,2508
anyio/abc/__init__.py,sha256=c2OQbTCS_fQowviMXanLPh8m29ccwkXmpDr7uyNZYOo,2652
anyio/abc/__pycache__/__init__.cpython-312.pyc,,
anyio/abc/__pycache__/_eventloop.cpython-312.pyc,,
anyio/abc/__pycache__/_resources.cpython-312.pyc,,
anyio/abc/__pycache__/_sockets.cpython-312.pyc,,
anyio/abc/__pycache__/_streams.cpython-312.pyc,,
anyio/abc/__pycache__/_subprocesses.cpython-312.pyc,,
anyio/abc/__pycache__/_tasks.cpython-312.pyc,,
anyio/abc/__pycache__/_testing.cpython-312.pyc,,
anyio/abc/_eventloop.py,sha256=UmL8DZCvQTgxzmyBZcGm9kWj9VQY8BMWueLh5S8yWN4,9682
anyio/abc/_resources.py,sha256=DrYvkNN1hH6Uvv5_5uKySvDsnknGVDe8FCKfko0VtN8,783
anyio/abc/_sockets.py,sha256=KhWtJxan8jpBXKwPaFeQzI4iRXdFaOIn0HXtDZnaO7U,6262
anyio/abc/_streams.py,sha256=He_JpkAW2g5veOzcUq0XsRC2nId_i35L-d8cs7Uj1ZQ,6598
anyio/abc/_subprocesses.py,sha256=cumAPJTktOQtw63IqG0lDpyZqu_l1EElvQHMiwJgL08,2067
anyio/abc/_tasks.py,sha256=yJWbMwowvqjlAX4oJ3l9Is1w-zwynr2lX1Z02AWJqsY,3080
anyio/abc/_testing.py,sha256=tBJUzkSfOXJw23fe8qSJ03kJlShOYjjaEyFB6k6MYT8,1821
anyio/from_thread.py,sha256=MbXHZpgM9wgsRkbGhMNMomEGYj7Y_QYq6a5BZ3c5Ev8,17478
anyio/lowlevel.py,sha256=nkgmW--SdxGVp0cmLUYazjkigveRm5HY7-gW8Bpp9oY,4169
anyio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
anyio/pytest_plugin.py,sha256=qXNwk9Pa7hPQKWocgLl9qijqKGMkGzdH2wJa-jPkGUM,9375
anyio/streams/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
anyio/streams/__pycache__/__init__.cpython-312.pyc,,
anyio/streams/__pycache__/buffered.cpython-312.pyc,,
anyio/streams/__pycache__/file.cpython-312.pyc,,
anyio/streams/__pycache__/memory.cpython-312.pyc,,
anyio/streams/__pycache__/stapled.cpython-312.pyc,,
anyio/streams/__pycache__/text.cpython-312.pyc,,
anyio/streams/__pycache__/tls.cpython-312.pyc,,
anyio/streams/buffered.py,sha256=UCldKC168YuLvT7n3HtNPnQ2iWAMSTYQWbZvzLwMwkM,4500
anyio/streams/file.py,sha256=6uoTNb5KbMoj-6gS3_xrrL8uZN8Q4iIvOS1WtGyFfKw,4383
anyio/streams/memory.py,sha256=o1OVVx0OooteTTe2GytJreum93Ucuw5s4cAsr3X0-Ag,10560
anyio/streams/stapled.py,sha256=U09pCrmOw9kkNhe6tKopsm1QIMT1lFTFvtb-A7SIe4k,4302
anyio/streams/text.py,sha256=6x8w8xlfCZKTUWQoJiMPoMhSSJFUBRKgoBNSBtbd9yg,5094
anyio/streams/tls.py,sha256=HxzpVmUgo8SUSIBass_lvef1pAI1uRSrnysM3iEGzl4,13199
anyio/to_interpreter.py,sha256=UhuNCIucCRN7ZtyJg35Mlamzs1JpgDvK4xnL4TDWrAo,6527
anyio/to_process.py,sha256=ZvruelRM-HNmqDaql4sdNODg2QD_uSlwSCxnV4OhsfQ,9595
anyio/to_thread.py,sha256=WM2JQ2MbVsd5D5CM08bQiTwzZIvpsGjfH1Fy247KoDQ,239612345Wheel-Version: 1.0Generator: setuptools (76.0.0)Root-Is-Purelib: trueTag: py3-none-any
1anyio1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192# SPDX-License-Identifier: MIT
"""Argon2 for Python"""
from . import exceptions, low_level, profilesfrom ._legacy import hash_password, hash_password_raw, verify_passwordfrom ._password_hasher import ( DEFAULT_HASH_LENGTH, DEFAULT_MEMORY_COST, DEFAULT_PARALLELISM, DEFAULT_RANDOM_SALT_LENGTH, DEFAULT_TIME_COST, PasswordHasher,)from ._utils import Parameters, extract_parametersfrom .low_level import Type
__title__ = "argon2-cffi"
__author__ = "Hynek Schlawack"__copyright__ = "Copyright (c) 2015 " + __author____license__ = "MIT"
__all__ = [ "DEFAULT_HASH_LENGTH", "DEFAULT_MEMORY_COST", "DEFAULT_PARALLELISM", "DEFAULT_RANDOM_SALT_LENGTH", "DEFAULT_TIME_COST", "Parameters", "PasswordHasher", "Type", "exceptions", "extract_parameters", "hash_password", "hash_password_raw", "low_level", "profiles", "verify_password",]
def __getattr__(name: str) -> str: dunder_to_metadata = { "__version__": "version", "__description__": "summary", "__uri__": "", "__url__": "", "__email__": "", } if name not in dunder_to_metadata: msg = f"module {__name__} has no attribute {name}" raise AttributeError(msg)
import sys import warnings
if sys.version_info < (3, 8): from importlib_metadata import metadata else: from importlib.metadata import metadata
warnings.warn( f"Accessing argon2.{name} is deprecated and will be " "removed in a future release. Use importlib.metadata directly " "to query for structlog's packaging metadata.", DeprecationWarning, stacklevel=2, )
meta = metadata("argon2-cffi")
if name in ("__uri__", "__url__"): return meta["Project-URL"].split(" ", 1)[-1]
if name == "__email__": return meta["Author-email"].split("<", 1)[1].rstrip(">")
return meta[dunder_to_metadata[name]]
# Make nicer public names.__locals = locals()for __name in __all__: if not __name.startswith(("__", "DEFAULT_")) and not __name.islower(): __locals[__name].__module__ = "argon2"del __localsdel __name # pyright: ignore[reportUnboundVariable]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990# SPDX-License-Identifier: MIT
from __future__ import annotations
import argparseimport sysimport timeit
from . import ( DEFAULT_HASH_LENGTH, DEFAULT_MEMORY_COST, DEFAULT_PARALLELISM, DEFAULT_TIME_COST, PasswordHasher, profiles,)
def main(argv: list[str]) -> None: parser = argparse.ArgumentParser(description="Benchmark Argon2.") parser.add_argument( "-n", type=int, default=100, help="Number of iterations to measure." ) parser.add_argument( "-t", type=int, help="`time_cost`", default=DEFAULT_TIME_COST ) parser.add_argument( "-m", type=int, help="`memory_cost`", default=DEFAULT_MEMORY_COST ) parser.add_argument( "-p", type=int, help="`parallelism`", default=DEFAULT_PARALLELISM ) parser.add_argument( "-l", type=int, help="`hash_length`", default=DEFAULT_HASH_LENGTH ) parser.add_argument( "--profile", type=str, help="A profile from `argon2.profiles. Takes precedence.", default=None, )
args = parser.parse_args(argv[1:])
password = b"secret" if args.profile: ph = PasswordHasher.from_parameters( getattr(profiles, args.profile.upper()) ) else: ph = PasswordHasher( time_cost=args.t, memory_cost=args.m, parallelism=args.p, hash_len=args.l, ) hash = ph.hash(password)
params = { "time_cost": (ph.time_cost, "iterations"), "memory_cost": (ph.memory_cost, "KiB"), "parallelism": (ph.parallelism, "threads"), "hash_len": (ph.hash_len, "bytes"), }
print("Running Argon2id %d times with:" % (args.n,))
for k, v in sorted(params.items()): print("%s: %d %s" % (k, v[0], v[1]))
print("\nMeasuring...") duration = timeit.timeit( f"ph.verify({hash!r}, {password!r})", setup=f"""\from argon2 import PasswordHasher, Type
ph = PasswordHasher( time_cost={args.t!r}, memory_cost={args.m!r}, parallelism={args.p!r}, hash_len={args.l!r},)gc.enable()""", number=args.n, ) print(f"\n{duration / args.n * 1000:.1f}ms per password verification")
if __name__ == "__main__": # pragma: no cover main(sys.argv)12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091# SPDX-License-Identifier: MIT
"""Legacy mid-level functions."""
from __future__ import annotations
import osimport warnings
from ._password_hasher import ( DEFAULT_HASH_LENGTH, DEFAULT_MEMORY_COST, DEFAULT_PARALLELISM, DEFAULT_RANDOM_SALT_LENGTH, DEFAULT_TIME_COST,)from ._typing import Literalfrom .low_level import Type, hash_secret, hash_secret_raw, verify_secret
_INSTEAD = " is deprecated, use argon2.PasswordHasher instead"
def hash_password( password: bytes, salt: bytes | None = None, time_cost: int = DEFAULT_TIME_COST, memory_cost: int = DEFAULT_MEMORY_COST, parallelism: int = DEFAULT_PARALLELISM, hash_len: int = DEFAULT_HASH_LENGTH, type: Type = Type.I,) -> bytes: """ Legacy alias for :func:`argon2.low_level.hash_secret` with default parameters.
.. deprecated:: 16.0.0 Use :class:`argon2.PasswordHasher` for passwords. """ warnings.warn( "argon2.hash_password" + _INSTEAD, DeprecationWarning, stacklevel=2 ) if salt is None: salt = os.urandom(DEFAULT_RANDOM_SALT_LENGTH) return hash_secret( password, salt, time_cost, memory_cost, parallelism, hash_len, type )
def hash_password_raw( password: bytes, salt: bytes | None = None, time_cost: int = DEFAULT_TIME_COST, memory_cost: int = DEFAULT_MEMORY_COST, parallelism: int = DEFAULT_PARALLELISM, hash_len: int = DEFAULT_HASH_LENGTH, type: Type = Type.I,) -> bytes: """ Legacy alias for :func:`argon2.low_level.hash_secret_raw` with default parameters.
.. deprecated:: 16.0.0 Use :class:`argon2.PasswordHasher` for passwords. """ warnings.warn( "argon2.hash_password_raw" + _INSTEAD, DeprecationWarning, stacklevel=2 ) if salt is None: salt = os.urandom(DEFAULT_RANDOM_SALT_LENGTH) return hash_secret_raw( password, salt, time_cost, memory_cost, parallelism, hash_len, type )
def verify_password( hash: bytes, password: bytes, type: Type = Type.I) -> Literal[True]: """ Legacy alias for :func:`argon2.low_level.verify_secret` with default parameters.
.. deprecated:: 16.0.0 Use :class:`argon2.PasswordHasher` for passwords. """ warnings.warn( "argon2.verify_password" + _INSTEAD, DeprecationWarning, stacklevel=2 ) return verify_secret(hash, password, type)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251# SPDX-License-Identifier: MIT
from __future__ import annotations
import os
from typing import ClassVar
from ._typing import Literalfrom ._utils import Parameters, _check_types, extract_parametersfrom .exceptions import InvalidHashErrorfrom .low_level import Type, hash_secret, verify_secretfrom .profiles import RFC_9106_LOW_MEMORY
DEFAULT_RANDOM_SALT_LENGTH = RFC_9106_LOW_MEMORY.salt_lenDEFAULT_HASH_LENGTH = RFC_9106_LOW_MEMORY.hash_lenDEFAULT_TIME_COST = RFC_9106_LOW_MEMORY.time_costDEFAULT_MEMORY_COST = RFC_9106_LOW_MEMORY.memory_costDEFAULT_PARALLELISM = RFC_9106_LOW_MEMORY.parallelism
def _ensure_bytes(s: bytes | str, encoding: str) -> bytes: """ Ensure *s* is a bytes string. Encode using *encoding* if it isn't. """ if isinstance(s, bytes): return s return s.encode(encoding)
class PasswordHasher: r""" High level class to hash passwords with sensible defaults.
Uses Argon2\ **id** by default and always uses a random salt_ for hashing. But it can verify any type of Argon2 as long as the hash is correctly encoded.
The reason for this being a class is both for convenience to carry parameters and to verify the parameters only *once*. Any unnecessary slowdown when hashing is a tangible advantage for a brute force attacker.
:param int time_cost: Defines the amount of computation realized and therefore the execution time, given in number of iterations. :param int memory_cost: Defines the memory usage, given in kibibytes_. :param int parallelism: Defines the number of parallel threads (*changes* the resulting hash value). :param int hash_len: Length of the hash in bytes. :param int salt_len: Length of random salt to be generated for each password. :param str encoding: The Argon2 C library expects bytes. So if :meth:`hash` or :meth:`verify` are passed a ``str``, it will be encoded using this encoding. :param Type type: Argon2 type to use. Only change for interoperability with legacy systems.
.. versionadded:: 16.0.0 .. versionchanged:: 18.2.0 Switch from Argon2i to Argon2id based on the recommendation by the current RFC draft. See also :doc:`parameters`. .. versionchanged:: 18.2.0 Changed default *memory_cost* to 100 MiB and default *parallelism* to 8. .. versionchanged:: 18.2.0 ``verify`` now will determine the type of hash. .. versionchanged:: 18.3.0 The Argon2 type is configurable now. .. versionadded:: 21.2.0 :meth:`from_parameters` .. versionchanged:: 21.2.0 Changed defaults to :data:`argon2.profiles.RFC_9106_LOW_MEMORY`.
.. _salt: https://en.wikipedia.org/wiki/Salt_(cryptography) .. _kibibytes: https://en.wikipedia.org/wiki/Binary_prefix#kibi """ __slots__ = ["_parameters", "encoding"]
_parameters: Parameters encoding: str
def __init__( self, time_cost: int = DEFAULT_TIME_COST, memory_cost: int = DEFAULT_MEMORY_COST, parallelism: int = DEFAULT_PARALLELISM, hash_len: int = DEFAULT_HASH_LENGTH, salt_len: int = DEFAULT_RANDOM_SALT_LENGTH, encoding: str = "utf-8", type: Type = Type.ID, ): e = _check_types( time_cost=(time_cost, int), memory_cost=(memory_cost, int), parallelism=(parallelism, int), hash_len=(hash_len, int), salt_len=(salt_len, int), encoding=(encoding, str), type=(type, Type), ) if e: raise TypeError(e)
# Cache a Parameters object for check_needs_rehash. self._parameters = Parameters( type=type, version=19, salt_len=salt_len, hash_len=hash_len, time_cost=time_cost, memory_cost=memory_cost, parallelism=parallelism, ) self.encoding = encoding
@classmethod def from_parameters(cls, params: Parameters) -> PasswordHasher: """ Construct a `PasswordHasher` from *params*.
.. versionadded:: 21.2.0 """ ph = cls() ph._parameters = params
return ph
@property def time_cost(self) -> int: return self._parameters.time_cost
@property def memory_cost(self) -> int: return self._parameters.memory_cost
@property def parallelism(self) -> int: return self._parameters.parallelism
@property def hash_len(self) -> int: return self._parameters.hash_len
@property def salt_len(self) -> int: return self._parameters.salt_len
@property def type(self) -> Type: return self._parameters.type
def hash(self, password: str | bytes, *, salt: bytes | None = None) -> str: """ Hash *password* and return an encoded hash.
Parameters:
password: Password to hash.
salt: If None, a random salt is securely created.
.. danger::
You should **not** pass a salt unless you really know what you are doing.
Raises:
argon2.exceptions.HashingError: If hashing fails.
Returns:
Hashed *password*.
.. versionadded:: 23.1.0 *salt* parameter """ return hash_secret( secret=_ensure_bytes(password, self.encoding), salt=salt or os.urandom(self.salt_len), time_cost=self.time_cost, memory_cost=self.memory_cost, parallelism=self.parallelism, hash_len=self.hash_len, type=self.type, ).decode("ascii")
_header_to_type: ClassVar[dict[bytes, Type]] = { b"$argon2i$": Type.I, b"$argon2d$": Type.D, b"$argon2id": Type.ID, }
def verify( self, hash: str | bytes, password: str | bytes ) -> Literal[True]: """ Verify that *password* matches *hash*.
.. warning::
It is assumed that the caller is in full control of the hash. No other parsing than the determination of the hash type is done by *argon2-cffi*.
:param hash: An encoded hash as returned from :meth:`PasswordHasher.hash`. :type hash: ``bytes`` or ``str``
:param password: The password to verify. :type password: ``bytes`` or ``str``
:raises argon2.exceptions.VerifyMismatchError: If verification fails because *hash* is not valid for *password*. :raises argon2.exceptions.VerificationError: If verification fails for other reasons. :raises argon2.exceptions.InvalidHashError: If *hash* is so clearly invalid, that it couldn't be passed to Argon2.
:return: ``True`` on success, raise :exc:`~argon2.exceptions.VerificationError` otherwise. :rtype: bool
.. versionchanged:: 16.1.0 Raise :exc:`~argon2.exceptions.VerifyMismatchError` on mismatches instead of its more generic superclass. .. versionadded:: 18.2.0 Hash type agility. """ hash = _ensure_bytes(hash, "ascii") try: hash_type = self._header_to_type[hash[:9]] except LookupError: raise InvalidHashError from None
return verify_secret( hash, _ensure_bytes(password, self.encoding), hash_type )
def check_needs_rehash(self, hash: str) -> bool: """ Check whether *hash* was created using the instance's parameters.
Whenever your Argon2 parameters -- or *argon2-cffi*'s defaults! -- change, you should rehash your passwords at the next opportunity. The common approach is to do that whenever a user logs in, since that should be the only time when you have access to the cleartext password.
Therefore it's best practice to check -- and if necessary rehash -- passwords after each successful authentication.
:rtype: bool
.. versionadded:: 18.2.0 """ return self._parameters != extract_parameters(hash)123456789101112131415# SPDX-License-Identifier: MIT
from __future__ import annotations
import sys
# try/except ImportError does NOT work.# c.f. https://github.com/python/mypy/issues/8520if sys.version_info >= (3, 8): from typing import Literalelse: from typing_extensions import Literal
__all__ = ["Literal"]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140# SPDX-License-Identifier: MIT
from __future__ import annotations
from dataclasses import dataclassfrom typing import Any
from .exceptions import InvalidHashErrorfrom .low_level import Type
NoneType = type(None)
def _check_types(**kw: Any) -> str | None: """ Check each ``name: (value, types)`` in *kw*.
Returns a human-readable string of all violations or `None``. """ errors = [] for name, (value, types) in kw.items(): if not isinstance(value, types): if isinstance(types, tuple): types = ", or ".join(t.__name__ for t in types) else: types = types.__name__ errors.append( f"'{name}' must be a {types} (got {type(value).__name__})" )
if errors != []: return ", ".join(errors) + "."
return None
def _decoded_str_len(length: int) -> int: """ Compute how long an encoded string of length *l* becomes. """ rem = length % 4
if rem == 3: last_group_len = 2 elif rem == 2: last_group_len = 1 else: last_group_len = 0
return length // 4 * 3 + last_group_len
@dataclassclass Parameters: """ Argon2 hash parameters.
See :doc:`parameters` on how to pick them.
:ivar Type type: Hash type. :ivar int version: Argon2 version. :ivar int salt_len: Length of the salt in bytes. :ivar int hash_len: Length of the hash in bytes. :ivar int time_cost: Time cost in iterations. :ivar int memory_cost: Memory cost in kibibytes. :ivar int parallelism: Number of parallel threads.
.. versionadded:: 18.2.0 """
type: Type version: int salt_len: int hash_len: int time_cost: int memory_cost: int parallelism: int
__slots__ = ( "type", "version", "salt_len", "hash_len", "time_cost", "memory_cost", "parallelism", )
_NAME_TO_TYPE = {"argon2id": Type.ID, "argon2i": Type.I, "argon2d": Type.D}_REQUIRED_KEYS = sorted(("v", "m", "t", "p"))
def extract_parameters(hash: str) -> Parameters: """ Extract parameters from an encoded *hash*.
:param str params: An encoded Argon2 hash string.
:rtype: Parameters
.. versionadded:: 18.2.0 """ parts = hash.split("$")
# Backwards compatibility for Argon v1.2 hashes if len(parts) == 5: parts.insert(2, "v=18")
if len(parts) != 6: raise InvalidHashError
if parts[0]: raise InvalidHashError
try: type = _NAME_TO_TYPE[parts[1]]
kvs = { k: int(v) for k, v in ( s.split("=") for s in [parts[2], *parts[3].split(",")] ) } except Exception: # noqa: BLE001 raise InvalidHashError from None
if sorted(kvs.keys()) != _REQUIRED_KEYS: raise InvalidHashError
return Parameters( type=type, salt_len=_decoded_str_len(len(parts[4])), hash_len=_decoded_str_len(len(parts[5])), version=kvs["v"], time_cost=kvs["t"], memory_cost=kvs["m"], parallelism=kvs["p"], )1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556# SPDX-License-Identifier: MIT
from __future__ import annotations
class Argon2Error(Exception): """ Superclass of all argon2 exceptions.
Never thrown directly. """
class VerificationError(Argon2Error): """ Verification failed.
You can find the original error message from Argon2 in ``args[0]``. """
class VerifyMismatchError(VerificationError): """ The secret does not match the hash.
Subclass of :exc:`argon2.exceptions.VerificationError`.
.. versionadded:: 16.1.0 """
class HashingError(Argon2Error): """ Raised if hashing failed.
You can find the original error message from Argon2 in ``args[0]``. """
class InvalidHashError(ValueError): """ Raised if the hash is invalid before passing it to Argon2.
.. versionadded:: 23.1.0 As a replacement for :exc:`argon2.exceptions.InvalidHash`. """
InvalidHash = InvalidHashError"""Deprecated alias for :class:`InvalidHashError`.
.. versionadded:: 18.2.0.. deprecated:: 23.1.0 Use :exc:`argon2.exceptions.InvalidHashError` instead."""123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238# SPDX-License-Identifier: MIT
"""Low-level functions if you want to build your own higher level abstractions.
.. warning:: This is a "Hazardous Materials" module. You should **ONLY** use it if you're 100% absolutely sure that you know what you're doing because this module is full of land mines, dragons, and dinosaurs with laser guns."""
from __future__ import annotations
from enum import Enumfrom typing import Any
from _argon2_cffi_bindings import ffi, lib
from ._typing import Literalfrom .exceptions import HashingError, VerificationError, VerifyMismatchError
__all__ = [ "ARGON2_VERSION", "Type", "ffi", "hash_secret", "hash_secret_raw", "verify_secret",]
ARGON2_VERSION = lib.ARGON2_VERSION_NUMBER"""The latest version of the Argon2 algorithm that is supported (and used bydefault).
.. versionadded:: 16.1.0"""
class Type(Enum): """ Enum of Argon2 variants.
Please see :doc:`parameters` on how to pick one. """
D = lib.Argon2_d I = lib.Argon2_i # noqa: E741 ID = lib.Argon2_id
def hash_secret( secret: bytes, salt: bytes, time_cost: int, memory_cost: int, parallelism: int, hash_len: int, type: Type, version: int = ARGON2_VERSION,) -> bytes: """ Hash *secret* and return an **encoded** hash.
An encoded hash can be directly passed into :func:`verify_secret` as it contains all parameters and the salt.
:param bytes secret: Secret to hash. :param bytes salt: A salt_. Should be random and different for each secret. :param Type type: Which Argon2 variant to use. :param int version: Which Argon2 version to use.
For an explanation of the Argon2 parameters see :class:`argon2.PasswordHasher`.
:rtype: bytes
:raises argon2.exceptions.HashingError: If hashing fails.
.. versionadded:: 16.0.0
.. _salt: https://en.wikipedia.org/wiki/Salt_(cryptography) .. _kibibytes: https://en.wikipedia.org/wiki/Binary_prefix#kibi """ size = ( lib.argon2_encodedlen( time_cost, memory_cost, parallelism, len(salt), hash_len, type.value, ) + 1 ) buf = ffi.new("char[]", size) rv = lib.argon2_hash( time_cost, memory_cost, parallelism, ffi.new("uint8_t[]", secret), len(secret), ffi.new("uint8_t[]", salt), len(salt), ffi.NULL, hash_len, buf, size, type.value, version, ) if rv != lib.ARGON2_OK: raise HashingError(error_to_str(rv))
return ffi.string(buf) # type: ignore[no-any-return]
def hash_secret_raw( secret: bytes, salt: bytes, time_cost: int, memory_cost: int, parallelism: int, hash_len: int, type: Type, version: int = ARGON2_VERSION,) -> bytes: """ Hash *password* and return a **raw** hash.
This function takes the same parameters as :func:`hash_secret`.
.. versionadded:: 16.0.0 """ buf = ffi.new("uint8_t[]", hash_len)
rv = lib.argon2_hash( time_cost, memory_cost, parallelism, ffi.new("uint8_t[]", secret), len(secret), ffi.new("uint8_t[]", salt), len(salt), buf, hash_len, ffi.NULL, 0, type.value, version, ) if rv != lib.ARGON2_OK: raise HashingError(error_to_str(rv))
return bytes(ffi.buffer(buf, hash_len))
def verify_secret(hash: bytes, secret: bytes, type: Type) -> Literal[True]: """ Verify whether *secret* is correct for *hash* of *type*.
:param bytes hash: An encoded Argon2 hash as returned by :func:`hash_secret`. :param bytes secret: The secret to verify whether it matches the one in *hash*. :param Type type: Type for *hash*.
:raises argon2.exceptions.VerifyMismatchError: If verification fails because *hash* is not valid for *secret* of *type*. :raises argon2.exceptions.VerificationError: If verification fails for other reasons.
:return: ``True`` on success, raise :exc:`~argon2.exceptions.VerificationError` otherwise. :rtype: bool
.. versionadded:: 16.0.0 .. versionchanged:: 16.1.0 Raise :exc:`~argon2.exceptions.VerifyMismatchError` on mismatches instead of its more generic superclass. """ rv = lib.argon2_verify( ffi.new("char[]", hash), ffi.new("uint8_t[]", secret), len(secret), type.value, )
if rv == lib.ARGON2_OK: return True
if rv == lib.ARGON2_VERIFY_MISMATCH: raise VerifyMismatchError(error_to_str(rv))
raise VerificationError(error_to_str(rv))
def core(context: Any, type: int) -> int: """ Direct binding to the ``argon2_ctx`` function.
.. warning:: This is a strictly advanced function working on raw C data structures. Both Argon2's and *argon2-cffi*'s higher-level bindings do a lot of sanity checks and housekeeping work that *you* are now responsible for (e.g. clearing buffers). The structure of the *context* object can, has, and will change with *any* release!
Use at your own peril; *argon2-cffi* does *not* use this binding itself.
:param context: A CFFI Argon2 context object (i.e. an ``struct Argon2_Context`` / ``argon2_context``). :param int type: Which Argon2 variant to use. You can use the ``value`` field of :class:`Type`'s fields.
:rtype: int :return: An Argon2 error code. Can be transformed into a string using :func:`error_to_str`.
.. versionadded:: 16.0.0 """ return lib.argon2_ctx(context, type) # type: ignore[no-any-return]
def error_to_str(error: int) -> str: """ Convert an Argon2 error code into a native string.
:param int error: An Argon2 error code as returned by :func:`core`.
:rtype: str
.. versionadded:: 16.0.0 """ return ffi.string(lib.argon2_error_message(error)).decode("ascii") # type: ignore[no-any-return]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960# SPDX-License-Identifier: MIT
"""This module offers access to standardized parameters that you can load using:meth:`argon2.PasswordHasher.from_parameters()`. See the `source code<https://github.com/hynek/argon2-cffi/blob/main/src/argon2/profiles.py>`_ forconcrete values and :doc:`parameters` for more information.
.. versionadded:: 21.2.0"""
from __future__ import annotations
from ._utils import Parametersfrom .low_level import Type
# FIRST RECOMMENDED option per RFC 9106.RFC_9106_HIGH_MEMORY = Parameters( type=Type.ID, version=19, salt_len=16, hash_len=32, time_cost=1, memory_cost=2097152, # 2 GiB parallelism=4,)
# SECOND RECOMMENDED option per RFC 9106.RFC_9106_LOW_MEMORY = Parameters( type=Type.ID, version=19, salt_len=16, hash_len=32, time_cost=3, memory_cost=65536, # 64 MiB parallelism=4,)
# The pre-RFC defaults in argon2-cffi 18.2.0 - 21.1.0.PRE_21_2 = Parameters( type=Type.ID, version=19, salt_len=16, hash_len=16, time_cost=2, memory_cost=102400, # 100 MiB parallelism=8,)
# Only for testing!CHEAPEST = Parameters( type=Type.ID, version=19, salt_len=8, hash_len=4, time_cost=1, memory_cost=8, parallelism=1,)1pip123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128Metadata-Version: 2.1Name: argon2-cffiVersion: 23.1.0Summary: Argon2 for PythonProject-URL: Documentation, https://argon2-cffi.readthedocs.io/Project-URL: Changelog, https://github.com/hynek/argon2-cffi/blob/main/CHANGELOG.mdProject-URL: GitHub, https://github.com/hynek/argon2-cffiProject-URL: Funding, https://github.com/sponsors/hynekProject-URL: Tidelift, https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynekAuthor-email: Hynek Schlawack <hs@ox.cx>License-Expression: MITLicense-File: LICENSEKeywords: hash,hashing,password,securityClassifier: Development Status :: 5 - Production/StableClassifier: Intended Audience :: DevelopersClassifier: License :: OSI Approved :: MIT LicenseClassifier: Operating System :: MacOS :: MacOS XClassifier: Operating System :: Microsoft :: WindowsClassifier: Operating System :: POSIXClassifier: Operating System :: UnixClassifier: Programming Language :: Python :: 3.7Classifier: Programming Language :: Python :: 3.8Classifier: Programming Language :: Python :: 3.9Classifier: Programming Language :: Python :: 3.10Classifier: Programming Language :: Python :: 3.11Classifier: Programming Language :: Python :: 3.12Classifier: Programming Language :: Python :: Implementation :: CPythonClassifier: Programming Language :: Python :: Implementation :: PyPyClassifier: Topic :: Security :: CryptographyClassifier: Topic :: Software Development :: Libraries :: Python ModulesRequires-Python: >=3.7Requires-Dist: argon2-cffi-bindingsRequires-Dist: typing-extensions; python_version < '3.8'Provides-Extra: devRequires-Dist: argon2-cffi[tests,typing]; extra == 'dev'Requires-Dist: tox>4; extra == 'dev'Provides-Extra: docsRequires-Dist: furo; extra == 'docs'Requires-Dist: myst-parser; extra == 'docs'Requires-Dist: sphinx; extra == 'docs'Requires-Dist: sphinx-copybutton; extra == 'docs'Requires-Dist: sphinx-notfound-page; extra == 'docs'Provides-Extra: testsRequires-Dist: hypothesis; extra == 'tests'Requires-Dist: pytest; extra == 'tests'Provides-Extra: typingRequires-Dist: mypy; extra == 'typing'Description-Content-Type: text/markdown
# *argon2-cffi*: Argon2 for Python
[Argon2](https://github.com/p-h-c/phc-winner-argon2) won the [Password Hashing Competition](https://www.password-hashing.net/) and *argon2-cffi* is the simplest way to use it in Python:
```pycon>>> from argon2 import PasswordHasher>>> ph = PasswordHasher()>>> hash = ph.hash("correct horse battery staple")>>> hash # doctest: +SKIP'$argon2id$v=19$m=65536,t=3,p=4$MIIRqgvgQbgj220jfp0MPA$YfwJSVjtjSU0zzV/P3S9nnQ/USre2wvJMjfCIjrTQbg'>>> ph.verify(hash, "correct horse battery staple")True>>> ph.check_needs_rehash(hash)False>>> ph.verify(hash, "Tr0ub4dor&3")Traceback (most recent call last): ...argon2.exceptions.VerifyMismatchError: The password does not match the supplied hash
```<!-- end short -->
## Project Links
- [**PyPI**](https://pypi.org/project/argon2-cffi/)- [**GitHub**](https://github.com/hynek/argon2-cffi)- [**Documentation**](https://argon2-cffi.readthedocs.io/)- [**Changelog**](https://github.com/hynek/argon2-cffi/blob/main/CHANGELOG.md)- [**Funding**](https://hynek.me/say-thanks/)- The low-level Argon2 CFFI bindings are maintained in the separate [*argon2-cffi-bindings*](https://github.com/hynek/argon2-cffi-bindings) project.
## Release Information
### Removed
- Python 3.6 is not supported anymore.
### Deprecated
- The `InvalidHash` exception is deprecated in favor of `InvalidHashError`. No plans for removal currently exist and the names can (but shouldn't) be used interchangeably.
- `argon2.hash_password()`, `argon2.hash_password_raw()`, and `argon2.verify_password()` that have been soft-deprecated since 2016 are now hard-deprecated. They now raise `DeprecationWarning`s and will be removed in 2024.
### Added
- Official support for Python 3.11 and 3.12. No code changes were necessary.
- `argon2.exceptions.InvalidHashError` as a replacement for `InvalidHash`.
- *salt* parameter to `argon2.PasswordHasher.hash()` to allow for custom salts. This is only useful for specialized use-cases -- leave it on None unless you know exactly what you are doing. [#153](https://github.com/hynek/argon2-cffi/pull/153)
---
[→ Full Changelog](https://github.com/hynek/argon2-cffi/blob/main/CHANGELOG.md)
## Credits
*argon2-cffi* is maintained by [Hynek Schlawack](https://hynek.me/).
The development is kindly supported by my employer [Variomedia AG](https://www.variomedia.de/), *argon2-cffi* [Tidelift subscribers](https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynek), and my amazing [GitHub Sponsors](https://github.com/sponsors/hynek).
## *argon2-cffi* for Enterprise
Available as part of the Tidelift Subscription.
The maintainers of *argon2-cffi* and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open-source packages you use to build your applications.Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.[Learn more.](https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynek)123456789101112131415161718192021222324argon2/__init__.py,sha256=jDpUpW9taHKrUcS245AffLDv_-NktN-6gpStEqkm4Cg,2238
argon2/__main__.py,sha256=3Oo7cJhgwjQRWXgMMDp7GiGom4oyT6Tdrrlf8dx4yXs,2290
argon2/__pycache__/__init__.cpython-312.pyc,,
argon2/__pycache__/__main__.cpython-312.pyc,,
argon2/__pycache__/_legacy.cpython-312.pyc,,
argon2/__pycache__/_password_hasher.cpython-312.pyc,,
argon2/__pycache__/_typing.cpython-312.pyc,,
argon2/__pycache__/_utils.cpython-312.pyc,,
argon2/__pycache__/exceptions.cpython-312.pyc,,
argon2/__pycache__/low_level.cpython-312.pyc,,
argon2/__pycache__/profiles.cpython-312.pyc,,
argon2/_legacy.py,sha256=Wumpg1-oG6coGlhcw2nE1CGFDnf_808E4b_lPbABJ4s,2417
argon2/_password_hasher.py,sha256=06Ie5-f4u6Jsjafhb_AgVuMdslTjDGG2V09AuD-aUJI,8213
argon2/_typing.py,sha256=JYHDd_ZM9pCmVM1d0lKruTu3Fk6zW63tt_wtRDz279M,304
argon2/_utils.py,sha256=aBCZPr8lwl9wetNsbBOyw0dLHSNjoDY4fLS6MkxuLbs,3172
argon2/exceptions.py,sha256=0CBxmt5BquHsDjNKRUiSoS9o-w8n0eSFK9txzPJhj48,1097
argon2/low_level.py,sha256=v1red7BdmVRGozlhYiFNSt8d4JbshD8jua-6F6VGdfc,6165
argon2/profiles.py,sha256=gGXlTTdatbLq6wPSD4OCRqqX0tRm_WfQpYLG9Sxv4G0,1268
argon2/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
argon2_cffi-23.1.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
argon2_cffi-23.1.0.dist-info/METADATA,sha256=G5tmqJUpogTUcFYf-k9DWw9pMbP1n2hVi6vi0ZtAuKw,5217
argon2_cffi-23.1.0.dist-info/RECORD,,
argon2_cffi-23.1.0.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
argon2_cffi-23.1.0.dist-info/licenses/LICENSE,sha256=tpRNOG6HzPSdljLaCDaFpLdiRzPmhqf-KD3S1Cg0HXc,11151234Wheel-Version: 1.0Generator: hatchling 1.18.0Root-Is-Purelib: trueTag: py3-none-any1pip123456789101112131415161718192021The MIT License (MIT)
Copyright (c) 2021 Hynek Schlawack
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152Metadata-Version: 2.1Name: argon2-cffi-bindingsVersion: 21.2.0Summary: Low-level CFFI bindings for Argon2Home-page: https://github.com/hynek/argon2-cffi-bindingsAuthor: Hynek SchlawackAuthor-email: hs@ox.cxMaintainer: Hynek SchlawackMaintainer-email: hs@ox.cxLicense: MITProject-URL: Source Code, https://github.com/hynek/argon2-cffi-bindingsProject-URL: Funding, https://github.com/sponsors/hynekProject-URL: Tidelift, https://tidelift.com/subscription/pkg/pypi-argon2-cffi?utm_source=pypi-argon2-cffi&utm_medium=pypiProject-URL: Ko-fi, https://ko-fi.com/the_hynekKeywords: password,hash,hashing,security,bindings,cffiPlatform: UNKNOWNClassifier: Development Status :: 5 - Production/StableClassifier: Intended Audience :: DevelopersClassifier: License :: OSI Approved :: MIT LicenseClassifier: Natural Language :: EnglishClassifier: Operating System :: MacOS :: MacOS XClassifier: Operating System :: Microsoft :: WindowsClassifier: Operating System :: POSIXClassifier: Operating System :: UnixClassifier: Programming Language :: Python :: 3Classifier: Programming Language :: Python :: 3.6Classifier: Programming Language :: Python :: 3.7Classifier: Programming Language :: Python :: 3.8Classifier: Programming Language :: Python :: 3.9Classifier: Programming Language :: Python :: 3.10Classifier: Programming Language :: Python :: Implementation :: CPythonClassifier: Programming Language :: Python :: Implementation :: PyPyClassifier: Programming Language :: PythonClassifier: Topic :: Security :: CryptographyClassifier: Topic :: SecurityClassifier: Topic :: Software Development :: Libraries :: Python ModulesRequires-Python: >=3.6Description-Content-Type: text/markdownLicense-File: LICENSERequires-Dist: cffi (>=1.0.1)Provides-Extra: devRequires-Dist: pytest ; extra == 'dev'Requires-Dist: cogapp ; extra == 'dev'Requires-Dist: pre-commit ; extra == 'dev'Requires-Dist: wheel ; extra == 'dev'Provides-Extra: testsRequires-Dist: pytest ; extra == 'tests'
# Low-level Python CFFI Bindings for Argon2
*argon2-cffi-bindings* provides low-level [*CFFI*](https://cffi.readthedocs.io/) bindings to the [*Argon2*] password hashing algorithm including a vendored version of them.
<!-- [[[cog# Extract commit ID; refresh using `tox -e cog`import subprocessout = subprocess.check_output(["git", "submodule"], text=True)id = out.strip().split(" ", 1)[0]link = f'[**`{id[:7]}`**](https://github.com/P-H-C/phc-winner-argon2/commit/{id})'print(f"The currently vendored *Argon2* commit ID is {link}.")]]] -->The currently vendored *Argon2* commit ID is [**`f57e61e`**](https://github.com/P-H-C/phc-winner-argon2/commit/f57e61e19229e23c4445b85494dbf7c07de721cb).<!-- [[[end]]] -->
> If you want to hash passwords in an application, this package is **not** for you.> Have a look at [*argon2-cffi*] with its high-level abstractions!
These bindings have been extracted from [*argon2-cffi*] and it remains its main consumer.However, they may be used by other packages that want to use the *Argon2* library without dealing with C-related complexities.
## Usage
*argon2-cffi-bindings* is available from [PyPI](https://pypi.org/project/argon2-cffi-bindings/).The provided *CFFI* bindings are compiled in API mode.
Best effort is given to provide binary wheels for as many platforms as possible.
### Disabling Vendored Code
A copy of [*Argon2*] is vendored and used by default, but can be disabled if *argon2-cffi-bindings* is installed using:
```console$ env ARGON2_CFFI_USE_SYSTEM=1 \ python -m pip install --no-binary=argon2-cffi-bindings argon2-cffi-bindings```
### Overriding Automatic *SSE2* Detection
Usually the build process tries to guess whether or not it should use [*SSE2*](https://en.wikipedia.org/wiki/SSE2)-optimized code (see [`_ffi_build.py`](https://github.com/hynek/argon2-cffi-bindings/blob/main/src/_argon2_cffi_bindings/_ffi_build.py) for details).This can go wrong and is problematic for cross-compiling.
Therefore you can use the `ARGON2_CFFI_USE_SSE2` environment variable to control the process:
- If you set it to ``1``, *argon2-cffi-bindings* will build **with** SSE2 support.- If you set it to ``0``, *argon2-cffi-bindings* will build **without** SSE2 support.- If you set it to anything else, it will be ignored and *argon2-cffi-bindings* will try to guess.
However, if our heuristics fail you, we would welcome a bug report.
### Python API
Since this package is intended to be an implementation detail, it uses a private module name to prevent your users from using it by accident.
Therefore you have to import the symbols from `_argon2_cffi_bindings`:
```pythonfrom _argon2_cffi_bindings import ffi, lib```
Please refer to [*cffi* documentation](https://cffi.readthedocs.io/en/latest/using.html) on how to use the `ffi` and `lib` objects.
The list of symbols that are provided can be found in the [`_ffi_build.py` file](https://github.com/hynek/argon2-cffi-bindings/blob/main/src/_argon2_cffi_bindings/_ffi_build.py).
[*Argon2*]: https://github.com/p-h-c/phc-winner-argon2[*argon2-cffi*]: https://argon2-cffi.readthedocs.io/
## Project Information
*argon2-cffi-bindings* is available under the MIT license, available from [PyPI](https://pypi.org/project/argon2-cffi-bindings/), the source code and documentation can be found on [GitHub](https://github.com/hynek/argon2-cffi-bindings).
*argon2-cffi-bindings* targets Python 3.6 and later, including PyPy3.
### Credits & License
*argon2-cffi-bindings* is written and maintained by [Hynek Schlawack](https://hynek.me/about/).It is released under the [MIT license](https://github.com/hynek/argon2-cffi/blob/main/LICENSE>).
The development is kindly supported by [Variomedia AG](https://www.variomedia.de/).
The authors of *Argon2* were very helpful to get the library to compile on ancient versions of Visual Studio for ancient versions of Python.
The documentation quotes frequently in verbatim from the *Argon2* [paper](https://www.password-hashing.net/argon2-specs.pdf) to avoid mistakes by rephrasing.
#### Vendored Code
The original *Argon2* repo can be found at <https://github.com/P-H-C/phc-winner-argon2/>.
Except for the components listed below, the *Argon2* code in this repository is copyright (c) 2015 Daniel Dinu, Dmitry Khovratovich (main authors), Jean-Philippe Aumasson and Samuel Neves, and under [CC0] license.
The string encoding routines in src/encoding.c are copyright (c) 2015 Thomas Pornin, and under [CC0] license.
The [*BLAKE2*](https://www.blake2.net) code in ``src/blake2/`` is copyright (c) Samuel Neves, 2013-2015, and under [CC0] license.
[CC0]: https://creativecommons.org/publicdomain/zero/1.0/
1234567891011_argon2_cffi_bindings/__init__.py,sha256=Gm_s_NmP0nyKhjkqPk-5gq6aluEEO6YziCY8cZzs30k,92
_argon2_cffi_bindings/__pycache__/__init__.cpython-312.pyc,,
_argon2_cffi_bindings/__pycache__/_ffi_build.cpython-312.pyc,,
_argon2_cffi_bindings/_ffi.pyd,sha256=LHT5PPJFHMvV7q8LTQd26yhWzVilzHJ5AxvmpiqD568,53248
_argon2_cffi_bindings/_ffi_build.py,sha256=GWyfVuQ-48rPhhdo2rjDc_tr1QYsRo2fPTqYzr_5xSk,6316
argon2_cffi_bindings-21.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
argon2_cffi_bindings-21.2.0.dist-info/LICENSE,sha256=WrxzxDB5_M_mxNxxCvLftKWaZTmxQ0I29u-MdbAVDWE,1103
argon2_cffi_bindings-21.2.0.dist-info/METADATA,sha256=Zoe40TTiS4EwkPh7nbOWc1pHzu6HMeQCGTjsV17A_Mk,6705
argon2_cffi_bindings-21.2.0.dist-info/RECORD,,
argon2_cffi_bindings-21.2.0.dist-info/WHEEL,sha256=g0Gp_9X_YiwOuaF1hZMQNaS1qKUg2WIXRJjlZWggGSw,100
argon2_cffi_bindings-21.2.0.dist-info/top_level.txt,sha256=WyRJzxvIv58cyvTye2AsVz50Lw0hDxUYBuCH1rUb_tg,2712345Wheel-Version: 1.0Generator: bdist_wheel (0.37.0)Root-Is-Purelib: falseTag: cp36-abi3-win_amd64
12_argon2_cffi_bindings_ffi123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126"""Provides the default implementation of :class:`ArrowFactory <arrow.factory.ArrowFactory>`methods for use as a module API.
"""
from datetime import date, datetimefrom datetime import tzinfo as dt_tzinfofrom time import struct_timefrom typing import Any, List, Optional, Tuple, Type, Union, overload
from arrow.arrow import TZ_EXPR, Arrowfrom arrow.constants import DEFAULT_LOCALEfrom arrow.factory import ArrowFactory
# internal default factory._factory = ArrowFactory()
# TODO: Use Positional Only Argument (https://www.python.org/dev/peps/pep-0570/)# after Python 3.7 deprecation
@overloaddef get( *, locale: str = DEFAULT_LOCALE, tzinfo: Optional[TZ_EXPR] = None, normalize_whitespace: bool = False,) -> Arrow: ... # pragma: no cover
@overloaddef get( *args: int, locale: str = DEFAULT_LOCALE, tzinfo: Optional[TZ_EXPR] = None, normalize_whitespace: bool = False,) -> Arrow: ... # pragma: no cover
@overloaddef get( __obj: Union[ Arrow, datetime, date, struct_time, dt_tzinfo, int, float, str, Tuple[int, int, int], ], *, locale: str = DEFAULT_LOCALE, tzinfo: Optional[TZ_EXPR] = None, normalize_whitespace: bool = False,) -> Arrow: ... # pragma: no cover
@overloaddef get( __arg1: Union[datetime, date], __arg2: TZ_EXPR, *, locale: str = DEFAULT_LOCALE, tzinfo: Optional[TZ_EXPR] = None, normalize_whitespace: bool = False,) -> Arrow: ... # pragma: no cover
@overloaddef get( __arg1: str, __arg2: Union[str, List[str]], *, locale: str = DEFAULT_LOCALE, tzinfo: Optional[TZ_EXPR] = None, normalize_whitespace: bool = False,) -> Arrow: ... # pragma: no cover
def get(*args: Any, **kwargs: Any) -> Arrow: """Calls the default :class:`ArrowFactory <arrow.factory.ArrowFactory>` ``get`` method."""
return _factory.get(*args, **kwargs)
get.__doc__ = _factory.get.__doc__
def utcnow() -> Arrow: """Calls the default :class:`ArrowFactory <arrow.factory.ArrowFactory>` ``utcnow`` method."""
return _factory.utcnow()
utcnow.__doc__ = _factory.utcnow.__doc__
def now(tz: Optional[TZ_EXPR] = None) -> Arrow: """Calls the default :class:`ArrowFactory <arrow.factory.ArrowFactory>` ``now`` method."""
return _factory.now(tz)
now.__doc__ = _factory.now.__doc__
def factory(type: Type[Arrow]) -> ArrowFactory: """Returns an :class:`.ArrowFactory` for the specified :class:`Arrow <arrow.arrow.Arrow>` or derived type.
:param type: the type, :class:`Arrow <arrow.arrow.Arrow>` or derived.
"""
return ArrowFactory(type)
__all__ = ["get", "utcnow", "now", "factory"]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528<#
.Synopsis
Activate a Python virtual environment for the current PowerShell session.
.Description
Pushes the python executable for a virtual environment to the front of the
$Env:PATH environment variable and sets the prompt to signify that you are
in a Python virtual environment. Makes use of the command line switches as
well as the `pyvenv.cfg` file values present in the virtual environment.
.Parameter VenvDir
Path to the directory that contains the virtual environment to activate. The
default value for this is the parent of the directory that the Activate.ps1
script is located within.
.Parameter Prompt
The prompt prefix to display when this virtual environment is activated. By
default, this prompt is the name of the virtual environment folder (VenvDir)
surrounded by parentheses and followed by a single space (ie. '(.venv) ').
.Example
Activate.ps1
Activates the Python virtual environment that contains the Activate.ps1 script.
.Example
Activate.ps1 -Verbose
Activates the Python virtual environment that contains the Activate.ps1 script,
and shows extra information about the activation as it executes.
.Example
Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
Activates the Python virtual environment located in the specified location.
.Example
Activate.ps1 -Prompt "MyPython"
Activates the Python virtual environment that contains the Activate.ps1 script,
and prefixes the current prompt with the specified string (surrounded in
parentheses) while the virtual environment is active.
.Notes
On Windows, it may be required to enable this Activate.ps1 script by setting the
execution policy for the user. You can do this by issuing the following PowerShell
command:
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
For more information on Execution Policies:
https://go.microsoft.com/fwlink/?LinkID=135170
#>
Param(
[Parameter(Mandatory = $false)]
[String]
$VenvDir,
[Parameter(Mandatory = $false)]
[String]
$Prompt
)
<# Function declarations --------------------------------------------------- #>
<#
.Synopsis
Remove all shell session elements added by the Activate script, including the
addition of the virtual environment's Python executable from the beginning of
the PATH variable.
.Parameter NonDestructive
If present, do not remove this function from the global namespace for the
session.
#>
function global:deactivate ([switch]$NonDestructive) {
# Revert to original values
# The prior prompt:
if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
}
# The prior PYTHONHOME:
if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
}
# The prior PATH:
if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
Remove-Item -Path Env:_OLD_VIRTUAL_PATH
}
# Just remove the VIRTUAL_ENV altogether:
if (Test-Path -Path Env:VIRTUAL_ENV) {
Remove-Item -Path env:VIRTUAL_ENV
}
# Just remove VIRTUAL_ENV_PROMPT altogether.
if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
Remove-Item -Path env:VIRTUAL_ENV_PROMPT
}
# Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
}
# Leave deactivate function in the global namespace if requested:
if (-not $NonDestructive) {
Remove-Item -Path function:deactivate
}
}
<#
.Description
Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
given folder, and returns them in a map.
For each line in the pyvenv.cfg file, if that line can be parsed into exactly
two strings separated by `=` (with any amount of whitespace surrounding the =)
then it is considered a `key = value` line. The left hand string is the key,
the right hand is the value.
If the value starts with a `'` or a `"` then the first and last character is
stripped from the value before being captured.
.Parameter ConfigDir
Path to the directory that contains the `pyvenv.cfg` file.
#>
function Get-PyVenvConfig(
[String]
$ConfigDir
) {
Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
# Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
$pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
# An empty map will be returned if no config file is found.
$pyvenvConfig = @{ }
if ($pyvenvConfigPath) {
Write-Verbose "File exists, parse `key = value` lines"
$pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
$pyvenvConfigContent | ForEach-Object {
$keyval = $PSItem -split "\s*=\s*", 2
if ($keyval[0] -and $keyval[1]) {
$val = $keyval[1]
# Remove extraneous quotations around a string value.
if ("'""".Contains($val.Substring(0, 1))) {
$val = $val.Substring(1, $val.Length - 2)
}
$pyvenvConfig[$keyval[0]] = $val
Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
}
}
}
return $pyvenvConfig
}
<# Begin Activate script --------------------------------------------------- #>
# Determine the containing directory of this script
$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
$VenvExecDir = Get-Item -Path $VenvExecPath
Write-Verbose "Activation script is located in path: '$VenvExecPath'"
Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
# Set values required in priority: CmdLine, ConfigFile, Default
# First, get the location of the virtual environment, it might not be
# VenvExecDir if specified on the command line.
if ($VenvDir) {
Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
}
else {
Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
$VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
Write-Verbose "VenvDir=$VenvDir"
}
# Next, read the `pyvenv.cfg` file to determine any required value such
# as `prompt`.
$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
# Next, set the prompt from the command line, or the config file, or
# just use the name of the virtual environment folder.
if ($Prompt) {
Write-Verbose "Prompt specified as argument, using '$Prompt'"
}
else {
Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
$Prompt = $pyvenvCfg['prompt'];
}
else {
Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
$Prompt = Split-Path -Path $venvDir -Leaf
}
}
Write-Verbose "Prompt = '$Prompt'"
Write-Verbose "VenvDir='$VenvDir'"
# Deactivate any currently active virtual environment, but leave the
# deactivate function in place.
deactivate -nondestructive
# Now set the environment variable VIRTUAL_ENV, used by many tools to determine
# that there is an activated venv.
$env:VIRTUAL_ENV = $VenvDir
if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
Write-Verbose "Setting prompt to '$Prompt'"
# Set the prompt to include the env name
# Make sure _OLD_VIRTUAL_PROMPT is global
function global:_OLD_VIRTUAL_PROMPT { "" }
Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
function global:prompt {
Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
_OLD_VIRTUAL_PROMPT
}
$env:VIRTUAL_ENV_PROMPT = $Prompt
}
# Clear PYTHONHOME
if (Test-Path -Path Env:PYTHONHOME) {
Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
Remove-Item -Path Env:PYTHONHOME
}
# Add the venv to the PATH
Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
# SIG # Begin signature block
# MII0CQYJKoZIhvcNAQcCoIIz+jCCM/YCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWC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tJaf
# 7oSB86VOI0lfHnPUlLWvoiLHrFR5PsYkltOuPqU=
# SIG # End signature block12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576# This file must be used with "source bin/activate" *from bash*# You cannot run it directly
deactivate () { # reset old environment variables if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then PATH="${_OLD_VIRTUAL_PATH:-}" export PATH unset _OLD_VIRTUAL_PATH fi if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" export PYTHONHOME unset _OLD_VIRTUAL_PYTHONHOME fi
# Call hash to forget past locations. Without forgetting # past locations the $PATH changes we made may not be respected. # See "man bash" for more details. hash is usually a builtin of your shell hash -r 2> /dev/null
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then PS1="${_OLD_VIRTUAL_PS1:-}" export PS1 unset _OLD_VIRTUAL_PS1 fi
unset VIRTUAL_ENV unset VIRTUAL_ENV_PROMPT if [ ! "${1:-}" = "nondestructive" ] ; then # Self destruct! unset -f deactivate fi}
# unset irrelevant variablesdeactivate nondestructive
# on Windows, a path can contain colons and backslashes and has to be converted:case "$(uname)" in CYGWIN*|MSYS*|MINGW*) # transform D:\path\to\venv to /d/path/to/venv on MSYS and MINGW # and to /cygdrive/d/path/to/venv on Cygwin VIRTUAL_ENV=$(cygpath 'C:\Users\Light\Documents\sentiment-analysis-bert\venv') export VIRTUAL_ENV ;; *) # use the path as-is export VIRTUAL_ENV='C:\Users\Light\Documents\sentiment-analysis-bert\venv' ;;esac
_OLD_VIRTUAL_PATH="$PATH"PATH="$VIRTUAL_ENV/"Scripts":$PATH"export PATH
VIRTUAL_ENV_PROMPT='(venv) 'export VIRTUAL_ENV_PROMPT
# unset PYTHONHOME if set# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)# could use `if (set -u; : $PYTHONHOME) ;` in bashif [ -n "${PYTHONHOME:-}" ] ; then _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" unset PYTHONHOMEfi
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then _OLD_VIRTUAL_PS1="${PS1:-}" PS1="("'(venv) '") ${PS1:-}" export PS1fi
# Call hash to forget past commands. Without forgetting# past commands the $PATH changes we made may not be respectedhash -r 2> /dev/null12345678910111213141516171819202122232425262728293031323334@echo off
rem This file is UTF-8 encoded, so we need to update the current code page while executing it
for /f "tokens=2 delims=:." %%a in ('"%SystemRoot%\System32\chcp.com"') do (
set _OLD_CODEPAGE=%%a
)
if defined _OLD_CODEPAGE (
"%SystemRoot%\System32\chcp.com" 65001 > nul
)
set "VIRTUAL_ENV=C:\Users\Light\Documents\sentiment-analysis-bert\venv"
if not defined PROMPT set PROMPT=$P$G
if defined _OLD_VIRTUAL_PROMPT set PROMPT=%_OLD_VIRTUAL_PROMPT%
if defined _OLD_VIRTUAL_PYTHONHOME set PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%
set _OLD_VIRTUAL_PROMPT=%PROMPT%
set PROMPT=(venv) %PROMPT%
if defined PYTHONHOME set _OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%
set PYTHONHOME=
if defined _OLD_VIRTUAL_PATH set PATH=%_OLD_VIRTUAL_PATH%
if not defined _OLD_VIRTUAL_PATH set _OLD_VIRTUAL_PATH=%PATH%
set "PATH=%VIRTUAL_ENV%\Scripts;%PATH%"
set "VIRTUAL_ENV_PROMPT=(venv) "
:END
if defined _OLD_CODEPAGE (
"%SystemRoot%\System32\chcp.com" %_OLD_CODEPAGE% > nul
set _OLD_CODEPAGE=
)12345678910111213141516171819202122@echo off
if defined _OLD_VIRTUAL_PROMPT (
set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
)
set _OLD_VIRTUAL_PROMPT=
if defined _OLD_VIRTUAL_PYTHONHOME (
set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
set _OLD_VIRTUAL_PYTHONHOME=
)
if defined _OLD_VIRTUAL_PATH (
set "PATH=%_OLD_VIRTUAL_PATH%"
)
set _OLD_VIRTUAL_PATH=
set VIRTUAL_ENV=
set VIRTUAL_ENV_PROMPT=
:END123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475#!C:\Users\Light\Documents\sentiment-analysis-bert\venv\Scripts\python.exe
## Author: Mike McKerns (mmckerns @caltech and @uqfoundation)# Copyright (c) 2008-2016 California Institute of Technology.# Copyright (c) 2016-2024 The Uncertainty Quantification Foundation.# License: 3-clause BSD. The full license text is available at:# - https://github.com/uqfoundation/dill/blob/master/LICENSE'''build profile graph for the given instance
running: $ get_gprof <args> <instance>
executes: gprof2dot -f pstats <args> <type>.prof | dot -Tpng -o <type>.call.png
where: <args> are arguments for gprof2dot, such as "-n 5 -e 5" <instance> is code to create the instance to profile <type> is the class of the instance (i.e. type(instance))
For example: $ get_gprof -n 5 -e 1 "import numpy; numpy.array([1,2])"
will create 'ndarray.call.png' with the profile graph for numpy.array([1,2]),where '-n 5' eliminates nodes below 5% threshold, similarly '-e 1' eliminatesedges below 1% threshold'''
if __name__ == "__main__": import sys if len(sys.argv) < 2: print ("Please provide an object instance (e.g. 'import math; math.pi')") sys.exit() # grab args for gprof2dot args = sys.argv[1:-1] args = ' '.join(args) # last arg builds the object obj = sys.argv[-1] obj = obj.split(';') # multi-line prep for generating an instance for line in obj[:-1]: exec(line) # one-line generation of an instance try: obj = eval(obj[-1]) except Exception: print ("Error processing object instance") sys.exit()
# get object 'name' objtype = type(obj) name = getattr(objtype, '__name__', getattr(objtype, '__class__', objtype))
# profile dumping an object import dill import os import cProfile #name = os.path.splitext(os.path.basename(__file__))[0] cProfile.run("dill.dumps(obj)", filename="%s.prof" % name) msg = "gprof2dot -f pstats %s %s.prof | dot -Tpng -o %s.call.png" % (args, name, name) try: res = os.system(msg) except Exception: print ("Please verify install of 'gprof2dot' to view profile graphs") if res: print ("Please verify install of 'gprof2dot' to view profile graphs")
# get stats f_prof = "%s.prof" % name import pstats stats = pstats.Stats(f_prof, stream=sys.stdout) stats.strip_dirs().sort_stats('cumtime') stats.print_stats(20) #XXX: save to file instead of print top 20? os.remove(f_prof)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354#!C:\Users\Light\Documents\sentiment-analysis-bert\venv\Scripts\python.exe
## Author: Mike McKerns (mmckerns @caltech and @uqfoundation)# Copyright (c) 2008-2016 California Institute of Technology.# Copyright (c) 2016-2024 The Uncertainty Quantification Foundation.# License: 3-clause BSD. The full license text is available at:# - https://github.com/uqfoundation/dill/blob/master/LICENSE"""display the reference paths for objects in ``dill.types`` or a .pkl file
Notes: the generated image is useful in showing the pointer references in objects that are or can be pickled. Any object in ``dill.objects`` listed in ``dill.load_types(picklable=True, unpicklable=True)`` works.
Examples::
$ get_objgraph ArrayType Image generated as ArrayType.png"""
import dill as pickle#pickle.debug.trace(True)#import pickle
# get all objects for testingfrom dill import load_typesload_types(pickleable=True,unpickleable=True)from dill import objects
if __name__ == "__main__": import sys if len(sys.argv) != 2: print ("Please provide exactly one file or type name (e.g. 'IntType')") msg = "\n" for objtype in list(objects.keys())[:40]: msg += objtype + ', ' print (msg + "...") else: objtype = str(sys.argv[-1]) try: obj = objects[objtype] except KeyError: obj = pickle.load(open(objtype,'rb')) import os objtype = os.path.splitext(objtype)[0] try: import objgraph objgraph.show_refs(obj, filename=objtype+'.png') except ImportError: print ("Please install 'objgraph' to view object graphs")
# EOF12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667#!C:\Users\Light\Documents\sentiment-analysis-bert\venv\Scripts\python.exe
# -*- coding: utf-8 -*-
import argparseimport jsonimport sys
import jsonpointer
parser = argparse.ArgumentParser( description='Resolve a JSON pointer on JSON files')
# Accept pointer as argument or as fileptr_group = parser.add_mutually_exclusive_group(required=True)
ptr_group.add_argument('-f', '--pointer-file', type=argparse.FileType('r'), nargs='?', help='File containing a JSON pointer expression')
ptr_group.add_argument('POINTER', type=str, nargs='?', help='A JSON pointer expression')
parser.add_argument('FILE', type=argparse.FileType('r'), nargs='+', help='Files for which the pointer should be resolved')parser.add_argument('--indent', type=int, default=None, help='Indent output by n spaces')parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + jsonpointer.__version__)
def main(): try: resolve_files() except KeyboardInterrupt: sys.exit(1)
def parse_pointer(args): if args.POINTER: ptr = args.POINTER elif args.pointer_file: ptr = args.pointer_file.read().strip() else: parser.print_usage() sys.exit(1)
return ptr
def resolve_files(): """ Resolve a JSON pointer on JSON files """ args = parser.parse_args()
ptr = parse_pointer(args)
for f in args.FILE: doc = json.load(f) try: result = jsonpointer.resolve_pointer(doc, ptr) print(json.dumps(result, indent=args.indent)) except jsonpointer.JsonPointerException as e: print('Could not resolve pointer: %s' % str(e), file=sys.stderr)
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733# postinstall script for pywin32
#
# copies pywintypesXX.dll and pythoncomXX.dll into the system directory,
# and creates a pth file
import argparse
import glob
import os
import shutil
import sys
import sysconfig
import tempfile
import winreg
tee_f = open(
os.path.join(
tempfile.gettempdir(), # Send output somewhere so it can be found if necessary...
"pywin32_postinstall.log",
),
"w",
)
class Tee:
def __init__(self, file):
self.f = file
def write(self, what):
if self.f is not None:
try:
self.f.write(what.replace("\n", "\r\n"))
except OSError:
pass
tee_f.write(what)
def flush(self):
if self.f is not None:
try:
self.f.flush()
except OSError:
pass
tee_f.flush()
sys.stderr = Tee(sys.stderr)
sys.stdout = Tee(sys.stdout)
com_modules = [
# module_name, class_names
("win32com.servers.interp", "Interpreter"),
("win32com.servers.dictionary", "DictionaryPolicy"),
("win32com.axscript.client.pyscript", "PyScript"),
]
# Is this a 'silent' install - ie, avoid all dialogs.
# Different than 'verbose'
silent = 0
# Verbosity of output messages.
verbose = 1
root_key_name = "Software\\Python\\PythonCore\\" + sys.winver
def get_root_hkey():
try:
winreg.OpenKey(
winreg.HKEY_LOCAL_MACHINE, root_key_name, 0, winreg.KEY_CREATE_SUB_KEY
)
return winreg.HKEY_LOCAL_MACHINE
except OSError:
# Either not exist, or no permissions to create subkey means
# must be HKCU
return winreg.HKEY_CURRENT_USER
# Create a function with the same signature as create_shortcut
# previously provided by bdist_wininst
def create_shortcut(
path, description, filename, arguments="", workdir="", iconpath="", iconindex=0
):
import pythoncom
from win32com.shell import shell
ilink = pythoncom.CoCreateInstance(
shell.CLSID_ShellLink,
None,
pythoncom.CLSCTX_INPROC_SERVER,
shell.IID_IShellLink,
)
ilink.SetPath(path)
ilink.SetDescription(description)
if arguments:
ilink.SetArguments(arguments)
if workdir:
ilink.SetWorkingDirectory(workdir)
if iconpath or iconindex:
ilink.SetIconLocation(iconpath, iconindex)
# now save it.
ipf = ilink.QueryInterface(pythoncom.IID_IPersistFile)
ipf.Save(filename, 0)
# Support the same list of "path names" as bdist_wininst used to
def get_special_folder_path(path_name):
from win32com.shell import shell, shellcon
for maybe in """
CSIDL_COMMON_STARTMENU CSIDL_STARTMENU CSIDL_COMMON_APPDATA
CSIDL_LOCAL_APPDATA CSIDL_APPDATA CSIDL_COMMON_DESKTOPDIRECTORY
CSIDL_DESKTOPDIRECTORY CSIDL_COMMON_STARTUP CSIDL_STARTUP
CSIDL_COMMON_PROGRAMS CSIDL_PROGRAMS CSIDL_PROGRAM_FILES_COMMON
CSIDL_PROGRAM_FILES CSIDL_FONTS""".split():
if maybe == path_name:
csidl = getattr(shellcon, maybe)
return shell.SHGetSpecialFolderPath(0, csidl, False)
raise ValueError(f"{path_name} is an unknown path ID")
def CopyTo(desc, src, dest):
import win32api
import win32con
while 1:
try:
win32api.CopyFile(src, dest, 0)
return
except win32api.error as details:
if details.winerror == 5: # access denied - user not admin.
raise
if silent:
# Running silent mode - just re-raise the error.
raise
full_desc = (
f"Error {desc}\n\n"
"If you have any Python applications running, "
f"please close them now\nand select 'Retry'\n\n{details.strerror}"
)
rc = win32api.MessageBox(
0, full_desc, "Installation Error", win32con.MB_ABORTRETRYIGNORE
)
if rc == win32con.IDABORT:
raise
elif rc == win32con.IDIGNORE:
return
# else retry - around we go again.
# We need to import win32api to determine the Windows system directory,
# so we can copy our system files there - but importing win32api will
# load the pywintypes.dll already in the system directory preventing us
# from updating them!
# So, we pull the same trick pywintypes.py does, but it loads from
# our pywintypes_system32 directory.
def LoadSystemModule(lib_dir, modname):
# See if this is a debug build.
import importlib.machinery
import importlib.util
suffix = "_d" if "_d.pyd" in importlib.machinery.EXTENSION_SUFFIXES else ""
filename = "%s%d%d%s.dll" % (
modname,
sys.version_info.major,
sys.version_info.minor,
suffix,
)
filename = os.path.join(lib_dir, "pywin32_system32", filename)
loader = importlib.machinery.ExtensionFileLoader(modname, filename)
spec = importlib.machinery.ModuleSpec(name=modname, loader=loader, origin=filename)
mod = importlib.util.module_from_spec(spec)
loader.exec_module(mod)
def SetPyKeyVal(key_name, value_name, value):
root_hkey = get_root_hkey()
root_key = winreg.OpenKey(root_hkey, root_key_name)
try:
my_key = winreg.CreateKey(root_key, key_name)
try:
winreg.SetValueEx(my_key, value_name, 0, winreg.REG_SZ, value)
if verbose:
print(f"-> {root_key_name}\\{key_name}[{value_name}]={value!r}")
finally:
my_key.Close()
finally:
root_key.Close()
def UnsetPyKeyVal(key_name, value_name, delete_key=False):
root_hkey = get_root_hkey()
root_key = winreg.OpenKey(root_hkey, root_key_name)
try:
my_key = winreg.OpenKey(root_key, key_name, 0, winreg.KEY_SET_VALUE)
try:
winreg.DeleteValue(my_key, value_name)
if verbose:
print(f"-> DELETE {root_key_name}\\{key_name}[{value_name}]")
finally:
my_key.Close()
if delete_key:
winreg.DeleteKey(root_key, key_name)
if verbose:
print(f"-> DELETE {root_key_name}\\{key_name}")
except OSError as why:
winerror = getattr(why, "winerror", why.errno)
if winerror != 2: # file not found
raise
finally:
root_key.Close()
def RegisterCOMObjects(register=True):
import win32com.server.register
if register:
func = win32com.server.register.RegisterClasses
else:
func = win32com.server.register.UnregisterClasses
flags = {}
if not verbose:
flags["quiet"] = 1
for module, klass_name in com_modules:
__import__(module)
mod = sys.modules[module]
flags["finalize_register"] = getattr(mod, "DllRegisterServer", None)
flags["finalize_unregister"] = getattr(mod, "DllUnregisterServer", None)
klass = getattr(mod, klass_name)
func(klass, **flags)
def RegisterHelpFile(register=True, lib_dir=None):
if lib_dir is None:
lib_dir = sysconfig.get_paths()["platlib"]
if register:
# Register the .chm help file.
chm_file = os.path.join(lib_dir, "PyWin32.chm")
if os.path.isfile(chm_file):
# This isn't recursive, so if 'Help' doesn't exist, we croak
SetPyKeyVal("Help", None, None)
SetPyKeyVal("Help\\Pythonwin Reference", None, chm_file)
return chm_file
else:
print("NOTE: PyWin32.chm can not be located, so has not been registered")
else:
UnsetPyKeyVal("Help\\Pythonwin Reference", None, delete_key=True)
return None
def RegisterPythonwin(register=True, lib_dir=None):
"""Add (or remove) Pythonwin to context menu for python scripts.
??? Should probably also add Edit command for pys files also.
Also need to remove these keys on uninstall, but there's no function
to add registry entries to uninstall log ???
"""
import os
if lib_dir is None:
lib_dir = sysconfig.get_paths()["platlib"]
classes_root = get_root_hkey()
## Installer executable doesn't seem to pass anything to postinstall script indicating if it's a debug build
pythonwin_exe = os.path.join(lib_dir, "Pythonwin", "Pythonwin.exe")
pythonwin_edit_command = pythonwin_exe + ' -edit "%1"'
keys_vals = [
(
"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Pythonwin.exe",
"",
pythonwin_exe,
),
(
"Software\\Classes\\Python.File\\shell\\Edit with Pythonwin",
"command",
pythonwin_edit_command,
),
(
"Software\\Classes\\Python.NoConFile\\shell\\Edit with Pythonwin",
"command",
pythonwin_edit_command,
),
]
try:
if register:
for key, sub_key, val in keys_vals:
## Since winreg only uses the character Api functions, this can fail if Python
## is installed to a path containing non-ascii characters
hkey = winreg.CreateKey(classes_root, key)
if sub_key:
hkey = winreg.CreateKey(hkey, sub_key)
winreg.SetValueEx(hkey, None, 0, winreg.REG_SZ, val)
hkey.Close()
else:
for key, sub_key, val in keys_vals:
try:
if sub_key:
hkey = winreg.OpenKey(classes_root, key)
winreg.DeleteKey(hkey, sub_key)
hkey.Close()
winreg.DeleteKey(classes_root, key)
except OSError as why:
winerror = getattr(why, "winerror", why.errno)
if winerror != 2: # file not found
raise
finally:
# tell windows about the change
from win32com.shell import shell, shellcon
shell.SHChangeNotify(
shellcon.SHCNE_ASSOCCHANGED, shellcon.SHCNF_IDLIST, None, None
)
def get_shortcuts_folder():
if get_root_hkey() == winreg.HKEY_LOCAL_MACHINE:
try:
fldr = get_special_folder_path("CSIDL_COMMON_PROGRAMS")
except OSError:
# No CSIDL_COMMON_PROGRAMS on this platform
fldr = get_special_folder_path("CSIDL_PROGRAMS")
else:
# non-admin install - always goes in this user's start menu.
fldr = get_special_folder_path("CSIDL_PROGRAMS")
try:
install_group = winreg.QueryValue(
get_root_hkey(), root_key_name + "\\InstallPath\\InstallGroup"
)
except OSError:
install_group = "Python %d.%d" % (
sys.version_info.major,
sys.version_info.minor,
)
return os.path.join(fldr, install_group)
# Get the system directory, which may be the Wow64 directory if we are a 32bit
# python on a 64bit OS.
def get_system_dir():
import win32api # we assume this exists.
try:
import pythoncom
import win32process
from win32com.shell import shell, shellcon
try:
if win32process.IsWow64Process():
return shell.SHGetSpecialFolderPath(0, shellcon.CSIDL_SYSTEMX86)
return shell.SHGetSpecialFolderPath(0, shellcon.CSIDL_SYSTEM)
except (pythoncom.com_error, win32process.error):
return win32api.GetSystemDirectory()
except ImportError:
return win32api.GetSystemDirectory()
def fixup_dbi():
# We used to have a dbi.pyd with our .pyd files, but now have a .py file.
# If the user didn't uninstall, they will find the .pyd which will cause
# problems - so handle that.
import win32api
import win32con
pyd_name = os.path.join(os.path.dirname(win32api.__file__), "dbi.pyd")
pyd_d_name = os.path.join(os.path.dirname(win32api.__file__), "dbi_d.pyd")
py_name = os.path.join(os.path.dirname(win32con.__file__), "dbi.py")
for this_pyd in (pyd_name, pyd_d_name):
this_dest = this_pyd + ".old"
if os.path.isfile(this_pyd) and os.path.isfile(py_name):
try:
if os.path.isfile(this_dest):
print(
f"Old dbi '{this_dest}' already exists - deleting '{this_pyd}'"
)
os.remove(this_pyd)
else:
os.rename(this_pyd, this_dest)
print(f"renamed '{this_pyd}'->'{this_pyd}.old'")
except OSError as exc:
print(f"FAILED to rename '{this_pyd}': {exc}")
def install(lib_dir):
import traceback
# The .pth file is now installed as a regular file.
# Create the .pth file in the site-packages dir, and use only relative paths
# We used to write a .pth directly to sys.prefix - clobber it.
if os.path.isfile(os.path.join(sys.prefix, "pywin32.pth")):
os.unlink(os.path.join(sys.prefix, "pywin32.pth"))
# The .pth may be new and therefore not loaded in this session.
# Setup the paths just in case.
for name in "win32 win32\\lib Pythonwin".split():
sys.path.append(os.path.join(lib_dir, name))
# It is possible people with old versions installed with still have
# pywintypes and pythoncom registered. We no longer need this, and stale
# entries hurt us.
for name in "pythoncom pywintypes".split():
keyname = "Software\\Python\\PythonCore\\" + sys.winver + "\\Modules\\" + name
for root in winreg.HKEY_LOCAL_MACHINE, winreg.HKEY_CURRENT_USER:
try:
winreg.DeleteKey(root, keyname + "\\Debug")
except OSError:
pass
try:
winreg.DeleteKey(root, keyname)
except OSError:
pass
LoadSystemModule(lib_dir, "pywintypes")
LoadSystemModule(lib_dir, "pythoncom")
import win32api
# and now we can get the system directory:
files = glob.glob(os.path.join(lib_dir, "pywin32_system32\\*.*"))
if not files:
raise RuntimeError("No system files to copy!!")
# Try the system32 directory first - if that fails due to "access denied",
# it implies a non-admin user, and we use sys.prefix
for dest_dir in [get_system_dir(), sys.prefix]:
# and copy some files over there
worked = 0
try:
for fname in files:
base = os.path.basename(fname)
dst = os.path.join(dest_dir, base)
CopyTo("installing %s" % base, fname, dst)
if verbose:
print(f"Copied {base} to {dst}")
worked = 1
# Nuke any other versions that may exist - having
# duplicates causes major headaches.
bad_dest_dirs = [
os.path.join(sys.prefix, "Library\\bin"),
os.path.join(sys.prefix, "Lib\\site-packages\\win32"),
]
if dest_dir != sys.prefix:
bad_dest_dirs.append(sys.prefix)
for bad_dest_dir in bad_dest_dirs:
bad_fname = os.path.join(bad_dest_dir, base)
if os.path.exists(bad_fname):
# let exceptions go here - delete must succeed
os.unlink(bad_fname)
if worked:
break
except win32api.error as details:
if details.winerror == 5:
# access denied - user not admin - try sys.prefix dir,
# but first check that a version doesn't already exist
# in that place - otherwise that one will still get used!
if os.path.exists(dst):
msg = (
"The file '%s' exists, but can not be replaced "
"due to insufficient permissions. You must "
"reinstall this software as an Administrator" % dst
)
print(msg)
raise RuntimeError(msg)
continue
raise
else:
raise RuntimeError(
"You don't have enough permissions to install the system files"
)
# Register our demo COM objects.
try:
try:
RegisterCOMObjects()
except win32api.error as details:
if details.winerror != 5: # ERROR_ACCESS_DENIED
raise
print("You do not have the permissions to install COM objects.")
print("The sample COM objects were not registered.")
except Exception:
print("FAILED to register the Python COM objects")
traceback.print_exc()
# There may be no main Python key in HKCU if, eg, an admin installed
# python itself.
winreg.CreateKey(get_root_hkey(), root_key_name)
chm_file = None
try:
chm_file = RegisterHelpFile(True, lib_dir)
except Exception:
print("Failed to register help file")
traceback.print_exc()
else:
if verbose:
print("Registered help file")
# misc other fixups.
fixup_dbi()
# Register Pythonwin in context menu
try:
RegisterPythonwin(True, lib_dir)
except Exception:
print("Failed to register pythonwin as editor")
traceback.print_exc()
else:
if verbose:
print("Pythonwin has been registered in context menu")
# Create the win32com\gen_py directory.
make_dir = os.path.join(lib_dir, "win32com", "gen_py")
if not os.path.isdir(make_dir):
if verbose:
print(f"Creating directory {make_dir}")
os.mkdir(make_dir)
try:
# create shortcuts
# CSIDL_COMMON_PROGRAMS only available works on NT/2000/XP, and
# will fail there if the user has no admin rights.
fldr = get_shortcuts_folder()
# If the group doesn't exist, then we don't make shortcuts - its
# possible that this isn't a "normal" install.
if os.path.isdir(fldr):
dst = os.path.join(fldr, "PythonWin.lnk")
create_shortcut(
os.path.join(lib_dir, "Pythonwin\\Pythonwin.exe"),
"The Pythonwin IDE",
dst,
"",
sys.prefix,
)
if verbose:
print("Shortcut for Pythonwin created")
# And the docs.
if chm_file:
dst = os.path.join(fldr, "Python for Windows Documentation.lnk")
doc = "Documentation for the PyWin32 extensions"
create_shortcut(chm_file, doc, dst)
if verbose:
print("Shortcut to documentation created")
else:
if verbose:
print(f"Can't install shortcuts - {fldr!r} is not a folder")
except Exception as details:
print(details)
# importing win32com.client ensures the gen_py dir created - not strictly
# necessary to do now, but this makes the installation "complete"
try:
import win32com.client # noqa
except ImportError:
# Don't let this error sound fatal
pass
print("The pywin32 extensions were successfully installed.")
def uninstall(lib_dir):
# First ensure our system modules are loaded from pywin32_system, so
# we can remove the ones we copied...
LoadSystemModule(lib_dir, "pywintypes")
LoadSystemModule(lib_dir, "pythoncom")
try:
RegisterCOMObjects(False)
except Exception as why:
print(f"Failed to unregister COM objects: {why}")
try:
RegisterHelpFile(False, lib_dir)
except Exception as why:
print(f"Failed to unregister help file: {why}")
else:
if verbose:
print("Unregistered help file")
try:
RegisterPythonwin(False, lib_dir)
except Exception as why:
print(f"Failed to unregister Pythonwin: {why}")
else:
if verbose:
print("Unregistered Pythonwin")
try:
# remove gen_py directory.
gen_dir = os.path.join(lib_dir, "win32com", "gen_py")
if os.path.isdir(gen_dir):
shutil.rmtree(gen_dir)
if verbose:
print(f"Removed directory {gen_dir}")
# Remove pythonwin compiled "config" files.
pywin_dir = os.path.join(lib_dir, "Pythonwin", "pywin")
for fname in glob.glob(os.path.join(pywin_dir, "*.cfc")):
os.remove(fname)
# The dbi.pyd.old files we may have created.
try:
os.remove(os.path.join(lib_dir, "win32", "dbi.pyd.old"))
except OSError:
pass
try:
os.remove(os.path.join(lib_dir, "win32", "dbi_d.pyd.old"))
except OSError:
pass
except Exception as why:
print(f"Failed to remove misc files: {why}")
try:
fldr = get_shortcuts_folder()
for link in ("PythonWin.lnk", "Python for Windows Documentation.lnk"):
fqlink = os.path.join(fldr, link)
if os.path.isfile(fqlink):
os.remove(fqlink)
if verbose:
print(f"Removed {link}")
except Exception as why:
print(f"Failed to remove shortcuts: {why}")
# Now remove the system32 files.
files = glob.glob(os.path.join(lib_dir, "pywin32_system32\\*.*"))
# Try the system32 directory first - if that fails due to "access denied",
# it implies a non-admin user, and we use sys.prefix
try:
for dest_dir in [get_system_dir(), sys.prefix]:
# and copy some files over there
worked = 0
for fname in files:
base = os.path.basename(fname)
dst = os.path.join(dest_dir, base)
if os.path.isfile(dst):
try:
os.remove(dst)
worked = 1
if verbose:
print("Removed file %s" % (dst))
except Exception:
print(f"FAILED to remove {dst}")
if worked:
break
except Exception as why:
print(f"FAILED to remove system files: {why}")
# NOTE: This used to be run from inside the bdist_wininst created binary un/installer.
# From inside the binary installer this script HAD to NOT
# call sys.exit() or raise SystemExit, otherwise the installer would also terminate!
# Out of principle, we're still not using system exits.
def verify_destination(location: str) -> str:
location = os.path.abspath(location)
if not os.path.isdir(location):
raise argparse.ArgumentTypeError(
f'Path "{location}" is not an existing directory!'
)
return location
def main():
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description="""A post-install script for the pywin32 extensions.
* Typical usage:
> python -m pywin32_postinstall -install
* or (shorter but you don't have control over which python environment is used)
> pywin32_postinstall -install
You need to execute this script, with a '-install' parameter,
to ensure the environment is setup correctly to install COM objects, services, etc.
""",
)
parser.add_argument(
"-install",
default=False,
action="store_true",
help="Configure the Python environment correctly for pywin32.",
)
parser.add_argument(
"-remove",
default=False,
action="store_true",
help="Try and remove everything that was installed or copied.",
)
parser.add_argument(
"-wait",
type=int,
help="Wait for the specified process to terminate before starting.",
)
parser.add_argument(
"-silent",
default=False,
action="store_true",
help='Don\'t display the "Abort/Retry/Ignore" dialog for files in use.',
)
parser.add_argument(
"-quiet",
default=False,
action="store_true",
help="Don't display progress messages.",
)
parser.add_argument(
"-destination",
default=sysconfig.get_paths()["platlib"],
type=verify_destination,
help="Location of the PyWin32 installation",
)
args = parser.parse_args()
if not args.quiet:
print(f"Parsed arguments are: {args}")
if not args.install ^ args.remove:
parser.error("You need to either choose to -install or -remove!")
if args.wait is not None:
try:
os.waitpid(args.wait, 0)
except OSError:
# child already dead
pass
silent = args.silent
verbose = not args.quiet
if args.install:
install(args.destination)
if args.remove:
uninstall(args.destination)
if __name__ == "__main__":
main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120"""A test runner for pywin32"""
import os
import site
import subprocess
import sys
# locate the dirs based on where this script is - it may be either in the
# source tree, or in an installed Python 'Scripts' tree.
project_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
site_packages = [site.getusersitepackages()] + site.getsitepackages()
failures = []
# Run a test using subprocess and wait for the result.
# If we get an returncode != 0, we know that there was an error, but we don't
# abort immediately - we run as many tests as we can.
def run_test(script, cmdline_extras):
dirname, scriptname = os.path.split(script)
# some tests prefer to be run from their directory.
cmd = [sys.executable, "-u", scriptname] + cmdline_extras
print("--- Running '%s' ---" % script)
sys.stdout.flush()
result = subprocess.run(cmd, check=False, cwd=dirname)
print(f"*** Test script '{script}' exited with {result.returncode}")
sys.stdout.flush()
if result.returncode:
failures.append(script)
def find_and_run(possible_locations, extras):
for maybe in possible_locations:
if os.path.isfile(maybe):
run_test(maybe, extras)
break
else:
raise RuntimeError(
"Failed to locate a test script in one of %s" % possible_locations
)
def main():
import argparse
code_directories = [project_root] + site_packages
parser = argparse.ArgumentParser(
description="A script to trigger tests in all subprojects of PyWin32."
)
parser.add_argument(
"-no-user-interaction",
default=False,
action="store_true",
help="(This is now the default - use `-user-interaction` to include them)",
)
parser.add_argument(
"-user-interaction",
action="store_true",
help="Include tests which require user interaction",
)
parser.add_argument(
"-skip-adodbapi",
default=False,
action="store_true",
help="Skip the adodbapi tests; useful for CI where there's no provider",
)
args, remains = parser.parse_known_args()
# win32, win32ui / Pythonwin
extras = []
if args.user_interaction:
extras.append("-user-interaction")
extras.extend(remains)
scripts = [
"win32/test/testall.py",
"Pythonwin/pywin/test/all.py",
]
for script in scripts:
maybes = [os.path.join(directory, script) for directory in code_directories]
find_and_run(maybes, extras)
# win32com
maybes = [
os.path.join(directory, "win32com", "test", "testall.py")
for directory in [os.path.join(project_root, "com")] + site_packages
]
extras = remains + ["1"] # only run "level 1" tests in CI
find_and_run(maybes, extras)
# adodbapi
if not args.skip_adodbapi:
maybes = [
os.path.join(directory, "adodbapi", "test", "adodbapitest.py")
for directory in code_directories
]
find_and_run(maybes, remains)
# This script has a hard-coded sql server name in it, (and markh typically
# doesn't have a different server to test on) but there is now supposed to be a server out there on the Internet
# just to run these tests, so try it...
maybes = [
os.path.join(directory, "adodbapi", "test", "test_adodbapi_dbapi20.py")
for directory in code_directories
]
find_and_run(maybes, remains)
if failures:
print("The following scripts failed")
for failure in failures:
print(">", failure)
sys.exit(1)
print("All tests passed \\o/")
if __name__ == "__main__":
main()12345678910111213141516171819202122#!C:\Users\Light\Documents\sentiment-analysis-bert\venv\Scripts\python.exe
## Author: Mike McKerns (mmckerns @caltech and @uqfoundation)# Copyright (c) 2008-2016 California Institute of Technology.# Copyright (c) 2016-2024 The Uncertainty Quantification Foundation.# License: 3-clause BSD. The full license text is available at:# - https://github.com/uqfoundation/dill/blob/master/LICENSE"""unpickle the contents of a pickled object file
Examples::
$ undill hello.pkl ['hello', 'world']"""
if __name__ == '__main__': import sys import dill for file in sys.argv[1:]: print (dill.load(open(file,'rb')))
1234567{ "NotebookApp": { "nbserver_extensions": { "jupyterlab": true } }}1234567{ "ServerApp": { "jpserver_extensions": { "jupyter_lsp": true } }}notebooks/results/checkpoint-3000/config.jsonAdded+26
notebooks/results/checkpoint-3000/trainer_state.jsonAdded+244
notebooks/results/checkpoint-3500/config.jsonAdded+26
notebooks/results/checkpoint-3500/trainer_state.jsonAdded+279
notebooks/results/checkpoint-4000/config.jsonAdded+26
notebooks/results/checkpoint-4000/trainer_state.jsonAdded+314
notebooks/results/checkpoint-4500/config.jsonAdded+26
notebooks/results/checkpoint-4500/trainer_state.jsonAdded+349
notebooks/results/checkpoint-4689/config.jsonAdded+26
notebooks/results/checkpoint-4689/trainer_state.jsonAdded+356
notebooks/results/checkpoint-500/config.jsonAdded+26
notebooks/results/checkpoint-500/trainer_state.jsonAdded+69
venv/Lib/site-packages/anyio-4.9.0.dist-info/LICENSEAdded+20
venv/Lib/site-packages/anyio-4.9.0.dist-info/METADATAAdded+105
venv/Lib/site-packages/anyio-4.9.0.dist-info/RECORDAdded+88
venv/Lib/site-packages/anyio-4.9.0.dist-info/WHEELAdded+5
venv/Lib/site-packages/anyio-4.9.0.dist-info/top_level.txtAdded+1
venv/Lib/site-packages/argon2/__init__.pyAdded+92
venv/Lib/site-packages/argon2/__main__.pyAdded+90
venv/Lib/site-packages/argon2/_legacy.pyAdded+91
venv/Lib/site-packages/argon2/_password_hasher.pyAdded+251
venv/Lib/site-packages/argon2/_typing.pyAdded+15
venv/Lib/site-packages/argon2/_utils.pyAdded+140
venv/Lib/site-packages/argon2/exceptions.pyAdded+56
venv/Lib/site-packages/argon2/low_level.pyAdded+238
venv/Lib/site-packages/argon2/profiles.pyAdded+60
venv/Lib/site-packages/argon2/py.typedAdded
venv/Lib/site-packages/argon2_cffi-23.1.0.dist-info/INSTALLERAdded+1
venv/Lib/site-packages/argon2_cffi-23.1.0.dist-info/METADATAAdded+128
venv/Lib/site-packages/argon2_cffi-23.1.0.dist-info/RECORDAdded+24
venv/Lib/site-packages/argon2_cffi-23.1.0.dist-info/WHEELAdded+4
venv/Lib/site-packages/argon2_cffi_bindings-21.2.0.dist-info/INSTALLERAdded+1
venv/Lib/site-packages/argon2_cffi_bindings-21.2.0.dist-info/LICENSEAdded+21
venv/Lib/site-packages/argon2_cffi_bindings-21.2.0.dist-info/METADATAAdded+152
venv/Lib/site-packages/argon2_cffi_bindings-21.2.0.dist-info/RECORDAdded+11
venv/Lib/site-packages/argon2_cffi_bindings-21.2.0.dist-info/WHEELAdded+5
venv/Lib/site-packages/argon2_cffi_bindings-21.2.0.dist-info/top_level.txtAdded+2
venv/Lib/site-packages/arrow/api.pyAdded+126
venv/Scripts/Activate.ps1Added+528
venv/Scripts/activateAdded+76
venv/Scripts/activate.batAdded+34
venv/Scripts/deactivate.batAdded+22
venv/Scripts/get_gprofAdded+75
venv/Scripts/get_objgraphAdded+54
venv/Scripts/jsonpointerAdded+67
venv/Scripts/pywin32_postinstall.pyAdded+733
venv/Scripts/pywin32_testall.pyAdded+120
venv/Scripts/undillAdded+22
venv/etc/jupyter/jupyter_notebook_config.d/jupyterlab.jsonAdded+7
venv/etc/jupyter/jupyter_server_config.d/jupyter-lsp-jupyter-server.jsonAdded+7