code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
Binary Class Transformation
---------------------------
The Binary Class Transformation Approach (Influential Marketing, Response Transformation Approach).
Based on
<NAME>. (2006). “Influential marketing: A new direct marketing strategy addressing
the existence of voluntary buyers”. Master of Science thes... | [
"numpy.array"
] | [((2938, 2961), 'numpy.array', 'np.array', (['y_transformed'], {}), '(y_transformed)\n', (2946, 2961), True, 'import numpy as np\n')] |
import sys
import math
# Save humans, destroy zombies!
def distance(a, b):
xa, ya = a
xb, yb = b
return math.sqrt((xb - xa)**2 + (yb - ya)**2)
# game loop
while True:
x, y = [int(i) for i in input().split()]
human_count = int(input())
humans = dict()
for i in range(human_count):
... | [
"math.sqrt"
] | [((118, 160), 'math.sqrt', 'math.sqrt', (['((xb - xa) ** 2 + (yb - ya) ** 2)'], {}), '((xb - xa) ** 2 + (yb - ya) ** 2)\n', (127, 160), False, 'import math\n')] |
#
# Copyright 2022 DMetaSoul
#
# 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, ... | [
"pyarrow.BufferOutputStream",
"metaspore_pb2_grpc.PredictStub",
"pyarrow.BufferReader",
"grpc.insecure_channel",
"pyarrow.float32",
"pyarrow.ipc.new_file",
"metaspore_pb2.PredictRequest",
"pyarrow.ipc.read_tensor"
] | [((666, 704), 'grpc.insecure_channel', 'grpc.insecure_channel', (['"""0.0.0.0:50051"""'], {}), "('0.0.0.0:50051')\n", (687, 704), False, 'import grpc\n'), ((728, 767), 'metaspore_pb2_grpc.PredictStub', 'metaspore_pb2_grpc.PredictStub', (['channel'], {}), '(channel)\n', (758, 767), False, 'import metaspore_pb2_grpc\n'),... |
# Necessary libraries
import pandas as pd
import re
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.graph_objs as go
import plotly.offline as py
from statsmodels.stats.outliers_influence import variance_inflation_factor
from sklearn.model_selection import train_test_split
from sklearn.preprocessin... | [
"sklearn.preprocessing.LabelEncoder",
"sklearn.tree.DecisionTreeRegressor",
"pandas.read_csv",
"sklearn.ensemble.ExtraTreesRegressor",
"sklearn.ensemble.AdaBoostRegressor",
"sklearn.naive_bayes.BernoulliNB",
"sklearn.metrics.r2_score",
"re.split",
"sklearn.ensemble.RandomForestRegressor",
"seaborn... | [((809, 834), 'pandas.read_csv', 'pd.read_csv', (['"""zomato.csv"""'], {}), "('zomato.csv')\n", (820, 834), True, 'import pandas as pd\n'), ((1650, 1678), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 10)'}), '(figsize=(15, 10))\n', (1660, 1678), True, 'import matplotlib.pyplot as plt\n'), ((1716, 17... |
# We iterate hexagonal numbers and check whether they are pentagonal.
# By definition, every hexagonal number is a triangle number.
import math
n_h = 144
n_p = 0.5
while not n_p.is_integer():
h = n_h*(2*n_h - 1)
n_p = (1 + math.sqrt(1 + 24*h))/6
n_h += 1
print(h)
# Copyright Junipyr. All r... | [
"math.sqrt"
] | [((242, 263), 'math.sqrt', 'math.sqrt', (['(1 + 24 * h)'], {}), '(1 + 24 * h)\n', (251, 263), False, 'import math\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.OperateContext import OperateContext
from alipay.aop.api.domain.OutboundOrderLine import OutboundOrderLine
from alipay.aop.api.domain.OutboundOrder import OutboundOrder
class Koub... | [
"alipay.aop.api.domain.OperateContext.OperateContext.from_alipay_dict",
"alipay.aop.api.domain.OutboundOrderLine.OutboundOrderLine.from_alipay_dict",
"alipay.aop.api.domain.OutboundOrder.OutboundOrder.from_alipay_dict"
] | [((784, 822), 'alipay.aop.api.domain.OperateContext.OperateContext.from_alipay_dict', 'OperateContext.from_alipay_dict', (['value'], {}), '(value)\n', (815, 822), False, 'from alipay.aop.api.domain.OperateContext import OperateContext\n'), ((1546, 1583), 'alipay.aop.api.domain.OutboundOrder.OutboundOrder.from_alipay_di... |
from os import path, listdir, remove
import platform
import io
from datetime import datetime, timedelta
import time
import json
import pandas as pd
from tinymongo import TinyMongoClient
import pytest
from flask import url_for
import publicAPI.exceptions as exceptions
import publicAPI.config as api_utils
import helper... | [
"helpers.clear_caches",
"pandas.read_csv",
"os.path.join",
"helpers.get_config",
"flask.url_for",
"os.path.dirname",
"tinymongo.TinyMongoClient",
"pytest.mark.usefixtures",
"pandas.DataFrame",
"time.time",
"pytest.xfail"
] | [((374, 392), 'os.path.dirname', 'path.dirname', (['HERE'], {}), '(HERE)\n', (386, 392), False, 'from os import path, listdir, remove\n'), ((412, 446), 'os.path.join', 'path.join', (['HERE', '"""test_config.cfg"""'], {}), "(HERE, 'test_config.cfg')\n", (421, 446), False, 'from os import path, listdir, remove\n'), ((456... |
from unittest import TestCase, main as ut_main
from jekt.github import Github
class TestGithub(TestCase):
def test_list_repos(self):
github = Github()
github.authenticate('amol9')
some_exp_repos = ['mayloop', 'wallp', 'redcmd', 'fbstats']
repos = github.list_repos()
for r in some_exp_repos:
self.ass... | [
"unittest.main",
"jekt.github.Github"
] | [((819, 828), 'unittest.main', 'ut_main', ([], {}), '()\n', (826, 828), True, 'from unittest import TestCase, main as ut_main\n'), ((149, 157), 'jekt.github.Github', 'Github', ([], {}), '()\n', (155, 157), False, 'from jekt.github import Github\n'), ((378, 386), 'jekt.github.Github', 'Github', ([], {}), '()\n', (384, 3... |
import graphene
from fastapi import FastAPI
from starlette.graphql import GraphQLApp
class Query(graphene.ObjectType):
hello = graphene.String(name=graphene.String(default_value="stranger"))
def resolve_hello(self, info, name):
return "Hello " + name
app = FastAPI()
app.add_route("/", GraphQLApp(sc... | [
"graphene.String",
"fastapi.FastAPI",
"graphene.Schema"
] | [((278, 287), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (285, 287), False, 'from fastapi import FastAPI\n'), ((154, 195), 'graphene.String', 'graphene.String', ([], {'default_value': '"""stranger"""'}), "(default_value='stranger')\n", (169, 195), False, 'import graphene\n'), ((325, 353), 'graphene.Schema', 'graph... |
from copy import deepcopy
import torch
import cv2
import time
import pickle
import os
import numpy as np
import ctypes
from _path_init import *
from visualDet3D.utils.timer import Timer
from visualDet3D.utils.utils import cfg_from_file
from visualDet3D.data.kitti.kittidata import KittiData
def read_one_split(cfg, i... | [
"os.listdir",
"os.makedirs",
"fire.Fire",
"visualDet3D.data.kitti.kittidata.KittiData",
"os.path.join",
"os.path.isdir",
"visualDet3D.utils.timer.Timer",
"visualDet3D.utils.utils.cfg_from_file",
"torch.cuda.set_device"
] | [((523, 530), 'visualDet3D.utils.timer.Timer', 'Timer', ([], {}), '()\n', (528, 530), False, 'from visualDet3D.utils.timer import Timer\n'), ((1142, 1194), 'os.path.join', 'os.path.join', (['cfg.path.preprocessed_path', 'data_split'], {}), '(cfg.path.preprocessed_path, data_split)\n', (1154, 1194), False, 'import os\n'... |
##############################################################################
#
# Copyright (c) 2001 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... | [
"functools.partial"
] | [((854, 882), 'functools.partial', 'partial', (['escape'], {'quote': '(False)'}), '(escape, quote=False)\n', (861, 882), False, 'from functools import partial\n')] |
from configs.channel_configs import ChannelConfigs
def get_configs(config_name):
if config_name == 'channels-48':
return ChannelConfigs(n_channels=[[48, 40, 32],
[48, 40, 32], [48, 40, 32], [48, 40, 32], [48, 40, 32],
[48,... | [
"configs.channel_configs.ChannelConfigs"
] | [((135, 295), 'configs.channel_configs.ChannelConfigs', 'ChannelConfigs', ([], {'n_channels': '[[48, 40, 32], [48, 40, 32], [48, 40, 32], [48, 40, 32], [48, 40, 32], [48,\n 40, 32, 24], [48, 40, 32, 24], [48, 40, 32, 24]]'}), '(n_channels=[[48, 40, 32], [48, 40, 32], [48, 40, 32], [48, \n 40, 32], [48, 40, 32], [... |
from unittest import TestCase
from daily_solutions.year_2021.day_15 import RiskMap, Year2021Day15Solution
example = [
"1163751742",
"1381373672",
"2136511328",
"3694931569",
"7463417111",
"1319128137",
"1359912421",
"3125421639",
"1293138521",
"2311944581",
]
example_map = [
... | [
"daily_solutions.year_2021.day_15.RiskMap"
] | [((1341, 1358), 'daily_solutions.year_2021.day_15.RiskMap', 'RiskMap', (['[[8]]', '(5)'], {}), '([[8]], 5)\n', (1348, 1358), False, 'from daily_solutions.year_2021.day_15 import RiskMap, Year2021Day15Solution\n')] |
import importlib
import logging
import sys
import traceback
from .util import run_forever_nonblocking, StopRunForever
class Loadable:
def __init__(self, sleep=0, exception_sleep=5):
super().__init__()
self.log = logging.getLogger(self.__class__.__name__)
self.__stop = False
run_fo... | [
"logging.getLogger",
"traceback.format_exc",
"sys.modules.pop",
"importlib.import_module"
] | [((235, 277), 'logging.getLogger', 'logging.getLogger', (['self.__class__.__name__'], {}), '(self.__class__.__name__)\n', (252, 277), False, 'import logging\n'), ((732, 774), 'logging.getLogger', 'logging.getLogger', (['self.__class__.__name__'], {}), '(self.__class__.__name__)\n', (749, 774), False, 'import logging\n'... |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License:
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the... | [
"json.load",
"os.path.exists",
"os.path.dirname",
"random.choice"
] | [((3786, 3808), 'os.path.exists', 'path.exists', (['full_path'], {}), '(full_path)\n', (3797, 3808), False, 'from os import path\n'), ((3995, 4007), 'json.load', 'json.load', (['f'], {}), '(f)\n', (4004, 4007), False, 'import json\n'), ((3744, 3766), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n'... |
# -*- coding: utf-8 -*-
"""
Profile: https://www.hl7.org/fhir/DSTU2/visionprescription.html
Release: DSTU2
Version: 1.0.2
Revision: 7202
"""
from typing import Any, Dict
from typing import List as ListType
from pydantic import Field, root_validator
from . import domainresource, fhirtypes
from .backboneelement import ... | [
"pydantic.Field",
"pydantic.root_validator"
] | [((574, 613), 'pydantic.Field', 'Field', (['"""VisionPrescription"""'], {'const': '(True)'}), "('VisionPrescription', const=True)\n", (579, 613), False, 'from pydantic import Field, root_validator\n'), ((668, 858), 'pydantic.Field', 'Field', (['None'], {'alias': '"""identifier"""', 'title': '"""Business Identifier for ... |
# Generated by Django 3.0.6 on 2020-06-21 09:10
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('registrations', '0003_auto_20200615_0714'),
]
operations = [
migrations.AddField(
model_name='sacco... | [
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.CharField"
] | [((383, 453), 'django.db.models.DateField', 'models.DateField', ([], {'auto_now_add': '(True)', 'default': 'django.utils.timezone.now'}), '(auto_now_add=True, default=django.utils.timezone.now)\n', (399, 453), False, 'from django.db import migrations, models\n'), ((619, 674), 'django.db.models.TextField', 'models.TextF... |
import numpy as np
from sequentia.classifiers import HMM
# Create some sample data
X = [np.random.random((10 * i, 3)) for i in range(1, 4)]
# Create and fit a left-right HMM with random transitions and initial state distribution
hmm = HMM(label='class1', n_states=5, topology='left-right')
hmm.set_random_initial()
hmm... | [
"numpy.random.random",
"sequentia.classifiers.HMM"
] | [((237, 291), 'sequentia.classifiers.HMM', 'HMM', ([], {'label': '"""class1"""', 'n_states': '(5)', 'topology': '"""left-right"""'}), "(label='class1', n_states=5, topology='left-right')\n", (240, 291), False, 'from sequentia.classifiers import HMM\n'), ((89, 118), 'numpy.random.random', 'np.random.random', (['(10 * i,... |
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-g", "--gt", type=str, default=r"", help="Assign the groud true path.")
parser.add_argument("-d", "--dt", type=str, default=r"",
... | [
"pycocotools.coco.COCO",
"pycocotools.cocoeval.COCOeval",
"argparse.ArgumentParser"
] | [((133, 158), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (156, 158), False, 'import argparse\n'), ((428, 441), 'pycocotools.coco.COCO', 'COCO', (['args.gt'], {}), '(args.gt)\n', (432, 441), False, 'from pycocotools.coco import COCO\n'), ((494, 526), 'pycocotools.cocoeval.COCOeval', 'COCOeva... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-05-20 17:19
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | [
"django.db.models.OneToOneField",
"django.db.models.DateField",
"django.db.models.FloatField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((312, 369), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (343, 369), False, 'from django.db import migrations, models\n'), ((509, 574), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)',... |
import logging
from colorama import Fore
from nuts.utilities.file_handler import FileHandler
class Reporter:
"""
The Reporter-class is responsible to print the test results to the
console and write a logfile with the test information.
...
Attributes
----------
logger
Instance o... | [
"logging.getLogger",
"nuts.utilities.file_handler.FileHandler"
] | [((452, 479), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (469, 479), False, 'import logging\n'), ((508, 521), 'nuts.utilities.file_handler.FileHandler', 'FileHandler', ([], {}), '()\n', (519, 521), False, 'from nuts.utilities.file_handler import FileHandler\n')] |
import os
import json
import pytest
import geoh
@pytest.fixture
def geojson_sf():
__location__ = os.path.realpath(os.path.join(
os.getcwd(), os.path.dirname(__file__)))
geojson = json.loads(
open(os.path.join(__location__, './geojson-sf.json')).read())
return geojson
@pytest.fixture
def geojson_none()... | [
"os.path.join",
"os.getcwd",
"geoh.geohashes",
"pytest.mark.parametrize",
"os.path.dirname"
] | [((1033, 1089), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""precision"""', '[1, 2, 3, 4, 5, 6]'], {}), "('precision', [1, 2, 3, 4, 5, 6])\n", (1056, 1089), False, 'import pytest\n'), ((1567, 1623), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""precision"""', '[1, 2, 3, 4, 5, 6]'], {}), "('... |
from typing import Iterable
from pandas import DataFrame
from recipe_db.analytics.recipe import RecipesPopularityAnalysis, CommonStylesAnalysis, RecipesTrendAnalysis, \
RecipesListAnalysis
from recipe_db.analytics.scope import RecipeScope, YeastProjection, YeastScope
from recipe_db.models import Yeast, Recipe
US... | [
"recipe_db.analytics.recipe.RecipesListAnalysis",
"recipe_db.analytics.recipe.CommonStylesAnalysis",
"recipe_db.analytics.recipe.RecipesTrendAnalysis",
"recipe_db.analytics.scope.YeastProjection",
"recipe_db.analytics.scope.YeastScope",
"recipe_db.analytics.recipe.RecipesPopularityAnalysis",
"recipe_db.... | [((756, 769), 'recipe_db.analytics.scope.RecipeScope', 'RecipeScope', ([], {}), '()\n', (767, 769), False, 'from recipe_db.analytics.scope import RecipeScope, YeastProjection, YeastScope\n'), ((810, 822), 'recipe_db.analytics.scope.YeastScope', 'YeastScope', ([], {}), '()\n', (820, 822), False, 'from recipe_db.analytic... |
import torch
import torch.nn as nn
import utils.util as util
from models.dips import ImageDIP
from models.backbones.edsr import EDSR
from models.kernel_encoding.kernel_wizard import KernelExtractor
# from models.sr.cattengu import KernelExtractor
from models.sr.IDK import IDK
from tqdm import tqdm
import cv2
from model... | [
"cv2.imwrite",
"models.losses.perceptual_loss.PerceptualLoss",
"models.losses.ssim_loss.SSIM",
"models.dips.ImageDIP",
"torch.load",
"torch.nn.L1Loss",
"models.backbones.edsr.EDSR",
"models.losses.hyper_laplacian_penalty.HyperLaplacianPenalty",
"utils.util.get_noise",
"torch.reshape",
"torch.nn.... | [((2378, 2416), 'cv2.imwrite', 'cv2.imwrite', (['"""./after_warmup.png"""', 'res'], {}), "('./after_warmup.png', res)\n", (2389, 2416), False, 'import cv2\n'), ((2517, 2570), 'torchvision.utils.save_image', 'save_image', (['k', '"""./test_k.png"""'], {'nrow': '(1)', 'normalize': '(True)'}), "(k, './test_k.png', nrow=1,... |
import inspect
from distutils.util import strtobool
from typing import *
from PyQt6.QtCore import QEvent, Qt, pyqtSignal
from PyQt6.QtWidgets import (QCheckBox, QComboBox, QDateEdit, QLineEdit,
QRadioButton, QSlider, QSpinBox, QTextEdit)
from smseventlog import dt
from smseventlog import ... | [
"distutils.util.strtobool",
"smseventlog.functions.getattr_chained",
"inspect.getmro",
"smseventlog.dt.now",
"smseventlog.getlog",
"PyQt6.QtCore.pyqtSignal"
] | [((373, 389), 'smseventlog.getlog', 'getlog', (['__name__'], {}), '(__name__)\n', (379, 389), False, 'from smseventlog import getlog\n'), ((1044, 1062), 'PyQt6.QtCore.pyqtSignal', 'pyqtSignal', (['object'], {}), '(object)\n', (1054, 1062), False, 'from PyQt6.QtCore import QEvent, Qt, pyqtSignal\n'), ((5164, 5176), 'PyQ... |
from django.db import models
# Create your models here.
class Stocks(models.Model):
ticker = models.CharField(max_length=5, default='STOCK',)
date = models.DateField()
open = models.IntegerField()
high = models.IntegerField()
low = models.IntegerField()
close = models.IntegerField()
volume... | [
"django.db.models.FloatField",
"django.db.models.DateField",
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((99, 146), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(5)', 'default': '"""STOCK"""'}), "(max_length=5, default='STOCK')\n", (115, 146), False, 'from django.db import models\n'), ((159, 177), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (175, 177), False, 'from djang... |
# pylint: disable=redefined-outer-name
"""Test Configuration and Fixtures.
Setup test config_setup.cfg.configurations and store fixtures.
Returns:
[type]: None.
"""
import configparser
import os
import pathlib
import shutil
import typing
import cfg.glob
import cfg.setup
import db.driver
import pytest
import sqla... | [
"os.listdir",
"configparser.ConfigParser",
"sqlalchemy.Table",
"shutil.copy2",
"pathlib.Path",
"os.path.join",
"sqlalchemy.delete",
"shutil.rmtree",
"os.path.isfile",
"shutil.copytree",
"os.path.isdir",
"pytest.helpers.copy_files_4_pytest_2_dir",
"os.mkdir",
"dcr.initialise_logger",
"dcr... | [((590, 617), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (615, 617), False, 'import configparser\n'), ((7797, 7813), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (7811, 7813), False, 'import pytest\n'), ((8327, 8343), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (8341,... |
from django.db import models
from django.db.models.fields import EmailField
# Create your models here.
class Person(models.Model):
first_name = models.TextField()
last_name = models.TextField()
middle_name = models.TextField()
address = models.TextField()
birth_date = models.DateField()
email =... | [
"django.db.models.OneToOneField",
"django.db.models.fields.EmailField",
"django.db.models.DateField",
"django.db.models.FloatField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.DateTimeField"
] | [((149, 167), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (165, 167), False, 'from django.db import models\n'), ((184, 202), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (200, 202), False, 'from django.db import models\n'), ((221, 239), 'django.db.models.TextField', 'model... |
from flask import Blueprint, request
from .config import API_KEY, WEBHOOK_URL, WEBHOOK_API_KEY
import datetime
import requests
import sqlite3
bot_interface = Blueprint("bot_interface", __name__, static_folder="static", template_folder="templates")
@bot_interface.route("/ping", methods=["POST"])
def add_entry_to_wiki(... | [
"requests.post",
"sqlite3.connect",
"flask.request.form.get",
"datetime.datetime.now",
"flask.Blueprint",
"flask.request.headers.get"
] | [((159, 252), 'flask.Blueprint', 'Blueprint', (['"""bot_interface"""', '__name__'], {'static_folder': '"""static"""', 'template_folder': '"""templates"""'}), "('bot_interface', __name__, static_folder='static',\n template_folder='templates')\n", (168, 252), False, 'from flask import Blueprint, request\n'), ((350, 38... |
"""
radish
~~~~~~
The root from red to green. BDD tooling for Python.
:copyright: (c) 2019 by <NAME> <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
import pytest
from radish.models import Rule, State
def test_rule_should_forward_set_feature_to_its_scenarios(mocker):
"""A Rule should forward a set ... | [
"pytest.mark.parametrize",
"radish.models.Rule"
] | [((1489, 2373), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""given_scenario_states, expected_state"""', '[([State.PASSED, State.PASSED, State.PASSED], State.PASSED), ([State.PASSED,\n State.UNTESTED, State.PASSED], State.UNTESTED), ([State.PASSED, State.\n SKIPPED, State.UNTESTED], State.SKIPPED), ... |
# Generated by Django 2.1.1 on 2018-09-25 17:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('processo_seletivo', '0002_auto_20180925_1430'),
]
operations = [
migrations.AlterField(
model_name='processoseletivo',
... | [
"django.db.models.PositiveIntegerField"
] | [((360, 414), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'verbose_name': '"""Ano letivo"""'}), "(verbose_name='Ano letivo')\n", (387, 414), False, 'from django.db import migrations, models\n')] |
"""
Newtons Cradle
===========================
This example shows how to implement newtons cradle with b2d
"""
from b2d.testbed import TestbedBase
import b2d
class NewtonsCradle(TestbedBase):
name = "<NAME>"
def __init__(self, settings=None):
super(NewtonsCradle, self).__init__(settings=settings)
... | [
"b2d.circle_shape",
"b2d.testbed.run"
] | [((1705, 1735), 'b2d.testbed.run', 'b2d.testbed.run', (['NewtonsCradle'], {}), '(NewtonsCradle)\n', (1720, 1735), False, 'import b2d\n'), ((905, 937), 'b2d.circle_shape', 'b2d.circle_shape', ([], {'radius': '(r * 0.9)'}), '(radius=r * 0.9)\n', (921, 937), False, 'import b2d\n')] |
# -*- coding: utf-8 -*-
# Copyright 2016 Open Permissions Platform Coalition
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by appl... | [
"identity.models.identity.validate",
"pytest.mark.parametrize",
"identity.models.identity.options.define"
] | [((1356, 1753), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""body"""', "[{'resolver_id': 'https://r1234', 'repository_id':\n '37cd1397e0814e989fa22da6b15fec60', 'count': 2000}, {'resolver_id':\n 'https://r1234', 'repository_id': '37cd1397e0814e989fa22da6b15fec60',\n 'illegal': 'x'}, {'resolver_i... |
import pytest
from chemml.chem import tensorise_molecules
from chemml.chem import Molecule
@pytest.fixture()
def mols():
m1 = Molecule('c1ccc1', 'smiles')
m2 = Molecule('CNC', 'smiles')
molecules = [m1, m2]
return molecules
def test_exception():
# not a molecule
with pytest.raises(ValueEr... | [
"pytest.fixture",
"pytest.raises",
"chemml.chem.Molecule",
"chemml.chem.tensorise_molecules"
] | [((95, 111), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (109, 111), False, 'import pytest\n'), ((133, 161), 'chemml.chem.Molecule', 'Molecule', (['"""c1ccc1"""', '"""smiles"""'], {}), "('c1ccc1', 'smiles')\n", (141, 161), False, 'from chemml.chem import Molecule\n'), ((171, 196), 'chemml.chem.Molecule', 'Mol... |
import numpy as np
a = [[1,4],[2,5],[3,6]]
a = np.array(a)
print(a.shape)
print(a[0]) | [
"numpy.array"
] | [((49, 60), 'numpy.array', 'np.array', (['a'], {}), '(a)\n', (57, 60), True, 'import numpy as np\n')] |
from tkinter import *
import datetime
import time
import pyttsx3
synthesizer = pyttsx3.init()
window=Tk()
Alarm_time=""
window.config(pady=20)
window.geometry("300x300")
window.title("Alarm")
entry=Entry()
entry.insert(0,"hh:mm:ss")
entry.pack()
label_emtpy=Label(text="")
label_emtpy.pack()
def settim... | [
"pyttsx3.init",
"datetime.datetime.now",
"time.sleep"
] | [((84, 98), 'pyttsx3.init', 'pyttsx3.init', ([], {}), '()\n', (96, 98), False, 'import pyttsx3\n'), ((701, 724), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (722, 724), False, 'import datetime\n'), ((1234, 1247), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1244, 1247), False, 'import ti... |
import torch
from torch.utils.data import DataLoader
import pathlib
import os
import numpy as np
import dataset
from criteria import cal_criteria, bbrebuild
def loss_from_log(train_name):
with open('../logs/log_%s.txt' % train_name) as f:
lines = f.readlines()
val_loss = []
train_loss... | [
"os.listdir",
"pathlib.Path",
"criteria.cal_criteria",
"criteria.bbrebuild",
"os.path.join",
"numpy.argsort",
"numpy.array",
"torch.no_grad",
"numpy.save"
] | [((705, 725), 'numpy.array', 'np.array', (['train_loss'], {}), '(train_loss)\n', (713, 725), True, 'import numpy as np\n'), ((742, 760), 'numpy.array', 'np.array', (['val_loss'], {}), '(val_loss)\n', (750, 760), True, 'import numpy as np\n'), ((1798, 1842), 'os.path.join', 'os.path.join', (['self.output_folder', 'model... |
from django.contrib import admin
# Register your models here.
from .models import Authors, Series, Genres, Publishers
class AuthorsAdmin(admin.ModelAdmin):
#search_fields = ['name']
list_display = ['pk', 'name', 'description']
class SeriesAdmin(admin.ModelAdmin):
list_display = ['pk', 'name']
class GenresA... | [
"django.contrib.admin.site.register"
] | [((460, 502), 'django.contrib.admin.site.register', 'admin.site.register', (['Authors', 'AuthorsAdmin'], {}), '(Authors, AuthorsAdmin)\n', (479, 502), False, 'from django.contrib import admin\n'), ((503, 543), 'django.contrib.admin.site.register', 'admin.site.register', (['Series', 'SeriesAdmin'], {}), '(Series, Series... |
import time
from player import Human, RandomCompPlayer, SmartCompPlayer
class TicTacToe:
def __init__(self):
self.board = [' ' for _ in range(9)] # single list to represent a 3x3 game board
self.current_winner = None # keeping track of a winner
def print_board(self):
# t... | [
"player.SmartCompPlayer",
"time.sleep",
"player.Human"
] | [((3247, 3257), 'player.Human', 'Human', (['"""X"""'], {}), "('X')\n", (3252, 3257), False, 'from player import Human, RandomCompPlayer, SmartCompPlayer\n'), ((3314, 3334), 'player.SmartCompPlayer', 'SmartCompPlayer', (['"""O"""'], {}), "('O')\n", (3329, 3334), False, 'from player import Human, RandomCompPlayer, SmartC... |
# coding: utf-8
"""
Automated Tool for Optimized Modelling (ATOM)
Author: Mavs
Description: Unit tests for basepredictor.py
"""
# Standard packages
import pytest
import numpy as np
import pandas as pd
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
# Own modules
from atom import ATOMClas... | [
"sklearn.discriminant_analysis.LinearDiscriminantAnalysis",
"atom.utils.merge",
"pytest.mark.parametrize",
"atom.training.DirectClassifier",
"pytest.raises",
"atom.ATOMClassifier",
"atom.ATOMRegressor"
] | [((18833, 18895), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""metric"""', "['ap', 'roc_auc_ovo', 'f1']"], {}), "('metric', ['ap', 'roc_auc_ovo', 'f1'])\n", (18856, 18895), False, 'import pytest\n'), ((19655, 19719), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dataset"""', "['train', 'tes... |
# -*- coding: utf-8 -*-
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import Rule
from . import GenericSpider
class UastoreSpider(GenericSpider):
name = 'uastore'
allowed_domains = ['store.united-arrows.co.jp']
rules = (
# Match each product in product list.
Rule(Lin... | [
"scrapy.linkextractors.LinkExtractor"
] | [((317, 371), 'scrapy.linkextractors.LinkExtractor', 'LinkExtractor', ([], {'restrict_xpaths': '"""//div[@id="itemList"]"""'}), '(restrict_xpaths=\'//div[@id="itemList"]\')\n', (330, 371), False, 'from scrapy.linkextractors import LinkExtractor\n'), ((434, 496), 'scrapy.linkextractors.LinkExtractor', 'LinkExtractor', (... |
import os
import warnings
import matplotlib.pyplot as plt
from pytplot import get_data
from . import mms_load_mec
def mms_orbit_plot(trange=['2015-10-16', '2015-10-17'], probes=[1, 2, 3, 4], data_rate='srvy', xr=None, yr=None, plane='xy', coord='gse'):
"""
This function creates MMS orbit plots
Parame... | [
"matplotlib.pyplot.imshow",
"os.path.realpath",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1747, 1785), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'sharey': '(True)', 'sharex': '(True)'}), '(sharey=True, sharex=True)\n', (1759, 1785), True, 'import matplotlib.pyplot as plt\n'), ((1882, 1919), 'matplotlib.pyplot.imshow', 'plt.imshow', (['im'], {'extent': '(-1, 1, -1, 1)'}), '(im, extent=(-1, 1, -1... |
# Copyright 2021 Alibaba Group Holding Limited. 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 ... | [
"tensorflow.python.ops.math_ops.argmax",
"tensorflow.python.util.deprecation.deprecated_argument_lookup",
"tensorflow.python.ops.array_ops.expand_dims",
"tensorflow.python.ops.math_ops.to_float",
"tensorflow.python.ops.math_ops.to_int64",
"epl.ops.bridging_layer.Replica2Split",
"tensorflow.python.ops.ma... | [((4011, 4087), 'tensorflow.python.util.deprecation.deprecated_argument_lookup', 'deprecation.deprecated_argument_lookup', (['"""axis"""', 'axis', '"""dimension"""', 'dimension'], {}), "('axis', axis, 'dimension', dimension)\n", (4049, 4087), False, 'from tensorflow.python.util import deprecation\n'), ((4176, 4185), 'e... |
from flask import Blueprint, render_template, abort
from flask.ext.login import current_user
from KerbalStuff.objects import User
from KerbalStuff.database import db
from KerbalStuff.common import *
profiles = Blueprint('profile', __name__, template_folder='../../templates/profiles')
@profiles.route("/profile/<userna... | [
"flask.render_template",
"flask.abort",
"KerbalStuff.objects.User.query.filter",
"flask.Blueprint"
] | [((211, 285), 'flask.Blueprint', 'Blueprint', (['"""profile"""', '__name__'], {'template_folder': '"""../../templates/profiles"""'}), "('profile', __name__, template_folder='../../templates/profiles')\n", (220, 285), False, 'from flask import Blueprint, render_template, abort\n'), ((949, 1072), 'flask.render_template',... |
# -*- coding=utf-8 -*-
import jieba
jieba.load_userdict('/home/zhangshuai/kaldi-master/egs/biendata/s5/data/local/dict/lexicon_parse.txt')
with open('/home/zhangshuai/kaldi-master/egs/biendata/s5/data/train_dev_sp/text_parse3','w') as w:
with open('/home/zhangshuai/kaldi-master/egs/biendata/s5/data/train_dev_sp/... | [
"jieba.load_userdict"
] | [((38, 150), 'jieba.load_userdict', 'jieba.load_userdict', (['"""/home/zhangshuai/kaldi-master/egs/biendata/s5/data/local/dict/lexicon_parse.txt"""'], {}), "(\n '/home/zhangshuai/kaldi-master/egs/biendata/s5/data/local/dict/lexicon_parse.txt'\n )\n", (57, 150), False, 'import jieba\n')] |
""" ec2 instances scheduler """
import logging
import boto3
from botocore.exceptions import ClientError
# Setup simple logging for INFO
LOGGER = logging.getLogger()
LOGGER.setLevel(logging.INFO)
def ec2_handler(schedule_action, tag_key, tag_value):
"""
Aws ec2 scheduler function, stop or
start ec2... | [
"logging.getLogger",
"boto3.client"
] | [((147, 166), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (164, 166), False, 'import logging\n'), ((404, 423), 'boto3.client', 'boto3.client', (['"""ec2"""'], {}), "('ec2')\n", (416, 423), False, 'import boto3\n'), ((1308, 1327), 'boto3.client', 'boto3.client', (['"""ec2"""'], {}), "('ec2')\n", (1320, 1... |
from __future__ import annotations
from pathlib import Path
import urllib.request
import urllib.error
import socket
def download(odir: Path, source_url: str, irng: list[int]):
"""Download star index files.
The default range was useful for my cameras.
"""
assert len(irng) == 2, "specify start, stop ind... | [
"pathlib.Path"
] | [((338, 348), 'pathlib.Path', 'Path', (['odir'], {}), '(odir)\n', (342, 348), False, 'from pathlib import Path\n'), ((1046, 1059), 'pathlib.Path', 'Path', (['outfile'], {}), '(outfile)\n', (1050, 1059), False, 'from pathlib import Path\n')] |
import numpy as np
import cv2
from Feature_Matching import initial_guess
from velocity import velocity
def distance(velocity_estimate,frame_0_time,time_inc,base_frame,curr_frame):
'''
function to calculate distance travelled between frames
Parameters:
-----------
velocity_estimate = Nx2 array of t... | [
"numpy.identity",
"numpy.ones",
"Feature_Matching.initial_guess",
"velocity.velocity",
"numpy.asarray",
"numpy.array",
"numpy.zeros",
"cv2.Rodrigues",
"numpy.vstack",
"cv2.imread"
] | [((7973, 8064), 'numpy.array', 'np.array', (['[[904.04572636, 0, 645.74398382], [0, 907.01811462, 512.14951996], [0, 0, 1]]'], {}), '([[904.04572636, 0, 645.74398382], [0, 907.01811462, 512.14951996],\n [0, 0, 1]])\n', (7981, 8064), True, 'import numpy as np\n'), ((10920, 10942), 'numpy.asarray', 'np.asarray', (['po... |
# -*- coding: utf-8 -*-
# (c) 2015, <NAME> <<EMAIL>>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | [
"ansible.module_utils.known_hosts.get_fqdn",
"ansible.module_utils.known_hosts.is_ssh_url"
] | [((2208, 2233), 'ansible.module_utils.known_hosts.is_ssh_url', 'known_hosts.is_ssh_url', (['u'], {}), '(u)\n', (2230, 2233), False, 'from ansible.module_utils import known_hosts\n'), ((2350, 2373), 'ansible.module_utils.known_hosts.get_fqdn', 'known_hosts.get_fqdn', (['u'], {}), '(u)\n', (2370, 2373), False, 'from ansi... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import List, Dict, Callable
import numpy as np
from allennlp.common.checks import ConfigurationError
from kb_utils.kb_context import KBContext
from utils import EntityType, Universe
class Action:
def __init__(self, action_str: ... | [
"numpy.array",
"allennlp.common.checks.ConfigurationError"
] | [((4506, 4549), 'numpy.array', 'np.array', (['entity_type_indices'], {'dtype': 'np.int'}), '(entity_type_indices, dtype=np.int)\n', (4514, 4549), True, 'import numpy as np\n'), ((2231, 2297), 'allennlp.common.checks.ConfigurationError', 'ConfigurationError', (['f"""Do not support for main type as {main_type}"""'], {}),... |
import os
import torch
import segmentation_models_pytorch as smp
import pandas as pd
from abc import abstractmethod
from pathlib import Path
from catalyst.dl.callbacks import AccuracyCallback, EarlyStoppingCallback, \
CheckpointCallback, PrecisionRecallF1ScoreCallback
from catalyst.dl... | [
"segmentation_models_pytorch.encoders.get_preprocessing_fn",
"segmentation_models_pytorch.utils.losses.BCEDiceLoss",
"catalyst.dl.callbacks.CheckpointCallback",
"clouds.models.ResNet34FPN",
"torch.optim.lr_scheduler.CosineAnnealingWarmRestarts",
"clouds.io.ClassificationCloudDataset",
"catalyst.dl.callb... | [((6263, 6353), 'torch.utils.data.DataLoader', 'DataLoader', (['self.train_dset'], {'batch_size': 'b_size', 'shuffle': '(True)', 'num_workers': 'num_workers'}), '(self.train_dset, batch_size=b_size, shuffle=True, num_workers=\n num_workers)\n', (6273, 6353), False, 'from torch.utils.data import DataLoader\n'), ((640... |
import numpy as np
import scipy.stats as stats
E = []
for ch in range(1,17):
energy = []
if ch<10:
file_name = "20210218-ch0" + str(ch) + ".e.txt"
else:
file_name = "20210218-ch" + str(ch) + ".e.txt"
with open(file_name,"r") as fl:
for line in fl:
energy.append(floa... | [
"numpy.array",
"scipy.stats.ks_2samp"
] | [((344, 360), 'numpy.array', 'np.array', (['energy'], {}), '(energy)\n', (352, 360), True, 'import numpy as np\n'), ((499, 529), 'scipy.stats.ks_2samp', 'stats.ks_2samp', (['E[ch1]', 'E[ch2]'], {}), '(E[ch1], E[ch2])\n', (513, 529), True, 'import scipy.stats as stats\n')] |
"""
Generate the potential task instances for
formal/informal dimension
complex/simple dimension
Generate the task instances for
number substitution characteristic
contraction characteristic
Take Subsample of potential tasks
"""
import logging
import sys
import os
import p... | [
"logging.basicConfig",
"random.shuffle",
"argparse.ArgumentParser",
"quadruple_generators.NumberSubsQuadrupleGenerator",
"pandas.read_csv",
"qualtrics_constants.quadruple_id.format",
"os.path.join",
"logging.warning",
"set_for_global.set_global_seed",
"os.path.dirname",
"quadruple_generators.Sim... | [((796, 824), 'os.path.join', 'os.path.join', (['"""."""', '"""utility"""'], {}), "('.', 'utility')\n", (808, 824), False, 'import os\n'), ((10329, 10424), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s : %(levelname)s : %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s : ... |
import os
import json
import typer
import asyncio
from tester import test
def load_config(file):
if os.path.exists(file) is False:
raise ValueError("Invalid file path! It does not exist")
exit(1)
with open(file, "r") as f:
data = json.load(f)
# data = json.loads(file)
retur... | [
"os.path.exists",
"asyncio.get_event_loop",
"tester.test",
"json.load",
"typer.run"
] | [((633, 648), 'typer.run', 'typer.run', (['main'], {}), '(main)\n', (642, 648), False, 'import typer\n'), ((108, 128), 'os.path.exists', 'os.path.exists', (['file'], {}), '(file)\n', (122, 128), False, 'import os\n'), ((267, 279), 'json.load', 'json.load', (['f'], {}), '(f)\n', (276, 279), False, 'import json\n'), ((58... |
"""
git
===============
Wrappers around gitpython to return information about the git repository
for debugging
"""
class GitPythonError(Exception):
"""
Exception if gitpython cannot be found (Typical in production
environments).
"""
pass
class GitEnvironmentError(Exception):
"""
Excep... | [
"git.Repo"
] | [((1454, 1473), 'git.Repo', 'git.Repo', (['repo_path'], {}), '(repo_path)\n', (1462, 1473), False, 'import git\n')] |
# 线程锁
# 多线程和多进程最大的不同在于,多进程中,同一个变量,各自有一份拷贝存在于每个进程中,互不影响,而多线程中,所有变量都由所有线程共享,所以,任何一个变量都可以被任何一个线程修改,因此,线程之间共享数据最大的危险在于多个线程同时改一个变量,把内容给改乱了。
# 来看看多个线程同时操作一个变量怎么把内容给改乱了:
import time, threading
# 假定这是你的银行存款:
balance = 0
def changeit(n):
# 先存后取,结果应该为0:
global balance
balance = balance + n
balance = balance ... | [
"threading.Lock",
"threading.Thread",
"multiprocessing.cpu_count"
] | [((424, 440), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (438, 440), False, 'import time, threading\n'), ((671, 727), 'threading.Thread', 'threading.Thread', ([], {'target': 'run_thread_with_lock', 'args': '(5,)'}), '(target=run_thread_with_lock, args=(5,))\n', (687, 727), False, 'import time, threading\n'),... |
from chargebeecli.config.Configuration import Configuration
from chargebeecli.constants.constants import ACTIVE_PROFILE_SECTION_NAME
from chargebeecli.printer.printer import custom_print
def process(profile):
configuration = Configuration.Instance()
if profile in configuration.fetch_available_sections():
... | [
"chargebeecli.config.Configuration.Configuration.Instance",
"chargebeecli.printer.printer.custom_print"
] | [((233, 257), 'chargebeecli.config.Configuration.Configuration.Instance', 'Configuration.Instance', ([], {}), '()\n', (255, 257), False, 'from chargebeecli.config.Configuration import Configuration\n'), ((414, 459), 'chargebeecli.printer.printer.custom_print', 'custom_print', (['f"""{profile} active profile set"""'], {... |
"""Optimizer for weights of portfolio."""
from datetime import datetime
from typing import Optional
import numpy as np
from scipy.optimize import minimize
from mypo.common import safe_cast
from mypo.market import Market
from mypo.optimizer.base_optimizer import BaseOptimizer
from mypo.sampler import Sampler
class C... | [
"numpy.ones",
"numpy.float64",
"mypo.common.safe_cast",
"numpy.max",
"numpy.sum",
"numpy.dot",
"numpy.quantile",
"mypo.sampler.Sampler"
] | [((2192, 2211), 'mypo.common.safe_cast', 'safe_cast', (['minout.x'], {}), '(minout.x)\n', (2201, 2211), False, 'from mypo.common import safe_cast\n'), ((2227, 2249), 'numpy.float64', 'np.float64', (['minout.fun'], {}), '(minout.fun)\n', (2237, 2249), True, 'import numpy as np\n'), ((1458, 1512), 'mypo.sampler.Sampler',... |
# -*- coding: utf8 -*-
# Author: <NAME>
"""Version parsing unit tests."""
from typing import Tuple
import pytest
from xmlInterface import parse_version
# Version string, version tuple
tests = (
("1.2.3", (1, 2, 3)),
("1.2pl3", (1, 2, 3)),
("1.2", (1, 2, 0)),
("1.2+alpha3", (1, 2, 0)),
("1.2+alph... | [
"pytest.mark.parametrize",
"xmlInterface.parse_version"
] | [((341, 392), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""version, expected"""', 'tests'], {}), "('version, expected', tests)\n", (364, 392), False, 'import pytest\n'), ((527, 549), 'xmlInterface.parse_version', 'parse_version', (['version'], {}), '(version)\n', (540, 549), False, 'from xmlInterface imp... |
import json
from os import path
from os import mkdir
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import numpy as np
from astropy.time import Time
import glob
import matplotlib.cm as cm
def convert_dict_to_nested_type(report):
if type(report) is dict:
for k, v in report.items():
... | [
"matplotlib.pyplot.setp",
"numpy.mean",
"matplotlib.pyplot.subplot2grid",
"json.dump",
"json.load",
"astropy.time.Time",
"numpy.stack",
"os.path.isdir",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.concatenate",
"matplotlib.pyplot.tight_layout",
"os.mkdir",
"numpy.cumsum",
"numpy.sh... | [((614, 637), 'astropy.time.Time', 'Time', (['date'], {'format': '"""jd"""'}), "(date, format='jd')\n", (618, 637), False, 'from astropy.time import Time\n'), ((885, 905), 'os.path.isdir', 'path.isdir', (['dir_path'], {}), '(dir_path)\n', (895, 905), False, 'from os import path\n'), ((6679, 6715), 'matplotlib.pyplot.su... |
import discord
import mystbin
from discord.ext import commands
import json
import os
import aiohttp
import asyncio
import yarl
import re
os.chdir("/home/gilb/LyricMaster/BotRecords/")
class GithubError(commands.CommandError):
pass
class Github_Related(commands.Cog):
def __init__(self, bot):
self.bot ... | [
"discord.ext.commands.Cog.listener",
"discord.utils._parse_ratelimit_header",
"discord.ext.commands.guild_only",
"asyncio.Lock",
"os.chdir",
"discord.ext.commands.has_guild_permissions",
"asyncio.sleep",
"json.load",
"yarl.URL",
"discord.ext.commands.command",
"json.dump"
] | [((138, 184), 'os.chdir', 'os.chdir', (['"""/home/gilb/LyricMaster/BotRecords/"""'], {}), "('/home/gilb/LyricMaster/BotRecords/')\n", (146, 184), False, 'import os\n'), ((3589, 3612), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (3610, 3612), False, 'from discord.ext import commands\n... |
# Copyright (c) 2018 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import math
import numpy as np
import python_speech_features as psf
import resampy as rs
import scipy.io.wavfile as wave
def get_speech_features_from_file(filename, num_fe... | [
"numpy.mean",
"numpy.abs",
"math.ceil",
"numpy.random.rand",
"python_speech_features.sigproc.framesig",
"python_speech_features.logfbank",
"python_speech_features.mfcc",
"numpy.random.randint",
"python_speech_features.sigproc.logpowspec",
"scipy.io.wavfile.read",
"numpy.std",
"numpy.pad",
"n... | [((1419, 1438), 'scipy.io.wavfile.read', 'wave.read', (['filename'], {}), '(filename)\n', (1428, 1438), True, 'import scipy.io.wavfile as wave\n'), ((2559, 2656), 'numpy.random.randint', 'np.random.randint', ([], {'low': "augmentation['noise_level_min']", 'high': "augmentation['noise_level_max']"}), "(low=augmentation[... |
from urllib.parse import urljoin
from flask import current_app
from server.apis.base_api import BaseApi
class NasdaqUrl:
def __init__(self, root):
self.root = root
def make(self, *args):
return urljoin(self.root, *args)
def info(self, symbol):
if not symbol:
raise Exc... | [
"server.apis.base_api.BaseApi.create_session",
"flask.current_app.config.get",
"urllib.parse.urljoin",
"server.apis.base_api.BaseApi.__init__"
] | [((221, 246), 'urllib.parse.urljoin', 'urljoin', (['self.root', '*args'], {}), '(self.root, *args)\n', (228, 246), False, 'from urllib.parse import urljoin\n'), ((686, 708), 'server.apis.base_api.BaseApi.__init__', 'BaseApi.__init__', (['self'], {}), '(self)\n', (702, 708), False, 'from server.apis.base_api import Base... |
'''
Design a delivery algorithm where you want to carry as many packages as possible under a weight limit.
Assumptions:
- Weight is a positive integer
- Each item has a price and a weight
- Total weight limit is a positive amount
- Want to maximize quantity of packages to fit, not necessarily the heaviest item... | [
"numpy.random.choice"
] | [((801, 839), 'numpy.random.choice', 'np.random.choice', (['(10)', '(10)'], {'replace': '(True)'}), '(10, 10, replace=True)\n', (817, 839), True, 'import numpy as np\n')] |
from googletrans import Translator
translator = Translator()
sample_text = 'Hi my name is subash'
det = translator.detect(sample_text)
print(det)
output= translator.translate(sample_text, dest="ta")
print(output)
| [
"googletrans.Translator"
] | [((51, 63), 'googletrans.Translator', 'Translator', ([], {}), '()\n', (61, 63), False, 'from googletrans import Translator\n')] |
import requests
import csv
import logging
from requests.auth import HTTPBasicAuth
import time
from primeapidata import PI_ADDRESS, USERNAME, PASSWORD
requests.packages.urllib3.disable_warnings()
'''
Call one of those from the main function or put one out of comments here, be carefull of the different filenames.
It sh... | [
"requests.auth.HTTPBasicAuth",
"requests.packages.urllib3.disable_warnings",
"csv.writer",
"time.strftime",
"logging.warning",
"logging.info"
] | [((151, 195), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', ([], {}), '()\n', (193, 195), False, 'import requests\n'), ((1301, 1342), 'logging.info', 'logging.info', (['"""Getting all device groups"""'], {}), "('Getting all device groups')\n", (1313, 1342), False, 'import l... |
# 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 ... | [
"jax.numpy.concatenate",
"language.mentionmemory.utils.jax_utils.matmul_2d_index_select",
"language.mentionmemory.modules.memory_retrieval_layer.MemoryRetrievalLayer",
"flax.linen.Dense"
] | [((3412, 3468), 'flax.linen.Dense', 'nn.Dense', ([], {'features': 'self.memory_key_dim', 'dtype': 'self.dtype'}), '(features=self.memory_key_dim, dtype=self.dtype)\n', (3420, 3468), True, 'import flax.linen as nn\n'), ((3527, 3674), 'language.mentionmemory.modules.memory_retrieval_layer.MemoryRetrievalLayer', 'memory_r... |
"""
Expansion and contraction of resource allocation in sensory bottlenecks.
<NAME>., <NAME>., <NAME>.
Written in 2021 by <NAME>.
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distribut... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.legend"
] | [((1221, 1233), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1231, 1233), True, 'import matplotlib.pyplot as plt\n'), ((1715, 1819), 'matplotlib.pyplot.plot', 'plt.plot', (['[0, 100]', '[d_line, d_line]'], {'linestyle': '"""--"""', 'color': '"""#9c2c2c"""', 'label': '"""Proportional density"""'}), "([0,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from codecs import open
from setuptools import find_packages, setup
def read(*paths):
"""Build a file path from *paths and return the contents."""
with open(os.path.join(*paths), 'r', 'utf-8') as f:
return f.read()
requires = [
'Django<1.9'... | [
"setuptools.find_packages",
"os.path.join"
] | [((1586, 1601), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1599, 1601), False, 'from setuptools import find_packages, setup\n'), ((224, 244), 'os.path.join', 'os.path.join', (['*paths'], {}), '(*paths)\n', (236, 244), False, 'import os\n')] |
import numpy as np
import math
def grid_reading(key, table):
_key = sorted(key)
order = [key.index(i) for i in _key]
print(list(key))
#print(_key)
print('Порядок использования столбцов:', order)
m = table.shape[0]
res = ''
for j in order:
for i in range(m):
res += ta... | [
"math.ceil",
"numpy.roll",
"numpy.sqrt",
"numpy.array",
"numpy.zeros",
"numpy.random.randint",
"numpy.empty",
"numpy.vstack",
"numpy.full",
"numpy.arange"
] | [((4187, 4199), 'numpy.array', 'np.array', (['ru'], {}), '(ru)\n', (4195, 4199), True, 'import numpy as np\n'), ((732, 752), 'math.ceil', 'math.ceil', (['(t_len / n)'], {}), '(t_len / n)\n', (741, 752), False, 'import math\n'), ((759, 778), 'numpy.full', 'np.full', (['(m, n)', '""""""'], {}), "((m, n), '')\n", (766, 77... |
# Copyright (c) 2017 Xilinx, Inc.
#
# SPDX-License-Identifier: GPL-2.0
# Test various gpio-related functionality, such as the input, set,
# clear and toggle.
import pytest
import random
"""
Note: This test relies on boardenv_* containing configuration values to define
which the gpio available for testing. Without th... | [
"pytest.skip",
"pytest.mark.buildconfigspec"
] | [((1786, 1825), 'pytest.mark.buildconfigspec', 'pytest.mark.buildconfigspec', (['"""cmd_gpio"""'], {}), "('cmd_gpio')\n", (1813, 1825), False, 'import pytest\n'), ((2004, 2043), 'pytest.mark.buildconfigspec', 'pytest.mark.buildconfigspec', (['"""cmd_gpio"""'], {}), "('cmd_gpio')\n", (2031, 2043), False, 'import pytest\... |
from rest_framework import serializers
from demo.models import Lock
class LockerSerializer(serializers.ModelSerializer):
actions = serializers.SerializerMethodField()
class Meta:
model = Lock
fields = ('id', 'actions', 'status')
readonly = ('id', 'status')
def get_actions(self, ... | [
"rest_framework.serializers.SerializerMethodField"
] | [((138, 173), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {}), '()\n', (171, 173), False, 'from rest_framework import serializers\n')] |
import datetime
from django.core.management.base import BaseCommand
from django.db.models import Q
from post_office import mail
from ...models import Dashboard
class Command(BaseCommand):
help = "Send reminder emails"
def handle(self, *args, **options):
"""
Bulk send reminder emails.
... | [
"post_office.mail.send_many",
"datetime.date.today",
"post_office.mail.send_queued",
"django.db.models.Q"
] | [((1620, 1646), 'post_office.mail.send_many', 'mail.send_many', (['all_emails'], {}), '(all_emails)\n', (1634, 1646), False, 'from post_office import mail\n'), ((1688, 1706), 'post_office.mail.send_queued', 'mail.send_queued', ([], {}), '()\n', (1704, 1706), False, 'from post_office import mail\n'), ((342, 363), 'datet... |
# Generated by Django 2.0.2 on 2018-05-25 19:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('capdb', '0039_auto_20180521_1511'),
]
operations = [
migrations.AddField(
model_name='casexml',
name='size',
... | [
"django.db.models.BooleanField",
"django.db.models.IntegerField"
] | [((331, 373), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (350, 373), False, 'from django.db import migrations, models\n'), ((502, 544), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'blank': '(True)', 'null': '(True)'... |
#!/usr/bin/env python3
# ------------------------------------------------------------------
#
# Description: unified config for herbstluftwm autostart
# Created by: <NAME> <<EMAIL>)
#
# Source
# https://github.com/epsi-rns/dotfiles/tree/master/herbstluftwm/python
#
# Blog
# http://epsi-rns.githu... | [
"os.access",
"os.path.isfile",
"os.popen",
"os.path.abspath",
"os.system"
] | [((8351, 8406), 'os.system', 'os.system', (['("xsetroot -solid \'" + color[\'blue500\'] + "\'")'], {}), '("xsetroot -solid \'" + color[\'blue500\'] + "\'")\n', (8360, 8406), False, 'import os\n'), ((8482, 8526), 'os.system', 'os.system', (['"""echo 35 > /tmp/herbstluftwm-gap"""'], {}), "('echo 35 > /tmp/herbstluftwm-ga... |
# Copyright 2019 The Wallaroo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
"logging.debug",
"integration.cluster.Cluster",
"os.environ.get",
"integration.logger.add_in_memory_log_stream",
"os.getcwd",
"time.sleep",
"datetime.datetime.now",
"integration.external.save_logs_to_file",
"integration.logger.set_logging",
"integration.end_points.iter_generator",
"integration.e... | [((989, 1020), 'integration.logger.set_logging', 'set_logging', ([], {'name': '"""conformance"""'}), "(name='conformance')\n", (1000, 1020), False, 'from integration.logger import add_in_memory_log_stream, set_logging\n'), ((1840, 1897), 'integration.end_points.iter_generator', 'iter_generator', ([], {'items': 'data', ... |
from flask_assets import Bundle
bundels = {
'main_js': Bundle(),
'main_css': Bundle(),
'admin_js': Bundle(),
'admin_css': Bundle()
} | [
"flask_assets.Bundle"
] | [((60, 68), 'flask_assets.Bundle', 'Bundle', ([], {}), '()\n', (66, 68), False, 'from flask_assets import Bundle\n'), ((86, 94), 'flask_assets.Bundle', 'Bundle', ([], {}), '()\n', (92, 94), False, 'from flask_assets import Bundle\n'), ((112, 120), 'flask_assets.Bundle', 'Bundle', ([], {}), '()\n', (118, 120), False, 'f... |
# Django settings for sample project.
import os
import sys
import django
APP = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
PROJ_ROOT = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, APP)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('<NAME>', '<EMAIL>'),
)
MANAGERS = ADMINS
DA... | [
"os.path.dirname",
"sys.path.insert",
"os.path.join"
] | [((195, 218), 'sys.path.insert', 'sys.path.insert', (['(0)', 'APP'], {}), '(0, APP)\n', (210, 218), False, 'import sys\n'), ((168, 193), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (183, 193), False, 'import os\n'), ((1300, 1343), 'os.path.join', 'os.path.join', (['PROJ_ROOT', '"""media"""... |
import statsmodels.api as sm
import pandas as pd
def BackwardElimination(x, y, Threshold):
"""
This function apply a backard elimination for a linear regression model, based on P Value level.
Argument:
----------
- x: pandas dataframe
The dependent variables
- y: pandas da... | [
"statsmodels.api.OLS"
] | [((827, 839), 'statsmodels.api.OLS', 'sm.OLS', (['y', 'x'], {}), '(y, x)\n', (833, 839), True, 'import statsmodels.api as sm\n')] |
# main code for the ground station, mounted to the launchpad. All data must be received from the rocket over radio and transmitted to the analysis tool over a network socket
#from C:/Users/CalSu/Documents/.ACTUAL_DOCS/YAR/yar-software/workspaces/ground-station import server
from server import server
HOST = '192.168.0... | [
"server.server"
] | [((408, 426), 'server.server', 'server', (['HOST', 'PORT'], {}), '(HOST, PORT)\n', (414, 426), False, 'from server import server\n')] |
from argparse import ArgumentParser
from collections import Counter
from json import JSONDecodeError, loads
from typing import Counter as CounterType, Optional
from typing import Dict
from commode_utils.vocabulary import BaseVocabulary, build_from_scratch
from embeddings_for_trees.utils.common import AST
class Voca... | [
"collections.Counter",
"json.loads",
"commode_utils.vocabulary.build_from_scratch",
"argparse.ArgumentParser"
] | [((2561, 2577), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (2575, 2577), False, 'from argparse import ArgumentParser\n'), ((2844, 2885), 'commode_utils.vocabulary.build_from_scratch', 'build_from_scratch', (['args.data', '_vocab_cls'], {}), '(args.data, _vocab_cls)\n', (2862, 2885), False, 'from com... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 2 18:47:31 2019
@author: m
for musical dimensions
listen bach
time 32.56
podcast
BBC all in the mind 28.05.19 21:30
http://open.live.bbc.co.uk/mediaselector/6/redir/version/2.0/mediaset/audio-nondrm-download/proto/http/vpid/p07bkkr0.mp3
"""
imp... | [
"subprocess.check_output",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.show"
] | [((530, 588), 'matplotlib.pyplot.plot', 'plt.plot', (['[-0.1, 1.1]', '[-0.1, 1.1]'], {'color': '"""w"""', 'linewidth': '(0)'}), "([-0.1, 1.1], [-0.1, 1.1], color='w', linewidth=0)\n", (538, 588), True, 'import matplotlib.pyplot as plt\n'), ((1251, 1283), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""input"""'], {'fon... |
from django.contrib.auth.models import User
from rest_framework import serializers
from rest_framework_simplejwt.serializers import (
TokenObtainPairSerializer as BaseTokenObtainSerializer,
TokenRefreshSerializer as BaseTokenRefreshSerializer,
)
from rest_framework_simplejwt.tokens import RefreshToken
class U... | [
"rest_framework_simplejwt.tokens.RefreshToken",
"rest_framework.serializers.ImageField",
"django.contrib.auth.models.User.objects.get"
] | [((453, 500), 'rest_framework.serializers.ImageField', 'serializers.ImageField', ([], {'source': '"""profile.avatar"""'}), "(source='profile.avatar')\n", (475, 500), False, 'from rest_framework import serializers\n'), ((793, 822), 'rest_framework_simplejwt.tokens.RefreshToken', 'RefreshToken', (["data['refresh']"], {})... |
from datastore.core import SymlinkDatastore
from datastore.core import DirectoryDatastore
from .model import Model
from .model import Key
class Collection(object):
'''Implements a simple persistent collection of objects.
It uses symlink and directory datastores to keep track of the items.
'''
Model = Model... | [
"datastore.core.DirectoryDatastore",
"datastore.core.SymlinkDatastore"
] | [((451, 478), 'datastore.core.SymlinkDatastore', 'SymlinkDatastore', (['datastore'], {}), '(datastore)\n', (467, 478), False, 'from datastore.core import SymlinkDatastore\n'), ((510, 552), 'datastore.core.DirectoryDatastore', 'DirectoryDatastore', (['self.symlink_datastore'], {}), '(self.symlink_datastore)\n', (528, 55... |
import findspark
findspark.init()
from pyspark import SparkContext
from pyspark import SparkConf
from pyspark.mllib.clustering import LDA, LDAModel
from pyspark.mllib.feature import IDF
from pyspark.sql import SQLContext
from pyspark.ml.feature import CountVectorizer
import pandas as pd
import nltk
import... | [
"pyspark.sql.SQLContext",
"pandas.read_csv",
"nltk.word_tokenize",
"pyspark.mllib.clustering.LDAModel.load",
"pyspark.mllib.feature.IDF",
"pyspark.SparkConf",
"operator.itemgetter",
"pyspark.mllib.clustering.LDA.train",
"findspark.init",
"pyspark.ml.feature.CountVectorizer",
"pyspark.SparkContex... | [((18, 34), 'findspark.init', 'findspark.init', ([], {}), '()\n', (32, 34), False, 'import findspark\n'), ((490, 513), 'pyspark.SparkContext', 'SparkContext', ([], {'conf': 'conf'}), '(conf=conf)\n', (502, 513), False, 'from pyspark import SparkContext\n'), ((528, 542), 'pyspark.sql.SQLContext', 'SQLContext', (['sc'], ... |
import argparse
import numpy as np
import os
import sys
from time import sleep
import pandas as pd
# running on Mac for testing
if 'darwin' in sys.platform:
from fake_rpi.RPi import GPIO as GPIO
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d.axes3d as p3
from matplotlib import animation
... | [
"numpy.log10",
"RPi.GPIO.output",
"time.sleep",
"numpy.array",
"numpy.arange",
"RPi.GPIO.setmode",
"numpy.save",
"os.path.exists",
"RPi.GPIO.cleanup",
"argparse.ArgumentParser",
"numpy.where",
"numpy.max",
"matplotlib.pyplot.close",
"pandas.DataFrame",
"matplotlib.pyplot.cla",
"numpy.r... | [((1391, 1447), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['bt_no', 'vis_name', 'time_step']"}), "(columns=['bt_no', 'vis_name', 'time_step'])\n", (1403, 1447), True, 'import pandas as pd\n'), ((344, 367), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (358, 367), False, 'import m... |
from django.contrib import messages
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect, render
from vendor.forms import VendorSignUpForm
from vendor.utils import service
def VendorSignUpView(request):
''' Sign up a new vendor '''
if request.method == 'POST':
... | [
"django.shortcuts.render",
"django.contrib.auth.authenticate",
"django.contrib.auth.login",
"django.shortcuts.redirect",
"django.contrib.messages.success",
"vendor.utils.service.send_welcome_mail",
"vendor.forms.VendorSignUpForm"
] | [((945, 999), 'django.shortcuts.render', 'render', (['request', '"""vendor/sign_up.html"""', "{'form': form}"], {}), "(request, 'vendor/sign_up.html', {'form': form})\n", (951, 999), False, 'from django.shortcuts import redirect, render\n'), ((333, 378), 'vendor.forms.VendorSignUpForm', 'VendorSignUpForm', (['request.P... |
"""
Copyright (c) Dell Inc., or its subsidiaries. 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
"""
import csv
import dataclasses... | [
"dataclasses.fields",
"dataclasses.asdict",
"gzip.open",
"pathlib.Path.cwd",
"json.dumps",
"pravega_client.StreamManager",
"dataclasses.astuple",
"csv.reader"
] | [((4194, 4238), 'pravega_client.StreamManager', 'pravega_client.StreamManager', (['controller_uri'], {}), '(controller_uri)\n', (4222, 4238), False, 'import pravega_client\n'), ((1987, 2011), 'dataclasses.fields', 'dataclasses.fields', (['self'], {}), '(self)\n', (2005, 2011), False, 'import dataclasses\n'), ((2546, 25... |
#!/usr/bin/env python
import signal
import os
# Getting currunt path
currunt_path_temp = os.path.abspath(__file__)
currunt_path = os.path.split(currunt_path_temp)[0] + "/"
def Shutdownhandler(signum, frame):
exit()
# Set the signal handler
signal.signal(signal.SIGINT, Shutdownhandler)
print("\n")
while(T... | [
"os.path.abspath",
"signal.signal",
"os.path.split"
] | [((90, 115), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (105, 115), False, 'import os\n'), ((253, 298), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'Shutdownhandler'], {}), '(signal.SIGINT, Shutdownhandler)\n', (266, 298), False, 'import signal\n'), ((131, 163), 'os.path.split', ... |
from typing import Optional, Tuple, Sequence, Type, Union, Dict
import numpy as np
from anndata import AnnData
import scipy.stats
from scipy import sparse
from scanpy import logging as logg
import graph_tool.all as gt
import pandas as pd
from .._utils import get_cell_loglikelihood, get_cell_back_p, state_from_blocks
... | [
"graph_tool.all.remove_parallel_edges",
"graph_tool.all.vertex_similarity",
"numpy.sqrt",
"numpy.log",
"scanpy.preprocessing.neighbors",
"scanpy._utils._choose_graph",
"numpy.array",
"scanpy.tools.pca",
"graph_tool.all.BlockState",
"pandas.Categorical",
"numpy.max",
"numpy.dot",
"scanpy.exte... | [((11570, 11634), 'numpy.array', 'np.array', (['[(1 - 1 / adata.obsm[x].shape[1]) for x in obsm_names]'], {}), '([(1 - 1 / adata.obsm[x].shape[1]) for x in obsm_names])\n', (11578, 11634), True, 'import numpy as np\n'), ((13210, 13252), 'scanpy.logging.info', 'logg.info', (['"""Adding cell similarity scores"""'], {}), ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Novo and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import cint, cstr, flt
class Drawing(Document):
def autoname(self):
if self.prefix... | [
"frappe.throw",
"frappe.db.sql_list"
] | [((333, 418), 'frappe.db.sql_list', 'frappe.db.sql_list', (['"""select name from `tabDrawing` where prefix=%s"""', 'self.prefix'], {}), "('select name from `tabDrawing` where prefix=%s', self.prefix\n )\n", (351, 418), False, 'import frappe\n'), ((593, 628), 'frappe.throw', 'frappe.throw', (['"""Prefix Is Mandatory"... |
import unittest
from arekit.contrib.source.rusentrel.io_utils import RuSentRelIOUtils, RuSentRelVersions
class TestRuSentRel(unittest.TestCase):
rsr_version = RuSentRelVersions.V11
def test_iter_train_indices(self):
train_indices = list(RuSentRelIOUtils.iter_train_indices(self.rsr_version))
... | [
"unittest.main",
"arekit.contrib.source.rusentrel.io_utils.RuSentRelIOUtils.iter_test_indices",
"arekit.contrib.source.rusentrel.io_utils.RuSentRelIOUtils.iter_train_indices"
] | [((793, 808), 'unittest.main', 'unittest.main', ([], {}), '()\n', (806, 808), False, 'import unittest\n'), ((258, 311), 'arekit.contrib.source.rusentrel.io_utils.RuSentRelIOUtils.iter_train_indices', 'RuSentRelIOUtils.iter_train_indices', (['self.rsr_version'], {}), '(self.rsr_version)\n', (293, 311), False, 'from arek... |
# -*- coding: utf-8 -*-
"""
test methods of cdips module
"""
from matplotlib.axes import Axes
import lightkurve as lk
from chronos import Diamante
TICID = 460205581
TOIID = 837
SECTOR = 10
QUALITY_BITMASK = "default"
d = Diamante(
ticid=TICID,
# toiid=TOIID,
# sector=SECTOR,
lc_num=1,
aper_radius... | [
"chronos.Diamante"
] | [((224, 270), 'chronos.Diamante', 'Diamante', ([], {'ticid': 'TICID', 'lc_num': '(1)', 'aper_radius': '(2)'}), '(ticid=TICID, lc_num=1, aper_radius=2)\n', (232, 270), False, 'from chronos import Diamante\n')] |
from typing import List, Tuple, Union, Dict
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
import torch_optimizer
import numpy as np
import os
from tqdm import tqdm
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
from ecg_classification import *
from wettbewerb import load_references
def predi... | [
"torch.optim.lr_scheduler.MultiStepLR",
"torch.load",
"wettbewerb.load_references",
"torch.utils.data.DataLoader",
"torch.no_grad"
] | [((7649, 7664), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (7662, 7664), False, 'import torch\n'), ((4323, 4433), 'torch.utils.data.DataLoader', 'DataLoader', ([], {'dataset': 'dataset', 'batch_size': '(1)', 'num_workers': '(0)', 'pin_memory': '(False)', 'drop_last': '(False)', 'shuffle': '(False)'}), '(datase... |
import time
class GuessingGame(object):
def __init__(self, log, storage):
super(GuessingGame, self).__init__()
self.Log = log
self.Storage = storage
self.Running = False
self.Completed = False
self.Guesses = list()
self.StartTime = time.time()
self... | [
"time.time"
] | [((295, 306), 'time.time', 'time.time', ([], {}), '()\n', (304, 306), False, 'import time\n')] |
import importlib
import datetime
import argparse
import random
import uuid
import time
import os
import numpy as np
import torch
from torch.autograd import Variable
from metrics.metrics import confusion_matrix
import matplotlib.pyplot as plt
from main import load_datasets
# Import saliency methods
#from fullgrad_sa... | [
"fullgrad_saliency_master.saliency.gradcam.GradCAM",
"fullgrad_saliency_master.saliency.smoothgrad.SmoothGrad",
"torch.sum",
"matplotlib.pyplot.imshow",
"argparse.ArgumentParser",
"numpy.random.seed",
"matplotlib.pyplot.axis",
"torch.abs",
"importlib.import_module",
"matplotlib.pyplot.gcf",
"uui... | [((2135, 2152), 'torch.sum', 'torch.sum', (['scores'], {}), '(scores)\n', (2144, 2152), False, 'import torch\n'), ((2241, 2258), 'torch.abs', 'torch.abs', (['x_grad'], {}), '(x_grad)\n', (2250, 2258), False, 'import torch\n'), ((2305, 2362), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""... |
from swagger_spec_validator.validator20 import validate_apis
def test_api_level_params_ok():
# Parameters defined at the API level apply to all operations within that
# API. Make sure we don't treat the API level parameters as an operation
# since they are peers.
apis = {
'/tags/{tag-name}': {... | [
"swagger_spec_validator.validator20.validate_apis"
] | [((605, 637), 'swagger_spec_validator.validator20.validate_apis', 'validate_apis', (['apis', '(lambda x: x)'], {}), '(apis, lambda x: x)\n', (618, 637), False, 'from swagger_spec_validator.validator20 import validate_apis\n'), ((1128, 1160), 'swagger_spec_validator.validator20.validate_apis', 'validate_apis', (['apis',... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 12 16:51:04 2017
@author: tonyd
Updated 05Oct2020 by stephg
"""
import vcf
import sys
import getopt
import math
usage = 'clinvarSummary.py -r <region> -b <binLength> -p <regionParts> -m <annotationMode>'
theArgs = {'binLength': int(0), 'regionPar... | [
"getopt.getopt",
"math.ceil",
"vcf.Reader",
"sys.exit"
] | [((5154, 5175), 'vcf.Reader', 'vcf.Reader', (['sys.stdin'], {}), '(sys.stdin)\n', (5164, 5175), False, 'import vcf\n'), ((944, 1042), 'getopt.getopt', 'getopt.getopt', (['argv', '"""hr:b:p:m:"""', "['region=', 'binLength=', 'regionParts=', 'annotationMode=']"], {}), "(argv, 'hr:b:p:m:', ['region=', 'binLength=', 'regio... |
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from sklearn.metrics import roc_auc_score
from torchvision import datasets, transforms
from tqdm import tqdm, trange
# for CBB and MCBB
DEVICE = torch.device("cuda" if torch.cuda.is_available... | [
"torch.nn.functional.linear",
"torch.nn.functional.conv2d",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.distributions.Normal",
"torch.log",
"torch.nn.init.constant_",
"torch.max",
"torch.nn.init.kaiming_normal_",
"torch.Tensor",
"torch.exp",
"math.sqrt",
"torch.tensor",
"torch.cuda.is_... | [((297, 322), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (320, 322), False, 'import torch\n'), ((464, 496), 'torch.distributions.Normal', 'torch.distributions.Normal', (['(0)', '(1)'], {}), '(0, 1)\n', (490, 496), False, 'import torch\n'), ((2953, 2974), 'torch.nn.functional.linear', 'F.lin... |
"""Entry point for treadmill manage ecosystem"""
import pkgutil
import click
from treadmill import cli
__path__ = pkgutil.extend_path(__path__, __name__)
def init():
"""Return top level command handler."""
@click.group(cls=cli.make_multi_command('treadmill.cli.manage'))
def manage():
"""Manage a... | [
"treadmill.cli.make_multi_command",
"pkgutil.extend_path"
] | [((115, 154), 'pkgutil.extend_path', 'pkgutil.extend_path', (['__path__', '__name__'], {}), '(__path__, __name__)\n', (134, 154), False, 'import pkgutil\n'), ((235, 281), 'treadmill.cli.make_multi_command', 'cli.make_multi_command', (['"""treadmill.cli.manage"""'], {}), "('treadmill.cli.manage')\n", (257, 281), False, ... |