text stringlengths 1 927k |
|---|
import logging
from tornado.web import RequestHandler, StaticFileHandler
from amgut import media_locale, text_locale
from amgut.connections import ag_data
from amgut.lib.config_manager import AMGUT_CONFIG
from amgut.lib.mail import send_email
class BaseHandler(RequestHandler):
def get_current_user(self):
... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables
class Target... |
#!/usr/bin/env python3
import os
import time
import yaml
now = time.time()
cutoff = now - 86400 # One day ago
yml = yaml.safe_load(open('config.yaml').read())
pdfdir = yml['storage']['pdf']
tokdir = yml['storage']['tokens']
rm = 0
if os.path.exists(pdfdir):
for file in [x for x in os.listdir(pdfdir) if os.path.... |
import codecs
import io
import json
import os
import platform
import sys
import hashlib
from builtins import input
from collections import defaultdict
from copy import deepcopy
from functools import lru_cache
from detect_secrets.core.baseline import merge_results
from detect_secrets.core.bidirectional_iterator import ... |
import symro
import symro.src.mat as mat
from symro.src.prob.problem import Problem
from symro.src.parsing.amplparser import AMPLParser
import symro.src.handlers.nodebuilder as nb
import symro.src.handlers.formulator as frm
from symro.test.test_util import *
# Scripts
# -----------------------------------------------... |
from abyss import abyss_filter_t
import ida_lines, ida_pro
FUNC_NAMES = [
"memcpy", "memmove", "strcpy", "gets", "malloc", "free",
"realloc", "sprintf", "system", "popen"]
class funcname_colorizer_t(abyss_filter_t):
"""example filter which makes function names stand out visually"""
def process_text(s... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'PaymentOption'
db.delete_table('store_paymentoption')
# Removing M2M table for fi... |
# This file is part of Cryptography GUI, licensed under the MIT License.
# Copyright (c) 2020 Benedict Woo Jun Kai
# See LICENSE.md for more details.
######################################
# Import and initialize the librarys #
######################################
import logging
import pygame
import glob
import os
... |
import smtplib
import urllib.parse
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from itsdangerous import URLSafeTimedSerializer
from flask import current_app
from server.services.messaging.template_service import get_template, get_profile_url
class SMTPService:
@staticmet... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-10 17:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('feedback_survey', '0014_auto_20170510_1717'),
]
operations = [
migrations.A... |
# Copyright 2015 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 required by applicable law or a... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 17 18:15:59 2018
@author: Chat
"""
import smtplib
def sendemail(from_addr, to_addr_list, cc_addr_list, subject, message, login, password, smtpserver='smtp.gmail.com:587'):
header = 'From: %s\n' % from_addr
header += 'To: %s\n' % ','.join(to_addr_list)
h... |
from .tspline import * |
from __future__ import print_function
import os
import sys
import re
import shutil
import six
if six.PY3:
from itertools import zip_longest
from configparser import ConfigParser
elif six.PY2:
from itertools import izip_longest as zip_longest
from ConfigParser import ConfigParser
from getpass import ge... |
from contextlib import contextmanager
import pickle
import sqlalchemy as tsa
from sqlalchemy import ARRAY
from sqlalchemy import bindparam
from sqlalchemy import BLANK_SCHEMA
from sqlalchemy import Boolean
from sqlalchemy import CheckConstraint
from sqlalchemy import Column
from sqlalchemy import column
from sqlalchem... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is the official evaluator taken from the original dataset. I made minimal changes to make it
Python 3 compatible, and conform to our style guidelines.
"""
#Official Evaluator for WikiTableQuestions Dataset
#
#There are 3 value types
#1. String (unicode)
#2. Numbe... |
# Triple-quoted string to output personal information
print('Programmer: NAME', 'Course: COSC146, Winter 2019', 'Lab#: 1, part#1', 'Due date: 1-16-2019', sep='\n')
# Print "Roses are Red" to console
print('\nRoses are Red\n')
# Print Poem with Border
border = '+++++++++++++++++++++++++++'
poem = '+ Ros... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# aiortc documentation build configuration file, created by
# sphinx-quickstart on Thu Feb 8 17:22:14 2018.
#
# 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
# aut... |
SUBSTITUTIONS = {
"ODP20": ("Stratospheric Ozone Depletion", "20 year timescale"),
"ODP100": ("Stratospheric Ozone Depletion", "100 year timescale"),
"ODPinfinite": ("Stratospheric Ozone Depletion", "Infinite timescale"),
"EOFP": ("Ozone Formation", "Damage to Ecosystems"),
"HOFP": ("Ozone Formation... |
import sys
import os
label_path = "/home/minjae/TANet/pointpillars_with_TANet/second/data/JRDB_to_KITTI/training/label_2/"
label_lists = os.listdir(label_path)
instance_counts = 0
#import pdb; pdb.set_trace()
for i in label_lists:
with open(label_path + i,"r") as f:
instance_counts += len(f.readlines())
p... |
from parsons.notifications.gmail import Gmail
import json
import os
import requests_mock
import unittest
import shutil
import base64
import email
_dir = os.path.dirname(__file__)
class TestGmail(unittest.TestCase):
@requests_mock.Mocker()
def setUp(self, m):
self.tmp_folder = "tmp/"
self.cr... |
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
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, p... |
#!/usr/bin/python
import numpy as np
from numpy.linalg import norm
from time import process_time
from .wolfe_skel import *
from .visualize import visualize
# Resolution d'un probleme d'optimisation sans contrainte
# Methode pseudo-newtonienne: BFGS
def bfgs(oracle, x0, iter_max = 5000, threshold = 0.000001, visual=... |
# Copyright 2016 Tecnativa - Antonio Espinosa
# Copyright 2016 Tecnativa - Sergio Teruel
# Copyright 2016-2018 Tecnativa - Pedro M. Baeza
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models
class AccountAnalyticLine(... |
from yeast.step import Step
from yeast.errors import YeastValidationError
class CustomStep(Step):
"""
Custom Step was designed to extend all the power of Yeast Pipelines and cover all scenarios
where the Yeast steps are not adequate. You might need to define your own operations.
You could define your ... |
# coding: utf-8
import pprint
import re
import six
class UpdateRecordSetsRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from django.views import defaults as default_views
urlpat... |
# autogenerated by scripts/update_backend_index.py
import re
backend_url_patterns = [
("acm", re.compile("https?://acm\\.(.+)\\.amazonaws\\.com")),
("apigateway", re.compile("https?://apigateway\\.(.+)\\.amazonaws.com")),
(
"applicationautoscaling",
re.compile("https?://application-autoscal... |
import argparse
import collections
import math
import os
import matplotlib.pyplot as plt
import pandas as pd
def my_plot_function(showGraph=False, x_axis="episodes", algo="ppo", env=''):
masterDataFrameList = {}
dfs = []
divBy = 0
avg = None
for subdir, dirs, files in os.walk(os.path.join(storag... |
#!/usr/bin/env python
"""
3a. Create a new directory named "test_ex3".
In this directory, create a file named "test_simple.py".
In this file, write two simple functions "my_add" and "my_mul"
which add two values together and multiply two values together respectively
(and then return these values).
3b. Create two ... |
from __future__ import unicode_literals
import os
from dulwich.ignore import match_pattern, read_ignore_patterns
from dvc.utils import relpath
from dvc.utils.compat import cast_bytes
from dvc.utils.fs import get_parent_dirs_up_to
class DvcIgnoreFileHandler(object):
def __init__(self, tree):
self.tree = ... |
# coding: utf-8
"""
metal-api
API to manage and control plane resources like machines, switches, operating system images, machine sizes, networks, IP addresses and more # noqa: E501
OpenAPI spec version: v0.15.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __futur... |
# 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... |
from captions.models import Caption
from captions.serializers import CaptionSerializer, UserSerializer
from rest_framework import generics
from django.contrib.auth.models import User
from rest_framework import permissions
from captions.permissions import IsOwnerOrReadOnly
class UserList(generics.ListAPIView):
que... |
#!/usr/bin/env python
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved.
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Simple SMB Server example.
#
# Author:
# Alberto Sol... |
from pwn import *
from LibcSearcher import LibcSearcher
import sys
io = -1
############################
#********修改文件名**********
############################
file_name = 'level3_x64'
port = 27974
###########修改宏###########
DEBUG = 1
LOG_PRINT = 1
TMUX = 0
def LOG_ADDR_SUCCESS(name:str, addr:int):
'''
打印地址
... |
class Packages:
def __init__(self, dir, index_url, extra_url):
self.dir = dir
self.index_url = index_url
self.extra_url = extra_url
def __get_installed_packages(self):
try:
with open(self.dir + '/packages') as f:
return f.read().split(' ')
ex... |
from .j4j_spawner import J4J_Spawner |
#!/usr/bin/env python3
# Copyright (c) 2016-2017 The QQcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test using named arguments for RPCs."""
from test_framework.test_framework import QQcoinTestFramework
f... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import pickle
dataset = pd.read_csv('hiring.csv')
dataset['experience'].fillna(0, inplace=True)
dataset['test_score'].fillna(dataset['test_score'].mean(), inplace=True)
X = dataset.iloc[:, :3]
# Converting words to int... |
"""
CHAIN INSPECTION.
https://www.codeeval.com/open_challenges/119/
We use special generator to produce chains of elements. Don't ask why we need
them, we're not sure that somebody knows the answer for this question. A
chain is represented by a string of name-address pairs. So the first element
is the name of a pair ... |
import torch
from tonic import logger # noqa
from tonic.torch import agents, updaters
def default_actor_updater():
return updaters.TrustRegionPolicyGradient(
optimizer=updaters.ConjugateGradient(
constraint_threshold=0.01, damping_coefficient=0.1,
conjugate_gradient_steps=10, bac... |
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from .models import *
class HoodForm(forms.ModelForm):
class Meta:
model = Hood
fields = ['name', 'location']
class ProfileForm(forms.ModelForm):
class Meta:
... |
from django.contrib import admin
from .models import MovieList, Movie
class MoviesInline(admin.TabularInline):
model = Movie
extra = 1
fieldsets = [
('Movies', {'fields': ['title']}),
(None, {'fields': ['movielist']})
]
class MovieListAdmin(admin.ModelAdmin):
fieldsets = [
... |
import logging
import warnings
try:
import cPickle as pickle
except ImportError:
import pickle
from lib.error import AddressBookError
logger = logging.getLogger(__name__)
class AddressBook:
def __init__(self, name='primary'):
self.name = name
try:
self.contact_list = pickle.l... |
############################################################
# CMPSC 442: Homework 3
############################################################
student_name = "Kangdong Yuan"
############################################################
# Imports
############################################################
# Includ... |
# $Id: ospf.py 23 2006-11-08 15:45:33Z dugsong $
# -*- coding: utf-8 -*-
"""Open Shortest Path First."""
from __future__ import absolute_import
from . import dpkt
AUTH_NONE = 0
AUTH_PASSWORD = 1
AUTH_CRYPTO = 2
class OSPF(dpkt.Packet):
"""Open Shortest Path First.
TODO: Longer class information....
At... |
# -*- coding: utf-8 -*-
# Copyright 2021 Tampere University and VTT Technical Research Centre of Finland
# This software was developed as a part of the ProCemPlus project: https://www.senecc.fi/projects/procemplus
# This source code is licensed under the MIT license. See LICENSE in the repository root directory.
# Auth... |
from __future__ import absolute_import
import six
from sentry.models import AuthIdentity, AuthProvider
from sentry.testutils import AuthProviderTestCase
from sentry.utils.auth import SSO_SESSION_KEY
class OrganizationAuthLoginTest(AuthProviderTestCase):
def test_sso_auth_required(self):
user = self.crea... |
import numpy as np
from .. import pad
from .base import Refocus
class RefocusNumpy(Refocus):
"""Refocusing with numpy-based Fourier transform
.. versionadded:: 0.3.0
"""
def _init_fft(self, field, padding):
"""Perform initial Fourier transform of the input field
Parameters
... |
def escreva(nome):
print('~' * (len(nome) + 6))
print(f' {nome} ')
print('~' * (len(nome) + 6))
nome = 'Ian'
escreva(nome)
nome = 'Estuda y Estuda'
escreva(nome)
nome = 'Coding and Conding'
escreva(nome) |
import imaplib
import pprint
import imaplib_connect
with imaplib_connect.open_connection() as c:
c.select('INBOX', readonly=True)
print('HEADER:')
typ, msg_data = c.fetch('1', '(BODY.PEEK[HEADER])')
for response_part in msg_data:
if isinstance(response_part, tuple):
print(response_... |
# Author: Hamzeh Alsalhi <ha258@cornell.edu>
#
# License: BSD 3 clause
import numpy as np
import scipy.sparse as sp
import array
from . import check_random_state
from ._random import sample_without_replacement
__all__ = ['sample_without_replacement']
def _random_choice_csc(n_samples, classes, class_probability=None... |
# AUTOGENERATED! DO NOT EDIT! File to edit: notebooks/07_gbe.sst.data_provider.ipynb (unless otherwise specified).
__all__ = ['SSTDataProvider']
# Cell
from fastcore.foundation import patch
from ..data_provider import GBEProvider
from ...data_provider import get_efficiently
import numpy as np
# Cell
class SSTDataPro... |
# -*- encoding: utf-8 -*-
# Module iah2percentile
def iah2percentile(h,p):
import numpy as np
s = h.sum()
k = ((s-1) * p/100.)+1
dw = np.floor(k)
up = np.ceil(k)
hc = np.cumsum(h)
if isinstance(p, int):
k1 = np.argmax(hc>=dw)
k2 = np.argmax(hc>=up)
else:
k1 = np.ar... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from numpy import linalg as la
__all__ = [
'l2_norm'
]
def l2_norm(X, axis=0):
"""Compute the L2 (Euclidean) norm of a matrix.
Computes the L2 norm along the specified axis. If axis is 0,
computes the norms along the columns. If 1, com... |
from tkinter import *
def handler(A):
print(A)
if __name__ == '__main__':
X = 42
widget = Button(text = 'ni', command = (lambda: handler('spam')))
widget.pack()
widget.mainloop() |
"""Module for test user model"""
import unittest
from auth.models import User
class TestUserModel(unittest.TestCase):
"""Class for user model testing"""
def setUp(self) -> None:
"""Setting up test data and configs"""
self.user = User(password="pass", username="user_name")
self.user2 ... |
"""Label encode and One-Hot encode dataframes."""
from sklearn.preprocessing import LabelEncoder
from pandas import get_dummies
from pandas import DataFrame
from pandas import Series
from pandas import concat
from pandas import merge
import numpy as np
# Auto encodes any dataframe column of type category or object.
... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import os
import torch
from torch.utils.data import Dataset, random_split, DataLoader
from PIL import Image
import torchvision.models as models
import matplotlib.pyplot as plt
import torchvision.transforms as transforms
# from sklearn.metrics import f1_score
import torch.nn.functional as F
import torch.nn as nn
from t... |
# Copyright 2015 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 required by applicable law or agreed ... |
# Copyright (c) 2017-2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
from dazl.damlast import DarFile, daml_types as daml
from dazl.damlast.daml_lf_1 import DottedName, ModuleRef, PackageRef, TypeConName
from dazl.damlast.lookup import MultiPackag... |
import network
cred_f = open('wifi_credentials.txt')
wifi_credentials = cred_f.read().split('\n');
sta_if = network.WLAN(network.STA_IF)
if not sta_if.isconnected():
print('connecting to network...')
sta_if.active(True)
sta_if.connect(wifi_credentials[0], wifi_credentials[1])
while not sta_if.isconnec... |
# -*- coding: utf-8 -*-
# File generated according to Generator/ClassesRef/Machine/WindingDW2L.csv
# WARNING! All changes made in this file will be lost!
"""Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Machine/WindingDW2L
"""
from os import linesep
from sys import getsizeof
f... |
from setuptools import setup
setup(name='compylex',
version='1.1',
description='Code compiler',
url='https://github.com/AshiqAbdulkhader/Compylex',
packages=['compylex'],
install_requires=[],
license='MIT License',
author='Muhammed Ashiq Abdul Khader',
author_email='ashi... |
from nanome._internal._network._serialization import _ContextDeserialization, _ContextSerialization
from nanome._internal._util._serializers import _DictionarySerializer, _LongSerializer
from nanome._internal._structure._serialization import _WorkspaceSerializer, _AtomSerializer
from nanome._internal._util._serializers... |
__version__ = (0, 1, 3, 3) |
import unittest
from pyravendb.commands.raven_commands import PutDocumentCommand, PatchCommand
from pyravendb.custom_exceptions.exceptions import DocumentDoesNotExistsException
from pyravendb.data.patches import PatchRequest
from pyravendb.tests.test_base import TestBase
class TestPatch(TestBase):
def setUp(self)... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import copy
import logging
import typing
from typing import Dict, Text, Any, Optional, Iterator
from typing import List
logger = logging.getLogger(__name__)
if typing... |
"""
Utilities Functions.
Copyright (c) 2014 NavPy Developers. All rights reserved.
Use of this source code is governed by a BSD-style license that can be found in
LICENSE.txt
"""
import numpy as _np
import sys
def input_check_Nx1(x):
"""
Check x to be of dimension Nx1 and reshape it as a 1-D array
Adhik... |
#!/usr/bin/env python3
"""
4-bayes_opt.py
"""
import numpy as np
from scipy.stats import norm
GP = __import__('2-gp').GaussianProcess
class BayesianOptimization:
"""
Class that instantiates a Bayesian optimization
on a noiseless 1D Gaussian process
"""
def __init__(self, f, X_init, Y_init, bounds... |
"""
Classes from the 'CloudDocs' framework.
"""
try:
from rubicon.objc import ObjCClass
except ValueError:
def ObjCClass(name):
return None
def _Class(name):
try:
return ObjCClass(name)
except NameError:
return None
BRZombie = _Class("BRZombie")
BRXPCSyncProxy = _Class("BRX... |
"""Enum for amino acid."""
from enum import Enum
from typing import Dict, TypedDict
class AcidityBasicity(Enum):
"""Enum for acidity and basicity."""
U = 3 # Neutral
A = 1 # Acid
B = 2 # Base
class Charge(Enum):
"""Enum for charge."""
U = 3 # Neutral
P = 1 # Positive
N = 2 #... |
occasions = {
"Christmas":"Merry Christmas!",
"Birthday":"Happy Birthday!",
"New Years":"Happy New Year!",
}
occasion = str(input(f"Hi!\nWhat occasion is it? Here are the ones I know:\n{list(occasions.keys())}\n"))
try:
occasion = occasion.title()
print(occasions[occasion])
except:
print("Unfortun... |
#-*- encoding: utf-8 -*-
from collections import OrderedDict
import os
import re
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
###
import sys
sys.path.append('../')
###
import utils
MIN_TEXT_LINES = 1
MIN_CHUNK_LINES = 1
MIN_CHUNK_WORDS = 20
MAX_CHUNK_WORDS = 200
AUTHORS_IGNOR... |
# coding: utf-8
"""
Mux Python - Copyright 2019 Mux Inc.
NOTE: This class is auto generated. Do not edit the class manually.
"""
from __future__ import absolute_import
import unittest
import mux_python
from mux_python.models.list_breakdown_values_response import ListBreakdownValuesResponse # noqa: E501
from mux_... |
"""
Build callback objects to run during model training.
Classes:
Callback:
Callback ABC.
CallbackList:
Perform callbacks sequentially and log output messages.
BatchMetricScorer:
Calculate and log metrics after batch sampling and forward computation.
EarlyStopping:
Stop... |
"""
Tests for trading_fee.py module.
"""
import unittest
from nowtrade.trading_fee import StaticFee
class TestTradingFees(unittest.TestCase):
"""
Tests trading_fee.py classes.
"""
def test_trading_fees(self):
"""
Simple test for all trading fees.
"""
trading_fee = Static... |
import os
B = 2 # batch size
MB = 1 # batch size for metric learning
max_clusters = 2
commitment_cost = 0.25
is_refine_net = False
is_init_cluter_with_instance = False
top_grasp_only = False
H = 240 # height
W = 320 # width
# BY = 200*2 # bird height (y axis, [-40, 40])
# BX = 176*2 # bird width (x axis, [0, 70.4])
... |
# Copyright (c) [2021] [Andrii Kuts, Oleksandr Tsepkov]
import sqlite3 as sq
import csv
with sq.connect("data/server.db") as con:
cur = con.cursor()
def create_table_teams():
cur.execute("""CREATE TABLE IF NOT EXISTS teams (
team_id INTEGER PRIMARY KEY,
team_name TEXT
)""")... |
from collections import OrderedDict
from datetime import date
import json
import os
from pathlib import Path
import re
import sys
import pytoml as toml
def get_data_dir():
"""Get the directory path for flit user data files.
"""
home = os.path.realpath(os.path.expanduser('~'))
if sys.platform == 'darwi... |
'''
Item/dungeon tracker saving
'''
import json
import os.path
import threading
from ..config import CONFIG, CONFIGDIRECTORY
from ..version import __version__ as version
DATALOCK = threading.RLock()
__all__ = (
'load_items', 'load_dungeons', 'load_locations', 'load_entrances'
'store_items', 'store_dungeons'... |
import datetime
import http
import json
import pathlib
import pytest
from gidgethub import (
BadRequest,
BadRequestUnknownError,
GitHubBroken,
HTTPException,
InvalidField,
RateLimitExceeded,
RedirectionException,
ValidationError,
ValidationFailure,
)
from gidgethub import sansio
... |
# coding: utf-8
"""Configuration file to set up Pybo
"""
from pathlib import Path
import yaml
default_config = '''tokenizer:
trie_files:
- &part 'particles.txt'
- &ancient ancient.txt
- &except exceptions.txt
- &uncomp uncompound_lexicon.txt
- &tsikchen tsikchen.txt
- &oral0 oral_corpus_0.t... |
from .objects import DB
from vkapi import VkApi, VkApiResponseException
import json
from flask import render_template
import typing
import time
import re
def get_all_history_gen(vk: VkApi, chat_id: int) -> typing.Generator[dict, None, None]:
__offset = 0
chat = vk("messages.getHistory", count=1, peer_id=chat_i... |
from . import nlclsq
from . import slopeOP #! REQUIRES THIS PACKAGE https://github.com/vrunge/slopeOP
from . import op #! REQUIRES THIS PACKAGE https://github.com/mpascucci/optimalpartitioning
from . import count
__doc__ = "functions for inhibition diameter measurement" |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import ctypes
import ctypes.wintypes
import functools
class I18nText(object):
def __init__(self, strings = None):
self.__strings = {}
if strings != None:
self.__strings = strings
def __setitem__(self, locale, string):
if st... |
from pettingzoo.sisl.waterworld import waterworld
from RL_dmfgac import Actor
import csv
import numpy as np
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
def run_waterworld(parallel_env):
n_actions = 25
num_episode = 0
while num_episode < 100:
observation = parallel_env.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
# Copyright (c) 2017. Vincenzo Lomonaco. All rights reserved. #
# See the accompanying LICENSE file for terms. #
# ... |
import collections
import random
from typing import Counter
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
def parse_data(list_content):
lists_data = []
list_collections: Counter = collections.Counter(list_content)
top_lists = list_collections.most_common(10)
... |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notic... |
from django.urls import re_path
from . import views
urlpatterns = [
re_path(r'^$', views.index, name='index'),
] |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
class AlipayMobileMovieActivityNotifyRequest(object):
def __init__(self, biz_model=None):
self._biz_model = biz_model
self._... |
import math
class Calculator:
def __init__(self, width):
self.width = width
self.params = {
'angle_x': [0],
'angle_y': [0],
'angle_z': [0],
'eye_l_open': [1],
'eye_r_open': [1],
'eye_ball_x': [0],
'eye_ball_y': [0],... |
# Copyright 2015 Google 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 applicable law or agreed to in writing, ... |
import numpy as np
import torch
import torch.nn as nn
from skimage.transform import resize
from tqdm import tqdm
class RISE(nn.Module):
"""A RISE class that computes saliency maps with RISE.
"""
def __init__(self, model, input_size, N, p1, gpu_batch=100):
super(RISE, self).__init__()
self... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.