text stringlengths 2 999k |
|---|
# Copyright (c) 2016 Mirantis, 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 requir... |
import numpy as np
from core.evaluation.labels import Label, LabelPair
from core.source.opinion import Opinion
from networks.context.configurations.base import LabelCalculationMode
from networks.context.debug import DebugKeys
from networks.context.helpers.labels.base import LabelsHelper
from networks.context.processin... |
# -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot
snapshots = Snapshot()
snapshots['test_presets_on_examples 1'] = {
'pipelineOrError': {
'name': 'airline_demo_ingest_pipeline',
'presets': [
{
... |
#!/usr/bin/env python
from distutils.core import setup
import os
from currencies import __version__
# Compile the list of packages available, because distutils doesn't have
# an easy way to do this.
packages, data_files = [], []
root_dir = os.path.dirname(__file__)
if root_dir:
os.chdir(root_dir)
for dirpath, di... |
import asyncio
import pprint as pretty_print
import typing
from typing import Any, Dict, Text, Optional
from rasa.cli.utils import print_success, print_error
from rasa.core.interpreter import NaturalLanguageInterpreter, RasaNLUInterpreter
import rasa.model as model
if typing.TYPE_CHECKING:
from rasa.core.agent imp... |
class Solution:
def minSetSize(self, arr: List[int]) -> int:
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the Safari history event formatter."""
import unittest
from plaso.formatters import safari
from tests.formatters import test_lib
class SafariHistoryFormatterTest(test_lib.EventFormatterTestCase):
"""Tests for the Safari history event formatter."""
def tes... |
#!/usr/bin/env python3
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
if __name__ == "__main__":
from openvino.tools.mo.subprocess_main import subprocess_main
subprocess_main(framework='onnx')
|
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Font(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "densitymapbox.legendgrouptitle"
_path_str = "densitymapbox.legendgrouptitle.font"
_valid_props... |
import os
import re
from functools import lru_cache
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from orchestra import plugins
from orchestra.utils.python import import_class
from . import settings
class AppOption(plugins.Plugin, metaclass=plugins.Plugi... |
#!/usr/bin/env python3
print_last_digit = __import__('9-print_last_digit').print_last_digit
print_last_digit(98)
print_last_digit(0)
r = print_last_digit(-1024)
print(r)
|
# coding: utf-8
import pprint
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
class CreateVpcRouteResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (di... |
#
# 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: utf8
from __future__ import unicode_literals
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS, TOKEN_MATCH
from .punctuation import TOKENIZER_PREFIXES, TOKENIZER_SUFFIXES, TOKENIZER_INFIXES
from .stop_words import STOP_WORDS
from ..tokenizer_exceptions import BASE_EXCEPTIONS
from ..norm_exceptions imp... |
import time
from collections import defaultdict
from math import sqrt
from itertools import combinations
def profiler(method):
def wrapper_method(*arg, **kw):
t = time.time()
ret = method(*arg, **kw)
print(
"Method "
+ method.__name__
+ " took : "
... |
#!/usr/bin/env python
"""
uritemplate.variable
====================
This module contains the URIVariable class which powers the URITemplate class.
What treasures await you:
- URIVariable class
You see a hammer in front of you.
What do you do?
>
"""
import sys
try:
import collections.abc as collections_abc
e... |
n = int(input('Introduce la cantidad de meses: '))
c = int(input('Introduce el total del credito: '))
cat = float(input('Introduce el valor del CAT en porcentaje: '))/100
a = int(input('Introduce la anualidad: '))
p = sum([1/((1+cat)**(i/12)) for i in range(1,n+1)])
mensualidad = (c-a)/p
print(f'Las mensualidades ser... |
import numpy as np
import healpy as hp
def _random_theta_phi(nside, pix):
theta, phi = hp.pix2ang(nside, pix, nest=True)
dpix = np.sqrt(hp.nside2pixarea(nside))
theta += np.random.uniform(-dpix/2, dpix/2, size=len(theta))
phi += np.random.uniform(-dpix/2, dpix/2, size=len(phi)) * np.cos(np.pi/2 - theta... |
from django.contrib import admin
from diary.models import Diary, Entry
admin.site.register(Diary)
admin.site.register(Entry)
|
r"""
Quiver Representations
AUTHORS:
- Jim Stark (2012-03-04): Initial implementation of acyclic quivers without
relations.
- Simon King (2013-05, 2014-02): Split code up. Allow cyclic quivers where
possible.
A quiver is a directed graph used for representation theory. In our
representation theoretic code, it is... |
"""Annotated multivariate observation data."""
from ._metadata import __version__, __author__, __email__
from ._core.anndata import AnnData, ImplicitModificationWarning
from ._core.merge import concat
from ._core.raw import Raw
from ._io import (
read_h5ad,
read_loom,
read_hdf,
read_excel,
read_um... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
import pyarrow.plasma as plasma
import pytest
import sys
import tempfile
import threading
import time
import numpy as np
import redis
import ray
import ray.ray_constants as ray_constants... |
# Created: 09.02.2010, 2018 adapted for ezdxf
# Copyright (c) 2010-2021, Manfred Moitzi
# License: MIT License
import ezdxf
from ezdxf.render import Spline
from ezdxf.math import Vec3, Matrix44
next_frame = Matrix44.translate(0, 5, 0)
right_frame = Matrix44.translate(10, 0, 0)
NAME = "spline.dxf"
doc = ezdxf.new("R2... |
#!/usr/bin/env python
import os
import requests
import json
import datetime
import shutil
from bs4 import BeautifulSoup
here = os.path.dirname(os.path.abspath(__file__))
hospital_id = os.path.basename(here)
url ='https://www.uhhospitals.org/patients-and-visitors/billing-insurance-and-medical-records/cms-medicare-pri... |
from typing import List, Optional
from fastapi import Depends, HTTPException, status
from sqlalchemy.orm import Session
from ..db import tables
from ..db.database import get_session
class GameService:
"""Service for game."""
def __init__(self, session: Session = Depends(get_session)) -> None:
self.... |
# ImageDownloader - Muhammed Shokr its amazing
def ImageDownloader(url):
import os, re, requests
response = requests.get(url)
text = response.text
p = r'<img.*?src="(.*?)"[^\>]+>'
img_addrs = re.findall(p, text)
for i in img_addrs:
os.system("wget {}".format(i))
return 'DONE... |
"""
Command that will allow for a user to inject triples into a database.
"""
from rhobot.components.commands.base_command import BaseCommand
from rdflib.namespace import FOAF
from rhobot.namespace import RHO
from rhobot.components.storage import StoragePayload
import logging
logger = logging.getLogger(__name__)
cla... |
from flask_wtf import FlaskForm
from wtforms import BooleanField, SelectField, StringField,SubmitField,PasswordField
from wtforms.validators import DataRequired,Email,EqualTo
from wtforms import ValidationError
from flask_wtf.file import FileField,FileAllowed
from flask_login import current_user
from companyblog.model... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
import smart_imports
smart_imports.all()
def raise_exception(*argv, **kwargs):
raise Exception('unknown error')
class TestRegistration(utils_testcase.TestCase):
def setUp(self):
super(TestRegistration, self).setUp()
game_logic.create_test_map()
tt_services.players_timers.cmd_debug... |
import time
from numpy.random import seed
seed(8)
import tensorflow
tensorflow.random.set_seed(7)
from tensorflow.keras.preprocessing.image import ImageDataGenerator
import tensorflow as tf
import pickle
import socket
import argparse
from tensorflow.python.keras import models
from tensorflow.python.k... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: hfc/protos/idemix/idemix.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
fr... |
class LinearSizeKeyFrame(SizeKeyFrame,ISealable,IKeyFrame):
"""
Animates from the System.Windows.Size value of the previous key frame to its own System.Windows.Media.Animation.SizeKeyFrame.Value using linear interpolation.
LinearSizeKeyFrame()
LinearSizeKeyFrame(value: Size)
LinearSizeKeyFrame(valu... |
#!/usr/bin/evn python
# _*_ coding: utf-8 _*_
import numpy as np
import sys
import os
import shutil
"""
usage:
"""
# ============================================
# CP2K / PW_DFT / MIXER
#=============================================
class cp2k_pw_dft_mixer:
"""
"""
def __init__(se... |
# Generated by Django 4.0 on 2021-12-27 13:23
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ToDoListItem',
fields=[
('id', models.BigAuto... |
# --------------
# Import packages
import numpy as np
import pandas as pd
from scipy.stats import mode
path
bank=pd.read_csv(path)
print(bank.head())
# code starts here
categorical_var=bank.select_dtypes(include = 'object')
print(categorical_var)
numerical_var=bank.select_dtypes(include = 'number')
print(numerical_va... |
import mock
from beagle.datasources import ElasticSearchQSSerach
@mock.patch.object(ElasticSearchQSSerach, "_setup_session")
def test_init(mock_method):
ElasticSearchQSSerach(index="logs-*", query="*")
assert mock_method.called
@mock.patch.object(ElasticSearchQSSerach, "_setup_session")
def test_event_loop(... |
import os
import sys
from .builder import build_all
from .dumper import dump
from .expression import add_context_processor
from .functions import definitions
from .tree import NodeException
for definition in definitions:
add_context_processor(definition)
class ErrorList(list):
def __init__(self):
se... |
from ..search_attribute import SearchAttribute
class Returnable(object):
"""A mixin to add the returns method"""
def returns(self, value):
"""return the Request setup with ReturnValues attribute
Adds the ReturnValues to the request attributes dict
Args:
value: NONE | ALL_... |
__title__ = 'wagtailgmaps'
__version__ = '1.0.1'
__author__ = 'Springload'
__license__ = 'MIT'
__copyright__ = 'Copyright 2017 Springload'
|
"""
Django settings for test_project project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
impo... |
#G00387859 DONAL MAHER
"""
Write a program that takes a positive floating-point number as input and outputs an
approximation of its square root.
You should create a function called sqrt that does this.
"""
import math
def sqrt(num):
#recreate the math
#sqrtR = math.sqrt(num)
sqrtR= num**(1.0/2)
retu... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-20 18:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dominion', '0035_auto_20180831_0922'),
('character', '0031_auto_20181116_1219'),
... |
"""Testing Error Message."""
from pyof.v0x01.asynchronous.error_msg import (
BadRequestCode, ErrorMsg, ErrorType, FlowModFailedCode)
from tests.test_struct import TestStruct
class TestErrorMessage(TestStruct):
"""Test the Error Message."""
@classmethod
def setUpClass(cls):
"""Setup TestStruct... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2018, Nigel Small
#
# 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
#
# Unle... |
# 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 applicab... |
from steam2sqlite import main
def test_main():
"""runs the script for a brief time"""
result = main.main(("--limit", "0.1"))
assert result == 0
|
from typing import Optional
from pydantic import Field
from pystratis.api import Model
class PeerInfoModel(Model):
"""A pydantic model with power information.."""
peer_id: int = Field(alias='id')
"""The peer id."""
addr: str
"""The peer address."""
addrlocal: str
"""The local peer address.... |
class Counter(object):
def __init__(self): #コンストラクタ 新しいクラス作るとき必要
self.cnt = 0
def count(self):
self.cnt += 1
def doublecount(self):
self.cnt += 2
def reset(self):
self.cnt = 0
def show(self):
print(self.cnt)
def __repr__(... |
DEADLINE = 99999999999
def test_call_max_no_value(liquid_lgt, relayer, storage, accounts):
initial_tokens = liquid_lgt.poolTokenReserves()
calldata = "60fe47b1000000000000000000000000000000000000000000000000000000000000000f"
expected_tokens = liquid_lgt.getEthToTokenInputPrice("0.003 ether")
assert ex... |
###############################################################################
#
# An example of writing cell comments to a worksheet using Python and
# XlsxWriter.
#
# For more advanced comment options see comments2.py.
#
# Copyright 2013-2016, John McNamara, jmcnamara@cpan.org
#
import xlsxwriter
workbook = xlsxwri... |
# coding=utf-8
# Copyright 2018 DPR Authors, The Hugging Face Team.
#
# 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 a... |
import argparse
import json
import os
import random
import pickle
from collections import Counter
def get_context(mention_id, mentions, entities, context_size):
mention = mentions[mention_id]
context_document_id = mention['context_document_id']
s = mention['start_index']
t = mention['end_index']
... |
#!/usr/bin/env python3
import json, sys, os, logging
try:
log = logging.getLogger()
log.addHandler(logging.StreamHandler(sys.stdout))
log.setLevel(logging.INFO)
if len(sys.argv) < 4:
log.info('Usage: update_project.py <project identifier> <container name> <url> [<url>] [<url>] ...')
exit(1)
projectId = s... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
import json
import re
import urllib2
import copy
api_server = kobitonServer['url']
username = kobitonServer['username']
api_key = kobitonServer['apiKey']
group_options = {
'cloudDevices': isCloud,
'privateDevices': isPrivate,
'favoriteDevices': isFavorite
}
platform_options = {
'Android': isAndroid,
'iOS':... |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# 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... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Woochain Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Run regression test suite.
This module calls down into individual test cases via subprocess. It will
... |
import abc
import dataclasses
import functools
import re
from typing import Any, Dict, List, Optional, Pattern, Set, Tuple
from manubot.util import import_function
from .citekey import CiteKey
"""
Non-citation prefixes used by the pandoc-xnos suite of Pandoc filters,
including pandoc-fignos, pandoc-tablenos, and pan... |
"""
Syntax: .invite<username>
for all users
Customized by @meanii
Please Don't remove credit name
"""
from telethon import functions
from uniborg.util import admin_cmd
from telethon import events
@borg.on(admin_cmd(pattern="invite ?(.*)"))
@borg.on(events.NewMessage(pattern=r"\.invite ?(.*)",incoming=True))
async... |
"""
>>> getRootFolder()["manfred"] = Mammoth()
>>> from zope.testbrowser.wsgi import Browser
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.open("http://localhost/manfred/@@painting")
>>> print(browser.contents)
<html>
<body>
<h1>GROK MACRO!</h1>
<div>
GROK SLOT!
</div>
... |
# -*- coding: utf-8 -*-
# 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... |
import sys
from PyQt6.QtWidgets import (
QApplication,
QLabel,
QMainWindow,
QPushButton,
QVBoxLayout,
QHBoxLayout,
QWidget,
QScrollArea,
)
from words import words
class WordleLetter(QPushButton):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
... |
# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/
#
# 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 the rights to use, copy, modify, m... |
# import the settings file
from django.conf import settings
def globalize_oauth_vars(request):
# return the value you want as a dictionnary. you may add multiple values in there.
return {'SHOW_LOGIN_FORM': settings.SHOW_LOGIN_FORM,
'FORGOT_PASSWORD': settings.FORGOT_PASSWORD,
'CLASSIC_... |
import math
import os
import sys
import time
import traceback
import pygame
import pygame.gfxdraw
import pygame.gfxdraw
import pygame.locals
from daegu_bank.classification_statistics import ClassificationStatistics
from daegu_bank.monthly_statistics import MonthlyStatistics
from personal_financial_analyzer import Per... |
from datetime import datetime
from sqlite3.dbapi2 import DatabaseError
from database_connection import database_connection as default_database_connection
from services.reading_tip_factory import ReadingTipFactory
# pylint: disable=missing-function-docstring
def give_tip_object(row):
"""A helper function for creat... |
# -*- coding: utf-8 -*-
""" Models for the parameters application. """
# standard library
import json
import datetime
import time
# django
from django.core.cache import cache
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.text import slugify
from django.utils.transla... |
from django.db import models
class Location(models.Model):
lat = models.DecimalField(max_digits=9, decimal_places=6)
lng = models.DecimalField(max_digits=9, decimal_places=6)
|
#!/usr/bin/python
from argparse import (ArgumentParser)
import logging, os, re, datetime, time
import pandas as pd
from parsityper.helpers import init_console_logger,read_fasta, read_samples
import multiprocessing as mp
from multiprocessing import Pool
from parsityper.scheme import parseScheme, constructSchemeLookups,... |
"""
1d interpolation functions based off the Pecaut & Mamajek (2013) tables:
http://www.pas.rochester.edu/~emamajek/EEM_dwarf_UBVIJHK_colors_Teff.txt
Contents:
get_interp_mass_from_rstar
get_interp_rstar_from_teff
get_interp_BmV_from_Teff
get_interp_BpmRp_from_Teff
get_interp_BmV_from_BpmRp
get... |
# 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 ... |
# =========== MENU AND SUBMENU IN TKINTER ===========
from tkinter import *
root = Tk()
root.geometry('800x400')
root.title('Pycharm')
def myfunc():
print('omkar sutar')
# create space for main menu in horizontal bar
mainmenu = Menu(root)
# Use this to create main menu without submenu in gui
mainmenu.add_command... |
import psycopg2
connect = psycopg2.connect(
host = "localhost",
database = "GasStationAutomationDB",
user = "postgres",
password = "031100") |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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 witho... |
#!/usr/bin/python
from configparser import ConfigParser
import sys
import logging
import pyinotify
import envhelper
import MyLogger
datafolder = "./config/"
class SingletonType(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = ... |
board = [['a', 'b', 'c'], ['d', 'e', 'f'], ['g, h, i']]
def dfs(dims, i, j, target, K, res, visited):
if (i < 0 or j < 0 or i >= dims[0] or j >= dims[1] or K < 0 or visited[i][j] == True): return
K -= 1
visited[i][j] = True
dfs(dims)
def count_paths(dims, start, target, K):
"""
@param dims... |
from solution import solution
def test(index, inp, expected, debug=False, disable=False):
if disable:
print("Test %d : DISABLED!!!" % (index))
return
r = solution(inp, debug)
if r == expected:
print("Test %d : OK" % index)
else:
print("Test %d : FAIL : %s" % (index, str(... |
import os
import sys
import json
import atexit
import click
from create_results_folders import create_folders
from logger import get_logger
import user_details as user
from crawler import WgGesuchtCrawler
@click.command()
@click.option(
"--filter-names",
help='Names of the filters you want to use (comma separ... |
"""Runway config deployment definition."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple, Union, overload
from ....exceptions import UnresolvedVariable
from ....variables import Variable
from ...models.runway import (
RunwayDeploymentDefi... |
# -*- coding: utf-8 -*-
"""Implementation of the R-GCN model."""
import logging
from os import path
from typing import Any, Callable, Mapping, Optional, Type
import torch
from torch import nn
from torch.nn import functional
from . import ComplEx, DistMult, ERMLP
from .. import EntityEmbeddingModel
from ..base impor... |
from time import time
from typing import TYPE_CHECKING, Any, Dict, Optional
if TYPE_CHECKING: # pragma: no cover
from yatq.dto import Task
class BaseTaskRunner:
def __init__(self, ctx: Dict[str, Any], task: "Task") -> None:
self.ctx = ctx
self.task = task
self.run_start: Optional[fl... |
""" Advent of code 2020 day 08/1 """
import math
from os import path
import re
import logging
instruction_parser = re.compile(r'(nop|acc|jmp)\s+([+-]\d+)')
class HandheldDevice(object):
def __init__(self, instructions):
self.instructions = instructions
self.ip = 0
self.acc = 0
se... |
# -*- coding: utf-8 -*-
#
# Copyright (c), 2016-2020, SISSA (International School for Advanced Studies).
# All rights reserved.
# This file is distributed under the terms of the MIT License.
# See the file 'LICENSE' in the root directory of the present
# distribution, or http://opensource.org/licenses/MIT.
#
# @author ... |
# -*- coding: utf-8 -*-
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
from qtpy.QtCore import Qt
from qtpy.QtWidgets import (QLabel, QVBoxLayout, QFrame,
QHBoxLayout, QPushButton)
from spyder.config.base impo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import config
from telegram.ext import Updater
import os
import logging
import getopt
import sys
import mysystemd
from telegram import Update,BotCommand
from telegram.ext import CallbackContext,Dispatcher,CommandHandler
# logging.basicConfig(level=logging.INFO,
# ... |
#encoding:utf-8
subreddit = 'Coronavirus+COVID19'
t_channel = '@redditcoronavirus'
def send_post(submission, r2t):
return r2t.send_simple(submission)
|
import sys
import time
import psycopg2 as psycopg2
import os
def start_database():
try:
while True:
try:
conn = psycopg2.connect(dbname=os.environ['DB_NAME'], user=os.environ['DB_USERNAME'], password=os.environ['DB_PASSWORD'], host=os.environ['DB_HOSTNAME'],
... |
# Title : Factorial of a number
# Author : Kiran raj R.
# Date : 18:10:2020
def factorial(n):
if n == 1:
return 1
else:
result = n * factorial(n - 1)
return result
try:
userInput = input("Enter a number to find the factorial: ")
num = int(userInput)
if num == 0:
... |
from project.beverage.beverage import Beverage
class ColdBeverage(Beverage):
pass |
import unittest
import os
import os.path
from programy.spelling.norvig import NorvigSpellingChecker
class SpellingStoreAsserts(unittest.TestCase):
def assert_upload_from_file(self, store):
store.empty()
store.upload_from_file(os.path.dirname(__file__) + os.sep + "data" + os.sep + "spelling" + o... |
import sys
CRITICAL = 50
ERROR = 40
WARNING = 30
INFO = 20
DEBUG = 10
NOTSET = 0
_level_dict = {
CRITICAL: "CRIT",
ERROR: "ERROR",
WARNING: "WARN",
INFO: "INFO",
DEBUG: "DEBUG",
}
_stream = sys.stderr
class LogRecord:
def __init__(self):
self.__dict__ = {}
def __getattr__(self,... |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
# ----------------------------------------------------------------------------------------------------------------------
# Customize your APP title, subtitle and menus here
# ----------------------------------------... |
# -*- coding: utf-8 -*-
"""
Python bindings for the ECMWF Atlas mesh library.
"""
from ._atlas4py import *
|
#!/usr/bin/env ipy
import clr
clr.AddReference('System.Drawing')
clr.AddReference('System.Windows.Forms')
clr.AddReference('WatiN.Core.dll')
# .NET imports
from System.Windows import Forms
from System import Drawing
import WatiN.Core as Watin
# Python imports
import sys
sys.path.append('C:\Python26\Lib')
sys.path.app... |
# ~~~ aydao ~~~~ 2020 ~~~
#
# Copy over the weights (trainables in G, D, Gs) to another network
#
import warnings
warnings.filterwarnings('ignore', category=FutureWarning)
warnings.filterwarnings('ignore', category=DeprecationWarning)
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.E... |
from datetime import datetime
from app import db
class UserCode(db.Model):
__tablename__ = 'userCode'
id = db.Column(db.Integer, primary_key=True)
user = db.Column(db.String(80))
title = db.Column(db.String(100))
code = db.Column(db.Text)
pub_date = db.Column(db.DateTime)
def __init__(self, user, title,code,pu... |
import numpy as np
from cereal import car
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.car.volkswagen.values import DBC_FILES, CANBUS, NetworkLocation, TransmissionTyp... |
import json
import logging
import os
import subprocess
import sys
from typing import Any, Dict, List, Optional, Tuple
from pytest_embedded.app import App
class IdfApp(App):
"""
Idf App class
Attributes:
app_path (str): App path
binary_path (str): binary file path
elf_file (str): ... |
# Definition for singly-linked list.
# class ListNode(object):
# def _init_(self, x):
# self.val = x
# self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
carry =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.