content stringlengths 5 1.05M |
|---|
# install path
import os
install_path = os.path.dirname(os.path.realpath(__file__))
|
class Server:
def __init__(self, host, username, password=None):
self.host = host
self.username = username
self.password = password
self.connect() # Better ask user to ``connect()`` explicitly
def connect(self):
print(f'Logging to {self.host} using: {self.username}:{... |
import imaplib
import email
import hashlib
from email.header import Header
from typing import List
class Email(object):
def __init__(self, date: str, header: str, sender: str, to: str, body: str = '', html: str = ''):
self.date = date
self.header = header
self.sender = sender
self.... |
# (C) Copyright 2021 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 status as an intergovernmenta... |
VERSION = "0.1.1.dev" |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ui', '0015_auto_20170426_0803'),
]
operations = [
migrations.RenameField('Collection', 'is_active', 'is_on'),
migrat... |
"""Loading data functions
This script contains the function load_data needed to make the interface
with the user and also the associated functions for the check.
This file can be imported as a module and contains the following
functions:
"""
import datetime
import xarray as xr
from astropy.time import Time
import wa... |
"""
This source takes input from instance_performance_gce.csv
and adds it to data block
"""
import argparse
import pprint
import pandas as pd
from decisionengine.framework.modules import Source
import logging
PRODUCES = ['GCE_Instance_Performance']
class GCEInstancePerformance(Source.Source):
def __init__(sel... |
import pytest
from pathlib import Path
from lark import Lark
from typing import NamedTuple
from pprint import pprint
class Declaration(NamedTuple):
args: object
returns: object
body: object
BLACKLIST = {"operators.twn"}
def test_examples(ir, examples: Path):
for path in examples.iterdir():
... |
# -*- coding: utf-8 -*-
translations = {
# Days
'days': {
0: 'E Diel',
1: 'E Hënë',
2: 'E Martë',
3: 'E Mërkurë',
4: 'E Enjte',
5: 'E Premte',
6: 'E Shtunë'
},
'days_abbrev': {
0: 'Die',
1: 'Hën',
2: 'Mar',
3: 'Mër'... |
from itertools import zip_longest
import tensorflow as tf
import tensorflow.keras.layers as layers
from tensorflow.keras import Model
from tensorflow.keras.models import Sequential
class BasePolicy(Model):
def __init__(self, observation_space, action_space):
super(BasePolicy, self).__init__()
sel... |
"""
Load paired image data.
Supported formats: h5 and Nifti.
Image data can be labeled or unlabeled.
"""
import random
from typing import List
from deepreg.dataset.loader.interface import (
AbstractPairedDataLoader,
GeneratorDataLoader,
)
from deepreg.dataset.util import check_difference_between_two_lists
from... |
# -*- coding: utf-8 -*-
"""
A program that loads a natural number and checks if it is a palindrome.
**UNFINISHED**
"""
number= -1
reverseNumber = 0
while number <= 0:
number = int(input("Enter a natural number: "))
if number<=0:
print("That's not a natural number.")
modNumber = number
for i in ran... |
# ------------------------------------------------------------------------
# DT-MIL
# Copyright (c) 2021 Tencent. All Rights Reserved.
# ------------------------------------------------------------------------
# Modified from Deformable DETR
# Copyright (c) 2020 SenseTime. All Rights Reserved.
# -----------------------... |
import logging
import inspect
import collections
import random
import torch
from torchnlp.text_encoders import PADDING_INDEX
logger = logging.getLogger(__name__)
def get_tensors(object_):
""" Get all tensors associated with ``object_``
Args:
object_ (any): Any object to look for tensors.
Retu... |
# Copyright (c) 2020 OpenMosaic Developers.
# Distributed under the terms of the Apache License, Version 2.0.
# SPDX-License-Identifier: Apache-2.0
"""Batch creation and handling and other processing related utils."""
import geopandas
import numpy as np
import pandas as pd
def hello_world():
"""Test that tests a... |
"""The test for the moon sensor platform."""
from __future__ import annotations
from unittest.mock import patch
import pytest
from homeassistant.components.homeassistant import (
DOMAIN as HA_DOMAIN,
SERVICE_UPDATE_ENTITY,
)
from homeassistant.components.moon.sensor import (
MOON_ICONS,
STATE_FIRST_Q... |
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ["https://spreadsheets.google.com/feeds", 'https://www.googleapis.com/auth/spreadsheets',
"https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive"]
credentials = ServiceAccountCredentials.fr... |
from __future__ import absolute_import, unicode_literals
import sys
from functools import reduce
if sys.version_info.major >= 3:
from builtins import map
from builtins import filter
else:
from itertools import imap as map
from itertools import ifilter as filter
|
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Any, List
import tkinter as tk
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.backends.backend_tkagg as backend_tkagg
import matplotlib.pyplot as plt
class Displayer(ABC):
'''Abstract Class used to di... |
import speech_recognition as sr
from scipy.io.wavfile import write
import json
import os
import time
with open('dumping-wiki-6-july-2019.json') as fopen:
wiki = json.load(fopen)
combined_wiki = ' '.join(wiki).split()
len(combined_wiki)
length = 4
texts = []
for i in range(0, len(combined_wiki), length):
text... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import *
class LocalConstraint():
def __init__(self, originalLabel, originalVertex, labelConstraintDict):
self.originalLabel=originalLabel
self.originalVertex=originalVertex
self.labelList=list(labelConstraintDict.keys())
... |
import numpy as np
from numpy import arange, pi, zeros, exp, cos, ones
from spectralTransform import specTrans
from numpy import vstack, transpose, newaxis, linspace, sum
from numpy import hstack, dot, eye, tile, diag
#from numpy.fft.helper import ifftshift
from numpy.linalg import matrix_power
from numpy.fft import rf... |
import numpy
import numpy as np
def smooth_uniform_curve(curve, n: int):
if n == 1:
return curve
x = curve[..., 0]
values = curve[..., 1]
if n == -1 or curve.shape[0] <= n: # mean value
mean = numpy.tile(numpy.mean(values, -1, keepdims=True), 2)
return numpy.array([numpy.min(x... |
__author__ = "Brian O'Neill" # BTO
__version__ = '0.1.14'
__doc__ = """
100% coverage of deco_settings.py
"""
from unittest import TestCase
from log_calls import DecoSetting, DecoSettingsMapping
from log_calls.log_calls import DecoSettingEnabled, DecoSettingHistory
from collections import OrderedDict
import insp... |
# Copyright (c) 2021 Works Applications 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 a... |
import discord
import asyncio
import logging
import json
import time
import io
import sys
import random
import datetime
import re
import markov
from discord.ext import commands
from pathlib import Path
description = '''An automod bot for auto modding
'''
mark = markov.Markov
reminders = []
polls = []
TESTING = Tr... |
class Solution:
def XXX(self, nums: List[int]) -> int:
n = len(nums)
dp = [num for num in nums]
maxl = dp[0]
for i in range(1, n):
dp[i] = max(dp[i], dp[i - 1] + nums[i])
if dp[i] > maxl:
maxl = dp[i]
return maxl
|
import torch
import numpy as np
from domainbed.lib.misc import get_feature
from domainbed.lib import misc
import matplotlib.pyplot as plt
import time
def calculate_f_star(algorithm, loaders, device, test_envs, num_classes):
# test envs 不应该加入FSSD的计算
fss_list = [[] for i in range(num_classes)]
fo... |
from math import floor
from PIL import Image
try:
from .waifu2x_ncnn_vulkan import Waifu2x
except ImportError:
from waifu2x_ncnn_vulkan_python import Waifu2x
from ..params import ProcessParams
class Processor:
def __init__(self, params: ProcessParams):
self.params = params
self.w2x = Wa... |
import os
#####################################################################################################################################################################################################################################################################################################################... |
#!/usr/bin/env python3
"""
test_laboratory.py
Test the laboratory.py module.
"""
import amespahdbpythonsuite
from amespahdbpythonsuite.laboratory import Laboratory
class TestLaboratory():
"""
Test Laboratory class.
"""
def test_instance(self):
lab = Laboratory()
assert isinstance(l... |
# from .book import Book
from .book_page import BookPage, TitlePage, ChapterPage
|
import os, glob, json
from random import shuffle, choice
from shutil import copy
from self_driving.edit_distance_polyline import iterative_levenshtein
def get_spine(member):
spine = json.loads(open(member).read())['sample_nodes']
return spine
def get_min_distance_from_set(ind, solution):
distances = li... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
from ._load import *
from .inverse import *
from ._influence_line import *
from .utils import *
from .data import get_standard_influence_line
from . import serialize
from . import data
__version__ = "1.5.9"
|
#!/usr/bin/env python3
# numpy is required
import numpy
from numpy import *
# mpi4py module
from mpi4py import MPI
def utf8len(s):
return len(s.encode('utf-8'))
# Initialize MPI and print out hello
comm=MPI.COMM_WORLD
myid=comm.Get_rank()
numprocs=comm.Get_size()
print("hello from ",myid," of ",numprocs)
# Tag ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tkinter as tk
from tkinter import messagebox
win = tk.Tk()
win.title("Take Your Height")
win.geometry("500x300")
l=tk.Label(win,text="请输入你的身高(单位:cm):")
l.place(x=20,y=20)
t=tk.Entry(win)
t.place(x=20,y=50)
b=tk.Button(win,text="计算")
b.place(x=20,y=80)
def calc(... |
from lunespy.client.transactions import BaseTransaction
from lunespy.client.wallet import Account
class CancelLease(BaseTransaction):
def __init__(self, sender: Account, lease_tx_id: str = None,
timestamp: int = None, fee: int = None) -> None:
from lunespy.utils import drop_none
... |
# --------------------------------------------------------------------------------------------
# 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
# EPTOOLS Python Interface
# Unit tests: EP updates with Gaussian mixture potential
#
# TODO:
# - Create a single comparison function, which can be used to debug
# the updates under realistic conditions
import numpy as np
import apbsint as abt
# Helper functions
# 'x' must be a matrix. The ... |
from serif.theory.serif_theory import SerifTheory
class SerifEventMentionTheory(SerifTheory):
def mention_arguments(self):
"""Returns a list of just the Mention arguments in this EventMention"""
results = []
for arg in self.arguments:
if arg.mention != None:
... |
def get_checkpoint_resume(hparams):
resume_from_checkpoint = hparams.resume_from_checkpoint
if resume_from_checkpoint is None:
return None
if not hparams.debug:
if hparams.fold_i in resume_from_checkpoint:
return resume_from_checkpoint[hparams.fold_i]
else:
re... |
# #!/usr/bin/env python
#
# import nlopt # THIS IS NOT A PACKAGE!
# import numpy as np
#
# print(('nlopt version='+nlopt.__version__))
#
# def f(x, grad):
# F=x[0]
# L=x[1]
# E=x[2]
# I=x[3]
# D=F*L**3/(3.*E*I)
# return D
#
# n = 4
# opt = nlopt.opt(nlopt.LN_COBYLA, n)
# opt.set_min_objective(f)... |
from pprint import pprint
def check_bingo(matrix) -> bool:
"""
Check if any row or column is completely marked
Returns:
bool: True if any row or column is completely marked
"""
for i in range(len(matrix)):
if matrix[i][0] == matrix[i][1] == matrix[i][2] == matrix[i][3]... |
# Copyright 1996-2021 Cyberbotics 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 agreed to in... |
from wtforms import (
widgets,
StringField,
TextField,
TextAreaField,
PasswordField,
BooleanField,
ValidationError
)
class CKTextAreaWidget(widgets.TextArea):
def __call__(self, field, **kwargs):
kwargs.setdefault('class_', 'ckeditor')
return super(CKTextAreaWidget, self... |
from numpy import exp, array, random, dot
class NeuronLayer():
def __init__(self, number_of_neurons, number_of_inputs_per_neuron):
self.synaptic_weights = 2 * random.random((number_of_inputs_per_neuron, number_of_neurons)) - 1
class NeuralNetwork():
def __init__(self, layer1, layer2):
self.lay... |
"""Client for mypy daemon mode.
Highly experimental! Only supports UNIX-like systems.
This manages a daemon process which keeps useful state in memory
rather than having to read it back from disk on each run.
"""
import argparse
import json
import os
import signal
import socket
import sys
import time
from typing i... |
from sketching.datasets import Synthetic_Dataset
from sketching.utils import run_experiments
MIN_SIZE = 100
MAX_SIZE = 3000
STEP_SIZE = 100
NUM_RUNS = 21
dataset = Synthetic_Dataset(n_rows=100000)
run_experiments(
dataset=dataset,
min_size=MIN_SIZE,
max_size=MAX_SIZE,
step_size=STEP_SIZE,
num_run... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... |
import utils
from scrapers.base_scraper import BaseScraper
import json
import rfeed
from datetime import datetime
class FeedGenerator:
def __init__(self):
self.scrapers = dict()
def add_scraper(self, scraper_route, scraper: BaseScraper):
self.scrapers[scraper_route] = scraper
def create_... |
# -*- coding: utf-8 -*-
from transformers.opendata.default import DefaultTransformer
class FlotteursTransformer(DefaultTransformer):
MODEL = "Flotteur"
|
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from rapidsms.utils.modules import try_import
from .models import Location
def get_model(name):
"""
"""
for type in Location.subclasses():
if type._meta.module_name == name:
return type
raise StandardError("There is no Location... |
from provider import redfin
from database import postgreSQL
class HousingData(object):
"""
Get housing data and store them into database
Attributes:
name: A string representing the customer's name.
balance: A float tracking the current balance of the customer's account.
"""
def _... |
'''
Invert Image Colors
Copyright (c) 2020 Aditya Singh Tejas
'''
from tkinter import *
from tkinter import messagebox
from PIL import Image
import PIL.ImageOps
from os import path,listdir
from tkinter.ttk import Entry
def invert(input_dir, output_dir):
try:
for img in sorted(listdir(input_dir)):... |
STATUS_SCHEDULED = 0
STATUS_RUNNING = 1
STATUS_STOPPING = 2
STATUS_STOPPED = 3
STATUS_FAILED = 4
STATUS_SUCCEEDED = 5
STATUS_TIMEOUT = 6
STATUS_SCHEDULED_ERROR = 7
STATUS_DICT = {
STATUS_SCHEDULED: 'scheduled',
STATUS_RUNNING: 'running',
STATUS_STOPPING: 'stopping',
STATUS_STOPPED: 'stopped',
STATU... |
#!/usr/bin/env python
"""
Script to print worker tenants. It gets all tenants from metrics and prints
tenants which are not in "convergence-tenants" config. Takes chef otter.json
as argument
"""
from __future__ import print_function
import json
import os
import sys
import treq
from twisted.internet import task
fro... |
"""
Copyright 2013 Rackspace
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, software
dist... |
"""Methods for computing radar statistics.
These are usually spatial statistics based on values inside a storm object.
"""
import pickle
import numpy
import pandas
import scipy.stats
from gewittergefahr.gg_io import myrorss_and_mrms_io
from gewittergefahr.gg_io import gridrad_io
from gewittergefahr.gg_utils import st... |
from cc3d import CompuCellSetup
from .DeltaNotchSteppables import DeltaNotchClass
from .DeltaNotchSteppables import ExtraFields
def configure_simulation():
from cc3d.core.XMLUtils import ElementCC3D
cc3d = ElementCC3D("CompuCell3D")
potts = cc3d.ElementCC3D("Potts")
potts.ElementCC3D("Dimensions", {"... |
# Copyright 2013 Devsim 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, s... |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import argp... |
# noinspection PyUnresolvedReferences
import base64
# noinspection PyUnresolvedReferences
from quasargui.base import Component, LabeledComponent
from quasargui.quasar_components import QIcon
from quasargui.tools import merge_classes, build_props
from quasargui.typing import PropValueType, ClassesType, StylesType, Even... |
"""
Get unit profiles such as spike correlograms or burstiness
"""
from pyfinch.analysis.parameters import spk_corr_parm
from pyfinch.analysis.spike import BaselineInfo, BurstingInfo, Correlogram, MotifInfo
from pyfinch.database.load import ProjectLoader, DBInfo, create_db
import matplotlib.pyplot as plt
from pyfinch.... |
from PyObjCTools.TestSupport import *
from AppKit import *
class TestNSBox (TestCase):
def testConstants(self):
self.assertEqual(NSNoTitle, 0)
self.assertEqual(NSAboveTop, 1)
self.assertEqual(NSAtTop, 2)
self.assertEqual(NSBelowTop, 3)
self.assertEqual(NSAboveBottom, 4)
... |
import wx
from ..figure import Figure
class WorkspaceViewFigure(Figure):
def on_close(self, event):
"""Hide instead of close"""
if isinstance(event, wx.CloseEvent):
event.Veto()
self.Hide()
|
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import tensorflow as tensorflow
from resnet.data import svhn_input
from resnet.utils import logger
log = logger.get()
class SVHNDataset():
def __init__(self,
folde... |
# import themes from within the directory
from pyADVISE.Visualize.Themes.USAID_themes import USAID_style
def create_Div(div, text_type ='text'):
from bokeh.models import Div
# options for text: title, subtitle, text
if text_type == 'text':
a = '<p>\n' + div + '\n</p>\n'
... |
# Copyright 2017-present Open Networking Foundation
#
# 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 agr... |
from flask import (Blueprint, jsonify)
from flask_jwt_extended import jwt_required
from mal import Anime
from models.schemas import AnimeSchema
bp_anime = Blueprint(name="bp_anime", import_name=__name__)
class AnimeObj():
def __init__(self, mal_id, title, score, genres, duration, rating, image_url):
self... |
from pyomo.environ import *
def pyomo_create_model(options):
model = Model()
model.Locations = Set()
model.P = Param()
model.Customers = Set()
model.ValidIndices = Set(within=model.Locations*model.Customers)
model.d = Param(model.Locations, model.Customers, within=Reals)
model.x = V... |
from django.shortcuts import render
def handler500(request):
return render(request, '500.html', status=500) |
import discord
from discord.ext import commands
from checks import Checks
class Misc(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def ping(self, ctx):
await ctx.send('Pong!')
@commands.command()
async def pong(self, ctx):
await ctx.send... |
# -*- coding: utf-8 -*-
# @Author: luoling
# @Date: 2019-11-26 12:13:34
# @Last Modified by: luoling
# @Last Modified time: 2019-12-09 11:22:29
from .dfanet import DFANet
from .unet import UNet
from .danet import DANet
from .dabnet import DABNet
from .ce2p import CE2P
from .ehanet import EHANet18
from .parsenet18 ... |
from sequana import Quality
from sequana import phred
def test_quality():
q = Quality('ABC')
q.plot()
assert q.mean_quality == 33
q = phred.QualitySanger('ABC')
q = phred.QualitySolexa('ABC')
def test_ascii_to_quality():
assert phred.ascii_to_quality("!") == 0
assert phred.ascii_to_qual... |
from multimds import data_tools as dt
from multimds import compartment_analysis as ca
import numpy as np
from sklearn import svm
from multimds import linear_algebra as la
from mayavi import mlab
struct = dt.structure_from_file("hic_data/GM12878_combined_21_100kb_structure.tsv")
new_start = struct.chrom.getAbsoluteInd... |
# Generated by Django 2.2 on 2020-04-01 18:04
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='HighestQualification',
field... |
# D.1. python CODE
def bubbleSort(array):
n = len(array)
swapped = True
status = True
try:
while swapped == True:
swapped = False
for i in range(1, n):
if array[i - 1] > array[i]:
#swap(array[i-1], array[i])
tmp = ar... |
"""The tests for the Ring component."""
from datetime import timedelta
import homeassistant.components.ring as ring
from homeassistant.setup import async_setup_component
from tests.common import load_fixture
ATTRIBUTION = "Data provided by Ring.com"
VALID_CONFIG = {
"ring": {"username": "foo", "password": "bar"... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2021, Eduardo Rodrigues and Henry Schreiner.
#
# Distributed under the 3-clause BSD license, see accompanying file LICENSE
# or https://github.com/scikit-hep/decaylanguage for details.
import pytest
from pytest import approx
from decaylanguage.decay.decay import Daughters... |
lista = []
print(lista)
|
import js2py
code1='function f(x) {return x+x;}'
f=js2py.eval_js(code1)
print(f) |
from __future__ import absolute_import, division, print_function
import os.path as op
import numpy as np
import pandas as pd
import numpy.testing as npt
import evp001 as ev
data_path = op.join(sb.__path__[0], 'data')
# n/a |
# this script below walks through all subdirectories and will look for only tifs
# still need something to confirm or be a little more careful
# need to test that the script runs in a given dir as opposed to where the script lives
# need to figure out best way to tell it to run in a given dir, shebang or keyword arg?
... |
# Generated by Django 3.1.8 on 2021-04-11 04:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("core", "0074_location_preferred_contact_method"),
]
operations = [
migrations.AlterModelOptions(
name="callrequest",
... |
import sys
from itertools import combinations
import qiskit
import numpy as np
import tqix
sys.path.insert(1, '../')
import qtm.base
import qtm.nqubit
import qtm.fubini_study
def self_tensor(matrix, n):
product = matrix
for i in range(1, n):
product = np.kron(product, matrix)
return product
... |
from django.db import models
# Create your models here.
class products(models.Model):
pname=models.CharField(max_length=15)
pcost = models.DecimalField(max_digits=10, decimal_places=4)
quantity=models.IntegerField()
def __str__(self):
return self.pname
|
import os
from unittest import mock
import pytest
import castero.config
from castero.config import Config
from castero.episode import Episode
from castero.feed import Feed
from castero.player import Player, PlayerDependencyError
my_dir = os.path.dirname(os.path.realpath(__file__))
feed = Feed(file=my_dir + "/feeds/v... |
#!/usr/bin/env python
"""
_Couchapp_
This is a general unittest for me should I need to create and
test couchapps. Its utility is probably limited for people who
know what they're doing, and for couchapps that will never need
to be altered
"""
import os
import unittest
import threading
import WMCore.WMBase
from WM... |
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2021 Filipe Laíns <lains@riseup.net>
import os
import pathlib
import traceback
from typing import Dict
import build_system
import build_system.builder
import build_system.dependencies
import build_system.ninja
import configure
class OS... |
from src.utils.data_processing import *
from src.utils.helpers import *
|
import os
import glob
import psycopg2
import pandas as pd
from sql_queries import *
def process_song_file(cur, filepath):
"""
Process songs files and insert records into the Postgres database.
:param cur: cursor reference
:param filepath: complete file path for the file to load
"""
# open son... |
from grabscreen import grabscreen
import torch
import numpy as np
from grabkeys import key_check
from grabscreen import grabscreen
import cv2
import time
from directkeys import PressKey,ReleaseKey, W, A, S, D
import random
weights = np.array([1, 0.4, 0.5, 0.5, 0.5, 0.5, 1.5, 0.5, 0.2])
w = [1,0,0,0,0,0,0,0,0]
s = [... |
# Copyright (c) 2018 DDN. All rights reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
from collections import defaultdict
from chroma_api.utils import SeverityResource, DateSerializer
from django.contrib.contenttypes.models import ContentType
from chroma... |
from fbchat._group import Group
def test_group_from_graphql():
data = {
"name": "Group ABC",
"thread_key": {"thread_fbid": "11223344"},
"image": None,
"is_group_thread": True,
"all_participants": {
"nodes": [
{"messaging_actor": {"id": "1234"}},
... |
#!/bin/python
from deap import base
from copy import deepcopy
import random
import promoterz.supplement.age
import promoterz.supplement.PRoFIGA
import promoterz.supplement.phenotypicDivergence
# population as last positional argument, to blend with toolbox;
def immigrateHoF(HallOfFame, population):
if not Hall... |
#import cmip
import cmip_model
import bmi_cmip
import cmip_utils as cu
|
from ParadoxTrading.Chart import Wizard
from ParadoxTrading.Fetch.ChineseFutures import FetchDominantIndex
from ParadoxTrading.Indicator import FastVolatility
fetcher = FetchDominantIndex()
market = fetcher.fetchDayData('20100101', '20170101', 'rb')
fast_vol_1 = FastVolatility(30, _smooth=1).addMany(market).getAllDa... |
#!/usr/bin/env python
import asyncio
import websockets
import socket
def get_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
# doesn't even have to be reachable
s.connect(('10.255.255.255', 1))
IP = s.getsockname()[0]
except Exception:
IP = '127.0.0.1'
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/9/3 17:43
# @Author : CrissChan
# @Site : https://blog.csdn.net/crisschan
# @File : 4-2.py
# @Software: PyCharm
import requests
import json
print('--------post-param-------')
url_login = 'http://127.0.0.1:12356/login'
username='CrissChan'
password=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.