text stringlengths 3.07k 22.1k |
|---|
import razorpay
from django import views
from django.contrib.auth.models import User
from django.contrib.auth.views import redirect_to_login
from django.shortcuts import render, redirect
from django.views import View
from .models import Customer, Product, Cart, OrderPlaced
from .forms import CustomerRegistrationForm, C... |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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
... |
#!/usr/bin/env python
'''
MonkeyTest -- test your hard drive read-write speed in Python
A simplistic script to show that such system programming
tasks are possible and convenient to be solved in Python
The file is being created, then written with random data, randomly read
and deleted, so the script doesn't waste your... |
import socket
import binascii
import logging
import time
import threading
import queue
from .elmoprocessor import (
cmd_accesso_sistema, cmd_inserisci_settore,
cmd_disinserisci_settore,
cmd_lettura_settori_inseribili,
cmd_lettura_stato_ingressi,
rq_cmd,
recive,
parse_to_send,
read_stato_... |
import math
from decimal import Decimal, getcontext
from math import gcd
import numpy as np
ASTEROIDS = """.............#..#.#......##........#..#
.#...##....#........##.#......#......#.
..#.#.#...#...#...##.#...#.............
.....##.................#.....##..#.#.#
......##...#.##......#..#.......#......
......#........ |
# 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... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
"""
This part of the REST API joins the frontend dataset created by user with
convertors and connectors to various other parts of the WA-KAT backend, which
are used to fill missing data, and emit required output data.
"""
#
# Imports =... |
#!/usr/bin/env python2.7
from __future__ import print_function
import sys
import argparse
import os
import textwrap
import yaml
import cPickle
import uuid
from urlparse import urlparse
from functools import partial
from bd2k.util.humanize import human2bytes
from toil.common import Toil
from toil.job import Job
from... |
import pytest
from pathlib import Path
import numpy as np
from nnaps.mesa import extract_mesa, common_envelope, fileio
base_path = Path(__file__).parent
# by using scope='module', the predictor is created once and then used for all functions
# that need it in this test module.
@pytest.fixture(scope='module')
def d... |
import torch
from torch.utils.data import Dataset, DataLoader
from transformers import BertTokenizer,BertModel
import torch.nn as nn
import numpy as np
import pandas as pd
from torch import optim
from matplotlib import pyplot as plt
class BertDataset(Dataset):
def __init__(self, data_path, max_len=200)... |
# main imports
import sys, os
import argparse
import json
import numpy as np
import pandas as pd
import logging
# models imports
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Conv1D, MaxPooling1D
from keras.layers import Activation, Dropout, Flatt... |
from unittest import TestCase
import os.path as osp
import numpy as np
import scipy.signal as sps
from pylinac.core import image
from pylinac.core.profile import SingleProfile, MultiProfile, CircleProfile, CollapsedCircleProfile
class SingleProfileMixin:
ydata = np.ndarray
normalize_sides = True
fwxm_i... |
"""
Generic interchange document structures.
"""
STYLE_TYPE_INT = 'int'
STYLE_TYPE_FLOAT = 'float'
STYLE_TYPE_CDATA = 'cdata'
STYLE_TYPE_BOOLEAN = 'boolean'
STYLE_TYPES = (
STYLE_TYPE_INT,
STYLE_TYPE_FLOAT,
STYLE_TYPE_CDATA,
STYLE_TYPE_BOOLEAN
)
class Style(object):
def __init__(self, types):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
fsed.py
(c) <NAME> 12 December, 2015
Main module for the ``fsed`` command line utility.
'''
from __future__ import absolute_import, print_function, unicode_literals
from fsed.utils import open_file
import click
import fsed.ahocorasick
import logging
import re
import... |
import argparse
import torch
import json
import numpy as np
import random
import xml.etree.ElementTree as ET
from subprocess import check_output
from model import Model
import sys
from os import path
sys.path.append('..')
import common.util
np.random.seed(1337)
random.seed(1337)
torch.manual_seed(1337)
# torch.cud... |
#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#
import random
from typing import Any, MutableMapping
import pytest
from airbyte_cdk.models import SyncMode
from airbyte_cdk.sources.streams import Stream
from source_freshdesk.streams import (
Agents,
BusinessHours,
CannedResponseFolders,
Ca... |
from algorithms import *
class GameData:
def __init__(self,N):
self.Played_actions = []
self.Mixed_strategies = []
self.Incurred_losses = []
self.Regrets = []
self.Cum_losses = [()]*N
def Initialize_Players(N, OD_pairs, Strategy_vectors, min_tra... |
# Copyright 2015 <NAME>
#
# 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, softw... |
# -*- coding: utf-8 -*-
# Copyright 2019 ICON 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 o... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import time
from django.utils.text import slugify
from lgr.tools.annotate import annotate, lgr_set_annotate
from lgr.tools.compare import union_lgrs, intersect_lgrs, diff_lgrs, diff_lgr_sets
from lgr.tools.cross_script_variants import cro... |
#!/usr/bin/env python
import yaml
import os
import re
import time
import pandas as pd
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from bs4 import BeautifulSoup
from dateutil.relativedelta import relativedelta
from datetime import date, datetime... |
# -*- coding: utf-8 -*-
"""
Kalman class using opencv implementation
"""
import cv2 as cv
import numpy as np
from scipy.optimize import linear_sum_assignment
from xmot.mot.utils import cen2cor, cor2cen, costCalc, unionBlob, iom
class Blob:
"""
Abstraction of identified particles in video, (i.e. unqiue particl... |
#! /usr/bin/env python
###################################################################################
###
### Title: rdams-client.py
### Author: <NAME>, <EMAIL>
### Date: 10/24/2013
### Purpose: List dataset metadata, subset data subset requests, check on request
### status.
###
### SVN ... |
import re
from collections import defaultdict
from itertools import combinations, product
from loguru import logger
from rdkit.Chem import AllChem, ReplaceCore, GetMolFrags, ReplaceSubstructs, CombineMols
from substituent_replacement.models.library import ReplacementLibrary, ReplacementMap
from substituent_replaceme... |
import random
import uuid
import numpy as np
from termcolor import colored
import time
import sys
import json
import os
import argparse
from datetime import datetime
import carla
from gym_carla.envs.carla_env import CarlaEnv
from lbc_agent.noisy_agent import NoisyAgent
WEATHER_MORNING = [20.0, 90.0, 30.0, 30.0, 0.0... |
import pandas as pd
import pandas.api.types as types
from Levenshtein.StringMatcher import distance
""" Find and replace """
def find_replace(dataframe: pd.DataFrame, column_name: str, to_replace, value) -> pd.DataFrame:
dataframe[column_name].replace(to_replace, value, inplace=True)
return dataframe
de... |
import torchvision.transforms as T
import torchvision.transforms.functional as F
from PIL import Image
import numpy as np
import cv2
import time
import os
import matplotlib.pylab as plt
import random
import math
class MyAugmentation():
'''
frame:a PIL img
label:a numpy array
'''
def __init... |
# 要添加一个新单元,输入 '# %%'
# 要添加一个新的标记单元,输入 '# %% [markdown]'
# %%
from pickle import FALSE
from input_data import DataSets
import input_data
import matplotlib.pyplot as plt
import numpy as np
from net import ResNet_BN as ResNet
# from resnet import resnet20 as ResNet
import torchvision
from torchvision import transforms
imp... |
import re
from clang.cindex import CursorKind
from util import trim
semicolon = ';'
open_paren = '('
close_paren = ')'
const_token = 'const'
open_brace = '{'
close_brace = '}'
open_bracket = '<'
close_bracket = '>'
comma = ','
brackets = [open_paren, close_paren, open_brace, close_brace]
def get_tokens(tu, cursor):... |
#!/usr/bin/env python
# Note: rsync must be invoked with -I argument, as it is possible for
# files in different branches to have identical size, and if the filesystem
# is quick enough the files in different branches may have identical timestamp.
import shutil
import re
import optparse
import subprocess
import os.pa... |
import glob
import logging
import os
import sys
import pkg_resources
import fitz
import qtawesome as qta
from PyQt5 import QtWidgets, QtGui
from PyQt5 import uic, QtCore
from PyQt5.QtGui import QPixmap, QImage, QColor, QPalette
from PyQt5.QtWidgets import QFileDialog, QApplication
from PyQt5.Qt import Qt
from godr.fr... |
import datetime as dt
import numpy as np
import pandas as pd
import pytest
from .. import cycles
from ..cycles import (
PeriodicCycleMiner,
SingleEventCycleMiner,
_generate_candidates_batch,
_recover_splits_rec,
compute_cycles_dyn,
cycle_length,
evaluate,
extract_triples,
generate_... |
# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Modifications made by Cloudera are:
# Copyright (c) 2016 Cloudera, 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. A cop... |
import numpy as np
import scipy.sparse as sparse
from time import time
from utilities import calc_h_hexa, update
def iterate(k, j, t, wall_time, hexagon_mf_operators,
ts, Ma, uab_term, u_term, v_term, mu_term, t_term, var_terms,
dig_h, Pr, Psi_s, Ns, Nsquare_s, EVals, EVecs, err):
t_begin... |
from sklearn import datasets
import numpy as np
import tensorflow as tf
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import os
import csv
import pandas as pd
def rho_calculation(copy_model, X_train, y_train,d):
y_pred_ohe = copy_model.predict(X_train)
y_train_ohe=tf.one_... |
import tensorflow as tf
from ops import *
def clip_tensor(tens):
return tens
tf.print(tens)
mask = tf.equal(tens, 1e-42 * tf.ones_like(tens))
new_tensor = tf.multiply(tens, tf.cast(mask, 'float32'))
return new_tensor
#return tf.clip_by_value(tens,1e-10,1)
def CAN_loss(model):
#builds opti... |
"""Provide a (semi) automated mapping between GenBank and ontologies.
The goal is to provide an ontology namespace and term for each item
of a standard GenBank file.
"""
from __future__ import with_statement
import os
import collections
import csv
from rdflib.Graph import Graph
#from Mgh.SemanticLiterature import spa... |
from AgentRun import *
from AgentNet import *
from AgentZoo import *
""" ISAC
Auto TTUR
Adaptive lambda
"""
class AgentInterSAC4(AgentBasicAC): # Integrated Soft Actor-Critic Methods
def __init__(self, state_dim, action_dim, net_dim):
super(AgentBasicAC, self).__init__()
self.learning_rate = 1e-... |
#!/usr/bin/env python
# zmqc: a small but powerful command-line interface to ZMQ.
## Usage:
# zmqc [-0] [-r | -w] (-b | -c) SOCK_TYPE [-o SOCK_OPT=VALUE...] address [address ...]
## Examples:
# zmqc -rc SUB 'tcp://127.0.0.1:5000'
#
# Subscribe to 'tcp://127.0.0.1:5000', reading messages from it and printing
# the... |
"""
Description: Contains functions on APIs and turning that into candlestick data.
Fully Implemented: Cryptowatch, Poloniex, CoinAPI
"""
import requests
from cryptolytic.util import date
import time
import os
import requests
import json
import datetime
import numpy as np
import pandas as pd
# Json conversion... |
# -*- coding: utf-8 -*-
"""
"""
# Mandatory imports
import json
import os
import sys
import getopt
import re
import platform
from tabulate import tabulate
from crontab import CronTab
from datetime import datetime, timedelta
# Relative imports
from ..version import version as __version__
from ..jobber import Job, Queu... |
# ----------------------------------------------------------------------------
# MODES: serial parallel
# CLASSES: nightly
#
# Test Case: flatten.py
#
# Tests: Tests CLI Flatten() function
# (which is avtFlattenQuery underneath)
#
# Programmer: <NAME>
# Date: Fri Feb 4 17:07:24 EST 2022
... |
"""
2020-10-09 MY
Printing plots of forecasts from JRC, Satotilasto and EO predictions.
RUN:
python forecasting.py -i /Users/myliheik/Documents/myCROPYIELD/cropyieldMosaics/results/test1320 -y 2018 -n
python forecasting.py -i /Users/myliheik/Documents/myCROPYIELD/cropyieldMosaics/results/test1320 -y 2018 -n -r -f
#... |
from tkinter import *
from time import strftime
import sounddevice as sd
import soundfile as sf
import time
filename = 'data/bell.wav'
data, fs = sf.read(filename, dtype='float32')
syncfile = 'data/sync.wav'
sdata, sfs = sf.read(syncfile, dtype='float32')
def toggle():
global bell_trigger
if ... |
# Adapted by RJH June 2018 from fork of https://github.com/lscsoft/webhook-queue (Public Domain / unlicense.org)
# The main change was to add some vetting of the json payload before allowing the job to be queued.
# Updated Sept 2018 to add callback service
# TODO: We don't currently have any way to clear the faile... |
#!/usr/bin/env python
# Filename: data_figures.py
"""
introduction: to plot figures
authors: <NAME>
email:<EMAIL>
add time: 16 February, 2021
"""
import os,sys
code_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
sys.path.insert(0, code_dir)
import basic_src.io_function as io_function
import ... |
from os.path import join
import numpy as np
from rastervision.common.utils import (
load_img, get_img_size, _makedirs,
save_numpy_array)
from rastervision.common.settings import (
TRAIN, VALIDATION, TEST
)
from rastervision.semseg.data.isprs import (
IsprsDataset, IsprsBatch, IsprsFileGenerator)
VAI... |
# pylint:disable=missing-class-docstring,unused-argument
from collections import defaultdict
from typing import Optional, Any, Dict, TYPE_CHECKING
import ailment
from ailment import Expression, Block
from ailment.statement import Statement, Assignment, Call
from ..ailblock_walker import AILBlockWalker
from ..sequence... |
#!/usr/bin/env python
# coding=utf-8
"""
demodocus is Python CLI program to quickly check synchronization maps.
This is the main demodocus script, intended to be run from command line.
"""
from __future__ import absolute_import
from io import open
import argparse
import json
import os
import pyaudio
import re
import... |
'''
models.py
=========
Basic objects used for communication bodies with a servlet container.
'''
import logging
import struct
from . import AJP4PY_LOGGER
from .ajp_types import (AjpAttribute, AjpHeader, AjpPacketHeadersFromContainer,
AjpPacketHeadersToContainer, AjpSendHeaders, header_case)
... |
# Copyright 2018, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 1 22:01:56 2018
@author: yiyuezhuo
"""
import cifar10.models.resnet as resnet
import torch
import torch.nn as nn
import torchvision
from torchvision import transforms
import numpy as np
import h5py
net = resnet.ResNet56()
model_file = r'cifar10\trained_nets\resnet56... |
import tkinter
from tkinter import ttk
import tkinter.messagebox
import subprocess
from threading import Thread
import os, glob
import time
import json
import requests
import re
class LabelEntry(tkinter.Frame):
def __init__(self, label, var, validatetype = 'float', *args, **kwargs):
tkinter.Frame.__init__(... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018-2019 <NAME>.
# All rights reserved.
#
# Copyright (c) 2018-2020 <NAME> <<EMAIL>>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are me... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# imports.
from ssht00ls.classes.config import *
from ssht00ls.classes import utils
from ssht00ls.classes import agent, keys, aliases, ssh, smartcards, ssync, smb
# the client object class.
class Client(object):
def __init__(self,
# the alias (required) (param #1).
... |
import json
from osbot_utils.decorators.methods.cache_on_self import cache_on_self
from osbot_aws.apis.Logs import Logs
from osbot_utils.decorators.lists.index_by import index_by
from osbot_utils.decorators.methods.cache import cache
from osbot_utils.decorators.methods.catch import catch
from osbot_utils.decorators.m... |
import paho.mqtt.client as mqtt
import time, signal, subprocess, http.client, urllib, re, json
import traceback, os
#from functools import partial
from daemon import Daemon
from dataclasses import dataclass
from dataclasses_json import dataclass_json
from enum import Enum
from typing import *
from multitimer import Mul... |
import os
import sys
import json
import time
import socket
import select
import logging
import threading
from twisted.internet import reactor
from twisted.internet.endpoints import UNIXServerEndpoint as ServerEndpoint
import path
import connection
import instance
__all__ = ('path', 'connection', 'instance',
'... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.1
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# # Frozen-MLP cau... |
import pandas as pd
import json
from tqdm.notebook import tqdm
from itertools import product
import os
import numpy as np
import pickle as pkl
from gym import spaces
from scipy.optimize import minimize
from tqdm import tnrange
import sys
from RLMultilayer.utils import visualize_progress, summarize_res, combine_tracke... |
#! /usr/bin/env python
import os
import sys
import fileinput
import argparse
try:
# For Python 3.0 and later
from urllib.request import urlopen
except ImportError:
# Fall back to Python 2's urllib2
from urllib2 import urlopen
import re
import json
from genie import process_functions as process
# global... |
#!/usr/bin/env python
#
# almahelpers.py
#
# History:
# v1.0 (scorder, gmoellen, jkern; 2012Apr26) == initial version
#
# This script defines a function that takes the Caltable you wish
# to apply to a MeasurementSet and generates a "apply-cal-ready"
# spwmap that provides the appropriate information regarding
# the t... |
import datetime
import time
import uuid
from decorator import *
from django.db import models, connection, transaction
from app_user.models import *
tz = pytz.timezone('Asia/Shanghai')
# id
# 会议名称
# 会议logo
# 会议时间 开始,结束
# 报名时间
# 举办地点 one
# 主办单位 many
# 协办单位 many
# 会议内容
# 与会人员 - id
class Meeting(models.Model):
... |
import torch
import torchvision
import torchvision.transforms as transforms
from torchvision.utils import save_image
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import os
import glob
import PIL
from PIL import Image
from torch.utils import data as D
from torch.ut... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of my-weather-indicator
#
# Copyright (c) 2012 <NAME> <a.k.a. atareao>
#
# 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 w... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
ThreeDiCustomStats
A QGIS plugin
This plugin calculates statistics of 3Di results. The user chooses the variable, aggregation method and spatiotemperal filtering.
Generated by Plu... |
import argparse
import json
import logging
from kgextractiontoolbox.backend.database import Session
from kgextractiontoolbox.backend.models import Document, Tag
from kgextractiontoolbox.document.document import TaggedDocument, TaggedEntity
CONTENT_BUFFER_SIZE = 10000
TAG_BUFFER_SIZE = 100000
def export(out_fn, expo... |
import bpy
from bpy.props import StringProperty, IntProperty, CollectionProperty, EnumProperty, BoolProperty
from bpy.types import PropertyGroup, UIList, Operator, Panel
from ..rfb_logger import rfb_log
from .rman_ui_base import _RManPanelHeader
from .rman_ui_base import CollectionPanel
from .rman_ui_base import PRManB... |
from uds import createUdsConnection
from struct import pack, unpack
import hashlib
from time import sleep, time
class ihexData(object):
def __init__(self):
self.__startAddress = 0
self.__size = 0
self.__data = []
@property
def startAddress(self):
return self.__startAddre... |
#!/usr/bin/env python
# coding: utf-8
# Python TOV solver
# <NAME>: Date 05/11/2020
''' Information about the code:
This code solves TOV equations for mass radius relations. This also can plot the mass radius curve.
USE: To use the code, here are the steps:
1) Include the file in your main code e.g. import tov_class ... |
import numpy as np
import os,sys,inspect
import tensorflow as tf
import time
from datetime import datetime
import re
import hickle as hkl
import os.path as osp
from glob import glob
import sklearn.metrics as metrics
from input import Dataset
import globals as g_
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
currentd... |
import PySimpleGUI as sg
import serial
import sys
import glob
ser = None #Global tanımlanmalı
def serial_ports():
if sys.platform.startswith('win'):
ports = ['COM%s' % (i + 1) for i in range(32)] # Hız için 256'dan 32'e düşürüldü.
elif sys.platform.startswith('linux') or sys.platform.start... |
"""Test polygon .contains and .overlaps methods
py.test -k polygon --cov-report term-missing --cov visual/helpers.py
"""
from __future__ import division
from builtins import range
from past.utils import old_div
from psychopy import visual, monitors
from psychopy.visual import helpers
from numpy import sqrt, array
imp... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
#
# 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/LICENS... |
import numpy as np
import time
import gym
import queue
import ray
from ray.rllib.agents.ppo.ppo_tf_policy import PPOTFPolicy
from ray.rllib.evaluation.worker_set import WorkerSet
from ray.rllib.evaluation.rollout_worker import RolloutWorker
from ray.rllib.execution.common import STEPS_SAMPLED_COUNTER, \
STEPS_TRAI... |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 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 node responses to invalid network messages."""
import asyncio
import struct
import sys
from test_... |
# Copyright (c) 2013, Epoch and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from __future__ import division
from pydoc import doc
import frappe
from frappe import _, msgprint
from frappe.utils import flt, getdate, comma_and
from collections import defaultdict
... |
#!/usr/bin/env python3
# Copyright 2020 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
#
# Unl... |
#!/usr/bin/env python
# Copyright (c) 2002-2007 ActiveState Software Inc.
import collections.abc as cabc
import getopt
# 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, i... |
# 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 -*-
from ..logger import logger
logger.debug("Started 'reading app/script_editor.py'")
from qtpy import QtGui, QtCore, QtWidgets, uic
import os
from .. import global_vars as g
from .syntax import PythonHighlighter
from ..utils.misc import save_file_gui, open_file_gui, load_ui
MESSAGE_TIME = 2000
t... |
# -*- coding: utf-8 -*-
# !/usr/bin/env python2
import sys
import os
import pandas as pd
import signal
# import talib
from logbook import Logger
from catalyst import run_algorithm
from catalyst.api import (
symbol,
record,
order,
order_target,
order_target_percent,
get_open_orders
)
from cata... |
"""
Mask R-CNN
Train on the toy Balloon dataset and implement color splash effect.
Copyright (c) 2018 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Written by <NAME>
------------------------------------------------------------
Usage: import the module (see Jupyter notebooks for examples),... |
'''
Created on Feb 11, 2015
@author: derigible
'''
from collections import OrderedDict as od
import templater.loader as disc
reserved_words = ("parent", "foot")
approved_block_types = ("inherit", "keepnested")
'''Tag type'''
TAG_TYPE = 0
'''Tag name'''
TAG_NAME = 1
'''Block reference'''
BLOCK_REF = 2
'''Block Le... |
"""
This is the Scrapy engine which controls the Scheduler, Downloader and Spiders.
For more information see docs/topics/architecture.rst
"""
import warnings
from time import time
from twisted.internet import defer
from twisted.python.failure import Failure
from scrapy import log, signals
from scrapy.core.downloade... |
import os, ctypes
from ctypes import c_int, c_uint, c_bool, c_float, c_char, c_char_p, POINTER, byref
class Error(Exception):
pass
# open dll
sPath = os.path.dirname(os.path.abspath(__file__))
_lib = ctypes.CDLL(os.path.join(sPath, 'DLL_win64', 'vnx_fmsynth'))
# define data types used by this dll
DEVID = c_uint
... |
from rest_framework import viewsets
from . import models
from . import serializers
from . import views_tools
import string
import os
from rest_framework.response import Response
from rest_framework.decorators import action
from .lib2.zone_operate import Zone
from django.conf import settings
class ViewVies(views_tools... |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 28 18:29:19 2016
@author: rochus
Fragmentizer class
depends on graph addon (this means graph_tool must be installed)
MPI-safe version .. Warning: use prnt function which is overloaded
RS (May 2020, corona times)
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import attr
from datetime import datetime, timedelta
from pymongo_mate.crud.insert import smart_insert
from crawlib.spider.selenium_spider import ChromeSpider
from crawlib import exc, Status
from pytq import StatusFlagScheduler
try:
from .config import Con... |
# 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, ... |
# coding: utf-8
import time
import random
import os
import json
import re
import sys
sys.path.append(os.getcwd() + "/class/core")
import mw
app_debug = False
if mw.isAppleSystem():
app_debug = True
def getPluginName():
return 'rsyncd'
def getInitDTpl():
path = getPluginDir() + "... |
from babel.core import Locale
from babel.numbers import format_decimal, LC_NUMERIC
class UnknownUnitError(ValueError):
def __init__(self, unit, locale):
ValueError.__init__(self, "%s is not a known unit in %s" % (unit, locale))
def get_unit_name(measurement_unit, length='long', locale=LC_NUMERIC):
"... |
"""
Transform particles from local frame to global frame
"""
import argparse
import errno
import math
import multiprocessing
import os
import h5py
import numpy as np
from joblib import Parallel, delayed
# give some PIC simulation parameters here
lx_pic = 250.0 # in electron inertial length
ly_pic = 25.0
lz_pic = 125... |
import re
from dataclasses import dataclass
from collections import OrderedDict
from typing import ClassVar, Optional, TextIO
from modlunky2.levels.utils import (
DirectivePrefixes,
split_comment,
to_line,
format_comment,
)
VALID_TILE_CODES = set(
[
"alien",
"adjacent_floor",
... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from beta_rec.models.torch_engine import ModelEngine
def get_ii_constraint_mat(train_mat, num_neighbors, ii_diagonal_zero=False):
print("Computing \\Omega for the item-item graph... ")
A = train_mat.T.dot(train_mat) # I * ... |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import stat
import zipfile
import pytest
from pex.common import temporary_dir
from pex.compatibility import WINDOWS, nested
from pex.pex import PEX
from pex.pex_builder import ... |
from __future__ import unicode_literals
import json
import uuid as uuid
from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator, MinValueValidator
from django.db import models
from django.db.models import Avg
from django.utils import timezone
from app import utils
from us... |
# -*- coding: utf-8 -*-
"""
pyspecific.py
~~~~~~~~~~~~~
Sphinx extension with Python doc-specific markup.
:copyright: 2008-2014 by <NAME>.
:license: Python license.
"""
ISSUE_URI = 'https://bugs.python.org/issue%s'
SOURCE_URI = 'https://hg.python.org/cpython/file/default/%s'
from docutils import... |
# @Author : guopeiming
# @Contact : <EMAIL>, 163}.com
import os
import sys
import time
import torch
import random
import argparse
import numpy as np
from config import Constants
from utils.optim import Optim
from config.config import MyConf
from utils.bert_utils import load_data
from utils.visualLogger import VisualLog... |
#
# Copyright (c) 2021, NVIDIA 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 law or agreed ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.