text stringlengths 957 885k |
|---|
# Copyright 2016 Quora, 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, so... |
def generateXaxis():
"""Creates a list for the x axis of 1-10
Returns:
LIST: Contains range from 1 - 10
"""
x_axis = [i for i in range(1, 11)]
return x_axis
def generateYaxis():
"""Creates a list for the y axis of the letters A-J
Returns:
LIST: Contains range from A-J
... |
from allennlp.predictors.predictor import Predictor
import os
import sys
from sayhello import app
from nltk.stem.wordnet import WordNetLemmatizer
from sayhello.commonDataProcess import CommonDatabase
class OpenInfoPredictor:
def __init__(self):
# self.source_tgz = os.path.dirname(app.root_path) + "/sayhel... |
<gh_stars>1-10
#!/usr/bin/env python
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
import os
from ansible.module_utils.basic import AnsibleModule, json
from ansible.module_utils.viptela import viptelaModule, viptela_argument_spec
def run_module():
... |
from __future__ import annotations
from typing import Set
from collections import defaultdict
from heapq import heapify, heappop, heappush
import os
'''
coarse matrix
0, 0, 0, 0, 0, 1, 1, 1, 0, 1,
0, 0, 1, 0, 0, 0, 1, 1, 0, 0,
0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0... |
# coding: utf-8
import pprint
import re
import six
class ResizeInstanceReq:
"""
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 value ... |
from typing import Any, Dict, Optional, Tuple, Text, List
import pytest
from rasa.nlu.tokenizers.tokenizer import Token
from rasa.nlu.constants import TOKENS_NAMES
from rasa.shared.nlu.constants import (
TEXT,
INTENT,
RESPONSE,
INTENT_RESPONSE_KEY,
ACTION_TEXT,
ACTION_NAME,
)
from rasa.shared.n... |
<reponame>Coding618/Django_base
from django.http import HttpResponse
from django.shortcuts import render
from book.models import BookInfo
# Create your views here.
def index(request):
book = BookInfo.objects.all()
print(book)
return HttpResponse('index')
######### insert 数据 ################
from book.mo... |
<gh_stars>0
"""
Database connection.
Functions to insert, update and select data.
Needs config setted at authenticate.py file. Exemple present in authenticate.example.py
WRITE OPERATIONS: insert_user, insert_tweet, update_tweet, update_tweet_text_after, auto_update_tweet, update_user
READ OPERATIONS: tweet_list,... |
# Title: Utilities for talking to a Corelatus GTH from python
# Author: <NAME> (<EMAIL>)
#
import sys
from sys import stderr
from transport import API_socket
import socket
class API:
def __init__(self, gth_ip_or_hostname, verbosity=0):
"""
verbosity=0: keep mostly quiet
verbosity=1: print event counts
verbos... |
"""
Website tester utility for magna.
"""
import httpx
# API_URL is the online service of the api
# Update this with your own.
# [REMOVE TRAILING SLASH]
API_URL = "https://magna-sc.cf"
# set of sample website links to request
# if the api returns OK
sample_requests = {
"manganelo": {
"manga": "https://... |
<filename>parental-control.py
# NOTE: This file should be copied to /etc/parental-control directory
import sys
import datetime
import subprocess
import os
COL_USER = 0
COL_FUNC = 1
COL_WKDY = 2
COL_SU = COL_WKDY
COL_MO = COL_SU + 1
COL_TU = COL_SU + 2
COL_WE = COL_SU + 3
COL_TH = COL_SU + 4
COL_FR = COL_SU + 5
COL_SA... |
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
import numpy as np
import numba
_mock_identity = np.eye(2, dtype=np.float32)
_mock_ones = np.ones(2, dtype=np.float32)
@numba.njit(fastmath=True)
def euclidean(x, y):
r"""Standard euclidean distance.
.. math::
D(x, y) = \\sqrt{\sum_i (x_i - y_i)^2... |
#!/usr/bin/env python3
#
## @file
# list_repos_command.py
#
# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
import collections
import os
#from git import Repo
from colorama import Fore, Style
# Our modules
from edkrepo.commands... |
<gh_stars>0
# system
import math
from collections import namedtuple, Counter
from functools import reduce
from pprint import pprint
from typing import List, Dict, Tuple
# internal
from .day import Day
"""
===============================================================================
Day 3 Puzzle 1
The gravity assis... |
<reponame>CardinalNumberFromReddit/robinhood_trailingstop<gh_stars>0
#!/usr/bin/python
# trailing_stop.py
# Install python package:
# > pip install https://github.com/swgr424/Robinhood/archive/master.zip
# swgr424 includes a PR for gathering quotes for multiple symbols at once
# Wait...
from Robinhood import Robinho... |
<gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
import datetime as DT
import subprocess
import sys
from netmiko import ConnectHandler
keyfile = "vmanage"
logfile = "backupjob.log"
backup_path = "./backupdata"
login_info = {
"device_type": "linux",
"host": "10.75.58.50",
"username": "admin",
"u... |
<reponame>alan-turing-institute/pcit
import matplotlib.pyplot as plt
n_list = np.round(np.exp(list(np.arange(6,10,0.1)))).astype(int)
size_mat = 10
B = 10
def get_conf_ints(series, sd):
sd[sd == 0] = 0.01
low = series - 1.64 * sd
high = series + 1.64 * sd
low[low <= 0] = 0
high[high >= 1] = 1
... |
# Copyright 2019 <NAME> <<EMAIL>>
#
# 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 wri... |
<filename>ethosu/vela/tflite_mapping.py<gh_stars>1-10
# Copyright (C) 2020 Arm Limited or its affiliates. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# 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 c... |
# -*- coding: utf-8 -*-
r"""
Ambient spaces of modular symbols
This module defines the following classes. There is an abstract base
class ``ModularSymbolsAmbient``, derived from
``space.ModularSymbolsSpace`` and ``hecke.AmbientHeckeModule``. As
this is an abstract base class, only derived classes should be
instantia... |
<reponame>marcreyesph/tf-selfpacedtuts
from skimage import data
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import os
# Minimize console warnings by tensorflow
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
sess = tf.InteractiveSession()
img_dataset = [os.path.join('celeba_dataset_... |
<gh_stars>0
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
# GN version: //ios/web/public/app
'target_name': 'ios_web_app'... |
<filename>tests/test_queries.py
# coding: utf-8
# Copyright 2010 <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 ... |
<reponame>jyshangguan/visfitter<filename>VisFitter/mcmc_emcee.py<gh_stars>0
import acor
import emcee
import corner
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
from scipy.stats import truncnorm
from time import time
PI2 = 2. * np.pi
__all__ = ["EmceeModel"]
#The probabi... |
# -*- coding: utf-8 -*-
import sys
import os
from decimal import Decimal
import unittest
import magento
from mock import patch, MagicMock
import trytond.tests.test_tryton
from trytond.tests.test_tryton import POOL, USER, DB_NAME, CONTEXT
from test_base import TestBase, load_json
from trytond.transaction import Transa... |
<gh_stars>10-100
#!/usr/bin/env python
#
# Copyright 2014 <NAME>
#
# gnTEAM, School of Computer Science, University of Manchester.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU General Public License.
#
# author: <NAME>
# email: <EMAIL>
#... |
<gh_stars>1-10
# Lint as: python2, python3
# Copyright 2017 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... |
<reponame>Abdullah0297445/Django-Projects<filename>Miniature Hospital Management System/hospital_app/views.py
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.models import User
from .models import Patient, DiagReport
from django.urls import reverse
from django.views.generic import Li... |
#!/usr/bin/env python
import datetime
import os
import click
import numpy as np
from mpi4py import MPI
from epg.launching import launcher, logger
from epg.envs.random_robots import RandomHopper, DirHopper, NormalHopper
from epg.evolution import ES
"""
Evolved Policy Gradients (EPG)
------------------------------
Ru... |
# -*- coding: utf-8 -*-
"""
unit test for loop functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: 2007 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
from py.test import raises
from jinja2.exceptions import UndefinedError, TemplateSyntaxError
SIMPLE = '''{% for item in seq %}{{ item }}{%... |
<filename>loader.py
import os
import json
import logging
from launcher import *
class Loader(object):
def __init__(self, dconn):
self.launchers = {}
self.home_root = '/home'
self.dconn = dconn
def get_launcher(self, launcher_name, user = None):
if launcher_name not in self.... |
# coding=utf-8
# Copyright 2018 The TF-Agents 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... |
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Layer
class MaskedDense(Layer):
"""
Masked fully connected layer. For full documentation of the fully-connected architecture, see the
TensorFlow Keras Dense layer documentation.
This layer implements masking consistent wit... |
import pytest
import sunpy.net.dataretriever.sources.eve as eve
from sunpy.net import Fido
from sunpy.net import attrs as a
from sunpy.net._attrs import Instrument, Level, Time
from sunpy.net.vso.attrs import Source
from sunpy.net.dataretriever.client import QueryResponse
from sunpy.net.fido_factory import UnifiedResp... |
<reponame>freelan-developers/plix
"""
Test the configuration parser.
"""
from __future__ import print_function
from unittest import TestCase
from contextlib import contextmanager
from voluptuous import (
MultipleInvalid,
)
from six import StringIO
from mock import (
patch,
MagicMock,
)
import plix.confi... |
from copy import copy
__author__ = 'Anthony'
import numpy as np
import cv2
import cv
from scipy.cluster.hierarchy import fclusterdata
from scipy.spatial.distance import pdist, squareform
from hungarian import linear_assignment
show_sub_img = False
show_raw_img = False
show_cluster_img = True
show_kalman_img = True
su... |
<reponame>co2palm/antivirus_demo
#!/usr/bin/env python2
import argparse
import pickle
import requests
import sys
import os
from sklearn.externals import joblib
MACHINE_TYPES = {
"IMAGE_FILE_MACHINE_UNKNOWN": 0,
"IMAGE_FILE_MACHINE_I386": 0x014c,
"IMAGE_FILE_MACHINE_R3000": 0x0162,
"IMAGE_FILE_MACHINE_R... |
# Time: O(n^2 * l^2), n is the number of strings
# Space: O(1) , l is the max length of strings
class Solution:
def stringMatching(self, words: List[str]) -> List[str]:
result = []
for i, pattern in enumerate(words):
for j, text in enumerate(words):
if i != j an... |
<filename>Neural Network for Regression.py
"""
@author: <NAME>
"""
# importing all the required libraries
import numpy as np
import matplotlib .pyplot as plt
# function to initialize parameters to be uniformly distributed random numbers
# between 0.0 and 1.0
def randInitializeWeights(L_in, L_out):
... |
# Borrowed for PyTorch repo
# This script outputs relevant system environment info
# Run it with `python collect_env.py`.
import re
import subprocess
import sys
from collections import namedtuple
from setup import NeodroidPackage
import neodroid
PY3 = sys.version_info >= (3, 0)
# System Environment Information
Syst... |
<filename>web/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py<gh_stars>1-10
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP SA (<http://openerp.com>). All Rights Res... |
<reponame>HelloAllen8893/AliOS-Things<filename>build/site_scons/scons_upload.py
import os, json
import subprocess
import sys
import platform
import serial
from serial.tools import miniterm
from serial.tools.list_ports import comports
from scons_util import *
# Global variables
PORT = None
# Functions
def _run_upload_... |
<filename>python/StateRepresentation.py
#!/usr/bin/env python
"""Uses tilecoding to create state.
"""
import numpy as np
from tiles import *
import time
# image tiles
NUM_RANDOM_POINTS = 100
CHANNELS = 4
NUM_IMAGE_TILINGS = 4
NUM_IMAGE_INTERVALS = 4
SCALE_RGB = NUM_IMAGE_INTERVALS / 256.0
IMAGE_START_INDEX = 0
# c... |
# BSD Licence
# Copyright (c) 2009, Science & Technology Facilities Council (STFC)
# All rights reserved.
#
# See the LICENSE file in the source distribution of this software for
# the full license text.
"""
An implementation of model.WebMapService drived from a single CDMS
file, potentially a CDML aggregation file.
"... |
<gh_stars>1-10
# reference ==> https://www.shadertoy.com/view/WtScDt#
import taichi as ti
ti.init(arch = ti.cuda)
res_x = 800
res_y = 450
pixels = ti.Vector.field(3, ti.f32, shape=(res_x, res_y))
cos_record = ti.Vector.field(3, ti.f32)
ti.root.dense(ti.i, 16).dense(ti.jk, (res_x,res_y)).place(cos_record) #... |
from django.contrib.auth import get_user_model
from django.contrib.auth.views import LoginView
from django.test import TestCase, Client
from django.urls import reverse
from posts.models import Post
class GeneralTestCase(TestCase):
def setUp(self):
self.client = Client()
User = get_user_model()
... |
'''
Created on 28 Feb 2018
@author: lbtanh
'''
from __future__ import division
import face_recognition
import cv2
import os
import time
import datetime
import pickle
# import pp
import sys
from PIL import Image, ImageEnhance
import numpy as np
from py2neo.packages.neo4j.v1.packstream import LIST_16
... |
from abc import ABC, abstractmethod
import numpy as np
class Intrinsics(ABC):
@property
@abstractmethod
def f_x(self) -> np.float32:
pass
@property
@abstractmethod
def f_y(self) -> np.float32:
pass
@property
@abstractmethod
def c_x(self) -> np.float32:
pa... |
<filename>spambayes/Outlook2000/msgstore.py
from __future__ import generators
import sys, os, re
import locale
from time import timezone
import email
from email.MIMEImage import MIMEImage
from email.Message import Message
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.Par... |
<filename>tools/gen_profile.py
#!/usr/bin/env python2
import sys, os, collections, subprocess, sniper_lib, sniper_config
def ex_ret(cmd):
return subprocess.Popen(cmd, stdout = subprocess.PIPE).communicate()[0]
def cppfilt(name):
return ex_ret([ 'c++filt', name ])
class Function:
def __init__(self, eip, name,... |
<filename>paper_trader/interpreter/interpreter.py
from argparse import ArgumentError, ArgumentParser
from cmd import Cmd
class _CmdLineParser(ArgumentParser):
"""
An extension to ArgumentParser set up for interpreter line parsing
"""
def __init__(self, *nargs, **kwargs):
super().__i... |
######################################################################################################################
# The Alpha Particles 2.0 project was made by <NAME>.
######################################################################################################################
### Program for Timing ... |
import numpy as np
from teacher.metrics import coverage, precision, fidelity, rule_fidelity
from teacher.tree import Rule
def test_coverage():
dataset_membership = {
'feat1': {
'val1': np.array([0.7, 1, 0.4]),
'val2': np.array([0.3, 0, 0.6])
},
'feat2': {
... |
import tweepy
import requests
from random import randrange
randNum=randrange(40)
def main():
response=requests.get("https://www.boredapi.com/api/activity")
joke=requests.get("https://official-joke-api.appspot.com/jokes/programming/random")
auth = tweepy.OAuthHandler(consumer_key, consumer_secr... |
import re
import sys
import os
import numpy as np
import cv2
import torch
import torch.backends.cudnn as cudnn
from scipy.ndimage.filters import gaussian_filter
from gazenet.utils.registrar import *
from gazenet.models.saliency_prediction.tased.generator import load_video_frames
from gazenet.models.saliency_predictio... |
import numpy as np
import pandas as pd
import decorators
from scipy import optimize
import settings
import utility_functions as utilfunc
import agent_mutation
import PySAM.Battwatts as battery
import PySAM.BatteryTools as batt_tools
import PySAM.Utilityrate5 as utility
import PySAM.Cashloan as cashloan
#===========... |
# standard libraries
import argparse
from datetime import date
import json
import logging
import os
import pickle
import sys
# third-party libaries
import coremltools
import editdistance
import numpy as np
import onnx
from onnx import helper, shape_inference
import onnxruntime
import onnx_coreml
import torch
import tor... |
import numpy as np
from nptyping import NDArray
from typing import Tuple
import warnings
class Blob:
"""A single blob."""
def __init__(
self,
id: int,
blob_shape: str,
amplitude: float,
width_prop: float,
width_perp: float,
v_x: float,
v_y: floa... |
import os
import numpy as np
from collections import OrderedDict
import math
import matplotlib
import matplotlib.pyplot as plt
import PIL.Image as Image
import torch
from models.base_model import BaseModel
from models.modules.base_module import ModuleFactory
import utils.util as util
from models.modules.vgg import V... |
<reponame>adityazagade/StockScanner<filename>stockscanner/model/asset/holding.py
from datetime import date, timedelta, datetime
from typing import List
from pandas import Timestamp
from stockscanner.model.config import Config
from stockscanner.persistence.dao_manager import DAOManager
from stockscanner.utils import C... |
###
### Multimodal registration with exhaustive search mutual information
### Author: Johan \"{O}fverstedt
###
from numpy.random.mtrand import random
import time
import torch
import torch.nn.functional
import numpy as np
import torch.nn.functional as F
import torch.fft
import torchvision.transforms.functional as TF
i... |
"""
Tests optimizing a unit in AlexNet/CaffeNet with DeePSiM generators 1-8
Running time (approx.; steps == 200; n_units == 1):
5 mins (GTX 2080); 10 mins (GTX 1060)
"""
from time import time
from pathlib import Path
import h5py as h5
import numpy as np
from Experiments import CNNExperiment
save_root = Path('tem... |
import json
import math
import os
from absl import app
from absl import flags
from absl import logging
import data as data_lib
import metrics
import model as model_lib
import objective as obj_lib
import tensorflow.compat.v2 as tf
import tensorflow_datasets as tfds
import numpy as np
from sklearn.metrics import confus... |
#!/usr/bin/python
import usb.core
import usb.util
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import time
class UsbLivePlot:
"""
UsbLivePlot class provides a way to receive sensor readings in form of USB packets and create a self-refreshing plot using matplotlib FuncAnimation... |
# -*- coding: utf-8 -*-
"""DSPT3 U3S2M2 Lecture - Aaron.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1CrqR41yAB2TSKWnANXAREusGUEy8ipAN
"""
import psycopg2
dir(psycopg2)
'''psycopg2.connect looks like it may be interesting!
(Similar to how... |
<filename>Notebooks/python-library/venv/lib/python3.9/site-packages/check50/_api.py
import hashlib
import functools
import numbers
import os
import re
import shlex
import shutil
import signal
import sys
import time
import pexpect
from pexpect.exceptions import EOF, TIMEOUT
from . import internal, regex
_log = []
int... |
import ast
import types
from textwrap import dedent
import inspect
from core_language import Var, Prim, Return, Fun, primops, LitBool, LitFloat, LitInt, Assign, Loop
from type_system import int32, int64
class CoreTranslator(ast.NodeVisitor):
"""
Processes the tree of the python abstract syntax grammar,
mo... |
<gh_stars>1-10
# coding: utf-8
"""
convertapi
Convert API lets you effortlessly convert file formats and types. # noqa: E501
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class HtmlSsrfThreatCh... |
<filename>aio_pool/pool.py
import asyncio
import logging
import sys
from asyncio.base_events import BaseEventLoop
from asyncio.coroutines import iscoroutinefunction
from asyncio.locks import Semaphore
from asyncio.tasks import Task
from collections import deque
from concurrent.futures import ThreadPoolExecutor
from fun... |
# -*- coding: utf-8 -*-
"""This module contains the core function of the *PLUTO_gen* program and the first subfunction of *PLUTO_gen*.
"""
import xmltodict
def read_xml(filename):
"""Reads in the XML to be converted
Reads a *XML-Timeline* file. And returns a dictionary
Arguments:
filename (str... |
<gh_stars>0
"""
# Copyright 2022 Red Hat
#
# 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 applicabl... |
import os
import cv2
import glob
import json
import math
import numpy as np
import matplotlib.pyplot as plt
def getminmax(x1, x2):
aux1 = sorted(x1)
aux2 = sorted(x2)
#print(aux1[0], aux2[0])
if aux1[0] < aux2[0]:
p = aux1[0]
else:
p = aux2[0]
#print(p)
p = p * 10
... |
<filename>ZConfig/tests/test_loader.py
##############################################################################
#
# Copyright (c) 2002, 2003, 2018 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the... |
<gh_stars>100-1000
"""
flood_fill
"""
from __future__ import absolute_import, division, print_function
from PySide import QtGui
import logging
import collections
import time
from mcedit2.editortools import EditorTool
from mcedit2.command import SimplePerformCommand
from mcedit2.editortools.select import SelectionCu... |
<reponame>wsk1314zwr/submarine
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (th... |
<gh_stars>10-100
import os
import sys
import yaml
from matplotlib import pyplot as plt
from matplotlib.lines import Line2D
import numpy as np
import torch
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from networks import encoder_net
from networks import transformer_net
import train
t... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2019 CERN.
#
# cds-books is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""CDS-Books migrator API."""
import json
import uuid
from contextlib import contextman... |
<reponame>bosscha/GASS
#! /usr/bin/env python2
# -*- coding: utf-8 -*-
__author__="<NAME>"
__version__="0.1"
__email__="<EMAIL>"
'''
File name: Useful_Functions_for_GA_Main.py
Author: <NAME>
Description : Useful functions to make test - Subarray selection using Genetic Algorithm
with para... |
from __future__ import absolute_import, division, print_function
# LIBTBX_SET_DISPATCHER_NAME cctbx.xfel.h5_average
import numpy as np
import h5py
import iotbx.phil
import libtbx.load_env
from dials.util.options import OptionParser
import sys, os
from six.moves import range
phil_scope = iotbx.phil.parse("""
averag... |
'''
Created on May 13, 2015
@author: corilo
'''
import csv
import sys
from PySide.QtCore import SIGNAL
from PySide.QtGui import QMainWindow, QFileDialog, QTreeWidgetItem, QIcon, QPixmap, QMessageBox
from res import MainRes
from yec.nhmfl.icr.MzFinder.Inputs.Import_FTMS_Thermo.Load_FTMS_Thermo_File import... |
import numpy as np
import torch
import os
from .base_model import BaseModel
from . import networks_basic as networks
class DistModel(BaseModel):
def name(self):
return self.model_name
def initialize(
self, model='net-lin', net='alex', colorspace='Lab',
pnet_rand=False, pnet_t... |
<reponame>Mon-ius/flask-deploy
from config import *
from validation import *
from utils import *
import subprocess
import getpass
import os
import click
@click.group()
def cx():
"""A quick deploy script for productive flask app."""
@click.command(context_settings=dict(
allow_extra_args=True
))
@click.option(... |
<gh_stars>1-10
from selenium import webdriver
import os
import requests
import bs4
import re
import selenium.webdriver
import RandomHeaders
import threading
import sys
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
def convertHeadless(dr... |
<reponame>HugoCMU/pirateAI
import os
import random
import logging
import numpy as np
import pickle
from uuid import uuid4
from keras.models import load_model
from src.dataset import image_analysis
import src.config as config
class Pirate(object):
"""
Pirates are the agents on the island. When instantiated, pir... |
<gh_stars>0
import re
from bs4 import BeautifulSoup
import time
from itertools import islice
import io
start_time = time.time()
print('starting...')
global root_path
root_path = "C:/Users/Anxhela/PycharmProjects/AI/venv/"
def find_vector(text, count):
array = text.split('_') # Getting the words form the sentenc... |
<reponame>alercebroker/ztf-api-apf
from attr import Attribute, attr
from flask_restx import Resource, fields, Model
from math import isnan
def get_magpsf(raw_response):
try:
magpsf = raw_response.magpsf
return magpsf
except AttributeError:
mag = raw_response["mag"]
return mag
... |
import sys
import os
from time import sleep
from subprocess import run, Popen
from shutil import copy
import yaml
GH_BASE = os.path.expanduser("~/github")
DANS_BASE = f"{GH_BASE}/Dans-labs"
THEME_BASE = f"{DANS_BASE}/mkdocs-dans"
CLIENTS = f"{THEME_BASE}/clients.yaml"
HELP = "help.md"
USAGE = """
Run `build.py` f... |
from django.urls import reverse
from django.utils.crypto import get_random_string
from django.test import TestCase, override_settings
from accounts.models import User
from zentral.contrib.inventory.models import Taxonomy
@override_settings(STATICFILES_STORAGE='django.contrib.staticfiles.storage.StaticFilesStorage')
c... |
<reponame>fsimkovic/cptbx<filename>conkit/core/sequencefile.py
# coding=utf-8
#
# BSD 3-Clause License
#
# Copyright (c) 2016-21, 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... |
<filename>ats/models.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User
class Project(models.Model):
id = models.AutoField(primary_key=True)
name = models.TextField(blank=F... |
<filename>app/user/tests/test_user_api.py
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
CREATE_USER_URL = reverse('user:create')
TOKEN_URL = reverse('user:token')
ME_URL = rev... |
<filename>Lib/test/test_raise.py
# Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Tests for the raise statement."""
from test import support
import sys
import types
import unittest
def get_tb():
try:
raise OSError()
except:
return sys.exc... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
__author__="<NAME>, <NAME>"
import sys
import requests
import json
import codecs
import datetime
import time
import os
import re
import unicodedata
from acscsv.twitter_acs import TwacsCSV
reload(sys)
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
sys.stdin = codecs.... |
from keras.callbacks import ModelCheckpoint
# 引入Tensorboard
from keras.callbacks import TensorBoard
from keras.models import Model, load_model, Sequential
from keras.layers import Dense, Activation, Dropout, Input, Masking, TimeDistributed, LSTM, Conv1D
from keras.layers import GRU, Bidirectional, BatchNormalization,... |
<reponame>semanticbits/survey_stats
import re
import os
import yaml
import pandas as pd
import sqlalchemy as sa
import dask
import dask.multiprocessing
import dask.cache
from cytoolz.curried import map
from multiprocessing.pool import ThreadPool
from timeit import default_timer as timer
from survey_stats import log
fr... |
<gh_stars>1-10
"""Hard filtering of genomic variants.
"""
from distutils.version import LooseVersion
import os
from bcbio import utils
from bcbio.distributed.transaction import file_transaction
from bcbio.pipeline import config_utils
from bcbio.provenance import do, programs
from bcbio.variation import vcfutils
# ## ... |
#import torch.nn as nn
import torch
from torch.nn import functional as F
#from PIL import Image
import numpy as np
import pandas as pd
#import os
import os.path as osp
import shutil
#import math
def save_checkpoint(state,best_pred, epoch,is_best,checkpoint_path,filename='./checkpoint/checkpoint.pth.tar'):
torch.sa... |
<filename>scripts/mgear/maya/rigbits/rbf_manager_ui.py
#!/usr/bin/env python
"""
A tool to manage a number of rbf type nodes under a user defined setup(name)
Steps -
set Driver
set Control for driver(optional, recommended)
select attributes to driver RBF nodes
Select Node to be driven in scene(Animatio... |
<reponame>DHI-GRAS/wapor-et-look<filename>pyWAPOR/Collect/Landsat/PreprocessLandsat.py
import os
import shutil
import tarfile
import numpy as np
import rasterio as rio
from tqdm import tqdm
from pathlib import Path
from datetime import datetime
from datetime import timedelta
from pyWAPOR.Functions.nspi import nspi
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.