text stringlengths 957 885k |
|---|
# import the necessary packages
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.models import load_model
from imutils.video import VideoStream
import numpy as np
import imutils
import cv2
import os
from playsound... |
<reponame>kgarg8/cs559-uic-neural-networks
# Q-learning implementation for 5*5 grid
import numpy as np, matplotlib.pyplot as plt, random, pdb
from tqdm import tqdm
#### Environment ####
# HO 21 22 23 24
# 15 16 17 18 19
# 10 11 12 13 14
# 5 6 7 8 9
# I 1 2 3 GM
# GM: Gold Mine (4)
# HO: Home (20)
... |
import itertools
from collections import Counter
the_code = "18 5 22 25 15 5 17 13 18 19 23 25 15 19 23 12 13 24 19 3 19 17 13 24 9 23 5 23 12 13 15 25 17 19 22 13 5 17 9 17 19 10 25 22 5 18 25 15 5 15 13 17 13 1 19 24 19 8 19 17 9 17 25"
dictionary_file_path = r"C:\Users\slawo\Downloads\sjp-202... |
<filename>celery_project/tools/qcloud/image_cut/cut_helper.py
# coding=utf-8
from __future__ import absolute_import, unicode_literals
import os
import time
import requests
from PIL import Image
from io import BytesIO
from requests import HTTPError
from tools.qcloud.cos_api.python_upload import UploadImage
class Cu... |
from celery import shared_task
import requests as r
import yaml
import base64
import collections
import json
import time
import secrets
import string
import modules.keycloak_lib as keylib
from .exceptions import ProjectCreationException
from django.conf import settings
from .models import Flavor, Environment, Proje... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 16 16:39:54 2018
nteseqr
Description:
Takes ribosome profiling data and annotated reference genomes to identify
N-terminal extensions (NTE)
@author: <NAME>
12.3.2019 (Concentrate Feed) Implementing improvements for MiMB publication
_x_ nteseqr, identify high likeli... |
<reponame>tddesjardins/stsynphot_refactor
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test catalog.py module."""
# THIRD-PARTY
import numpy as np
import pytest
# ASTROPY
from astropy import units as u
# SYNPHOT
from synphot import exceptions as synexceptions
from synphot import units
# LOCAL
... |
<reponame>spacetelescope/jwst-fgs-countrate<filename>fgscountrate/utils.py
import io
import numpy as np
import pandas as pd
import requests
def convert_to_abmag(value, name):
"""
Convert magnitude to AB magnitude
Parameters
----------
value : float
Value of the band
name : str
... |
import warnings
from fault.verilog_target import VerilogTarget
from .verilog_utils import verilog_name
from .util import (is_valid_file_mode, file_mode_allows_reading,
file_mode_allows_writing)
import magma as m
from pathlib import Path
import fault.actions as actions
from fault.actions import FileOp... |
<gh_stars>0
# SPDX-FileCopyrightText: 2021 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Tegra T186 pin names"""
import atexit
from Jetson import GPIO
GPIO.setmode(GPIO.TEGRA_SOC)
GPIO.setwarnings(False) # shh!
class Pin:
"""Pins dont exist in CPython so...lets make our own!"""
IN = 0... |
<reponame>gortizji/tv-graph-cnn
import numpy as np
from scipy.sparse.linalg import eigsh
from scipy.signal import square
def delta(Nv, c):
d = np.zeros([Nv, 1])
d[c] = 1
return d
def diffusion_seq(W, x, T):
N = W.shape[0]
X = np.zeros((N, T))
for t in range(T):
if t == 0:
... |
<reponame>dbirman/cs375<filename>final_project/train_coco.py
"""
Final project
"""
import os
import numpy as np
import tensorflow as tf
from tfutils import base, data, model, optimizer, utils
from coco_provider import COCO
from data_provider import Combine_world
from yolo_tiny_net import YoloTinyNet
from scipy.misc i... |
#
# Copyright (c) 2016 <NAME>
# All rights reserved.
#
# This file is part of Faber. It is made available under the
# Boost Software License, Version 1.0.
# (Consult LICENSE or http://www.boost.org/LICENSE_1_0.txt)
from faber.feature import feature, incidental, map, join
from faber.action import action
from faber.arte... |
<filename>dro_training.py
""" Functions for training using the naive approach."""
import os
import itertools
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import random
import tensorflow as tf
import time
import data
import losses
import model
import naive_training
import optimization
import... |
from __future__ import print_function, division
import os
import json
import time
from utils import command_parser
from utils.class_finder import model_class, agent_class
from main_eval import main_eval
from tqdm import tqdm
from tabulate import tabulate
from tensorboardX import SummaryWriter
os.environ... |
<gh_stars>0
import cv2
import argparse
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
#Generator Network with 2 hidden layers
def generator(noise,reuse=None):
with tf.variable_scope('gen',reuse=reuse): #allows to have subsets o... |
<reponame>zengwbz/FaceMaskClassification<gh_stars>1-10
# from pretrainedmodels import models as pm
# import pretrainedmodels
from torch import nn
from torchvision import models as tm
from config import configs
# from efficientnet_pytorch import EfficientNet
from efficientnet_lite_pytorch import EfficientNet
from effici... |
<reponame>vumichien/gama
from collections.abc import Sequence
import logging
from gama.logging.machine_logging import TOKENS, log_event
from .components import Individual
log = logging.getLogger(__name__)
class OperatorSet:
""" Provides a thin layer for ea operators for logging, callbacks and safety. """
d... |
import glob
import os
from configuration.configuration_api import ConfigurationAPI
from rest_client.AuthenticationRest import AuthenticationAPI
from files_treatment_new.xls_gen_bank_patric import XlsGenBankPatric
from files_treatment_new.fasta_contigs_patric import FastaContigsPatric
from objects_new.Contigs_new im... |
"""Linear inverse problems and bayesian estimation with linear restriction."""
import numpy as np
from gnss_timeseries.stats import is_not_outlier
__docformat__ = 'reStructuredText en'
# -----------------------------------------------------------------------------
# Linear regression (one variab... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... |
#By bafomet
import requests
import random
import json
from module.utils import COLORS
try:
from module import local
except ImportError:
from . import local
resp_js = None
is_private = False
total_uploads = 12
def get_page(username):
global resp_js
session = requests.session()
session.headers = {'User-Agent': r... |
import ast
import hashlib
import importlib
import numpy as np
import pandas as pd
class Utils:
"""
Utils functions
"""
@classmethod
def md5_file(cls, filename):
"""
Calculate the md5 of a file
thanks <NAME> https://www.pythoncentral.io/hashing-files-with-python/
R... |
'''
Created on 18.07.2012
@author: philkraf
'''
from base64 import b64encode
from .. import lib as web
from ... import db
from traceback import format_exc as traceback
from datetime import datetime, timedelta
import io
from ..auth import group, expose_for, users
import codecs
from ...tools.calibration import Calibrati... |
<reponame>kleutzinger/advent-of-code-2021
import os
import sys
from collections import *
from pprint import pprint
from copy import deepcopy
from itertools import *
# change to dir of script
os.chdir(os.path.dirname(os.path.abspath(__file__)))
input_file = "input.txt"
if "s" in sys.argv:
input_file = "input_small.... |
from base.base_model import BaseModel
import tensorflow as tf
import numpy as np
class ExampleModel(BaseModel):
def __init__(self, config):
super(ExampleModel, self).__init__(config)
self.build_model()
self.init_saver()
def build_model(self):
self.is_training = tf.placeholder(... |
<filename>add_criminal.py
from tkinter import *
import tkinter as tk
import tkinter.messagebox
import tkinter.font as tkFont
from PIL import Image, ImageTk
from tkinter import filedialog
import os
import sqlite3
connection = sqlite3.connect('NCD.db')
cursor = connection.cursor()
def add2(p):
t = tk.Tk(... |
<gh_stars>0
from pandas.testing import assert_frame_equal
import pandas as pd
from sparkmagic.utils.utils import coerce_pandas_df_to_numeric_datetime
def test_no_coercing():
records = [
{"buildingID": 0, "date": "6/1/13", "temp_diff": "12"},
{"buildingID": 1, "date": "random", "temp_diff": "0adsf... |
<reponame>bondruy/sam-tensorflow
import tensorflow as tf
def vgg_net(images, _data_format):
layer01 = tf.layers.conv2d(images, 64, 3,
padding="same",
activation=tf.nn.relu,
data_format=_data_format,
... |
# import modules
# -------------
# built-in
import csv
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import norm
from progress.bar import Bar
from timeit import default_timer as timer
# user
from cogen_util import find_global_cost
import pce as pce
from pce.quad4pce import columnize
# savedata f... |
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision as T
import numpy as np
import pickle
import argparse
import time
import os
from utils import select_network, select_optimizer
from torch._utils import _accumulate
from torch.utils.data import Subset
from datetime import datetime
parser ... |
# config.py - Reading and writing Git config files
# Copyright (C) 2011 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2
# of the License or (at your option) a later ... |
<reponame>rky0930/yolo_v2
# 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/LICENSE-2.0
#
# ... |
<reponame>medialab/bibliotools3.0
#! /usr/bin/env python
"""
Author : <NAME> (http://www.sebastian-grauwin.com/)
Copyright (C) 2012
All rights reserved.
BSD license.
"""
import os
import sys
import glob
import numpy
import argparse
## ##################################################
##... |
<reponame>mailtokartik1/electron<filename>script/native-tests.py
#!/usr/bin/env python
import argparse
import os
import subprocess
import sys
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor')
PYYAML_LIB_DIR = os.path.join(VENDOR_DIR, 'pyyaml', '... |
from .base_requests import AnymailRequestsBackend, RequestsPayload
from ..exceptions import AnymailRequestsAPIError
from ..message import AnymailRecipientStatus
from ..utils import get_anymail_setting, update_deep
class EmailBackend(AnymailRequestsBackend):
"""
SparkPost Email Backend
"""
esp_name = ... |
import sqlite3
from .User import User
def createUserFromResponse(response):
user = User(response[1])
user.ID = response[0]
user.tg_name = response[2]
user.tg_nickname = response[3]
user.fname = response[4]
user.lname = response[5]
user.name = response[6]
user.score = response[7]
user.second_score = respon... |
<gh_stars>1-10
import torch
import torch.nn as nn
import numpy as np
import torchvision.models as models
from torch.utils.data import DataLoader
from tqdm import tqdm
import torchvision.transforms as T
import torchvision.utils as vutils
from PIL import Image
import os
from torch.utils.tensorboard import Summa... |
<filename>main.py
import os
import sys
import time
import colorama
import pyfiglet
from colorama import Fore
import json
import subprocess
os.system(' clear ')
def restart_program():
python = sys.executable
os.execl(python, python, * sys.argv)
curdir = os.getcwd()
def load_animation():
load_s... |
"""
Intro
-----
- For general context and class diagram, refer to :mod:`~sanskrit_data.schema`.
"""
import logging
import sys
from sanskrit_data.schema import common
from sanskrit_data.schema.common import JsonObject, recursively_merge_json_schemas, TYPE_FIELD, update_json_class_index
logging.basicConfig(
level=... |
import praw
import urllib.request
import requests
import os
import sys
from tqdm import tqdm
import argparse
from datetime import datetime
# program usage: py main.py [-u] [user/subreddit] [sort category] [# posts] ['directory']
def download(posts, num, folder):
inter = False
try:
for submission in t... |
<filename>pdftools.py
import subprocess
import os
import math
from queue import Queue
from pathlib import Path
from PIL import Image
def locate_mutool():
"""
Checks for the presence of mutool and if found, returns the Path
object for it. If not it returns False.
"""
f1, f2 = Path('./mutool... |
# Create a hash table with add/delete/lookup methods
class HashMap:
"""
Hash map inits with a list of a given size (m);
Keywords: map_size (default = 17)
"""
def __init__(self, map_size=17):
self.map_size = map_size
self.hash_map = self.create_map(map_size)
def create_map(sel... |
<gh_stars>0
import json
import numpy as np
class AbstractBenchmark:
"""
Abstract template for benchmark classes
"""
def __init__(self, config_path=None):
"""
Initialize benchmark class
Parameters
-------
config_path : str
Path to load configuration... |
# -*- coding: utf-8 -*-
"""A Python library that understands the TUIO protocol"""
__author__ = "<NAME>, <NAME>"
__version__ = "0.1"
__copyright__ = "Copyright (c) 2007-2008 <NAME>, <NAME>"
__license__ = "MIT"
__url__ = "http://code.google.com/p/pytuio/"
import os
import sys
import math
import socket
impo... |
"""The script scrapes https://flagma.ua/ site. It collects contact data for
each company from the specified category. The results are saved to a CSV file.
The scraping process requires dynamic IP change, for the site has anti-scrape
protection (IP ban). Therefore the script uses free TOR proxy. In order to
make things... |
<gh_stars>10-100
"""
Copyright (c) Microsoft Corporation.
Licensed under the MIT license.
run evaluation of VCMR or infenrece of TVR for submission
"""
import argparse
import os
from os.path import exists
from time import time
import torch
from torch.utils.data import DataLoader
from torch.nn import functional as F
i... |
from dd.cudd import BDD
from parity_game import parity_game, sat_to_expr
import logging
import time
logger = logging.getLogger(__name__)
debug = logger.isEnabledFor(logging.DEBUG)
#@profile
def fpj(pg: parity_game):
"""Symbolic implementation of the FPJ algorithm
:param pg: parity game instance
:type pg:... |
<reponame>somespecialone/csgo-items-db
import asyncio
import json
from dataclasses import dataclass
from datetime import datetime
from pathlib import Path
from typing import Any
import aiohttp
import vdf
import vpk
from . import _typings
from ._vpk_extractor import VpkExtractor
from ._fields import FieldsCollector
f... |
"""与疫情通截图相关的方法
"""
import datetime
import json
import logging
import pytz
import random
from io import BytesIO
import requests
from PIL import Image, ImageDraw, ImageFont
from conf import settings
logger = logging.getLogger('screenshot')
def generate_screenshot(
name: str,
st... |
from transformers import pipeline
import tweepy as tw
import praw
import streamlit as st
import pandas as pd
import os
import matplotlib.pyplot as plt
import seaborn as sns
import random
import requests
#import pandas_datareader as pdr
from pandas import json_normalize
from alpha_vantage.timeseries import TimeSeries
#... |
<reponame>Tigraine/dotless
#!/usr/bin/python
#
# Copyright 2008, 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/LICENS... |
# -*- coding: utf-8 -*-
import proxy
import urllib
import requests
from django.conf import settings
from django.http import HttpResponse
#import xml.etree.ElementTree as ET
from lxml import etree as ET
from django.contrib.auth.models import User
from geoprisma.utils import isAuthorized
from geoprisma.models import Data... |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
# from tinymce.models import HTMLField
# from pyuploadcare.dj.models import ImageField
# from django.db.models import Avg, Max, Min
# from pyuploadcare.dj.forms im... |
# Copyright (c) 2020-2021 by Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel, and University of Kassel. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
import json
import os
import pickle
from functools impo... |
<gh_stars>1-10
import unittest
from unittest import mock
import numpy as np
from smac.intensification.abstract_racer import RunInfoIntent
from smac.intensification.parallel_scheduling import ParallelScheduler
from smac.runhistory.runhistory import RunInfo, RunValue
from smac.tae import StatusType
def mock_ranker(sh... |
wrong_input = [
"IL",
"IC",
"ID",
"IM",
"VV",
"VX",
"VL",
"VC",
"VD",
"VM",
"XD",
"XM",
"LL",
"LC",
"LD",
"LM",
"DD",
"DM",
"IIV",
"IIX",
"IIL",
"IIC",
"IID",
"IIM",
"IVI",
"IVV",
"IVX",
"IVL",
"IVC",
... |
<reponame>balintmaci/drone_intro_exercises
from math import pi, cos, asin, sqrt, sin
import numpy as np
from mercator.utm import utmconv
from gps.data_helper import *
from shapely.geometry import LineString
import time
def convert_to_meters(line):
uc = utmconv()
(hemisphere1, zone1, letter1, e1, n1) = uc.geode... |
#We used the Recipe Puppy API :)
api_key = "01c7a5dd19fe082baf1a1bd40c11bd9f"
#We also used these three modules
import webbrowser
import json
import urllib.request
def foodFind():
y={}
x = input("Would you like to search by 1)Keywords or by 2)Ingredients? ")
if x == "1":
print(y)
return sea... |
#!/usr/bin/env python2
import json
import argparse
import os
import os.path
import sys
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
import cElementTree as ElementTree
# Put shared python modules in path
sys.path.insert(0, os.path.join(
os.path.dirname(os.path.dirname(os.... |
import argparse
import pickle
import operator
import pprint
import fileinput
import numpy as np
import pandas as pd
parser = argparse.ArgumentParser(description='Check correlations with different alpha')
parser.add_argument('-m', '--model', help='input pickle file for the model', required=True)
parser.add_argument('-t... |
<reponame>sedlakovi/mafTools
##################################################
# Copyright (C) 2013 by
# <NAME> (<EMAIL>, <EMAIL>)
# ... and other members of the Reconstruction Team of <NAME>'s
# lab (BME Dept. UCSC).
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softwar... |
<gh_stars>10-100
import chainer
import numpy as np
import scipy.sparse as sp
import sklearn
from sklearn.datasets import fetch_20newsgroups
from nlp_utils import tokenize
def moving_window_window_iterator(sentences, window):
for sentence in sentences:
for i in range(0, len(sentence) - window + 1):
... |
<filename>Plug-ins/PlexSportsAgent.bundle/Contents/Code/Schedules/ESPNAPIScheduleAdapter.py
import json
import re
import threading
import Queue
from Constants import *
from Hashes import *
from StringUtils import *
from TimeZoneUtils import *
from Vectors import *
from ..Data.ESPNAPIDownloader import *
fro... |
from __future__ import print_function
'''
R-1.1 Write a short Python function, is_multiple(n, m), that takes two integer values and
returns True if n is a multiple of m, that is, n = mi for some integer i, and False otherwise
'''
def is_multiple(n, m):
try:
return n % m == 0
except ZeroDivisionError:
... |
<filename>control_de_flujo.py<gh_stars>0
"""Guarde en lista `naturales` los primeros 100 números naturales (desde el 1)
usando el bucle while
"""
naturales = []
n = 0
while n < 100:
n +=1
naturales.append(n)
#print(naturales)
"""Guarde en `acumulado` una lista con el siguiente patrón:
['1','1 2','1 2 3','1... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: cosmos/distribution/v1beta1/distribution.proto, cosmos/distribution/v1beta1/genesis.proto, cosmos/distribution/v1beta1/query.proto, cosmos/distribution/v1beta1/tx.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import... |
<reponame>benjiec/pychemy
# Tools for grouping proteins into non-conflicting sets for
# multiplexed screening of homologues
import re
from pychemy.peptides import mass_from_sequence
import numpy as np
import csv
import os
AA = re.compile('[ACDEFGHILMNPQSTVWY]+[RK]')
AA_check = re.compile('[ACDEFGHILKMNPQRSTVWY]')
... |
<filename>t/ehos/instances_test.py<gh_stars>1-10
import pytest
from unittest.mock import Mock, patch
import ehos.instances as I
import ehos
#import ehos.tyt
import sys
print(sys.modules['ehos.instances'] )
print( I )
db_name = 'ehos_testing'
url = "postgresql://ehos:ehos@127.0.0.1:5432/{db_name}".format( db_name=db... |
<reponame>Vishal324140/ElainaRobot<gh_stars>1-10
# MIT License
# Copyright (c) 2022 <NAME>™
# 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... |
#
# Copyright (c) 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
import logging
from typing import Dict, Type
from discord.ext import commands
from miyu_bot.bot import models
import miyu_bot.bot.bot
from miyu_bot.bot.models import PreferenceScope, all_preferences
class Preferences(commands.Cog):
bot: 'miyu_bot.bot.bot.MiyuBot'
def __init__(self, bot):
self.bot =... |
# -*- coding: utf-8 -*-
"""
Shows headphones symbol with x or tick according to if Bose are connected or not
"""
import subprocess
class Py3status:
def __init__(self):
headphones_icon = "Blackout"
# self.format_connected = "🎧 ✔"
# self.format_connected = headphones_icon + " ✔"
... |
#SPDX-License-Identifier: MIT
import os, subprocess
from datetime import datetime
import logging
from workers.worker_git_integration import WorkerGitInterfaceable
import requests
import json
from urllib.parse import quote
from multiprocessing import Process, Queue
import traceback
import pandas as pd
import sqlalchem... |
<gh_stars>10-100
# Random RGB Sticklet by @PhycoNinja13b
#Exclusive for My personal Repo
#Requirement of this plugin is very high (Kumbhkaran ki aulad)
#Currently Loaded 74 Font Options
#Dare To edit this part! U will be tored apart!
import io
import textwrap
import random
from telethon import events
from PIL imp... |
"""Toplevel parser script that can run wikipedia search."""
import logging
from pathlib import Path
from time import sleep
from typing import Union
from wiki_music.constants.colors import CYAN, GREEN, RESET
from wiki_music.utilities import (Action, exception, flatten_set, to_bool,
we... |
<gh_stars>0
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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 ri... |
<filename>code/imgaug/augmenters/flip.py
"""
Augmenters that apply mirroring/flipping operations to images.
Do not import directly from this file, as the categorization is not final.
Use instead
`from imgaug import augmenters as iaa`
and then e.g. ::
seq = iaa.Sequential([
iaa.Fliplr((0.0, 1.0)),
... |
"""
split.py - Word Splitting
Nice blog post on the complexity/corner cases/differing intuition of splitting
strings:
https://chriszetter.com/blog/2017/10/29/splitting-strings/
python-dev doesn't want to touch it anymore!
Other possible splitters:
- AwkSplitter -- how does this compare to awk -F?
- RegexSplitter
-... |
"""Generic BEL relation API methods."""
import re
import cgi
import requests
import xmltodict
from enum import Enum
from collections import namedtuple, defaultdict, Counter
from copy import deepcopy
from math import ceil
from typing import List, Optional, Dict, Set, NamedTuple, Any, Union, Tuple
from flask import requ... |
##### インポート #####
from discord.ext import commands
from discord.ext import tasks
from datetime import time
from collections import Counter
import discord
import random
import asyncio
import aiohttp
import json
import os
import subprocess
import sys
import datetime
import time
import ast
import re
import zlib
import io
... |
<reponame>wesleyegberto/machine-learning-courses
#!/usr/bin/env python
# coding: utf-8
# # Machine Learning using Logistic Regression
#
# Classifier model that estimates an applicant’s probability of admission based the scores from those two exams.
# In[1]:
import pandas as pd
import numpy as np
# import pandas_pr... |
<gh_stars>10-100
# Implementing TF-IDF for preidctive analytics on unstructured texts
#---------------------------------------
# Run the below command to have the nltk and its pre-trained toxkenizer models instelled on your machine.
# sudo python3 -c "import nltk; nltk.download('all')"
import tensorflow as tf # Ten... |
<filename>challenges/linux_misc/linuxadv/answer.py
#!/usr/bin/python3
import os
import sys
import datetime
import stat
import signal
class COLORS:
PURPLE = '\033[95m%s\033[0m'
BLUE = '\033[94m%s\033[0m'
GREEN = '\033[92m%s\033[0m'
YELLOW = '\033[93m%s\033[0m'
EMPHASIS = '\033[1m\033[4m'
FLAG="E... |
from aiohttp import web
from aiohttp_validate import validate
from . import schemas, utils
from ..auth.mixins import TokenRequiredMixin
from ..users.utils import user_exists
class SendMessageView(TokenRequiredMixin, web.View):
"""View to send message to one user."""
@validate(**schemas.send_message_schema)
... |
<filename>sfft/utils/StampGenerator.py
import numpy as np
import os.path as pa
from astropy.io import fits
from astropy.wcs import WCS
from tempfile import mkdtemp
from astropy.nddata.utils import Cutout2D
__author__ = "<NAME> <<EMAIL>>"
__version__ = "v1.0"
"""
# MeLOn Notes
# @Stamp Generator
# * Remarks on the 2 b... |
# coding: utf-8
# In[1]:
# get_ipython().magic(u'matplotlib inline')
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
# import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import numpy.random as npr
from sklearn.cl... |
"""
Ingest data from a genomic center manifest CSV file which dropped by biobank.
"""
import os
import csv
import datetime
import logging
import collections
from rdr_service import clock
from rdr_service import config
from rdr_service.api_util import list_blobs, open_cloud_file
from rdr_service.config import GENOMIC_... |
# Copyright 2019 Open Source Robotics Foundation, 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... |
<gh_stars>1-10
#!/usr/bin/env python
# __BEGIN_LICENSE__
#Copyright (c) 2015, United States Government, as represented by the
#Administrator of the National Aeronautics and Space Administration.
#All rights reserved.
#
#The xGDS platform is licensed under the Apache License, Version 2.0
#(the "License"); you may not... |
<gh_stars>0
import asyncio
import structlog
import argparse
import random
import time
import socket
from hubtraf.user import User, OperationError
from hubtraf.auth.dummy import login_dummy
from functools import partial
async def simulate_user(
hub_url, username, password, delay_seconds,
exec_seconds, ... |
import pytz
from settings import GBE_TABLE_FORMAT
from django.db.models import(
CASCADE,
CharField,
ForeignKey,
OneToOneField,
TextField,
URLField,
)
from django.core.exceptions import (
NON_FIELD_ERRORS,
ValidationError,
)
from gbe.models import (
Biddable,
Conference,
Perfo... |
<reponame>thepabloaguilar/argocd-client
# coding: utf-8
"""
Consolidate Services
Description of all APIs # noqa: E501
The version of the OpenAPI document: version not set
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from argocd_client.configur... |
'''
Compares folders of clean and dirty audio
Calculates STOI, PESQ (tbd) and MSS
'''
import argparse
import pathlib
import typing
from typing import Union
from dataclasses import dataclass, fields
import logging
import csv
from tqdm import tqdm # type: ignore
import soundfile # type: ignore
from mir_eval.separation... |
import os
import random
import pickle
import pytrec_eval
from eval.eval_bm25_coliee2021 import read_label_file
from analysis.ttest import measure_per_query
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import matplotlib
from analysis.compare_bm25_dpr import read... |
<gh_stars>0
'''
Tic-tac-toe is played by two players A and B on a 3 x 3 grid.
Here are the rules of Tic-Tac-Toe:
Players take turns placing characters into empty squares (" ").
The first player A always places "X" characters, while the second player B always places "O" characters.
"X" and "O" characters a... |
import numpy as np
import scipy.sparse as sp
import warnings
import properties
from .base import BaseRegularization, BaseComboRegularization
from .. import Utils
class BaseSparse(BaseRegularization):
"""
Base class for building up the components of the Sparse Regularization
"""
def __init__(self, mes... |
import numpy as np
_DEFAULT_ALPHA = 2.
_MASS_UNIT = "Msol h**-1"
def Okamoto_Mc_fn():
from seren3 import config
from scipy import interpolate
# from seren3.analysis.interpolate import extrap1d
fname = "%s/Mc_Okamoto08.txt" % config.get('data', 'data_dir')
data = np.loadtxt(fname)
ok_a, ok_z, ... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import pygame
import time
pygame.init()
screen = pygame.display.set_mode((1000, 1000))
level_number = 1
number_of_levels = 2
font = pygame.font.SysFont("comicsans", 60)
small_font = pygame.font.SysFont("comicsans", 30)
boss_defeated_msg = font.render("Congretulations !... |
<reponame>Mirantis/contrail-controller
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2015 Juniper Networks
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.