text stringlengths 1 927k |
|---|
"""Constants for pyIndego."""
from enum import Enum
class Methods(Enum):
"""Enum with HTTP methods."""
GET = "GET"
POST = "POST"
PUT = "PUT"
DELETE = "DELETE"
PATCH = "PATCH"
OPTIONS = "OPTIONS"
HEAD = "HEAD"
DEFAULT_URL = "https://api.indego.iot.bosch-si.com/api/v1/"
CONTENT_TYPE_J... |
import pygame
from pygame.sprite import Sprite
class Ship(Sprite):
def __init__(self, ai_settings, screen):
super(Ship, self).__init__()
self.screen = screen
self.ai_settings = ai_settings
self.image = pygame.image.load('images/ship.bmp')
self.rect = self.image.get_rect()
... |
# Generated by Django 3.1.5 on 2021-01-21 19:32
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Author',
fields=[
... |
import json
import functools
import asyncio
from collections import defaultdict
from aiohttp import web
from aiohttp.abc import AbstractView
from jsonschema.validators import validator_for
__author__ = """Dmitry Chaplinsky"""
__email__ = 'chaplinsky.dmitry@gmail.com'
__version__ = '0.1.1'
def _raise_exception(cls, ... |
# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------... |
## @package Labelling_app
# Labelling app software developed with Grabcut
#
# @version 1
#
# Pontificia Universidad Javeriana
#
# Electronic Enginnering
#
# Developed by:
# - Andrea Juliana Ruiz Gomez
# Mail: <andrea_ruiz@javeriana.edu.co>
# GitHub: andrearuizg
# - Pedro Eli Ruiz Zarate
# Mail: <... |
import os
import cv2
import numpy as np
from absl import flags, app
from PIL import Image
from torch.utils.data import Dataset, DataLoader
from .data_utils import RandomCrop
from ..external.hmr.src.util import image as img_util
import tqdm
bgData = './dataset/PRW-v16.04.20/frames'
flags.DEFINE_string('PRW_img_path'... |
#!/usr/bin/python
import sys, traceback
import cv2
import numpy as np
import argparse
import string
import plantcv as pcv
### Parse command-line arguments
def options():
parser = argparse.ArgumentParser(description="Imaging processing with opencv")
parser.add_argument("-i", "--image", help="Input image file.", req... |
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
class Mail:
"""Sending an email with smtp library"""
def __init__(self, smtpaddr, smtpport):
self.smtpaddr = smtpaddr
self.smtpport = smtpport
def check_mail_inputs(self, fromaddr, fro... |
"""
Copyright 2015 Hewlett-Packard
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, softwar... |
# -*- coding: utf-8 -*-
from django.template import engines
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from tests.test_app.models import DummyLink, DummySpacer
from djangocms_text_ckeditor.cms_plugins import TextPlugin
@plugin_pool.register_plugin
class PreviewDisabledPlugin(... |
#!/usr/bin/python
import serial
import time
import random
import sys
s = None
num_leds = 93
play_time = 0
def flush_input():
s.flushInput()
def wait_for_ack():
while s.inWaiting() <= 0:
pass ... |
#!/usr/bin/env python
from random import randint
from eth_tester.exceptions import TransactionFailed
from pytest import raises
from utils import longToHexString, PrintGasUsed, TokenDelta, BuyWithCash, AssertLog
def proceedToDesignatedReporting(fixture, market):
fixture.contracts["Time"].setTimestamp(market.getEnd... |
# -*- coding: utf-8 -*-
"""Tools for getting URI format strings.
.. warning::
URI format strings are different from URI prefix strings. URI format strings have a ``$1`` where
the prefix should go, which makes them more general than URI prefix strings.
"""
from typing import List, Mapping, Optional, Sequence... |
from __future__ import absolute_import
import pkg_resources
from semantic_version import (
Spec,
)
from cytoolz.dicttoolz import (
assoc,
)
import rlp
from eth_utils import (
encode_hex,
to_tuple,
)
from eth_tester.constants import (
FORK_HOMESTEAD,
FORK_DAO,
FORK_SPURIOUS_DRAGON,
... |
import cv2
import numpy as np
class sharpening:
def __init__(self):
pass
def sharp(self,image):
# Create sharpening kernel
kernel = np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]])
# applying the sharpening kernel to the input image & displaying it.
sharpened = cv2.filter2D(image, -1, kernel)
# Noise... |
load("//:deps.bzl",
"bazel_gazelle",
"bazel_skylib",
"org_pubref_rules_node",
"build_bazel_rules_nodejs",
"build_bazel_rules_typescript",
"com_google_protobuf",
"io_bazel_rules_closure",
"io_bazel_rules_go",
"io_bazel_rules_webtesting",
"ts_protoc_gen",
)
def ts_proto_compile(*... |
# Generated by Django 3.2 on 2021-06-22 16:46
from django.db import migrations, models
import parking_permits_app.constants
class Migration(migrations.Migration):
dependencies = [
("parking_permits_app", "0003_add_price_model"),
]
operations = [
migrations.AlterField(
model... |
import datetime
from django.core.management.base import BaseCommand
from canvas.notifications.actions import Actions
from drawquest import knobs, economy
from drawquest.apps.explore.models import preloaded_explore_comment_ids
from drawquest.apps.quest_comments.models import QuestComment
class Command(BaseCommand):
... |
"""Test component helpers."""
# pylint: disable=protected-access
from collections import OrderedDict
from openpeerpower import helpers
def test_extract_domain_configs():
"""Test the extraction of domain configuration."""
config = {
"zone": None,
"zoner": None,
"zone ": None,
"... |
#!/usr/bin/env python
'''
Reads an existing model and do something.
'''
from __future__ import print_function
import h5py
from PIL import Image
import numpy as np
import os
from keras import backend as K
import model
# dataset config
from config_emoji import *
batch_size = 100
# path to the stored model
base = '... |
"""Test runway.module.staticsite.parameters.models."""
# pylint: disable=no-self-use
# pyright: basic
from typing import Any, Dict, cast
import pytest
from pydantic import ValidationError
from runway.module.staticsite.parameters.models import (
RunwayStaticSiteCustomErrorResponseDataModel,
RunwayStaticSiteLam... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
import unittest
import os
from cdm.enums import CdmObjectType, CdmRelationshipDiscoveryStyle
from cdm.storage import LocalAdapter
from tests.common import async_... |
# coding=utf-8
# Copyright 2019 The Google Research Authors.
#
# 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 applicab... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
"""Philips Hue lights platform tests."""
import asyncio
from collections import deque
import logging
from unittest.mock import Mock
import aiohue
from aiohue.lights import Lights
from aiohue.groups import Groups
import pytest
from homeassistant import config_entries
from homeassistant.components import hue
from homea... |
from ._abstract import AbstractCrawler
from .abstractsitemapscraper import FilteredSitemapSpider
class Food(AbstractCrawler):
def crawl(self, es, client, process):
URL = ['https://www.food.com/robots.txt']
rules = [('/recipe/', 'parse_recipes')]
domains = ['food.com']
process.craw... |
"""
Curations for release v1.3.1
This script combines various curations on Sco-GEM v1.3.0 to produce v1.3.1.
Indicated is which issues are solved, more detailed explanation is given in the
relevant pull requests.
"""
# Import required functions, add any that are necessary for your code.
import sys
import cobra
from d... |
from django.views import generic
from django.contrib.auth.models import User
from django.db.models import Count
from django.shortcuts import reverse
from django.db.models import Q
from django.http import JsonResponse, HttpResponseForbidden, HttpResponse
import json
import random
from mutagen.easyid3 import EasyID3
fr... |
from models import OfficeModel
from flask_sqlalchemy import sqlalchemy
from config import db
import uuid
class OfficeActions():
# Table actions:
@classmethod
def create(cls, usa_state: str, office_code: str):
new_office = OfficeModel(usa_state=usa_state, office_code=office_code)
db.session.add(... |
import torch.nn as nn
class Decoder(nn.Module):
def __init__(self, layer_sizes, latent_size):
super().__init__()
self.MLP = nn.Sequential()
input_size = latent_size
for i, (in_size, out_size) in enumerate(zip([input_size]+layer_sizes[:-1], layer_sizes)):
self.MLP.ad... |
import numpy as np
dtype_obj: np.dtype[np.str_]
reveal_type(np.dtype(np.float64)) # E: numpy.dtype[numpy.floating[numpy.typing._64Bit]]
reveal_type(np.dtype(np.int64)) # E: numpy.dtype[numpy.signedinteger[numpy.typing._64Bit]]
# String aliases
reveal_type(np.dtype("float64")) # E: numpy.dtype[numpy.floating[numpy... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... |
import functools
import logging
import typing as t
from enum import Enum
from discord import Colour, Embed
from discord.ext import commands
from discord.ext.commands import Context, group
from bot import exts
from bot.bot import Bot
from bot.constants import Emojis, MODERATION_ROLES, Roles, URLs
from bot.converters i... |
import html
import json
import urllib
import sparql
class WikiWrapper():
@staticmethod
def download_pages_name(q):
result = sparql.query('http://dbpedia.org/sparql', q)
names = []
for item in result.fetchall():
row = sparql.unpack_row(item)
names.append(row[0].... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
# -*- coding: utf-8 -*-
"""
up2github
~~~~~~~~~
Save uploaded pictures in github.
:copyright: (c) 2020 by staugur.
:license: BSD 3-Clause, see LICENSE for more details.
"""
__version__ = '0.1.1'
__author__ = 'staugur <staugur@saintic.com>'
__hookname__ = 'up2github'
__description__ = '将图片保存到GitHu... |
"""The ``dgl.nn`` package contains framework-specific implementations for
common Graph Neural Network layers (or module in PyTorch, Block in MXNet).
Users can directly import ``dgl.nn.<layer_name>`` (e.g., ``dgl.nn.GraphConv``),
and the package will dispatch the layer name to the actual implementation
according to the ... |
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
from unittest import TestCase
from unittest.mock import patch, call
from duologsync.app import *
from duologsync.config import Config
def running_is_false(msg):
Program._running = False
class TestApp(TestCase):
def tearDown(self):
Config._config = None
Config._config_is_set = False
Pro... |
'''
█ █▄ █ █▄█ ▄▀▄ █▄ ▄█ ██▀ █▀▄ █▀▄ █▀
█ █ ▀█ █ █ █▀█ █ ▀ █ █▄▄ █▀ █▄▀ █▀
Dev : IlhamGUD
'''
import time
import shutil
from pdf import PROCESS
from pyrogram import filters
from Configs.dm import Config
from plugins.checkPdf import checkPdf
from plugins.progress import progress... |
#This program compares an unkown face with a known face and identifies the person in the unknown image, with controlled tolerance (strictness)
import face_recognition
img_of_bill = face_recognition.load_image_file('./img/known/Bill_Gates.jpg')
bill_face_encoding = face_recognition.face_encodings(img_of_bill)[0] ... |
from datetime import datetime
from json import dumps, loads
from sqlite3 import connect
from threading import RLock, Thread
from time import sleep
import myDevices.schedule as schedule
from myDevices.requests_futures.sessions import FuturesSession
from myDevices.utils.logger import debug, error, exception, info, logJs... |
version_info = (0, 0, 3, 2)
__version__ = '.'.join(map(str, version_info)) |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... |
#
# Generated with PointFenderBlueprint
from dmt.blueprint import Blueprint
from dmt.dimension import Dimension
from dmt.attribute import Attribute
from dmt.enum_attribute import EnumAttribute
from dmt.blueprint_attribute import BlueprintAttribute
from sima.sima.blueprints.namedobject import NamedObjectBlueprint
clas... |
#!/usr/bin/env python3
## @package my_module
import sys
import copy
import rospy
import moveit_commander
import moveit_msgs.msg
import geometry_msgs.msg
from math import pi
from std_msgs.msg import String
from rqt_mypkg import path_planning_interface
from rqt_mypkg import statistics
from rqt_mypkg.msg import PathStatis... |
#!/usr/bin/env python
from __future__ import print_function
import string
import os
import sys
import bgutils
RunningLog = []
def DumpAndExit(msg):
global RunningLog
print("")
print(msg + " Details follow...")
print("")
for l in RunningLog:
print(l.strip())
print("")
print("")
sys.exit(-1)
r... |
#!/usr/bin/env python
"""Simple parsers for OS X files."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import datetime
import io
import os
import stat
import biplist
from future.utils import string_types
from grr_response_core.lib import parser
fro... |
from django.contrib import admin
from django.utils.translation import gettext as _
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from . import models
class UserAdmin(BaseUserAdmin):
ordering = ["id"]
list_display = ["email"]
fieldsets = (
(None, {'fields': ('email', 'password')... |
# -*- coding: utf-8 -*-
from io import StringIO
from ipykernel.comm import CommManager
from ipykernel.kernelbase import Kernel
from ipykernel.zmqshell import ZMQInteractiveShell
from robotkernel.constants import THROBBER
from traitlets import Any
from traitlets import Instance
from traitlets import Type
import re
cla... |
import bottle
from email import encoders
import email.utils
from email.mime.base import MIMEBase
from email.mime.image import MIMEImage
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import io
import json
import os
import png
import pyqrcode
import requests
import settings
import sm... |
from .sc2pathlib import PathFind
# from . import _sc2pathlib
# import sc2pathlib
import numpy as np
from typing import Union, List, Tuple
from math import floor
def to_float2(original: Tuple[int, int]) -> Tuple[float, float]:
return (original[0] + 0.5, original[1] + 0.5)
class PathFinder:
def __init__(self... |
disease_name = 'COVID-19'
# Prob. of fatality (https://www.worldometers.info/coronavirus/coronavirus-age-sex-demographics):
p_covid19_fat_by_age_group = {
'0-9' : 0.000,
'10-19' : 0.002,
'20-29' : 0.002,
'30-39' : 0.002,
'40-49' : 0.004,
'50-59' : 0.013,
'60-69' : 0.036,
'70-79' : 0.0... |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
from pkg_resources import EGG_NAME, parse_version, safe_name, safe_version
from .archiver import Archiver
from .base import maybe_requirement
from .interpreter import PythonInt... |
import sys
from collections import Counter
import matplotlib.pyplot as plt
import numpy as np
from eval_utils import *
class Evaluator:
def GetPascalVOCMetrics(self,
boundingboxes,
IOUThreshold=0.5,
method=MethodAveragePrecision... |
# -*- coding: utf-8 -*-
import os
from config import Config
from config import Template
scene = 'C:/TEMP/SDD_Experiments/scenes/SimpleForPrecision.scene'
gridSizes = [(40, 40), (20, 20)]
gridHeight = 2.5
imageSize = (160, 120)
templates = [Template('res/person_01.ppm', 1, [60, 180], [120, 200])]
firstFrame = ... |
# exported from PySB model 'model'
from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD
Model()
Monomer('Ligand', ['Receptor'])
Monomer('ParpU', ['C3A'])
Monomer('C8A', ['BidU', 'C3pro'])
Monomer('SmacM', ['BaxA'])
Monomer('BaxM', ['BidM', '... |
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def index():
return render_template('index.html')
@app.route("/leaderboard")
def leaderboard():
return render_template('leaderboard.html')
@app.route("/profile")
def profile():
return render_template('profile.html')
app.run() |
from system.db import db
from telegram_bot.handlers.utils.decorators import remember_new_user, \
send_typing, write_logs
from telegram_bot.handlers.utils.menu_entries import MenuEntry
from telegram_bot.handlers.utils.reply_markup import create_main_reply_markup
from telegram_bot.models import User
@write_logs
@se... |
"""Unit tests for kernel integrity.
Kernel integrity tests verify if the kernel type and architecture
is as expected from the kernel header.
"""
import shutil
import unittest
from pds.naif_pds4_bundler.utils import check_kernel_integrity
def test_text_kernel_integrity(self):
"""Test text kernel integrity.
... |
# Copyright The OpenTelemetry Authors
#
# 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 ... |
from __future__ import absolute_import, division, print_function, unicode_literals
from echomesh.base import Config
from echomesh.base import Platform
from echomesh.util import Log
from echomesh.util import Subprocess
LOGGER = Log.logger(__name__)
OUTPUT_COMMAND = 'sudo', 'amixer', 'cset', 'numid=3'
COMMANDS = dict(... |
# Copyright 2021 MosaicML. All Rights Reserved.
from typing import List, Optional
from composer.models.base import MosaicClassifier
from composer.models.model_hparams import Initializer
from composer.models.resnets import ImageNet_ResNet
class ResNet101(MosaicClassifier):
"""A ResNet-101 model extending :class:... |
import peewee
class Trade(peewee.Model):
id = peewee.UUIDField(primary_key=True)
# timestamp in milliseconds
timestamp = peewee.BigIntegerField()
price = peewee.FloatField()
buy_qty = peewee.FloatField()
sell_qty = peewee.FloatField()
buy_count = peewee.IntegerField()
sell_count = p... |
import re
def basic_cleaning(input_path='data/haiku.txt', output_path='data/haiku_cleaned.txt', threshold=50):
'''
Ignore lines that exceeds threshold length for poem,
and lines starting with non alphabet
'''
with open(input_path, 'r') as fsrc:
with open(output_path, 'w') as fdest:
... |
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
from os import getenv
from celery import Celery
from lazy_object_proxy import Proxy
from packit_service.models import get_pg_url
from packit_service.sentry_integration import configure_sentry
class Celerizer:
def __init__(self):
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 9 18:00:12 2019
@author: carsault
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from utilities import utils
from utilities.utils import *
#%%
class ModelFamily(nn.Module):
def __init__(self):
super(ModelFamily, ... |
import logging
import time
from loguru import logger
from goodguy.service.crawl import get_recent_contest
from goodguy.timer.contest.email_job import send_contest_remind_email
from goodguy.timer.contest.feishu_job import send_contest_feishu_message
from goodguy.util.config import GLOBAL_CONFIG as GBC
from goodguy.uti... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: matchmaker.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 google.protobuf import reflection as _re... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@date: 2021-Today
@author: marie-christin.wimmler@tu-dresden.de
"""
from .NetworkBettina import NetworkBettina |
# coding=utf-8
"""Dependency data object."""
import json
class Dependency:
"""Dependency data object.
Use to specify dependencies between PBs, workflow stages, and SBIs?
"""
def __init__(self, config_dict: dict):
"""Create a dependency object from a DB dependency dict."""
self._confi... |
import jdatetime
class Wodev:
def __init__(self, is_shamsi=True, first_week=None):
self.is_shamsi = is_shamsi
self.today = jdatetime.date.today()
if first_week:
self.first_week = first_week
else:
if is_shamsi:
self.first_week = jdatetime.date... |
import os
import asyncio
import logging
import configparser
from contextlib import suppress
from eventkit import Event
from ib_insync.objects import Object
from ib_insync.contract import Forex
from ib_insync.ib import IB
import ib_insync.util as util
__all__ = ['IBC', 'IBController', 'Watchdog']
class IBC(Object):... |
from django.core.exceptions import ValidationError
from django.contrib.auth.models import User
from django.shortcuts import reverse
from django_webtest import WebTest
from django_dynamic_fixture import G
from profiles.models import UserProfile
from .models import PrivateMessageGroup
from .views import UsernamesField
... |
import requests
import nekos
from PIL import Image
import os
from telegram import Message, Chat, Update, Bot, MessageEntity
from telegram import ParseMode
from telegram.ext import CommandHandler, run_async
from Bot import dispatcher, updater
def is_user_in_chat(chat: Chat, user_id: int) -> bool:
member = chat.g... |
# Copyright 2017 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 hashtable.linked_list import *
class HashTable :
def __init__(self, size = 1024):
self.size = size
self._buckets = [None] *self.size
def hash(self,key:str)->int:
'''
hash will hashed the key means convert the key string into a value of int
parameters:
key: a string
Argumen... |
#!/usr/bin/env python
# flake8: noqa: E402
""" Meant to be used by mesos-slave instead of the /usr/bin/docker executable
directly This will parse the CLI arguments intended for docker, extract
environment variable settings related to the actual node hostname and mesos
task ID, and use those as an additional --hostname ... |
import math
# https://github.com/wandergis/coordTransform_py/blob/master/coordTransform_utils.py
xu = 6370996.81
Sp = [1.289059486E7, 8362377.87, 5591021, 3481989.83, 1678043.12, 0]
Hj = [75, 60, 45, 30, 15, 0]
a = 6378245.0 # 长半轴
ee = 0.00669342162296594323 # 偏心率平方
Au = [[1.410526172116255e-8, 0.0000089830550964... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
# @author weishu @2015/12/7
import subprocess
import os
import re
import json
from AppKit import NSWorkspace, NSBundle
from pypinyin import lazy_pinyin
# copy from Alfred 2 preferences, if you have applications installed at other place, add it here.
APP_DIRECTORYS = [
... |
# Copyright 2018-2021 Streamlit 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 wr... |
import pandas as pd
from bokeh.io import show, output_file
from bokeh.plotting import figure
from bokeh.sampledata.stocks import MSFT
df = pd.DataFrame(MSFT)[:51]
inc = df.close > df.open
dec = df.open > df.close
p = figure(plot_width=1000, title="MSFT Candlestick with Custom X-Axis")
# map dataframe indices to dat... |
# coding=utf-8
"""General utilities."""
from six import iteritems
class Enum(object):
@classmethod
def values(cls):
for attribute, value in iteritems(cls.__dict__):
if attribute.startswith('_'):
continue
yield value |
from scipy.sparse import csr_matrix
from sklearn.feature_extraction.text import CountVectorizer
import numpy as np
import pickle
from sklearn.feature_extraction.text import TfidfVectorizer
import re
from joblib import Memory
cachedir = 'cache/'
memory = Memory(cachedir, verbose=0)
path_to_site_dict = 'data/site_dic.... |
# coding: utf-8
"""
Intersight REST API
This is Intersight REST API
OpenAPI spec version: 1.0.9-262
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class CommIpV6Interface(object):
"""
NOTE: This cla... |
from cs50 import get_string
def main():
r_text = get_string("Text: ")
total_letters = 0
total_words = 0
total_sentences = 0
L = 0.0
S = 0.0
# determine the number of letters
# words and sentences in the string
for i in r_text:
tmpChar = i
if tmpChar.isalpha():
... |
# Video Player
# imported necessary library
import tkinter
from tkinter import *
import tkinter as tk
import tkinter.messagebox as mbox
from tkinter import ttk
from tkinter import filedialog
from PIL import ImageTk, Image
import cv2
import numpy as np
# Main Window & Configuration
window = tk.Tk() # created a tkint... |
#
# Copyright 2018-2022 Elyra Authors
#
# 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 writ... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016--, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# -----------------------------------------------... |
from enum import Enum
from ..base import Base
from .material import *
from .axis import Axis
STRUCTURAL_PROPERTY = "Objectives.Structural.Properties"
class MemberType(int, Enum):
Beam = 0
Column = 1
Generic1D = 2
Slab = 3
Wall = 4
Generic2D = 5
VoidCutter1D = 6
VoidCutter2D = 7
c... |
from .SkillsTab import *
from .Skill import *
from .SkillArmor import *
from .SkillArmorSetBonus import *
from .SkillCharm import *
from .SkillDecoration import *
from .SkillDetail import * |
import logging
import aiohttp
from aiogram import Bot, Dispatcher, types
from aiogram.contrib.fsm_storage.redis import RedisStorage2
from data import config
session = aiohttp.ClientSession()
bot = Bot(token=config.BOT_TOKEN, parse_mode=types.ParseMode.HTML)
storage = RedisStorage2(
config.REDIS_HOST,
config... |
import os
import torch
from torch import nn
from torch.nn import functional as F
from torchvision import datasets, transforms
from src.models.base import BaseModel
class MNIST(BaseModel):
def _setup(self):
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import pprint
from base import BaseObject
from base import FileIO
class GenerateParents(BaseObject):
""" Generate the parent (type) for each term
this is the SINGLE SOURCE OF TRUTH for parents in the entire system
this generated file can ... |
import os
import unittest
from contextlib import redirect_stdout
from datetime import datetime
from io import StringIO
from unittest.mock import patch
from uuid import uuid4
import pytest
from prompt_toolkit.document import Document
from prompt_toolkit.validation import ValidationError
from pepys_import.core.store.da... |
import sys
import copy
import json
from collections import OrderedDict
from keys import *
from keys import _NO_ARG
def _is_valid_object(name, object_):
if not isinstance(object_, Keyable):
raise Exception("Invalid schema. %s is not a Keyable." % name)
def _proto_message_name(string):
if string != st... |
#!/usr/bin/env python3
"""
Representation of a patient, with phenotypes described with HPO terms.
"""
__author__ = 'Orion Buske (buske@cs.toronto.edu)'
import json
import logging
import csv
logger = logging.getLogger(__name__)
class Patient:
def __init__(self, id, hp_terms, neg_hp_terms=None, onset=None, diagn... |
#!/usr/bin/python
# TODO: test scenario
import sys
import time
import os
processes = {}
sys.path.append(os.path.abspath(__file__ + '/../../..'))
from library import runner, optionParser
def issueRequest(opts, url, expectedResult):
print 'connecting to localhost:%s' % opts.httpdPort
connection = runner.createCon... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.