filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_25859 | from pathlib import Path
import pytest
from poetry.core.factory import Factory
from poetry.core.toml import TOMLFile
fixtures_dir = Path(__file__).parent / "fixtures"
def test_create_poetry():
poetry = Factory().create_poetry(fixtures_dir / "sample_project")
package = poetry.package
assert package.n... |
the-stack_106_25860 | import os
from os import path
from setuptools import find_packages, setup
VERSION = "0.5.1"
INSTALL_REQUIRES = [
"Django>=2.2.9,<3",
"bleach==3.1.4",
"bleach-whitelist>=0.0.10",
"cryptography>=2.7",
"django-after-response>=0.2.2",
"django-bootstrap4>=0.0.7",
"djangorestframework>=3.9.2",
... |
the-stack_106_25861 | """
Test the session save feature
"""
import os
import tempfile
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class SessionSaveTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def raw_transcript_builder(self, cmd, r... |
the-stack_106_25863 | import torch
from torch.nn import Linear as Lin
from torch.nn import ReLU
from torch.nn import Sequential as Seq
from torch_geometric.nn import GlobalAttention
def test_global_attention():
channels, batch_size = (32, 10)
gate_nn = Seq(Lin(channels, channels), ReLU(), Lin(channels, 1))
nn = Seq(Lin(channe... |
the-stack_106_25864 | # Copyright (c) 2021 PaddlePaddle 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 appli... |
the-stack_106_25866 | import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
# Device configuration
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
# Hyper-parameters
sequence_length = 28
input_size = 28
hidden_size = 128
num_layers = 2
num_classes = 10
batch_size = 100
nu... |
the-stack_106_25867 | from datetime import datetime
from decimal import Decimal
import numpy as np
import pytest
from pandas._config import config as cf
from pandas._libs import missing as libmissing
from pandas._libs.tslibs import iNaT, is_null_datetimelike
from pandas.core.dtypes.common import is_scalar
from pandas.core.dtypes.dtypes ... |
the-stack_106_25868 | # This work is based on original code developed and copyrighted by TNO 2020.
# Subsequent contributions are licensed to you by the developers of such code and are
# made available to the Project under one or several contributor license agreements.
#
# This work is licensed to you under the Apache License, Version 2... |
the-stack_106_25871 | import logging
import psycopg2
import psycopg2.extras
import socket
import sys
import time
from cluster_under_test import *
class DbRetriable:
"""
Wrapper around psycopg2, which offers convenient retry functionality.
If connection to postgres is lost during query execution or between
queries, retry wi... |
the-stack_106_25873 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import warnings, os, pickle, argparse, multiprocessing, logging
from statsmodels.tools.sm_exceptions import ConvergenceWarning
import yaml
import recommender_config
warnings.simplefilter('ignore', ConvergenceWarning)
warnings.simplefilter('ignore',... |
the-stack_106_25875 | # pylint: skip-file
import inspect
from typing import List, Optional
import lark
from WDL.Error import SourcePosition
from WDL import Error as Err
from WDL import Tree as D
from WDL import Type as T
from WDL import Expr as E
common_grammar = r"""
?literal: "true"-> boolean_true
| "false" -> boolean_false
... |
the-stack_106_25876 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Common Python library imports
import enum
# Pip package imports
from flask import Blueprint, current_app, make_response
from flask.json import dumps, JSONEncoder as BaseJSONEncoder
from flask.views import MethodViewType
from flask_restful import Api as BaseApi
from flas... |
the-stack_106_25877 | #!/usr/bin/env python
#--coding:utf-8 --
"""
2018-03-08: modified default minPts to 3
2018-03-13: mode added for pre-set parameters
2018-03-26: modified cut option , removed
"""
__author__ = "CAO Yaqiang"
__date__ = ""
__modified__ = ""
__email__ = "caoyaqiang0410@gmail.com"
__version__ = "0.93"
#sys library
import o... |
the-stack_106_25883 | #!/usr/bin/python3
# Copyright 2022. FastyBird s.r.o.
#
# 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 re... |
the-stack_106_25885 | import atexit
import functools
import os
import shutil
import tempfile
import time
from copy import deepcopy as _deepcopy
from taichi._lib import core as _ti_core
from taichi._lib.utils import locale_encode
from taichi.lang import impl
from taichi.lang.expr import Expr
from taichi.lang.impl import axes
from taichi.lan... |
the-stack_106_25886 | from numpy.lib.shape_base import take_along_axis
from suzieq.poller.services.service import Service
from suzieq.utils import convert_macaddr_format_to_colon, expand_ios_ifname
import re
import numpy as np
class LldpService(Service):
"""LLDP service. Different class because of munging ifname"""
def _common_da... |
the-stack_106_25887 | import json
import numpy as np
import gym
from gym import spaces
from game.simulator import Simulator
class LilysGardenEnv(gym.Env):
def __init__(self, level: int = 1, **kwargs):
"""The gym environment for Lily's Garden.
Example of starting env: env = gym.make('lg-v0', level=1)
Paramet... |
the-stack_106_25888 | # Copyright 2018 Capital One Services, 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... |
the-stack_106_25889 | # Copyright (c) ByteDance, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
"""
Copy-paste from mmcv library:
https://github.com/open-mmlab/mmcv/
"""
import os.path as osp
import time
import mmcv
i... |
the-stack_106_25890 | """SQL io tests
The SQL tests are broken down in different classes:
- `PandasSQLTest`: base class with common methods for all test classes
- Tests for the public API (only tests with sqlite3)
- `_TestSQLApi` base class
- `TestSQLApi`: test the public API with sqlalchemy engine
- `TestSQLiteFallbackApi`: t... |
the-stack_106_25891 | ##############################################################################
#
# Copyright (c) 2012 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... |
the-stack_106_25892 | # Copyright 2016 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... |
the-stack_106_25893 | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Xinlei Chen
# --------------------------------------------------------
"""Compute minibatch blobs for training a Fast R-CNN ne... |
the-stack_106_25899 | import pandas as pd, os.path as path
import numpy as np
import os
setting_folder=r'./results/'
fns=os.listdir(setting_folder)
transfer_type = '_gen_feat'
#transfer_type = '_None'
all_label = []
all_pred = []
for item in fns:
if item != 'rd_idx':
pred = np.load(setting_folder + item + '/... |
the-stack_106_25901 | # --------------------------------------------------------------------
# Copyright (c) iEXBase. All rights reserved.
# Licensed under the MIT License.
# See License.txt in the project root for license information.
# --------------------------------------------------------------------
import binascii
import codecs
impo... |
the-stack_106_25903 | """Tests that ensure the dask-based fit matches.
https://github.com/DEAP/deap/issues/75
"""
import unittest
import nose
from sklearn.datasets import make_classification
from tpot import TPOTClassifier
try:
import dask # noqa
import dask_ml # noqa
except ImportError:
raise nose.SkipTest()
class TestDa... |
the-stack_106_25904 | from typing import Optional
import discord
class DropdownSelect(discord.ui.Select['DropdownView']):
def __init__(self, options: list[discord.SelectOption], placeholder: str):
super().__init__(
placeholder=placeholder,
min_values=1,
max_values=1,
options=opt... |
the-stack_106_25905 | import hassapi as hass
import requests
import xml.etree.ElementTree as ET
from datetime import datetime, timedelta
"""
Get detailed Yr weather data
Arguments:
- event: Entity name when publishing event
- interval: Update interval, in minutes. Must be at least 10
- source: Yr xml source
- hours: Number of hours t... |
the-stack_106_25907 | #!/usr/bin/env python
#
# Copyright (c) 2014, 2016 Apple Inc. All rights reserved.
# Copyright (c) 2014 University of Washington. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributio... |
the-stack_106_25909 | # Tempest documentation build configuration file, created by
# sphinx-quickstart on Tue May 21 17:43:32 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have... |
the-stack_106_25912 | from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from rest_framework import status
from rest_framework.generics import GenericAPIView
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from auction_api.models import Auction
from auction_api.se... |
the-stack_106_25914 |
import numpy as np
import scipy as sp
import logging
import osr
import ogr
import gdal
from shapely.geometry import Polygon
from biopal.agb.processing_AGB import (
check_intersection,
interp2d_wrapper,
merge_agb_intermediate,
compute_processing_blocs_order,
)
# %%
def sample_and_tabulate_data(
bl... |
the-stack_106_25916 | #!/usr/bin/env python
# coding: utf-8
# Copyright (c) cccs-is.
# Distributed under the terms of the Modified BSD License.
import pytest
from ipykernel.comm import Comm
from ipywidgets import Widget
class MockComm(Comm):
"""A mock Comm object.
Can be used to inspect calls to Comm's open/send/close methods.
... |
the-stack_106_25918 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
the-stack_106_25919 | __version__ = '4.14.0'
def setup(app):
# We can't do the import at the module scope as setup.py has to be able to
# import this file to read __version__ without hitting any syntax errors
# from both Python 2 & Python 3.
# By the time this function is called, the directives code will have been
# ... |
the-stack_106_25922 | #!/usr/bin/env python3
# coding: utf-8
from src.lappy.models.well import Well
from src.lappy.models.point import Point
from src.lappy.models.pointPair import PointPair
from src.lappy.models.vector import Vector
from src.lappy.services import geom_oper, vect_oper, geom_numpy
from src.lappy.services import well_track_se... |
the-stack_106_25925 | # -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @tantrumdev wrote this file. As long as you retain this notice you
# can do whatever you want wit... |
the-stack_106_25927 | #!/usr/bin/env python
#
# Use the raw transactions API to spend bullets received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bulletd or Bulle... |
the-stack_106_25929 | from random import random, randrange
from .config import cfg
from .vocab_pick import calc_progress
class WordIterator:
def __init__(self, words: list):
self.__words = words
self.__add_after_iter = None
def __iter__(self):
return self
def add_word(self, index: int, value):
... |
the-stack_106_25930 | from sqlalchemy import *
from sqlalchemy.orm import *
engine = create_engine('sqlite:///data/db.sqlite', echo=False)
metadata = MetaData()
metadata.bind = engine
ranking = Table(
'ranking', metadata,
Column('id', Integer, primary_key=True),
Column('name', String),
Column('hiScore', Float),
Column... |
the-stack_106_25931 | # -*- coding: utf-8 -*-
# Copyright 2020 The Matrix.org Foundation C.I.C.
#
# 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-stack_106_25935 | # Copyright 2022 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... |
the-stack_106_25936 | # Copyright (c) 2010 Mitch Garnaat http://garnaat.org/
#
# 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... |
the-stack_106_25937 | import random
from typing import Sequence
print("Hello, what is your name?")
name = input()
secretNum = random.randint(1,20)
print("Well, " + name + ", I am thinking of a number between 1 and 20")
guess = 0
for guessesTaken in range(1,7):
print("Take a guess.")
try:
guess = int(input())
if guess < secret... |
the-stack_106_25939 | from typing import Dict
from cereal import car
from selfdrive.car import dbc_dict
from selfdrive.car.docs_definitions import CarInfo
Ecu = car.CarParams.Ecu
SPEED_FROM_RPM = 0.008587
class CarControllerParams:
ANGLE_DELTA_BP = [0., 5., 15.]
ANGLE_DELTA_V = [5., .8, .15] # windup limit
ANGLE_DELTA_VU = [5.,... |
the-stack_106_25943 | #!/usr/bin/env python3
import requests
import bs4
import json
import format_json
import argparse
# following values(URL,FILENAME) are dummy and sample values
URL = "https://scholar.google.co.jp/scholar?start=10&hl=ja&as_sdt=2005&sciodt=0,5&cites=3982677450424843587&scipsc="
FILENAME = "Minimal solvers for general... |
the-stack_106_25946 | # 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
# d... |
the-stack_106_25948 | from . import test_table
from ..src import table
from ..src import button
def test_init_seat_neg1():
t = test_table.custom_tbl(players=6)
btn = button.Button(t)
assert btn.seat == -1
def test_init_repr_neg1_str():
t = test_table.custom_tbl(players=6)
btn = button.Button(t)
assert repr(btn) =... |
the-stack_106_25949 | import operator
import unittest
from metafunctions.core import FunctionMerge
from metafunctions.core import SimpleFunction
from metafunctions.tests.util import BaseTestCase
from metafunctions.operators import concat
from metafunctions import exceptions
from metafunctions.api import node, star
class TestUnit(BaseTest... |
the-stack_106_25950 | """Test fixtures for the generic component."""
from io import BytesIO
from PIL import Image
import pytest
@pytest.fixture(scope="package")
def fakeimgbytes_png():
"""Fake image in RAM for testing."""
buf = BytesIO()
Image.new("RGB", (1, 1)).save(buf, format="PNG")
yield bytes(buf.getbuffer())
@pyt... |
the-stack_106_25951 | # Copyright (c) 2007-2019 UShareSoft, 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 requi... |
the-stack_106_25953 | # Copyright (c) 2021 - present / Neuralmagic, 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 b... |
the-stack_106_25954 | import os
import numpy as np
import shutil
import logging
from oggm import cfg, utils, GlacierDirectory, tasks
from oggm.core import gcm_climate
from oggm.workflow import init_glacier_regions, execute_entity_task
from oggm.core.flowline import FileModel, run_from_climate_data
from relic.preprocessing import merge_pa... |
the-stack_106_25956 | """
Main script for the project that runs the program from start to finish.
:author: Jacob Singleton
"""
from pathlib import Path
from random import randint
from time import sleep
from audio import Audio
from config import Config
def show_startup_banner() -> None:
"""
Displays an ASCII art startup banner ex... |
the-stack_106_25958 | import fechbase
class Records(fechbase.RecordsBase):
def __init__(self):
fechbase.RecordsBase.__init__(self)
self.fields = [
{'name': 'FORM TYPE', 'number': '1'},
{'name': 'FILER COMMITTEE ID NUMBER', 'number': '2'},
{'name': 'CHANGE OF COMMITTEE NAME', 'number': ... |
the-stack_106_25959 | # -*- coding: utf-8 -*-
"""
Testing class for report-data-entry endpoint of the Castor EDC API Wrapper.
Link: https://data.castoredc.com/api#/report-data-entry
@author: R.C.A. van Linschoten
https://orcid.org/0000-0003-3052-596X
"""
import pytest
from httpx import HTTPStatusError
from castoredc_api import CastorExcep... |
the-stack_106_25960 | #!/usr/bin/python
import os
import re
import sys
import time
from rancher_metadata import MetadataAPI
__author__ = 'Sebastien LANGOUREAUX'
BACKUP_DIR = '/backup/gluster'
class ServiceRun():
def backup_duplicity_ftp(self, backend, target_path, full_backup_frequency, nb_full_backup_keep, nb_increment_backup_chain... |
the-stack_106_25961 | """
Copyright (c) 2018-2019 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
... |
the-stack_106_25962 | from django.db import migrations
def create_site(apps, schema_editor):
Site = apps.get_model("sites", "Site")
custom_domain = "pilpol-33525.botics.co"
site_params = {
"name": "PilPol",
}
if custom_domain:
site_params["domain"] = custom_domain
Site.objects.update_or_create(def... |
the-stack_106_25965 |
import numpy as np
import time as tm
import sys
def PrettyPrintComplexMatrix(matrix,prec=3,linewidth1=150,suppressOn=True):
np.set_printoptions(precision=prec,linewidth=linewidth1,suppress=suppressOn)
print('RE=\n', np.real(matrix))
print('Im=\n', np.imag(matrix))
def matrixMatrixMultiplication_good(A,B)... |
the-stack_106_25966 | from django.shortcuts import render, redirect
from django.conf.timezone import now
from .models import (
SandType,
Topdressing,
GreenTopdressing,
TeeTopdressing,
FairwayTopdressing
)
def curr_time():
return now()
def index(request):
context = {
'curr_time': curr_time(),
}
... |
the-stack_106_25967 | from __future__ import annotations
from typing import Union
from pathlib import Path
from dataclasses import dataclass, field
import math
import uuid
# useful geometric constants
TWO_PI = 2 * math.pi
PI_OVER_TWO = math.pi / 2
THREE_PI_OVER_TWO = 3 * math.pi / 2
def get_oriented_distance(p0: Point, p1: Point, p2: Poi... |
the-stack_106_25968 | import netCDF4 as nc
import sys
import argparse
import numpy as np
import configparser
from itertools import islice, chain, repeat
from netcdfTools import *
from mapTools import readNumpyZTile
'''
Tools for genPIDSInput.py
Author:
Sasu Karttunen
sasu.karttunen@helsinki.fi
Institute for Atmospheric and Earth System ... |
the-stack_106_25970 | import os
import sys
import time
from contextlib import contextmanager
from dagster import check
if sys.version_info.major >= 3 and sys.version_info.minor >= 3:
time_fn = time.perf_counter
elif os.name == 'nt':
time_fn = time.clock
else:
time_fn = time.time
class TimerResult(object):
def __init__(s... |
the-stack_106_25972 | #!/usr/bin/env python
#
# Electrum - Lightweight Bitcoin Client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... |
the-stack_106_25973 | import logging
import os
import sys
import httpx
from coverage_comment import badge, comment_file
from coverage_comment import coverage as coverage_module
from coverage_comment import (
github,
github_client,
log,
settings,
subprocess,
template,
wiki,
)
def main():
logging.basicConfi... |
the-stack_106_25976 | import os
import sys
import cv2
curdir = os.path.dirname(__file__)
files = os.listdir(curdir)
for file in files:
_, ext = os.path.splitext(file)
if ext == '.py':
continue
img = cv2.imread(file)
size = img.shape
h, w = size[:2]
print('{} {}x{}'.format(file, w, h)) |
the-stack_106_25981 | #!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test RPC calls related to net.
Tests correspond to code in rpc/net.cpp.
"""
from decimal import Decim... |
the-stack_106_25983 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/12/17 13:19
# @Author : glacier
# @Site :
# @File : db_test.py
# @Software: PyCharm Edu
import pymysql
import pymysql
def db_deal(title_url,title,count):
# 打开数据库连接
db = pymysql.connect(
"localhost",
... |
the-stack_106_25984 | # This code is modified from https://github.com/facebookresearch/low-shot-shrink-hallucinate
import torch
import torch.nn as nn
import math
import torch.nn.functional as F
from torch.nn.utils import weight_norm
# Basic ResNet model
def init_layer(L):
# Initialization using fan-in
if isinstance(L, nn.Conv2d):... |
the-stack_106_25985 | from unittest.mock import patch
from django.shortcuts import reverse
from api.tests.helpers import (
BaseFeedAPITestCase, create_entry_objects, FEED_DETAIL_FIELDS
)
from feeds.models import Feed
class FeedListTest(BaseFeedAPITestCase):
"""Tests GET request on `feed-list` endpoint.
This API... |
the-stack_106_25987 | import array
import logging
from . import machine
from spec_exceptions import ChannelError
log = logging.getLogger('puka')
class ChannelCollection(object):
channel_max = 65535
def __init__(self):
self.channels = {}
self.free_channels = []
# Channel 0 is a special case.
self... |
the-stack_106_25988 | """Test figures.tasks Daily task functions
# Overview of daily pipeline
Figures daily pipeline collects and aggregates data from Open edX (edx-platform)
into Figures models.
The Figures task functions are Celery tasks. However currently only the top
level task function is called asynchronously.
# Daily pipeline exe... |
the-stack_106_25989 | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
from os.path import join as pjoin
import numpy as np
from dis... |
the-stack_106_25992 | # -*- coding: utf-8 -*-
# Author: XuMing <xuming624@qq.com>
# Brief:
from xml.dom import minidom
import pycorrector.rnn_crf.rnn_crf_config as config
from pycorrector.tokenizer import segment
def parse_xml_file(path):
print('Parse data from %s' % path)
id_lst, word_lst, label_lst = [], [], []
with open(pa... |
the-stack_106_25993 | import os
import pandas as pd
import numpy as np
import shutil
from data_handling_functions import get_article_row, m_j_dict
import math
this_path = 'Bilbokning/'
#PARAMETERS
EUR_PALLET_VOLUME = 1.20*0.80*1.00
NUM_OF_ZONES = 9
def calculate_dij_mj(degree_of_filling, date):
#Remove /csv/... if it exists, then cr... |
the-stack_106_25994 | # -*- coding: utf-8 -*-
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Sections in this module are
1. top-level functions
2. plan creators
3. plan runners
4. individual operations
5. helper functions
The top-level functions compose and execute full plans.
A plan is created b... |
the-stack_106_25997 | import gym
from torch import nn as nn
from rlkit.exploration_strategies.base import \
PolicyWrappedWithExplorationStrategy
from rlkit.exploration_strategies.epsilon_greedy import EpsilonGreedy
from rlkit.policies.argmax import ArgmaxDiscretePolicy
from rlkit.torch.policies.softmax_policy import SoftmaxPolicy
from ... |
the-stack_106_25999 | #
# Created on Wed Sep 08 2021
#
# The MIT License (MIT)
# Copyright (c) 2021 Maatuq
#
# 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... |
the-stack_106_26000 |
# Copyright 2009 by Peter Cock. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Unittests for the Seq objects."""
import warnings
import unittest
import sys
from Bio impor... |
the-stack_106_26006 | """application URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... |
the-stack_106_26007 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Evaluate pre-trained model trained for ppl metric.
"""
from parlai_internal.scripts.eval_ppl import eval_ppl, setup_a... |
the-stack_106_26012 | import torch
import torch.nn as nn
import torch.nn.functional as F
from mmseg.core import add_prefix
from mmseg.ops import resize
from .. import builder
from ..builder import SEGMENTORS
from .base import BaseSegmentor
@SEGMENTORS.register_module()
class EncoderDecoder(BaseSegmentor):
"""Encoder Decoder segmentor... |
the-stack_106_26013 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Stream(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "contour"
_path_str = "contour.stream"
_valid_props = {"maxpoints", "token"}
# maxpoints... |
the-stack_106_26017 | """
Tests for the basic masking and filtering operations
"""
from ccd.qa import *
from ccd.app import get_default_params
clear = 0
water = 1
fill = 255
snow = 3
clear_thresh = 0.25
snow_thresh = 0.75
default_params = get_default_params()
def test_checkbit():
packint = 1
offset = 0
assert checkbit(pac... |
the-stack_106_26019 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... |
the-stack_106_26022 | # Specify an Exasim version to run
version = "Version0.1";
# import external modules
import numpy, os
# Add Exasim to Python search path
cdir = os.getcwd(); ii = cdir.find("Exasim");
exec(open(cdir[0:(ii+6)] + "/Installation/setpath.py").read());
# import internal modules
import Preprocessing, Postprocessing, Gencod... |
the-stack_106_26023 | # _________________________________________________________________________
#
# PyUtilib: A Python utility library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the BSD License.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains ... |
the-stack_106_26025 | from flask import Flask, render_template, request, redirect, jsonify, make_response, json, request, url_for, send_from_directory, flash
from collections import namedtuple
from werkzeug import secure_filename
import sys
import types
import time
import datetime
import re
import json
import untangle
import uuid
import sql... |
the-stack_106_26029 | from flask_mail import Message
from flask import render_template
from . import mail
subject_prefix = 'Phil Blog'
sender_email = 'thefirifo@gmail.com'
def mail_message(subject,template,to,**kwargs):
email = Message(subject, sender=sender_email, recipients=[to])
email.body= render_template(template + ".tx... |
the-stack_106_26031 | import distutils.command.build_clib as orig
from distutils.errors import DistutilsSetupError
from distutils import log
from setuptools.dep_util import newer_pairwise_group
class build_clib(orig.build_clib):
"""
Override the default build_clib behaviour to do the following:
1. Implement a rudimentary time... |
the-stack_106_26032 | # An Accessory for Adafruit NeoPixels attached to GPIO Pin18
# Tested using Python 3.6 Raspberry Pi
# This device uses all available services for the Homekit Lightbulb API
# Note: set your neopixels settings under the #NeoPixel constructor arguments
# Note: RPi GPIO must be PWM. Neopixels.py will warn if wrong GPIO is ... |
the-stack_106_26034 | import numpy as np
import os.path as osp
import sys
import pyrado
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from panda3d.core import *
from pyrado.environments.sim_base import SimEnv
# Configuration for panda3d-window
confVars = """
win-size 1280 720
framebuffer-multisample 1
multisa... |
the-stack_106_26035 | import torch
from torch import nn
from torch.autograd import Variable
from torch.nn import functional as F
# Module for residual/skip connections
class FCResBlock(nn.Module):
def __init__(self, dim, n, nonlinearity, batch_norm=True):
"""
:param dim:
:param n:
:param nonlinearity:... |
the-stack_106_26036 | import astropy.units as u
from astropy.coordinates import SkyCoord
from astropy import wcs
from astropy.nddata import Cutout2D
import astropy.io.fits as fits
import numpy as np
import matplotlib.pyplot as plt
import os
from astropy.table import Table, join
from matplotlib.patches import Circle
from aspecs_catalog_bui... |
the-stack_106_26040 | import pprint
import json
import pandas as pd
import numpy as np
from json_shot_scraper import flatten_shot, flatten_corner #flatten_goal, flatten_complete_pass, flatten_incomplete_pass
from player_scraper import flatten_player, flatten_sub
from dataframe_cleaner import (pass_to_shot, corner_to_shot, transpose_coordin... |
the-stack_106_26041 | # 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... |
the-stack_106_26042 | import discord
import os
from lxml import etree
from discord.ext import commands
import asyncio, json
import youtube_dl
import youtube_search
playlists = {} # playlists loaded from each guild will be stored here
musics = {} # musics from each guild will be stored here.
now_playing = {} # music actually playing will be... |
the-stack_106_26044 | # Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
from iris_relay.app import read_config_from_argv
from iris_relay.gmail import Gmail
config = read_config_from_argv()
gmclient = Gmail(config.get('gmail'), con... |
the-stack_106_26045 | import os
import re
from datetime import timedelta
from django.core.urlresolvers import reverse
from django.core.management import call_command
from django.contrib.contenttypes.models import ContentType
from django.utils import timezone
from ecs.utils.testcases import LoginTestCase
from ecs.documents.models import Do... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.