content stringlengths 5 1.05M |
|---|
###############################################################################
# WaterTAP Copyright (c) 2021, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory, Oak Ridge National
# Laboratory, National Renewable Energy Laboratory, and National Energy
# Technology Laboratory ... |
import os
import csv
import timeit
from datetime import datetime
import numpy
import logging
import coloredlogs
import numpy as np
import argparse
import copy
import json
import re
import sys
import onnxruntime
from onnx import numpy_helper
from perf_utils import *
import pprint
import time
from float16 import *
# impo... |
from django.db import models
# Create your models here.
class Person(models.Model):
name = models.CharField(max_length=255)
surname = models.CharField(max_length=255)
image = models.ImageField(upload_to='person_images')
|
import os
import click
from flask import current_app
from sqlalchemy import text
from app import db
def register(app):
@app.cli.group()
def translate():
"""Translation and localization commands."""
pass
@translate.command()
@click.argument('lang')
def init(lang):
"""In... |
from __future__ import annotations
import attr
__all__ = ("AllowedMentions",)
@attr.s(kw_only=True)
class AllowedMentions:
"""Represents an allowed mentions object.
This is used to determine the allowed mentions of any messages being sent from the client's user.
Parameters
----------
everyone:... |
import csv
class PlayerThumbnails:
def getThumbnailsID():
ThumbnailsID = []
with open('Logic/Files/assets/csv_logic/player_thumbnails.csv') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
line_count = 0
for row in csv_reader:
if lin... |
"""
This file contains all the HTTP routes for basic pages (usually HTML)
"""
from flask import Blueprint, render_template, request
import _config as config
pages = Blueprint('controller', __name__)
@pages.route('/')
def index():
"""
A basic landing page for this web service
:return: HTTP Response (HTM... |
"""The Snooty documentation writer's tool."""
__version__ = "0.9.6.dev"
|
#!/usr/bin/env python
from subprocess import Popen
from subprocess import PIPE
class ChromeHtmlToPdf():
def __init__(self, url, output_path=None, verbose=False):
'''
Initialize class with google chrome parameters
Params:
Return:
'''
... |
from streaming.app import app
from streaming.config import config
from streaming.phishtank.api import Reported
# Topics
reports_topic = app.topic('phishtank-reports')
# Tables
states_table = app.Table('phishtank-state', default=str)
@app.agent(reports_topic)
async def get_phishtank_reports(states):
async for sta... |
#!/usr/bin/python
# -*- coding: UTF-8 -*
from common.common_time import get_system_datetime
from db.base import DbBase
from db.connection_pool import MysqlConn
import copy
import datetime
from utils.status_code import response_code
from config import configuration
import traceback
import json
import os
from config impo... |
from .api import process_large_corpus, process_small_corpus, \
process_belscript, process_pybel_graph, process_json_file, \
process_pybel_neighborhood, process_cbn_jgif_file, \
process_bel_stmt
|
from distutils.core import setup
version = "1.2"
setup(
name='chainee',
packages=['chainee'],
version=version,
license='MIT',
description='Chain your predicates, easy way.',
author='Yaroslav Pankovych',
author_email='flower.moor@gmail.com',
url='https://github.com/ypankovych/chainee',
... |
# The idea here is to store all the different things you need for Code in one module
# Code can then import the module and call whatever functions are needed
# R. Sheehan 27 - 10 - 2020
MOD_NAME_STR = "Measurement"
# import the necessary modules
import board
import time
import digitalio
from analogio import AnalogOut... |
import pytest
import main
from time import time
import hmac
import hashlib
from unittest.mock import Mock
from unittest.mock import MagicMock
def test_valid_signature():
timestamp = int(time())
slack_signing_secret = 'abcdefg'
main.slack_signing_secret = slack_signing_secret
req_body = 'abcdefgabcdefg... |
from matchbook.apiclient import APIClient
from matchbook.exceptions import MBError
__title__ = 'matchbook'
__version__ = '0.0.9'
|
# -*- coding: utf-8 -*-
"""
Test Generic Map
"""
import os
import pytest
import numpy as np
import astropy.units as u
from astropy.coordinates import SkyCoord
import matplotlib.pyplot as plt
import sunpy
import sunpy.map
import sunpy.coordinates
import sunpy.data.test
from sunpy.tests.helpers import figure_test
tes... |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
# this should be fine, but failed with pychecker 0.8.18 on python 2.6
def func():
d = { 'a': 1, 'b': 2}
print d.keys()
|
import torch
import torch.nn as nn
import torch.nn.init as init
import numpy as np
import math
import torchvision.utils as tvu
from torch.autograd import Variable
import matplotlib.pyplot as plt
def generate_images(generator, centers, num_clusters, alpha, z_dim, device):
idx_centers = torch.from_numpy(np.random.c... |
import os
import numpy as np
def _download_and_extract(url, path, filename):
import shutil, zipfile
import requests
fn = os.path.join(path, filename)
while True:
try:
with zipfile.ZipFile(fn) as zf:
zf.extractall(path)
print('Unzip finished.')
... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
__author__ = 'Chao Wu'
r'''
python C:\Users\cwu\Desktop\Software\Papers\pH_effect\plot_ph_effect_contour\plot_contour.py
'''
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
EPCS_FILE = 'path\to\epcs.xlsx'
DGPS_FILE = 'path\to\dgps.xl... |
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from matplotlib.patches import Polygon
import numpy as np
import stader
d = stader.load_aircraft('b747_flight_condition2')
ac = stader.Aircraft(d)
msec = 15
dt = msec/1000
show_state = False
if show_state:
fig = plt.figure(figsize=(1... |
import os.path
from lsst.meas.base import CircularApertureFluxAlgorithm
config.measurement.load(os.path.join(os.path.dirname(__file__), "apertures.py"))
config.measurement.load(os.path.join(os.path.dirname(__file__), "kron.py"))
config.measurement.load(os.path.join(os.path.dirname(__file__), "convolvedFluxes.py"))
co... |
import pyglet
from pyglet.gl import *
blueDot = pyglet.resource.image('blue-dot.png')
redDot = pyglet.resource.image('red-dot.png')
class Window(pyglet.window.Window):
"""docstring for Window"""
def __init__(self):
print("Init Window")
super(Window, self).__init__(500, 400, vsync=False)
... |
# -*- coding:utf-8 -*-
import logging
from flask import request
from flask_restx import Namespace
from app.spider.csdn.csdn import CSDN
from app.spider.toutiao.toutiao_hotnews import ToutiaoNews
from app.api.util.base_resource import BaseResource
from app.api.util.web_response import WebResponse
from app.api.util.web... |
"""Singleton Class"""
# standard library
import threading
class Singleton(type):
"""A singleton Metaclass"""
_instances = {}
_lock = threading.Lock()
def __call__(cls, *args, **kwargs):
"""Evoke call method."""
with cls._lock:
if cls not in cls._instances:
... |
def print_two(*args): # :TODO *args are for funcs and argv for inputs
arg1, arg2 = args
print('arg1: %r, arg2: %r' % (arg1, arg2))
def print_two_again(arg1, arg2):
print('arg1: %r, arg2: %r' % (arg1, arg2))
print_two("zdr", "zdr")
print_two_again("zdr", "zdr")
|
import os
import sys
import time
import requests
from py2neo import Graph, Node, Relationship
graph = Graph()
graph.run("CREATE CONSTRAINT ON (u:User) ASSERT u.username IS UNIQUE")
graph.run("CREATE CONSTRAINT ON (t:Tweet) ASSERT t.id IS UNIQUE")
graph.run("CREATE CONSTRAINT ON (h:Hashtag) ASSERT h.name IS UNIQUE")
... |
import os
import shutil
def create_analysis_folder(folder_name):
if not os.path.exists(folder_name):
os.makedirs(folder_name)
shutil.copy('ffield', folder_name)
shutil.copy('parameters', folder_name)
|
from collections import defaultdict
import boto3
import click
from halo import Halo
from termcolor import colored, cprint
from ..app import app
from ..utils import formatted_time_ago
def task_id(task_detail: dict) -> str:
tags = {t["key"]: t["value"] for t in task_detail["tags"]}
try:
return tags["p... |
from setuptools import setup
with open("README.md", "r", encoding="utf-8") as f:
long_description = f.read()
setup(
name="sku",
version="0.2",
description="scikit-learn Utilities",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/myt... |
# sim_core/views.py
#################
#### imports ####
#################
from app import app
from flask import render_template, Blueprint
from logger import logger
from flask import current_app
################
#### config ####
################
sim_core_blueprint = Blueprint('sim_core', __name__, static_folder=... |
from unittest import TestCase
from demands.pagination import PaginatedResults, PaginationType
class PaginationTestsMixin(object):
args = (1, 2, 3)
kwargs = {'one': 1, 'two': 2}
def get(self, start, end, *args, **kwargs):
self.assertEqual(args, self.args)
self.assertEqual(kwargs, self.kwa... |
N, arr = int(input()), input().split()
print(all([int(i) > 0 for i in arr]) and any([i == i[::-1] for i in arr])) |
import tkinter as tk
import tkinter.filedialog as fd
import src.helper.gui as hg
from src.image.extractor import Extractor
from src.helper.file import File
class ImageExtractForm(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.controller = controller
... |
import copy
import operator
from functools import cached_property, reduce
from typing import Dict, List, Optional
import torch
import torch.nn as nn
from torch import Tensor
from torch.nn.functional import mse_loss
from torch.optim import Adam
from ai_traineree import DEVICE
from ai_traineree.agents import AgentBase
... |
# -*- coding: utf-8 -*-
"""
flask_jsonschema
~~~~~~~~~~~~~~~~
flask_jsonschema
"""
import os
from functools import wraps
try:
import simplejson as json
except ImportError:
import json
from flask import current_app, request
from jsonschema import ValidationError, validate
class _JsonSchema(obj... |
from tortoise.contrib.pydantic import pydantic_model_creator
from typing import Optional
from pydantic import BaseModel
from db.models import Meals
MealsInSchema = pydantic_model_creator(
Meals, name="MealIn", exclude_readonly=True
)
MealsOutSchema = pydantic_model_creator(
Meals, name="MealOut", exclude=["c... |
"""
Host Guest Complex
==================
"""
from __future__ import annotations
import typing
from collections import abc
from ...molecules import BuildingBlock
from ...reactions import GenericReactionFactory
from ..topology_graph import (
ConstructionState,
NullOptimizer,
Optimizer,
TopologyGraph,... |
import bs4
import json
import requests
import time
from utils import (get_content, get_soup, save_json, load_json)
MANGA_SEARCH_URL = 'https://myanimelist.net/manga.php?type=1&q='
# load series information
all_series = load_json("data.json")
for series in all_series:
# search on MyAnimeList
query_soup = get... |
from random import randint
from game_map.direction import Direction
from game_map.rect import Rect
class Room(Rect):
"""
A Room is just a Rect that can tell you where its walls are
"""
def __init__(self, x, y, width, height):
super(Room, self).__init__(x, y, width, height)
def get_wall(se... |
"""
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""
# Write your code here
from collections import deque, defaultdict
... |
import unittest
from mock import Mock
from foundations_events.producers.jobs.run_job import RunJob
class TestProducerRunJob(unittest.TestCase):
def setUp(self):
from foundations_internal.foundations_job import FoundationsJob
self.route_name = None
self.message = None
self._fou... |
import os
TEST_DIR = os.path.realpath(os.path.dirname(__file__))
|
# Copyright (c) 2017-2019 Intel Corporation
#
# 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... |
import logging
from logger_config import configure_logging
logger_name = 'root_logger'
configure_logging(logger_name, log_dir='logs')
logger = logging.getLogger(logger_name)
logger.warning('This is warning')
logger.error('This is exception')
logger.info('This is info message')
logger.debug('This is debug message')
|
# All edits to original document Copyright 2016 Vincent Berthiaume.
#
# Copyright 2015 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
#
# ht... |
__version__ = '3.0.8'
__buildinfo__ = {'branch': 'BRANCH_NOT_SET', 'last_commit': 'COMMIT_NOT_SET'} |
from dash import dcc
import dash_bootstrap_components as dbc # pip install dash-bootstrap-components
from dash import Input, Output, State, html
from app import app
# Lotties: Emil at https://github.com/thedirtyfew/dash-extensions
url_sunlight = "https://assets8.lottiefiles.com/packages/lf20_bknKi1.json"
url_earth = ... |
"""
Tatoeba (https://tatoeba.org/) is a collection of sentences and translation, mainly aiming for language learning.
It is available for more than 300 languages.
This script downloads the Tatoeba corpus and extracts the sentences & translations in the languages you like
"""
import os
import sentence_transformers
impo... |
from django.test import TestCase
from unittest2 import skipIf
from django.db import connection
import json
import re
from sqlshare_rest.util.db import get_backend
from sqlshare_rest.test import missing_url
from django.test.utils import override_settings
from django.test.client import Client
from django.core.urlresolver... |
from rest_framework import status
from rest_framework.test import APITestCase
from .. import models
from .. import serializers
class DocumentTopicTestCase(APITestCase):
URL = '/v1/m2m/document/topic/'
DOCUMENT_URL = '/v1/document/'
def test_create_document_topic(self):
topic_data = {
... |
#!/usr/bin/env python
import sys
import numpy
from numpy import matrix
class Policy(object):
actions = None
policy = None
def __init__(self, num_states, num_actions, filename='policy/default.policy'):
try:
f = open(filename, 'r')
except:
print('\nError: unable to open file: ' + filename)
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Credits: Benjamin Dartigues, Emmanuel Bouilhol, Hayssam Soueidan, Macha Nikolski
import pathlib
from loguru import logger
import constants
import plot
import numpy as np
import helpers
from image_set import ImageSet
from helpers import open_repo
from path import global_r... |
import matplotlib
import matplotlib.colors as colors
import matplotlib.pyplot as plt
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
import networkx as nx
import numpy as np
import sklearn.metrics as metrics
import torch
import torch.nn as nn
from torch.a... |
#!/usr/bin/env python3
import pandas as pd
def cyclists():
df = pd.read_csv('src/Helsingin_pyorailijamaarat.csv', sep=';')
# [Same as line below]: df = df[df.notna().any(axis=1)]
df = df.dropna(how='all')
df = df.dropna(how='all', axis=1)
return df
def main():
print(cyclists())
if __name... |
def calc_fitness(pop):
from to_decimal import to_decimal
from math import sin, sqrt
for index, elem in enumerate(pop):
# sรณ atribui a fitness a cromossomos que ainda nรฃo possuem fitness
# print(elem[0], elem[1])
x = to_decimal(elem[0])
y = to_decimal(elem[1])
# x = ... |
import os
from typing import Tuple, List
from tokenizers import BertWordPieceTokenizer, Tokenizer
import sentencepiece as spm
from enums.configuration import Configuration
from services.arguments.pretrained_arguments_service import PretrainedArgumentsService
from services.file_service import FileService
class Bas... |
#!/usr/bin/env python3
import fileinput
import hashlib
salt = ''
for line in fileinput.input():
salt = line.strip()
def md5(i):
return hashlib.md5((salt + str(i)).encode('utf-8')).hexdigest()
def checkNple(s, n):
i = 0
while i < len(s):
char = s[i]
consecutive = 0
while i < ... |
txt = ''.join(format(ord(x), 'b') for x in 'my foo is bar and baz')
print txt
from collections import Counter
secs = {
'60': '111100',
'30': '11110',
'20': '10100',
'12': '1100',
'10': '1010',
'6': '110',
'5': '101',
'3': '11',
'2': '10',
'1': '1',
'0': '0',
... |
#############################################
# --- Day 8: I Heard You Like Registers --- #
#############################################
import AOCUtils
class Instruction:
def __init__(self, inst):
inst = inst.split()
self.reg = inst[0]
self.mul = {"inc": 1, "dec": -1}[inst[1]]
s... |
import datetime
import geospacelab.express.eiscat_dashboard as eiscat
dt_fr = datetime.datetime.strptime('20201209' + '1800', '%Y%m%d%H%M')
dt_to = datetime.datetime.strptime('20201210' + '0600', '%Y%m%d%H%M')
# check the eiscat-hdf5 filename from the EISCAT schedule page, e.g., "EISCAT_2020-12-10_beata_60@uhfa.hdf5"... |
from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
from django.contrib.auth.models import User
from django.conf import settings
from postgresqleu.util.fields import LowercaseEmailField
from postgresqleu.countries.models import Country
from postgresqleu.invoices.models ... |
import numpy as np
def readLine(line):
return [ int(c) for c in line.split(' ') ]
def schedule(activities):
lastC = 0
lastJ = 0
sortedSchedule = ''
sortedActivities = sorted(activities, key=lambda a: a[1])
for a in sortedActivities:
if a[1] >= lastC:
sortedSchedule += 'C'... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
# slimไธป่ฆๆฏๅไปฃ็ ็ฆ่บซ-2016ๅนดๅผๅง
slim = tf.contrib.slim
# 5 x Inception-Resnet-A
def block35(net, scale=1.0, activation_fn=tf.nn.relu, scope=None, reuse=None):
"""Build the 35 x 35 resnet b... |
# -------------------------------------------------------------------------
# function: classes,type = dbscan(x, k, Eps)
# -------------------------------------------------------------------------
# Objective:
# Clustering the data with Density - Based Scan Algorithm with Noise (DBSCAN)
# -------------------------... |
# form test
|
# -*- coding: utf-8 -*-
"""
ๆต่ฏๆนๆณ:
1. ๆง่ก s1, s2, s3 ็กฎไฟ document ่ขซๅๅปบ, ๅนถไธ value = 0
2. ๆๅผไธคไธช terminal ่พๅ
ฅ python e3_concurrent_update.py
3. ๅฟซ้ๅจไธคไธช terminal ๆไธ enter ่ฟ่ก. ๆๆๆฏๅฏน value ่ฟ่ก 1000 ๆฌก +1, ็ฑไบๆไธคไธช
ๅนถๅ, ๆไปฅไบ็ธไน้ดไผไบๆข
4. ๆง่ก s4, ๆฅ็ value ๆฏๅฆๆฏ 2000
ES ไธญๅค็ๅนถๅ็็ญ็ฅ่ฏฆ่งฃ https://www.elastic.co/guide/en/elasticsearch/reference/current... |
# -*- coding: utf-8 -*-
import numpy as np
from skued import azimuthal_average, powdersim
from crystals import Crystal
import unittest
from skimage.filters import gaussian
np.random.seed(23)
def circle_image(shape, center, radii, intensities):
""" Creates an image with circle or thickness 2 """
im = np.ze... |
# Copyright 2018 Luddite Labs 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 os
import io
import sys
import time
import string
import random
import pstats
import unittest
import cProfile
import itertools
import statistics
from unittest.mock import patch, MagicMock
import bucky3.statsd as statsd
class RoughFloat(float):
def __eq__(self, other):
if not isinstance(other, flo... |
import os
import cv2
import numpy as np
import torch
# from utils import cropping as fp
from csl_common.utils import nn, cropping
from csl_common import utils
from landmarks import fabrec
from torchvision import transforms as tf
from landmarks import lmvis
snapshot_dir = os.path.join('.')
INPUT_SIZE = 256
transfo... |
from django.shortcuts import render
from django.views.generic import TemplateView
from django.contrib.auth.mixins import LoginRequiredMixin
class NewFatpercentageView(LoginRequiredMixin, TemplateView):
template_name = "new_fatpercentage.html"
class FatpercentageView(LoginRequiredMixin, TemplateView):
temp... |
import sys
from io import StringIO
def io_sys_stdin():
"""ๆ ๅ่พๅ
ฅๆต
Ctrl + D ็ปๆ่พๅ
ฅ
"""
for line in sys.stdin: # ๆ่กๅๅฒ่พๅ
ฅ
s = line.split() # ่ฏฅๆญฅ่ฟๅไธไธช list๏ผๆ็ฉบๆ ผๅๅฒๅ
็ด
print(s)
def io_input():
"""ไฝฟ็จ input() ่ฏปๅ่พๅ
ฅ๏ผไผๅฐ่พๅ
ฅๅ
ๅฎนไฝไธบ่กจ่พพๅผ
ไปฅๆข่ก็ฌฆไธบ็ปๆๆ ๅฟ
Python 3 ๆฒกๆ raw_input() ๆนๆณ๏ผไปฅ input() ไปฃๆฟ
"""
... |
#
# Copyright 2014 Thomas Rabaix <thomas.rabaix@gmail.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... |
from Jumpscale import j
def test():
"""
to run:
kosmos 'j.data.rivine.test(name="sia_basic")'
"""
e = j.data.rivine.encoder_sia_get()
# you can add integers, booleans, iterateble objects, strings,
# bytes and byte arrays. Dictionaries and objects are not supported.
e.add(False)
e... |
from nose.tools import *
from ..app import address_parts
@raises(TypeError)
def test_address_parts_no_address():
expected = []
actual = address_parts()
def test_address_parts_with_address():
expected = ['AddressNumber', 'StreetName']
actual = address_parts('123 main')
assert actual == expected
|
from sys import *
def parse_weights(numberExpectedParams, filename):
f = open(filename, 'r')
contents = f.readlines()
params = []
linenumber=0
for i in contents:
linenumber = linenumber + 1
i = i.strip()
if i == "":
continue
try... |
from flask import current_app as app
from flask import jsonify, request
from director.api import api_bp
from director.builder import WorkflowBuilder
from director.exceptions import WorkflowNotFound
from director.extensions import cel_workflows, schema
from director.models.workflows import Workflow
@api_bp.route("/wo... |
nome = input('Digite seu nome:')
if nome == 'Cristiano':
print('Sou eu')
else:
print('Nรฃo sou seu')
|
from django.db import models
from bitoptions import BitOptions, BitOptionsField
TOPPINGS = BitOptions(
('pepperoni', 'mushrooms', 'onions', 'sausage', 'bacon', 'black olives',
'green olives', 'green peppers', 'pineapple', 'spinach', 'tomatoes',
'broccoli', 'jalapeno peppers', 'anchovies', 'chicken', 'bee... |
print(["ABC","ARC","AGC"][int(input())//50+8>>5]) |
from __future__ import print_function
import sys
if sys.version_info < (3, 8):
print(file=sys.stderr)
print('This game needs Python 3.8 or later; preferably 3.9.', file=sys.stderr)
exit(1)
try:
import moderngl
import pyglet
import png
except ImportError:
print(file=sys.stderr)
print('Y... |
#!/usr/bin/python2
#Dasporal
import swiftclient
import os, sys, mimetypes
import requests
import json
import pprint
data = file(os.path.join(sys.path[0], "../tokens.json"))
tokens = json.load(data)
if len(sys.argv) != 2 or len(sys.argv) != 3:
print ("Usage: podcast_upload.py [audio file name]")
exit(1)
# ... |
DEFAULT_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'
SPECIAL_CASES = {
'ee': 'et',
}
LANGUAGES = {
'af': 'afrikaans',
'sq': 'albanian',
'ar': 'arabic',
'be': 'belarusian',
'bg': 'bulgarian',
'ca': 'catalan',
'zh-CN': 'chinese_simplified',
'zh-TW': 'chinese_traditional',... |
from keras.engine import InputSpec
from keras.layers import Dense
from keras.layers.wrappers import Wrapper, TimeDistributed
class Highway(Wrapper):
def __init__(self, layer, gate=None, **kwargs):
self.supports_masking = True
self.gate = gate
super(Highway, self).__init__(layer, **kwargs... |
import tensorflow as tf
import tqdm
from one_shot_learning_network import MatchingNetwork
class ExperimentBuilder:
def __init__(self, data):
"""
Initializes an ExperimentBuilder object. The ExperimentBuilder object takes care of setting up our experiment
and provides helper functions such... |
from __future__ import annotations
from typing import TYPE_CHECKING
from os import chdir, path
from asdfy import ASDFProcessor, ASDFAccessor
if TYPE_CHECKING:
from obspy import Trace, Stream
if not path.exists('traces.h5') and path.exists('tests/traces.h5'):
chdir('tests')
def func1(stream: Stream):
#... |
import numpy as np
from starfish.core.expression_matrix.concatenate import concatenate
from starfish.core.expression_matrix.expression_matrix import ExpressionMatrix
from starfish.types import Features
def test_concatenate_two_expression_matrices():
a_data = np.array(
[[0, 1],
[1, 0]]
)
... |
"""The plugin module implements various plugins to extend the behaviour
of community app.
The plugins provided by this module are:
SketchsTab - additional tab to show on the profile pages
LiveCodeExtension - injecting livecode css/js into lesson page
"""
import frappe
from community.plugins import PageExtensi... |
# -*- coding: utf-8 -*-
"""
@description: ๅ็ฑปๅจ
@author:XuMing
"""
import re
import jieba
from jieba import posseg
class DictClassifier:
def __init__(self):
self.__root_path = "data/dict/"
jieba.load_userdict("data/dict/user.dict") # ่ชๅฎไนๅ่ฏ่ฏๅบ
# ๆ
ๆ่ฏๅ
ธ
self.__phrase_dict = self.__get... |
import discord
import logging
import os
class ValorantBot(discord.Client):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.BOT_LOG = os.getenv('BOT_LOG')
if self.BOT_LOG == 'INFO' or self.BOT_LOG is None or self.BOT_LOG == '':
logging.getLogger().s... |
import unittest
from typing import List, Text
INPUT_FILE = "input.txt"
TEST_INPUT_SHORT = "test_input_short.txt"
TEST_INPUT_LONG = "test_input_long.txt"
def getJolts(inputFile: Text):
jolts: List[int] = []
with open(inputFile, "r") as inputFile:
lines = inputFile.readlines()
for line in lines... |
from resolwe.process import IntegerField, Process, StringField
class PythonProcessDataIdBySlug(Process):
"""The process is used for testing get_data_id_by_slug."""
slug = "test-python-process-data-id-by-slug"
name = "Test Python Process Data ID by Slug"
version = "1.0.0"
process_type = "data:pyth... |
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib import style
import pandas as pd
style.use('fivethirtyeight')
fig = plt.figure(figsize=(12,8))
ax1 = fig.add_subplot(2,2,1)
ax2 = fig.add_subplot(2,2,2)
ax3 = fig.add_subplot(2,2,3)
ax4 = fig.add_subplot(2,2,4)
de... |
import os
from src.MarkdownFile import MarkdownFile
class Parser:
def __init__(self, folderPath='.', ignoredDirectories=['.obsidian', '.git']):
self._folderPath = folderPath
self._ignoredDirectories = ignoredDirectories
self.mdFiles = list[MarkdownFile]
self._retrieveMarkdownFiles()... |
# Created byMartin.cz
# Copyright (c) Martin Strohalm. All rights reserved.
import pero
class DrawTest(pero.Graphics):
"""Test case for text properties drawing."""
def draw(self, canvas, *args, **kwargs):
"""Draws the test."""
# clear canvas
canvas.fill(pero.color... |
# 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, software
# distributed under the Li... |
########################################
# Automatically generated, do not edit.
########################################
from pyvisdk.thirdparty import Enum
AutoStartWaitHeartbeatSetting = Enum(
'no',
'systemDefault',
'yes',
)
|
"""
Vulnerability service interfaces and implementations for `pip-audit`.
"""
from .interface import (
Dependency,
ResolvedDependency,
ServiceError,
SkippedDependency,
VulnerabilityResult,
VulnerabilityService,
)
from .osv import OsvService
from .pypi import PyPIService
__all__ = [
"Depend... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.