text stringlengths 2 999k |
|---|
import abc
import textwrap
import warnings
from copy import deepcopy
from collections import namedtuple
from collections.abc import Mapping
import astropy.nddata
import astropy.units as u
import numpy as np
from astropy.units import UnitsError
try:
# Import sunpy coordinates if available to register the frames an... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = 'j. F Y H:i:s'
YEAR_MONTH... |
# Advent of Code 2021
# Day 4: Part 1 and Part 2
# Author: Nico Van den Hooff
import numpy as np
def read_data(path):
with open(path, "r") as f:
lines = []
matrix = []
bingo_boards = []
# bingo numbers
numbers = [int(num) for num in f.readline().split(",")]
# r... |
import numpy as np
import logging
from fastlmmhpc.association import single_snp
from sklearn.cross_validation import KFold
import pandas as pd
import os
import time
import pysnptools.util as pstutil
from fastlmmhpc.inference import FastLMM
from fastlmmhpc.util.mapreduce import map_reduce
from fastlmmhpc.inference.fast... |
import os
import json
import asyncio
import logging
import argparse
import datetime
import configparser
from pydiscover.utils import prepare_text, crypt, decrypt
from socket import gethostbyname, gethostname
logging.basicConfig(level=logging.INFO, format='[ %(levelname)-5s - Service Discovery ] %(asctime)s - %(messag... |
# -*- coding: utf-8 -*-
from .unitprototype import UnitPrototypeDetailViewer
from .spellprototype import SpellPrototypeDetailViewer
from .unitinstance import UnitInstanceDetailViewer
|
'''
Olly Smith 2018
olly.smith1994@gmail.com
This application makes live predictions for the location of a ball, using region proposal on a trained CNN model, from a webcam. Threading was used to improve the performance of the webcam stream.
'''
import time
import threading
from threading import Thread
import cv2
imp... |
"""Test mandatory parameters."""
import pytest
from haddock.core.defaults import RUNDIR
# this import is also a test
from haddock.gear.parameters import ( # noqa: F401
MANDATORY_YAML,
_mandatory_parameters,
config_mandatory_general_parameters,
)
from haddock.gear.yaml2cfg import read_from_yaml_config
... |
class Extra:
def __init__(self,x,y):
self.r=8
self.xr=x+self.r*3
self.xl=x-self.r*3
self.y=y
self.toDelete = 0
def show(self):
fill(200)
rect(self.xr,self.y,self.r,self.r)
rect(self.xl,self.y,self.r,self.r)
def move(self):
... |
import json
import click
import pandas as pd
import requests
from gsan.clean_df import strip_chars
def get_crtsh(domain, timeout=30):
try:
crt_req = requests.get(f"https://crt.sh/?dNSName={domain}&output=json", timeout=timeout).json()
except requests.exceptions.ConnectionError:
click.secho("... |
test = {
'name': 'derive-sum',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
scm> (make-sum 1 3)
4
scm> (make-sum 'x 0)
x
scm> (make-sum 0 'x)
x
scm> (make-sum 'a 'x)
(+ a x)
scm> (make-sum... |
name="tsoftlib" |
"""
Module for SegmentRule model(s)
"""
from tasking.models import BaseSegmentRule
class SegmentRule(BaseSegmentRule):
"""
SegmentRule model class
"""
# pylint: disable=too-few-public-methods
class Meta:
"""
Meta options for SegmentRule
"""
abstract = False
... |
import numpy as np
import camb as cb
from scipy import integrate
from scipy.interpolate import interp1d
from . import linear_growth_functions as lgf
class CosmoLinearGrowth:
""" A class for computing, storing and interpolating cosmological linear growth functions:
- rz: comoving distance.
- Hz: Hubble p... |
"""
https://github.com/git/git/blob/v2.10.2/Documentation/gitignore.txt#L70
"""
import glob
import os
# import re
# import pathspec
from .base import Base
# class Globs(Base):
# def run(self, *patterns):
# """ .gitignoreスタイルのファイルの指定方法を許可する
# """
# spec = pathspec.PathSpec.from_lines("gi... |
import cv2
import dlib
fonte = cv2.FONT_HERSHEY_COMPLEX_SMALL
# Iremos utilizar as imagens abaixo (uma de cada vez) para testar a confiabilidade dos detectores HOG e CNN
imagem = cv2.imread("imagens-e-recursos/fotos/grupo.0.jpg")
# imagem = cv2.imread("imagens-e-recursos/fotos/grupo.1.jpg")
# imagem = cv2.imread("ima... |
## -*- coding: utf-8 -*-
"""
Example script of clustering circles data with DMAE.
"""
# Author: Juan S. Lara <julara@unal.edu.co>
# License: MIT
from dmae.layers import DissimilarityMixtureAutoencoderCov, DissimilarityMixtureEncoderCov
from dmae.initializers import InitKMeans, InitIdentityCov
from dmae import dissimil... |
from sandbox.rocky.tf.algos.trpo import TRPO
from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline
from rllab.envs.normalized_env import normalize
from sandbox.rocky.tf.optimizers.conjugate_gradient_optimizer import ConjugateGradientOptimizer
from sandbox.rocky.tf.optimizers.conjugate_gradient_optim... |
import math
import StringIO
import types
__pychecker__ = 'no-returnvalues'
WS = set([' ', '\t', '\r', '\n', '\x08', '\x0c'])
DIGITS = set([str(i) for i in range(0, 10)])
NUMSTART = DIGITS.union(['.', '-', '+'])
NUMCHARS = NUMSTART.union(['e', 'E'])
ESC_MAP = {'n': '\n', 't': '\t', 'r': '\r', 'b': '\x08', 'f': '\x0c'}
R... |
#!/usr/bin/env python3
import time
from threading import Lock
from requests.exceptions import RequestException
from mackee import main, eprint, get_cms, get_args
from brightcove.utils import TimeString, list_to_csv, SimpleProgressDisplay
data_lock = Lock()
row_list = [ ['video_id','delivery_type','master_size'] ]
show... |
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import itertools as itt
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal, assert_allclose)
im... |
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
import numpy as np
if __name__ == '__main__':
# Input
N = int(input())
route = np.zeros([2, N], dtype=int)
# HACK: More smarter.
for i in range(2):
line = [int(i) for i in input().split(" ")]
for j in r... |
# -*- coding: utf-8 -*-
from pandas_ta.overlap import ma
from pandas_ta.utils import get_drift, get_offset, verify_series
def efi(close, volume, length=None, mamode=None, drift=None, offset=None, **kwargs):
"""Indicator: Elder's Force Index (EFI)"""
# Validate arguments
length = int(length) if length and ... |
# Time: O(nlogn)
# Space: O(n)
class Solution(object):
def numRescueBoats(self, people, limit):
"""
:type people: List[int]
:type limit: int
:rtype: int
"""
people.sort()
result = 0
left, right = 0, len(people)-1
while left <= right:
... |
from flask import current_app
import requests
GOOGLE_API_URL = "https://www.googleapis.com/customsearch/v1"
def searcher(term):
if not term.startswith('*'):
url = None
else:
term = term[1:]
search_terms = {
'start': 1,
'num': 1,
'q': ' '.join(['sto... |
import sys
def new_item():
global list
name = str(input("Name : "))
list.append(name)
print(f"{name} added")
def menu_text():
global list
if len(list) <= 0:
cmd = str(input("(N)ew (Q)uit : "))
else:
cmd = str(input("(N)ew (S)how (D)elete (Q)uit : "))
return cmd
def sh... |
import json
import os
import re
import sys
from udemy.decryptor.utils import extract_kid, decrypt, mux_process
def clean_title(title):
return re.sub(r"[^\w-]", '_', title)
def walk_recursively(path, pattern_file=""):
all_dirs_path = []
all_files_path = []
for _root, d_names, f_names ... |
from django.core.management.base import BaseCommand, CommandError
from bbb.models import Room, RoomStats
import requests
import json
import dateutil.parser
import traceback
class Command(BaseCommand):
help = 'Update room statistics'
def handle(self, *args, **options):
for room in Room.objects.all():
... |
# -*- coding: utf-8 -*-
"""
bai public
"""
from .baidu_ai_voice import BaiVoice
|
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from .models import Profile, Post, Comment
class SignUpForm(UserCreationForm):
email = forms.EmailField(max_length=254, help_text='Required. Please provide a valid email address.')
class... |
from datetime import date
import shutil
from pathlib import Path
from typing import (
AbstractSet,
Any,
Callable,
Iterable,
List,
Tuple,
TypeVar,
Union,
Optional,
Dict,
Mapping,
)
from adam.language.language_utils import (
phase2_language_generator,
integrated_experim... |
from time_handler import hhmm_to_seconds_from_now
from time_handler import seconds_from_now_to_hhmm
import time
def test_time_handler():
assert seconds_from_now_to_hhmm(hhmm_to_seconds_from_now("12:15"))
assert seconds_from_now_to_hhmm(hhmm_to_seconds_from_now("09:00"))
assert seconds_from_now_to_... |
import paddle
import os
import shutil
import time
import pkgutil
import types
import contextlib
import argparse
import json
import sys
import inspect
import ast
import logging
import importlib
"""
generate api_info_dict.json to describe all info about the apis.
"""
en_suffix = "_en.rst"
cn_suffix = "_cn.rst"
# key = ... |
"""
Manipulation of EPI data.
.. testsetup::
>>> tmpdir = getfixture('tmpdir')
>>> tmp = tmpdir.chdir() # changing to a temporary directory
>>> nb.Nifti1Image(np.zeros((90, 90, 60)), None, None).to_filename(
... tmpdir.join('epi.nii.gz').strpath)
"""
def get_trt(in_meta, in_file=None):
r"""... |
from introduction import give_speech
from staring import stare_at_people
from dow_jones import visualize_dow_jones
from art_critic import give_art_critiques
from hipster import try_hipster_social_interaction
from empathy import share_feelings_with_everyone
from slapstick import perform_slapstick_humor
from ending impor... |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2017, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... |
# coding=utf-8
#
# BSD 3-Clause License
#
# Copyright (c) 2016-19, University of Liverpool
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the abov... |
# -*- coding: utf-8 -*-
"""
sphinx.builders.applehelp
~~~~~~~~~~~~~~~~~~~~~~~~~
Build Apple help books.
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import print_function
import codecs
import pipes
import plistlib
imp... |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
from spack.util.environment import set_env
from spack.util.executable import which
class Strumpack(C... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import re
import functools
import operator as op
import utool as ut
import numpy as np
import copy
import six
(print, rrr, profile) = ut.inject2(__name__, '[depbase]')
class StackedConfig(ut.DictLike, ut.HashCom... |
import logging
from django.shortcuts import redirect
from django.utils.translation import ugettext as _
from django.urls import reverse, reverse_lazy
from .applicant_form_view_base import ApplicantFormViewBase
from formation.forms import county_form_selector, \
county_display_form_selector, ApplicationReviewForm
i... |
import tensorflow as tf
import numpy as np
from skimage import io, transform
from random import randint
from scipy.stats import multivariate_normal
from utils import comiou2d, comloc2d
def contrast(image):
'''
'''
image = image - 127
image = image*(randint(100, 150)/100)
image = image + 127
image = np.clip(ima... |
# -*- coding: utf-8 -*-
"""
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
#
# This file was generated and any changes will be overwritten.
"""
from __future__ import unicode_literals
from ..request.directory_ob... |
import importlib.util
import inspect
import os
import queue
from dataclasses import dataclass
from importlib.machinery import ModuleSpec
from pathlib import Path
from types import ModuleType
from typing import Callable, Iterable, List, NamedTuple, Optional
from loguru import logger
from tinytag import TinyTag
from tin... |
#!/usr/bin/env python3
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
im... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis <michael.aivazis@para-sim.com>
# (c) 1998-2022 all rights reserved
def test():
"""
Sanity check: verify that the {debug} channel is accessible
"""
# access
from journal import debug
# all done
return
# main
if __nam... |
from __future__ import print_function
#
# demo to start os command
#
# from subprocess import check_output
# cmd = r'C:\cygwin64\bin\ps.exe'
# output = check_output(cmd)
# print (output)
from builtins import object
import subprocess
import glob
import json
import platform
import os
from cloudmesh_base... |
import json
from contextlib import contextmanager
from django.db import models, transaction
from django.conf.urls import url
from django.contrib import admin, messages
from django.contrib.admin import options
from django.contrib.admin.utils import unquote, quote
from django.contrib.contenttypes.admin import GenericInl... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException
DOCUMENTATION = '''
module: k8s_v1_event
short_description: Kubernetes Event
description:
- Manage the lifecycle of a event object. Supports check mode, and attempts to to
be ide... |
from textwrap import wrap
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.figure import Figure
from ssl_metrics_github_issues.polynomialMath import findBestFitLine
def graph(
title: str,
xLabel: str,
yLabel: str,
xData: list,
yData: list,
maximumDegree: int = None,
bes... |
import sys
import os
import os.path
import random
import argparse
from pathlib import Path
import webdataset as wds
parser = argparse.ArgumentParser("""Generate sharded dataset from text datasets.""")
parser.add_argument("--maxsize", type=float, default=1e9)
parser.add_argument("--maxcount", type=float, default=1000... |
from django.conf.urls import url
from estatisticas_facebook.pages.views import *
urlpatterns = [
url(
regex=r'^create/$',
view= PageCreateView.as_view(),
name='create'
),
url(
regex=r'^detail/(?P<pk>[\w-]+)/$',
view= PageDetailView.as_view(),
name='detail'
... |
from . import packet
class Packet6(packet.Packet):
def __init__(self):
super().__init__(6)
|
import subprocess
import sys
import pytest
import re
import signal
import time
import os
import ray
from ray._private.test_utils import (
run_string_as_driver_nonblocking,
run_string_as_driver,
)
@pytest.mark.skipif(sys.platform == "win32", reason="Failing on Windows.")
def test_spill_logs():
script = "... |
"""
Table of Contents Extension for Python-Markdown
* * *
(c) 2008 [Jack Miller](http://codezen.org)
Dependencies:
* [Markdown 2.0+](http://www.freewisdom.org/projects/python-markdown/)
"""
import markdown
from markdown import etree
import re
class TocTreeprocessor(markdown.treeprocessors.Treeprocessor):
# Iter... |
#!/home/edith/Documents/moringa/galleria-app/virtual/bin/python
# When the django-admin.py deprecation ends, remove this script.
import warnings
from django.core import management
try:
from django.utils.deprecation import RemovedInDjango40Warning
except ImportError:
raise ImportError(
'django-admin.py... |
"""Class implementation for the skew x interface.
"""
from typing import Dict
from apysc._animation.animation_skew_x_interface import AnimationSkewXInterface
from apysc._type.attr_linking_interface import AttrLinkingInterface
from apysc._type.int import Int
from apysc._type.revert_interface import RevertInter... |
# kernel.py
#
# Energy deposition kernel data for varian 6MV source created with EDKnrc.
#
# Simulation details:
#
# Histories - 20000000
# Num cones - 48
# Angles - 3.75 degree spacing
# Num spheres - 24
# Medium - H20521ICRU
# ECUT - 0.521
# PCUT - 0.010
#
import numpy as np
class PolyenergeticKernel:
def __in... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 23 21:45:43 2019
@author: Zoletnik
"""
import configparser
import copy
import flap.tools
class Config:
def __init__(self):
self.config = configparser.ConfigParser()
self.config.optionxform = str
self.file_name = None
def read(file_name=None):... |
# Copyright (c) 2019 Intel Corporation.
#
# 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 la... |
import binascii
import logging
import numbers
from .bits import Bits
from ..ast.base import _make_name
from .bool import If
l = logging.getLogger("claripy.ast.bv")
_bvv_cache = dict()
# This is a hilarious hack to get around some sort of bug in z3's python bindings, where
# under some circumstances stuff gets destr... |
#!/usr/bin/env python3
# Software Name: ngsildclient
# SPDX-FileCopyrightText: Copyright (c) 2021 Orange
# SPDX-License-Identifier: Apache 2.0
#
# This software is distributed under the Apache 2.0;
# see the NOTICE file for more details.
#
# Author: Fabien BATTELLO <fabien.battello@orange.com> et al.
# SPDX-License-Id... |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... |
from typing import Callable, AnyStr, List
import json
def combine_validators(*validators: Callable) -> Callable:
"""
Combines all validators into one function that checks if
all validators return True.
:param validators: A list of validators
:return: A function that combines all the validators
... |
print "1..2"
import perl
perl.eval("""
Python::exec("
print 'ok 1'
n = 4
");
print "ok ", Python::eval("n/2"), "\n";
""")
|
from launcher import Task
import json
import os
import argparse
import pprint
class ConfigureTask(Task):
name = 'configure'
def __init__(self, args):
self.args = args
self.data_dir = os.path.join(os.path.abspath(args["data_dir"]),
args["dataset"])
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
from conans import ConanFile, CMake, tools
class LibwebpConan(ConanFile):
name = "libwebp"
version = "1.0.0"
description = "library to encode and decode images in WebP format"
url = "http://github.com/bincrafters/conan-libwebp"
... |
# coding: utf-8
"""
Exposes several methods for transmitting cyclic messages.
The main entry point to these classes should be through
:meth:`can.BusABC.send_periodic`.
"""
import abc
import logging
import threading
import time
import warnings
log = logging.getLogger('can.bcm')
class CyclicTask(object):
"""
... |
import os
dir = "lgg-mri-segmentation/kaggle_3m"
# To call the corresponding original file
def tiff_call(content):
content = content.split(".")[0] + ".tif"
dir_ = "_".join(content.split("_")[:4])
path = dir + "/" + dir_ + "/" + content
if os.path.exists(path):
return path
else :
return "lgg-mri-segme... |
# Copyright 2020 The Cirq Developers
# 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 law or agreed to in wr... |
from __future__ import annotations
from enum import Enum
from re import match
from typing import Optional
from typing import Dict
from typing import List
from pathlib import Path
from jmm.utilities.functions import get_number
class Direction(Enum):
FORWARD = 1
BACKWARD = -1
class SubtitleType(Enum):
NON... |
import os
import random
import torch
import pandas as pd
from PIL import Image
from torchvision import transforms as TR
class CelebAMaskHQDataset(torch.utils.data.Dataset):
def __init__(self, opt, for_metrics):
opt.load_size = 256
opt.crop_size = 256
opt.label_nc = 18
opt.contai... |
"""Allows using emdp as a gym environment."""
import numpy as np
import gym
from gym import spaces
import emdp.utils as utils
def gymify(mdp, **kwargs):
return GymToMDP(mdp, **kwargs)
class GymToMDP(gym.Env):
def __init__(self, mdp, cutoff_time=100000, observation_one_hot=True):
"""
:param... |
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# Cathy Nangini <cnangini@gmail.com>
# Mainak Jas <mainak@neuro.hut.fi>
#... |
"""
======================
DMP as Potential Field
======================
A Dynamical Movement Primitive defines a potential field that superimposes
several components: transformation system (goal-directed movement), forcing
term (learned shape), and coupling terms (e.g., obstacle avoidance).
"""
print(__doc__)
impor... |
# Covid Run problem
# author Abhishek Sharma
t = int(input())
while t:
t= t-1
n,k,x,y = [int(l) for l in input().split()]
count = [0]*n
while True:
if count[x]:
flag = 1
break
count[x] +=1
x = (x+k)%n
if count[y]:
flag = 2
... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Centralized catalog of paths."""
import os
class DatasetCatalog(object):
DATA_DIR = "datasets"
DATASETS = {
"coco_2017_train": {
"img_dir": "coco/train2017",
"ann_file": "coco/annotations/instances_trai... |
"""
Python with RabbitMQ—simplified so you won't have to.
This module implements PyRMQ Publisher class
:copyright: 2020-Present by Alexandre Gerona.
:license: MIT, see LICENSE for more details.
Full documentation is available at https://pyrmq.readthedocs.io
"""
import json
import logging
import o... |
# mission_Caravan.py
#
# Created: Ago 2018, M. Gallani
# Modified: Jun 2021, V. Tanigawa
#----------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------
import SUAVE
import matplotlib.pyplot as plt
import numpy as np ... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.login),
url(r'^signup/$', views.signup),
url(r'^login/$', views.login),
url(r'^logout/$', views.logout),
] |
# Given an array of ints, return a new array length 2 containing the first and
# last elements from the original array. The original array will be length 1
# or more.
# make_ends([1, 2, 3]) --> [1, 3]
# make_ends([1, 2, 3, 4]) --> [1, 4]
# make_ends([7, 4, 6, 2]) --> [7, 2]
def make_ends(nums):
return ([nums[0], n... |
#!/usr/bin/env python2
""" one-line description QQQQ
(Note blank line above for docstring)
title QQQQ
Version QQQQ
Copyright (C) QQQQ
Author QQQQ
Date QQQQ
Description QQQQ
python2template
Replace all occurances of QQQQ
with the appropriate information
This template passes pylint with one change, see .pylintrc
Thi... |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'camara_ui.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
import sys
import cv2
import numpy as np
import threading
im... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rendertools.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. ... |
# MIT License
#
# Copyright (c) 2020 CNRS
#
# 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... |
# -*- coding: utf-8 -*-
import sys
import warnings
import weakref
import numpy as np
import os
from ...Qt import QtGui, QtCore, QT_LIB
from ... import pixmaps
from ... import functions as fn
from ...widgets.FileDialog import FileDialog
from .. PlotDataItem import PlotDataItem
from .. ViewBox import ViewBox
from .. Axis... |
# -*- coding: utf-8 -*-
# Copyright 2013 Google 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 require... |
'''
Copyright (c) 2021, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
'''
import rouge
import time
import json
import nltk
import os
from tqdm import tqdm
import debugger
nltk.... |
#----------------------------------------------------------------------
# This file was generated by ./setup_img2py.py
#
from wx.lib.embeddedimage import PyEmbeddedImage
Root = PyEmbeddedImage(
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1B"
"AACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAA... |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"Factory for modules, classes, methods, functions."
from lib import base, cache, constants, exception
from lib.constants import objects, element, locator
from lib.element import tree_view, widget_info, tree_v... |
# -*- coding: utf-8 -*-
"""
Spyder Editor
Created on Mon Mar 22 10:03:21 2021
@author: Francis Lareau
This is Projectjstor.
Topic model with LDA (Gibbs sampling) comparison
"""
#==============================================================================
# ############################################################... |
from packages.utility import Date, day_difference
# User interaction
if __name__ == '__main__':
print("Enter 'q' at any time to quit.")
while True:
try:
# Prompt the user for data filename and return the processed dataframe
first_date = input(
'Please enter Fir... |
# 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... |
# This file is Copyright 2020 Volatility Foundation and licensed under the Volatility Software License 1.0
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
#
import argparse
import gettext
import re
# This effectively overrides/monkeypatches the core argparse module to provide more helpf... |
#
# Generated with ParameterFieldBlueprint
from dmt.blueprint import Blueprint
from dmt.dimension import Dimension
from dmt.attribute import Attribute
from dmt.enum_attribute import EnumAttribute
from dmt.blueprint_attribute import BlueprintAttribute
from .customcomponent import CustomComponentBlueprint
from sima.sima... |
import gym
import numpy as np
class Agent:
def __init__(self, env):
self.env = env
def get_action(self):
action = self.env.action_space.sample()
return action
def play(self, episodes, render=True):
rewards = [0.0 for i in range(episodes)]
for episode in range(epi... |
"""Let's Encrypt Cisco ASA plugin."""
|
#!/usr/bin/python3 -u
"""
SPDX-License-Identifier: BSD-2
"""
import unittest
from tpm2_pytss import *
from .TSS2_BaseTest import TSS2_EsapiTest
class TestEsys(TSS2_EsapiTest):
def test_get_random(self):
r = self.ectx.get_random(5)
self.assertEqual(len(r), 5)
with self.assertRaises(TypeE... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import hashlib as hasher
import datetime as date
class Block:
def __init__(self, index, timestamp, data, previous_hash):
"""class constructor"""
self.index = index
self.timestamp = timestamp
self.data = data
self.previous_hash... |
class TestClass:
def reverse_string(self, str):
result = ""
i = len(str) - 1
while i >= 0:
result += str[i]
i -= 1
return result
def test_method(self):
print self.reverse_string("print value")
return "return value"
try:
TestClass(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.