content stringlengths 7 928k | language stringclasses 1
value |
|---|---|
from pygments.lexers import Python3Lexer
from pygments.token import Comment, Keyword, Name, Number, Operator, Punctuation, String
def is_comment(token):
return token in Comment
def is_decorator(token):
return token in Name.Decorator
def is_function(token):
return token in Name.Function
def is_builti... | Python |
# vmimages.py - azurerm functions for Microsoft.Compute RP publishers and images
from .restfns import do_get
from .settings import azure_rm_endpoint, COMP_API
# list_offers(access_token, subscription_id, location, publisher)
# list available VM image offers from a publisher
def list_offers(access_token, subscription... | Python |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | Python |
import os
import random
from riscv_definitions import *
NONE = 0
CF_J = 1
CF_BR = 2
CF_RET = 3
MEM_R = 4
MEM_W = 5
CSR = 6
PREFIX = '_p'
MAIN = '_l'
SUFFIX = '_s'
class Word():
def __init__(self, label: int, insts: list, tpe=NONE, xregs=[], fregs=[], imms=[], symbols=[], populated=False):
se... | Python |
from __future__ import print_function
import os
import time
import random
import datetime
import scipy.misc
import numpy as np
import tensorflow as tf
import tensorflow.contrib.slim as slim
from datetime import datetime
from util.util import *
from util.BasicConvLSTMCell import *
class DEBLUR(object):
def __init_... | Python |
from datetime import datetime
import json
from unittest import TestCase
from celery.schedules import schedule, crontab
try: # celery 3.x
from celery.utils.timeutils import timezone
except ImportError: # celery 4.x
from celery.utils.time import timezone
from redbeat.decoder import RedBeatJSONDecoder, RedBeat... | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
import json
import datetime
url = 'https://endpoints.office.com/endpoints/worldwide?clientrequestid=b10c5ed1-bad1-445f-b386-b919946339a7'
r = requests.get(url)
service_list = r.json()
lurls= []
lips = []
for service in service_list:
for url in servic... | Python |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
import numpy as np
from numpy.testing import assert_allclose
from vispy.util.transforms import (translate, scale, rotate, ortho, frustum,
pe... | Python |
# Uses python3
import sys
def get_change(money, coins):
t = [j+1 for j in range(money+1)]
# boundary condition
t[0] = 0
for j in range(1, money+1):
for c in coins:
if c <= j:
t[j] = min(t[j], 1+t[j-c])
return t[money]
if __name__ == '__main__':
coins =... | Python |
import os
import torch
import os
import random
from torch.nn import(
Module,Linear,LayerNorm
)
import math
from .AutoEncoder import Encoder
class DeltaT(Module):
def __init__(self):
super().__init__()
self.reset_seed()
self.elem = math.prod(Encoder().output_size)
self.input_size... | Python |
import asyncio
import logging
import ssl
import time
import traceback
from ipaddress import IPv6Address, ip_address, ip_network, IPv4Network, IPv6Network
from pathlib import Path
from secrets import token_bytes
from typing import Any, Callable, Dict, List, Optional, Union, Set, Tuple
from aiohttp import ClientSession,... | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('data', '0002_auto_20141114_1935'),
]
operations = [
migrations.RemoveField(
model_name='registryentry',
... | Python |
from python_dwd.additionals.functions import check_parameters, retrieve_time_resolution_from_filename,\
retrieve_parameter_from_filename, retrieve_period_type_from_filename, determine_parameters
from python_dwd.enumerations.period_type_enumeration import PeriodType
from python_dwd.enumerations.time_resolution_enume... | Python |
import praw
c_id='34kxuaxc4yWiKw'
c_secret='8bJqHqNHFdB6NKV9sHzFbo4_Dl4'
ua='my user agent'
un='the_ugly_bot'
pwd='whatever930'
def login():
r = praw.Reddit(client_id=c_id,
client_secret=c_secret,
user_agent=ua,
username=un,
passwor... | Python |
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | Python |
from .utils import make_cobertura
def remove_style_tag(html):
style_pattern_start = '\n <style>'
style_pattern_stop = '\n </style>'
style_starts = html.find(style_pattern_start)
style_stops = html.find(style_pattern_stop) + len(style_pattern_stop)
html_nostyle = html[:style_starts] + html[st... | Python |
import pytest
from exchange_calendars.exchange_calendar_xshg import XSHGExchangeCalendar
from .test_exchange_calendar import ExchangeCalendarTestBase
from .test_utils import T
class TestXSHGCalendar(ExchangeCalendarTestBase):
@pytest.fixture(scope="class")
def calendar_cls(self):
yield XSHGExchangeCa... | Python |
#For the whatsapp statuses url given below
#COOL
import requests
from bs4 import BeautifulSoup
url_to_scrape = 'https://www.appstatustxt.com/cool-whatsapp-status/'
r = requests.get(url_to_scrape)
soup = BeautifulSoup(r.text,"html5lib")
status_object=[]
statuses=[]
title=soup.title.string
print(title)
status_... | Python |
import copy
import datetime
import decimal
import inspect
import json
import logging
import traceback
import uuid
import warnings
from collections import Counter, defaultdict, namedtuple
from collections.abc import Hashable
from functools import wraps
from typing import List
from dateutil.parser import parse
from gre... | Python |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 10