text stringlengths 4.68k 32.9k | length int64 4.1k 4.35k | is_long_context bool 1
class | metric_val float64 0.02 0.44 | label_metric stringclasses 1
value | source stringclasses 2
values | threshold_scale stringclasses 1
value |
|---|---|---|---|---|---|---|
#!/usr/bin/env python3
'''
lib/ycmd/start.py
Server bootstrap logic. Includes a utility class for normalizing parameters and
calculating default ones. Also includes a helper to set up the temporary
options file.
'''
import logging
import os
import tempfile
from ..process import (
FileHandles,
Process,
)
from... | 4,174 | true | 0.102127 | median | code | normalized |
# Copyright 2017 Datera
# 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... | 4,153 | true | 0.082591 | median | code | normalized |
# Copyright 2020 Huawei Technologies Co., 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 law or agreed to... | 4,316 | true | 0.077669 | median | code | normalized |
# coding=utf-8
import copy
import functools
from typing import List
import torch
import torch.distributed._shard.sharding_spec as shard_spec
from .api import (
_register_sharded_op,
Shard,
ShardedTensor,
ShardedTensorMetadata,
TensorProperties,
)
from .metadata import ShardMetadata # noqa: F401
... | 4,193 | true | 0.144545 | median | code | normalized |
from .single_stage import SingleStageDetector
from ..registry import DETECTORS
from mmdet.core import bbox2result
import torch.nn as nn
import torch
from .. import builder
import numpy as np
import cv2
from mmdet.core import bbox2roi, bbox2result, build_assigner, build_sampler
@DETECTORS.register_module
class CSP(Sin... | 4,099 | true | 0.129034 | median | code | normalized |
# Copyright 2019 Huawei Technologies Co., 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 law or agreed to... | 4,175 | true | 0.256549 | median | code | normalized |
# -*- coding: utf-8 -
from iso8601 import parse_date
from datetime import datetime, date, time, timedelta
import dateutil.parser
from pytz import timezone
import os
from decimal import Decimal
import re
TZ = timezone(os.environ['TZ'] if 'TZ' in os.environ else 'Europe/Kiev')
def get_all_etender_dates(initial_tender... | 4,231 | true | 0.062461 | median | code | normalized |
#!/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.
"""Class for bitcoinexodusd node under test"""
import contextlib
import decimal
import errno
from enum im... | 4,250 | true | 0.088897 | median | code | normalized |
# -*- test-case-name: twisted.test.test_factories -*-
#
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""Standard implementations of Twisted protocol-related interfaces.
Start here if you are looking to write a new protocol implementation for
Twisted. The Protocol class contains ... | 4,188 | true | 0.082364 | median | code | normalized |
from flask_socketio import SocketIO
from flask import Flask, make_response, request, session
from flask import render_template, session, url_for, redirect
from threading import RLock
from threading import Thread
from utilslib import list_to_HTML_table
from time import sleep
from ClientStorage import Clients, User
fr... | 4,144 | true | 0.129204 | median | code | normalized |
import threading
import requests
# encryption
import Encrypt
import unicodedata
from ttk import Style, Button, Label, Entry, Progressbar, Checkbutton
from Tkinter import Tk, Frame, RIGHT, BOTH, RAISED
from Tkinter import TOP, X, N, LEFT
from Tkinter import END, Listbox, MULTIPLE
from Tkinter import Toplevel, DISABLE... | 4,170 | true | 0.074017 | median | code | normalized |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | 4,263 | true | 0.08739 | median | code | normalized |
from unittest import TestCase, skip
import copy
import numpy as np
from giant import rotations as at
from giant.ray_tracer import kdtree, shapes, rays
class TestKDTree(TestCase):
def setUp(self):
self.max_depth = 4
tri1 = np.array([[-5, -4, -4.5],
[0, 0, 1],
... | 4,208 | true | 0.222839 | median | code | normalized |
import torch
import torch.nn as nn
import torch.nn.functional as F
from mp.models.segmentation.unet_fepegar import UNet2D
### UNet Wrapper ###
class UNet2D_dis(UNet2D):
r"""Wrapper for UNet2D to access encoder and decoder seperately.
"""
def __init__(self, *args, **kwargs):
super(UNet2D_dis, self).... | 4,261 | true | 0.094416 | median | code | normalized |
# # ⚠ Warning
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIA... | 4,339 | true | 0.125277 | median | code | normalized |
import torch
from torch import nn, optim, multiprocessing
from torch.utils.data import DataLoader
from torch.utils.tensorboard.writer import SummaryWriter
from tqdm import tqdm
from time import time
from collections import defaultdict
from utils.run_utils import get_logger
from utils.train_utils import CheckpointMan... | 4,181 | true | 0.094079 | median | code | normalized |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2019, 2020 Matt Post <post@cs.jhu.edu>
#
# 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/LICE... | 4,122 | true | 0.095055 | median | code | normalized |
# %% md
#### This notebook demonstrates the use of an optimized data pre-processing algorithm for bias mitigation
# - The
# debiasing
# function
# used is implemented in the
# `OptimPreproc`
#
# class .
# - Define
# parameters
# for optimized pre - processing specific to the dataset.
#
#
# - Divide
# the... | 4,121 | true | 0.08861 | median | code | normalized |
#
# Copyright (C) 2002-2006 greg Landrum and Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
""" utility functionality for ... | 4,237 | true | 0.074435 | median | code | normalized |
from toposort import toposort
import contextlib
import numpy as np
import tensorflow as tf
import tensorflow.contrib.graph_editor as ge
import time
import sys
sys.setrecursionlimit(10000)
# refers back to current module if we decide to split helpers out
util = sys.modules[__name__]
# getting rid of "WARNING:tensorflow... | 4,119 | true | 0.070708 | median | code | normalized |
'''
Copyright 2016, United States Government, as represented by the Administrator of
the National Aeronautics and Space Administration. All rights reserved.
The "pyCMR" platform is licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may ... | 4,144 | true | 0.099097 | median | code | normalized |
# Copyright 1999-2021 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 required by applicable law or a... | 4,169 | true | 0.101886 | median | code | normalized |
#GUI classes for the application
from kivy.app import App
from kivy.lang import Builder
from kivy.core.window import Window
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
from kivy.uix.popup import Popup
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.... | 4,204 | true | 0.076512 | median | code | normalized |
# Copyright 2021, joshiayus Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... | 4,321 | true | 0.079405 | median | code | normalized |
import io
import resource
from pathlib import Path
import numpy as np
import PIL
import pytest
from keras_preprocessing.image import utils
def test_validate_filename(tmpdir):
valid_extensions = ('png', 'jpg')
filename = tmpdir.ensure('test.png')
assert utils.validate_filename(str(filename), valid_extens... | 4,346 | true | 0.143307 | median | code | normalized |
"""
Copyright (c) 2018-2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | 4,168 | true | 0.241495 | median | code | normalized |
import json
import os
import sys
import shutil
import tempfile
import unittest
import ray
import ray.cloudpickle as cloudpickle
from ray.rllib import _register_all
from ray import tune
from ray.tune.logger import NoopLogger
from ray.tune.utils.trainable import TrainableUtil
from ray.tune.function_runner import with_p... | 4,312 | true | 0.136045 | median | code | normalized |
# !/usr/bin/env python
import re
import requests
import collections
import hashlib
import os
import json
import time
def _prefix(cmd):
prefix = os.path.basename(cmd.replace('-', '_'))
for i in ['.pyc', '.py', '-cli', '-tool', '-util']:
prefix = prefix.replace(i, '')
return prefix.upper()
PREFI... | 4,099 | true | 0.079633 | median | code | normalized |
import uuid
import datetime
from sqlalchemy import Float
from sqlalchemy import Column
from sqlalchemy import String
from sqlalchemy import Integer
from sqlalchemy import Boolean
from sqlalchemy import DateTime
from sqlalchemy import ForeignKey
from sqlalchemy import UniqueConstraint
from sqlalchemy.orm import backref... | 4,223 | true | 0.145418 | median | code | normalized |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | 4,320 | true | 0.175949 | median | code | normalized |
import numpy as np
from os import path as osp
from mmdet3d.core import show_result, show_seg_result
from mmdet3d.core.bbox import DepthInstance3DBoxes
from mmdet.datasets import DATASETS
from mmseg.datasets import DATASETS as SEG_DATASETS
from .custom_3d import Custom3DDataset
from .custom_3d_seg import Custom3DSegDat... | 4,219 | true | 0.136766 | median | code | normalized |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | 4,160 | true | 0.176067 | median | code | normalized |
# -*- coding: utf-8 -*-
# Copyright 2016 OpenMarket 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... | 4,325 | true | 0.152859 | median | code | normalized |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 4,257 | true | 0.153802 | median | code | normalized |
"""
Provide the functionality to group entities.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/group/
"""
import asyncio
import logging
import voluptuous as vol
from homeassistant import core as ha
from homeassistant.const import (
ATTR_ENTITY_ID... | 4,246 | true | 0.091998 | median | code | normalized |
# Copyright (C) 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 4,251 | true | 0.091165 | median | code | normalized |
import math
import chainer
import chainer.functions as F
import chainer.links as L
import numpy as np
from .sn_convolution_2d import SNConvolution2D, SNDeconvolution2D
from .sn_linear import SNLinear
def _upsample(x):
h, w = x.shape[2:]
return F.unpooling_2d(x, 2, outsize=(h * 2, w * 2))
def _downsample(x):
... | 4,109 | true | 0.204923 | median | code | normalized |
'''
Utility functions.
'''
import argparse
import functools
import itertools
import os
import sqlite3 as sql
from contextlib import closing
from copy import deepcopy
from itertools import repeat
import numpy as np
import pandas as pd
import scipy as sp
import scipy.fftpack
import scipy.signal
from cnld import abstract... | 4,287 | true | 0.046573 | median | code | normalized |
"""
.. module:: volume
:synopsis: Volume Indicators.
.. moduleauthor:: Dario Lopez Padial (Bukosabino)
"""
import numpy as np
import pandas as pd
from ta.utils import IndicatorMixin, ema
class AccDistIndexIndicator(IndicatorMixin):
"""Accumulation/Distribution Index (ADI)
Acting as leading indicator o... | 4,107 | true | 0.255691 | median | code | normalized |
# 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 ... | 4,172 | true | 0.093991 | median | code | normalized |
# 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 ag... | 4,107 | true | 0.142255 | median | code | normalized |
#!/usr/bin/env python3
# Author: Volodymyr Shymanskyy
# Usage:
# ./run-spec-test.py
# ./run-spec-test.py ./core/i32.json
# ./run-spec-test.py ./core/float_exprs.json --line 2070
# ./run-spec-test.py ./proposals/tail-call/*.json
# ./run-spec-test.py --exec ../build-custom/wasm3
# ./run-spec-test.py --engine... | 4,165 | true | 0.055393 | median | code | normalized |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Download SQL file of MySQL database by phpMyAdmin
'''
import re
import os
import sys
import base64
import urllib
import urllib2
import traceback
from cookielib import CookieJar, DefaultCookiePolicy
from pprint import pprint
__author__ = 'furyu (furyutei@gmail.com... | 4,311 | true | 0.073258 | median | code | normalized |
import vtk
from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
import math
import numpy as np
import numpy.matlib
import os
import json
import cv2
# Z
# /
# /
# /
# ---------- X
# |
# |
# |
# Y
class vtkRenderer():
def __init__(self, widget=None... | 4,283 | true | 0.098401 | median | code | normalized |
import tkinter as tk
from tkinter import ttk
import re
import os
import wikipedia
import time
import webbrowser
import json
import requests
import ctypes
import youtube_dl
import random
import urllib
import ssl
from bs4 import BeautifulSoup
from urllib.request import urlopen
import speech_recognition as sr
import reque... | 4,227 | true | 0.074501 | median | code | normalized |
"""
BROS
Copyright 2022-present NAVER Corp.
Apache License v2.0
Do 2nd preprocess on top of the result of the 'preprocess.sh' file.
Reference: https://github.com/microsoft/unilm/blob/master/layoutlm/deprecated/examples/seq_labeling/run_seq_labeling.py
"""
import json
import os
from collections import Counter
from t... | 4,178 | true | 0.087971 | median | code | normalized |
# from flask import Flask, Blueprint
# from flask_sqlalchemy import SQLAlchemy
# from flask_login import LoginManager
# import os
from flask import Flask, jsonify, request, make_response, redirect, url_for
import jwt
import datetime
import os
from functools import wraps
from flask_sqlalchemy import SQLAlchemy
import u... | 4,129 | true | 0.111697 | median | code | normalized |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | 4,305 | true | 0.168511 | median | code | normalized |
""" Local routines
Written by S.Haesaert
CONTENT
helpfull functions for JPL project
Bridging Tulip with the Statechart autocoder
DATE 2 June
"""
# TODO : Check whether output set of reduced mealy machines (i,e.,ctrl.outputs) is too big?
from __future__ import absolute_import
from __future__ import... | 4,318 | true | 0.136103 | median | code | normalized |
import pygame
import psutil
import cpuinfo
import socket
import time
import nmap
from cpuinfo import get_cpu_info
red = (200,0,0)
white = (210,214,217)
blue = (0,0,200)
grey = (105,105,105)
black = (0,0,0)
largura_tela, altura_tela = 1024,760
pygame.init()
pygame.font.init()
font = pygame.font.Font(N... | 4,210 | true | 0.167419 | median | code | normalized |
import math
import operator
from datetime import date, datetime
from operator import methodcaller
import pandas as pd
import pandas.testing as tm
import pytest
from pytest import param
import ibis
import ibis.expr.datatypes as dt
import ibis.expr.types as ir
from ibis import literal as L
clickhouse_driver = pytest.i... | 4,332 | true | 0.131745 | median | code | normalized |
"""
test_analyze.py
Testing analyze.py
"""
import os
from collections import defaultdict
import numpy as np
import seekr2.modules.common_analyze as common_analyze
import seekr2.modules.mmvt_analyze as mmvt_analyze
import seekr2.analyze as analyze
import seekr2.modules.common_base as base
import seekr2.modules.mmvt_... | 4,280 | true | 0.103621 | median | code | normalized |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
# pylint: disable=protected-access
from typing import (
Any,
IO,
Union,
List,
TYPE_CHECKING
)
from azure.core.tracing.decorator impo... | 4,178 | true | 0.240755 | median | code | normalized |
"""Script to train the Hamiltonian Generative Network
"""
import ast
import argparse
import copy
import pprint
import os
import warnings
import yaml
import numpy as np
import torch
import tqdm
from utilities.integrator import Integrator
from utilities.training_logger import TrainingLogger
from utilities import loader... | 4,264 | true | 0.082112 | median | code | normalized |
# -*- coding: utf-8 -*-
"""The graphical part of a Control Parameters step"""
import seamm
from seamm_util import ureg, Q_, units_class # noqa: F401
import seamm_widgets as sw
import control_parameters_step # noqa: F401
import Pmw
import pprint # noqa: F401
import tkinter as tk
import tkinter.ttk as ttk
class Tk... | 4,265 | true | 0.157559 | median | code | normalized |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 4,134 | true | 0.118783 | median | code | normalized |
import numpy as np
from lenstronomy.Cosmo.background import Background
from lenstronomy.LensModel.profile_list_base import ProfileListBase
import lenstronomy.Util.constants as const
__all__ = ['MultiPlaneBase']
class MultiPlaneBase(ProfileListBase):
"""
Multi-plane lensing class
The lens model deflecti... | 4,178 | true | 0.110943 | median | code | normalized |
"""
The MIT License (MIT)
Copyright (c) 2015-2021 Rapptz
Copyright (c) 2021-present Disnake Development
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 limi... | 4,228 | true | 0.08914 | median | code | normalized |
# -*- coding: utf-8 -*-
"""
Plugin to create a Yambo input file and run a calculation with the yambo executable.
"""
from __future__ import absolute_import
import os
import six
from aiida.engine import CalcJob
from aiida_quantumespresso.calculations import _lowercase_dict, _uppercase_dict
from aiida.common.datastruc... | 4,212 | true | 0.073724 | median | code | normalized |
import cv2
import numpy as np
import dlib
from imutils import face_utils, translate
class Camera(object):
def __init__(self):
self.camera = cv2.VideoCapture(0)
p = "../data/shape_predictor_68_face_landmarks.dat"
self.detector = dlib.get_frontal_face_detector()
self.predictor = dlib.shape_predictor(p)
self.... | 4,330 | true | 0.104441 | median | code | normalized |
import sys
import time
import signal
import subprocess
from ._utils import get_ffmpeg_exe, logger
from ._parsing import LogCatcher, parse_ffmpeg_header, cvsecs
ISWIN = sys.platform.startswith("win")
exe = None
def _get_exe():
global exe
if exe is None:
exe = get_ffmpeg_exe()
return exe
def ... | 4,279 | true | 0.126101 | median | code | normalized |
"""Logic Blocks devices."""
from typing import Any, List
from mpf.core.delays import DelayManager
from mpf.core.device_monitor import DeviceMonitor
from mpf.core.events import event_handler
from mpf.core.machine import MachineController
from mpf.core.mode import Mode
from mpf.core.mode_device import ModeDevice
from mp... | 4,223 | true | 0.098364 | median | code | normalized |
import time
from collections import deque
import gym
import numpy as np
import tensorflow as tf
from stable_baselines import logger
from stable_baselines.common import explained_variance, tf_util, ActorCriticRLModel, SetVerbosity, TensorboardWriter
from stable_baselines.common.policies import ActorCriticPolicy, Recur... | 4,202 | true | 0.097537 | median | code | normalized |
import unittest
from test import test_support
import UserDict, random, string
class DictTest(unittest.TestCase):
def test_constructor(self):
# calling built-in types without argument must return empty
self.assertEqual(dict(), {})
self.assert_(dict() is not {})
def test_literal_constr... | 4,189 | true | 0.067816 | median | code | normalized |
import torch
from torch import nn
from torch import optim
from torch.nn import functional as F
from torch.utils.data import TensorDataset, DataLoader
from torch import optim
import numpy as np
from learner import Learner
from copy import deepcopy
def zero_nontrainable_grads(grads, trainable_lay... | 4,220 | true | 0.191414 | median | code | normalized |
#!/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... | 4,180 | true | 0.106883 | median | code | normalized |
# 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 u... | 4,228 | true | 0.149225 | median | code | normalized |
import os
import yaml
import numpy as np
import torch
import shutil
import torchvision.transforms as transforms
from torch.autograd import Variable
from collections import namedtuple
class MyDumper(yaml.Dumper):
def increase_indent(self, flow=False, indentless=False):
return super(MyDumper, self).increase... | 4,134 | true | 0.073775 | median | code | normalized |
"""
Train a new model.
"""
import sys
import argparse
import h5py
import datetime
import subprocess as sp
import numpy as np
import pandas as pd
import gzip as gz
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
fr... | 4,260 | true | 0.100937 | median | code | normalized |
# Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or... | 4,227 | true | 0.089366 | median | code | normalized |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | 4,200 | true | 0.061855 | median | code | normalized |
# MINLP written by GAMS Convert at 05/15/20 00:50:46
#
# Equation counts
# Total E G L N X C B
# 34 22 3 9 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... | 4,235 | true | 0.125846 | median | code | normalized |
# -*- coding: utf-8 -*-
# (c) 2009-2021 Martin Wendt and contributors; see WsgiDAV https://github.com/mar10/wsgidav
# Original PyFileServer (c) 2005 Ho Chun Wei.
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
"""
Implementation of a WebDAV provider that provides a very basic, read-... | 4,301 | true | 0.107928 | median | code | normalized |
"""
Module for radiometric normalization
Credits:
Copyright (c) 2018-2019 Johannes Schmid (GeoVille)
Copyright (c) 2017-2019 Matej Aleksandrov, Matic Lubej, Devis Peresutti (Sinergise)
This source code is licensed under the MIT license found in the LICENSE
file in the root directory of this source tree.
"""
import n... | 4,127 | true | 0.149774 | median | code | normalized |
"""SCons.Tool.GettextCommon module
Used by several tools of `gettext` toolset.
"""
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# 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 withou... | 4,126 | true | 0.080586 | median | code | normalized |
from models.resnet import ResNetBase, get_norm
from models.modules.common import ConvType, NormType, conv, conv_tr
from models.modules.resnet_block import BasicBlock, Bottleneck, BasicBlockIN, BottleneckIN, BasicBlockLN
from MinkowskiEngine import MinkowskiReLU
import MinkowskiEngine.MinkowskiOps as me
class Res16UN... | 4,233 | true | 0.143765 | median | code | normalized |
#!/usr/bin/env python
"""Provenance post processing script for OSA pipeline."""
import copy
import logging
import shutil
import sys
from pathlib import Path, PurePath
import yaml
from osa.configs import options
from osa.configs.config import cfg
from osa.provenance.capture import get_activity_id, get_file_hash
from... | 4,322 | true | 0.094321 | median | code | normalized |
# coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------------... | 4,298 | true | 0.210557 | median | code | normalized |
# Copyright 2019-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | 4,263 | true | 0.090374 | median | code | normalized |
"""Tests for 'site'.
Tests assume the initial paths in sys.path once the interpreter has begun
executing have not been removed.
"""
import unittest
import test.support
from test.support import captured_stderr, TESTFN, EnvironmentVarGuard
import builtins
import os
import sys
import re
import encodings
import urllib.re... | 4,260 | true | 0.076478 | median | code | normalized |
import numpy as np
import matplotlib.pyplot as plt
import pickle
import os
from scipy import stats
from HER_mod.rl_modules.tsp import generate_path
from HER_mod.rl_modules.hyperparams import NUM_GOALS, NUM_AGENTS
gd_step_list = [0,2,5, 10, 20, 40]
# NUM_AGENTS = 3
N=200
def get_path_costs(train_pos_agent, train_vel_a... | 4,159 | true | 0.193152 | median | code | normalized |
'''
Created on 08.04.2019
@author: mort
ipywidget interface to the GEE for IR-MAD
'''
import ee, time, warnings, math
import ipywidgets as widgets
from IPython.display import display
from ipyleaflet import (Map,DrawControl,TileLayer,
basemaps,basemap_to_tiles,
LayersCo... | 4,133 | true | 0.092753 | median | code | normalized |
"""
Copyright 2022 RICHARD TJÖRNHAMMAR
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, sof... | 4,141 | true | 0.10864 | median | code | normalized |
#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_framework.comptool import TestManager, T... | 4,328 | true | 0.135551 | median | code | normalized |
import copy
from dataclasses import make_dataclass
from unittest import mock
from tests.fixtures.books import Books
from tests.fixtures.models import AttrsType
from tests.fixtures.models import ExtendedListType
from tests.fixtures.models import ExtendedType
from tests.fixtures.models import FixedType
from tests.fixtur... | 4,321 | true | 0.123368 | median | code | normalized |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import shutil
import pytest
import llnl.util.filesystem as fs
import spack.error
import spack.patch
import sp... | 4,198 | true | 0.128109 | median | code | normalized |
import os
import traceback
import unittest
from tornado.escape import utf8, native_str, to_unicode
from tornado.template import Template, DictLoader, ParseError, Loader
from tornado.util import ObjectDict
import typing # noqa: F401
class TemplateTest(unittest.TestCase):
def test_simple(self):
template ... | 4,323 | true | 0.085913 | median | code | normalized |
# Copyright 2018 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... | 4,153 | true | 0.095207 | median | code | normalized |
# import
## batteries
import os, sys
import re
from functools import partial
import types
import logging
import tempfile
import shutil
import glob
from collections import defaultdict
from random import shuffle
from StringIO import StringIO
## 3rd party
import numpy as np
import pandas as pd
from SIPSim_pymix import mix... | 4,198 | true | 0.077885 | median | code | normalized |
# Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | 4,163 | true | 0.122811 | median | code | normalized |
import AppKit
import objc
from PyObjCTools.TestSupport import TestCase, min_os_level
class TestNSGraphics(TestCase):
def testConstants(self):
self.assertEqual(AppKit.NSCompositeClear, 0)
self.assertEqual(AppKit.NSCompositeCopy, 1)
self.assertEqual(AppKit.NSCompositeSourceOver, 2)
s... | 4,170 | true | 0.105082 | median | code | normalized |
"""Tests for the clip module."""
import warnings
from distutils.version import LooseVersion
import numpy as np
import pandas as pd
import shapely
from shapely.geometry import (
Polygon,
Point,
LineString,
LinearRing,
GeometryCollection,
MultiPoint,
)
import geopandas
from geopandas import Ge... | 4,146 | true | 0.146081 | median | code | normalized |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | 4,311 | true | 0.159614 | median | code | normalized |
from onelang_core import *
import OneLang.One.Ast.Expressions as exprs
import OneLang.One.Ast.Statements as stats
import OneLang.One.Ast.Types as types
import OneLang.One.Ast.AstTypes as astTypes
import OneLang.One.Ast.References as refs
import OneLang.One.Ast.Interfaces as ints
import onelang_core as one
import json
i... | 4,178 | true | 0.094757 | median | code | normalized |
from __future__ import print_function
import numpy as np
from openmdao.api import ExplicitComponent, Group, IndepVarComp
from wisdem.commonse.utilities import hstack, vstack
from wisdem.commonse.csystem import DirectionVector
from wisdem.commonse import gravity
# This is an extremely simple RNA mass calculator that s... | 4,164 | true | 0.096086 | median | code | normalized |
#
# Copyright (c) 2019, salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
#
import abc
import http.client
import itertools
import logging
import sys
import django
from django... | 4,260 | true | 0.071534 | median | code | normalized |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from aldryn_newsblog.utils.migration import rename_tables_old_to_new, rename_tables_new_to_old
class Migration(SchemaMigration):
def forwards(self,... | 4,115 | true | 0.133686 | median | code | normalized |
"""
Tests for line search routines
"""
from numpy.testing import (assert_, assert_equal, assert_array_almost_equal,
assert_array_almost_equal_nulp, assert_warns,
suppress_warnings)
import scipy.optimize.linesearch as ls
import scipy.optimize.nonlin as nl #(LS)
from ... | 4,204 | true | 0.135753 | median | code | normalized |
import time
import tkinter as tk
from tkinter import *
import tkinter.filedialog as filedialog
from tkinter.filedialog import askopenfilename
import utils.utils as util
import utils.similarity_measures as sm
import SMAP.MatrixProfile as mp
import matplotlib
matplotlib.use("TkAgg")
from matplotlib.backends.backend_tkagg... | 4,340 | true | 0.12298 | median | code | normalized |
# 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... | 4,144 | true | 0.12256 | median | code | normalized |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.