text stringlengths 3.07k 22.1k |
|---|
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
"""
Pytorch Classifier class in the style of scikit-learn
Classifiers include Logistic Regression and MLP
"""
from __future__ ... |
import sys
import pytest
from binobj import DEFAULT
from binobj import errors
from binobj import fields
from binobj.fields import stringlike
def test_bytes__dump_too_short():
"""Crash if we try dumping a Bytes field without enough bytes."""
field = stringlike.Bytes(size=4)
with pytest.raises(errors.Val... |
#!/usr/bin/env python
# coding: utf-8
# In[4]:
### Required
#### 1. **Write a function** to download histohour data, parameters:
#fsym: BTC, tsym: USDT, start_time="2017-04-01", end_time="2020-04-01", e='binance'
import requests
import json
from datetime import datetime, timedelta
import pandas as pd
def histoh... |
#!/usr/bin/env python3
import random
from project.utils import *
from project.HCSR04 import Sensor
from project.constants import *
from project.components.vaisseau import Vaisseau, Tir
from project.components.alien import Alien
from project.components.explosion import Explosion
from project.components.score import Sc... |
import logging
from datetime import timedelta
from collections import defaultdict
import contextlib
import functools
import requests
import dateutil
from django.core.urlresolvers import reverse
from smashrun import Smashrun as SmashrunClient
from tapiriik.settings import WEB_ROOT, SMASHRUN_CLIENT_ID, SMASHRUN_CLIENT_... |
import glob
import logging
import os
import re
import shutil
import tempfile
import hydra
import numpy as np
import pyparsing as pp
from edalize import *
from hydra.core.hydra_config import HydraConfig
from hydra.utils import get_original_cwd
from omegaconf import DictConfig, OmegaConf
from do_blink.edalize.symbiflow... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2021 The MobileCoin Foundation
# Python wrappers for the gRPC service `MobilecoindAPI` organized as a `Client` object
import grpc
from google.protobuf import empty_pb2
from .external_pb2 import *
from .blockchain_pb2 import *
from .mobilecoind_api_... |
import configparser
import logging
import os
import subprocess
import time
from typing import Any, Dict, Optional, Tuple
if False:
import boto3 # type: ignore
import wandb
from wandb.apis.internal import Api
import wandb.docker as docker
from wandb.errors import LaunchError
from wandb.util import get_module
from... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""setup.py
This is a basic setup script for Demag GUI Autoupdate. It functions mainly to
resolve path names to the data files on your machine (saved to dmgui_au.conf)
and retrieve data from the *.inp files of data directories. These files contain
site-specific information... |
from lumicks.pylake.kymotracker.detail.msd_estimation import *
import contextlib
import pytest
@contextlib.contextmanager
def temp_seed(seed):
np.random.seed(seed)
try:
yield
finally:
np.random.seed(None)
def simulate_diffusion_1d(diffusion, steps, dt, observation_noise):
"""Simulate... |
import numpy as np
from numpy import linalg as la
import logging
from typing import Callable, List, Tuple, Dict
def random_sample(bounds: np.ndarray, k: int) -> np.ndarray:
"""
Generate a set of k n-dimensional points sampled uniformly at random
:param bounds: n x 2 dimenional array containing upper/lower ... |
#!/usr/bin/env python
from __future__ import (absolute_import, print_function, division, unicode_literals)
from contextlib import contextmanager
from os.path import dirname, realpath, join, exists, normpath
import os
import shutil
import subprocess
import glob
import re
from shlex import split
import click
# https://... |
# Copyright 2021, 2022 Cambridge Quantum Computing Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
import bottle
from bottle import get, post, run, template, request, redirect
import modeli
import hashlib
SKRIVNOST = 'moja skrivnost'
def prijavljen_uporabnik():
return request.get_cookie('prijavljen', secret=SKRIVNOST) == 'da'
def url_knjiznice(id):
return '/knjiznica/{}/'.format(id)
@get('/')
def glavn... |
# -*- coding: UTF-8 -*-
"""
..
---------------------------------------------------------------------
___ __ __ __ ___
/ | \ | \ | \ / the automatic
\__ |__/ |__/ |___| \__ annotation and
\ | | | | \ ... |
import json
import logging
import os
import re
from dataclasses import dataclass, field
from pathlib import Path, PurePath
from test.data import TEST_DATA_DIR
from test.utils import GraphHelper
from typing import (
ClassVar,
Collection,
Dict,
Iterable,
List,
Optional,
OrderedDict,
Patter... |
# Copyright 2019 Google LLC. 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... |
# HELLO WORLD!
# hello world!
print('hello world')
#####
# BIG INTEGER
# bignum
print(1 << 1000)
#####
# ASSEMBLY
# inline assembler
@micropython.asm_thumb
def asm_add(r0, r1):
add(r0, r0, r1)
print(asm_add(1, 2))
#####
# SWITCH
# push the USR button on the pyboard to flash the LEDs!
# try using the reset button... |
from os import environ
import logging
import asyncio
from threading import Event, Thread, Lock
from time import sleep
from typing import Optional, Mapping, Dict, Tuple
from serial.serialutil import SerialException # type: ignore
from opentrons.drivers import serial_communication, utils
from opentrons.drivers.serial_c... |
import os
import yaml
import requests
import pandas as pd
from baseAssistant import baseAssistant
class wit(baseAssistant):
def __init__(self):
self.LIMIT = 200
self.creds = self.getCreds()
self.URL = self.creds["wit"]["URL"]
self.headers = {
'Authorization': 'Bearer ' ... |
import numpy as np
import torch
from .quant_layer import QuantModule, lp_loss
from .quant_model import QuantModel
from .quant_block import BaseQuantBlock
from .adaptive_rounding import AdaRoundQuantizer
from .set_weight_quantize_params import get_init, weight_get_quant_state
from .set_act_quantize_params import set_act... |
import logging
import os
import subprocess
import posixpath
import sys
import warnings
from mlflow.models import FlavorBackend
from mlflow.models.docker_utils import _build_image, DISABLE_ENV_CREATION
from mlflow.models.container import ENABLE_MLSERVER
from mlflow.pyfunc import ENV, scoring_server, mlserver
from mlf... |
import click
from esque.cli.autocomplete import list_consumergroups, list_contexts, list_topics
from esque.cli.helpers import ensure_approval
from esque.cli.options import State, default_options
from esque.cli.output import blue_bold, green_bold
from esque.cluster import Cluster
from esque.config import ESQUE_GROUP_ID... |
import datetime
from typing import List
import numpy as np
import pandas as pd
from celery import chain, chord, group
from celery.utils.log import get_task_logger
from materializationengine.celery_init import celery
from materializationengine.chunkedgraph_gateway import chunkedgraph_cache
from materializationengine.da... |
import json
import os
from collections import Counter
from datetime import datetime
from io import BytesIO
from typing import TYPE_CHECKING, Callable, List, Optional, Tuple, Union
from uuid import uuid4
import joblib
import numpy as np
from fedot.core.log import Log, default_log
from fedot.core.operations.atomized_te... |
import numpy as np
import torch
from matplotlib import pyplot as plt
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_absolute_error
torch.manual_seed(7)
# Load the dataset
D_numpy = np.load("D.npy")[:, 0, :] # We only have one SOAP... |
##############################################################################
#
# Copyright (c) 2007 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 ZPL should accompany this distribution.
# THIS SOF... |
"""An adapter for the Blue Gene/L log data available at: https://www.usenix.org/cfdr-data."""
import codecs
import datetime
import os
import click
class LogEntry:
"""A log entry."""
code_to_key = {}
def __init__(self, code, type, severity, timestamp):
"""Initialize a LogEntry.
code -... |
# 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 rights
# to us... |
#!/usr/bin/python3
import re
import tkinter as tk
import tkinter.font as tkFont
from pathlib import Path
from tkinter import ttk
from brownie.project.sources import is_inside_offset
from .bases import SelectBox
from .styles import TEXT_COLORS, TEXT_STYLE
class SourceNoteBook(ttk.Notebook):
def __init__(self, p... |
# Copyright (c) 2019, NVIDIA CORPORATION. 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 applic... |
from itertools import cycle
from typing import List
from unittest.mock import Mock, create_autospec
from urllib.parse import urlparse
import gevent
import pytest
import requests
import responses
from eth_utils import decode_hex, encode_hex, to_canonical_address, to_normalized_address
from matrix_client.errors import M... |
'''
keypoint_visualizer.py
Visualizer for Human Pose Estimation
Author: <NAME>
E-mail: <EMAIL>
Created on June 18th, 2018
'''
import cv2
import numpy as np
import sys, os
sys.path.append(os.path.abspath("../../../utility/"))
from utils_io_file import is_image
from utils_io_folder import create_folder
from... |
# ******************************************************************************
# Copyright 2014-2018 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.apa... |
import configparser
import json
import re
import yaml
import logging
from io import StringIO
from dotmap import DotMap
log = logging.getLogger('UtilityDictionary')
class UtilityDictionary:
@staticmethod
def load_config_string(s: str) -> (dict, bool):
config_dict = dict()
try:
#c... |
from rest_framework.generics import (
CreateAPIView,
RetrieveAPIView,
UpdateAPIView,
DestroyAPIView,
)
from rest_framework.permissions import IsAuthenticated
from .permissions import IsOwnerCustomer
from django.contrib.auth.models import User
from .models import Customer, DeliveryAddress
from order... |
from PySide2 import QtCore, QtGui
class Field(object):
"""Base class for all fields used to create settings for indicators"""
def __init__(self, attribute_name):
# Constants
self._attribute_name = attribute_name
@property
def attribute_name(self) -> str:
"""Return the attrib... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
import os
import cv2
from os.path import join as pjoin
import json
import math
import numpy as np
import torch.utils.data as data
import torch
from typing import Optional
from utils import image_io, frame_sampling as sampling
_dtype = torch.f... |
# Copyright (c) Microsoft Corporation
#
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights... |
from .. import util
importlib = util.import_importlib('importlib')
machinery = util.import_importlib('importlib.machinery')
import errno
import os
import sys
import tempfile
from types import ModuleType
import unittest
import warnings
import zipimport
class FinderTests:
"""Tests for PathFinder."""
def tes... |
import pygame
import sys
import game_stats
from bullet import Bullet
from alien import Alien
from time import sleep
def check_keydown_events(event, game_settings, screen, ship, bullets):
"""Check keydown events"""
if event.key == pygame.K_RIGHT or event.key == pygame.K_d:
ship.moving_right = True
... |
import skimage
import skimage.io
import skimage.transform
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.pyplot import imshow
import matplotlib.image as mpimg
import tensorflow as tf
import os
from skimage import io
from skimage.transform import resize
import cv2
# synset = [l.strip() ... |
import requests
import pytz
import datetime
import time
import json
import util
import threading
ERROR_MSG = "Что-то поломалось! :("
def get_string_week_number(**kwargs):
return "Disabled until September 1st, 2018"
"""
initial_day = datetime.date(year=2018, month=2, day=9)
initial_week_number = init... |
# reference codes:
# https://github.com/robertklee/COCO-Human-Pose/blob/main/human_pose_app.py
# https://github.com/robertklee/COCO-Human-Pose/blob/main/human_pose_app.py
# https://github.com/rejexx/Parkingspot_Vacancy/blob/main/src/streamlit_app.py
import streamlit as st
import os
import cv2
import numpy as np
impo... |
import itertools
from decimal import Decimal as D
from django.core.cache import cache
from django.core.exceptions import ImproperlyConfigured
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from pecomsdk import pecom
from ... |
"""PlagiarismDetectionSubmissions API Version 1.0.
This API client was generated using a template. Make sure this code is valid before using it.
"""
import logging
from datetime import date, datetime
from .base import BaseCanvasAPI
from .base import BaseModel
class PlagiarismDetectionSubmissionsAPI(BaseCanvasAPI):
... |
from flask import Blueprint, request, url_for, render_template, redirect, flash
from flask_security import current_user, login_required
from sqlalchemy.sql.expression import func
from os import path
from classes.shared import db
from classes import settings
from classes import RecordedVideo
from classes import subscri... |
# -*- coding: utf-8; indent-tabs-mode: nil; python-indent: 2 -*-
#
# Copyright (C) 2019 <NAME>
#
# This file is part of WaterOnMars (https://github.com/tibonihoo/wateronmars)
#
# WaterOnMars is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as publishe... |
from typing import Tuple
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import traceback
BRAND = "XSOAR"
PAGE_SIZE = 2000
# --------------------------------------------------- Helper functions---------------------------------------------
def find_indicators_by... |
import numpy as np
from numpy import newaxis as na
from py_wake.deficit_models import BlockageDeficitModel
class Rathmann(BlockageDeficitModel):
"""
<NAME> (DTU) developed in 2020 an approximation to the vortex
cylinder solution (<NAME> and <NAME>, 2014). In speed it is
comparable to the vortex dipole... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import os.path
import numpy as np
from numpy.testing import assert_allclose
from scipy import signal
import pytest
from pambox import utils
from pambox.utils import fftfilt
__DATA_ROOT__ = os.path.join(os.path.dirname(__file__)... |
from __future__ import division
import numpy as np
import pandas as pd
from PyAstronomy import pyasl
import matplotlib.pyplot as plt
from astropy import constants as c
from joblib import Parallel, delayed
plt.rcParams['xtick.direction'] = 'in'
plt.rcParams['ytick.direction'] = 'in'
plt.rcParams['axes.spines.right'] = ... |
"""
QRCoder, a Fusion 360 add-in
================================
QRCoder is a Fusion 360 add-in for the creation of 3D QR Codes.
:copyright: (c) 2021 by <NAME>.
:license: MIT, see LICENSE for more details.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED ... |
import nipype.interfaces.afni.preprocess as e_afni
from CPAC.pipeline import nipype_pipeline_engine as pe
import nipype.interfaces.utility as util
def create_scrubbing_preproc(wf_name = 'scrubbing'):
"""
This workflow essentially takes the list of offending timepoints that are to be removed
and removes it... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import warnings
import torchvision
warnings.filterwarnings(action='ignore')
class double_conv(nn.Module):
'''(conv => BN => ReLU) * 2'''
def __init__(self, in_ch, out_ch, reduction=16):
super(double_conv, self).__init__()
self.conv = nn.Seq... |
'''
Created on Jun 2, 2014
@author: eze
'''
import json
import logging
import os
import re
import shutil
import subprocess
from tqdm import tqdm
from numpy.lib.scimath import sqrt
from glob import glob
from SNDG import mkdir, execute
_log = logging.getLogger(__name__)
PDB_HEADER_FIELDS = ["Pocket Score",
... |
#!/usr/bin/python
# *****************************************************************************
#
# 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 A... |
import glob
import json
import pathlib
import subprocess
from decimal import Decimal
import numpy as np
import pandas as pd
import plotly.graph_objs as go
import plotly.offline as offline
import xmltodict as xd
# offline.init_notebook_mode()
ROOTDIR = "/home/jovyan/data/protein_pka"
pathlib.Path(f'{ROOTDIR}/result/... |
import argparse
import numpy as np
import os
import torch
from collections import Counter
from torchvision import datasets
import torch.nn.functional as F
# Utility functions
from codes.tasks.mnist import mnist, Net
from codes.utils import top1_accuracy, initialize_logger
# Attacks
from codes.attacks.labelflipping im... |
import math # for trig and constants
import scipy.spatial as sp # for fast nearest nearbour search
from numba import jit # for precompile speed up
# GSLIB's KB2D program (Deutsch and Journel, 1998) converted from the original Fortran to Python
# translated by <NAME>, th... |
"""Defines oauth endpoints"""
import os
import httplib2
import requests
import json
from flask import Blueprint, make_response, request, session
from flask import flash, redirect, url_for
from .. infrastructure import helper_methods
from oauth2client.client import flow_from_clientsecrets
from oauth2client.client impor... |
import pathlib
from tempfile import TemporaryDirectory
from unittest.mock import patch
import geopandas as gp
import pandas
import pytest
from shapely.geometry import Polygon
from gerrychain.graph import Graph
from gerrychain.graph.geo import GeometryError
@pytest.fixture
def geodataframe():
a = Polygon([(0, 0)... |
# Copyright (c) 2015-2019 The Botogram Authors (see AUTHORS)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... |
from datetime import datetime
import django_filters
import json
from django.db.models import Q
from rest_framework import serializers, viewsets, permissions, filters, status
from rest_framework.authentication import SessionAuthentication, TokenAuthentication
from rest_framework.decorators import action
from rest_frame... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from gv import *
from a2c_ppo_acktr.distributions import Bernoulli, Categorical, DiagGaussian
from a2c_ppo_acktr.utils import init
from copy import deepcopy
device = get_v('device')
class Flatten(nn.Module):
def forward(self, x):... |
"""Provenance module."""
import copy
import logging
import os
from netCDF4 import Dataset
from PIL import Image
from PIL.PngImagePlugin import PngInfo
from prov.model import ProvDerivation, ProvDocument
from ._version import __version__
logger = logging.getLogger(__name__)
ESMVALTOOL_URI_PREFIX = 'https://www.esmva... |
import sys
import config
import torch
import torchvision
import torchvision.transforms as transforms
from torch import Tensor, nn
sys.path.insert(0, "../..")
import os
import matplotlib.pyplot as plt
import numpy as np
from classifier_models import *
from dataloader import get_dataloader
from networks.models impor... |
import bpy
import os
import math
from sys import platform
if platform.startswith("linux"):
# linux
path = os.path.dirname(bpy.data.filepath)+"/"
if platform.startswith("darwin"):
# OS X
path = os.path.dirname(bpy.data.filepath)+"/"
if platform.startswith("cygwin") or platform.startswith("win32") or pla... |
from __future__ import print_function
import numpy as np
import chainer
from chainer.functions.evaluation import accuracy
from chainer.functions.loss import softmax_cross_entropy
from chainer import optimizers
import chainer.functions as F
import chainer.links as L
import matplotlib.pyplot as plt
import time
###### A... |
import discord
import re
from discord.ext.commands import Cog
from discord.ext import commands
from src.list_embed import ListEmbed
TRASH = u"\U0001F5D1"
OPEN_FOLDER = u"\U0001F4C2"
BOT_FACE = u"\U0001F916"
SHIELD = u"\U0001F6E1"
LOCK_KEY = u"\<KEY>"
SWORDS = u"\U00002694"
HAMMER_PICK = u"\U00002692"
HAMMER = u"\U000... |
import os
import subprocess
import shlex
from sys import stdin, exit
from argparse import ArgumentParser
from collections import defaultdict
from shared.utils import log_error, log_warning, file_path_from, subprocess_popen
major_contigs_order = ["chr" + str(a) for a in list(range(1, 23)) + ["X", "Y"]] + [str(a) for a... |
import numpy as np
from math import sqrt
import torch
import torch.nn as nn
class DPLinear(nn.Module):
def __init__(self, nested: nn.Linear):
super().__init__()
self.weight = nested.weight.detach()
self.bias = nested.bias.detach()
self.in_features = nested.in_features
sel... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:owefsad
# software: PyCharm
# project: lingzhi-webapi
import logging
import time
from dongtai.models.agent import IastAgent
from dongtai.models.project import IastProject
from dongtai.models.replay_queue import IastReplayQueue
from dongtai.models.vulnerablity impor... |
import time
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.metrics import precision_recall_fscore_support, pairwise_distances, pairwise
from sklearn.decomposition import LatentDirichletAllocation
from sklearn.preprocessing import normali... |
# WoodchoppererRL
# A tiny little wood-chopping game
# originally developed by: @eigenbom 2016
# linux port / updates: @tsquar3d 2016
from collections import deque
import math
import os
import sys
import threading
import time
import random
import termios, atexit
from select import select
# save the terminal settings... |
import logging
import threading
import itertools
from google.appengine.api import datastore
from django.conf import settings
from django.core.cache import cache
from django.core.signals import request_finished, request_started
from django.dispatch import receiver
from djangae.db import utils
from djangae.db.unique_ut... |
# -*- coding: UTF-8 -*-
'''Example script to generate text from Nietzsche's writings.
At least 20 epochs are required before the generated text
starts sounding coherent.
It is recommended to run this script on GPU, as recurrent
networks are quite computationally intensive.
If you try this script on new data... |
# Copyright 2020 Google LLC. 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... |
from __future__ import print_function
import argparse
from math import log10, sqrt
import time
import os
from os import errno
from os.path import join
import torch
import torch.nn as nn
import torch.optim as optim
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
from torch.utils.data import Dat... |
import pandas as pd
import numpy as np
import datetime as dt
import time, csv, os, itertools, shutil, json, random
import btalib
from itertools import compress
from PIL import Image
from sklearn.preprocessing import MinMaxScaler
def bool_convert(s):
"""
Parse string booleans from parameters
* :param ... |
"""
@file
@brief Machine Learning Post request
"""
import os
import sys
import json
import threading
import importlib
from datetime import datetime
# from filelock import Timeout, FileLock
from ..args.zip_helper import unzip_bytes
class AlreadyExistsException(Exception):
"""
Exception raised when a project al... |
from __future__ import absolute_import
from __future__ import division
# function to set path to current folder (py 2 to 3)
from builtins import str
from past.utils import old_div
def import_modify():
if __name__ == '__main__':
if __package__ is None:
import sys
from os import pat... |
#-----------------------------------------------------------------------------
# Name: ProgramAnalysis
# Purpose: To analyze and report on code
# Author: <NAME>
# Created: 4/10/2017
# License: MIT License
#-----------------------------------------------------------------------------
""" This modu... |
# -*- coding:utf-8 -*-
__author__ = 'shrprasha'
import itertools
import os
from collections import Counter
import nltk
import numpy
from keras.preprocessing import sequence
from keras.utils import np_utils
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
import math
import utils
... |
#!/usr/bin/env python
''' Simple script to auto-generate the README.md file for a 30 Seconds of C++ project.
Apply as a git hook by running the following command in linux:
cd .git/hooks/ && ln -s ../../createtil.py pre-commit && cd -
'''
from __future__ import print_function
import os
EMOJIS = {
"a... |
import os.path
from tkinter import *
from agents import *
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
loc_A, loc_B, loc_C, loc_D = (0, 0, 0), (1, 0, 0), (0, 1, 0), (1, 1, 0) # The two locations for the Vacuum world
class Gui(Environment):
"""This GUI environment has two locations, A and B. E... |
import random
import re
import copy
out_test_cn = None
out_test_en = None
out_generalization_cn = None
out_generalization_en = None
out_generalization3_cn = None
out_generalization3_en = None
c_tag_pattern = r'[\u3002\uff1b\uff0c\uff1a\u201c\u201d\uff08\uff09\u3001\uff1f\u300a\u300b]'
c_tag_com = re.compile(c_tag_patt... |
""" This file contains configuration defaults, options parsing, and config
file code.
"""
import argparse
import ipaddress
import os
import socket
import sys
from . import bandguards
from . import rendguard
from . import vanguards
from . import control
from . import logger
from .logger import plog
try:
from co... |
import sys
import csv
import gzip
import zlib
import logging
from io import BytesIO
from functools import wraps
from datetime import datetime
import xml.etree.ElementTree as ET
try: # Python 3
from itertools import zip_longest
except ImportError: # Python 2
from itertools import izip_longest as zip_longest
... |
import os
from pathlib import Path
from typing import Tuple, Union
import hashlib
import struct
import logging
import time
import asyncio
# The default file name and location
# The default location is in the same directory as this python module
DEFAULT_DIR: Path = Path(os.path.dirname(os.path.abspath(__file__)))
DEF... |
import matplotlib
matplotlib.use('Agg')
from scipy.interpolate import interp1d
from locker import analysis as ana, colordict
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from scripts.config import params as plot_params, FormatedFigure
from mpl_toolkits.axes_grid1.inset_l... |
import os
import sys
import operator
import collections
import functools
import stat
from ctypes import (
POINTER,
byref,
cast,
create_unicode_buffer,
create_string_buffer,
windll,
)
from ctypes.wintypes import LPWSTR
import nt
import posixpath
import builtins
from jaraco.structures import bina... |
import os, base64
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save, m2m_changed
from django.db.utils import DatabaseError
from fabric.api import env, run, hide, settings
import fabric.exceptions
from fabric.network import disconnect_all
from django.... |
import unittest
import dbt.main as dbt
import os, shutil
import yaml
import time
import json
from dbt.adapters.factory import get_adapter
from dbt.logger import GLOBAL_LOGGER as logger
DBT_CONFIG_DIR = os.path.abspath(
os.path.expanduser(os.environ.get("DBT_CONFIG_DIR", '/root/.dbt'))
)
DBT_PROFILES = os.path.... |
# imports for file
from flask import Flask, render_template, redirect, request, url_for, flash, session
import os
# imports for forms
from flask_wtf import FlaskForm
from wtforms.validators import DataRequired, Email, EqualTo, ValidationError, Length
from wtforms import StringField, SubmitField, PasswordField, Boolean... |
# -*- coding: utf-8 -*-
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
# The MIT License (MIT)
# Copyright (c) 2022 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modi... |
import sys
from csv import reader
import numpy as np
#Function to read csv file
def load_csv(filename):
dataset = list()
with open(filename, 'r') as file:
csv_reader = reader(file)
for row in csv_reader:
if not row:
continue
dataset.append(row... |
from importlib import reload
from unittest.mock import call, patch
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase, TransactionTestCase, override_settings, \
modify_settings
from ... |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.