content stringlengths 5 1.05M |
|---|
import setuptools
setuptools.setup(
name="EpiForecastStatMech",
version="0.2",
packages=setuptools.find_packages(),
install_requires=[
"absl-py",
"numpy",
"scipy",
"pandas",
"matplotlib",
"seaborn",
"sklearn",
# "tensorflow", # revert bac... |
# This file is part of Cryptography GUI, licensed under the MIT License.
# Copyright (c) 2020 Benedict Woo Jun Kai
# See LICENSE.md for more details.
######################################
# Import and initialize the librarys #
######################################
import logging
import webbrowser
from item_storage ... |
# Copyright (C) 2014-2019 Tormod Landet
# SPDX-License-Identifier: Apache-2.0
import dolfin
from dolfin import Function, Constant
from ocellaris.solver_parts import SlopeLimiter
from . import register_multi_phase_model, MultiPhaseModel
from ..convection import get_convection_scheme, StaticScheme, VelocityDGT0Projector... |
#Nonebot plugin
#AutoWhiteList
#__init__.py
#Author:dixiatielu
from nonebot import on_command, CommandSession
from nonebot import on_natural_language, NLPSession, IntentCommand
from .data_source import get_whitelist
__plugin_name__ = '自动白名单'
__plugin_usage__ = r'''
自动白名单
含有自然语言处理功能
用你最自然的语言,让我为你加上Minecraft服务器的白名单吧!... |
from ..hidro.basin import BasinApi
from ..hidro.stations import Stations
from ..hidro.serie_temporal import SerieTemporal
from ..hidro.entities import EntityApi
__init__ = ["BasinApi", "Stations", "SerieTemporal", "EntityApi"]
|
import itertools
def Process2LineGraph(size, edge, label):
nText = ['' for _ in range(size)]
nEdge = [[], []]
# Process Nodes (text)
for i, (u, v) in enumerate(zip(*edge)):
nText[v] += label[i]
# Process Edges
def push2Edge(edges, type):
if type == 1:
for u, v in edges:
nEdge[0].app... |
import boto3
import uuid
import json
from socket import gethostbyname, gaierror
from inspect import stack
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def blacklist_ip(ip_address):
try:
client = boto3.client('ec2')
nacls = client.describe_network_acls()
for n... |
#!/usr/bin/env python3
"""Find the 9 hashes needed for subscription local geo realtime updates"""
__author__ = "H. Martin"
__version__ = "0.1.0"
import argparse
import geohash
import json
import redis
from http.server import BaseHTTPRequestHandler, HTTPServer
from optparse import OptionParser
from urllib.parse impor... |
# Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import sympy
import sympy as sp
from sympy.core.relational import Relational
from Abstract.equation import Equation
class SymEquation(Equation):
"""
Concrete equation built based purely on sympy.core.relational.Relational class
"""
symq: sp.core.relational
def set_type(self, mode):
self.... |
import tensorflow as tf
# Inception module 1
def Inception_traditional(Inputs, nfilters_11=64, nfilters_11Before33=64,
nfilters_11Before55=48, nfilters_11After33Pool=32,
nfilters_33=96, nfilters_55=64, name=None):
'''
最基本的Inception模块,拼接不同感受野的卷积结果
其实传入的参数还... |
#!/usr/bin/env python
###############################################################################
# Copyright (C) 1994 - 2009, Performance Dynamics Company #
# #
# This software is licensed as described in the file COPY... |
import os
import json
import unittest
from unittest.mock import MagicMock
from py_client import Client, ResponseStatus
from py_client.models import LoginResponseModel
from py_client.modules.holdings_limits.models import *
from py_client.modules.holdings_limits import endpoints
from .common import create_login_model
... |
import os
import sys
import argparse
import logging
import time
import cProfile
from .builder import Builder
from .server import SampleServer
from .lexer import Lexer
from .parser import Parser
from .formatter import Formatter
from .transform import TransformMinifyScope
def makedirs(path):
if not... |
import fitbit
import gather_keys_oauth2 as Oauth2
import pandas as pd
import datetime
import os.path as osp
import os
# ************ UBC MIST Account *********
# CLIENT_ID ='22DF24'
# CLIENT_SECRET = '7848281e9151008de32698f7dd304c68'
# ************ Hooman's Account *********
CLIENT_ID ='22D68G'
CLIENT_SECRET = '32e2... |
n=1
while n<=20:
print n
n +=1
|
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Run: python3 cratesio-temporal-changes <path-to-crates.io-index> <path-to-dylib>
Return csv-file with resolved edges
"""
import sys
import json
from pathlib import Path
from ctypes import cdll, c_bool, c_void_p, cast, c_char_p, c_int32
assert len(sys.argv) == 3
... |
import yaml
import argparse
from source.knn import create_knn
from source.cdp import cdp
def main():
parser = argparse.ArgumentParser(description="CDP")
parser.add_argument('--config', default='', type=str)
args = parser.parse_args()
with open(args.config) as f:
config = yaml.load(f)
for k... |
import subprocess
import configparser
import datetime
import tempfile
import shutil
import jinja2
import os
repo_name = input("Input repository name: ").replace(" ", "_")
repo_path = os.path.join("/", "srv", "git", repo_name + ".git")
if os.path.exists(repo_path):
print("ERROR: A repository with that name already... |
import pygame as pg
import sys, time
import random
pg.init()
#initilization of certain variables
mode = 0
#can change screen size
size = (width, height) = (1280, 720)
sea = (46,139,87)
pink = (254,171,185)
Background = (0,144,158)
red = (255,0,0)
green = (0,255,0)
#Can change squareSize
squareSize ... |
import AMC
import time
IP = "192.168.1.1"
# Setup connection to AMC
amc = AMC.Device(IP)
amc.connect()
# Activate axis 1
# Internally, axes are numbered 0 to 2
axis = 0 # Axis 1
amc.control.setControlOutput(axis, True)
# Check if open loop positioner is connected
OL = 1
if amc.status.getOlStatus(axis) == OL:
#... |
"""Strategy Design Pattern
Here we design strategies as classes.
"""
class MyClass:
def __init__(self, strategy=None):
class BasicStrategy:
def method1(self, name):
print("Dummy1", name)
def method2(self, name):
print("Dummy2", name)
if strategy:
self.strategy = strategy
else:
self.s... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-08-24 17:08
# pylint: skip-file
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('passive_data_kit', '0026_dataservermetadata'),
]
operations = [
migrations.RenameModel(
o... |
import numpy as np
def best_values(series, nb=None, min_count=None):
"""Return unique values in series ordered by most to less occurrences"""
occurrences = series.value_counts()
if min_count:
occurrences = occurrences[occurrences > min_count]
nb = len(occurrences) if nb is None else nb
ret... |
# Generated by Django 2.2.9 on 2019-12-28 17:00
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import phonenumber_field.modelfields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... |
from . import Choice, Result_T
from .boolean import BooleanPrompt
from .select import SelectPrompt
from .text import TextPrompt
class FChoice(Choice[Result_T]):
def __init__(self, value: Result_T):
self.name = str(value)
self.data = value
|
# Copyright 2019 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import logging
from typing import Union
import discord
from discord.ext import commands
log = logging.getLogger(__name__)
class DebugMessageLogger(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_message(self, message: discord.Message):
chann... |
## Import the required modules
# Check time required
import time
time_start = time.time()
import sys
import os
import argparse as ap
import math
import imageio
from moviepy.editor import *
import numpy as np
sys.path.append(os.path.dirname(__file__) + "/../")
from scipy.misc import imread, imsave
from config imp... |
"""Conversions between different network parameters (S, Z, Y, T, ABCD)."""
import numpy as np
# S-parameters to ... --------------------------------------------------------
# def s_to_zparam(sparam, z0):
# """Convert S-parameters to Z-parameters.
# Args:
# sparam (ndarray): S-parameters
# ... |
from ._common import ParticleArray
import numpy as np
import pandas as pd
from softnanotools.logger import Logger
logger = Logger(__name__)
class Salt(ParticleArray):
def __init__(self, item, **kwargs):
ParticleArray.__init__(self, item, **kwargs)
# charge on each species
self.anion = flo... |
# -*- coding: utf-8 -*-
import os
from collections import OrderedDict
import yaml
from restapi.utilities.logs import log
PROJECTS_DEFAULTS_FILE = 'projects_defaults.yaml'
PROJECT_CONF_FILENAME = 'project_configuration.yaml'
def read_configuration(
default_file_path, base_project_path, projects_path, submod... |
import cv2
import matplotlib.pyplot as plt
import numpy as np
import detect_lincense
def split_lincense_horizontally(image):
if isinstance(image, str):
img = cv2.imread(image)
else:
img = image
# 彩色图转灰度图, opencv读取图片通道顺序默认是bgr, 而非一半的rgb.
gray = cv2.cvtColor(img, cv2.COLOR_BG... |
from django.urls import path, include
from django.conf.urls import url
from .views import PostViewSet
from rest_framework.routers import DefaultRouter
import dedicated_page.views as dedicated_page_views
from django.views.generic import TemplateView
router = DefaultRouter()
router.register('post', PostViewSet, basena... |
import logging
import boto3
import os
import json
from random import shuffle
from mail_handlers import ses_handler, mailgun_handler
# TODO
# Should using the deadletter queue, at the moment the naive approach
# is adding a message, when it has been 'taken' three times from the queue.
def setup_handlers():
'''
... |
#A PushBuffer is an iterable that contains a fixed number of items
#When a new item is pushed into a PushBuffer, it will be placed in the front (lowest index)
# and all other items are shifted one place higher
#If pushing a new item would require more space than the size allows,
# the oldest item (highest index) is di... |
"""Start a hyperoptimization from a single node"""
import sys
import numpy as np
import pickle as pkl
import hyperopt
from hyperopt import hp, fmin, tpe, Trials
import pysr
import time
import contextlib
@contextlib.contextmanager
def temp_seed(seed):
state = np.random.get_state()
np.random.seed(seed)
try... |
# Copyright 2016 Google Inc. 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 applicable law or a... |
from .parser import CContext, CEnum, CBitmask, CStruct, CType, CHandle, CMember, CCommand, CAlias
from . import typeconversion as tc
from typing import Optional, Tuple, List, Dict
import re
class SwiftEnum(CEnum):
def __init__(self, c_enum: CEnum, raw_type: str, error: bool = False, **kwargs):
super().__i... |
def calculate_area(rc):
return rc.width * rc.height
|
import torch
import pandas as pd
import numpy as np
from os import path
from torch.utils.data import Dataset, sampler
from scipy.ndimage.filters import gaussian_filter
class MRIDataset(Dataset):
"""Dataset of MRI organized in a CAPS folder."""
def __init__(self, img_dir, data_file, preprocessing='linear', tr... |
#! usr/bin/python3.6
"""
Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-06-11 12:40:47.360445
.. warning::
The notes denoted "CAA V5 Visual Basic Help" are to be used as reference only.
They are there as a guide as to how the visual basic / catscript function... |
"""
The util module contains various utility functions.
"""
from __future__ import print_function
import argparse
import binascii
import re
import sys
from six.moves import range
import pwnypack.codec
import pwnypack.main
__all__ = [
'cycle',
'cycle_find',
'reghex',
]
def deBruijn(n, k):
"""
... |
# import turtle
import time
import datetime
import pytz
#
# # noinspection PyUnresolvedReferences
# # comment above was used to remove the warning due t o a bug in the turtle module
#
# turtle.forward(150)
# turtle.right(250)
# turtle.forward(150)
#
# time.sleep(5)
# ====================================
# import rando... |
# Copyright 2020 The TensorFlow Authors. 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 applica... |
from __future__ import print_function
import re
import sys
import api
import config
_VALID_SORTS = [
'Number',
'YearFrom',
'YearFromDESC',
'Pieces',
'PiecesDESC',
'Minifigs',
'MinifigsDESC',
'Rating',
'UKRetailPrice',
'UKRetailPriceDESC',
'USRetailPrice',
'USRetailPric... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import lxml
import lxml.html
import os
import hashlib
import jieba
from gensim.models import Word2Vec
import content_extract as ce
import text_util
def cache_dir():
work_dir = os.path.dirname(os.path.realpath(__file__)) + "/.cache"
if not os.path.isd... |
import sys
#import GRASP to use its thread safe print function
#sys.path.insert(0, 'graspy/')
#from grasp import tprint
from _thread import start_new_thread
from queue import Queue
#import all the modules
import GRASP_RegServer
#import TLS_Server
import NETCONF_client
import REST_Server
def main(args):
print(... |
from django.contrib import admin
from donations.models import CreditCard, Donation, RecurringDonation
admin.site.register(CreditCard)
admin.site.register(Donation)
admin.site.register(RecurringDonation)
|
from .optimizer import Optimizer
from .propellers import DatabaseFitProp, DatabaseDataProp, BladeElementProp
from .electronics import Battery, ESC, Motor
from .propulsion_unit import PropulsionUnit
from .exceptions import ThrottleNotFoundError, MaxCurrentExceededError, DatabaseRecordNotFoundError, TorquesNotMatchedErro... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'filter.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectN... |
from django.http.response import HttpResponseRedirect
from django.shortcuts import render
from django.views.decorators.csrf import csrf_protect
from django.urls.base import reverse
from axes.utils import reset
from bluebottle.bluebottle_dashboard.forms import AxesCaptchaForm
from bluebottle.utils.utils import get_cli... |
from setuptools import setup, find_packages
def read(f):
return open(f, 'r', encoding='utf-8').read()
setup(
name='ajelastic',
version='1.0.2',
packages=find_packages(exclude=["tests*"]),
url='https://github.com/aasaanjobs/ajelastic-sdk',
license='MIT',
author='Sohel Tarir',
author_e... |
from __future__ import absolute_import, division, print_function
import os
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow.contrib.eager as tfe
def parse_csv(line):
example_defaults = [[0.], [0.], [0.], [0.], [0]] # sets field types
parsed_line = tf.decode_csv(line, example_defaults)
... |
#!/usr/bin/env python3
# Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the ... |
"""
A simple example for Reinforcement Learning using table lookup Q-learning method.
An agent "o" is on the left of a 1 dimensional world, the treasure is on the rightmost location.
Run this program and to see how the agent will improve its strategy of finding the treasure.
View more on my tutorial page: https://morv... |
# This file contains basic statistics functionality. All runtime values are stored
# and can be referenced by name for further usage.
# Author: Stefan Kahl, 2018, Chemnitz University of Technology
import sys
sys.path.append("..")
import copy
import time
import config as cfg
from utils import log
def clearStats(clea... |
"""
Atividade 02
"""
def mes_do_Ano(dia,mes,ano):
if mes == 1:
mes = 'Janeiro'
print(f"{dia} de {mes} de {ano}")
elif mes == 2:
mes = 'Fevereiro'
print(f"{dia} de {mes} de {ano}")
elif mes == 3:
mes = 'Março'
print(f"{dia} de {mes} de {ano}")
elif mes == ... |
from django.contrib.auth.hashers import make_password, check_password
from django.db import models
# Create your models here.
from werkzeug.security import check_password_hash
class AdminUser(models.Model):
a_username = models.CharField(max_length=15,unique=True)
a_password = models.CharField(max_... |
# as_rwGPS.py Asynchronous device driver for GPS devices using a UART.
# Supports a limited subset of the PMTK command packets employed by the
# widely used MTK3329/MTK3339 chip.
# Sentence parsing based on MicropyGPS by Michael Calvin McCoy
# https://github.com/inmcm/micropyGPS
# Copyright (c) 2018 Peter Hinch
# Rele... |
#!/usr/bin/env python
from cloudify import ctx
import os
import yaml
kubeconfig_path = '/home/docker/.kube/config'
kubeconfig_raw = os.popen('sudo cat ' + kubeconfig_path)
kube_config_dict = yaml.safe_load(kubeconfig_raw.read())
ca_path = '/home/docker/.minikube/ca.crt'
ca_raw = os.popen('sudo cat ' + ca_path + ' |... |
import pandas as pd
import tweepy
import webbrowser
import os
import urllib.request
from urllib.error import URLError, HTTPError
def get_twitter_url(LinkCorpus_file):
tweet_urls = []
claim_ids = []
relevant_doc_ids = []
snopes_url = []
count = 0
data = pd.read_csv(LinkCorpus_file)
urls = d... |
import curses, curses.ascii, os
from subprocess import run
os.environ['TERM'] = 'xterm'
screen = curses.initscr()
screen.keypad(True)
screen.notimeout(True)
os.environ.setdefault('ESCDELAY', '0')
os.environ.setdefault('MBC_SEQUENCE_WAIT', '0')
exitmsg = "Ctrl+D to exit \n"
screen.addstr(exitmsg)
screen.refresh()
keyd... |
# -*- coding: utf-8 -*-
"""
trace_simexp._version
*********************
Module with version number unified across project, used in the module,
setup.py, and other command line interfaces.
"""
__version__ = "0.5.0"
|
"""
Implement numerical drop imputer.
"""
from typing import Any, Union, List, Optional
import dask.dataframe as dd
from dask.dataframe import from_pandas
import pandas as pd
class DropImputer:
"""Drop column with missing values
Attributes:
null_values
Specified null values which should b... |
from PIL import Image
import numpy as np
import time
'''将txt里的数据 转为{img,label}的字典格式'''
def make_img_label_dic(_path):
dic_list = []
file = open(_path)
total_imgs = 0
for item in file.readlines():
item = item.strip()
total_imgs = total_imgs + 1
key = item.split(' ')[0]
v... |
import pylab, math
def showGrowth(lower, upper):
log = []
linear = []
quadratic = []
logLinear = []
exponential = []
for n in range(lower, upper+1):
log.append(math.log(n, 2))
linear.append(n)
logLinear.append(n*math.log(n, 2))
quadratic.append(n**2)
expo... |
#!/usr/bin/env python
class P4Dirs(object):
|
result = ''
string = input()
string = string.lower()
for i in range(len(string)):
if (string[i] != 'a' and string[i] != 'o' and
string[i] != 'y' and string[i] != 'e' and
string[i] != 'u' and string[i] != 'i'):
result += '.' + string[i]
print(result) |
"""
This module defines APIs for multitasking and queueing
"""
from __future__ import print_function
# http://stackoverflow.com/a/2740494
# http://stackoverflow.com/a/6319267
# http://stackoverflow.com/a/15144765
from future import standard_library
standard_library.install_aliases()
#from builtins import str
from bui... |
"""The logger class supporting the crawler"""
# Author: Honglin Yu <yuhonglin1986@gmail.com>
# License: BSD 3 clause
import os
import time
class Logger(object):
"""record the crawling status, error and warnings
"""
def __init__(self, outputDir=""):
"""
Arguments:
- `o... |
#!/usr/bin/env python
#
# Public Domain 2014-2017 MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compil... |
import attr
from datetime import datetime
from typing import Optional
@attr.dataclass(frozen=True, slots=True)
class Jurusan:
jurusan_id: int
nama_jurusan: str
untuk_sma: str
untuk_smk: str
untuk_pt: str
untuk_slb: str
untuk_smklb: str
jurusan_induk: Optional[str]
level_bidang_id: ... |
# read test.txt
with open("test.txt") as file:
for line in file:
print(line[0])
|
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2016-2020 German Aerospace Center (DLR) and others.
# SUMOPy module
# Copyright (C) 2012-2017 University of Bologna - DICAM
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 20 11:55:00 2019
@author: github.com/sahandv
"""
import sys
import time
import gc
import collections
import json
import re
import os
import pprint
from random import random
import numpy as np
import pandas as pd
from tqdm import tqdm
import matplot... |
from legacy.crawler import crawler
import os
url = "https://www.wired.com"
output_dir = os.path.join('.', 'data', 'wired.com')
headers = {
'Accept':'application/json, text/javascript, */*; q=0.01',
'Accept-Encoding':'*',
'Accept-Language':'zh-CN,zh;q=0.8',
'Cookie': 'pay_ent_smp=eyJhbGc... |
import jwt
from django.contrib.auth import get_user_model
from rest_framework.authentication import BaseAuthentication
|
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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.... |
"""
Notebook rendering classes
Currently, only an HTMLRenderer class is available. Eventually this could be
extended to include something like a MarkdownRenderer class for hosting on
Github, etc.
"""
import os
import shutil
from jinja2 import Environment, PackageLoader
from pkg_resources import resource_filename, Requ... |
from cli import *
from sim_commands import *
import string, os
disk_types = { "320" : [40, 8, 2],
"360" : [40, 9, 2],
"720" : [80, 9, 2],
"1.2" : [80, 15, 2],
"1.44" : [80, 18, 2],
"2.88" : [80, 36, 2]}
def floppy_drive_get_info(obj):
ret... |
from .flop_benchmark import get_model_infos
|
# Import external libraries
import os
from pathlib import Path
from glob import glob
import shutil
import numpy as np
import nibabel as nib
import cv2
from pystackreg import StackReg
# A function to create directory
def create_dir(path_of_dir):
try:
os.makedirs(path_of_dir) # For one directory containin... |
# ##### BEGIN MIT LICENSE BLOCK #####
#
# MIT License
#
# Copyright (c) 2020 Steven Garcia
#
# 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 ... |
import sympy as sy
import numpy as np
import random
from sympy import *
def threePointCubicApprox(x,y,xSlopePoint,yPrime):
C3 = (y[2] - y[0])/((x[2] - x[1])*(x[2] - x[0])**2) - (y[1] - y[0])/((x[2] - x[1])*(x[1] - x[0])**2) + yPrime/((x[1]-x[0])*(x[2] - x[0]))
C2 = (((y[1] - y[0])/(x[1] - x[0])) - yPrime)/(x[1] - x[... |
#!/usr/bin/env python
# File created on 20 Jul 2014
from __future__ import division
__author__ = "Yoshiki Vazquez Baeza"
__copyright__ = "Copyright 2013, The Emperor Project"
__credits__ = ["Yoshiki Vazquez Baeza"]
__license__ = "BSD"
__version__ = "0.9.3-dev"
__maintainer__ = "Yoshiki Vazquez Baeza"
__email__ = "yosh... |
# Module for logging config
import logging
import sys
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
log = logging.getLogger("main")
def get_logger(lgr):
return logging.getLogger(lgr)
if __name__ == '__main__':
print(type(log))
|
"""
sentry.tagstore.base
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2017 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import re
from sentry.constants import TAG_LABELS
from sentry.utils.services import Service
# Va... |
import requests
from bs4 import BeautifulSoup
from lxml import html
import pandas as pd
import os.path
session_requests = requests.session()
login_url = "https://www.gradescope.com/login"
result = session_requests.get(login_url)
tree = html.fromstring(result.text)
authenticity_token = list(set(tree.xpath("//input[@na... |
# -*- coding: utf-8 -*-
import time
import re
import os
import sys
import numpy as np
from bs4 import BeautifulSoup
# reload(sys)
# sys.setdefaultencoding('utf-8')
# sys.path.append("/usr/bin/pdf2txt")
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
if len(sys.argv) != 2:
sys.exit("Erreur... |
from . import scraper
__all__ = ["scraper"]
|
class EverythingEquals:
def __eq__(self, other):
return True
mock_equal = EverythingEquals()
def assert_equal_dicts(d1, d2, ignore_keys=[]):
def check_equal():
ignored = set(ignore_keys)
for k1, v1 in d1.items():
if k1 not in ignored and (k1 not in d2 or d2[k1] != v1):
... |
from django.contrib import admin
from .models import Comment
@admin.register(Comment)
class CommentAdmin(admin.ModelAdmin):
list_display = ('target', 'content', 'nickname', 'website', 'created_time')
fields = ('target', 'content', 'nickname', 'website')
def save_model(self, request, obj, form, change):
... |
'''
/**
* created by cicek on 09.04.2018 16:44
*/
''' |
'''
This module contains generic structures that fit various needs.
These structures are not meant to be used as is(except void_desc)
and need to be included in a descriptor before it is sanitized.
Critical keys will be missing if they aren't sanitized.
'''
import supyr_struct
from supyr_struct.defs.frozen_dict impo... |
from rest_framework import serializers
from .models import Funcionario
from .models import Registro
class FuncionarioSerializer(serializers.ModelSerializer):
class Meta:
model = Funcionario
fields = ['id', 'matricula', 'nome']
class FuncionarioSimpleSerializer(serializers.ModelSerializer):
cla... |
"""Blog administration."""
from django.contrib import admin
from .models import Post, Tag
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
"""Admin panel for blog posts."""
list_display = ("__str__", "created", "modified", "published")
list_filter = ("created", "published")
@admin.register(Tag... |
import os,pty,serial,pymysql,time, datetime
from serial import SerialException
db = pymysql.connect("localhost", "flowerbot", "mycroft", "sensordata")
curs=db.cursor()
z1baudrate = 57600
z1port = '/dev/ttyACM0' # set the correct port before run it
z1serial = serial.Serial(port=z1port, baudrate=z1baudrate)
z1serial.... |
#!/usr/bin/python
#############################################################################
# Licensed Materials - Property of HCL*
# (C) Copyright HCL Technologies Ltd. 2017, 2018 All rights reserved.
# * Trademark of HCL Technologies Limited
#######################################################################... |
"""
Description:
Author: Jiaqi Gu (jqgu@utexas.edu)
Date: 2021-10-07 03:37:23
LastEditors: Jiaqi Gu (jqgu@utexas.edu)
LastEditTime: 2021-10-14 00:27:33
"""
from typing import Dict, List, Optional
import numpy as np
import torch
from pyutils.general import logger
from pyutils.torch_train import set_torch_deterministic... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.