code stringlengths 2k 1.04M | repo_path stringlengths 5 517 | parsed_code stringlengths 0 1.04M | quality_prob float64 0.02 0.95 | learning_prob float64 0.02 0.93 |
|---|---|---|---|---|
import logging
from django.core.exceptions import ObjectDoesNotExist
from django.db import DataError
from ApiManager.models import ProjectInfo, ModuleInfo, TestCaseInfo, UserInfo, EnvInfo, TestReports, DebugTalk, \
TestSuite
logger = logging.getLogger('HttpRunnerManager')
def add_register_data(**kwargs):
"... | ApiManager/utils/operation.py | import logging
from django.core.exceptions import ObjectDoesNotExist
from django.db import DataError
from ApiManager.models import ProjectInfo, ModuleInfo, TestCaseInfo, UserInfo, EnvInfo, TestReports, DebugTalk, \
TestSuite
logger = logging.getLogger('HttpRunnerManager')
def add_register_data(**kwargs):
"... | 0.19433 | 0.079139 |
import unittest2 as unittest
import rdflib
import numpy as np
from osp.core.namespaces import cuba
from osp.core.ontology.cuba import rdflib_cuba
from osp.core.namespaces import owl
try:
from osp.core.namespaces import city
except ImportError:
from osp.core.ontology import Parser
from osp.core.namespaces ... | tests/test_ontology_entity.py | import unittest2 as unittest
import rdflib
import numpy as np
from osp.core.namespaces import cuba
from osp.core.ontology.cuba import rdflib_cuba
from osp.core.namespaces import owl
try:
from osp.core.namespaces import city
except ImportError:
from osp.core.ontology import Parser
from osp.core.namespaces ... | 0.571288 | 0.452475 |
import re
import sys
import os.path as osp
import platform
from setuptools import setup, Extension
# Ensure user has the correct Python version
if sys.version_info < (3, 6):
print("Mathics does not support Python %d.%d" % sys.version_info[:2])
sys.exit(-1)
def get_srcdir():
filename = osp.normcase(osp.di... | setup.py | import re
import sys
import os.path as osp
import platform
from setuptools import setup, Extension
# Ensure user has the correct Python version
if sys.version_info < (3, 6):
print("Mathics does not support Python %d.%d" % sys.version_info[:2])
sys.exit(-1)
def get_srcdir():
filename = osp.normcase(osp.di... | 0.253214 | 0.245452 |
from registration.backends.default.urls import *
from django.contrib import admin
# Add next two lines to display static and media files
# then add +static statement at the end of the urlpatterns
from django.conf import *
from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.... | bbapi/urls.py | from registration.backends.default.urls import *
from django.contrib import admin
# Add next two lines to display static and media files
# then add +static statement at the end of the urlpatterns
from django.conf import *
from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.... | 0.355887 | 0.04888 |
import argparse
import logging
import os
import sys
import numpy as np
from naslib.optimizers.discrete.re import RegularizedEvolution as RE
from naslib.optimizers.discrete.re import Searcher as RESearcher
from naslib.optimizers.discrete.rs import RandomSearch as RS
from naslib.optimizers.discrete.rs import Searcher a... | naslib/benchmarks/nasbench201/runner.py | import argparse
import logging
import os
import sys
import numpy as np
from naslib.optimizers.discrete.re import RegularizedEvolution as RE
from naslib.optimizers.discrete.re import Searcher as RESearcher
from naslib.optimizers.discrete.rs import RandomSearch as RS
from naslib.optimizers.discrete.rs import Searcher a... | 0.33928 | 0.138607 |
import json
import os
import platform
import subprocess
from distutils.util import strtobool
from pathlib import Path
import pytest
def check_dict(check, expected):
""" Recursively check a dictionary of dictionaries """
for key, val in expected.items():
if isinstance(val, dict):
check_dic... | tests/test_templates.py | import json
import os
import platform
import subprocess
from distutils.util import strtobool
from pathlib import Path
import pytest
def check_dict(check, expected):
""" Recursively check a dictionary of dictionaries """
for key, val in expected.items():
if isinstance(val, dict):
check_dic... | 0.419172 | 0.494873 |
import abc
from typing import Any, Type, Iterable, List, Optional, Sequence, Set, TYPE_CHECKING, Tuple, Union
import numpy as np
from . import options
from .configurations.formulation import ColumnFormulation
from .utilities.basics import Array, Bounds, Groups, TableFormatter, format_number, format_se
# only impor... | pyblp/parameters.py |
import abc
from typing import Any, Type, Iterable, List, Optional, Sequence, Set, TYPE_CHECKING, Tuple, Union
import numpy as np
from . import options
from .configurations.formulation import ColumnFormulation
from .utilities.basics import Array, Bounds, Groups, TableFormatter, format_number, format_se
# only impor... | 0.944574 | 0.51312 |
import random
from typing import Any, Iterable, List
import pyspark.sql as ps
from fugue_spark._utils.convert import to_schema, to_spark_schema
from pyspark import RDD
from pyspark.sql import SparkSession
from pyspark.sql.functions import lit
_PARTITION_DUMMY_KEY = "__partition_dummy_key__"
def hash_repartition(
... | fugue_spark/_utils/partition.py | import random
from typing import Any, Iterable, List
import pyspark.sql as ps
from fugue_spark._utils.convert import to_schema, to_spark_schema
from pyspark import RDD
from pyspark.sql import SparkSession
from pyspark.sql.functions import lit
_PARTITION_DUMMY_KEY = "__partition_dummy_key__"
def hash_repartition(
... | 0.517083 | 0.505127 |
in a user-friendly way."""
import hashlib
from two1.bitcoin.utils import bytes_to_str
class Hash(object):
""" Wrapper around a byte string for handling SHA-256 hashes used
in bitcoin. Specifically, this class is useful for disambiguating
the required hash ordering.
This assumes that a he... | two1/bitcoin/hash.py | in a user-friendly way."""
import hashlib
from two1.bitcoin.utils import bytes_to_str
class Hash(object):
""" Wrapper around a byte string for handling SHA-256 hashes used
in bitcoin. Specifically, this class is useful for disambiguating
the required hash ordering.
This assumes that a he... | 0.945096 | 0.62157 |
import copy
import enum
from typing import Iterable, Optional
from intervaltree import IntervalTree, Interval
class ResourceType(enum.IntEnum):
"Enumeration to determine which kind of resource we're managing."
CPU = 1
MEMORY = 0
class ResourcePool:
"""A pool of resources.
This is the basic str... | schedgym/pool.py | import copy
import enum
from typing import Iterable, Optional
from intervaltree import IntervalTree, Interval
class ResourceType(enum.IntEnum):
"Enumeration to determine which kind of resource we're managing."
CPU = 1
MEMORY = 0
class ResourcePool:
"""A pool of resources.
This is the basic str... | 0.908418 | 0.535645 |
import numpy as np
import matplotlib.pyplot as plt
class Network(object):
def __init__(self, players=[], tdmas=[], l16s=[]):
self.tdmas = tdmas
self.set_l16s(l16s)
self.players = players
self.history = []
self.reset_counters()
def __repr__(self):
s = ''.join(s... | network.py | import numpy as np
import matplotlib.pyplot as plt
class Network(object):
def __init__(self, players=[], tdmas=[], l16s=[]):
self.tdmas = tdmas
self.set_l16s(l16s)
self.players = players
self.history = []
self.reset_counters()
def __repr__(self):
s = ''.join(s... | 0.361616 | 0.502258 |
import logging
import time
import unittest
from BeautifulReport import BeautifulReport
from po.config import conf
from po.config.conf import tcPath
from TestRunner import HTMLTestRunner
from po.models.log import Logger
log = Logger(__name__)
# 用HTMLTestRunner 实现的测试报告
def testreport():
"""
:return:
"""
... | po/models/testreport.py | import logging
import time
import unittest
from BeautifulReport import BeautifulReport
from po.config import conf
from po.config.conf import tcPath
from TestRunner import HTMLTestRunner
from po.models.log import Logger
log = Logger(__name__)
# 用HTMLTestRunner 实现的测试报告
def testreport():
"""
:return:
"""
... | 0.272508 | 0.1011 |
"OrderPortal web application server."
import logging
import os
import sys
import tornado.web
import tornado.ioloop
from orderportal import constants
from orderportal import designs
from orderportal import settings
from orderportal import utils
from orderportal import uimodules
from orderportal.requesthandler import ... | orderportal/app_orderportal.py | "OrderPortal web application server."
import logging
import os
import sys
import tornado.web
import tornado.ioloop
from orderportal import constants
from orderportal import designs
from orderportal import settings
from orderportal import utils
from orderportal import uimodules
from orderportal.requesthandler import ... | 0.116966 | 0.044266 |
import asyncio
from unittest.mock import patch, MagicMock
import homeassistant.components.ffmpeg as ffmpeg
from homeassistant.bootstrap import setup_component, async_setup_component
from tests.common import (
get_test_home_assistant, assert_setup_component, mock_coro)
class MockFFmpegDev(ffmpeg.FFmpegBase):
... | tests/components/test_ffmpeg.py | import asyncio
from unittest.mock import patch, MagicMock
import homeassistant.components.ffmpeg as ffmpeg
from homeassistant.bootstrap import setup_component, async_setup_component
from tests.common import (
get_test_home_assistant, assert_setup_component, mock_coro)
class MockFFmpegDev(ffmpeg.FFmpegBase):
... | 0.7237 | 0.283174 |
from django.db import models
from django.contrib.auth.models import AbstractUser
from datetime import date
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from dateutil.relativedelta import relativedelta
from django.core.validators import FileExtensionValidator
from django.conf... | accounts/models.py | from django.db import models
from django.contrib.auth.models import AbstractUser
from datetime import date
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from dateutil.relativedelta import relativedelta
from django.core.validators import FileExtensionValidator
from django.conf... | 0.475605 | 0.114146 |
import os
import sys
import torch
from torch.autograd import Variable
import shutil
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import torchvision.models as models
class Hed(nn.Module):
def __init__(self):
super(Hed, self).__init__()
self.vg... | ChipGAN/models/model.py | import os
import sys
import torch
from torch.autograd import Variable
import shutil
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import torchvision.models as models
class Hed(nn.Module):
def __init__(self):
super(Hed, self).__init__()
self.vg... | 0.625667 | 0.337613 |
from cltk.corpus.utils.importer import CorpusImporter
from cltk.tokenize.sentence import TokenizeSentence
from cltk.tokenize.word import nltk_tokenize_words
from cltk.tokenize.word import WordTokenizer
from cltk.tokenize.line import LineTokenizer
import os
import unittest
__license__ = 'MIT License. See LICENSE.'
cl... | cltk/tests/test_tokenize.py | from cltk.corpus.utils.importer import CorpusImporter
from cltk.tokenize.sentence import TokenizeSentence
from cltk.tokenize.word import nltk_tokenize_words
from cltk.tokenize.word import WordTokenizer
from cltk.tokenize.line import LineTokenizer
import os
import unittest
__license__ = 'MIT License. See LICENSE.'
cl... | 0.249722 | 0.220741 |
import argparse
import json
import os
from typing import List, Dict
import matplotlib
import matplotlib.font_manager as fm
import numpy
import scipy.signal
parser = argparse.ArgumentParser()
parser.add_argument("paths_result_directory", nargs='+')
parser.add_argument("--path_root", type=str)
parser.add_argument("--pa... | bin/make_graph_report.py | import argparse
import json
import os
from typing import List, Dict
import matplotlib
import matplotlib.font_manager as fm
import numpy
import scipy.signal
parser = argparse.ArgumentParser()
parser.add_argument("paths_result_directory", nargs='+')
parser.add_argument("--path_root", type=str)
parser.add_argument("--pa... | 0.427636 | 0.218398 |
import argparse
import os
import sys
import tensorflow as tf
sys.path.append(os.path.join(os.path.dirname(__file__), '../../..'))
from util import freeze_graph, read_test_results, write_test_results
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
# Execution starts here
if __name__ == '__main__':
# Parse arguments
... | test/unit_test/add_broadcast/graph/model.py | import argparse
import os
import sys
import tensorflow as tf
sys.path.append(os.path.join(os.path.dirname(__file__), '../../..'))
from util import freeze_graph, read_test_results, write_test_results
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
# Execution starts here
if __name__ == '__main__':
# Parse arguments
... | 0.397821 | 0.110591 |
from __future__ import unicode_literals
import re
import time
from netmiko.base_connection import BaseConnection
from netmiko.scp_handler import BaseFileTransfer
from netmiko.py23_compat import text_type
class JuniperBase(BaseConnection):
"""
Implement methods for interacting with Juniper Networks devices.
... | netmiko/juniper/juniper.py | from __future__ import unicode_literals
import re
import time
from netmiko.base_connection import BaseConnection
from netmiko.scp_handler import BaseFileTransfer
from netmiko.py23_compat import text_type
class JuniperBase(BaseConnection):
"""
Implement methods for interacting with Juniper Networks devices.
... | 0.781789 | 0.101545 |
import fnmatch
import logging
import os
import shutil
from .docker_base_task import DockerBaseBundleTask
from .target import DockerJvmAppTarget
from pants.backend.jvm.targets.jvm_app import JvmApp
from pants.base.exceptions import TaskError
from pants.backend.jvm.subsystems.jvm_tool_mixin import JvmToolMixin
logge... | src/python/verst/pants/docker/docker_jvm_app_bundle_task.py | import fnmatch
import logging
import os
import shutil
from .docker_base_task import DockerBaseBundleTask
from .target import DockerJvmAppTarget
from pants.backend.jvm.targets.jvm_app import JvmApp
from pants.base.exceptions import TaskError
from pants.backend.jvm.subsystems.jvm_tool_mixin import JvmToolMixin
logge... | 0.332852 | 0.044494 |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from vms.models import (Dc, Iso, VmTemplate, Image, Node, DcNode, Storage, NodeStorage, Vm, Subnet, IPAddress,
SnapshotDefine, Snapshot, BackupDefine, Backup)
from vms.admin... | vms/admin.py | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from vms.models import (Dc, Iso, VmTemplate, Image, Node, DcNode, Storage, NodeStorage, Vm, Subnet, IPAddress,
SnapshotDefine, Snapshot, BackupDefine, Backup)
from vms.admin... | 0.407687 | 0.058212 |
from django.db.models.query_utils import refs_expression
from django.test import TestCase
from .models import User, UserProfile, UserProject
# Create your tests here.
class TestUser(TestCase):
'''
test case to test user methods, create user, delete user, Get user
'''
def setUp(self):
self.new_user = User... | jury/tests.py | from django.db.models.query_utils import refs_expression
from django.test import TestCase
from .models import User, UserProfile, UserProject
# Create your tests here.
class TestUser(TestCase):
'''
test case to test user methods, create user, delete user, Get user
'''
def setUp(self):
self.new_user = User... | 0.369201 | 0.315551 |
import pytest
from castoredc_api import CastorException
from castoredc_api.importer.import_data import import_data
class TestImportTranslationSync:
"""Tests uploading data to Castor while translating external data points."""
def test_import_study_value_translate_success(self, import_study):
"""Tests... | castoredc_api/tests/test_import/test_sync_import/test_import_translation_sync.py | import pytest
from castoredc_api import CastorException
from castoredc_api.importer.import_data import import_data
class TestImportTranslationSync:
"""Tests uploading data to Castor while translating external data points."""
def test_import_study_value_translate_success(self, import_study):
"""Tests... | 0.584153 | 0.488466 |
print('pgu.fonts - This module is alpha, and is subject to change.')
import pygame
from pygame.locals import *
class TileFont:
"""Creates an instance of the TileFont class. Interface compatible
with pygame.Font
TileFonts are fonts that are stored in a tiled image. Where the image
opaque, it a... | pgu/fonts.py | print('pgu.fonts - This module is alpha, and is subject to change.')
import pygame
from pygame.locals import *
class TileFont:
"""Creates an instance of the TileFont class. Interface compatible
with pygame.Font
TileFonts are fonts that are stored in a tiled image. Where the image
opaque, it a... | 0.595728 | 0.234429 |
from splinter import Browser
from bs4 import BeautifulSoup as bs
from webdriver_manager.chrome import ChromeDriverManager
import pandas as pd
import time
data = {}
def scrape_all():
# Initiate headless driver for deployment
executable_path = {'executable_path': ChromeDriverManager().install()}
browser = ... | Mission_to_Mars/scrape_mars.py | from splinter import Browser
from bs4 import BeautifulSoup as bs
from webdriver_manager.chrome import ChromeDriverManager
import pandas as pd
import time
data = {}
def scrape_all():
# Initiate headless driver for deployment
executable_path = {'executable_path': ChromeDriverManager().install()}
browser = ... | 0.417865 | 0.213357 |
import unittest
from cybox.test import EntityTestCase, round_trip
from maec.package import Package
class TestPackage(EntityTestCase, unittest.TestCase):
klass = Package
_full_dict = {
'malware_subjects':[{
'findings_bundles': {
'bundle': [{
'actions': ... | maec/test/package/package_test.py |
import unittest
from cybox.test import EntityTestCase, round_trip
from maec.package import Package
class TestPackage(EntityTestCase, unittest.TestCase):
klass = Package
_full_dict = {
'malware_subjects':[{
'findings_bundles': {
'bundle': [{
'actions': ... | 0.501221 | 0.333992 |
import os
import torch
import pytorch3d
import pytorch3d.loss
import numpy as np
from scipy.spatial.transform import Rotation
import pandas as pd
import point_cloud_utils as pcu
from tqdm.auto import tqdm
from models.utils import *
from .misc import BlackHole
def load_xyz(xyz_dir):
all_pcls = {}
for fn in tqd... | utils/evaluate.py | import os
import torch
import pytorch3d
import pytorch3d.loss
import numpy as np
from scipy.spatial.transform import Rotation
import pandas as pd
import point_cloud_utils as pcu
from tqdm.auto import tqdm
from models.utils import *
from .misc import BlackHole
def load_xyz(xyz_dir):
all_pcls = {}
for fn in tqd... | 0.669961 | 0.299144 |
import argparse
import os
import subprocess
import mock
from yapsy.PluginManager import PluginManager
import statick_tool
from statick_tool.config import Config
from statick_tool.package import Package
from statick_tool.plugin_context import PluginContext
from statick_tool.plugins.tool.jshint_tool_plugin import JSHin... | tests/web_tool_plugins/jshint_tool_plugin/test_jshint_tool_plugin.py | import argparse
import os
import subprocess
import mock
from yapsy.PluginManager import PluginManager
import statick_tool
from statick_tool.config import Config
from statick_tool.package import Package
from statick_tool.plugin_context import PluginContext
from statick_tool.plugins.tool.jshint_tool_plugin import JSHin... | 0.57332 | 0.139221 |
from CIM14.IEC61970.Wires.TapChanger import TapChanger
class RatioTapChanger(TapChanger):
"""A tap changer that changes the voltage ratio impacting the voltage magnitude but not direclty the phase angle across the transformer..
"""
def __init__(self, tculControlMode="volt", Winding=None, TransformerWindi... | CIM14/IEC61970/Wires/RatioTapChanger.py |
from CIM14.IEC61970.Wires.TapChanger import TapChanger
class RatioTapChanger(TapChanger):
"""A tap changer that changes the voltage ratio impacting the voltage magnitude but not direclty the phase angle across the transformer..
"""
def __init__(self, tculControlMode="volt", Winding=None, TransformerWindi... | 0.912163 | 0.162579 |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import fms_core.schema_validators
import re
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('fms_core', '0025_v3_5_0'),
... | backend/fms_core/migrations/0026_v3_5_0.py |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import fms_core.schema_validators
import re
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('fms_core', '0025_v3_5_0'),
... | 0.576184 | 0.138229 |
import itertools
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.utils.rnn as rnn_utils
import torchvision.models as models
from resnet import resnet50
class CompatModel(nn.Module):
def __init__(self, embed_size=1000, need_rep=False, vocabulary=None):
... | baselines/concat/model.py | import itertools
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.utils.rnn as rnn_utils
import torchvision.models as models
from resnet import resnet50
class CompatModel(nn.Module):
def __init__(self, embed_size=1000, need_rep=False, vocabulary=None):
... | 0.933195 | 0.498474 |
from typing import Dict, Optional
from overrides import overrides
import torch
from allennlp.common.checks import ConfigurationError
from allennlp.modules.span_extractors import (
SpanExtractor, EndpointSpanExtractor, SelfAttentiveSpanExtractor,
BidirectionalEndpointSpanExtractor)
from allennlp.modules.span_e... | modules/span_extractors/muti_feature_extractor.py | from typing import Dict, Optional
from overrides import overrides
import torch
from allennlp.common.checks import ConfigurationError
from allennlp.modules.span_extractors import (
SpanExtractor, EndpointSpanExtractor, SelfAttentiveSpanExtractor,
BidirectionalEndpointSpanExtractor)
from allennlp.modules.span_e... | 0.91057 | 0.150621 |
from .site import Site
import os
import socket
from ..minirunner import Node
class CCParallel(Site):
"""Object representing execution in the local environment, e.g. a laptop."""
def command(self, cmd, sec):
"""Generate a complete command line to be run with the specified execution variables.
... | ceci/sites/ccin2p3.py | from .site import Site
import os
import socket
from ..minirunner import Node
class CCParallel(Site):
"""Object representing execution in the local environment, e.g. a laptop."""
def command(self, cmd, sec):
"""Generate a complete command line to be run with the specified execution variables.
... | 0.429669 | 0.223494 |
from typing import Type
from unittest import mock
from unittest.mock import patch
import pytest
from aea.common import Address
from aea.protocols.base import Message
from aea.protocols.dialogue.base import Dialogue as BaseDialogue
from aea.protocols.dialogue.base import DialogueLabel
from packages.valory.protocols.a... | tests/test_packages/test_protocols/test_acn.py | from typing import Type
from unittest import mock
from unittest.mock import patch
import pytest
from aea.common import Address
from aea.protocols.base import Message
from aea.protocols.dialogue.base import Dialogue as BaseDialogue
from aea.protocols.dialogue.base import DialogueLabel
from packages.valory.protocols.a... | 0.899552 | 0.179999 |
import statistics
class PlayerAi:
"""
Represents a chess-playing AI.
"""
def __init__(self, model):
"""
``model`` - A keras model which predicts the fitness of a board state
given a feature vector representing the board.
"""
self.__model = model
def get_m... | source/Dense/PlayerAi.py | import statistics
class PlayerAi:
"""
Represents a chess-playing AI.
"""
def __init__(self, model):
"""
``model`` - A keras model which predicts the fitness of a board state
given a feature vector representing the board.
"""
self.__model = model
def get_m... | 0.742982 | 0.545225 |
class CDLTransform:
"""
CDLTransform
"""
def __init__(self):
pass
def CreateFromFile(self, src, cccid):
pass
def equals(self):
pass
def getXML(self):
pass
def setXML(self, xmltext):
pass
def getSlope(self):
... | src/pyglue/DocStrings/CDLTransform.py | class CDLTransform:
"""
CDLTransform
"""
def __init__(self):
pass
def CreateFromFile(self, src, cccid):
pass
def equals(self):
pass
def getXML(self):
pass
def setXML(self, xmltext):
pass
def getSlope(self):
... | 0.879406 | 0.428891 |
"""Tests for kfp.v2.ds.artifact module."""
import unittest
import textwrap
from kfp.v2.dsl import artifact
class _MyArtifact(artifact.Artifact):
TYPE_NAME = 'MyTypeName'
PROPERTIES = {
'int1': artifact.Property(
type=artifact.PropertyType.INT,
description='An integer-typed property'),
... | sdk/python/kfp/v2/dsl/artifact_test.py | """Tests for kfp.v2.ds.artifact module."""
import unittest
import textwrap
from kfp.v2.dsl import artifact
class _MyArtifact(artifact.Artifact):
TYPE_NAME = 'MyTypeName'
PROPERTIES = {
'int1': artifact.Property(
type=artifact.PropertyType.INT,
description='An integer-typed property'),
... | 0.700178 | 0.270932 |
import torch
import logging
import numpy as np
import torch.nn.functional as F
# Method taken from tensorflow/models skipgram
from torch.nn import EmbeddingBag
def read_analogies(file, w2id):
"""Reads through the analogy question file.
Returns:
questions: a [n, 4] numpy array containing the analogy que... | evaluation/analogy_questions/analogy_questions.py | import torch
import logging
import numpy as np
import torch.nn.functional as F
# Method taken from tensorflow/models skipgram
from torch.nn import EmbeddingBag
def read_analogies(file, w2id):
"""Reads through the analogy question file.
Returns:
questions: a [n, 4] numpy array containing the analogy que... | 0.843315 | 0.589303 |
import os
from http import HTTPStatus
from uuid import UUID
import httpx
from api_pedidos.esquema import Item
from api_pedidos.excecao import (
FalhaDeComunicacaoError,
PedidoNaoEncontradoError,
)
# tenant e apikey fixos somente para demonstrações
APIKEY = os.environ.get("APIKEY", "coloque aqui sua apikey")
... | api_pedidos/magalu_api.py | import os
from http import HTTPStatus
from uuid import UUID
import httpx
from api_pedidos.esquema import Item
from api_pedidos.excecao import (
FalhaDeComunicacaoError,
PedidoNaoEncontradoError,
)
# tenant e apikey fixos somente para demonstrações
APIKEY = os.environ.get("APIKEY", "coloque aqui sua apikey")
... | 0.289271 | 0.05848 |
import re
from genie.libs.parser.utils.common import Common
# Genie
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Any, Optional
# ==========================================================================================
# Schema for 'show controller fia diagshell {diagshell_... | src/genie/libs/parser/iosxr/show_controllers.py | import re
from genie.libs.parser.utils.common import Common
# Genie
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Any, Optional
# ==========================================================================================
# Schema for 'show controller fia diagshell {diagshell_... | 0.396769 | 0.158044 |
import re
import serial
import serial.tools.list_ports
class eNoseConnector:
""" Connects to an eNose on the given port with the given baudrate.
Parses the input in a new thread and updates its values accordingly.
After each full received frame, the onUpdate is triggered.
Use onUpdate lik... | test_equipment/Classes/eNoseConnector.py | import re
import serial
import serial.tools.list_ports
class eNoseConnector:
""" Connects to an eNose on the given port with the given baudrate.
Parses the input in a new thread and updates its values accordingly.
After each full received frame, the onUpdate is triggered.
Use onUpdate lik... | 0.524395 | 0.216798 |
import server
import md5
import os
import fnmatch
import string
import tempfile
import rcslib
class DirSupport:
def __init__(self):
self._dirstack = []
def __del__(self):
self._close()
def _close(self):
while self._dirstack:
self.back()
def pwd(self):
re... | Demo/pdist/RCSProxy.py | import server
import md5
import os
import fnmatch
import string
import tempfile
import rcslib
class DirSupport:
def __init__(self):
self._dirstack = []
def __del__(self):
self._close()
def _close(self):
while self._dirstack:
self.back()
def pwd(self):
re... | 0.360151 | 0.080069 |
from __future__ import absolute_import
from datetime import datetime
import time
try:
from shlex import quote as _cmd_quote # pylint: disable=E0611
except: # pylint: disable=W0702
from pipes import quote as _cmd_quote
# Import salt libs
import salt.utils
from salt.ext import six
from salt.ext.six import str... | salt/modules/win_useradd.py | from __future__ import absolute_import
from datetime import datetime
import time
try:
from shlex import quote as _cmd_quote # pylint: disable=E0611
except: # pylint: disable=W0702
from pipes import quote as _cmd_quote
# Import salt libs
import salt.utils
from salt.ext import six
from salt.ext.six import str... | 0.722625 | 0.125815 |
import ray
from ray.util.sgd.torch import TrainingOperator
from ray.util.sgd import TorchTrainer
from ray import tune
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data.dataloader import DataLoader
import raydp
from raydp.torch import TorchEstimator
from raydp.utils import random_... | examples/raysgd_nyctaxi.py | import ray
from ray.util.sgd.torch import TrainingOperator
from ray.util.sgd import TorchTrainer
from ray import tune
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data.dataloader import DataLoader
import raydp
from raydp.torch import TorchEstimator
from raydp.utils import random_... | 0.91059 | 0.493592 |
from django.conf import settings
from django import forms
from django.template import Context
from django.forms.widgets import FileInput
from django.utils.encoding import force_unicode
from django.template.loader import render_to_string
from django.forms.util import flatatt
class ImageInput(FileInput):
"""
Wi... | oscar/forms/widgets.py | from django.conf import settings
from django import forms
from django.template import Context
from django.forms.widgets import FileInput
from django.utils.encoding import force_unicode
from django.template.loader import render_to_string
from django.forms.util import flatatt
class ImageInput(FileInput):
"""
Wi... | 0.569254 | 0.268513 |
import os
import shutil
import sys
import pandas
import tensorflow
from sklearn import model_selection
from tensorflow.contrib import learn, layers, tensorboard
ATTRIBUTES = [
{
'name': 'user',
'type': str,
'path': os.path.join(os.path.dirname(__file__), '../resources/movie-lens-100k-users... | elephant/recommendation.py | import os
import shutil
import sys
import pandas
import tensorflow
from sklearn import model_selection
from tensorflow.contrib import learn, layers, tensorboard
ATTRIBUTES = [
{
'name': 'user',
'type': str,
'path': os.path.join(os.path.dirname(__file__), '../resources/movie-lens-100k-users... | 0.381335 | 0.21767 |
import os
import numpy as np
import pandas as pd
import yaml
from mantraml.tasks import Task
import pytest
class MockData:
X = np.array([[1,2,3,4,5,6,7,8,9], [2,3,4,5,6,7,8,9,10]]).T
y = np.array([10, 11, 12, 13, 14, 15, 16, 17, 18])
def __len__(self):
return len(self.y)
def test_training_spl... | mantraml/tests/test_task.py | import os
import numpy as np
import pandas as pd
import yaml
from mantraml.tasks import Task
import pytest
class MockData:
X = np.array([[1,2,3,4,5,6,7,8,9], [2,3,4,5,6,7,8,9,10]]).T
y = np.array([10, 11, 12, 13, 14, 15, 16, 17, 18])
def __len__(self):
return len(self.y)
def test_training_spl... | 0.473414 | 0.705975 |
import datetime
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.db.models.loading import get_model
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy as _
from django.views.generic import (ListView, FormView, DetailView, DeleteVi... | oscar/apps/dashboard/vouchers/views.py | import datetime
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.db.models.loading import get_model
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy as _
from django.views.generic import (ListView, FormView, DetailView, DeleteVi... | 0.426322 | 0.061678 |
import json
from django.test import TestCase
from django.test.client import Client
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User as DjangoUser
from treeio.core.models import User, Group, Perspective, ModuleSetting, Object
from tr... | treeio/infrastructure/api/tests.py | import json
from django.test import TestCase
from django.test.client import Client
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User as DjangoUser
from treeio.core.models import User, Group, Perspective, ModuleSetting, Object
from tr... | 0.381104 | 0.135661 |
from functools import wraps
import Queue
import time
from twisted.internet.defer import Deferred
from twisted.internet.task import LoopingCall
from twisted.python.failure import Failure
from system.logging import logger as log
__author__ = 'Sean'
_log = log.getLogger(__name__)
class RateLimitExceededError(Excepti... | system/decorators/ratelimit.py | from functools import wraps
import Queue
import time
from twisted.internet.defer import Deferred
from twisted.internet.task import LoopingCall
from twisted.python.failure import Failure
from system.logging import logger as log
__author__ = 'Sean'
_log = log.getLogger(__name__)
class RateLimitExceededError(Excepti... | 0.703448 | 0.17037 |
from fabric.api import (
abort,
hide,
settings,
)
from fabric.colors import red
from fabtools.apache import (
disable_module,
enable_module,
disable_site,
enable_site,
_get_config_name,
)
from fabtools.require.deb import package
from fabtools.require.files import template_file
from fabt... | fabtools/require/apache.py | from fabric.api import (
abort,
hide,
settings,
)
from fabric.colors import red
from fabtools.apache import (
disable_module,
enable_module,
disable_site,
enable_site,
_get_config_name,
)
from fabtools.require.deb import package
from fabtools.require.files import template_file
from fabt... | 0.640861 | 0.176849 |
import unittest
import numpy as np
from extensions.ops.non_max_suppression import NonMaxSuppression
from mo.front.common.partial_infer.utils import int64_array
from mo.graph.graph import Node
from unit_tests.utils.graph import build_graph, regular_op_with_shaped_data, valued_const_with_data, result, connect
class ... | model-optimizer/unit_tests/extensions/ops/non_max_suppression_test.py |
import unittest
import numpy as np
from extensions.ops.non_max_suppression import NonMaxSuppression
from mo.front.common.partial_infer.utils import int64_array
from mo.graph.graph import Node
from unit_tests.utils.graph import build_graph, regular_op_with_shaped_data, valued_const_with_data, result, connect
class ... | 0.655777 | 0.534673 |
from tkinter import *
from model_railway_signals import *
import logging
#----------------------------------------------------------------------
# Configure the log level. If no 'level' is specified specified only warnings and errors
# will be generated. A level of 'INFO' will tell you what the various functions are ... | test_simple_example.py |
from tkinter import *
from model_railway_signals import *
import logging
#----------------------------------------------------------------------
# Configure the log level. If no 'level' is specified specified only warnings and errors
# will be generated. A level of 'INFO' will tell you what the various functions are ... | 0.518302 | 0.436802 |
from django.test import TransactionTestCase
from myuw.models import VisitedLinkNew, CustomLink, PopularLink, User
from myuw.test import get_request_with_user
from myuw.dao.user import get_user_model
from myuw.dao.affiliation import get_all_affiliations
from myuw.dao.quicklinks import get_quicklink_data, get_link_label... | myuw/test/dao/test_quicklinks.py |
from django.test import TransactionTestCase
from myuw.models import VisitedLinkNew, CustomLink, PopularLink, User
from myuw.test import get_request_with_user
from myuw.dao.user import get_user_model
from myuw.dao.affiliation import get_all_affiliations
from myuw.dao.quicklinks import get_quicklink_data, get_link_label... | 0.525369 | 0.3581 |
from utils import parseSource, nodesToString, nodesToLines, dumpNodes, dumpTree
from converters import ImportNameConverter
def test_ImportNameGather_01():
src = """
import amodule
"""
matches = ImportNameConverter().gather( parseSource( src ) )
match = matches[ 0 ]
assert match.import_word.... | test-unit/PythonToJavascript/converters_test/ImportNameConverter_test.py | from utils import parseSource, nodesToString, nodesToLines, dumpNodes, dumpTree
from converters import ImportNameConverter
def test_ImportNameGather_01():
src = """
import amodule
"""
matches = ImportNameConverter().gather( parseSource( src ) )
match = matches[ 0 ]
assert match.import_word.... | 0.477554 | 0.492371 |
# a list of tuples
# Each tuple contains the standard name followed by a regex for the formula
# terms
dimless_vertical_coordinates = [
("atmosphere_ln_pressure_coordinate",
# "p0: var1 lev: var2"
r'(p0): ([A-Za-z][A-Za-z0-9_]*) (lev): ([A-Za-z][A-Za-z0-9_]*)'),
("atmosphere_sigma_coordinate",
# ... | compliance_checker/cf/appendix_d.py | # a list of tuples
# Each tuple contains the standard name followed by a regex for the formula
# terms
dimless_vertical_coordinates = [
("atmosphere_ln_pressure_coordinate",
# "p0: var1 lev: var2"
r'(p0): ([A-Za-z][A-Za-z0-9_]*) (lev): ([A-Za-z][A-Za-z0-9_]*)'),
("atmosphere_sigma_coordinate",
# ... | 0.426322 | 0.254115 |
import pytest
from .utils import act_and_assert
@pytest.mark.gfm
def test_list_blocks_231():
"""
Test case 231: If the list item is ordered, then it is also assigned a start number, based on the ordered list marker.
"""
# Arrange
source_markdown = """A paragraph
with two lines.
indented co... | test/test_markdown_list_blocks.py | import pytest
from .utils import act_and_assert
@pytest.mark.gfm
def test_list_blocks_231():
"""
Test case 231: If the list item is ordered, then it is also assigned a start number, based on the ordered list marker.
"""
# Arrange
source_markdown = """A paragraph
with two lines.
indented co... | 0.777469 | 0.628692 |
import typing as t
import mock
import pytest
from pca.application.interactor import (
Interactor,
RequestModel,
ResponseModel,
interactor_factory,
)
from pca.domain.entity import (
Entity,
SequenceId,
field,
)
from pca.domain.repository import Repository
from pca.exceptions import LogicErr... | pca/application/tests/test_interactor.py | import typing as t
import mock
import pytest
from pca.application.interactor import (
Interactor,
RequestModel,
ResponseModel,
interactor_factory,
)
from pca.domain.entity import (
Entity,
SequenceId,
field,
)
from pca.domain.repository import Repository
from pca.exceptions import LogicErr... | 0.561816 | 0.28793 |
from __future__ import absolute_import, division, print_function, \
with_statement
from ctypes import c_int, create_string_buffer, byref, c_void_p
import hashlib
from struct import pack, unpack
from shadowsocks.crypto import util
from shadowsocks.crypto import hkdf
from shadowsocks.common import ord, chr
EVP_... | shadowsocks/crypto/aead.py |
from __future__ import absolute_import, division, print_function, \
with_statement
from ctypes import c_int, create_string_buffer, byref, c_void_p
import hashlib
from struct import pack, unpack
from shadowsocks.crypto import util
from shadowsocks.crypto import hkdf
from shadowsocks.common import ord, chr
EVP_... | 0.535341 | 0.146942 |
"""System test: test conv2d act"""
# pylint: disable=invalid-name, unused-argument, import-outside-toplevel
import pytest
import os
import tensorflow as tf
import numpy as np
import sys
from tflite_test_runner import TfliteTestRunner
def _make_module(n, i_channels, i_size, k_size, o_channels, strides, padding, dilat... | tests/importer/tflite_/combine/test_conv2d_act.py | """System test: test conv2d act"""
# pylint: disable=invalid-name, unused-argument, import-outside-toplevel
import pytest
import os
import tensorflow as tf
import numpy as np
import sys
from tflite_test_runner import TfliteTestRunner
def _make_module(n, i_channels, i_size, k_size, o_channels, strides, padding, dilat... | 0.804828 | 0.452899 |
import arcpy
from collections import defaultdict
# Author: <NAME> - ACTmapi Administrator
# Date: 17/09/2018
"""
This method calculates and returns the centre most point in a cluster
of points. This is required to find the centremost node of a polyline
which represents a road centreline.
in_table = r'<drive... | place_names.py | import arcpy
from collections import defaultdict
# Author: <NAME> - ACTmapi Administrator
# Date: 17/09/2018
"""
This method calculates and returns the centre most point in a cluster
of points. This is required to find the centremost node of a polyline
which represents a road centreline.
in_table = r'<drive... | 0.623033 | 0.40486 |
import os
import regex
import io
from natsort import natsorted, natsort_keygen
nkey = natsort_keygen()
count = 1
print(
"\nUWAGA!\nPLIK Z EWENTUALNYMI BŁĘDAMI ZOSTANIE ZAPISANY \
W <NAME> LOKALIZACJI!\n\n"
)
sciezka = input("Enter the path: ")
for subdir, dirs, files in os.walk(sciezka):
dirs.sort(key=n... | old_and_simple_and_deprecated/czy_sa_wkt_p31.py | import os
import regex
import io
from natsort import natsorted, natsort_keygen
nkey = natsort_keygen()
count = 1
print(
"\nUWAGA!\nPLIK Z EWENTUALNYMI BŁĘDAMI ZOSTANIE ZAPISANY \
W <NAME> LOKALIZACJI!\n\n"
)
sciezka = input("Enter the path: ")
for subdir, dirs, files in os.walk(sciezka):
dirs.sort(key=n... | 0.075563 | 0.071559 |
import calendar
import datetime
import locale
from google.cloud import datastore
def get_configs():
client = datastore.Client()
query = client.query(kind='Config')
return query.fetch()
def get_config_by_id(config_id):
client = datastore.Client()
key = client.key('Config', config_id)
return ... | datastore_queries_admin.py | import calendar
import datetime
import locale
from google.cloud import datastore
def get_configs():
client = datastore.Client()
query = client.query(kind='Config')
return query.fetch()
def get_config_by_id(config_id):
client = datastore.Client()
key = client.key('Config', config_id)
return ... | 0.278944 | 0.050565 |
from typing import (
Any,
Callable,
DefaultDict,
Generic,
Iterator,
List,
Set,
Tuple,
Type,
TypeVar,
cast,
)
import numpy as np
import pytest
import tensorflow as tf
from _pytest.fixtures import SubRequest
import gpflow
from gpflow.base import RegressionData
from gpflow.con... | tests/gpflow/posteriors/test_bo_integration.py | from typing import (
Any,
Callable,
DefaultDict,
Generic,
Iterator,
List,
Set,
Tuple,
Type,
TypeVar,
cast,
)
import numpy as np
import pytest
import tensorflow as tf
from _pytest.fixtures import SubRequest
import gpflow
from gpflow.base import RegressionData
from gpflow.con... | 0.927822 | 0.430387 |
import hail as hl
from hail.typecheck import typecheck, sequenceof
from hail.expr.expressions import expr_str, expr_call, expr_locus, expr_array
from typing import List
@typecheck(locus=expr_locus(),
alleles=expr_array(expr_str),
proband_call=expr_call,
father_call=expr_call,
... | hail/python/hail/experimental/phase_by_transmission.py | import hail as hl
from hail.typecheck import typecheck, sequenceof
from hail.expr.expressions import expr_str, expr_call, expr_locus, expr_array
from typing import List
@typecheck(locus=expr_locus(),
alleles=expr_array(expr_str),
proband_call=expr_call,
father_call=expr_call,
... | 0.836921 | 0.49109 |
import numpy as np
from mushroom_rl.algorithms.policy_search import REINFORCE, GPOMDP, eNAC
from mushroom_rl.approximators.parametric import LinearApproximator
from mushroom_rl.approximators.regressor import Regressor
from mushroom_rl.core import Core
from mushroom_rl.environments import LQR
from mushroom_rl.policy im... | examples/lqr_pg.py | import numpy as np
from mushroom_rl.algorithms.policy_search import REINFORCE, GPOMDP, eNAC
from mushroom_rl.approximators.parametric import LinearApproximator
from mushroom_rl.approximators.regressor import Regressor
from mushroom_rl.core import Core
from mushroom_rl.environments import LQR
from mushroom_rl.policy im... | 0.769427 | 0.386619 |
from cloudify import manager
from cloudify import logs
from cloudify.logs import CloudifyPluginLoggingHandler
from cloudify.exceptions import NonRecoverableError
class Endpoint(object):
def __init__(self, ctx):
self.ctx = ctx
def get_node(self, node_id):
raise NotImplementedError('Implemen... | cloudify/endpoint.py |
from cloudify import manager
from cloudify import logs
from cloudify.logs import CloudifyPluginLoggingHandler
from cloudify.exceptions import NonRecoverableError
class Endpoint(object):
def __init__(self, ctx):
self.ctx = ctx
def get_node(self, node_id):
raise NotImplementedError('Implemen... | 0.648244 | 0.072505 |
import functools
from google.protobuf.struct_pb2 import Struct
from google.cloud.proto.spanner.v1.transaction_pb2 import TransactionOptions
from google.cloud.proto.spanner.v1.transaction_pb2 import TransactionSelector
from google.api.core.exceptions import ServiceUnavailable
from google.cloud._helpers import _datetim... | spanner/google/cloud/spanner/snapshot.py | import functools
from google.protobuf.struct_pb2 import Struct
from google.cloud.proto.spanner.v1.transaction_pb2 import TransactionOptions
from google.cloud.proto.spanner.v1.transaction_pb2 import TransactionSelector
from google.api.core.exceptions import ServiceUnavailable
from google.cloud._helpers import _datetim... | 0.708515 | 0.226912 |
import os
from subprocess import check_output
import pandas as pd
from py2neo import Graph, Node, Relationship
import karmahutils as kut
version_info = "v0.1"
version_type = 'moonshade library'
authors = ['<NAME>']
contact = '<EMAIL>'
lib_name = 'MshNeo4j'
purpose = """QoL tools for interacting and maintaining neo4j ... | src/utils/MshNeo4j/__init__.py | import os
from subprocess import check_output
import pandas as pd
from py2neo import Graph, Node, Relationship
import karmahutils as kut
version_info = "v0.1"
version_type = 'moonshade library'
authors = ['<NAME>']
contact = '<EMAIL>'
lib_name = 'MshNeo4j'
purpose = """QoL tools for interacting and maintaining neo4j ... | 0.426083 | 0.080466 |
import matplotlib.pyplot as plt
import os
import collections
import time
import random
import cv2
import numpy as np
import torch
import torch.nn.functional as F
from PIL import Image
from blur_model import BlurModel
from dewarp import get_dewarping_matrix
from load_hdc import load_hdc
def optimize_model(model, sharp,... | train/estimate_psf.py | import matplotlib.pyplot as plt
import os
import collections
import time
import random
import cv2
import numpy as np
import torch
import torch.nn.functional as F
from PIL import Image
from blur_model import BlurModel
from dewarp import get_dewarping_matrix
from load_hdc import load_hdc
def optimize_model(model, sharp,... | 0.614394 | 0.719513 |
from pandac.PandaModules import DepthOffsetAttrib, NodePath, Vec3, Vec4, TextNode
from direct.directnotify import DirectNotifyGlobal
from direct.fsm.FSM import FSM
from direct.interval.FunctionInterval import Wait
from direct.interval.IntervalGlobal import Func, LerpHprInterval, LerpScaleInterval, LerpFunctionInterval
... | toontown/cogdominium/CogdoFlyingPlayer.py | from pandac.PandaModules import DepthOffsetAttrib, NodePath, Vec3, Vec4, TextNode
from direct.directnotify import DirectNotifyGlobal
from direct.fsm.FSM import FSM
from direct.interval.FunctionInterval import Wait
from direct.interval.IntervalGlobal import Func, LerpHprInterval, LerpScaleInterval, LerpFunctionInterval
... | 0.561215 | 0.135004 |
import requests
import zipfile
import io
from os.path import expanduser, join
from os import remove
from datetime import datetime, timedelta
import pandas as pd
from arctic.date import DateRange
from adagio.utils.date import date_shift
from adagio.utils.logging import get_logger
from adagio.utils.mongo import get_lib... | store_truefx_data.py | import requests
import zipfile
import io
from os.path import expanduser, join
from os import remove
from datetime import datetime, timedelta
import pandas as pd
from arctic.date import DateRange
from adagio.utils.date import date_shift
from adagio.utils.logging import get_logger
from adagio.utils.mongo import get_lib... | 0.446012 | 0.18881 |
import sys
try:
from indy_client import *
except ImportError as e:
print("Indy Client is required for this guild, "
"see doc for installing Indy Client.", file=sys.stderr)
print(str(e), file=sys.stderr)
sys.exit(-1)
try:
from indy_node import *
except ImportError as e:
print("Indy No... | indy_client/test/training/getting_started.py | import sys
try:
from indy_client import *
except ImportError as e:
print("Indy Client is required for this guild, "
"see doc for installing Indy Client.", file=sys.stderr)
print(str(e), file=sys.stderr)
sys.exit(-1)
try:
from indy_node import *
except ImportError as e:
print("Indy No... | 0.160069 | 0.10793 |
import unittest
from parameterized import parameterized
from airflow import AirflowException
from airflow.gcp.operators.spanner import \
CloudSpannerInstanceDeployOperator, \
CloudSpannerInstanceDeleteOperator, \
CloudSpannerInstanceDatabaseQueryOperator, \
CloudSpannerInstanceDatabaseDeployOperator, ... | tests/gcp/operators/test_spanner.py | import unittest
from parameterized import parameterized
from airflow import AirflowException
from airflow.gcp.operators.spanner import \
CloudSpannerInstanceDeployOperator, \
CloudSpannerInstanceDeleteOperator, \
CloudSpannerInstanceDatabaseQueryOperator, \
CloudSpannerInstanceDatabaseDeployOperator, ... | 0.459561 | 0.285521 |
import base64
import hashlib
import requests
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from django.core.exceptions import SuspiciousOperation
from django.db import transaction
from django.urls import reverse
from django.utils.encoding import force_bytes, smart... | oidc_rp/backends.py | import base64
import hashlib
import requests
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from django.core.exceptions import SuspiciousOperation
from django.db import transaction
from django.urls import reverse
from django.utils.encoding import force_bytes, smart... | 0.562898 | 0.118487 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os,sys
import torch
import torch.nn as nn
root_dir = os.path.join(os.path.dirname(__file__),... | src/lib/models/base.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os,sys
import torch
import torch.nn as nn
root_dir = os.path.join(os.path.dirname(__file__),... | 0.683736 | 0.075176 |
from __future__ import division, print_function
__author__ = "adrn <<EMAIL>>"
# Standard library
import os
import logging
# Third-party
from astropy import log as logger
import astropy.units as u
from astropy.coordinates.angles import rotation_matrix
import matplotlib.pyplot as plt
import numpy as np
from scipy.sign... | scripts/ensemble/ball_convergence_test.py | from __future__ import division, print_function
__author__ = "adrn <<EMAIL>>"
# Standard library
import os
import logging
# Third-party
from astropy import log as logger
import astropy.units as u
from astropy.coordinates.angles import rotation_matrix
import matplotlib.pyplot as plt
import numpy as np
from scipy.sign... | 0.725454 | 0.416441 |
import tarfile
import tempfile
from contextlib import contextmanager
from io import BytesIO
from pathlib import Path
from urllib.parse import urldefrag
from urllib.parse import urlsplit
from urllib.parse import urlunsplit
import dulwich
import requests
from repo2env.git_util import GitPath
from repo2env.git_util impo... | repo2env/fetch.py | import tarfile
import tempfile
from contextlib import contextmanager
from io import BytesIO
from pathlib import Path
from urllib.parse import urldefrag
from urllib.parse import urlsplit
from urllib.parse import urlunsplit
import dulwich
import requests
from repo2env.git_util import GitPath
from repo2env.git_util impo... | 0.31732 | 0.165425 |
import sys
from pmercury.protocols.tcp import TCP
from pmercury.protocols.tls import TLS
from pmercury.protocols.dtls import DTLS
from pmercury.protocols.http import HTTP
from pmercury.protocols.dhcp import DHCP
from pmercury.protocols.iquic import IQUIC
from pmercury.protocols.tls_server import TLS_Server
from pmercu... | python/pmercury/utils/packet_proc.py | import sys
from pmercury.protocols.tcp import TCP
from pmercury.protocols.tls import TLS
from pmercury.protocols.dtls import DTLS
from pmercury.protocols.http import HTTP
from pmercury.protocols.dhcp import DHCP
from pmercury.protocols.iquic import IQUIC
from pmercury.protocols.tls_server import TLS_Server
from pmercu... | 0.207455 | 0.242834 |
import json
from os import path
import pytest
import yaml
import zignalz as zz
@pytest.fixture(scope='session')
def session_tmp_dir(tmp_path_factory):
return tmp_path_factory.mktemp('data')
@pytest.fixture(scope='session')
def sqlite_db(session_tmp_dir):
db = zz.SQLite3(path.join(session_tmp_dir, 'sqllit... | tests/conftest.py |
import json
from os import path
import pytest
import yaml
import zignalz as zz
@pytest.fixture(scope='session')
def session_tmp_dir(tmp_path_factory):
return tmp_path_factory.mktemp('data')
@pytest.fixture(scope='session')
def sqlite_db(session_tmp_dir):
db = zz.SQLite3(path.join(session_tmp_dir, 'sqllit... | 0.268654 | 0.182918 |
from grammar import ReprWrap
with open(__file__[:-3] + '_template') as f:
parser_template = f.read()
class State:
def __init__(self, kernel):
self.kernel = kernel
self.items = None
self.actions = None
def build_closure(grammar, kernel):
items = set(kernel)
while True:
... | makelr.py |
from grammar import ReprWrap
with open(__file__[:-3] + '_template') as f:
parser_template = f.read()
class State:
def __init__(self, kernel):
self.kernel = kernel
self.items = None
self.actions = None
def build_closure(grammar, kernel):
items = set(kernel)
while True:
... | 0.576661 | 0.211702 |
import random
import time
from copy import deepcopy
from functools import total_ordering
from multiprocessing.queues import Queue
from queue import PriorityQueue
import numpy as np
import math
from scipy.linalg import cholesky, cho_solve, solve_triangular, LinAlgError
from scipy.optimize import linear_sum_assignment
f... | autokeras/bayesian.py | import random
import time
from copy import deepcopy
from functools import total_ordering
from multiprocessing.queues import Queue
from queue import PriorityQueue
import numpy as np
import math
from scipy.linalg import cholesky, cho_solve, solve_triangular, LinAlgError
from scipy.optimize import linear_sum_assignment
f... | 0.864067 | 0.450299 |
import os
import sys
import glob
import logging
import pickle
import argparse
import numpy as np
import pandas as pd
sys.path += [os.path.abspath('.'), os.path.abspath('..')] # Add path to root
import imsegm.utilities.data_io as tl_data
import imsegm.region_growing as tl_rg
PATH_DATA = tl_data.update_path('data_ima... | experiments_ovary_detect/run_RG2Sp_estim_shape-models.py | import os
import sys
import glob
import logging
import pickle
import argparse
import numpy as np
import pandas as pd
sys.path += [os.path.abspath('.'), os.path.abspath('..')] # Add path to root
import imsegm.utilities.data_io as tl_data
import imsegm.region_growing as tl_rg
PATH_DATA = tl_data.update_path('data_ima... | 0.361165 | 0.111169 |
from django.core.exceptions import ImproperlyConfigured
from django.utils.datastructures import SortedDict
from django.utils.functional import memoize
from django.utils.importlib import import_module
from assetfiles import settings
from assetfiles.filters.base import BaseFilter
from assetfiles.filters.mixins import (C... | assetfiles/filters/__init__.py | from django.core.exceptions import ImproperlyConfigured
from django.utils.datastructures import SortedDict
from django.utils.functional import memoize
from django.utils.importlib import import_module
from assetfiles import settings
from assetfiles.filters.base import BaseFilter
from assetfiles.filters.mixins import (C... | 0.823151 | 0.216819 |
from sympy import ( symbols, solve, diff, integrate, exp, sqrt, lambdify, pprint )
import matplotlib.pyplot as plt
import numpy as np
# The difference between the true value of an integral and the value given by the trapezoidal rule or Simpson's rule is known as the error.
# In numerical analysis, the error is stud... | src/Classes/MSDS400/Quiz/IV/06.py | from sympy import ( symbols, solve, diff, integrate, exp, sqrt, lambdify, pprint )
import matplotlib.pyplot as plt
import numpy as np
# The difference between the true value of an integral and the value given by the trapezoidal rule or Simpson's rule is known as the error.
# In numerical analysis, the error is stud... | 0.582372 | 0.766927 |
from pymtl3 import *
from pymtl3.stdlib.test import TestSinkCL
from pymtl3.stdlib.test.test_srcs import TestSrcRTL
from ..ThreeMulAdderShifterRTL import ThreeMulAdderShifterRTL
from ....lib.opt_type import *
from ....lib.messages import *
#-----------------------------------------... | fu/triple/test/ThreeMulAluShifterRTL_test.py | from pymtl3 import *
from pymtl3.stdlib.test import TestSinkCL
from pymtl3.stdlib.test.test_srcs import TestSrcRTL
from ..ThreeMulAdderShifterRTL import ThreeMulAdderShifterRTL
from ....lib.opt_type import *
from ....lib.messages import *
#-----------------------------------------... | 0.22465 | 0.456955 |
import csv
from landuse.models import LandUse
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Import HSE Health stats"
def add_arguments(self, parser):
parser.add_argument('--hse_bmi', nargs=1, required=False)
parser.add_argument('--hse_weight', nargs=... | landuse/management/commands/import_landuse_data.py | import csv
from landuse.models import LandUse
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Import HSE Health stats"
def add_arguments(self, parser):
parser.add_argument('--hse_bmi', nargs=1, required=False)
parser.add_argument('--hse_weight', nargs=... | 0.178168 | 0.288788 |
import numpy as np
from scipy.spatial.distance import cdist
from menpo.transform.rbf import R2LogR2RBF, R2LogRRBF
from menpofit.differentiable import DL
class DifferentiableR2LogRRBF(R2LogRRBF, DL):
def d_dl(self, points):
"""
The derivative of the basis function wrt the coordinate system
... | menpofit/transform/rbf.py | import numpy as np
from scipy.spatial.distance import cdist
from menpo.transform.rbf import R2LogR2RBF, R2LogRRBF
from menpofit.differentiable import DL
class DifferentiableR2LogRRBF(R2LogRRBF, DL):
def d_dl(self, points):
"""
The derivative of the basis function wrt the coordinate system
... | 0.921578 | 0.841174 |
from argparse import Namespace
from collections import OrderedDict
import os
from os import path
import pytest
import requests_mock
from requests.exceptions import ConnectionError
from ncbi_genome_download import core
from ncbi_genome_download import NgdConfig, SUPPORTED_TAXONOMIC_GROUPS
def _get_file(fname):
... | tests/test_core.py |
from argparse import Namespace
from collections import OrderedDict
import os
from os import path
import pytest
import requests_mock
from requests.exceptions import ConnectionError
from ncbi_genome_download import core
from ncbi_genome_download import NgdConfig, SUPPORTED_TAXONOMIC_GROUPS
def _get_file(fname):
... | 0.669529 | 0.25072 |
import logging
from abc import ABC, abstractmethod
from typing import Optional, Any, Callable, List, Iterable, NamedTuple, Dict
from ledger.merkle_verifier import MerkleVerifier
from plenum.common.constants import CURRENT_PROTOCOL_VERSION
from plenum.common.ledger import Ledger
from plenum.common.messages.node_message... | plenum/server/catchup/utils.py | import logging
from abc import ABC, abstractmethod
from typing import Optional, Any, Callable, List, Iterable, NamedTuple, Dict
from ledger.merkle_verifier import MerkleVerifier
from plenum.common.constants import CURRENT_PROTOCOL_VERSION
from plenum.common.ledger import Ledger
from plenum.common.messages.node_message... | 0.701815 | 0.16872 |
import typing
import datetime
import presalytics.story.components
import presalytics.story.outline
if typing.TYPE_CHECKING:
from presalytics.story.components import WidgetBase, PageTemplateBase
from presalytics.story.outline import StoryOutline, Info, Page, Widget, Theme
def create_outline_from_widget(widget:... | presalytics/lib/tools/component_tools.py | import typing
import datetime
import presalytics.story.components
import presalytics.story.outline
if typing.TYPE_CHECKING:
from presalytics.story.components import WidgetBase, PageTemplateBase
from presalytics.story.outline import StoryOutline, Info, Page, Widget, Theme
def create_outline_from_widget(widget:... | 0.665411 | 0.219442 |
from fontbakery.checkrunner import WARN
from fontbakery.codetesting import (assert_results_contain,
CheckTester,
TEST_FILE,
assert_PASS)
from fontbakery.profiles import outline as outline_profile
def test_check... | tests/profiles/outline_test.py | from fontbakery.checkrunner import WARN
from fontbakery.codetesting import (assert_results_contain,
CheckTester,
TEST_FILE,
assert_PASS)
from fontbakery.profiles import outline as outline_profile
def test_check... | 0.326271 | 0.322819 |
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ARExperienceAsset',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, s... | ARMODServers/Apps/ARExperiences/migrations/0001_initial.py |
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ARExperienceAsset',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, s... | 0.485356 | 0.180287 |
from rest_framework.response import Response
from post.models import Post
from post.serializers import PostSerializer
from rest_framework.viewsets import ModelViewSet
from rest_framework.exceptions import PermissionDenied, ValidationError
from post.pagination import PostPagination
from rest_framework.decorators import ... | blog/post/views.py | from rest_framework.response import Response
from post.models import Post
from post.serializers import PostSerializer
from rest_framework.viewsets import ModelViewSet
from rest_framework.exceptions import PermissionDenied, ValidationError
from post.pagination import PostPagination
from rest_framework.decorators import ... | 0.503906 | 0.078607 |
import numpy
from scipy.special import comb
import numpoly
import chaospy
from .distribution import Distribution
class LowerUpperDistribution(Distribution):
"""
Lower-Upper transformation.
Linear transforms any distribution on any interval `[lower, upper]`.
Args:
dist (Distribution):
... | chaospy/distributions/baseclass/lower_upper.py | import numpy
from scipy.special import comb
import numpoly
import chaospy
from .distribution import Distribution
class LowerUpperDistribution(Distribution):
"""
Lower-Upper transformation.
Linear transforms any distribution on any interval `[lower, upper]`.
Args:
dist (Distribution):
... | 0.852353 | 0.546012 |
import numpy as np
import numpy.testing as npt
import unittest
import sys
import os
import torch
import torch.legacy.nn as nn
from _test_utils import _INPUT_SHAPE
sys.path.append(
os.path.dirname(os.path.realpath(__file__)) + "/../torch2coreml/"
)
class SingleLayerTest(unittest.TestCase):
def setUp(self):
... | test/test_layers.py | import numpy as np
import numpy.testing as npt
import unittest
import sys
import os
import torch
import torch.legacy.nn as nn
from _test_utils import _INPUT_SHAPE
sys.path.append(
os.path.dirname(os.path.realpath(__file__)) + "/../torch2coreml/"
)
class SingleLayerTest(unittest.TestCase):
def setUp(self):
... | 0.478773 | 0.436322 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from ._enums import *
__all__ = [
'IncidentInfoArgs',
'IncidentLabelArgs',
'IncidentOwnerInfoArgs',
'UserInfoArgs',
]
@pulumi.input_type
class IncidentInf... | sdk/python/pulumi_azure_native/securityinsights/v20200101/_inputs.py |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from ._enums import *
__all__ = [
'IncidentInfoArgs',
'IncidentLabelArgs',
'IncidentOwnerInfoArgs',
'UserInfoArgs',
]
@pulumi.input_type
class IncidentInf... | 0.8415 | 0.080574 |
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, IntegerField
from wtforms.validators import DataRequired, Length, Email, ValidationError
from app import db
from app.models import Users
class LoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired(), Le... | app/forms.py | from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, IntegerField
from wtforms.validators import DataRequired, Length, Email, ValidationError
from app import db
from app.models import Users
class LoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired(), Le... | 0.436862 | 0.167934 |
# 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 Licens... | floris/tools/visualization.py |
# 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 Licens... | 0.955267 | 0.70712 |