repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
python-telegram-bot | src/telegram/ext/_callbackcontext.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 426 | 17,758 |
python-telegram-bot | src/telegram/ext/_application.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 1,941 | 84,907 |
python-telegram-bot | src/telegram/ext/_contexttypes.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 228 | 7,750 |
python-telegram-bot | src/telegram/ext/_handlers/callbackqueryhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 207 | 9,209 |
python-telegram-bot | src/telegram/ext/_handlers/chatjoinrequesthandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 110 | 4,451 |
python-telegram-bot | src/telegram/ext/_handlers/choseninlineresulthandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 124 | 4,896 |
python-telegram-bot | src/telegram/ext/_handlers/stringcommandhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 109 | 4,460 |
python-telegram-bot | src/telegram/ext/_handlers/inlinequeryhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 141 | 5,785 |
python-telegram-bot | src/telegram/ext/_handlers/typehandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 99 | 4,111 |
python-telegram-bot | src/telegram/ext/_handlers/messagereactionhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 181 | 8,153 |
python-telegram-bot | src/telegram/ext/_handlers/conversationhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 958 | 42,417 |
python-telegram-bot | src/telegram/ext/_handlers/businessmessagesdeletedhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 97 | 3,873 |
python-telegram-bot | src/telegram/ext/_handlers/businessconnectionhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 97 | 3,829 |
python-telegram-bot | src/telegram/ext/_handlers/paidmediapurchasedhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 94 | 3,783 |
python-telegram-bot | src/telegram/ext/_handlers/messagehandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 113 | 4,695 |
python-telegram-bot | src/telegram/ext/_handlers/stringregexhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 116 | 4,547 |
python-telegram-bot | src/telegram/ext/_handlers/precheckoutqueryhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 103 | 4,017 |
python-telegram-bot | src/telegram/ext/_handlers/commandhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 225 | 9,994 |
python-telegram-bot | src/telegram/ext/_handlers/pollhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 71 | 2,752 |
python-telegram-bot | src/telegram/ext/_handlers/basehandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 177 | 7,328 |
python-telegram-bot | src/telegram/ext/_handlers/chatboosthandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 131 | 5,526 |
python-telegram-bot | src/telegram/ext/_handlers/pollanswerhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 71 | 2,787 |
python-telegram-bot | src/telegram/ext/_handlers/chatmemberhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 127 | 5,269 |
python-telegram-bot | src/telegram/ext/_handlers/prefixhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 186 | 7,870 |
python-telegram-bot | src/telegram/ext/_handlers/managedbotupdatedhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 105 | 4,174 |
python-telegram-bot | src/telegram/ext/_handlers/shippingqueryhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 70 | 2,762 |
python-telegram-bot | src/telegram/ext/_utils/types.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 106 | 3,039 |
python-telegram-bot | src/telegram/ext/_utils/trackingdict.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 135 | 4,901 |
python-telegram-bot | src/telegram/ext/_utils/asyncio.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 57 | 1,933 |
python-telegram-bot | src/telegram/ext/_utils/_update_parsing.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 50 | 1,904 |
python-telegram-bot | src/telegram/ext/_utils/networkloop.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 201 | 7,830 |
python-telegram-bot | src/telegram/ext/_utils/webhookhandler.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 224 | 7,986 |
python-telegram-bot | src/telegram/ext/_utils/stack.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 77 | 2,556 |
python-telegram-bot | src/telegram/request/_httpxrequest.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 306 | 13,293 |
python-telegram-bot | src/telegram/request/_baserequest.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 445 | 19,597 |
python-telegram-bot | src/telegram/request/_requestparameter.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published... | 208 | 9,087 |
python-telegram-bot | src/telegram/request/_requestdata.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published... | 144 | 5,597 |
python-telegram-bot | src/telegram/_utils/types.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 108 | 4,281 |
python-telegram-bot | src/telegram/_utils/logging.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 51 | 1,940 |
python-telegram-bot | src/telegram/_utils/files.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 161 | 5,984 |
python-telegram-bot | src/telegram/_utils/strings.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 56 | 1,802 |
python-telegram-bot | src/telegram/_utils/repr.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 47 | 1,834 |
python-telegram-bot | src/telegram/_utils/enum.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 92 | 3,008 |
python-telegram-bot | src/telegram/_utils/usernames.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 110 | 3,559 |
python-telegram-bot | src/telegram/_utils/warnings_transition.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 117 | 4,105 |
python-telegram-bot | src/telegram/_utils/warnings.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 57 | 2,140 |
python-telegram-bot | src/telegram/_utils/datetime.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 290 | 11,804 |
python-telegram-bot | src/telegram/_utils/defaultvalue.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 150 | 4,293 |
python-telegram-bot | src/telegram/_utils/entities.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 74 | 3,013 |
python-telegram-bot | src/telegram/_utils/de_json.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 137 | 4,936 |
python-telegram-bot | src/telegram/_utils/argumentparsing.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 93 | 3,101 |
python-telegram-bot | src/telegram/_utils/markup.py | .py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2026
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | 51 | 2,099 |
d2l-en | setup.py | .py | from setuptools import setup, find_packages
import d2l
requirements = [
'jupyter==1.0.0',
'numpy==1.23.5',
'matplotlib==3.7.2',
'matplotlib-inline==0.1.6',
'requests==2.31.0',
'pandas==2.0.3',
'scipy==1.10.1'
]
setup(
name='d2l',
version=d2l.__version__,
python_requires='>=3.8'... | 27 | 566 |
d2l-en | d2l/__init__.py | .py | """Saved source code for "Dive into Deep Learning" (https://d2l.ai).
Please import d2l by one of the following ways:
from d2l import mxnet as d2l # Use MXNet as the backend
from d2l import torch as d2l # Use PyTorch as the backend
from d2l import tensorflow as d2l # Use TensorFlow as the backend
from d2l import ja... | 13 | 383 |
d2l-en | d2l/jax.py | .py | DATA_HUB = dict()
DATA_URL = 'http://d2l-data.s3-accelerate.amazonaws.com/'
import jax
import flax
from jax import numpy as jnp
from flax import linen as nn
import random
get_seed = lambda: random.randint(0, 1e6)
get_key = lambda: jax.random.PRNGKey(get_seed())
nn_Module = nn.Module
################# WARNING #... | 1,584 | 60,703 |
d2l-en | d2l/torch.py | .py | DATA_HUB = dict()
DATA_URL = 'http://d2l-data.s3-accelerate.amazonaws.com/'
import numpy as np
import torch
import torchvision
from PIL import Image
from torch import nn
from torch.nn import functional as F
from torch.utils import data
from torchvision import transforms
nn_Module = nn.Module
################# WARN... | 3,516 | 139,955 |
d2l-en | d2l/mxnet.py | .py | USE_MXNET = True
USE_PYTORCH = False
USE_TENSORFLOW = False
DATA_HUB = dict()
DATA_URL = 'http://d2l-data.s3-accelerate.amazonaws.com/'
from mxnet import autograd, context, gluon, image, init, np, npx
from mxnet.gluon import nn, rnn
from mxnet.gluon.data.vision import transforms
nn_Module = nn.Block
###############... | 3,376 | 137,105 |
d2l-en | d2l/tensorflow.py | .py | DATA_HUB = dict()
DATA_URL = 'http://d2l-data.s3-accelerate.amazonaws.com/'
import numpy as np
import tensorflow as tf
nn_Module = tf.keras.Model
################# WARNING ################
# The below part is generated automatically through:
# d2lbook build lib
# Don't edit it directly
import collections
imp... | 2,004 | 76,589 |
d2l-en | static/post_latex/main.py | .py | import os
import re
import regex
import sys
def _unnumber_chaps_and_secs(lines):
# Preface, Installation, and Notation are unnumbered chapters
NUM_UNNUMBERED_CHAPS = 3
# Prelimilaries
TOC2_START_CHAP_NO = 5
preface_reached = False
ch2_reached = False
num_chaps = 0
for i, l in enumerat... | 297 | 10,905 |
d2l-en | ci/submit-job.py | .py | import argparse
import random
import os
import re
import sys
import time
from datetime import datetime
import boto3
from botocore.compat import total_seconds
from botocore.config import Config
job_type_info = {
'ci-cpu': {
'job_definition': 'd2l-ci-cpu-builder:2',
'job_queue': 'D2L-CI-CPU'
},... | 203 | 7,554 |
data-science-ipython-notebooks | analyses/churn_measurements.py | .py | from __future__ import division
import numpy as np
__author__ = "Eric Chiang"
__email__ = "eric[at]yhathq.com"
"""
Measurements inspired by Philip Tetlock's "Expert Political Judgment"
Equations take from Yaniv, Yates, & Smith (1991):
"Measures of Descrimination Skill in Probabilistic Judgement"
"""
def calib... | 90 | 2,795 |
data-science-ipython-notebooks | deep-learning/theano-tutorial/scan_tutorial/scan_ex2_solution.py | .py | import theano
import theano.tensor as T
import numpy as np
probabilities = T.vector()
nb_samples = T.iscalar()
rng = T.shared_randomstreams.RandomStreams(1234)
def sample_from_pvect(pvect):
""" Provided utility function: given a symbolic vector of
probabilities (which MUST sum to 1), sample one element
... | 51 | 1,394 |
data-science-ipython-notebooks | deep-learning/theano-tutorial/scan_tutorial/scan_ex1_solution.py | .py | import theano
import theano.tensor as T
import numpy as np
coefficients = T.vector("coefficients")
x = T.scalar("x")
max_coefficients_supported = 10000
def step(coeff, power, prior_value, free_var):
return prior_value + (coeff * (free_var ** power))
# Generate the components of the polynomial
full_range = T.ara... | 29 | 952 |
data-science-ipython-notebooks | deep-learning/theano-tutorial/intro_theano/utils.py | .py | """ This file contains different utility functions that are not connected
in anyway to the networks presented in the tutorials, but rather help in
processing the outputs into a more understandable way.
For example ``tile_raster_images`` helps in generating a easy to grasp
image from a set of samples or weights.
"""
... | 141 | 5,130 |
data-science-ipython-notebooks | deep-learning/theano-tutorial/rnn_tutorial/synthetic.py | .py | import collections
import numpy as np
def mackey_glass(sample_len=1000, tau=17, seed=None, n_samples = 1):
'''
mackey_glass(sample_len=1000, tau=17, seed = None, n_samples = 1) -> input
Generate the Mackey Glass time-series. Parameters are:
- sample_len: length of the time-series in timesteps. Def... | 86 | 2,930 |
data-science-ipython-notebooks | deep-learning/theano-tutorial/rnn_tutorial/lstm_text.py | .py | import cPickle as pkl
import time
import numpy
import theano
from theano import config
import theano.tensor as T
from theano.tensor.nnet import categorical_crossentropy
from fuel.datasets import TextFile
from fuel.streams import DataStream
from fuel.schemes import ConstantScheme
from fuel.transformers import Batch, P... | 300 | 11,250 |
data-science-ipython-notebooks | deep-learning/theano-tutorial/rnn_tutorial/rnn_precompile.py | .py | """This file is only here to speed up the execution of notebooks.
It contains a subset of the code defined in simple_rnn.ipynb and
lstm_text.ipynb, in particular the code compiling Theano function.
Executing this script first will populate the cache of compiled C code,
which will make subsequent compilations faster.
... | 235 | 8,337 |
data-science-ipython-notebooks | deep-learning/tensor-flow-examples/input_data.py | .py | """Functions for downloading and reading MNIST data."""
from __future__ import print_function
import gzip
import os
import urllib
import numpy
SOURCE_URL = 'http://yann.lecun.com/exdb/mnist/'
def maybe_download(filename, work_directory):
"""Download the data from Yann's website, unless it's already here."""
if not ... | 144 | 5,709 |
data-science-ipython-notebooks | deep-learning/tensor-flow-examples/multigpu_basics.py | .py | #Multi GPU Basic example
'''
This tutorial requires your machine to have 2 GPUs
"/cpu:0": The CPU of your machine.
"/gpu:0": The first GPU of your machine
"/gpu:1": The second GPU of your machine
'''
import numpy as np
import tensorflow as tf
import datetime
#Processing Units logs
log_device_placement = True
#num of... | 85 | 2,031 |
data-science-ipython-notebooks | deep-learning/keras-tutorial/w2v.py | .py | from gensim.models import word2vec
from os.path import join, exists, split
import os
import numpy as np
def train_word2vec(sentence_matrix, vocabulary_inv,
num_features=300, min_word_count=1, context=10):
"""
Trains, saves, loads Word2Vec model
Returns initial weights for embedding layer... | 58 | 2,550 |
data-science-ipython-notebooks | deep-learning/keras-tutorial/data_helpers.py | .py | import numpy as np
import re
import itertools
from collections import Counter
"""
Original taken from https://github.com/dennybritz/cnn-text-classification-tf
"""
def clean_str(string):
"""
Tokenization/string cleaning for all datasets except for SST.
Original taken from https://github.com/yoonkim/CNN_sent... | 116 | 4,273 |
data-science-ipython-notebooks | deep-learning/keras-tutorial/solutions/sol_111.py | .py | ann = ANN(2, 10, 1)
%timeit -n 1 -r 1 ann.train(zip(X,y), iterations=2)
plot_decision_boundary(ann)
plt.title("Our next model with 10 hidden units")
| 5 | 149 |
data-science-ipython-notebooks | deep-learning/keras-tutorial/solutions/sol_112.py | .py | ann = ANN(2, 10, 1)
%timeit -n 1 -r 1 ann.train(zip(X,y), iterations=100)
plot_decision_boundary(ann)
plt.title("Our model with 10 hidden units and 100 iterations")
| 5 | 165 |
data-science-ipython-notebooks | deep-learning/keras-tutorial/deep_learning_models/vgg19.py | .py | # -*- coding: utf-8 -*-
'''VGG19 model for Keras.
# Reference:
- [Very Deep Convolutional Networks for Large-Scale Image Recognition](https://arxiv.org/abs/1409.1556)
'''
from __future__ import print_function
import numpy as np
import warnings
from keras.models import Model
from keras.layers import Flatten, Dense,... | 168 | 7,444 |
data-science-ipython-notebooks | deep-learning/keras-tutorial/deep_learning_models/imagenet_utils.py | .py | import numpy as np
import json
from keras.utils.data_utils import get_file
from keras import backend as K
CLASS_INDEX = None
CLASS_INDEX_PATH = 'https://s3.amazonaws.com/deep-learning-models/image-models/imagenet_class_index.json'
def preprocess_input(x, dim_ordering='default'):
if dim_ordering == 'default':
... | 44 | 1,233 |
data-science-ipython-notebooks | deep-learning/keras-tutorial/deep_learning_models/vgg16.py | .py | # -*- coding: utf-8 -*-
'''VGG16 model for Keras.
# Reference:
- [Very Deep Convolutional Networks for Large-Scale Image Recognition](https://arxiv.org/abs/1409.1556)
'''
from __future__ import print_function
import numpy as np
import warnings
from keras.models import Model
from keras.layers import Flatten, Dense,... | 166 | 7,227 |
data-science-ipython-notebooks | deep-learning/keras-tutorial/deep_learning_models/resnet50.py | .py | # -*- coding: utf-8 -*-
'''ResNet50 model for Keras.
# Reference:
- [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385)
Adapted from code contributed by BigMoyan.
'''
from __future__ import print_function
import numpy as np
import warnings
from keras.layers import merge, Input
from ker... | 247 | 10,194 |
data-science-ipython-notebooks | scikit-learn/fig_code/sgd_separator.py | .py | import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import SGDClassifier
from sklearn.datasets.samples_generator import make_blobs
def plot_sgd_separator():
# we create 50 separable points
X, Y = make_blobs(n_samples=50, centers=2,
random_state=0, cluster_std=0.60... | 41 | 1,148 |
data-science-ipython-notebooks | scikit-learn/fig_code/svm_gui.py | .py | """
==========
Libsvm GUI
==========
A simple graphical frontend for Libsvm mainly intended for didactic
purposes. You can create data points by point and click and visualize
the decision region induced by different kernels and parameter settings.
To create positive examples click the left mouse button; to create
neg... | 342 | 11,549 |
data-science-ipython-notebooks | scikit-learn/fig_code/data.py | .py | import numpy as np
def linear_data_sample(N=40, rseed=0, m=3, b=-2):
rng = np.random.RandomState(rseed)
x = 10 * rng.rand(N)
dy = m / 2 * (1 + rng.rand(N))
y = m * x + b + dy * rng.randn(N)
return (x, y, dy)
def linear_data_sample_big_errs(N=40, rseed=0, m=3, b=-2):
rng = np.random.RandomS... | 48 | 980 |
data-science-ipython-notebooks | scikit-learn/fig_code/figures.py | .py | import numpy as np
import matplotlib.pyplot as plt
import warnings
def plot_venn_diagram():
fig, ax = plt.subplots(subplot_kw=dict(frameon=False, xticks=[], yticks=[]))
ax.add_patch(plt.Circle((0.3, 0.3), 0.3, fc='red', alpha=0.5))
ax.add_patch(plt.Circle((0.6, 0.3), 0.3, fc='blue', alpha=0.5))
ax.add... | 234 | 8,633 |
data-science-ipython-notebooks | scikit-learn/fig_code/linear_regression.py | .py | import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
def plot_linear_regression():
a = 0.5
b = 1.0
# x from 0 to 10
x = 30 * np.random.random(20)
# y = a*x + b with noise
y = a * x + b + np.random.normal(size=x.shape)
# create a linear reg... | 38 | 735 |
data-science-ipython-notebooks | scikit-learn/fig_code/helpers.py | .py | """
Small helpers for code that is not shown in the notebooks
"""
from sklearn import neighbors, datasets, linear_model
import pylab as pl
import numpy as np
from matplotlib.colors import ListedColormap
# Create color maps for 3-class classification problem, as with iris
cmap_light = ListedColormap(['#FFAAAA', '#AAFF... | 76 | 2,301 |
data-science-ipython-notebooks | scikit-learn/fig_code/ML_flow_chart.py | .py | """
Tutorial Diagrams
-----------------
This script plots the flow-charts used in the scikit-learn tutorials.
"""
import numpy as np
import pylab as pl
from matplotlib.patches import Circle, Rectangle, Polygon, Arrow, FancyArrow
def create_base(box_bg = '#CCCCCC',
arrow1 = '#88CCFF',
... | 136 | 4,970 |
data-science-ipython-notebooks | mapreduce/mr_s3_log_parser.py | .py |
import time
from mrjob.job import MRJob
from mrjob.protocol import RawValueProtocol, ReprProtocol
import re
class MrS3LogParser(MRJob):
"""Parses the logs from S3 based on the S3 logging format:
http://docs.aws.amazon.com/AmazonS3/latest/dev/LogFormat.html
Aggregates a user's daily requests by user ... | 137 | 4,497 |
data-science-ipython-notebooks | mapreduce/test_mr_s3_log_parser.py | .py |
from StringIO import StringIO
import unittest2 as unittest
from mr_s3_log_parser import MrS3LogParser
class MrTestsUtil:
def run_mr_sandbox(self, mr_job, stdin):
# inline runs the job in the same process so small jobs tend to
# run faster and stack traces are simpler
# --no-conf prevents... | 88 | 3,179 |
data-science-ipython-notebooks | python-data/transform_util.py | .py | import re
class TransformUtil:
@classmethod
def remove_punctuation(cls, value):
"""Removes !, #, and ?.
"""
return re.sub('[!#?]', '', value)
@classmethod
def clean_strings(cls, strings, ops):
"""General purpose method to clean strings.
Pass in a se... | 23 | 571 |
data-science-ipython-notebooks | python-data/type_util.py | .py | class TypeUtil:
@classmethod
def is_iterable(cls, obj):
"""Determines if obj is iterable.
Useful when writing functions that can accept multiple types of
input (list, tuple, ndarray, iterator). Pairs well with
convert_to_list.
"""
try:
iter(obj)
... | 24 | 680 |
data-science-ipython-notebooks | python-data/tests/test_transform_util.py | .py | from nose.tools import assert_equal
from ..transform_util import TransformUtil
class TestTransformUtil():
states = [' Alabama ', 'Georgia!', 'Georgia', 'georgia', \
'FlOrIda', 'south carolina##', 'West virginia?']
expected_output = ['Alabama',
'Georgia',
... | 29 | 1,046 |
data-science-ipython-notebooks | python-data/tests/test_type_util.py | .py | from nose.tools import assert_equal
from ..type_util import TypeUtil
class TestUtil():
def test_is_iterable(self):
assert_equal(TypeUtil.is_iterable('foo'), True)
assert_equal(TypeUtil.is_iterable(7), False)
def test_convert_to_list(self):
assert_equal(isinstance(TypeUtil.convert_to_... | 13 | 420 |
data-science-ipython-notebooks | data/titanic/myfirstforest.py | .py | """ Writing my first randomforest code.
Author : AstroDave
Date : 23rd September 2012
Revised: 15 April 2014
please see packages.python.org/milk/randomforests.html for more
"""
import pandas as pd
import numpy as np
import csv as csv
from sklearn.ensemble import RandomForestClassifier
# Data cleanup
# TRAIN DATA
tra... | 98 | 4,081 |
data-science-ipython-notebooks | data/titanic/gendermodel.py | .py | """ This simple code is desinged to teach a basic user to read in the files in python, simply find what proportion of males and females survived and make a predictive model based on this
Author : AstroDave
Date : 18 September 2012
Revised: 28 March 2014
"""
import csv as csv
import numpy as np
csv_file_object = csv... | 76 | 3,666 |
data-science-ipython-notebooks | data/titanic/genderclassmodel.py | .py | """ Now that the user can read in a file this creates a model which uses the price, class and gender
Author : AstroDave
Date : 18th September 2012
Revised : 28 March 2014
"""
import csv as csv
import numpy as np
csv_file_object = csv.reader(open('train.csv', 'rb')) # Load in the csv file
header = csv_file_obj... | 113 | 5,760 |
data-science-ipython-notebooks | scipy/first.py | .py | """This file contains code used in "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import math
import numpy as np
import nsfg
import thinkstats2
import thinkplot
def... | 161 | 4,169 |
data-science-ipython-notebooks | scipy/thinkplot.py | .py | """This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import math
import matplotlib
import matplotlib.pyplot as pyplot
import numpy as... | 717 | 18,140 |
data-science-ipython-notebooks | scipy/thinkstats2.py | .py | """This file contains code for use with "Think Stats" and
"Think Bayes", both by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function, division
"""This file contains class definitions for:
H... | 2,802 | 68,825 |
data-science-ipython-notebooks | scipy/nsfg.py | .py | """This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2010 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
from collections import defaultdict
import numpy as np
import sys
import thinks... | 107 | 3,012 |
GitHub520 | fetch_ips.py | .py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Author : XueWeiHan
# E-mail : 595666367@qq.com
# Date : 2020-05-19 15:27
# Desc : 获取最新的 GitHub 相关域名对应 IP
from typing import Any, Dict, List, Optional
from datetime import datetime
import socket
import time
import sys
import asyncio
import aiodn... | 183 | 5,773 |
GitHub520 | common.py | .py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Author : XueWeiHan
# E-mail : 595666367@qq.com
# Date : 2025-01-16 15:27
# Desc : 公共函数
import os
import json
from typing import Any, Optional
from datetime import datetime, timezone, timedelta
from retry import retry
GITHUB_URLS = [
'alive.g... | 106 | 4,256 |
GitHub520 | update_ips.py | .py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Author : XueWeiHan
# E-mail : 595666367@qq.com
# Date : 2025-01-16 15:27
# Desc : GitHub Action 运行的脚本
import json
from typing import Any, Optional
import requests
from retry import retry
from common import write_hosts_content
@retry(tries=3)
d... | 43 | 987 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.