text stringlengths 2 999k |
|---|
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(os.path.join(os.path.dirname(__file__), '../photoeditor'))
import math
import tkinter as tk
from unittest import TestCase, mock, main
import cv2
import numpy as np
from TkinterDnD2 import *
from photoeditor.config imp... |
from django.conf.urls import *
urlpatterns = patterns(
'',
(
r'^$',
'test_cache.views.someview'
),
)
|
from __future__ import absolute_import, division, print_function
import os
import cv2
import sys
import matplotlib.pyplot as plt
import numpy as np
from mmcv import Config
import torch
from torch.utils.data import DataLoader
sys.path.append('.')
from mono.model.registry import MONO
from mono.model.mono_b... |
# Author: Tom Dupre la Tour
# Joan Massich <mailsik@gmail.com>
#
# License: BSD 3 clause
import numpy as np
import pytest
import scipy.sparse as sp
from numpy.testing import assert_array_equal
from sklearn.utils.seq_dataset import (
ArrayDataset32, ArrayDataset64, CSRDataset32, CSRDataset64)
from sklearn.... |
from django.apps import AppConfig
class BooksConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'Retake_exam_app.books'
|
import os, sys
import configparser
re="\033[1;31m"
gr="\033[1;32m"
cy="\033[1;36m"
def banner():
os.system('clear')
print(f"""
{re}╔═╗{cy}┌─┐┌┬┐┬ ┬┌─┐
{re}╚═╗{cy}├┤ │ │ │├─┘
{re}╚═╝{cy}└─┘ ┴ └─┘┴
Version : 1.01
{re}Thanks to me
{cy}www.t.me/c/ChankitSaini
""")
banner()
print(gr+"[+] Installing re... |
'''
Runs the whole process in one file for a .csv positional data file (time, x, y, z)
and generates the final set of keplerian elements along with a plot and a filtered.csv data file
'''
from util import (read_data, kep_state, rkf78, golay_window)
from filters import (sav_golay, triple_moving_average)
from kep_deter... |
# 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 os
import io
import gzip
import typing as tp
def _safe_readline(fd) -> str:
pos = fd.tell()
while True:
try:
... |
# 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 ... |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... |
"""Make primary key
Revision ID: 3c994ef50934
Revises: 73b63ad41d3
Create Date: 2017-07-27 10:58:29.747840
"""
# revision identifiers, used by Alembic.
revision = '3c994ef50934'
down_revision = '73b63ad41d3'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
###... |
"""
Django settings for Awwardz project.
Generated by 'django-admin startproject' using Django 2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
impo... |
# 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... |
#!/usr/bin/env python3
import io
import os
import re
import tempfile
import zipfile
from contextlib import contextmanager
import requests
@contextmanager
def zipopen(font_file):
if "://" in font_file:
r = requests.get(font_file.format(**os.environ))
r.raise_for_status()
fo = io.BytesIO(r... |
# Do not use packages that are not in standard distribution of python
import numpy as np
from ._base_network import _baseNetwork
class SoftmaxRegression(_baseNetwork):
def __init__(self, input_size=28*28, num_classes=10):
'''
A single layer softmax regression. The network is composed by:
a... |
import numpy as np
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import PySimpleGUI as sg
import matplotlib
import matplotlib.pyplot as plt
from pygame import time
from mpl_toolkits import mplot3d
from mpl_toolkits.mplot3d import axes3d
# Argh lots of imports
from main import *
# Helper functions ... |
# Form implementation generated from reading ui file 'Editor.ui'
#
# Created by: PyQt6 UI code generator 6.2.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt6 import QtCore, QtGui, QtWidgets
c... |
import numpy as np
import pytest
from pandas.core.dtypes.common import is_integer
import pandas as pd
from pandas import Index, Series
import pandas._testing as tm
from pandas.core.indexes.datetimes import Timestamp
class TestSeriesQuantile:
def test_quantile(self, datetime_series):
q = datetime_series... |
# coding=utf-8
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
from random import randint
import time
import utilities
driver = utilities.startWebDriverSession('http://localhost:4622/wd/hub')
driver.get("Calculator")
driver.add_cookie({'name... |
# Copyright 2020-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 agre... |
# -*- coding: utf-8 -*-
# Copyright 2017 ProjectQ-Framework (www.projectq.ch)
#
# 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
#
# ... |
import torch #top-level package
from torch.autograd.variable import Variable #differentiation operations on tensors
from torch.distributions.normal import Normal #also called Gaussian
from torch.distributions.multivariate_normal import MultivariateNormal
#the Latent Vector shape depends on the network type og the Gene... |
def lengthOfLongestSubstring(self, s: str) -> int:
valueMap = dict()
pointer = 0
maxLen = 0
for i in range(len(s)):
char = s[i]
if char in valueMap and pointer <= valueMap[char]:
pointer = valueMap[char] + 1
valueMap[char] = i
... |
i = 509671
def thing(recipies, a, b):
x = recipies[a] + recipies[b]
recipies += [int(y) for y in str(x)]
a = (a + recipies[a] + 1) % len(recipies)
b = (b + recipies[b] + 1) % len(recipies)
return a, b
recipies = [3, 7]
a, b = 0, 1
si = str(i)
lsi = len(si)
done1 = done2 = False
while not done1 or... |
# Copyright 2018 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... |
"""
GTSAM Copyright 2010-2019, Georgia Tech Research Corporation,
Atlanta, Georgia 30332-0415
All Rights Reserved
See LICENSE for the license information
JacobianFactor unit tests.
Author: Frank Dellaert & Duy Nguyen Ta (Python)
"""
import unittest
import numpy as np
import gtsam
from gtsam.utils.test_case import G... |
# Copyright (c) 2022 PaddlePaddle 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 appli... |
import re
import numpy as np
import pytest
from pgmax import factor, vgroup
def test_enumeration_factor():
variables = vgroup.NDVarArray(num_states=3, shape=(1,))
with pytest.raises(
NotImplementedError, match="Please implement compile_wiring in for your factor"
):
factor.Factor(
... |
numeros = ((int(input(f'Digite o um numero: '))),
(int(input(f'Digite outro numero: '))),
(int(input(f'Digite mais um numero: '))),
(int(input(f'Digite o ultimo numero: '))))
print(f'O numero 9 apareceu {numeros.count(9)} vezes')
if 9 in numeros:
print(f'O numero 3 apareceu na {nu... |
import re
import json
from unidecode import unidecode
import markovify
from embedder import word2vec_to_spacy
class SpacyText(markovify.Text):
"""
A class to integrate Spacy with Markovify. Mostly taken from
https://joshuanewlan.com/spacy-and-markovify with a few edits
Inherits from markovify.Text... |
from turtle import Screen, Turtle, mainloop
class ColorTurtle(Turtle):
def __init__(self, x, y):
Turtle.__init__(self)
self.shape('turtle')
self.resizemode('user')
self.shapesize(3, 3, 5)
self.pensize(10)
self._color = [0, 0, 0]
self.x = x
self._col... |
from transformers import pipeline
import os
import warnings
warnings.filterwarnings('ignore')
# os.environ["CUDA_VISIBLE_DEVICES"] = "0"
summarizer = pipeline("summarization", model="t5-base", tokenizer="t5-base", framework="tf")
def summarize_text(text: str):
summary_text = summarizer(text, max_length=100, mi... |
# Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved.
import dace
from dace.memlet import Memlet
import dace.libraries.blas as blas
import numpy as np
import scipy
vec_width = 4
vtype = dace.vector(dace.float32, vec_width)
n = dace.symbol("n")
# ---------- ----------
# Create Inner Nested SDFG... |
import unittest
from ctypes import *
from ctypes.test import need_symbol
class CHECKED(c_int):
def _check_retval_(value):
# Receives a CHECKED instance.
return str(value.value)
_check_retval_ = staticmethod(_check_retval_)
class Test(unittest.TestCase):
def test_checkretval(... |
from __future__ import print_function
CopyRight = '''
/**************************************************************************
*
* Copyright 2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation... |
from .backend import SmsBackend
__all__ = ['SmsBackend']
|
# Databricks CLI
# Copyright 2017 Databricks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"), except
# that the use of services to which certain application programming
# interfaces (each, an "API") connect requires that the user first obtain
# a license for the use of the APIs from Databricks,... |
# TODO: Set the directory to save the model
save_dir = './logs_deterministic'
# TODO: Please set the directory to the target datasets accordingly
miniImageNet_path = '../datasets/miniImagenet'
ISIC_path = "../datasets/ISIC2018"
ChestX_path = "../datasets/ChestX-Ray8"
CropDisease_path = "../datasets/plant-disease"
Eur... |
from __future__ import division, print_function
from model import rf
import numpy as np
import random
from time import time
from pdb import set_trace
class settings:
iter=50
N=100
f=0.5
cf=0
maxIter=100
lives=10
def flatten(x):
"""
Takes an N times nested list of list like [[a,b],[c, [d, e]],[f]]
an... |
"""
Houdini tools
@author Brigham Young University
"""
__all__ = ['publisher']
|
# Copyright 2013 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 EnterprisePolicies enum in histograms.xml file with policy
definitions read from policy_templates.json.
If the file was pretty-printed, the updat... |
import keras
from keras.datasets import mnist
from keras import optimizers
from keras.models import Sequential,Model
from keras.layers import Dense, Dropout, Flatten, Activation,Input
from keras.layers import Conv2D, MaxPooling2D
from keras.applications import VGG16
from keras.optimizers import SGD
from keras import ba... |
"""Test the API's checkout process over full digital orders."""
import pytest
from graphene import Node
from saleor.account.models import Address
from saleor.checkout import calculations
from saleor.checkout.error_codes import CheckoutErrorCode
from saleor.checkout.models import Checkout
from saleor.checkout.utils imp... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/enums/activity_type.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protob... |
result_text = ""
with open("text.txt", "r") as file:
for idx, line in enumerate(file):
length = len([el for el in line if el.isalpha()])
counter = 0
for el in line:
if el in "',.!?\";:-":
counter += 1
result_text += f"Line {idx + 1}: {line[:-2]} ({length})... |
import abc
import hashlib
import re
from collections import OrderedDict
import inflection
import yaml
class YamlOrderedDict(OrderedDict, yaml.YAMLObject):
yaml_tag = "!YamlOrderedDict"
def __setattr__(self, key, value):
self[key] = value
def __getattr__(self, item):
return self.get(item... |
from mpl_toolkits.mplot3d import axes3d
import numpy as np
import matplotlib.pyplot as plt
def getPointsPositions(file,positions,num_points,k):
for i in range(num_points):
line = file.readline()
arr = line.split(" ")
for j in range(k):
positions[j].append(int(arr[j]))
def drawFromLevel(level_data,old_dimens... |
import numpy as np
class DataSet(object):
'''
data_path-> instance对象集 -> 生成batch -> to_index (vocab) -> padding -> to_tensor
-> 创建vocab
bert_path -> bert_model / bert_tokenizer (vocab)
embed_path -> pre_embeds / pre_vocab
'''
def __len__(self):
raise NotImplementedError
... |
"""
Common functions and variables for all entity types including some bootstrap and init functions
"""
import datetime
import json
import time
import traceback
import uuid
from contextlib import contextmanager
from typing import Generator, Optional
import sqlalchemy
from sqlalchemy import types
from sqlalchemy.engine... |
def is_palindrome(x):
"""
:param x: integer
:return: True if x is a Palindrome
False if x is not a Palindrome
"""
rev = list(reversed(str(x)))
if list(str(x)) == rev:
return True
else:
return False
#print(is_palindrome(121))
# True
#print(is_palindrome(-121))
#... |
from django.db import models
from django.urls import reverse
from crud.models.mixins import TemplateModelMetaInfoMixin
class StatementCategory(TemplateModelMetaInfoMixin, models.Model):
title = models.CharField(verbose_name='Название категории', max_length=50)
legal_number = models.CharField(verbose_name='Юр... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2019-05-20 16:13
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('oauth', '0001_initial'),
]
operations = [
migrations.RemoveField(
mode... |
import random
class MineField:
def __init__(self, size):
"""
Initializes an empty minefield
:param size: tuple(int, int) - defines the dimensions of the minefield in rows x cols
"""
self.field = [[0] * size[1] for _ in range(size[0])]
self.dim = size... |
import numpy as np
import torch
class ResidualCoder(object):
def __init__(self, code_size=7, encode_angle_by_sincos=False, **kwargs):
super().__init__()
self.code_size = code_size
self.encode_angle_by_sincos = encode_angle_by_sincos
if self.encode_angle_by_sincos:
self.... |
"""Test Python APIs for target (launch and attach), breakpoint, and process."""
from __future__ import print_function
import os
import sys
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
class HelloWorldTestCase(TestBa... |
from check_index import *
def check_reply(r):
assert is_dict(r)
assert sorted(r.keys()) == ["__test-v1", "__test-v2", "__test-v3", "query.json", "unknown"]
check_index__test(r["__test-v1"], 1, 3)
check_index__test(r["__test-v2"], 2, 0)
check_error(r["__test-v3"], "unknown query file")
check_err... |
"""Collect information from the NY State Board of Elections website (http://www.elections.ny.gov/2016ElectionResults.html) and publish in a way more sensible format.
Code is given for 2016 and 2014 below, but could easily be extended. Note the NY State Board of Elections uses inconsistent names on their website, and ... |
import numpy
import math
import copy
class Delaunay2d:
EPS = 1.23456789e-14
def __init__(self, points):
# data structures
self.points = points[:] # copy
self.triangles = [] # cells
self.edge2Triangles = {} # edge to triangle(s) map
self.boundaryEdges = set()
self.appliedBoundaryEdges = N... |
from .. import utils
from .component import Component
class Chassis(Component):
def __init__(self):
Component.__init__(self)
self.data = {}
self.model = utils.get_fru_info("Chassis Part Number")
self.serial = utils.get_fru_info("Chassis Serial")
@classmethod
def list(cls... |
from typing import NewType
HashUrl = NewType('HashUrl', str)
|
#!/usr/bin/python3
#
# This script allows you to use Space-key as a modifier key like Shift or Ctrl and also as a usual Space-key at the same time.
# It should work in any linux distributive.
#
# Install dependencies first:
# For Ubuntu:
# sudo apt-get install python-dev python3-pip gcc
# sudo pip instal... |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 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 RPCs related to blockchainstate.
Test the following RPCs:
- getblockchaininfo
- gettxouts... |
import pandas as pd
import numpy as np
class PandasFiltros:
def __init__(self):
self.path = input("Digite o caminho do arquivo: ")
self.file = pd.read_csv(self.path, sep=";")
def NumIndiv(self): #Filtra o numero de indivíduos no estado indicado
sigla = input("Digite a sigla do es... |
# Copyright 2017-2020 Denis Gushchin. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import datetime
import os
import sys
# Export
__all__ = ('create_unique_file_name', 'get_file_as_string')
#
# Creates a unique file name
#
def create_uniqu... |
#!/usr/bin/python3
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# 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... |
# coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
import os
import shutil
from pyiron_base.settings.install import install_pyiron
from pyiron_base._tests import PyironTes... |
from __future__ import absolute_import
import os
from contextlib import contextmanager
from mock import Mock, patch
from celery.fixups.django import (
_maybe_close_fd,
fixup,
DjangoFixup,
)
from celery.tests.case import AppCase, patch_many, patch_modules, mask_modules
class test_DjangoFixup(AppCase):
... |
# Copyright (c) 2015-2018 Cisco Systems, Inc.
#
# 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... |
"""
FROM: https://github.com/dfcf93/MSMARCOV2/blob/master/Ranking/Evaluation/msmarco_eval.py
-------------------
This module computes evaluation metrics for MSMARCO dataset on the ranking task.
Command line:
python msmarco_eval_ranking.py <path_to_reference_file> <path_to_candidate_file>
Creation Date : 06/12/2018
... |
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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 us... |
# Copyright 2019 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.
from . import config
class TestConfig(config.CodeSignConfig):
def __init__(self,
identity='[IDENTITY]',
installer_id... |
#
# Copyright © 2019 Ronald C. Beavis
# Licensed under Apache License, Version 2.0, January 2004
#
#
# loads and interprets command line parameters
# generates error messages and returns false if parameters fail simple tests
#
import os
import json
#
# loads default parameters from a JSON formatted file if the -d pa... |
import copy
import rdtest
import renderdoc as rd
from typing import Tuple
class GL_Shader_Editing(rdtest.TestCase):
demos_test_name = 'GL_Shader_Editing'
def check_capture(self):
eid = self.find_draw("fixedprog").eventId
self.controller.SetFrameEvent(eid, False)
pipe: rd.PipeState = ... |
# Import local modules
from photoshop.api._core import Photoshop
class TiffSaveOptions(Photoshop):
"""Options for saving a document in TIFF format."""
object_name = "TiffSaveOptions"
def __int__(self):
super().__init__()
@property
def alphaChannels(self):
"""If true, the alpha c... |
# Copyright 1999-2021 Alibaba Group Holding 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
# -*- coding: utf-8 -*-
# -*- mode: Python; tab-width: 4; indent-tabs-mode: nil; -*-
# Do not change the previous lines. See PEP 8, PEP 263.
#
"""
CLI options class for comicstreamer app
Copyright 2014 Anthony Beville
Licensed under the Apache License, Version 2.0 (the "License");
you may not ... |
"""
Gaussian Process Sampler Module.
Provides the Gaussian Process Sampler Class which contains the strategies for
active sampling a spatial field using a non-parametric, Bayesian model
"""
import logging
from dora.active_sampling.base_sampler import Sampler, random_sample
import revrand.legacygp as gp
import numpy... |
# coding=utf-8
"""
"""
from Crypto.Cipher import AES
from obespoir.share.singleton import Singleton
from obespoir.share.ob_log import logger
import json
BS = AES.block_size
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]
class AesEncoder(object, metaclass=Single... |
# coding: utf-8
from __future__ import unicode_literals
import base64
import collections
import hashlib
import itertools
import json
import netrc
import os
import random
import re
import sys
import time
import math
from ..compat import (
compat_cookiejar_Cookie,
compat_cookies_SimpleCookie,
compat_etree_E... |
#!/usr/bin/env python
#
# Copyright 2019 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""\
Helper script for compiling and running the Wasm C/C++ API examples.
Usage: tools/run-wasm-api-tests.py outdir tempdir [filter... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'hint_view.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectNa... |
import json
class CustomerCall(object):
def __init__(self, start_pos, destination_pos, time):
self.start_pos = start_pos
self.destination_pos = destination_pos
self.time = time
def __jsonencode__(self):
return {'start_pos': self.start_pos, 'destination_pos': self.destination_po... |
import io
import json
import math
import os
# from neural_network_model.config import config as ccn_config
from regression_model import __version__ as _version
from regression_model.config import config as model_config
from regression_model.processing.data_management import load_dataset
from api import __version__ as... |
# coding: utf-8
from __future__ import unicode_literals
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.core.urlresolvers import (
NoReverseMatch, Resolver404, get_script_prefix, resolve
)
from django.db.models import Manager
from django.db.models.query import QuerySet
from ... |
import os
import re
import sys
import uuid
import redis
import environ
from cryptography.fernet import Fernet
from flask import abort, Flask, render_template, request
from redis.exceptions import ConnectionError
from werkzeug.urls import url_quote_plus
from werkzeug.urls import url_unquote_plus
from flask_s3 import F... |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2019 Blue Cheetah Analog Design 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
#
# U... |
from __future__ import absolute_import
from __future__ import unicode_literals
import json
from io import BytesIO
from contextlib import contextmanager, closing
from django.http.response import HttpResponseServerError
from django.shortcuts import redirect, render
from corehq.apps.domain.decorators import track_domain... |
#!/usr/bin/python
import os
import sys
import numpy as np
import subprocess
import time
import threading
import random
class GeneticOptimizer():
def __init__(self):
self.parameters_random = []
self.parameters_7 = []
def TrulyRandomNumbers(self, num):
x = self.parameters_random
... |
import os
import sys
is_py2 = (sys.version_info[0] == 2)
is_py3 = (sys.version_info[0] == 3)
is_win32 = os.name == "nt"
if is_py2:
_str = str
str = unicode
range = xrange
string_types = (_str, unicode)
integer_types = (int, long)
def bytes(b=None, enc="ascii"):
if b is None:
... |
import re
from datetime import timedelta
from django import forms
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy
import dateutil
from crispy_forms import bootstrap as twbscrispy
from crispy_forms import layout as crispy
from dimag... |
# Copyright (c) 2015 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.
"""Utility library for running a startup profile on an Android device.
Sets up a device for cygprofile, disables sandboxing permissions, and sets up
sup... |
#!/usr/bin/env python3
"""
----------------------------------------------------------------------------------------------------
MIT License Copyright (c) 2017
--------------------------------------------------------------------------------------------... |
#!/usr/bin/env python3
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def init_recorder():
return render_template('./index2.html')
@app.route('/get_canvas_images', methods=['POST', 'GET'])
def get_canvas_images():
if request.method == 'POST':
... |
#-------------------------------------------------------------------------
# Name:
# TypoGard
#
# Description:
# Applies a set of transformations to a given npm package name and
# the names of all (if any) of that package's transitive
# dependencies in an attempt to detect typosquatti... |
# 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 ... |
"""Module describing the planemo ``conda_search`` command."""
from __future__ import print_function
import click
import packaging.version
from planemo import options
from planemo.cli import command_function
from planemo.conda import build_conda_context
VERSION_4_DOT_4 = packaging.version.Version("4.4")
@click.comm... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# metadata
from __future__ import unicode_literals
import frappe, json
from frappe.utils import cstr, cint
from frappe.model import integer_docfield_properties, default_fields
from frappe.model.document import Document... |
#!/usr/bin/env python
"""
Multimodal demonstration using gaussian mixture model.
The model is a mixture model representing the probability density from a
product of gaussians.
This example show performance of the algorithm on multimodal densities,
with adjustable number of densities and degree of separation.
The pe... |
pyg = 'ay'
original = raw_input('Enter a word:')
if not (len(original) > 0 and original.isalpha()):
print 'Error - invalid input'
exit()
word = original.lower()
first = word[0]
new_word = word[1:len(word)] + first + pyg
print new_word
|
import pytest
from nonebug import App
@pytest.mark.asyncio
async def test_userdict(app: App):
"""测试添加用户词典"""
from nonebot_plugin_datastore import PluginData
from nonebot_plugin_wordcloud.config import plugin_config
from nonebot_plugin_wordcloud.data_source import analyse_message
data = PluginDa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.