text
string
size
int64
token_count
int64
from ETL.Data_Preprocessing.data_cleaning_and_filtering import cleaning_and_filtering from ETL.Data_Transformation.drug_conditions_grouped import group_conditions from ETL.Data_Transformation.jaccard_similarity import apply_jaccard_similarity from ETL.Data_Transformation.drug_conditions_fuzzy_matching import fuzzy_matc...
1,380
419
from setuptools import setup from setuptools.command.install import install import os import sys import atexit if __name__ == '__main__': package_name = 'dgdynamic' excludes = [ '__pycache__', 'StochKit' ] extras = [ 'default_config.ini', 'spim.ocaml', 'stochkit...
2,345
731
import os import RPi.GPIO as gpio import time from mesafe import distance motorhizi = 1 aci2 = aci3 = aci4 = 6 aci = 5.5 in4 = 26 in3 = 4 in2 = 12 in1 = 8 solled = 9 sagled = 11 gpio.setwarnings(False) def init(): gpio.setwarnings(False) gpio.setmode(gpio.BCM) gpio.setup(22,gpio.OUT) gpio.setup(27...
5,543
2,656
from sqlalchemy.sql import func from sqlalchemy import Column, BigInteger, String, DateTime, Boolean from .model import database class DiscordUser(database.Base): __tablename__='discord_users' id = Column(BigInteger, primary_key=True, unique=True, nullable=False, autoincrement=False) created = Column(DateTime(time...
632
199
#!/usr/bin/env python """ timer.py: Implementation of a CPU timer that is used as a part of stopping criteria. """ import time def _time(): """ Convenience function that returns current process time as milliseconds. """ return time.process_time() * 1000 class Timer: """ Captures CPU time ...
2,036
574
import argparse import os from glob import glob from pathlib import Path import imageio import h5py import pandas as pd from bioimageio.core import load_resource_description from bioimageio.core.prediction import predict_with_padding from bioimageio.core.prediction_pipeline import create_prediction_pipeline from elf....
6,093
1,892
from .bar import value
23
7
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Interpreter version: python 2.7 # # Imports ===================================================================== import requests from ..settings import USER_AGENT from ..settings import REQUEST_TIMEOUT # Functions & classes =========================================...
1,320
379
#!/usr/bin/env python2.7 from __future__ import print_function import json import sys import numpy as np import os.path import time from math import ceil import argparse import nbt from util import blif, cell, cell_library from placer import placer from router import router, extractor, minetime from vis import png ...
7,506
2,366
import logging import logging.handlers import time logger = logging.getLogger(__name__) handler = logging.handlers.SocketHandler('localhost', 9033) stream = logging.StreamHandler() logger.addHandler(handler) logger.addHandler(stream) while True: logger.warning('ping') time.sleep(.001)
296
91
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function from argparse import ArgumentParser from collections import OrderedDict import jinja2 import csv import sys import os.path import re def store_keyval(src_dict, key, val): if key is None: return val if type(src_dict) is...
5,032
1,644
import yaml import os import sys import time import numpy as np import cv2 as cv from franka.FrankaController import FrankaController def read_cfg(path): with open(path, 'r') as stream: out = yaml.safe_load(stream) return out if __name__ == '__main__': ROOT = os.path.dirname(os.path.abspath(__f...
2,077
699
import cherrypy import sesame from database import create_database DATABASE = create_database({'System':'sqlite', 'Database':'testy.db'}) SERVER = None def validate_password(realm, login, password): #TODO autoryzacja JWT return SERVER.authorize_user(login, password) CHERRYPY_CONFIG = { 'server.socket_hos...
2,913
966
from nltk.tag import StanfordNERTagger import pandas as pd from sklearn.metrics import f1_score, confusion_matrix from loader import Load train, test = Load('c') ner = StanfordNERTagger('./stanford-ner-2018-10-16/classifiers/english.all.3class.distsim.crf.ser.gz', './stanford-ner-2018-10-16/stanford-ner.jar') data ...
731
287
""" ==================================================================================== A Rete Network Building and 'Evaluation' Implementation for RDFLib Graphs of Notation 3 rules. The DLP implementation uses this network to automatically building RETE decision trees for OWL forms of DLP Uses Python hashing mechan...
41,355
11,004
from gcpy.functions.CloudFunction import CloudFunctionTrigger, CloudFunction from gcpy.utils.binary import binary_decode class HTTPTrigger(CloudFunctionTrigger): pass class HTTPFunction(CloudFunction): name = 'function_public_name' trigger = HTTPTrigger() def handle(self, request): print('H...
500
131
''' Unlike a RESTful API, there is only a single URL from which GraphQL is accessed. We are going to use Flask to create a server that expose the GraphQL schema under /graphql and a interface for querying it easily: GraphiQL (also under /graphql when accessed by a browser). ''' from flask import Flask from flask_graph...
792
244
# # Complete the 'reverseShuffleMerge' function below. # # The function is expected to return a STRING. # The function accepts STRING s as parameter. # import os from collections import defaultdict def frequency(s): result = defaultdict(int) for char in s: result[char] += 1 retur...
1,305
460
""" This class searches for data in a hierarchy of folders and sorts them in a list. Attributes to the data are: path: path to the raw data file type: whether from Picarro, DropSense sensors. data: the data set after reading with the modules: read_dropsense ...
4,021
990
#!/usr/bin/python import sys import json import urllib2 import collections url = "http://192.168.122.1:8080/sony/" camera_url = url+"camera" avContent_url = url+"avContent" def create_params_dict(method,params=[],id_=1,version="1.0"): params = collections.OrderedDict([ ("method", method), ("p...
2,794
922
import os from waflib import Context, Errors # pylint:disable=import-error class WatchContext(Context.Context): cmd = 'watch' fun = 'watch' variant = '' def __init__(self, **kw): super().__init__(**kw) self.top_dir = kw.get('top_dir', Context.top_dir) self.out_dir = kw.get('ou...
875
296
import sys import re import requests import requests.cookies from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) from time import sleep from GlobalVariables import * class FindJenkins(object): def __init__(self): super(FindJenkin...
3,151
1,286
import pytest from pytest_httpbin.plugin import httpbin_ca_bundle pytest.fixture(autouse=True)(httpbin_ca_bundle)
115
41
from unittest import mock async def test_post(anonym_client, mocker): mocker.patch('aioga.GA') r = await anonym_client.get('v1/wind') assert r.status == 200, await r.text()
187
70
"""Util functions""" from .vis_utils import visualizer from .save_model import save_model from .Util import checkParams, checkSize, test
138
39
import io import os from collections import OrderedDict import imageio import numpy as np from au import conf from au.util import create_log from au import util ## ## Images ## class ImageRow(object): """For expected usage, see `test_imagerow_demo`""" # NB: While pyspark uses cloudpickle for *user code*, it...
15,499
5,516
import re title_regex = r'<title>([^<>]*)<\/title>' info = input() title = re.findall(title_regex, info) title = ''.join(title) print(f"Title: {title}") body_regex = r'<body>.*<\/body>' body = re.findall(body_regex, info) body = ''.join(body) content_regex = r">([^><]*)<" content = re.findall(content_regex, bod...
417
167
import random def randomStr(): l = [x for x in range(9)] l += [chr(x) for x in range(65, 65+26)] string = "" for x in range(32): string += str(l[random.randint(0, len(l) - 1)]) return string
230
92
# Testing various methods to graph with matplotlib # Developed by Nathan Shepherd import numpy as np import matplotlib.pyplot as plt n = 100 y = [round(np.random.normal(scale=n/10)) for _ in range(n)] x = [i for i in range(-n, n)] _y = [] for i in range(-n, n): _y.append(y.count(i)) plt.plot(x, _y) plt.show()
320
130
import sys from Bio import Entrez from collections import Counter import pandas as pd ########################################### def get_tax_id(species): species = species.replace(" ", "+").strip() search = Entrez.esearch(term = species, db = "taxonomy", retmode = "xml") record = Entrez.read(search) re...
1,741
602
weird_board = [['_'] * 3] *3 print(weird_board) weird_board[0][2] = 'X' print(weird_board)
91
46
''' Author: Eric P. Nichols Date: Feb 8, 2008. Board class. Board data: 1=white, -1=black, 0=empty first dim is column , 2nd is row: pieces[1][7] is the square in column 2, at the opposite end of the board in row 8. Squares are stored and manipulated as (x,y) tuples. x is the column, y is the row. ''' imp...
12,754
4,238
import xlwt class ColourGradient: def __init__(self, minimum, maximum, interval, book): self.levels = {} self.minimum = minimum self.maximum = maximum dataRange = maximum - minimum steps = int(dataRange / interval) + 1 if (steps >= 4): ...
2,533
842
#! /usr/bin/env python """WSGI server interface to mw-render and mw-zip/mw-post""" import sys, os, time, re, shutil, StringIO from hashlib import md5 from mwlib import myjson as json from mwlib import log, _version from mwlib.metabook import calc_checksum log = log.Log('mwlib.serve') collection_id_rex = re.compile(...
2,044
692
from aiohttp import web class UseCase: def __init__(self, app: web.Application) -> None: self.app = app
118
39
# -*- coding: utf-8 -*- # Time: 2022-03-01 15:43 # Copyright (c) 2022 # author: Euraxluo from typing import * from amap_distance_matrix.helper import haversine,format_loc class AMapDefaultResultRouteStep(object): def __init__(self, start: str, end: str): self.polyline: str self.instruction = "到达途...
2,021
686
import numpy as np import pandas as pd import matplotlib.pyplot as plt import math import csv import datetime AGE = "Age Category" SEX = "Sex" TIME = "Time" OUTPUT_BASE = "output/" COLS_X = [AGE, SEX, TIME, "TotalRaces"] COLS_Y = [TIME] #training data TRAIN_X = "output/Y2X_train.csv" TRAIN_Y = "output/Y2Y_train.csv"...
1,589
773
def positive_integer_pairs(m, n): results = list() for a in range(m // 2 + 1 ): b = m - a if a ^ b == n: results.append((a, b)) return results
185
68
from .wrappers import SimpleClassifierWrapper def get_wrapper(config, wrapper_func=None): if wrapper_func is not None: wrapper = wrapper_func(config) elif config.wrapper_config.wrapper_name == 'SimpleClassifierWrapper': wrapper = SimpleClassifierWrapper(config.wrapper_config) else: ...
393
100
from bs4 import BeautifulSoup from urllib.request import Request,urlopen from urllib.error import HTTPError from PyQt5 import QtCore, QtGui, QtWidgets, Qt import sys import threading import datetime import win32con import os import struct import time import pyttsx3 from win32api import * from win32gui imp...
11,739
4,195
# SPDX-FileCopyrightText: 2021-present Ofek Lev <oss@ofek.dev> # # SPDX-License-Identifier: MIT import subprocess from textwrap import dedent as _dedent import tomli import tomli_w def dedent(text): return _dedent(text[1:]) def check_container_output(container_name, command): return subprocess.check_output...
1,604
543
#define calcIncrement function def calcIncrement(salary , noOfYearsWorked): if(noOfYearsWorked > 2): increment = (salary * 10 / 100) else: increment = 0 return increment #define calcTotalSalary function def calcTotalSalary(salary , increment): total = salary + increment return tot...
881
264
from .newDitherStackers import * from .newDitherStackers import * from .maskingAlgorithmGeneralized import * from .saveBundleData_npzFormat import * from .numObsMetric import * from .galaxyCountsMetric_extended import * from .galaxyCounts_withPixelCalibration import * from .artificialStructureCalculation import * from ...
438
134
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # anited. publish - Python package with cli to turn markdown files into ebooks # Copyright (c) 2014 Christopher Knörndel # # Distributed under the MIT License # (license terms are at http://opensource.org/licenses/MIT). """Setup script for easy_install and pip.""" impo...
2,576
848
""" main.py Main.py é responsável por iniciar o processo o programa completamente, através de duas threads, uma para manter o servidor de aplicação via flask para poder receber requisições e comunicar com o cliente, seus processos estão detalhados em server.py e outra thread para manter o fluxo da aplicação, baseado n...
1,187
355
#!/usr/bin/env python # coding: utf-8 import random import math import torch import dgl import graphgallery from graphgallery.datasets import Planetoid print("GraphGallery version: ", graphgallery.__version__) print("PyTorch version: ", torch.__version__) print("DGL version: ", dgl.__version__) ''' Load Datasets - co...
1,347
504
# Copyright Contributors to the Packit project. # SPDX-License-Identifier: MIT class ValidationFailed(Exception): pass
125
41
import subprocess import os from setuptools import setup, find_packages def readme(): with open('README.md') as _file: return _file.read() def requirements(): reqs_file = 'reqs.txt' if os.path.isfile(reqs_file): with open('reqs.txt') as reqs: return [line.strip() for line in ...
1,453
471
import unittest from lib.solutions.checkout import checkout class TestSum(unittest.TestCase): def test_checkout(self): self.assertEqual(checkout("ABC"), 50+30+20) self.assertEqual(checkout("ABCCCD"), 50+30+20*3+15) self.assertEqual(checkout("AAA"), 130) self.assertEqual(checkout("...
1,078
439
#!/usr/bin/env python import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from libs.imagemetadata_ui import Ui_imagemetadata class ImageMetadata(QWidget, Ui_imagemetadata): def __init__(self, parent=None): super(ImageMetadata, self).__init__(parent) s...
338
121
import os import cv2 import pdb import json import copy import numpy as np import torch from PIL import Image, ImageDraw, ImageFont import matplotlib.pyplot as plt import matplotlib import math from tqdm import tqdm from config import system_configs from utils import crop_image, normalize_ from external.nms import so...
19,992
6,847
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) #now we'll define the threaded callback function #this will run in another threadwhen our event is detected def my_callback(channel): print "Rising edge detected on po...
752
305
from django.http import HttpResponse from django.db.models import Q from drf_yasg.utils import swagger_auto_schema from drf_yasg.openapi import Parameter, Schema, Response, TYPE_INTEGER, TYPE_OBJECT, TYPE_STRING, IN_QUERY from json import dumps from .. import models from .Public import responses_success, responses_fa...
31,184
10,250
import struct import socket import asyncio import logging import knx_stack class Request(asyncio.DatagramProtocol): def __init__(self, local_addr: str, local_port: int): """ A KNXnet IP Discovery request service :param local_addr: discovery request instance host ip address :param...
6,514
2,087
from autodisc.representations.static.pytorchnnrepresentation.models.encoders import EncoderBurgess from autodisc.representations.static.pytorchnnrepresentation.models.decoders import DecoderBurgess
199
62
# Import OpenCV module import cv2 # Import numpy for array operations import numpy as np image = cv2.imread('images/five_cubes.jpeg') # Show the image cv2.imshow('Image',image) # Resize the image if it is too big, also helps to speed up the processing image = cv2.resize(image, (600, 600)) cv2.imshow('Resized Image'...
3,312
1,223
import exastics.collect import pathlib import sys import urllib.parse if __name__ == '__main__': github_account = sys.argv[1] github_repository = sys.argv[2] url_parts = ( 'https', 'api.github.com', urllib.parse.quote(f'/repos/{github_account}/{github_repository}/releases'), ...
569
193
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class RPOSchedule(object): """Implementation of the 'RPO Schedule.' model. Specifies an RPO Schedule. Attributes: rpo_inteval_minutes (long|int): If this field is set, then at any point, a recovery point should be available not ...
1,471
404
"""Export a text file.""" from ghpythonlib.componentbase import dotnetcompiledcomponent as component import Grasshopper, GhPython import System import os import datetime __author__ = "Nicolas Rogeau" __laboratory__ = "IBOIS, Laboratory for Timber Construction" __university__ = "EPFL, Ecole Polytechnique Fe...
5,834
2,060
from sommelier.steps.response_processing import * from sommelier.steps.event_processing import *
97
27
import sys from packaging.version import LegacyVersion from skbuild.exceptions import SKBuildError from skbuild.cmaker import get_cmake_version from skbuild import setup setup_requires = [] # Require pytest-runner only when running tests. if any(arg in sys.argv for arg in ('pytest', 'test')): setup_requires.append(...
877
291
from django.urls import path from . import views urlpatterns = [ path('', views.dashboard, name='dashboard'), path('dtcs/', views.dtcs, name='dtcs'), ]
162
56
from django import forms from crits.locations.location import Location from crits.core.handlers import get_item_names class AddLocationForm(forms.Form): """ Django form for adding a location to a TLO. The list of names comes from :func:`get_item_names`. """ error_css_class = 'error' required...
1,195
357
import pandas as pd import numpy as np import sys import os import itertools import pandas as pd import os from tqdm import tqdm_notebook, tnrange import numpy as np import networkx as nx import seaborn as sns import matplotlib.pyplot as plt from scipy.optimize import minimize import scipy from sklearn import linear_...
3,641
1,329
#!/usr/bin/env python3 import tornado.ioloop import tornado.web import json import logging from uf.wrapper.swift_api import SwiftAPI class MainHandler(tornado.web.RequestHandler): def initialize(self, swift): self.swift = swift def post(self): data = json.loads(self.request.body.decode()) ...
791
261
from rest_framework.exceptions import ValidationError from rest_framework.fields import DateField, ChoiceField, CharField from open.core.betterself.constants import ( BETTERSELF_LOG_INPUT_SOURCES, WEB_INPUT_SOURCE, ) from open.core.betterself.models.daily_productivity_log import DailyProductivityLog from open....
2,765
813
import random import cfg import utils import socket import re import time from time import sleep import sys try: file_c = open('chanel.txt', 'r', encoding='utf-8') CHANEL = file_c.read() print(f'chanel = {CHANEL}') file_c.close() except IOError as err: print('Please enter your CHANEL!') print(...
5,423
1,740
from django.urls import path from teams.views import TeamListView app_name = "core" urlpatterns = [ path("", TeamListView.as_view(), name="home"), ]
155
50
import os import subprocess import sys from distutils.command.build import build from distutils.spawn import find_executable from setuptools import setup def parse_requirements(filename): """ Helper which parses requirement_?.*.txt files :param filename: relative path, e.g. `./requirements.txt` :retu...
1,409
453
from .preprocess import SynthesizerPreprocessor from .dataset import SynthesizerDataset, collate_synthesizer
109
29
from web3 import Web3, IPCProvider, HTTPProvider from web3.middleware import geth_poa_middleware from R8Blockchain.blockchain_handler import BlockchainHandler from hashlib import sha256 import codecs from web3.contract import ConciseContract class EthereumBlockchain(BlockchainHandler): def __init__(self, eth_rpc)...
2,617
937
path = "/home/nathan/OpenPCDet/data/kitti/training/velodyne/000000.bin"
73
37
import xlrd import os import sys # rootdir = 'D:/工作/code/electric/' rootdir = sys.argv[1] xlrd.Book.encoding = "gbk" sumnum=0 filenum = 0 list = os.listdir(rootdir) #列出文件夹下所有的目录与文件 for i in range(0,len(list)): path = os.path.join(rootdir,list[i]) if os.path.isfile(path): print('正在处理:'+path) data...
690
270
''' 0 Preprocess segments: - - specify segments you want to process - dilate slightly the segments - create mask for dilation. - np.unique(my_masked_id) --> select only part with biggest uc - eliminates ouliers too disconnected/far from main structure ''' import numpy as np import h5py from scipy.ndimage import binar...
1,442
538
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse from dataclasses import dataclass import sys from cli import arg_utils from foundations.runner import Runner from branch impor...
2,665
775
import requests # 导入requests 库 from bs4 import BeautifulSoup import urllib.error import re class AQICityClass(object): def cityAQI(self,url,cityName,header={}): try: urlName = url + cityName + '.html' r = requests.get(urlName, header) except urllib.error.URLError...
946
307
from setuptools import setup classifiers = [ 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX' ] + [ ('Programming Language :: Python :: %s' % x) for x in '2.7'.split() ] test_requirements = [ 'pytest', 'pytest-cov', 'coveralls', ...
1,464
500
class ApiException(Exception): """Koodous API base class.""" class ApiUnauthorizedException(ApiException): """Exception when is made a request without the correct token or insufficient privileges.""" class FeedException(ApiException): """Base class for the feed exceptions.""" class FeedPackageExceptio...
580
149
# coding=utf-8 # Copyright 2018 The Batfish Open Source Project # # 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 requi...
1,005
321
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Sep 3 01:41:52 2020 Combines LAMMPS output files coming from a series of restarts with a * wildcard. This works on expanded (mode scalar) fixes from LAMMPS where each line is a time. The overlapping values of times due to restarts are averaged, but th...
2,849
883
from dataclasses import dataclass from datetime import datetime from typing import List, Optional from astropy.coordinates import SkyCoord @dataclass class MagnitudeRange: """A magnitude range. Attributes ---------- bandpass: `str` The bandpass for which the magnitudes are given. min_mag...
3,680
1,120
""" app """ from flask import Flask, render_template, request, redirect, url_for from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) # /// = relative path, //// = absolute path app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db = SQLAlchemy(...
1,875
674
from sqlalchemy.orm import backref from app.models import db class Version(db.Model): """Version model class""" __tablename__ = 'versions' id = db.Column(db.Integer, primary_key=True) event_id = db.Column(db.Integer, db.ForeignKey('events.id', ondelete='CASCADE')) events = db.relationship("Event"...
2,009
622
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import with_statement import io import logging import os from six import string_types from pydatajson.helpers import traverse_dict from pydatajson.indicators import generate_ca...
4,642
1,406
from tkinter import * import tkinter root = Tk() scrollbar = Scrollbar(root) scrollbar.pack( side = RIGHT, fill=Y ) mylist = Listbox(root, yscrollcommand = scrollbar.set ) for line in range(100): mylist.insert(END, "Line number : " + str(line)) mylist.pack( side = LEFT, fill = BOTH ) scrollbar.config( command = m...
346
126
"""Common get functions for sisf""" # Python import logging import re # Genie from genie.metaparser.util.exceptions import SchemaEmptyParserError log = logging.getLogger(__name__) log.setLevel(logging.DEBUG) def get_device_tracking_policy_name_configurations(device, policy): """ Get device-tracking policy conf...
8,354
2,880
# Advent of Code 2021 - Day: 13 # Imports (Always imports data based on the folder and file name) from aocd import data, submit def solve(data): # Parse input # Split the input into two lists, based on where the empty line is # Find the index of the line that is '', and use that to split the list # Return the two ...
1,742
644
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # # 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 appl...
13,598
3,944
print("Modules documentation: https://docs.python.org/3/tutorial/modules.html") print("Standard modules list: https://docs.python.org/3/py-modindex.html") import math print(math.pi) from math import pi print(pi) from math import pi as p print(p)
248
82
""" Utilities for creating archives :Author: Jonathan Karr <karr@mssm.edu> :Date: 2020-12-06 :Copyright: 2020, Center for Reproducible Biomedical Modeling :License: MIT """ from .data_model import Archive, ArchiveFile import glob import os __all__ = ['build_archive_from_paths'] def build_archive_from_paths(path_pa...
1,329
384
""" This class represents the info of one commit """ from Change import *; class Commit: def __init__(self, hash, author, authorEmail, date, commitMessage): self.hash = hash; self.author = author; self.authorEmail = authorEmail self.date = date; self.commitMessage = commit...
845
264
"""YTD precip""" import calendar import datetime from pandas.io.sql import read_sql from pyiem.util import get_autoplot_context, get_dbconn from pyiem.plot.use_agg import plt from pyiem.network import Table as NetworkTable def get_description(): """ Return a dict describing how to call this plotter """ desc ...
3,758
1,267
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: networking/v1beta1/gateway.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from ...
21,536
8,585
''' @Time : 2021/9/3 9:42 @Author : ljc @FileName: dataload.py @Software: PyCharm ''' import os import json import cv2 import numpy as np import torch from PIL import Image from torchvision import transforms from torch.utils.data import DataLoader from torch.utils.data import Dataset transform = transforms.Compo...
1,684
599
import numpy as np import os import skimage.io as io import skimage.transform as trans import numpy as np from tensorflow.keras.models import * from tensorflow.keras.layers import * from tensorflow.keras.optimizers import * from tensorflow.keras.callbacks import ModelCheckpoint, LearningRateScheduler from keras import...
15,833
6,039
#!/usr/bin/env python # -*- coding: utf-8 -*- """ run.py Code to run the PatchVAE on different datasets Usage: # Run with default arguments on mnist python run.py Basic VAE borrowed from https://github.com/pytorch/examples/tree/master/vae """ __author__ = "Kamal Gupta" __email__ = "kampta@cs.umd.edu" __version__ = ...
23,998
7,826
import os import sqlite3 from dataclasses import dataclass from pathlib import Path from typing import Dict, List, Optional from fastapi import Request from fastapi.routing import APIRouter from loguru import logger ENV = os.environ.copy() USE_MONGO_DB: bool = ENV.get('USE_MONGO_DB', 'True') == 'True' USE_POSTGRES_DB...
3,521
1,155
# encoding: UTF-8 from __future__ import with_statement import logging import codecs import csv import os from datetime import datetime, timedelta from decimal import Decimal from django.db.models import Q, Sum from django.core.management.base import BaseCommand from django.core.exceptions import ObjectDoesNotExist ...
11,602
3,289
from localground.apps.site.api.serializers.base_serializer import \ BaseSerializer, NamedSerializerMixin, ProjectSerializerMixin from localground.apps.site.api.serializers.field_serializer import \ FieldSerializer from django.conf import settings from rest_framework import serializers from localground.apps.site...
1,962
552
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @File : 7_PageClass_Cookie.py @Time : 2020-8-23 01:33:25 @Author : Recluse Xu @Version : 1.0 @Contact : 444640050@qq.com @Desc : 页面类 Page Class 官方文档:https://miyakogi.github.io/pyppeteer/reference.html#pyppeteer.page.Page.target Page类提供了与标签交互的...
1,447
614