text stringlengths 2 999k |
|---|
# Copyright (c) 2020, Qihoo, 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 required by applicable ... |
import asyncio
import functools
import collections
import operator
import io
import time
import stat
import sys
import pathlib
import abc
from .common import (with_timeout, AsyncStreamIterator, DEFAULT_BLOCK_SIZE,
AbstractAsyncLister)
from . import errors
__all__ = (
"AbstractPathIO",
"P... |
from datetime import timedelta
import logging
from homeassistant.components.binary_sensor import BinarySensorEntity
from .entity import PanasonicBaseEntity
from .const import (
DOMAIN,
UPDATE_INTERVAL,
DEVICE_TYPE_DEHUMIDIFIER,
DATA_CLIENT,
DATA_COORDINATOR,
LABEL_TANK,
ICON_TANK,
)
_LOGGE... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
class btctradeua (Exchange):
def describe(self):
... |
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ##... |
n1 = int(input('Digite um numero?'))
ant = n1-1
sur = n1+1
print("O numero que você digitou é {},\n o seu antecessor é {} \ne o seu sucessor é {}".format(n1, ant, sur)) |
# -*- coding: utf-8 -*-
"""
@author:XuMing(xuming624@qq.com)
@description: sentiment classification
"""
# 本notebook参考了https://github.com/bentrevett/pytorch-sentiment-analysis
#
# 在这份notebook中,我们会用PyTorch模型和TorchText再来做情感分析(检测一段文字的情感是正面的还是负面的)。我们会使用[IMDb 数据集](http://ai.stanford.edu/~amaas/data/sentiment/),即电影评论。
#
# 模型... |
# -*- coding: utf-8 -*-
'''
Management of APT/YUM package repos
===================================
Package repositories for APT-based and YUM-based distros can be managed with
these states. Here is some example SLS:
.. code-block:: yaml
base:
pkgrepo.managed:
- humanname: CentOS-$releasever - Base... |
from dataclasses import dataclass
from typing import List
CONDITION_EXISTS = '*'
CONDITION_EQ = 'eq'
CONDITION_NEQ = 'ne'
CONDITION_CONTAINS = 'contains'
CONDITION_NOT_CONTAINS = 'not_contain'
CONDITION_AND = 'and'
CONDITION_OR = 'or'
@dataclass
class TagRule(object):
property: str
condition: str
value: ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2015 Raphaël Barrois
#
# 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... |
import torch
from torch import nn
class DNNModel(nn.Module):
def __init__(self, dropout=0.2):
super(DNNModel, self).__init__()
self.fc1 = nn.Linear(4, 4)
self.relu1 = nn.ReLU()
self.dropout1 = nn.Dropout(p=dropout)
self.fc2 = nn.Linear(4, 4)
self.relu2 = nn.ReLU()
... |
from game import *
g = Game('XX', 'warrior', 'YY', 'rogue')
g.run() |
import time
import math
import constants
import utils, primeSieve
import pollardRho, pollardPm1, ecm
small_primes = primeSieve.prime_sieve(constants.PRIME_THRESHOLD_BF)
def merge_factorizations(f1, f2):
if f1 == -1 or f2 == -1:
return -1
f = []
i = j = 0
while i < len(f1) and j < len(f2):
... |
# -*- coding: utf-8 -*-
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.common.profile.client_profile import ClientProfile
from tencentcloud.common.profile.http_profile import HttpProfile
from tencentcloud.ess.v... |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import os
from unittest.mock import Mock, patch
from urllib.parse import urlparse
from azure.core.credentials import AccessToken
from azure.identity import CredentialUn... |
from blinker.base import (
ANY,
NamedSignal,
Namespace,
Signal,
receiver_connected,
signal,
)
__all__ = [
'ANY',
'NamedSignal',
'Namespace',
'Signal',
'receiver_connected',
'signal',
]
__version__ = '1.1'
|
#!/usr/bin/python
#
# Print line number before every line.
# It works like nl and cat -n, which are missing in busybox distributions.
# An additional second argument limits the number of lines.
# Additionally, it skips the lines starting with <<<.
#
# Igor Konnov, 2013
import getopt
import sys
def usage(exitcode):
... |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Bitcoin Core developers
# Copyright (c) 2017-2020 The Qtum Core developers
# Copyright (c) 2020 The BITCOIN2Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Tes... |
'''
Plotting the offset of CIV emission in the Cloudy models
as a function of ionization, nebular metallicity, stellar metallicity,
stellar population type, age, etc.
'''
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from cloudy_func import * # written by... |
#!/usr/bin/env python3
"""
Functions for predicting time-integrated ionospheric Faraday rotation effects.
Uses RMextract package to get time-dependent ionospheric RMs for a given
observation, then performs the time-integration to work out the effective
change in polarization angle, and the effective depolarization (t... |
# coding: utf-8
"""
SDX-Controller
You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: yxin@renci.org
Generated by: https://github.com/swagger-api/swagger-code... |
"""
* Copyright 2007,2008,2009 John C. Gunther
* Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
*
* 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/lic... |
"""Auto-generated file, do not edit by hand. GB metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_GB = PhoneMetadata(id='GB', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='[1-4679]\\d{2,5}', possible_number_patt... |
# -*- coding: utf-8 -*-
"""Labeled combobox widget with units.
The goal of these widgets is twofold: to make it easier for developers
to implement dialogs with compound widgets, and to naturally
standardize the user interface presented to the user.
"""
import logging
from seamm_util import Q_, units_class
import sea... |
# -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""Utils for mapping."""
from ._compiling import two_qubit_kak, euler_angles_1q
from ._coupling import Coupling
from ._coupl... |
import pytest
from pyinsights.config import load_config, load_schema, validate
from pyinsights.exceptions import (
ConfigInvalidSyntaxError,
ConfigNotFoundError,
InvalidVersionError
)
class TestLoadConfig:
def test_existing_config(self):
filepath = 'examples/pyinsights1.yml'
config = ... |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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,
... |
import numpy as np
import os
#from visual_mpc.agent.benchmarking_agent import BenchmarkAgent
from visual_mpc.agent.general_agent import GeneralAgent
from visual_mpc.envs.robot_envs.autograsp_env import AutograspEnv
from visual_mpc.policy.multiview_reaching.multiview_reach_policy import MultiViewReachPolicy
from visual_... |
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2012 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General P... |
"""Extension to execute code outside the Python shell window.
This adds the following commands:
- Check module does a full syntax check of the current module.
It also runs the tabnanny to catch any inconsistent tabs.
- Run module executes the module's code in the __main__ namespace. The window
must have been sa... |
from pyngrok import ngrok,conf
# Open a HTTP tunnel on the default port 80
# <NgrokTunnel: "http://<public_sub>.ngrok.io" -> "http://localhost:80">
def log_event_callback(log):
print(str(log))
conf.get_default().log_event_callback = log_event_callback
# http_tunnel = ngrok.connect("file:///C:/Users/LDLuc/Pictures/... |
# Copyright 2020 Google Research. 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 applicable law... |
import math
from stift.functions.base import ANY_NUM_ARGS, REALS, BaseFunction
class Abs(BaseFunction):
"""Math absolute value function."""
arg_counts = 1
arg_types = REALS
def process(self, argc: int, argv: list) -> REALS:
return abs(argv[0])
class Ceiling(BaseFunction):
"""Math ceil... |
from typing import Tuple
from app_config import deployment_config
from datapassing.shape_data import ShapeMetadata
from flask import render_template, redirect, abort, jsonify, send_file, request
from flask_paginate import Pagination, get_page_args
from deployment import daos
from hydrus import hydrus_utils
from metada... |
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest
from typing import Any, Mapping
from .abstract_gremlin_proxy_tests import abstract_gremlin_proxy_test_class
from .roundtrip_janusgraph_proxy import RoundtripJanusGraphProxy
class JanusGraphGremlinProxyTest(
... |
"""
WSGI config for jnvportal project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... |
import numpy as np
import openpnm as op
from numpy.testing import assert_allclose
from openpnm.utils import remove_prop_deep
class DiffusiveConductanceTest:
def setup_class(self):
self.net = op.network.Cubic(shape=[5, 5, 5])
self.geo = op.geometry.GenericGeometry(network=self.net,
... |
# curves plot with error bars; irregular X axis stubs; data point tooltips
# option: dobands .... if True show shaded SEM bands also
import svgdatashapes as s
def example6( dobands=False ):
# assign some data column names...
cols=['time','group1','group1sem','group2','group2sem','group3','group3sem'... |
# Generated by Django 3.1.4 on 2020-12-29 05:52
from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migr... |
from pydantic.fields import Field
from pydantic.main import BaseModel
from ...helpers.object_id_helpers import str_object_id
class BaseID(BaseModel):
"""
Base class for any model that requires a mongoDB ID.
"""
id: str = Field(default_factory=str_object_id, alias="_id")
class Config:
all... |
import unittest
from talipp.indicators import MassIndex
from TalippTest import TalippTest
class Test(TalippTest):
def setUp(self) -> None:
self.input_values = list(TalippTest.OHLCV_TMPL)
def test_init(self):
ind = MassIndex(9, 9, 10, self.input_values)
print(ind)
self.asse... |
import os
import re
import sys
from collections import OrderedDict
from typing import Callable, Any, Tuple
from typing_extensions import TypedDict
from codalab.lib import path_util, spec_util
from codalab.worker.bundle_state import State
from functools import reduce
from codalab.common import StorageType, StorageForma... |
import _plotly_utils.basevalidators
class ZValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="z", parent_name="layout.scene.camera.up", **kwargs):
super(ZValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
e... |
# coding=utf-8
# Copyright 2020 The Trax 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 a... |
#!/usr/bin/env python3
# (C) Copyright 2020 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its statu... |
# Copyright 2014 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.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
'target_name': 'ozone_demo',
'type': 'executable',
'dependencies': [
... |
days = "Mon Tue Wed Thu Fri Sat Sun"
months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"
print("Here are the days: ", days)
print("Here are the months: ", months)
print("""
There's something going on here.
With the three double-quotes.
We'll be able to type as much as we like.
Even 4 lines if we ... |
"""
Create a negex-styled dictionary from a tab-delimited
negation list, and a negation equivalences file.
"""
import argparse
import copy
import logging
import logging.config
import pyodbc
import regex as re
from .util import mylogger
from pytakes.util.db_reader import DbInterface
def parse_equivalence_file(eqfi... |
import cv2
import numpy as np
from ..utils import is_tuple_of
from .colorspace import bgr2gray, gray2bgr
def imnormalize(img, mean, std, to_rgb=True):
"""Normalize an image with mean and std.
Args:
img (ndarray): Image to be normalized.
mean (ndarray): The mean to be used for normalize.
... |
# Program showing some examples of collections module
from collections import Counter
# Count how many times each number is repeated
numbers = [10, 25, 8, 1, 1, 2, 36, 4, 1, 2, 3, 4, 1, 2, 3, 1, 2, 1]
print(Counter(numbers))
# Count how many times each letter is repeated
word = "Hello World !"
print(Counter(word))
... |
# -*- coding: utf-8 -*-
from PySide import QtCore, QtGui
class Ui_Widget(object):
def setupUi(self, Widget):
Widget.setObjectName("Widget")
Widget.resize(639, 686)
Widget.setMaximumSize(639, 646)
Widget.setMinimumSize(639, 646)
self.imageBox = QtGui.QGroupBox(Widget... |
# Created on 10/12/21 at 10:50 PM
# Author: Jenny Sun
import numpy as np
import torch
import torch.nn.functional as F
import torch.nn as nn
import sys
from torch.autograd import Variable
import math
torch.manual_seed(2021)
np.random.seed(2021)
# random.seed(2021)
torch.backends.cudnn.deterministic = True
torch.backe... |
# DO NOT EDIT THIS FILE. This file will be overwritten when re-running go-raml.
"""
Auto-generated class for EditTeamOption
"""
from .EnumEditTeamOptionPermission import EnumEditTeamOptionPermission
from six import string_types
from . import client_support
class EditTeamOption(object):
"""
auto-generated. d... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import functools
import random
import unittest
from multiprocessing import Manager
import torch
import torch.nn a... |
"""
This pipeline is intended to extract edge information from ADC images.
"""
import os
import numpy as np
from protoclass.data_management import ADCModality
from protoclass.data_management import GTModality
from protoclass.preprocessing import PiecewiseLinearNormalization
from protoclass.extraction import EdgeSig... |
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import json
from typing import (
Dict, Iterator, Optional, Union,
)
from databuilder.extractor.es_base_extractor import ElasticsearchBaseExtractor
from databuilder.models.table_metadata import ColumnMetadata, TableMetadata
cl... |
import FWCore.ParameterSet.Config as cms
# This config was generated automatically using generate2026Geometry.py
# If you notice a mistake, please update the generating script, not just this config
from Configuration.Geometry.GeometryDD4hepExtended2026D49_cff import *
# tracker
from Geometry.CommonTopologies.globalT... |
"""
Example to extract motion history images using opencv2. stripped from opencv2 python examples motempl.py
link to the gif: https://giphy.com/gifs/bJDYIRToRpkEU
command to extract the jpgs: convert example.gif -coalesce images/example-%03d.jpg
You have to use fixed length pattern for image sequence, such as ./images/... |
from django import forms
from .models import Poll, Choice
class QuestionForm(forms.ModelForm):
class Meta:
model = Poll
fields = ['topic','poll_details','who_can_vote','announce_at']
class PollUpdateForm(forms.ModelForm):
class Meta:
model = Poll
fields = ['topic','poll_details','announce_at']
class Choic... |
#
# 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 -*-
"""
Created on Sun Apr 3 16:44:27 2022
@author: Mark, Destiny
"""
import pandas as pd
from bokeh.io import show
from bokeh.plotting import figure
from bokeh.layouts import layout
from bokeh.models import CustomJS, ColumnDataSource, CDSView, DateRangeSlider, Select
# -----clean a... |
# -*- encoding: utf-8 -*-
import os
import sys
from setuptools import setup, find_packages
assert sys.version_info >= (3, 3), 'Python 3.3+ required.'
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='ralph',
version=read('./VERSION').strip(),
author='G... |
"""
Support for Aruba Access Points.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.aruba/
"""
import logging
import re
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.device_tr... |
from abc import ABCMeta, abstractmethod
from hashlib import sha256
from typing import Any, Dict, List, Tuple
from plotter.types.blockchain_format.sized_bytes import bytes32
"""
A simple, confidence-inspiring Merkle Set standard
Advantages of this standard:
Low CPU requirements
Small proofs of inclusion/exclusion
Rea... |
import pytest
import sqlite3
import sys
import os
from gunsmith_bot.armory import Armory
from gunsmith_bot.armory.armory import WeaponBaseArchetype, constants
class TestArmory():
def test_update_current_manifest(self):
current_manifest_path = "/path/to/file"
armory = Armory(current_manifest_path)
... |
from ..dashboards.children import review as review_children
def test_get_review_dash_children():
children = review_children.Get_Review_Children()
n = len(children)
assert n >= 1
assert isinstance(children, (list,)) |
import pylox.lox_types as lc
def test_singleton():
assert lc.nil is lc.NilType()
|
import numpy as np
from pyspedas import time_double
from pytplot import get_data, store_data, options
from geopack import geopack, t96
def tt96(pos_var_gsm, parmod=None, suffix=''):
"""
tplot wrapper for the functional interface to Sheng Tian's implementation of the Tsyganenko 96 and IGRF model:
https://... |
import numpy as np
from run_3_1 import runForParticleCount
runForParticleCount(80, prefix="3_3", seed=True, bins=21)
runForParticleCount(64, prefix="3_3", seed=True, bins=17)
runForParticleCount(8, prefix="3_3", seed=True,
bins=np.linspace(-0.5, 8.5, 10))
|
""" ResourceModel class is a list of resource nodes that can be used to
construct a resource set at a server location or to inspect resources
at a server location. The model can be populated by loading a
constructor in the collection+senml+json content format, and an
existing model can likewise be s... |
"""This is gramatically correct, but it's still a SyntaxError"""
__revision__ = None
yield 1
|
import logging
import re
import traceback
import warnings
from abc import ABC, ABCMeta, abstractmethod
from collections import Counter
from copy import deepcopy
from inspect import isabstract
from typing import Any, Dict, List, Optional, Tuple, Union
import pandas as pd
from dateutil.parser import parse
from great_ex... |
#!/usr/bin/env python
"""
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");... |
from .topo import ASTFTopology
from ..common.trex_port import Port
class ASTFPort(Port):
def __init__(self, *a, **k):
Port.__init__(self, *a, **k)
self.topo = ASTFTopology()
def is_service_mode_on(self):
return True
def set_service_mode(self, *a, **k):
return self.ok()
... |
message = "One of Python's strengths is its diverse community."
print(message) # 此处程序能正常运行, 因为双引号Python可以根据双引号来判断变量的起始与终止
print('\n')
# message = 'One of Python's strengths is its diverse community.'
# print(message) # 这里成勋会出现异常, 因为单引号包含单引号, Python出现判断错误 |
from Foundation import NSBundle, NSLog
import urllib, urllib2
import sys
import os
import json
import base64
import glob
#sensorpath = os.path.join("~", "Documents", "VMware", "WorkspaceONESensorMigration") #"~/Documents/VMware/WorkspaceOneSensorMigration/"
sensorpath = "SensorData/"
def oslog(text):
try:
... |
import glob
import math
import os
import sys
import warnings
from decimal import Decimal
import numpy as np
import pandas as pd
import pytest
from packaging.version import parse as parse_version
import dask
import dask.dataframe as dd
import dask.multiprocessing
from dask.blockwise import Blockwise, optimize_blockwis... |
import base64
import time
from telethon.tl.custom import Dialog
from telethon.tl.functions.messages import ImportChatInviteRequest as Get
from telethon.tl.types import Channel, Chat, User
from usercodex import codex
from ..core.managers import edit_delete, edit_or_reply
plugin_category = "utils"
# ================... |
# -*- coding: utf-8 -*-
"""
This is a skeleton file that can serve as a starting point for a Python
console script. To run this script uncomment the following lines in the
[options.entry_points] section in setup.cfg:
console_scripts =
fibonacci = sagemaker.skeleton:run
Then run `python setup.py install` ... |
# -*- coding: utf-8 -*-
#
# RESThub documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 27 21:42:41 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
import logging
from random import randint
from robot import Robot
# default sleep timeout in sec
DEFAULT_SLEEP_TIMEOUT_IN_SEC = 0.1
# default speed
DEFAULT_SPEED = 300
# default threshold distance
DEFAULT_THRESHOLD_DISTANCE = 150
# config logging
logging.... |
"""
WSGI config for hackowasp project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SET... |
# -*- coding: utf-8 -*-
import base64
import os
import re
import xml.dom.minidom
from cryptography.fernet import Fernet
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from ...core.utils.old import decode
from ..base.container imp... |
"""Tests for db backends
Authors:
* Min RK
"""
#-------------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#... |
# Copyright (c) SenseTime Research and its affiliates. All Rights Reserved.
"""
Implements the RDN framework
"""
import time
import os
from PIL import Image
from collections import deque
import torch
from torch import nn
from stft_core.structures.image_list import to_image_list
from stft_core.structures.boxlist_ops i... |
import shutil
import os
import time
import multiprocessing as mp
import yaml
from montreal_forced_aligner import __version__
from montreal_forced_aligner.corpus.align_corpus import AlignableCorpus
from montreal_forced_aligner.dictionary import Dictionary
from montreal_forced_aligner.aligner import PretrainedAligner
fr... |
from urllib import request
from bs4 import BeautifulSoup
from retrying import retry
import os
import time
import random
class Utils(object):
SUCCESS_CODE = 200
ERROR = "err"
BaseUrl = "https://www.androidos.net.cn"
Size = '-'
DEBUG = True
@retry(stop_max_attempt_number = 3,wait_fix... |
from abc import ABCMeta, abstractmethod
class Observable:
__metaclass__ = ABCMeta
@abstractmethod
async def update(self, message):
pass
|
#! /usr/bin/env python
# coding: ascii
"""\
Check include files in a ReST documentation project.
This script verifies that all ReST source files reside within or
below a given ``startdir``. Files that match the pattern "*.rst"
are considered to be source files. The ReST sources are scanned
for ``.. include::`` and ``... |
# coding: utf-8
"""
Talend Management Console Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import abs... |
import numpy as np
import pandas as pd
from scipy.stats import chi2_contingency
# preset values
significance_threshold = 0.05
sample_size = 180
lift = .3
control_rate = .5
name_rate = (1 + lift) * control_rate
# initialize an empty list of results
results = []
# start the loop
for i in range(100):
# simulate data:... |
from django.core.management.base import BaseCommand, CommandError
from project.models import Project, Tag
class Command(BaseCommand):
help = 'Retry error sync task.'
def handle(self, *args, **options):
Tag.objects.retry_migrate_tasks()
self.stdout.write(self.style.SUCCESS('Successfully.'))
|
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.contrib.sitemaps import Sitemap
from photologue.models import Gallery
class AlbumSitemap(Sitemap):
changefreq = "monthly"
priority = 0.5
def items(self):
return Gallery.objects.filter(is_public=True)
def lastm... |
from theano import gof
class TypedListType(gof.Type):
"""
Parameters
----------
ttype
Type of theano variable this list will contains, can be another list.
depth
Optionnal parameters, any value above 0 will create a nested list of
this depth. (0-based)
"""
def __... |
import collections
import itertools
import math
from matplotlib import pyplot as plt
import numpy as np
def show_raw_img(original_filename, extracted_filename, size):
with open(original_filename, 'rb') as img_file:
original_img = np.fromfile(img_file, dtype=np.uint8)
with open(extracted_filename, 'rb... |
""" One Odd Occurring: Given an array of Integers find the number that occurs odd number of times
Alternate: Given an array of n numbers in range [ 1 .. n+1 ] Every number appears once. Find the missing no. """
""" Naive Solution: Use nested loops and count occurrence of each number in one iteration O(n^2) """
"""... |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("SGDClassifier" , "digits" , "sqlite")
|
#!/usr/bin/env python3
from bs4 import BeautifulSoup
import requests
import csv
import os
positions = ['QB', 'RB', 'WR', 'TE', 'K', 'DST']
weeks = range(1, 18)
def cbs(pos, week, leaguetype, writer):
url = 'https://fantasynews.cbssports.com/fantasyfootball/stats/weeklyprojections/{pos}/{week}/jamey_eisenberg/st... |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/5/27 16:24
# @FileName: run_Prediction.py
import tensorflow as tf
import collections
from Abnormal_Url_Detection.detection_url.config.config import FLAGS
from Abnormal_Url_Detection.detection_url.utils.utils import get_pred_iterator
import datetime
from Ab... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.