text stringlengths 1 927k |
|---|
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... |
import databases
import sqlalchemy
DB_HOST = "localhost"
DB_NAME = "TEST_DATABASE"
DATABASE_URL = databases.DatabaseURL(
f"postgres://DEV_USER:DEV_PASSWORD@{DB_HOST}:5432/{DB_NAME}"
)
database = databases.Database(str(DATABASE_URL))
metadata = sqlalchemy.MetaData() |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
from numpy.testing import assert_allclose
from ...stats import (
significance_to_probability_normal,
probability_to_significance_normal,
probability_to_significa... |
#!/usr/bin/env python
"""Provide docking motivation layer node."""
import rospy
import json
import math
from enum import Enum
from threading import Lock
import tf
from tf.transformations import euler_from_quaternion
from std_msgs.msg import Bool
from std_msgs.msg import Empty
from geometry_msgs.msg import PoseStamped... |
import os
import config
import json
import tensorflow as tf
import numpy as np
from collections import defaultdict
class Reader:
def __init__(self, mode, data_dir, anchors_path, num_classes, tfrecord_num = 12, input_shape = 416, max_boxes = 20):
"""
Introduction
------------
构造函... |
""" A3C in Code - Centralized/ Gobal Network Parameter Server/ Controller
Based On:
A3C Code as in the book Deep Reinforcement Learning, Chapter 12.
Runtime: Python 3.6.5
Dependencies: numpy, matplotlib, tensorflow (/ tensorflow-gpu), gym
DocStrings: GoogleStyle
Author : Mohit Sewak (p20150023@goa-bits-pilani.a... |
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
matplotlib.rcParams['mathtext.fontset'] = 'stix'
matplotlib.rcParams['font.size'] = 9
ndim = 6
data = np.genfromtxt('dOTD_tst1.out')
xticks = [900, 1100, 1300]
yticks = [[0.7, 0.8, 0.9, 1],
[-0.2, 0, 0.2, 0.4],
[-0.5, 0, 0.... |
'''maior = 0
menor = 0
for p in range(1, 6):
peso = float(input('digite o {}o peso '.format(p)))
if p == 1:
menor = peso
maior = peso
else:
if peso >= maior:
maior = peso
if peso < menor:
menor = peso
print('O maior peso registrado foi {:.1f}kg \nO men... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 25 15:21:34 2021
@author: crtjur
"""
import tkinter as tk
from PIL import Image, ImageTk
root = tk.Tk()
root.title("Title")
root.geometry("280x350")
root.configure(background="black")
class Example(tk.Frame):
def __init__(self, master, *pargs):
tk.Frame.__i... |
from __future__ import division
import argparse
import os
import os.path as osp
import time
import mmcv
import torch
from mmcv import Config
from mmcv.runner import init_dist
from mmdet import __version__
from mmdet.apis import set_random_seed, train_detector
from mmdet.datasets import build_dataset
from mmdet.models... |
#!/usr/bin/env python
#
# Copyright 2016 Cisco Systems, 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 applicab... |
"""Membership forms module
"""
from django.forms import ModelForm
from .models import Note, Term, Organization, Contact, Membership
class NoteForm(ModelForm):
"""Note Form
"""
class Meta:
model = Note
fields = ['title', 'content', 'date_time']
class TermForm(ModelForm):
"""Term Form
... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... |
'''
Sorting Examples for showcasing and developing Jungle features
'''
import inspect
from jungle import JungleExperiment, JungleProfiler
import numpy as np
print('Finished Loading Modules')
class Sorting_Prototype:
print('\n---Test Sort N---')
@JungleExperiment(reps=1, n=[100, 500])
def test_sort_n(self... |
n = int(input('Digite um número inteiro: '))
cont = 0
for c in range(1, n + 1):
if n % c == 0:
print('\033[034m{}\033[m'.format(c), end=' ')
cont += 1
else:
print('\033[031m{}\033[m'.format(c), end=' ')
print('\nO número {} foi divisível {} vezes '.format(n, cont))
if cont == 2:
... |
# -*- coding: utf-8 -*-
r"""
Class to flatten polynomial rings over polynomial ring
For example ``QQ['a','b'],['x','y']`` flattens to ``QQ['a','b','x','y']``.
EXAMPLES::
sage: R = QQ['x']['y']['s','t']['X']
sage: from sage.rings.polynomial.flatten import FlatteningMorphism
sage: phi = FlatteningMorphism(... |
# Import kivy tools
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.recycleboxlayout import RecycleBoxLayout
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.checkbox import CheckBox
from kivy.uix.spinner import ... |
"""
..
---------------------------------------------------------------------
___ __ __ __ ___
/ | \ | \ | \ / the automatic
\__ |__/ |__/ |___| \__ annotation and
\ | | | | \ analysis
___/... |
start_addr = []
next_addr = []
start_addr.append(['8478'])
next_addr.append(['84a4','8498'])
start_addr.append(['8498'])
next_addr.append(['84b0','84a4'])
start_addr.append(['84a4'])
next_addr.append(['84b0'])
start_addr.append(['84b0'])
next_addr.append(['84e0','84d4'])
start_addr.append(['84d4'])
next_addr.appe... |
#!/usr/bin/env python
# coding=utf-8
from flask import render_template, request
from flask import redirect, url_for, flash
from flask_login import login_user
from flask_login import login_required
from flask_login import logout_user
from . import auth
from ..models import User
from .. import logger
@auth.route('/log... |
__all__ = ["Block", "BlockTemplateHeader", "BlockTemplateBody", "BlockTemplate"]
from .transaction import Transaction
class Block:
"""
Block returned by the server.
:param number: Height of the block.
:type number: int
:param hash: Hex-encoded 32-byte hash of the block.
:type hash: str
:... |
r"""
Kazhdan-Lusztig Polynomials
AUTHORS:
- Daniel Bump (2008): initial version
- Alan J.X. Guo (2014-03-18): ``R_tilde()`` method.
"""
#*****************************************************************************
# Copyright (C) 2008 Daniel Bump <bump at match.stanford.edu>
#
# This program is free softwar... |
from datetime import timedelta
from rest_framework import serializers
from ..models.widget import Widget
class BaseWidgetSerializer(serializers.ModelSerializer):
"""
This is the base serializer class for Widget model.
Other widget serializers must be inherited from it.
"""
class Meta:
m... |
# Restfull api using falcon framework
from wsgiref import simple_server
import falcon
import json
#Resource endpoints import
from cartsResource import *
from productsResource import *
# Check that client has application/json in Accept header
# and Content-Type, if request has body
class RequireJSON(object):
de... |
import frappe
from frappe.database import Database
from markdown2 import markdown
from frappe.utils import validate_email_add
def migrate():
pass |
from django.contrib import admin
from Models.models import UserInfo, Question, Choice
admin.site.register(UserInfo)
# admin.site.register(Question)
# admin.site.register(Choice)
class ChoiceInline(admin.StackedInline):
model = Choice
extra = 3
class QuestionAdmin(admin.ModelAdmin):
fieldsets = [
... |
# /xhr/resources/conditional.py -- to fake a 304 response
def main(request, response):
tag = request.GET.first("tag", None)
match = request.headers.get("If-None-Match", None)
date = request.GET.first("date", "")
modified = request.headers.get("If-Modified-Since", None)
if tag:
response.head... |
from utils.datareader import Datareader
from utils.evaluator import Evaluator
from utils.submitter import Submitter
from utils.post_processing import eurm_to_recommendation_list_submission
from utils.post_processing import eurm_to_recommendation_list
from utils.pre_processing import norm_l1_row, norm_max_row, norm_ma... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-01 11:03
from django.db import migrations
from django.db.models import F
def forwards_func(apps, schema_editor):
Page = apps.get_model("wagtailcore", "Page")
Page.objects.filter(has_unpublished_changes=False).update(last_published_at=F('latest_re... |
import logging
import contextlib
import threading
from typing import (
TYPE_CHECKING,
Generator,
)
import pytest
import conftest
from rnode_testing.common import TestingContext
from rnode_testing.rnode import (
docker_network_with_started_bootstrap,
started_peer,
)
from rnode_testing.wait import (
... |
"""
@author: Nathanael Jöhrmann
"""
import json
import textwrap
class Conjugations:
def __init__(self):
self.person = {}
self.negative = ["", ""]
self.passive = ["", ""]
self.passive_negative = ["", ""]
@property
def summary(self) -> str:
result = ""
sep ... |
import asyncio
from functools import partial
from .base_runner import BaseRunner
from .async_tools import raise_return, AsyncExecution
class AsyncioRunner(BaseRunner):
"""Runner for coroutines with :py:mod:`asyncio`"""
flavour = asyncio
def __init__(self):
super().__init__()
self.event_... |
from __future__ import unicode_literals
import pytest
@pytest.fixture
def completer():
import mssqlcli.mssqlcompleter as mssqlcompleter
return mssqlcompleter.MssqlCompleter()
def test_ranking_ignores_identifier_quotes(completer):
"""When calculating result rank, identifier quotes should be ignored.
... |
from Test import Test, Test as test
'''
Complete the solution so that it returns true if the first argument(string) passed in ends with the 2nd argument (also a string).
Examples:
solution('abc', 'bc') # returns true
solution('abc', 'd') # returns false
'''
def solution(string, ending):
return True if string[-l... |
import rospy
import tf
from geometry_msgs.msg import PoseStamped, Quaternion, TwistStamped
from dbw_mkz_msgs.msg import SteeringReport, ThrottleCmd, BrakeCmd, SteeringCmd
from std_msgs.msg import Float32 as Float
from std_msgs.msg import Bool
from sensor_msgs.msg import PointCloud2
from sensor_msgs.msg import Image
im... |
import os
import shutil
import os
from glob import glob
import pandas as pd
import random
from collections import defaultdict
from PIL import Image
from torch.utils.data import Dataset, DataLoader
def get_all_images(dir):
types = ["jpeg", "jpg", "png"]
files = []
for t in types:
path = os.path.join(dir, "**... |
# Copyright 2019 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... |
"""
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the
non-zero elements.
Example:
Input: [0,1,0,3,12]
Output: [1,3,12,0,0]
Note:
You must do this in-place without making a copy of the array.
Minimize the total number of operations.
"""
from unit... |
# encoding: utf-8
from datetime import datetime, timedelta
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils.timezone import now
from dateutil.tz import tzlocal
from core.utils import slugify
class Setup(object):
def setup(self, test=False):
self.te... |
import dnf
import dnf.cli
from glob import glob
import logging
import threading
import tempfile
import subprocess
import shutil
import os
logger = logging.getLogger('dnf')
class ErrorThread(threading.Thread):
_my_exception = None
def run(self, *args):
try:
self._run(*self._args)
... |
# coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
from glob import glob
import os
from setuptools import setup
package_name = 'parameter_tutorial_py'
setup(
name=package_name,
version='0.0.0',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + pac... |
from yaw_controller import YawController
from pid import PID
from lowpass import LowPassFilter
import rospy
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
class Controller(object):
def __init__(self, vehicle_mass, wheel_radius, decel_limit):
self.yaw_controller = None
self.throttle_controller = None
... |
#! /usr/bin/python2
# coding=utf-8
class pyJCal:
def __init__(self):
pass
def div(self, a, b):
return a / b
def gregorian_to_jalali(self, g_y, g_m, g_d):
"""
this function returns result of converting ye gregorian date to jalali
"""
g_days_in_month = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31... |
# -*- coding: utf-8 -*-
#
# OSU DevOps BootCamp documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 15 12:20:17 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated f... |
from fastapi import APIRouter, Depends
from ...api.dependencies.bets import get_bet_by_slug_from_path
from ...models.bets import Bet
router = APIRouter()
@router.get(
'/{slug}',
response_model=Bet,
name="bets:get-bet"
)
async def get_bet(bet=Depends(get_bet_by_slug_from_path)) -> Bet:
return Bet(**b... |
# Copyright 2015 Futurewei. 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 appl... |
# 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... |
"""
PASSENGERS
"""
numPassengers = 26645
passenger_arriving = (
(9, 10, 5, 5, 3, 2, 2, 3, 3, 1, 1, 0, 0, 6, 9, 0, 8, 12, 3, 4, 1, 0, 2, 2, 2, 0), # 0
(5, 10, 9, 11, 6, 2, 0, 5, 1, 1, 1, 0, 0, 11, 5, 5, 6, 6, 1, 2, 2, 1, 4, 0, 0, 0), # 1
(7, 9, 3, 3, 3, 3, 3, 5, 4, 4, 2, 0, 0, 9, 6, 5, 7, 9, 1, 5, 4, 2, 2, 2, 2, ... |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='odc-gee',
version='2.24',
description='Google Earth Engine indexing tools for Open Data Cube',
author='Andrew Lubawy',
author_email='andrew.m.lubawy@ama-inc.com',
install_requires=[
"google-auth>=1.11... |
#!/usr/bin/env python
import argparse
import os
import parallel_deploy
import service_config
import subprocess
import sys
import urlparse
import deploy_utils
from log import Log
ALL_JOBS = ["kafka", "kafkascribe"]
def _get_kafka_service_config(args):
args.kafka_config = deploy_utils.get_service_config(args)
def... |
#! /usr/bin/python
#
# Zephyr's Sanity Check library
#
# Set of code that other projects can also import to do things on
# Zephyr's sanity check testcases.
import logging
import yaml
log = logging.getLogger("scl")
#
#
def yaml_load(filename):
"""
Safely load a YAML document
Follows recomendations from
... |
from datetime import datetime
from decimal import Decimal
from io import StringIO
import numpy as np
import pytest
from pandas.compat import IS64
from pandas.errors import PerformanceWarning
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Grouper,
Index,
MultiIndex,
Series,
... |
import io
import pandas as pd
import json
from flask import (flash,
request,
redirect,
url_for,
jsonify,
render_template,
Blueprint,
abort)
from logzero import logger
from datetime impor... |
import torch
import numpy as np
import random
from torch._six import nan
from itertools import permutations, product
from torch.testing import all_types, all_types_and
from torch.testing._internal.common_utils import \
(TEST_WITH_ROCM, TestCase, run_tests, make_tensor, slowTest)
from torch.testing._internal.commo... |
# Copyright 2022 Jared Hendrickson
#
# 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 wri... |
import scrapy
from selenium import webdriver
from mySpider.items import MyspiderItem
class FundSpider(scrapy.Spider):
name = 'wangyi'
#allowed_domains = ['www.xxx.com']
start_urls = ['http://news.163.com/']
modules_url = [] #存放五个版块的url
def __init__(self):
self.bro = webdriver.Chrome(execut... |
# -*- coding: utf-8 -*-
from numpy import log as nplog
from pandas_ta.utils import get_offset, verify_series
def log_return(close, length=None, cumulative=False, offset=None, **kwargs):
"""Indicator: Log Return"""
# Validate Arguments
close = verify_series(close)
length = int(length) if length and len... |
#!/usr/bin/env python
# Copyright 2017 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Utility exporting basic filesystem operations.
This file was cut from "scripts/common/chromium_utils.py" at:
91310531c31... |
#!/usr/bin/env python3
"""Tool to download files from BaseSpace."""
import sys
import traceback
import atexit
import argparse
import requests
class BaseSpaceDownloadError(Exception):
"""BaseSpace download error."""
pass
def main():
"""Entry point."""
session = requests.Session()
atexit.registe... |
import base64
import datetime
import hashlib
import hmac
import json
import random
import time
from unittest import TestCase
import pytest
from freezegun import freeze_time
from oic.oic.message import AuthorizationRequest
from oic.oic.message import OpenIDRequest
from oic.utils.sdb import AccessCodeUsed
from oic.util... |
import random
proxy_list = [
'http://p.webshare.io:19999'
]
def random_proxy():
i = random.randint(0, len(proxy_list) - 1)
p = {
'http': proxy_list[i]
}
return p
def remove_proxy(proxy):
proxy_list.remove(proxy)
print(f'Removed {proxy}-- {len(proxy_list)} proxies left') |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\interactions\utils\creation.py
# Compiled at: 2019-12-03 21:37:40
# Size of source mod 2**32: 42011 ... |
import os
import telebot
bot = telebot.TeleBot(os.environ['BOT_TOKEN'], parse_mode='HTML') |
"""A module to keep track of a plaintext."""
class Plaintext:
"""An instance of a plaintext.
This is a wrapper class for a plaintext, which consists
of one polynomial.
Attributes:
poly (Polynomial): Plaintext polynomial.
scaling_factor (float): Scaling factor.
"""
def __init... |
from typing import List
from tst.types.blockchain_format.coin import Coin
from tst.types.blockchain_format.program import SerializedProgram
from tst.types.blockchain_format.sized_bytes import bytes32
from tst.util.condition_tools import (
conditions_dict_for_solution,
created_outputs_for_conditions_dict,
)
d... |
"""
COMPLETE DESCRIPTION HERE
"""
#-----------------------------------------------------------------
#1. Seperate this file for calibration models
# MAKE THE PYTHON PRE, MATLAB AND PYTHON POST and SPYDER pipelines ready for calibrations
# Set up the required folders
# Set up the excel file where to store the file numb... |
# 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 ... |
if __name__ == '__main__':
print('hi there!!') |
from django.shortcuts import (
render,
redirect,
reverse,
get_object_or_404,
get_list_or_404,
)
from django.db.models import Q
from django.urls import reverse_lazy
from django.contrib.auth import authenti... |
#
# Copyright 2021 XEBIALABS
#
# 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, merge, publish, distribute, subli... |
#!/usr/bin/env python
import sys
from hunmisc.corpustools.tsv_tools import sentence_iterator
from common import sanitize_word
TEMPLATE = ('{0} -> {1}_{0}\n[graph] "({1}<root> / {1})"\n' +
'[fourlang] "({1}<root> / {1})"\n')
def main():
seen = set()
with open(sys.argv[1]) as stream:
for... |
from HDPython import *
from HDPython.examples import *
from .helpers import Folders_isSame, vhdl_conversion, do_simulation,printf
from HDPython.test_handler import add_test
class test_bench_axi_fifo(v_entity):
def __init__(self):
super().__init__()
self.architecture()
def architecture(self)... |
# -*- coding: UTF-8 -*-
import unittest
from geopy.compat import u
from geopy.geocoders import GeoNames
from test.geocoders.util import GeocoderTestBase, env
@unittest.skipUnless( # pylint: disable=R0904,C0111
bool(env.get('GEONAMES_USERNAME')),
"No GEONAMES_USERNAME env variable set"
)
class GeoNamesTestCa... |
#To accepts marks in 5 subjects and displays the total and average mark
#Above 90% Grade A*
#90 - 80 % Grade A
#70 – 80 % Grade B
#60 – 70 % Grade C
#Less than 60 Grade D
a=float(input("Enter Mark(1):"))
b=float(input("Enter Mark(2):"))
c=float(input("Enter Mark(3):"))
d=float(input("Enter Mark(4):"... |
import csv
def write_csv(write_out_path, name, headers, rows_to_write):
"""
Purpose
-------
This writes out a csv file of row data with an optional header. If you don't want a header, pass None to headers
Parameters
----------
:param name: The file name
:type name: str
:param wri... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test the ticket model being serviced on localhost:8080
"""
__author__ = "John Hoff"
__email__ = "john.hoff@braindonor.net"
__copyright__ = "Copyright 2019, John Hoff"
__license__ = "Creative Commons Attribution-ShareAlike 4.0 International License"
__version__ = "... |
"""Generic script exporter class for any kernel language"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import entrypoints
from .templateexporter import TemplateExporter
from traitlets import Dict, default
from .base import get_exporter
class ScriptExporter(... |
# -*- coding:utf-8 -*-
from django import forms
# class username(forms.Form):
# usernames = forms.CharField(max_length=100)
class LoginForm(forms.Form):
""" Лучше пользоваться формой и объявлять ее тут, тут можно менять сам тип поля, тест, число, визивик повесить на поле
В самом html этого не сможем сде... |
from django.urls import path
from petstagram.common.views import LandingPage
urlpatterns = [
path('', LandingPage.as_view(), name='index'),
] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django_filepicker.models
class Migration(migrations.Migration):
dependencies = [
('filepicker_demo', '0001_initial'),
]
operations = [
migrations.CreateModel(
name... |
from object_detection.protos.string_int_label_map_pb2 import StringIntLabelMap, StringIntLabelMapItem
from google.protobuf import text_format
def convert_classes(classes, start=1):
msg = StringIntLabelMap()
for id, name in enumerate(classes, start=start):
msg.item.append(StringIntLabelMapItem(id=id, n... |
from django.apps import AppConfig
class ProfilesConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'profiles'
def ready(self):
from . import signals |
#Define a Point3D class that inherits from object
#Inside the Point3D class, define an __init__() function that accepts self, x, y, and z, and assigns these numbers to the member variables self.x, self.y, self.z
#Define a __repr__() method that returns "(%d, %d, %d)" % (self.x, self.y, self.z). This tells Pytho... |
import scrapy
import pickle
import os
import ast
from urllib import parse
from scrapy.selector import Selector
class XinjiangSpider(scrapy.Spider):
name = "Xinjiang"
if not os.path.exists('../../data/HTML_pk/%s' % name):
os.makedirs('../../data/HTML_pk/%s' % name)
if not os.path.exists('../../data/... |
# Copyright 2017 Match Group, 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,... |
from benchmarkstt.modules import Modules
from benchmarkstt.normalization import cli
def test_module():
modules = Modules('cli')
assert modules['normalization'] is cli
assert modules.normalization is cli
for k, v in modules:
assert modules[k] is v
assert getattr(modules, k) is v
ke... |
#!/usr/bin/env python
#
# Copyright 2009-2020 NTESS. Under the terms
# of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains certain rights in this software.
#
# Copyright (c) 2009-2020, NTESS
# All rights reserved.
#
# Portions are copyright of other developers:
# See the file CONTRIBUTORS.TXT in the top ... |
#coding=utf-8
################################################################################################
# A 3-part series on circle inversion, Descartes' theorem along with its variants, and more! #
# #
# Part 1: A... |
import time,random
from collections import OrderedDict
from simulator import Simulator
class TrafficLight(object):
"""A traffic light that switches periodically."""
valid_states = [True, False] # True = NS open, False = EW open
def __init__(self, state=None, period=None):
self.state = state if ... |
# @file
#
# Copyright 2020, Verizon Media
# SPDX-License-Identifier: Apache-2.0
#
'''
Basic smoke tests.
'''
Test.Summary = '''
Test basic functions and directives.
'''
Test.TxnBoxTestAndRun("Smoke Test", "smoke.replay.yaml", config_path='Auto', config_key="meta.txn_box.global"
,remap=[('http://example... |
from . import constants
from . import argparse
from . import elements
from . import materials
from . import mesh
from . import moc
from .treat_lattice import TreatLattice
from .core_builder import CoreBuilder |
import logging
import os
import unittest
from mswh.comm.sql import Sql
import pandas as pd
logging.basicConfig(level=logging.DEBUG)
# has setUpClass method, thus run the test on the entire class
class SqlTests(unittest.TestCase):
"""Tests the db-python read-write capabilities."""
@classmethod
def setU... |
# Simulations-2.py
import glob
import math
import yaml
from KineticAnalysis.NumericalSimulator import NumericalSimulator
PPEqThreshold = 1.0e-4
if __name__ == "__main__":
# Read fits to time-resolved datasets.
tr_data_sets = { }
for f in glob.glob(r"TimeResolved-*.yaml"):
with open... |
###########################################################################################
# Created by Jason Downing #
# Some code originally found at this Stackoverflow Post: #
# https://stackoverflow.com/questions/1896... |
"""
Chatbox API
"""
import os
from bottle import get, local, post, request
import yaml
from codalab.objects.chat_box_qa import ChatBoxQA
from codalab.server.authenticated_plugin import AuthenticatedPlugin
@get('/chats', apply=AuthenticatedPlugin())
def get_chat_box():
"""
Return a list of chats that the cur... |
import pytest
import json
import time
from ldclient.client import LDClient, Config
from ldclient.feature_store import InMemoryFeatureStore
from ldclient.flag import EvaluationDetail
from ldclient.interfaces import FeatureStore
from ldclient.versioned_data_kind import FEATURES
from testing.stub_util import MockEventProc... |
from aiogram import Bot, Dispatcher, executor, types
from aiogram.utils.exceptions import CantParseEntities
from dotenv import load_dotenv, find_dotenv
from signal import signal, SIGINT
from tqdm import tqdm
from os import getenv
import sys
import fire
import uvloop
import redis
load_dotenv(find_dotenv('.telegram'))
u... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-04 20:07
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('scaffold_templates', '0001_... |
import pyabc
import tempfile
import pytest
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# create and run some model
def model(p):
return {'ss0': p['p0'] + 0.1 * np.random.uniform(),
'ss1': p['p1'] + 0.1 * np.random.uniform()}
p_true = {'p0': 3, 'p1': 4}
observat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.