text stringlengths 2 999k |
|---|
from . import h
from .DefaultOrderedDict import DefaultOrderedDict
def addDfnPanels(doc, dfns):
# Constructs "dfn panels" which show all the local references to a term
atLeastOnePanel = False
# Gather all the <a href>s together
allRefs = DefaultOrderedDict(list)
for a in h.findAll("a", doc):
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
logger = logging.getLogger(__name__)
VERSION = (0, 99, 6)
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
__author__ = "Alberto Paro"
__contact__ = "alberto.paro@gmail.com"
__homepage__ = "http://github.com/aparo/pyes... |
# Copyright (c) 2017, the ElectrumX authors
#
# All rights reserved.
#
# The MIT License (MIT)
#
# 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 limit... |
"""Test the internal utility functions."""
import math
import numpy as np
import pandas as pd
import pytest
import xarray as xr
from pandas import DatetimeIndex as DTI
from pandas import TimedeltaIndex as TDI
from pandas import date_range
from pint.errors import DimensionalityError
import weldx.utility as ut
from we... |
import sys
# modificar esta funcion
def make_link(G, n1, n2, w):
if n1 not in G:
G[n1] = {}
if n2 not in G[n1]:
G[n1][n2] = []
G[n1][n2].append(w)
if n2 not in G:
G[n2] = {}
if n1 not in G[n2]:
G[n2][n1] = []
G[n2][n1].append(w)
return G
def count(G, e):
... |
from dataclasses import dataclass
from decimal import Decimal
from typing import Union
from babel.numbers import get_currency_precision
from django.conf import settings
from django.contrib.sites.models import Site
from prices import Money, MoneyRange, TaxedMoney, TaxedMoneyRange
class TaxError(Exception):
"""Def... |
#! /usr/bin/python
def fak(n) :
if n == 0 :
return 1
else :
ret = 1
i = n
while i > 0 :
ret *= i
i -= 1
return ret
def binKoeff(n,r) :
return fak(n) / ( fak(r)*fak(n-r) )
sum = 0
a = 1
while a < 101 :
print a
b = 1
while b <... |
from __future__ import print_function
from rpython.translator.backendopt import removenoops
from rpython.translator.backendopt import inline
from rpython.translator.backendopt.malloc import remove_mallocs
from rpython.translator.backendopt.constfold import constant_fold_graph
from rpython.translator.backendopt.constfol... |
from tyckiting_client.ai import base
from tyckiting_client import actions
from tyckiting_client.ai.strategies import escaping
from tyckiting_client.ai.strategies import scanning
'''
Rules:
Move if in danger
Else shoot at first target if available
Else scan random field
'''
class Ai(base.BaseAi):
def __init__(... |
from cloudant import Cloudant
from flask import Flask, render_template, request, jsonify
import atexit
import os
import json
app = Flask(__name__, static_url_path='')
db_name = 'mydb'
client = None
db = None
if 'VCAP_SERVICES' in os.environ:
vcap = json.loads(os.getenv('VCAP_SERVICES'))
print('... |
"""Определяет схемы URL для пользователей"""
from django.urls import path, include
from . import views
app_name = 'users'
urlpatterns = [
# Включить URL авторизации по умолчанию.
path('', include('django.contrib.auth.urls')),
# Страница регистрации.
path('register/', views.register, name='register'),
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from modules.logging import logging_decorator
from telegram.ext import PrefixHandler
from telegram import ChatAction
from datetime import datetime
from uptime import uptime
import platform
import cpuinfo
import psutil
def module_init(gd):
commands = gd.config["commands"]
... |
from datetime import datetime
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask_project import db, login_manager, app
from flask_login import UserMixin
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class User(db.Model, UserMixin):
id =... |
import socket
sock = socket.socket()
sock.connect(("127.0.0.1", 9000))
# ^ one-liner: sock = socket.create_connection(("127.0.0.1", 9000))
sock.sendall("ping".encode("utf8"))
sock.close()
|
#from Z3ModelEmergencyResponseOriginal import *
from consts import METRICS_MAXIMIZE, METRICS_MINIMIZE
from npGIAforZ3 import GuidedImprovementAlgorithm, \
GuidedImprovementAlgorithmOptions
from npGIAforZ3 import setRecordPoint
from z3 import *
import Z3ModelEShopOriginal as SHP
import Z3ModelEmergencyResponseOrigin... |
# coding=utf-8
"""
Uses /proc/loadavg to collect data on load average
#### Dependencies
* /proc/loadavg
"""
import diamond.collector
import re
import os
from diamond.collector import str_to_bool
_RE = re.compile(r'([\d.]+) ([\d.]+) ([\d.]+) (\d+)/(\d+)')
class LoadAverageCollector(diamond.collector.Collector):... |
import hashlib
text = input('enter string to encrpyt: ')
encode = hashlib.sha256(text.encode())
print(encode.hexdigest())
|
"""
Django settings for sampleSite project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os... |
# -*- coding: utf-8 -*-
#
# 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
#... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.14.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... |
"""Test ZHA Core channels."""
import asyncio
import math
from unittest import mock
from unittest.mock import AsyncMock, patch
import pytest
import zigpy.profiles.zha
import zigpy.types as t
import zigpy.zcl.clusters
import homeassistant.components.zha.core.channels as zha_channels
import homeassistant.components.zha.... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'WSystem.is_shattered'
db.add_column(u'Map_wsystem', 'is_shattered',
se... |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic list exercises
# D. Given a list of numbers, return a list where
# al... |
from __future__ import absolute_import
import struct
import random
from . import *
_len = len
_type = type
default_xid = lambda: long(random.random()*0xFFFFFFFF)
def _obj(obj):
if isinstance(obj, str):
return obj
elif isinstance(obj, tuple):
return eval(obj.__class__.__name__)(*obj)
else:
ra... |
# coding=utf-8
# Copyright 2021 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... |
HEADERS = {"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36"}
BASE_URL = "https://www.transfermarkt.com" |
from chocs import Application, HttpStatus
from chocs.testing import TestClient
from tests.fixtures.app_fixture import app
app.use("tests.fixtures.routes_fixture")
TestClient.__test__ = False
class TestTestClient:
def test_instantiate(self) -> None:
client = TestClient(Application())
assert isins... |
#! /usr/bin/env python2
# -*- coding: utf-8 -*-
#======================================================================
#
# emake.py - emake version 3.6.5
#
# history of this file:
# 2009.08.20 skywind create this file
# 2009.11.14 skywind new install() method
# 2009.12.22 skywind implementation execute int... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2021 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A tool to generate compile_commands file."""
import argparse
import json
import logging
import os
impo... |
# ===============================================================================
# Copyright 2021 ross
#
# 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/LICE... |
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, HttpRequest, HttpResponse
from django.db.models import Sum, Max, Count, Q, F
from django.core.paginator import Paginator
from django.contrib import messages
imp... |
#!/usr/bin/env python3
"""
Unit tests for cdsearch.py
"""
from pathlib import Path
import pytest
import requests
import requests_mock
from synthaser import ncbi
from synthaser.models import SynthaseContainer, Synthase
TEST_DIR = Path(__file__).resolve().parent
@pytest.fixture
def parameters():
return {
... |
#!/usr/bin/env python
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Updates the Fuchsia SDK to the given revision. Should be used in a 'hooks_os'
entry so that it only runs when .gclient's target_os in... |
import math
import torch
import torch.nn.functional as F
import pytest
from einops import rearrange, repeat
from src.ops.fused_softmax_dropout import _fused_softmax_dropout
@pytest.mark.parametrize('dtype', [torch.float16])
@pytest.mark.parametrize('seqlen', [128, 512, 1024])
def test_softmax_dropout(seqlen, dtyp... |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from colorama import Fore
import time, sys, os, ctypes, shutil
def tokengrabber():
def spinner():
l = ['|', '/', '-', '\\']
for i in l+l:
sys.stdout.write(f"""\r{y}[{b}#{y}]{w} Creating File... {i}""")
sys.stdout.flush()
time.sleep(0.2)
print('\... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette.by import By
from gaiatest.apps.base import Base
class DeviceInfo(Base):
_phone_number_locator = ... |
"""Handles generation of HAR archives.
This code has been taken from the har_dump.py addon in the mitmproxy project.
"""
import base64
import json
from datetime import datetime, timezone
from typing import List, Set
import seleniumwire
from seleniumwire.thirdparty.mitmproxy import connections
from seleniumwire.thirdp... |
import json
from django import http
from django.contrib.admin.models import LogEntry
from django.contrib.contenttypes.models import ContentType
from django.forms import models as model_forms
from django.utils.translation import ugettext as _
from .form import FormMixin
from .model import ModelMixin
def log(user, fl... |
"""
Kalman Filtering
"""
from sympy import *
import utils as utils
import SuperMatExpr as SME
import MVG as MVG
# Shapes
m, n = symbols('m n')
# Variables
x_prev = SME.SuperMatSymbol(m,1,name='x_(t-1)',mat_type='var') # x_(t-1)
x_t = SME.SuperMatSymbol(m,1,name='x_t',,mat_type='... |
import platform
from setuptools import Extension, setup
def get_ext_modules() -> list:
"""
获取三方模块
Windows需要编译封装接口
Linux和Mac由于缺乏二进制库支持无法使用
"""
extra_compile_flags = ["-O2", "-MT"]
extra_link_args = []
runtime_library_dirs = []
vnsecmd = Extension(
"vnpy_sec.api.vnsecmd",... |
"""add timestamps
Revision ID: a03babc74226
Revises:
Create Date: 2018-11-26 12:43:14.682188
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a03babc74226'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.add_column('product'... |
from dataclasses import dataclass
@dataclass
class FuncInput:
pass
@dataclass
class FuncOutput:
comments: str
func_success: bool
@dataclass(order=True)
class Desription:
info: str
GUI_title: str
@dataclass(frozen=True)
class CmdStruct:
#name: str
func_input: FuncInput
func_output:... |
# Generated by Django 3.1.2 on 2020-10-22 11:02
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import functools
import jsonfield.fields
import purpleserver.core.models
class Migration(migrations.Migration):
initial = True
dependencies = [
... |
# Generated by Django 2.2.4 on 2019-08-18 12:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sherkat', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='sherkat',
name='nam',
fie... |
import os
import shutil
from pathlib import Path
from unittest import TestCase
from deepclustering.dataset.segmentation.wMH_dataset import WMHDataset, WMHSemiInterface
class TestDownloadDataset(TestCase):
def setUp(self) -> None:
super().setUp()
self.dataset_root = "./"
self.dataset_subfo... |
#
# 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 t... |
from button import Button
from containers import signals
from layout import layout
import pygame
from resources import lang, theme
class Toolbar:
def __init__(self, display, x, y):
self.display, self.x, self.y = display, x, y
button_count = 2
self.bg = pygame.Rect(x, y, layout.window.w, l... |
# Generated by Django 3.1.3 on 2020-12-05 13:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pages', '0007_auto_20201205_0129'),
]
operations = [
migrations.AlterField(
model_name='gift',
name='image',
... |
"""
:mod:`eapi` -- Classes support manipulating Early American Imprints MARC records to CC's
standards.
"""
__author__ = 'Jeremy Nelson'
from marc_batch.marc_helpers import MARCModifier
import urlparse
from pymarc import Field
PROXY_LOCATION = ''
class EarlyAmericanImprintsJob(MARCModifier):
''' Class reads E... |
import ast
import _ast
from _ast import Dict, Constant
import astor
from nimoy.compare.types import Types
class ComparisonExpressionTransformer(ast.NodeTransformer):
def __init__(self) -> None:
super().__init__()
self.comparator_methods = {
_ast.Eq: Types.EQUAL,
_ast.NotE... |
import functools
import warnings
def replace_parameters(replacement_params,
end_version='future',
lib_name='Nistats',
):
"""
Decorator to deprecate & replace specificied parameters
in the decorated functions and methods
without chang... |
# qubit number=5
# total number=56
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(0) # number=3
pr... |
# Generated by Django 2.2.3 on 2019-08-02 19:41
from django.db import migrations, models
from django.contrib.postgres.fields import JSONField
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Collection',
... |
"""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, soft... |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test compact blocks (BIP 152).
Version 1 compact blocks are pre-segwit (txids)
Version 2 compact blocks are... |
from infi.systray import SysTrayIcon
class TrayIcon(object):
icon_fn = "icon.png"
def __init__(self,title,menu=None,on_quit=None,icon=icon_fn):
"""
Param *menu: Recebe tupla contendo tuplas com ("texto do botão","ícone do menu",função).
Param icon: Recebe o nome do ícone a ser car... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
==================
Active-Alchemy
==================
A framework agnostic wrapper for SQLAlchemy that makes it really easy
to use by implementing a simple active record like api, while it still uses the db.session underneath
:copyright: © 2014/2016 by `Mardix`.
:licen... |
import numpy as np
import torch
from torch import Tensor
from PIL import Image, ImageEnhance
def torch_none(x: Tensor):
return x
def torch_rot90_(x: Tensor):
return x.transpose_(2, 3).flip(2)
def torch_rot90(x: Tensor):
return x.transpose(2, 3).flip(2)
def torch_rot90_(x: Tensor):
return x.tran... |
class Instruccion:
"""Clase abstracta"""
class CreateDatabase(Instruccion):
"""
Clase que representa la instruccion CREATE DATABASE
Esta instruccion es la encargada de crear una nueva base de datos en el DBMS
"""
def __init__(self, replace, exists, name, mode, owner):
"""
Comm... |
import pytest
from typing import Dict, List
from sodasql.telemetry.soda_telemetry import SodaTelemetry
from sodasql.telemetry.soda_tracer import soda_trace
from sodasql.telemetry.memory_span_exporter import MemorySpanExporter
from sodasql.telemetry.soda_exporter import get_soda_spans
from tests.common.telemetry_helpe... |
import multigrid
from ntiling import TilingBuilder
from drawing.pil_draw_simple import Draw
palette = [
"#7fb414",
"#fac70b",
"#127681",
"#df0e62",
"#21174a",
]
draw = Draw(scale=150, width=3*1280, height=3*1280, bg_color=palette[-1])
draw.line_color = None
index_range = (-2, 2)
grid = multigrid.Mu... |
# -*- coding: utf-8 -*-
"""five: six, redux"""
PY2 = (str is bytes)
PY3 = (str is not bytes)
# provide a symettrical `text` type to `bytes`
if PY2: # pragma: no cover
text = unicode # noqa
def n(s):
if isinstance(s, bytes):
return s
else:
return s.encode('UTF-8')
els... |
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import sys
import numpy as np
import yaml
from retinaface.backbones.resnet_v1_fpn import ResNet_v1_50_FPN
from retinaface.models.models import RetinaFace
from retinaface.utils.anchor import AnchorUtil
from retinaface.u... |
from .AbstractEncoder import *
from .AbstractDecoder import *
__all__ = ["AbstractEncoder", "AbstractDecoder"]
|
import pandas
print(pandas.__version__)
|
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 15 14:39:41 2020
@author: derbaghc
"""
import numpy as np
from random import *
def average_above_zero(table: list):
"""
Fonction qui calcule la moyenne des valeurs d'un tableau donné, en
sélectionnant seulement les valeurs positives
param:
tab ... |
from datetime import datetime
from dateutil.tz import tzutc
from peewee import DateTimeField
from wunderlist.util import utc_to_local
class DateTimeUTCField(DateTimeField):
def python_value(self, value):
value = super(DateTimeUTCField, self).python_value(value)
if isinstance(value, datetime):
... |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"There is not a whole lot to test, but this does get us basic coverage."
import hashlib
import unittest
from ..commo... |
from swsscommon import swsscommon
import os
import re
import time
import json
import redis
class SaiWmStats:
queue_shared = "SAI_QUEUE_STAT_SHARED_WATERMARK_BYTES"
pg_shared = "SAI_INGRESS_PRIORITY_GROUP_STAT_SHARED_WATERMARK_BYTES"
pg_headroom = "SAI_INGRESS_PRIORITY_GROUP_STAT_XOFF_ROOM_WATERMARK_BYTES"... |
"""This module provides a cross section cache which automatically extracts
cross-sections from provided nuclear data sets."""
import sys
import inspect
from warnings import warn
from itertools import product
from collections import MutableMapping
import numpy as np
import tables as tb
from pyne import nucname
from ... |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... |
# -*- coding: utf-8 -*-
# The MIT License (MIT) - Copyright (c) 2016-2021 Dave Vandenbout.
"""
Arrange part units for best schematic wiring.
"""
from __future__ import ( # isort:skip
absolute_import,
division,
print_function,
unicode_literals,
)
import math
import re
from builtins import str, super... |
"""
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... |
# Generated by Django 2.0.5 on 2018-06-09 10:26
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('teacher', '0024_auto_20180609_1026'),
]
operations ... |
import spotify
# Assuming a spotify_appkey.key in the current dir:
session = spotify.Session()
# Assuming a previous login with remember_me=True and a proper logout:
session.relogin()
while session.connection.state != spotify.ConnectionState.LOGGED_IN:
session.process_events()
album = session.get_album('spotify... |
from collections import OrderedDict
from datetime import date, datetime
from wsgiref.util import FileWrapper
from django.conf import settings
from django.contrib import messages
from django.core.exceptions import PermissionDenied
from django.db.models.query_utils import Q
from django.http.response import (
Http404... |
# 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 u... |
from sys import argv, exit
from getopt import getopt, GetoptError
# Constant variables
GRID_SIZE = 20 # Grid size for rows and columns
GRID_CHAR = ' ' # Character to fill blanks in the grid
ERRORS = [
'No intersections',
'Illegal adjacencies',
'Out of bounds'
] # List containing error strings
def main(... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
#FILE_NO:2
#FILE NAME:iris_dataset_classification_algorithm.py
#WRITTEN BY: Sarvesh Chitko (exploringML)
#VERSION:1.1 DATE:20160316
import scipy as sp
from sklearn.datasets import load_iris
data=load_iris()
features=data['data'] #this contains actual measurements of the various params (petal length, sepal length etc.)
... |
#!/usr/bin/env python
import json
import requests
import uuid
from abc import ABC
from .encryption import Encryption
from ..exceptions.exceptions import NTCoreAPIException
from ..__about__ import __version__
from requests_toolbelt.adapters.ssl import SSLAdapter
try:
from urllib.parse import urljoin
except ImportErr... |
# Plotting tutorials in Python
# Polar Plots
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.style.use('default')
# Parameters
n = 2001
f = np.pi
r = 5.0
# Data
theta = np.linspace(0, 20.0*np.pi, n)
curve1 = r*np.cos(f*theta)
curve2 = r*np.sin(f*theta)
# Get an axes handle/object
a... |
# coding: utf-8
"""
Couchbase Backup Service API
This is REST API allows users to remotely schedule and run backups, restores and merges as well as to explore various archives for all there Couchbase Clusters. # noqa: E501
OpenAPI spec version: 0.1.0
Generated by: https://github.com/swagger-api... |
from . import base
import umysqldb.cursors
from nose.plugins.skip import SkipTest
raise SkipTest("umysql does not support server-side cursor")
class TestSSCursor(base.UMySQLdbTestCase):
def test_SSCursor(self):
affected_rows = 18446744073709551615
conn = self.connections[0]
data = [... |
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from django.db.models import Q
from rest_framework import mixins, viewsets, authentication, status
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_fram... |
import os
import urlparse
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
BASE_DIR = PACKAGE_ROOT
SITE_ID = int(os.environ.get("SITE_ID", 1))
DEBUG = SITE_ID == 1
if "GONDOR_DATABASE_URL" in os.environ:
urlparse.uses_net... |
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 21 15:47:02 2013
@author: Chad
"""
import scipy as sp #This brings in scipy - whenever I type sp in the program I would otherwise need to type scipy
import time
import random as rand
rand.seed()
def Norris(t):
A=44 #285
tau=1.28 #14.74
k... |
import os
import platform
from collections import OrderedDict, defaultdict
from jinja2 import Environment, FileSystemLoader
from conan.tools.env.environment import ProfileEnvironment
from conans.errors import ConanException, ConanV2Exception
from conans.model.conf import ConfDefinition
from conans.model.env_info impo... |
import sys, os
import pickle
import pandas as pd
import re
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem.MolStandardize import rdMolStandardize
from rdkit import rdBase
rdBase.DisableLog('rdApp.*')
def save_obj(obj, name):
"""save an object with pickle"""
name = na... |
import redis
conn = redis.Redis()
print('Dryer is starting')
while True:
msg = conn.blpop('dishes')
if not msg:
break
val = msg[1].decode('utf-8')
if val == 'quit':
break
print('Dried', val)
print('Dishes are dried')
|
"""
ANSI MUD Colorization.
Colorization library for helping with MUD-style color symbols to transform
them to/from their special escape codes.
"""
import collections
import random
ESCAPE = chr(27)
CSI = ESCAPE + '['
REAL_BRACKET_SYMBOL = '((bracket))'
REMAPS = {
"{r": CSI + "0;31m", # Red
"{1": CSI + "0;31... |
import collections
accepted_from_to = set(['(n)', '(n+1)', '(n-1)'])
class MassDef:
''' Class used to represent the definition of masses in a given
(macro)molecule.
'''
def __init__(self, massdef_file):
self.connect = None
self.connect_init = None
self.redefine_resis = No... |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class BackupSourceStats(object):
"""Implementation of the 'BackupSourceStats' model.
Specifies statistics about a Backup task in a Protection Job Run.
Specifies statistics for one backup task. One backup task is used to
backup on Protection Sour... |
"""
Load the Database to memory.
"""
import warnings
import pandas as pd
from app import APPLOG
from app.base import App, MainApplication
from core.create_db import createBomDB
from core.settings import (
DB_DIR,
BOM_DATA_DIR,
ITEM_DATA_DIR,
ARTICLE_RATES_DIR,
DB_MOD,
ARTLIST_DIR,
SQL_T_A... |
import yaml
import os
from string import Template
filePath = os.path.dirname(__file__)
print(filePath)
fileNamePath = os.path.split(os.path.realpath(__file__))[0]
print(fileNamePath)
yamlPath = os.path.join(fileNamePath,'icons.yml')
print(yamlPath);
f = open(yamlPath,'r',encoding='utf-8')
cont = f.read()
x = yaml.load... |
# ######################################################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... |
#!/usr/bin/env python
""" DAO Object for PhysicsGroups table """
from dbs.dao.Oracle.PhysicsGroup.Insert import Insert as OraPhysicsGroupInsert
class Insert(OraPhysicsGroupInsert):
pass
|
import gym
import numpy as np
import erdos.graph
from erdos.buffered_data_stream import BufferedDataStream
from erdos.data_stream import DataStream
from erdos.message import Message
from erdos.op import Op
from erdos.timestamp import Timestamp
class CarRacingOp(Op):
def __init__(self, name):
# Initialize... |
class Solution:
def knightDialer(self, N):
"""
:type N: int
:rtype: int
"""
xs = [1] * 10
m = [(4, 6), (6, 8), (7, 9), (4, 8), (3, 9, 0), (), (1, 7, 0), (2, 6), (1, 3), (4, 2)]
for _ in range(N - 1):
temp = [0] * 10
for i in range(10):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.