text stringlengths 3.07k 12.6k |
|---|
# Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug
# Copyright: (c) <<EMAIL>>
# Released under the MIT License.
from django.views.generic import View
from django_redis import get_redis_connection
from apscheduler.triggers.cron import CronTrigger
from apps.schedule.models import Task, History
from ... |
from difflib import HtmlDiff
from django.shortcuts import get_object_or_404, render_to_response, redirect
from django.http import HttpResponseForbidden
from django.conf import settings
from django.views.decorators.http import require_POST
from django.contrib.auth.decorators import login_required, user_passes_test
from ... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
#!/usr/bin/env python3
import atexit
import struct
import random
import sys
import threading
import socket
import termios
from select import select
PORT = 13117
BUFFER_SIZE = 4096
TEAM_NAME = f"2pack\n"
UTF8_ENCODE = 'utf-8'
SOCKET_LIST = []
ACTIVE_CONNECTION = 0
stop_threads = False
import os
os.system("")
# Grou... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import logging
from clickhouse_mysql.pool.pool import Pool
from clickhouse_mysql.objectbuilder import ObjectBuilder
from pymysqlreplication.row_event import WriteRowsEvent, UpdateRowsEvent, DeleteRowsEvent
# Buckets Belts' Index Generator
class BBIndexGenera... |
#!/usr/bin/python
# Copyright: (c) 2020, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
... |
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
import sys, unittest
from django.utils.importlib import import_module
def geo_suite():
"""
Builds a test suite for the GIS package. This is not named
`suite` so it will not interfere with the Django test suite (since
spatial database tables are required to execute these tests on
some backends).
... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# __author__ = Lyon
from base.auth import login_required
from api.status import Code, Message
from utils.fundutil import FundData
from apps.users.trade import TradeRecord
from docs import RequestHandler, define_api, Param
class FundSurvey(RequestHandler):
@define_api(... |
"""Data models for the Forecast.Solar API."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import datetime, timedelta, date
from enum import Enum
from typing import Any
import sys
if sys.version_info[:2] >= (3, 9):
import zoneinfo
else:
from backports import zoneinfo
fro... |
from django.contrib import admin, messages
from django.contrib.auth.admin import UserAdmin
from django.http import HttpResponse, HttpResponseRedirect
from django.urls import reverse
from django.utils.html import format_html
from django.utils.translation import gettext as _
from researcher_workspace.models import Permi... |
"""
A collection of function that detect and analyse an article
"""
import json
import sys
import re
import os
def features_detection(word):
"""
Detect features in a word. Features come from the pattern.json in the resources directory
:param word: the word to operate on.
:return: the list of features... |
# ------------------------------------------------------------------------------
# Hippocampus segmentation published by Dryad
# (https://datadryad.org/stash/dataset/doi:10.5061/dryad.gc72v)
# ------------------------------------------------------------------------------
import os
import SimpleITK as sitk
import mp.... |
from .base import BaseMatcher
from .base_simstring import BaseSimstring
from ..database import ElasticsearchDatabase
from typing import (
Any,
List,
Dict,
Tuple,
Union,
Iterable,
)
__all__ = [
'ElasticsearchSimstring',
'ElasticsearchFuzzy',
]
class ElasticsearchSimstring(BaseSimstrin... |
import os
import csv
import sqlite3
import threading
# XXX (orainha) How to use "threading" word here?
from threading import *
from bs4 import BeautifulSoup
import utils.files as utils
# XXX (ricardoapl) Fix this non-pythonic mess!
CONTACTS_TEMPLATE_FILE_PATH = os.path.join(os.path.dirname(__file__), r'..\templat... |
'''
@author: <NAME>
@summary: A module to perform batch request processing.
'''
from __future__ import absolute_import, unicode_literals
import json
import logging
from datetime import datetime
import six
from concurrent.futures import TimeoutError
from django.conf import settings
from django.http.response import (
... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Miscellaneous utility functions
"""
from __future__ import print_function, unicode_literals, division, absolute_import
from future import standard_library
standard_library.install... |
import threading
import random
import time
import os
from ffpyplayer.player import MediaPlayer
import playsound
import plyer
from youtube_dl import YoutubeDL
streams = [
"https://www.youtube.com/watch?v=grBFMP3HDZA",
"https://www.youtube.com/watch?v=RDbvC5I9wtw",
"https://www.youtube.com/watch?v=sca4VG9b0... |
''' one_line_description
DESCRIPTION:
Insert a paragraph-long description of the module here.
FUNCTIONS:
This module contains the following (main) functions:
* fun_name : one_line_description
(only add user-facing ones)
'''
import numpy as np
import matplotlib as mpl
import matplotlib.colors
imp... |
from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7
# Importing the Kratos Library
import KratosMultiphysics
from KratosMultiphysics.json_utilities import read_external_json, write_external_json
# Importing the base class
from KratosMul... |
import sys
import logging
import os
from scipy.stats.mstats import *
from optparse import OptionParser
import pysam
from Poperalib.FRegion import *
from Poperalib.Hotspot import *
from Poperalib.hotspotscount import *
from Poperalib.bgcount import *
# from Poperalib.peakcount import *
from Poperalib.pope... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2018 Red Hat
# Copyright © 2014-2016 eNovance
#
# 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
#
#... |
# core/operators/_affine.py
"""Classes for operators that depend affinely on external parameters, i.e.,
A(µ) = sum_{i=1}^{nterms} θ_{i}(µ) * A_{i}.
"""
__all__ = [
"AffineConstantOperator",
"AffineLinearOperator",
"AffineQuadraticOperator",
# AffineCrossQuadraticOperator",
"AffineCubicOperator... |
# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import json
import os
import re
from mock import MagicMock
from pyVmomi import vim
from requests import Response
from six import iteritems
from tests.common import HERE
from datadog_checks.vsphere.api import V... |
from flee import pflee
from flee.datamanager import handle_refugee_data
from flee.datamanager import DataTable # DataTable.subtract_dates()
from flee import InputGeography
import numpy as np
import flee.postprocessing.analysis as a
import sys
import argparse
import time
import os
def date_to_sim_days(date):
retu... |
from typing import Any, Callable, List, Mapping, NamedTuple, Optional
from snorkel.preprocess import BasePreprocessor
from snorkel.preprocess.nlp import EN_CORE_WEB_SM, SpacyPreprocessor
from .core import LabelingFunction, labeling_function
class SpacyPreprocessorParameters(NamedTuple):
"""Parameters needed to ... |
# Must plug in DC power to Lolin V3 board, to power its 3.3V and 5V rail to external devices like LCD/keypad.
# Dependency: This file reads config.json at same folder.
from time import sleep_ms, sleep
import gc
import mpr121
from convert_seconds_to_minutes_and_seconds import convert_seconds_to_minutes_and_seconds
from ... |
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# 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 applica... |
# Copyright (c) 2012 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.
"""Finds desktop browsers that can be controlled by telemetry."""
import logging
import os
import subprocess
import sys
from telemetry.core import brows... |
import datetime
import enum
from Swag import db
class Category(enum.Enum):
Shirts = 1
Sweatshirts = 2
Glassware = 3
Stickers = 4
Misc = 5
class PaymentMethod(enum.Enum):
Cash = 1
Check = 2
Venmo = 3
Paypal = 4
Card = 5
Online = 6
class SizeOptions(enum.Enum):
Stand... |
# Copyright 2019 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
#
# Unless required by applica... |
"""
<NAME>
camera.py
Construct a camera matrix and apply it to project points onto an image plane.
___
/ _ \
| / \ |
| \_/ |
\___/ ___
_|_|_/[_]\__==_
... |
import json
import requests
from six import integer_types, iteritems
from six.moves import xrange
import strongarm
class StrongarmException(Exception):
"""
An error occured in stronglib.
"""
class StrongarmHttpError(StrongarmException):
"""
The strongarm.io API responded with an HTTP error co... |
"""CIFAR10
****************************************
This is a dataset of 50,000 32x32 color training images and 10,000 test
images, labeled over 10 categories. See more info at the
`CIFAR homepage <https://www.cs.toronto.edu/~kriz/cifar.html>`_
The classes are:
- airplane
- automobile
- bird
- cat
- deer
- dog
-... |
import asyncio
import importlib
import sys
import traceback
import warnings
from fastapi import FastAPI, Request
from fastapi.exceptions import RequestValidationError
from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.gzip import GZipMiddleware
from fastapi.staticfiles import StaticFiles
from f... |
"""The main parsing routine."""
import logging
import argparse
import sys
import re
from .common import (
PARAM_KEYWORDS,
RETURN_KEYWORDS,
Docblock,
DocblockParam,
DocblockReturns,
ParseError,
)
from .generator import Generator
# Set up the logger
logger = logging.getLogger("jdp")
# Use a consol... |
"""Template callable unit test module.
Use this module as an example/template to write unit tests for general (see: non-core),
callable (e.g., functions, basic classes) features of Iron Onyx (IRON).
If you decide to separate your test class and Test Cases into separate modules within this
package, ensure the Test Case... |
"""
Exports various resources as data maps.
"""
import csv
from datetime import datetime
from typing import Dict, List, Tuple, Set
from fidesctl.core.api_helpers import get_server_resources
from fidesctl.core.utils import echo_green, get_all_level_fields
def export_to_csv(
list_to_export: List, resource_exporte... |
# Copyright 2019 The Magenta 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 or agreed to in ... |
#1.soru
print("katma deger ciro hesaplama")
tsm=int(input("toplam satis miktarinizi giriniz:"))
hm=int(input("hammadde maliyetinizi giriniz:"))
bog=int(input("bakim onarim maliyetinizi giriniz:"))
sg=int(input("sevkiyat giderlerinizi giriniz:"))
sahg=int(input("satin alinan hizmet giderlerinizi giriniz:"))
def k... |
import os
import pymates.fonts
from pymates.dom import DocumentNode, ParagNode, StyleNode, SpanNode, MathNode, inline
from pymates.lom import Alignment
def document():
return DocumentNode(document)
def pagesize(size):
return style(pageSize=size)
@inline("counters")
def counter(node, counterFmt, refFmt, *name... |
import pygame
import random
import game_object
# Defining colors
WHITE = (255, 255, 255)
RED = (255, 0, 0)
# Defining game properties
TITLE = "Survival"
WIDTH = 640
HEIGHT = 480
UPDATES_PER_SEC = 60 # Updates per second
TICK_TIME = 0.5 # Seconds per tick
# Initiating the window
pygame.init()
screen_size = (WIDTH,... |
import tensorflow as tf
import matplotlib.pyplot as plt
# MNIST dataset parameters.
num_classes = 10 # 0 to 9 digits
num_features = 784 # 28*28
# Training parameters.
learning_rate = 0.001
training_steps = 1000
batch_size = 256
display_step = 100
# Network parameters.
n_hidden_1 = 128 # 1st layer number of neurons.
... |
from torch.utils.data import Dataset
import os
import scipy.io as sio
import numpy as np
import matplotlib.pyplot as plt
import h5py
import pandas as pd
import random
from scipy.io import loadmat
import Utils
from scipy import interpolate
from scipy import signal
import csv
from scipy.signal import butter, lfilter, fre... |
#!/usr/bin/env python
"""
Author: <NAME>
Scrape the Malaysian Food Composition Database
"""
# This code retrieves a .csv and json with all entries in the Malaysian Food Composition Database.
## import statements
import textwrap
import json
import requests
import re
import pandas as pd
import time
# Define variable... |
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from sklearn.exceptions import NotFittedError
from sklearn.base import clone
from sklearn.linear_model import LinearRegression, Lasso
from sklearn.model_selection import KFold
REQUIRED_COLS = ['start_date', 'lat', 'lon', 'gt']
def _get_rmse(... |
"""Map of NASS Progress Data"""
import datetime
from collections import OrderedDict
import pandas as pd
from pandas.io.sql import read_sql
from pyiem.plot.use_agg import plt
from pyiem.plot.geoplot import MapPlot
from pyiem.util import get_autoplot_context, get_dbconn
PDICT = OrderedDict((
('corn_silking', 'Perce... |
from moz_sql_parser import parse
import json
import sys
# import the logging library
import logging
# Get an instance of a logger
logger = logging.getLogger(__name__)
hdlr = logging.FileHandler('./main/logs/application.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(form... |
#!/usr/bin/env python
"""
Parses the CMake files in a ROS installation directory (eg /opt/ros/melodic)
and produces bazel files to import each catkin package with the right
dependency information.
"""
import argparse
import glob
import os
import re
def _read_file_lines(fp):
with open(fp) as f:
lines = [l... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List
import numpy as np
import torch
from pytext.models.representations.transformer import (
TransformerLayer,
MultiheadSelfAttention,
)
from pytext.models.roberta import RoBERTaEncoder
from torch... |
"""プロジェクト構成ファイルを解析して EntityBucket を生成するモジュール"""
import yaml
from dialogapi.server import Server
from dialogapi.server import Endpoint
from dialogapi.entity import Project
from dialogapi.entity import Bot
from dialogapi.entity import AIML
from dialogapi.entity import Set
from dialogapi.entity import Map
from dialogapi... |
# Python access to gpio's via /dev/gpiochip* devices.
# Note gpio state will not be retained when the program exits, use gpio_sysfs
# if you need that.
from __future__ import print_function
import os, fcntl, glob
from ctypes import *
# For debug, dump ctypes.Structure
# def dump(struct):
# bytes=map(ord,memoryvi... |
#!/usr/bin/env python
# Author: <NAME>
# Date: 7/11/2005
#
# This is a tutorial to show some of the more advanced things
# you can do with Cg. Specifically, with Non Photo Realistic
# effects like Toon Shading. It also shows how to implement
# multiple buffers in Panda.
from direct.showbase.ShowBase import ShowBase
f... |
# coding: utf-8
# In[1]:
import math
import torch
from torch.nn.parameter import Parameter
import torch.nn.functional as F
import torch.nn as nn
Module = nn.Module
import collections
from itertools import repeat
# In[2]:
def _ntuple(n):
def parse(x):
if isinstance(x, collections.Iterable):
... |
from collections import OrderedDict
from levenshteinDistance import levenshtein as ld
#------------------------
# shared variables:
#------------------------
words = OrderedDict()
words['Eng'] = ''
words['Ger'] = ''
words['Mal'] = ''
words['Kor'] = ''
words['Swa'] = ''
outputFilename = 'output.txt'
allophones = {
... |
#!/usr/bin/env python3
import sys, os, logging, argparse, boto3, socket, textwrap
from yaml import safe_load
from urllib.parse import urlparse
from socket import gethostname as ghn
__version__ = '0.1'
try:
import coloredlogs
coloredlogs.install(
isatty = True,
show_name = False,
show_se... |
# coding=utf-8
import random
import rdkit.Chem as rkc
from rdkit.Chem import AllChem
from rdkit.Chem import MolStandardize
from rdkit.Chem import SaltRemover
from rdkit.Chem import rdmolops
def disable_rdkit_logging():
"""
Disables RDKit whiny logging.
"""
import rdkit.RDLogger as rkl
logger = r... |
import numpy as np
import pandas as pd
class Simulation:
''' Simulate a process of randomly selecting one of N coins, flipping the
selected coin a certain number of times, and then repeating this a few times
'''
def __init__(self,
n_sequences=10,
n_reps_per_sequence=7... |
#!/usr/bin/env python
# ase.py
# Created by <NAME> on 2017-09-12.
# Email: <EMAIL>
# Copyright (c) 2017. All rights reserved.
import numpy as np
from typing import Sequence, TypeVar, Union, Dict
import networkx
import os
from scipy.stats import norm
from scipy.stats import rankdata
from sklearn.decomposition import... |
import sys, os, pytest
sys.path.append('.')
import submit
output_worked = 'Your submission has been accepted and will be graded shortly.'
from io import StringIO
class TestCorrectMetadata:
def test_001(self):
meta_data = submit.load_metadata('test/_coursera')
assert len(meta_data.part_data) == ... |
import os
import sys
TRASH = [
'bottle',
'cup',
'fork',
'knife',
'spoon'
'banana',
'apple',
'sandwich',
'orange',
'broccoli',
'carrot',
'hot dog',
'pizza',
'donut',
'cake'
]
YOLO_PATH = os.path.join(sys.path[0], 'yc')
IMAGE_PATH = os.path.join(sys.path[0]... |
import os
import sys
import PIL
import math
import time
import json
import random
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import torch
import torchvision
from pathlib import Path
from PIL import Image, ImageOps, ImageFilter
from torch import nn, optim
from torchvision import transforms,... |
#!/usr/bin/env python
# wujian@2019
import argparse
import numpy as np
from libs.ssl import ml_ssl, srp_ssl, music_ssl
from libs.data_handler import SpectrogramReader, NumpyReader
from libs.utils import get_logger, EPSILON
from libs.opts import StftParser, str2tuple
logger = get_logger(__name__)
def add_wta(mas... |
# MIT License
#
# Copyright (c) 2020 <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 the rights
# to use, copy, modify, merge, publi... |
import pdb
from datetime import datetime
import pandas as pd
from shapely.geometry import LineString, Point
from shapely import wkb
import psycopg2
from psycopg2.extras import execute_values
#from postgis.psycopg import register
#from postgis import Point
class PostgresInterface(object):
def __init__(self, dbname... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... |
from django.db import models
from django.contrib.auth.models import User
from django.db.transaction import atomic
from django.conf import settings
from autoslug import AutoSlugField
from taggit.managers import TaggableManager
from categories.models import Category
from django.utils.timezone import now
from django.utils... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import glob
import logging
import re
import subprocess
import tempfile
from datetime import datetime as dt
from string import Template
class TaskFailedException(Exception):
pass
class TempDirIsFileException(Exception):
pass
class Tas... |
import logging
from dataclasses import dataclass
from pathlib import Path
from typing import Iterable, Optional, Sequence
from moviepy.editor import (
CompositeVideoClip, TextClip, VideoFileClip, concatenate_videoclips,
)
from moviepy.video.tools.subtitles import SubtitlesClip
from video_composer.meta import Clip... |
'''
Author: HaoZhang-Hoge<EMAIL>
Date: 2021-12-29 04:08:23
LastEditTime: 2022-03-26 07:54:58
LastEditors: Please set LastEditors
Description:
FilePath: /Aurora/type.py
'''
import math
num_region = 8 # MLC
region_add_bit = int(math.log2(num_region))
swap_region = 3 # SLC
print("The num_region is "+str(num... |
"""Contains interfaces for package tools executor."""
import os
import sys
from enum import Enum
import click
from termcolor import colored
from punish.style import AbstractStyle
from pypans import __version__
from pypans.file import Template
from pypans.project import Line, Project, User # noqa: I100
class _Emoji(E... |
#
# Copyright (C) 2000-2005 by <NAME> (<EMAIL>)
#
# Jockey 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; either version 2, or (at your option) any
# later version.
#
# Jockey is distributed in the hope that... |
"""Base class for testing file translation"""
import unittest
import os
import json
import argparse
import sys
import subprocess
import re
import chardet
sys.path.append('../..')
import vb2py.parserclasses
import vb2py.conversionserver
#
# Private data hiding may obscure some of the testing so we turn it off
impo... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from collections import Counter
from maskrcnn_benchmark.layers.misc import Conv2d
from maskrcnn_benchmark.layers import FrozenBatchNorm2d
class h_sigmoid(nn.Module):
def __init__(self, inplace=True):
super(h_sigmoid, se... |
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
# %%
# Update link drive shedule and links files for MOVES analyses
# This is an extra step because of grade calculation error we had
# <NAME>, Ph.D. Candidate
# %%
# Load required libraries
import pandas as pd
import numpy as np
from os import walk
# %%
# Load data from Excel to a pandas dataframe
def load_from_Exc... |
"""
https://github.com/google/microscopeimagequality/blob/main/microscopeimagequality/prediction.py
"""
import logging
import sys
import numpy
import tensorflow
import cytokit.miq.constants
import cytokit.miq.evaluation
# logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
_SPLIT_NAME = 'test'
_TFRECORD_F... |
import os
import pytrec_eval
import numpy as np
from capreolus.utils.loginit import get_logger
from capreolus.searcher import Searcher
logger = get_logger(__name__)
VALID_METRICS = {"P", "map", "map_cut", "ndcg_cut", "Rprec", "recip_rank", "set_recall"}
CUT_POINTS = [5, 10, 15, 20, 30, 100, 200, 500, 1000]
def _v... |
import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import kornia
from codes.models.resnet import resnet18
import matplotlib
from codes.models.region_proposal_network import RegionProposalNetwork
import cv2
from codes.EX_CONST import Const
import matplotlib.pyplot as plt
mat... |
# -*- coding: utf-8 -*-
import pandas as pd
import matplotlib.pyplot as plt
from collections import Counter
import codecs
import chardet
f = open(".txt","w",encoding='utf-8')
DATA_FILE = "GamerGate_processed.json"
# Build a JSON array
data = "[{0}]".format(",".join([l for l in open(DATA_FILE,encoding='utf-8').readline... |
# -*- coding: UTF-8 -*-
# Copyright 2013-2016 <NAME>
#
# License: BSD (see file COPYING for details)
"""Adds feedback-based workflow to :mod:`lino_xl.lib.cal`.
Used e.g. by :ref:`welfare`.
"""
from __future__ import unicode_literals
import logging
logger = logging.getLogger(__name__)
from django.utils.translation... |
from dataclasses import dataclass
from datetime import date, datetime
import mysql.connector
from mock import call
from mysql.connector import DatabaseError, Error, InterfaceError
from pytest import fixture, mark, raises
from nova_api.entity import Entity
from nova_api.persistence.mysql_helper import MySQLHelper
@d... |
import os
import math
from wand.api import library
import wand.color
import wand.image
def create_inner_bbox(
box_height=200,
box_width=200,
box_x=1,
box_y=1,
box_stroke_width=2,
bbox_stroke_width=2,
bbox_color="#232666",
bbox_r=2,
xml_id="",
):
stroke_tot... |
import os
import time
import logger
import random
import tensorflow as tf
import gym
import numpy as np
from collections import deque
from config import args
from utils import set_global_seeds, sf01, explained_variance
from agent import PPO
from env_wrapper import make_env
def main():
env = make_env()
set_gl... |
import hashlib
# import bitcoin
import binascii
import base58
from time import time
from common import globall as G
from common.ellipticcurve.privateKey import PrivateKey
from common.ellipticcurve.publicKey import PublicKey
from common.ellipticcurve.signature import Signature
from common.ellipticcurve.ec... |
#!/usr/bin/python
# Copyright (c) 2020, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
"""Provide Module Description
"""
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
__author__ = ["<NA... |
# ------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# -------------------------------------------------------------------... |
import hashlib
import json
from flask import Flask, jsonify, request
import requests
from uuid import uuid4
from urllib.parse import urlparse
import jsonpickle
# create the class block to maintain the block information
class Block(object):
def __init__(self, block_id, block_data, block_prev_hash, p... |
from collections import Counter, defaultdict
import csv
import json
import os
import random
import sys
from time import time
from metal.contrib.info_extraction.mentions import RelationMention
from metal.contrib.info_extraction.utils import mark_entities
import numpy as np
import torch
from scipy.sparse import issparse... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
"""
algorithms
Created by: <NAME>
On: 1/26/20, 5:43 PM
"""
from abc import ABC
import torch
import pandas as pd
from drugex.api.agent.agents import DrugExAgent as DrugExAgentTrainer
from drugex.api.agent.policy import PG
from drugex.api.corpus import Corpus, DataProvidingCorpus
from drugex.api.environ.models import ... |
from typing import List, Tuple
import helper
import inputHelper
from puzzleBase import PuzzleBase
CardList = List[int]
Const_Player1: str = "Player 1"
Const_Player2: str = "Player 2"
class InputData:
expectedAnswer: int
player1Deck: CardList
player2Deck: CardList
def __init__(self, name: str... |
# -*- test-case-name: twisted.test.test_strports -*-
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
#
"""Port description language
This module implements a description mini-language for ports, and provides
functions to parse it and to use it to directly construct appropriate
networ... |
"""
Generate a fully specified benchmark configuration file, given a lightweight
specification and a complete source of benchmark data.
Specification File
------------------
Score hierarchy input intended to be as easy to construct as possible,
relying on automatic inference of unspecified weights, benchmark configs,
... |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 18 22:59:59 2020
@author: CS
Check the read-me file for a in-depth summary of the problem
"""
import numpy as np
import sys
sys.path.append('..')
import TrussAnalysis as ta
class environment:
"""
The enviroment will act as a container for the data in the probl... |
# -*- coding: UTF-8 -*-
from django.http import HttpResponseRedirect
from datetime import datetime
from django.core.urlresolvers import reverse
from meregistro.shortcuts import my_render
from apps.seguridad.decorators import login_required, credential_required
from apps.seguridad.models import Usuario, Perfil
from app... |
import tensorflow as tf
import tensorflow.python.keras.backend as K
import numpy as np
from dataset_utils import NUM_HEADING_BIN
from paz.optimization.losses.frustumpointnet_loss import ExtractBox3DCorners
class frustum_data_loader(object):
def __init__(self, batch_size=32):
# g_type_object_of_interest =... |
from games.abstract_state import GameState, ArraySlice
from utils import np_one_hot, one_hot_to_int, one_hot_arrays_to_list_of_ints
import numpy as np
from numba import jit
@jit(nopython=True)
def extract_tricks(full_state, first_row, num_played_cards):
finished_tricks = max(0, (num_played_cards - 1) // 3)
fi... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
# coding: utf8
# Functions used by nipype interface.
# Initiate the pipeline
def init_input_node(pet):
from clinica.utils.filemanip import get_subject_id
from clinica.utils.ux import print_begin_image
# Extract image ID
image_id = get_subject_id(pet)
print_begin_image(image_id)
return pet
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.