code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.urls import reverse
from rest_framework import status
from conf_site.api.tests import ConferenceSiteAPITestCase
class ConferenceSiteAPIConferenceTestCase(ConferenceSiteAPITestCase):
def test_conference_api_anonymous_user(self):
response = self.client.get(reverse("conference-detail"))
... | [
"django.urls.reverse"
] | [((283, 311), 'django.urls.reverse', 'reverse', (['"""conference-detail"""'], {}), "('conference-detail')\n", (290, 311), False, 'from django.urls import reverse\n')] |
import asyncio
from django.core.management.base import BaseCommand
from Harvest.utils import get_logger
from task_queue.scheduler import QueueScheduler
logger = get_logger(__name__)
class Command(BaseCommand):
help = "Run the queue consumer"
def handle(self, *args, **options):
QueueScheduler().run... | [
"Harvest.utils.get_logger",
"task_queue.scheduler.QueueScheduler"
] | [((164, 184), 'Harvest.utils.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (174, 184), False, 'from Harvest.utils import get_logger\n'), ((300, 316), 'task_queue.scheduler.QueueScheduler', 'QueueScheduler', ([], {}), '()\n', (314, 316), False, 'from task_queue.scheduler import QueueScheduler\n')] |
# Generated by Django 3.0.10 on 2020-09-10 13:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0003_user_mobile_phone'),
]
operations = [
migrations.AlterField(
model_name='user',
name='mobile_phone',
... | [
"django.db.models.CharField"
] | [((338, 435), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'default': '""""""', 'max_length': '(255)', 'verbose_name': '"""Mobile phone number"""'}), "(blank=True, default='', max_length=255, verbose_name=\n 'Mobile phone number')\n", (354, 435), False, 'from django.db import migrations... |
# -*- coding: utf-8 -*-
# @Time : 5/31/2018 9:20 PM
# @Author : sunyonghai
# @File : test.py
# @Software: ZJ_AI
from multiprocessing import Pool, Lock, Value
import os
tests_count = 80
lock = Lock()
counter = Value('i', 0) # int type,相当于java里面的原子变量
def run(fn):
global tests_count, lock, counter
wi... | [
"multiprocessing.Lock",
"os.getpid",
"multiprocessing.Value",
"multiprocessing.Pool"
] | [((202, 208), 'multiprocessing.Lock', 'Lock', ([], {}), '()\n', (206, 208), False, 'from multiprocessing import Pool, Lock, Value\n'), ((220, 233), 'multiprocessing.Value', 'Value', (['"""i"""', '(0)'], {}), "('i', 0)\n", (225, 233), False, 'from multiprocessing import Pool, Lock, Value\n'), ((517, 524), 'multiprocessi... |
import turtle
tortuguinha = turtle.Turtle()
tortuguinha.shape('turtle')
tortuguinha.color('red')
tortugo = turtle.Turtle()
tortugo.shape('turtle')
tortugo.color('blue')
def faz_quadradin(the_turtle):
for i in range(0,4):
the_turtle.forward(100)
the_turtle.right(90)
def faz_espiral(the_turtle):
... | [
"turtle.Turtle"
] | [((30, 45), 'turtle.Turtle', 'turtle.Turtle', ([], {}), '()\n', (43, 45), False, 'import turtle\n'), ((109, 124), 'turtle.Turtle', 'turtle.Turtle', ([], {}), '()\n', (122, 124), False, 'import turtle\n')] |
# Copyright (c) 2015 Ericsson AB.
# 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 applicab... | [
"mock.Mock",
"kingbird.objects.base.KingbirdObject",
"kingbird.objects.base.KingbirdObject._from_db_object",
"mock.patch.object",
"oslo_versionedobjects.fields.StringField"
] | [((1099, 1162), 'mock.patch.object', 'mock.patch.object', (['obj_base.KingbirdObject', '"""obj_reset_changes"""'], {}), "(obj_base.KingbirdObject, 'obj_reset_changes')\n", (1116, 1162), False, 'import mock\n'), ((847, 872), 'kingbird.objects.base.KingbirdObject', 'obj_base.KingbirdObject', ([], {}), '()\n', (870, 872),... |
import tempfile
from abc import ABC, abstractmethod
from time import sleep, time
from hardware.camera import Photo, Resolution
class CameraDriver(ABC):
@abstractmethod
def capture(self) -> Photo:
pass
class PiCameraDriver(CameraDriver):
def __init__(self, resolution=Resolution(1024, 768), iso... | [
"hardware.camera.Resolution",
"hardware.camera.Photo",
"picamera.PiCamera",
"time.sleep",
"tempfile.NamedTemporaryFile"
] | [((294, 315), 'hardware.camera.Resolution', 'Resolution', (['(1024)', '(768)'], {}), '(1024, 768)\n', (304, 315), False, 'from hardware.camera import Photo, Resolution\n'), ((449, 480), 'picamera.PiCamera', 'PiCamera', ([], {'resolution': 'resolution'}), '(resolution=resolution)\n', (457, 480), False, 'from picamera im... |
from tests.common.devices.base import AnsibleHostBase
class VMHost(AnsibleHostBase):
"""
@summary: Class for VM server
For running ansible module on VM server
"""
def __init__(self, ansible_adhoc, hostname):
AnsibleHostBase.__init__(self, ansible_adhoc, hostname)
@property
def e... | [
"tests.common.devices.base.AnsibleHostBase.__init__"
] | [((240, 295), 'tests.common.devices.base.AnsibleHostBase.__init__', 'AnsibleHostBase.__init__', (['self', 'ansible_adhoc', 'hostname'], {}), '(self, ansible_adhoc, hostname)\n', (264, 295), False, 'from tests.common.devices.base import AnsibleHostBase\n')] |
"""Control the sc2monitor."""
import asyncio
import logging
import math
import time
from datetime import datetime, timedelta
from operator import itemgetter
import aiohttp
import sc2monitor.model as model
from sc2monitor.handlers import SQLAlchemyHandler
from sc2monitor.sc2api import SC2API
logger = logging.getLogge... | [
"logging.getLogger",
"sc2monitor.sc2api.SC2API",
"sc2monitor.model.Statistics",
"math.sqrt",
"operator.itemgetter",
"datetime.timedelta",
"sc2monitor.model.Match.datetime.asc",
"sc2monitor.model.Run",
"sc2monitor.model.Match",
"asyncio.gather",
"sc2monitor.model.Log.datetime.desc",
"sc2monitor... | [((304, 331), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (321, 331), False, 'import logging\n'), ((345, 364), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (362, 364), False, 'import logging\n'), ((798, 836), 'aiohttp.ClientSession', 'aiohttp.ClientSession', ([], {'heade... |
import pandas as pd
from tabulate import tabulate
from cadCAD.configuration import append_configs
from cadCAD.configuration.utils import config_sim
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor
from cadCAD import configs
# Policies per Mechanism
def p1m1(_g, step, sH, s):
return {'policy1': ... | [
"tabulate.tabulate",
"cadCAD.configuration.append_configs",
"cadCAD.engine.ExecutionMode",
"cadCAD.engine.Executor",
"pandas.DataFrame",
"cadCAD.engine.ExecutionContext"
] | [((1493, 1654), 'cadCAD.configuration.append_configs', 'append_configs', ([], {'sim_configs': 'sim_config', 'initial_state': 'genesis_states', 'partial_state_update_blocks': 'psubs', 'policy_ops': '[lambda a, b: a + b, lambda y: y * 2]'}), '(sim_configs=sim_config, initial_state=genesis_states,\n partial_state_updat... |
from __future__ import absolute_import, division, print_function
import pytest
import telnyx
TEST_RESOURCE_ID = "f1486bae-f067-460c-ad43-73a92848f902"
class TestPortingOrder(object):
def test_is_listable(self, request_mock):
resources = telnyx.PortingOrder.list()
request_mock.assert_requested("... | [
"telnyx.PortingOrder.modify",
"pytest.mark.skip",
"telnyx.PortingOrder.create",
"telnyx.PortingPhoneNumber.list",
"telnyx.PortingOrder.list",
"telnyx.PortingOrder.retrieve"
] | [((2585, 2656), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""PDF endpoint not supported by mock currently"""'}), "(reason='PDF endpoint not supported by mock currently')\n", (2601, 2656), False, 'import pytest\n'), ((254, 280), 'telnyx.PortingOrder.list', 'telnyx.PortingOrder.list', ([], {}), '()\n', (27... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"numpy.allclose",
"paddle.nn.LayerList",
"paddle.jit.ProgramTranslator.get_instance",
"paddle.ones",
"unittest.main"
] | [((2204, 2247), 'paddle.jit.ProgramTranslator.get_instance', 'paddle.jit.ProgramTranslator.get_instance', ([], {}), '()\n', (2245, 2247), False, 'import paddle\n'), ((2290, 2330), 'paddle.ones', 'paddle.ones', ([], {'shape': '[2, 3]', 'dtype': '"""int32"""'}), "(shape=[2, 3], dtype='int32')\n", (2301, 2330), False, 'im... |
""" The task of the registry is to register complex objects
by an keyword/alias that you easily can build and instanciate
these objects with a single keyword. This allows it in a easy
manner to parse a yaml configuration file and use these values
to instanciate the available objects.
"""
import tensorflow as tf
from ... | [
"importlib.import_module"
] | [((1307, 1328), 'importlib.import_module', 'import_module', (['module'], {}), '(module)\n', (1320, 1328), False, 'from importlib import import_module\n')] |
import os
import json
import rmse
TUNING_FILE = "/Users/markduan/duan/USC_course/USC_APDS/INF553/project/predict/tuning.json"
CORATED_LIMIT = [3, 5, 7, 10]
LONELY_THRESHOLD = [2, 3, 5, 7]
N_NEIGHBORS_ITEMBASED = [5, 7, 10, 12]
WEIGHT = [0.2, 0.4, 0.6, 0.8]
def writeRes(c, l, n, w, res):
with open(TUNING_FILE, 'a... | [
"os.path.exists",
"json.dumps",
"os.system",
"rmse.getRmse",
"os.remove"
] | [((553, 580), 'os.path.exists', 'os.path.exists', (['TUNING_FILE'], {}), '(TUNING_FILE)\n', (567, 580), False, 'import os\n'), ((586, 608), 'os.remove', 'os.remove', (['TUNING_FILE'], {}), '(TUNING_FILE)\n', (595, 608), False, 'import os\n'), ((490, 503), 'json.dumps', 'json.dumps', (['x'], {}), '(x)\n', (500, 503), Fa... |
from __future__ import unicode_literals
from datetime import datetime, date
from django.db import models
from django.contrib.auth.models import User
from django.db.models.aggregates import Sum
AGE_LIMIT = 7 # 7 days age limit
class PriceTemplate(models.Model):
name = models.CharField(max_length=200)
def _... | [
"django.db.models.aggregates.Sum",
"django.db.models.OneToOneField",
"django.db.models.EmailField",
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.ManyToManyField",
"django.db.models.PositiveIntegerField",... | [((277, 309), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (293, 309), False, 'from django.db import models\n'), ((405, 437), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (421, 437), False, 'from django.d... |
import logging
import os
from datetime import datetime
class Logger :
logger = None
def myLogger(self):
if None == self.logger:
self.logger=logging.getLogger('nrdf')
self.logger.setLevel(logging.DEBUG)
log_folder = r"logs/"
os.makedirs(os.path.dirname(lo... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.Formatter",
"os.path.dirname",
"datetime.datetime.now",
"logging.FileHandler"
] | [((170, 195), 'logging.getLogger', 'logging.getLogger', (['"""nrdf"""'], {}), "('nrdf')\n", (187, 195), False, 'import logging\n'), ((468, 547), 'logging.FileHandler', 'logging.FileHandler', (["(output_file + '.log')"], {'mode': '"""w"""', 'encoding': 'None', 'delay': '(False)'}), "(output_file + '.log', mode='w', enco... |
import os
import argparse
import cv2
import torch
import pandas as pd
from tqdm import tqdm
from pathlib import Path
import segmentation_models_pytorch as smp
from tools.datasets import InferenceDataset
from tools.models import CovidScoringNet, SegmentationModel
from tools.utils import extract_model_opts, get_list_of... | [
"tools.datasets.InferenceDataset",
"os.path.exists",
"tools.utils.get_list_of_files",
"argparse.ArgumentParser",
"os.makedirs",
"pathlib.Path",
"torch.load",
"tqdm.tqdm",
"os.path.join",
"tools.models.CovidScoringNet",
"os.path.split",
"os.path.normpath",
"torch.cuda.is_available",
"tools.... | [((494, 527), 'os.path.join', 'os.path.join', (['output_dir', '"""lungs"""'], {}), "(output_dir, 'lungs')\n", (506, 527), False, 'import os\n'), ((551, 584), 'os.path.join', 'os.path.join', (['output_dir', '"""covid"""'], {}), "(output_dir, 'covid')\n", (563, 584), False, 'import os\n'), ((1083, 1131), 'tqdm.tqdm', 'tq... |
#!/usr/bin/env python
# Copyright (c) 2017, DIANA-HEP
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list ... | [
"numpy.int64",
"numpy.uint32"
] | [((1673, 1696), 'numpy.int64', 'numpy.int64', (['(1073741824)'], {}), '(1073741824)\n', (1684, 1696), False, 'import numpy\n'), ((1721, 1739), 'numpy.int64', 'numpy.int64', (['(16384)'], {}), '(16384)\n', (1732, 1739), False, 'import numpy\n'), ((1765, 1788), 'numpy.int64', 'numpy.int64', (['(2147483648)'], {}), '(2147... |
from django.contrib import admin
from .models import Comment
# Register your models here.
class CommentsAdmin(admin.ModelAdmin):
list_display = ['id', "user", "content", "timestamp"]
class Meta:
model = Comment
admin.site.register(Comment, CommentsAdmin)
| [
"django.contrib.admin.site.register"
] | [((233, 276), 'django.contrib.admin.site.register', 'admin.site.register', (['Comment', 'CommentsAdmin'], {}), '(Comment, CommentsAdmin)\n', (252, 276), False, 'from django.contrib import admin\n')] |
import itertools
import os
import random
import numpy as np
import pandas as pd
from tqdm import tqdm
def _get_steps():
hdf_subdir = "augmentation/"
steps = {"step_name": ["prototypical", "single_sources", "mixtures"]}
steps_df = pd.DataFrame(steps)
steps_df["hdf_path"] = hdf_subdir + steps_df["step_... | [
"numpy.average",
"tqdm.tqdm",
"os.path.join",
"pandas.Categorical",
"numpy.append",
"numpy.array",
"numpy.linspace",
"numpy.geomspace",
"pandas.DataFrame",
"pandas.concat",
"numpy.poly1d",
"pandas.read_hdf"
] | [((245, 264), 'pandas.DataFrame', 'pd.DataFrame', (['steps'], {}), '(steps)\n', (257, 264), True, 'import pandas as pd\n'), ((401, 490), 'pandas.Categorical', 'pd.Categorical', (["steps_df['step_name']", "['prototypical', 'single_sources', 'mixtures']"], {}), "(steps_df['step_name'], ['prototypical', 'single_sources',\... |
import numpy as np
import pandas as pd
from pandas.testing import assert_series_equal
from analysis.comparisons import gt, gte, lt, lte
def test_comparisons():
# a | b | gt | gte | lt | lte
# ---+---+----+-----+----+-----
# 1 | 1 | F | T | F | T
# 1 | 2 | F | F | T | T
# 2 | 1 | T ... | [
"pandas.DataFrame.from_records",
"analysis.comparisons.lt",
"analysis.comparisons.gt",
"analysis.comparisons.lte",
"analysis.comparisons.gte"
] | [((859, 879), 'analysis.comparisons.gt', 'gt', (["df['a']", "df['b']"], {}), "(df['a'], df['b'])\n", (861, 879), False, 'from analysis.comparisons import gt, gte, lt, lte\n'), ((934, 955), 'analysis.comparisons.gte', 'gte', (["df['a']", "df['b']"], {}), "(df['a'], df['b'])\n", (937, 955), False, 'from analysis.comparis... |
import pytest
import numpy as np
import os
import pyarrow as pa
import pyarrow.feather as feather
import pandas as pd
from app.services.preprocessor import PreProcessor
from typing import List
@pytest.fixture
def preprocessor() -> PreProcessor:
return PreProcessor("datasets/csvs/train.csv", "datasets/csvs/build... | [
"numpy.random.rand",
"app.services.preprocessor.PreProcessor",
"numpy.savetxt",
"pandas.DataFrame",
"pyarrow.feather.write_feather",
"os.remove"
] | [((260, 330), 'app.services.preprocessor.PreProcessor', 'PreProcessor', (['"""datasets/csvs/train.csv"""', '"""datasets/csvs/building1.csv"""'], {}), "('datasets/csvs/train.csv', 'datasets/csvs/building1.csv')\n", (272, 330), False, 'from app.services.preprocessor import PreProcessor\n'), ((384, 406), 'numpy.random.ran... |
import itertools
import unittest
from usfm_utils.elements.document import Document
from usfm_utils.elements.element_impls import FormattedText, Text, Paragraph, Footnote
from usfm_utils.elements.footnote_utils import AutomaticFootnoteLabel, CustomFootnoteLabel
from usfm_utils.html.html_visitor import HtmlVisitor, non_... | [
"tests.test_utils.word",
"usfm_utils.elements.footnote_utils.AutomaticFootnoteLabel",
"itertools.product",
"usfm_utils.elements.document.Document",
"usfm_utils.elements.footnote_utils.CustomFootnoteLabel",
"usfm_utils.elements.element_impls.Text",
"unittest.main",
"usfm_utils.elements.element_impls.Pa... | [((4142, 4157), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4155, 4157), False, 'import unittest\n'), ((639, 661), 'usfm_utils.html.html_visitor.HtmlVisitor', 'HtmlVisitor', (['test_file'], {}), '(test_file)\n', (650, 661), False, 'from usfm_utils.html.html_visitor import HtmlVisitor, non_span_formatting\n'), ... |
#!/usr/bin/env python
#
# // SPDX-License-Identifier: BSD-3-CLAUSE
#
# (C) Copyright 2018, Xilinx, Inc.
#
import tensorflow as tf
import numpy as np
from xfdnn_compiler_tensorflow import TFFrontend
#from xfdnn.tools.compile.frontends.frontend_caffe import CaffeFrontend
from tensorflow.python.platform import gfile
impo... | [
"tensorflow.image.decode_png",
"xfdnn_compiler_tensorflow.TFFrontend",
"tensorflow.image.decode_bmp",
"tensorflow.Session",
"tensorflow.image.resize_bilinear",
"xdnn_opt.CPUTransform",
"xdnn_opt.FPGATransform",
"tensorflow.GraphDef",
"tensorflow.python.platform.gfile.FastGFile",
"tensorflow.image.... | [((1993, 2013), 'numpy.concatenate', 'np.concatenate', (['pred'], {}), '(pred)\n', (2007, 2013), True, 'import numpy as np\n'), ((2743, 2756), 'tensorflow.GraphDef', 'tf.GraphDef', ([], {}), '()\n', (2754, 2756), True, 'import tensorflow as tf\n'), ((2889, 2906), 'xfdnn_compiler_tensorflow.TFFrontend', 'TFFrontend', ([... |
import unittest
from red_and_blue import red_and_blue
class Test(unittest.TestCase):
def test_1(self):
self.assertEqual(red_and_blue([6, -5, 7, -3], [2, 3, -4]), 13)
def test_2(self):
self.assertEqual(red_and_blue([1, 1], [10, -3, 2, 2]), 13)
def test_3(self):
self.assertEqual(re... | [
"unittest.main",
"red_and_blue.red_and_blue"
] | [((487, 502), 'unittest.main', 'unittest.main', ([], {}), '()\n', (500, 502), False, 'import unittest\n'), ((134, 174), 'red_and_blue.red_and_blue', 'red_and_blue', (['[6, -5, 7, -3]', '[2, 3, -4]'], {}), '([6, -5, 7, -3], [2, 3, -4])\n', (146, 174), False, 'from red_and_blue import red_and_blue\n'), ((228, 264), 'red_... |
import random
from string import ascii_letters, digits
from urllib.parse import urlparse
def list_to_string(list_items, separator='\n'):
"""
Converts list items to string with separator
"""
return separator.join(list_items)
def string_to_list(string, separator='\n'):
"""
Converts string wit... | [
"random.choice",
"urllib.parse.urlparse"
] | [((799, 820), 'urllib.parse.urlparse', 'urlparse', (['url', 'scheme'], {}), '(url, scheme)\n', (807, 820), False, 'from urllib.parse import urlparse\n'), ((592, 614), 'random.choice', 'random.choice', (['symbols'], {}), '(symbols)\n', (605, 614), False, 'import random\n')] |
#!/usr/bin/env python
# Lint as: python3
"""E2E tests for the timeline flow."""
import csv
import io
from typing import Sequence
from typing import Text
from absl.testing import absltest
from grr_response_core.lib import rdfvalue
from grr_response_core.lib.util import temp
from grr_response_proto.api import timeline_... | [
"csv.reader",
"grr_response_core.lib.util.temp.AutoTempFilePath",
"io.open",
"grr_response_core.lib.rdfvalue.RDFDatetime.Now"
] | [((3856, 3882), 'grr_response_core.lib.rdfvalue.RDFDatetime.Now', 'rdfvalue.RDFDatetime.Now', ([], {}), '()\n', (3880, 3882), False, 'from grr_response_core.lib import rdfvalue\n'), ((734, 771), 'grr_response_core.lib.util.temp.AutoTempFilePath', 'temp.AutoTempFilePath', ([], {'suffix': '""".body"""'}), "(suffix='.body... |
import sys
sys.path.append("flask-comics-api")
from app import app
def test_all_comics():
print(app)
assert False | [
"sys.path.append"
] | [((11, 46), 'sys.path.append', 'sys.path.append', (['"""flask-comics-api"""'], {}), "('flask-comics-api')\n", (26, 46), False, 'import sys\n')] |
from copy import deepcopy
import numpy as np
def complete_mol(self, labels):
"""
Take a cell and complete certain molecules
The objective is to end up with a unit cell where the molecules of interest
are complete. The rest of the atoms of the cell must remain intact. Note that
the input atoms are... | [
"copy.deepcopy",
"numpy.cross",
"numpy.linalg.norm",
"numpy.array",
"numpy.dot",
"fromage.utils.mol.Mol"
] | [((769, 828), 'copy.deepcopy', 'deepcopy', (['[a for a in self.atoms if a not in scattered_mol]'], {}), '([a for a in self.atoms if a not in scattered_mol])\n', (777, 828), False, 'from copy import deepcopy\n'), ((2143, 2158), 'numpy.array', 'np.array', (['trans'], {}), '(trans)\n', (2151, 2158), True, 'import numpy as... |
"""Tests for aiopvpc."""
import logging
from asyncio import TimeoutError
from datetime import datetime, timedelta
from unittest.mock import patch
import pytest
from aiohttp import ClientError
from aiopvpc import ESIOS_TARIFFS, PVPCData, REFERENCE_TZ
from .conftest import MockAsyncSession, TZ_TEST
@pytest.mark.param... | [
"datetime.datetime",
"pytest.mark.parametrize",
"datetime.datetime.fromisoformat",
"unittest.mock.patch",
"datetime.timedelta",
"aiopvpc.PVPCData"
] | [((303, 1184), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""day_str, timezone, num_prices, num_calls, num_prices_8h, available_8h, last_hour"""', "(('2019-10-26 00:00:00+08:00', TZ_TEST, 0, 1, 0, False, None), (\n '2019-10-26 00:00:00', TZ_TEST, 24, 1, 24, True, 23), (\n '2019-10-27 00:00:00', TZ_T... |
from sklearn import metrics
import torch
from models import *
import torch.backends.cudnn as cudnn
import seaborn as sns
import matplotlib.pyplot as plt
from dataset import load
#define the net
device = 'cuda' if torch.cuda.is_available() else 'cpu'
net = LSTM(3, 10, 2, 3)
net = net.to(device)
if device == 'cuda':
... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylabel",
"torch.load",
"matplotlib.pyplot.xlabel",
"torch.nn.DataParallel",
"seaborn.heatmap",
"matplotlib.pyplot.figure",
"torch.cuda.is_available",
"dataset.load",
"matplotlib.pyplot.ylim",
"sklearn.metrics.confusion_matrix"
] | [((500, 506), 'dataset.load', 'load', ([], {}), '()\n', (504, 506), False, 'from dataset import load\n'), ((214, 239), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (237, 239), False, 'import torch\n'), ((329, 355), 'torch.nn.DataParallel', 'torch.nn.DataParallel', (['net'], {}), '(net)\n', (3... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-LOG 蓝鲸日志平台 is licensed under the MIT License.
License for BK-LOG 蓝鲸日志平台:
------------------------------------------------... | [
"apps.log_search.models.ProjectInfo.objects.bulk_create",
"apps.log_search.models.ProjectInfo.objects.filter",
"apps.utils.log.logger.error",
"apps.log_search.handlers.biz.BizHandler.list",
"apps.utils.db.array_chunk",
"apps.log_search.models.ProjectInfo.get_cmdb_projects",
"celery.schedules.crontab",
... | [((1867, 1879), 'apps.utils.lock.share_lock', 'share_lock', ([], {}), '()\n', (1877, 1879), False, 'from apps.utils.lock import share_lock\n'), ((2082, 2099), 'apps.log_search.handlers.biz.BizHandler.list', 'BizHandler.list', ([], {}), '()\n', (2097, 2099), False, 'from apps.log_search.handlers.biz import BizHandler\n'... |
import unittest
import logging
import asyncio
import datetime
from pytz import timezone
import dscraper
from dscraper.utils import FrequencyController
logger = logging.getLogger(__name__)
from .utils import Test
EPS = 1e-6
class TestController(Test):
INVERTAL = 0.2
CONFIG_NONE = (0, 0, 0, EPS, None)
CO... | [
"logging.getLogger",
"datetime.datetime.now",
"dscraper.utils.FrequencyController"
] | [((161, 188), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (178, 188), False, 'import logging\n'), ((507, 558), 'dscraper.utils.FrequencyController', 'FrequencyController', (['(0, self.INVERTAL, 0, 0, None)'], {}), '((0, self.INVERTAL, 0, 0, None))\n', (526, 558), False, 'from dscraper.... |
# coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | [
"utils.dict_from_yaml",
"core.domain.param_domain.ParamSpec.from_dict",
"core.domain.exp_services.get_exploration_by_id",
"core.domain.exp_domain.SkinInstance",
"os.path.join",
"core.domain.param_domain.ParamSpec",
"core.domain.exp_domain.SkinInstance.from_dict",
"core.domain.exp_domain.GadgetInstance... | [((6011, 6057), 'os.path.join', 'os.path.join', (['feconf.GADGETS_DIR', '"""TestGadget"""'], {}), "(feconf.GADGETS_DIR, 'TestGadget')\n", (6023, 6057), False, 'import os\n'), ((6791, 6847), 'core.domain.exp_domain.Exploration.create_default_exploration', 'exp_domain.Exploration.create_default_exploration', (['"""eid"""... |
# -*- coding: utf-8 -*-
# @Time : 2020/2/15 16:10
# @Author : <NAME>
# @Email : <EMAIL>
# @File : utils.py
# @Software: PyCharm
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.core.framework import summary_pb2
class AverageMeter(object):
def __init__(self):
self.re... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"tensorflow.core.framework.summary_pb2.Summary.Value",
"matplotlib.pyplot.close",
"numpy.exp",
"numpy.min",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",... | [((1003, 1036), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'train_accuracy', '"""r-"""'], {}), "(x, train_accuracy, 'r-')\n", (1011, 1036), True, 'import matplotlib.pyplot as plt\n'), ((1042, 1074), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'val_accuracy', '"""b--"""'], {}), "(x, val_accuracy, 'b--')\n", (1050, 10... |
import discord
import asyncio
import aiofiles
from discord.ext import commands
intents = discord.Intents.all()
client = commands.Bot(command_prefix=commands.when_mentioned_or('!'),intents=intents)
client.ticket_configs = {}
@client.command()
async def ping(ctx):
embed=discord.Embed(title="Bot Ping",description=... | [
"discord.ext.commands.has_permissions",
"discord.ext.commands.when_mentioned_or",
"aiofiles.open",
"discord.Colour.gold",
"discord.Intents.all",
"discord.Colour.red",
"discord.Colour.blurple",
"discord.File"
] | [((92, 113), 'discord.Intents.all', 'discord.Intents.all', ([], {}), '()\n', (111, 113), False, 'import discord\n'), ((3497, 3541), 'discord.ext.commands.has_permissions', 'commands.has_permissions', ([], {'administrator': '(True)'}), '(administrator=True)\n', (3521, 3541), False, 'from discord.ext import commands\n'),... |
"""
Calm Runbook Sample for set variable task
"""
from calm.dsl.runbooks import read_local_file
from calm.dsl.runbooks import runbook, runbook_json
from calm.dsl.runbooks import RunbookTask as Task
from calm.dsl.runbooks import CalmEndpoint as Endpoint, basic_cred
CRED_USERNAME = read_local_file(".tests/runbook_tests... | [
"calm.dsl.runbooks.basic_cred",
"calm.dsl.runbooks.RunbookTask.SetVariable.ssh",
"calm.dsl.runbooks.CalmEndpoint.Linux.ip",
"calm.dsl.runbooks.runbook_json",
"calm.dsl.runbooks.RunbookTask.Exec.escript",
"calm.dsl.runbooks.RunbookTask.SetVariable.escript",
"calm.dsl.runbooks.read_local_file"
] | [((283, 331), 'calm.dsl.runbooks.read_local_file', 'read_local_file', (['""".tests/runbook_tests/username"""'], {}), "('.tests/runbook_tests/username')\n", (298, 331), False, 'from calm.dsl.runbooks import read_local_file\n'), ((348, 396), 'calm.dsl.runbooks.read_local_file', 'read_local_file', (['""".tests/runbook_tes... |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2018 The THUMT Authors
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import collections
import math
import numpy as np
def count_words(filename):
counter = collections.Counter()
wi... | [
"numpy.savez",
"argparse.ArgumentParser",
"math.log",
"collections.Counter",
"numpy.cumsum",
"numpy.arange"
] | [((291, 312), 'collections.Counter', 'collections.Counter', ([], {}), '()\n', (310, 312), False, 'import collections\n'), ((2254, 2266), 'numpy.cumsum', 'np.cumsum', (['v'], {}), '(v)\n', (2263, 2266), True, 'import numpy as np\n'), ((2443, 2502), 'numpy.savez', 'np.savez', (["(args.output + '-cdf_base.npz')"], {'cdf':... |
# ---
# jupyter:
# jupytext:
# formats: jupyter_scripts//ipynb,scripts//py
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.3'
# jupytext_version: 1.0.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s... | [
"pandas.Series",
"numpy.abs",
"numpy.where",
"numpy.delete",
"pandas.Timedelta",
"numpy.log",
"numpy.floor",
"numpy.array",
"numpy.zeros",
"numpy.linspace",
"numpy.isnan",
"numpy.vstack",
"numpy.isfinite",
"numpy.nanmax",
"numpy.argmin",
"numpy.percentile",
"numpy.nansum",
"numpy.a... | [((3125, 3144), 'pandas.Timedelta', 'pd.Timedelta', (['"""12h"""'], {}), "('12h')\n", (3137, 3144), True, 'import pandas as pd\n'), ((4823, 4856), 'pandas.Series', 'pd.Series', (['dX'], {'index': 'X.index[:-1]'}), '(dX, index=X.index[:-1])\n', (4832, 4856), True, 'import pandas as pd\n'), ((5690, 5707), 'numpy.array', ... |
# +
import argparse
import os
import pickle
import sys
sys.path.append("..")
import numpy as np
import torchvision
import torchvision.transforms as T
import torch.utils.data as torch_data
from tqdm import tqdm
from models.classifiers import EvalCompoundResNet
# -
def parse_args():
parser = argparse.ArgumentPar... | [
"os.path.exists",
"pickle.dump",
"argparse.ArgumentParser",
"pickle.load",
"numpy.max",
"torchvision.datasets.ImageFolder",
"models.classifiers.EvalCompoundResNet",
"os.path.basename",
"torch.utils.data.DataLoader",
"torchvision.transforms.Resize",
"torchvision.transforms.ToTensor",
"sys.path.... | [((55, 76), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (70, 76), False, 'import sys\n'), ((300, 325), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (323, 325), False, 'import argparse\n'), ((1629, 1690), 'torchvision.datasets.ImageFolder', 'torchvision.datasets.Image... |
from bitcom.client.system_client import SystemClient
from bitcom.utils import *
from bitcom.constant import *
system_client = SystemClient(url=USER1_HOST, access_key=USER1_ACCESS_KEY, secret_key=USER1_SECRET_KEY)
timestamp_response = system_client.get_system_timestamp()
LogInfo.output("Get server timestamp: ", timesta... | [
"bitcom.client.system_client.SystemClient"
] | [((127, 218), 'bitcom.client.system_client.SystemClient', 'SystemClient', ([], {'url': 'USER1_HOST', 'access_key': 'USER1_ACCESS_KEY', 'secret_key': 'USER1_SECRET_KEY'}), '(url=USER1_HOST, access_key=USER1_ACCESS_KEY, secret_key=\n USER1_SECRET_KEY)\n', (139, 218), False, 'from bitcom.client.system_client import Sys... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/GG_start.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
from utilGui import Names
class Ui_main_window(object):
def setupUi(self... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QTableWidget",
"PyQt5.QtWidgets.QSpinBox",
"PyQt5.QtGui.QFont",
"PyQt5.QtWidgets.QDoubleSpinBox",
"PyQt5.QtWidgets.QComboBox",
"PyQt5.QtGui.QColor",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QStatusBar",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QTableWi... | [((500, 530), 'PyQt5.QtWidgets.QWidget', 'QtWidgets.QWidget', (['main_window'], {}), '(main_window)\n', (517, 530), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((631, 672), 'PyQt5.QtWidgets.QPushButton', 'QtWidgets.QPushButton', (['self.centralwidget'], {}), '(self.centralwidget)\n', (652, 672), False, 'fro... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | [
"mock.patch",
"gbpservice.contrib.nfp.configurator.agents.firewall.FWaasEventHandler",
"mock.Mock",
"gbpservice.contrib.tests.unit.nfp.configurator.test_data.fw_test_data.FakeEventFirewall",
"gbpservice.contrib.nfp.configurator.lib.fw_constants.FIREWALL_CREATE_EVENT.lower",
"gbpservice.contrib.nfp.configu... | [((1247, 1290), 'mock.patch', 'mock.patch', (["(__name__ + '.fo.FakeObjects.sc')"], {}), "(__name__ + '.fo.FakeObjects.sc')\n", (1257, 1290), False, 'import mock\n'), ((1296, 1341), 'mock.patch', 'mock.patch', (["(__name__ + '.fo.FakeObjects.conf')"], {}), "(__name__ + '.fo.FakeObjects.conf')\n", (1306, 1341), False, '... |
#!/usr/bin/env python
# -- encoding: utf-8 --
#
# Copyright 2015-2016 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FI-WARE project.
#
# 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... | [
"os.path.exists",
"copy.deepcopy",
"argparse.ArgumentParser",
"glancesync_image.GlanceSyncImage.from_field_list",
"glob.glob",
"tempfile.mkdtemp",
"os.mkdir",
"sys.exit",
"shelve.open",
"os.path.basename",
"csv.reader",
"os.unlink",
"logging.error",
"os.path.expanduser"
] | [((9754, 9825), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Start a clean persistent session"""'}), "(description='Start a clean persistent session')\n", (9777, 9825), False, 'import argparse\n'), ((6528, 6547), 'os.path.exists', 'os.path.exists', (['dir'], {}), '(dir)\n', (6542, 6547... |
# -*- coding: utf-8 -*-
import json
import os
import time
import psutil
import pyautogui
pubg_url = 'steam://rungameid/578080'
PROCNAME = "TslGame.exe"
CRASH_PROCNAME = "BroCrashReporter.exe"
debug_directory = "debug_screenshots"
start_state = "HELLO"
play_state = "PLAYING"
play_timer_max = 60 * 3
matching_state = ... | [
"os.path.exists",
"pyautogui.press",
"os.startfile",
"os.makedirs",
"pyautogui.moveTo",
"pyautogui.screenshot",
"psutil.process_iter",
"time.sleep",
"pyautogui.click",
"json.load",
"time.gmtime"
] | [((1935, 1956), 'psutil.process_iter', 'psutil.process_iter', ([], {}), '()\n', (1954, 1956), False, 'import psutil\n'), ((2857, 2878), 'psutil.process_iter', 'psutil.process_iter', ([], {}), '()\n', (2876, 2878), False, 'import psutil\n'), ((12583, 12607), 'time.sleep', 'time.sleep', (['refresh_rate'], {}), '(refresh_... |
#! C:\bin\Python35\python.exe
# -*- coding: utf-8 -*-
'''
Modified for python3 on 2012/04/29
original python2 version is Created on 2011/10/30
@author: tyama
'''
import poplib
import email.header
import string
import re
import urllib.request
import urllib.error
import urllib.parse
import http.cookiejar
import socket
... | [
"threading.Thread.__init__",
"json.loads",
"poplib.POP3_SSL",
"re.compile",
"subprocess.check_call",
"json.dumps",
"time.sleep",
"socket.setdefaulttimeout"
] | [((4499, 4524), 'json.dumps', 'json.dumps', (['original_data'], {}), '(original_data)\n', (4509, 4524), False, 'import json\n'), ((4561, 4581), 'json.loads', 'json.loads', (['json_str'], {}), '(json_str)\n', (4571, 4581), False, 'import json\n'), ((5194, 5224), 'socket.setdefaulttimeout', 'socket.setdefaulttimeout', ([... |
import math
from math import pi
import numpy as np
import open3d as o3d
import matplotlib.pyplot as plt
import cv2
import toml
from .cameraparam import CameraParam
from .fitted_line import FittedLine
from .ransac_fit import ransac_line_fit, ransac_ground_fit
from .util import check_all_false
# TODO: output random s... | [
"numpy.clip",
"math.acos",
"math.cos",
"numpy.array",
"numpy.argsort",
"cv2.ellipse",
"numpy.linalg.norm",
"numpy.arange",
"open3d.geometry.TriangleMesh.create_cylinder",
"numpy.asarray",
"numpy.max",
"numpy.exp",
"numpy.stack",
"numpy.linspace",
"numpy.dot",
"open3d.geometry.TriangleM... | [((897, 918), 'matplotlib.pyplot.get_cmap', 'plt.get_cmap', (['"""tab20"""'], {}), "('tab20')\n", (909, 918), True, 'import matplotlib.pyplot as plt\n'), ((3106, 3144), 'numpy.array', 'np.array', (['pcd.points'], {'dtype': 'np.float32'}), '(pcd.points, dtype=np.float32)\n', (3114, 3144), True, 'import numpy as np\n'), ... |
import turtle as t
import time
import os #connected with practice10.py
path = 'F:\\Github\\Python_season2'
os.chdir(path)
from practice10 import Snake
from practice13 import Food
from practice14 import Score
screen = t.Screen()
screen.setup(width=600,height=600)
screen.bgcolor("black")
screen.title("My snake"... | [
"practice14.Score",
"practice10.Snake",
"time.sleep",
"os.chdir",
"practice13.Food",
"turtle.Screen"
] | [((117, 131), 'os.chdir', 'os.chdir', (['path'], {}), '(path)\n', (125, 131), False, 'import os\n'), ((227, 237), 'turtle.Screen', 't.Screen', ([], {}), '()\n', (235, 237), True, 'import turtle as t\n'), ((348, 355), 'practice10.Snake', 'Snake', ([], {}), '()\n', (353, 355), False, 'from practice10 import Snake\n'), ((... |
from py2neo import Graph
grapher = Graph("bolt://localhost:7687", auth=("neo4j", "changeme"))
x = grapher.run("MATCH (a :Person) RETURN a.name, a.city, a.age").to_data_frame()
print(f"To_data_frame() :\n{x}")
| [
"py2neo.Graph"
] | [((36, 94), 'py2neo.Graph', 'Graph', (['"""bolt://localhost:7687"""'], {'auth': "('neo4j', 'changeme')"}), "('bolt://localhost:7687', auth=('neo4j', 'changeme'))\n", (41, 94), False, 'from py2neo import Graph\n')] |
import random
import os
import subprocess
import shutil
from google.cloud import storage, logging as glogging
from core.framework import levels
from core.framework.cloudhelpers import deployments, iam, gcstorage, ssh_keys
LEVEL_PATH = 'thunder/a2finance'
RESOURCE_PREFIX = 'a2'
LOG_NAME = 'transactions'
def create(... | [
"core.framework.cloudhelpers.ssh_keys.generate_ssh_keypair",
"core.framework.cloudhelpers.iam.generate_service_account_key",
"google.cloud.logging.Client",
"core.framework.levels.write_start_info",
"core.framework.levels.make_secret",
"core.framework.cloudhelpers.deployments.insert",
"os.remove",
"os.... | [((622, 653), 'core.framework.cloudhelpers.ssh_keys.generate_ssh_keypair', 'ssh_keys.generate_ssh_keypair', ([], {}), '()\n', (651, 653), False, 'from core.framework.cloudhelpers import deployments, iam, gcstorage, ssh_keys\n'), ((2664, 2675), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2673, 2675), False, 'import os\... |
import cv2
import os
from os import listdir, makedirs
from os.path import isfile, join, exists
import numpy as np
import time
import math
DEBUG = True
FACTOR = 2
RESO_X = int(576 / FACTOR)
RESO_Y = int(640 / FACTOR)
CONF_VAL = 0
THRESHOLD = 0
UPPER_BOUND = 230
LOWER_BOUND = 150
def get_file_index(filename):
i... | [
"cv2.rectangle",
"cv2.imshow",
"numpy.array",
"cv2.destroyAllWindows",
"cv2.dnn.NMSBoxes",
"os.path.exists",
"numpy.mean",
"cv2.resizeWindow",
"os.listdir",
"cv2.waitKey",
"cv2.dnn.blobFromImage",
"numpy.argmax",
"time.time",
"cv2.namedWindow",
"cv2.imread",
"cv2.imwrite",
"os.makedi... | [((400, 441), 'cv2.namedWindow', 'cv2.namedWindow', (['"""RGB"""', 'cv2.WINDOW_NORMAL'], {}), "('RGB', cv2.WINDOW_NORMAL)\n", (415, 441), False, 'import cv2\n'), ((446, 489), 'cv2.namedWindow', 'cv2.namedWindow', (['"""Depth"""', 'cv2.WINDOW_NORMAL'], {}), "('Depth', cv2.WINDOW_NORMAL)\n", (461, 489), False, 'import cv... |
import configparser
import unittest
from pathlib import Path
from TM1py.Objects import Dimension, Hierarchy, Element
from TM1py.Objects import ElementAttribute
from TM1py.Services import TM1Service
class TestDimensionService(unittest.TestCase):
@classmethod
def setUpClass(cls):
"""
Establish... | [
"configparser.ConfigParser",
"pathlib.Path",
"TM1py.Objects.Dimension",
"TM1py.Services.TM1Service",
"TM1py.Objects.ElementAttribute",
"unittest.main",
"TM1py.Objects.Hierarchy",
"TM1py.Objects.Element"
] | [((11996, 12011), 'unittest.main', 'unittest.main', ([], {}), '()\n', (12009, 12011), False, 'import unittest\n'), ((449, 476), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (474, 476), False, 'import configparser\n'), ((565, 601), 'TM1py.Services.TM1Service', 'TM1Service', ([], {}), "(**c... |
from distutils.version import StrictVersion as SV
import unittest
import minecraft
class VersionTest(unittest.TestCase):
def test_module_version_is_a_valid_pep_386_strict_version(self):
SV(minecraft.__version__)
def test_protocol_version_is_an_int(self):
for version in minecraft.SUPPORTED_PR... | [
"distutils.version.StrictVersion"
] | [((201, 226), 'distutils.version.StrictVersion', 'SV', (['minecraft.__version__'], {}), '(minecraft.__version__)\n', (203, 226), True, 'from distutils.version import StrictVersion as SV\n')] |
import torch
from torch.nn import functional as F
from torch import optim
from torch import nn
class PolicyNetwork(torch.nn.Module):
def __init__(self, in_dim, out_dim, alpha=0.01):
super(PolicyNetwork, self).__init__()
self.in_dim = in_dim
self.out_dim = out_dim
self.l1 = nn.Linear(in_dim, 128)
self.l2... | [
"torch.tanh",
"torch.nn.LeakyReLU",
"torch.Tensor",
"torch.cuda.is_available",
"torch.sum",
"torch.nn.Linear",
"torch.cuda.empty_cache",
"torch.ones"
] | [((1200, 1217), 'torch.ones', 'torch.ones', (['(10)', '(3)'], {}), '(10, 3)\n', (1210, 1217), False, 'import torch\n'), ((288, 310), 'torch.nn.Linear', 'nn.Linear', (['in_dim', '(128)'], {}), '(in_dim, 128)\n', (297, 310), False, 'from torch import nn\n'), ((323, 342), 'torch.nn.Linear', 'nn.Linear', (['(128)', '(128)'... |
# coding: utf-8
# # Using Dropout
# Let's see how we can use dropout for early stopping
from concept_dependency_graph import ConceptDependencyGraph
import data_generator as dg
from student import *
import simple_mdp as sm
import dynamics_model_class as dmc
import numpy as np
import dataset_utils
import tensorflow a... | [
"numpy.savez",
"dynamics_model_class.DynamicsModel",
"dataset_utils.preprocess_data_for_rnn",
"concept_dependency_graph.ConceptDependencyGraph",
"numpy.array",
"numpy.zeros",
"simple_mdp.percent_all_seen",
"numpy.random.seed",
"simple_mdp.percent_complete",
"copy.copy",
"time.time",
"simple_md... | [((951, 975), 'concept_dependency_graph.ConceptDependencyGraph', 'ConceptDependencyGraph', ([], {}), '()\n', (973, 975), False, 'from concept_dependency_graph import ConceptDependencyGraph\n'), ((1640, 1683), 'dataset_utils.preprocess_data_for_rnn', 'dataset_utils.preprocess_data_for_rnn', (['data'], {}), '(data)\n', (... |
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, fields, api
class AccountInvoiceTaxWizard(mode... | [
"odoo.fields.Float",
"odoo.fields.Many2one",
"odoo.api.onchange",
"odoo.fields.Selection",
"odoo.fields.Char"
] | [((540, 592), 'odoo.fields.Many2one', 'fields.Many2one', (['"""account.tax"""', '"""Tax"""'], {'required': '(True)'}), "('account.tax', 'Tax', required=True)\n", (555, 592), False, 'from odoo import models, fields, api\n'), ((635, 680), 'odoo.fields.Char', 'fields.Char', (['"""Tax Description"""'], {'required': '(True)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Parse the FRC drive station logs which are packed binary data
# Notes on comparison to DSLog-Parse:
# D-P has packet_loss as a *signed* integer, which makes no sense. Unsigned looks sensible.
import datetime
import math
import re
import struct
import bitstring
MAX_... | [
"datetime.datetime",
"math.ceil",
"math.floor",
"re.match",
"struct.unpack",
"datetime.timedelta",
"bitstring.Bits",
"struct.unpack_from"
] | [((621, 689), 'datetime.datetime', 'datetime.datetime', (['(1904)', '(1)', '(1)', '(0)', '(0)', '(0)'], {'tzinfo': 'datetime.timezone.utc'}), '(1904, 1, 1, 0, 0, 0, tzinfo=datetime.timezone.utc)\n', (638, 689), False, 'import datetime\n'), ((520, 543), 'struct.unpack', 'struct.unpack', (['""">q"""', 'b1'], {}), "('>q',... |
# -*- coding: UTF-8 -*-
from __future__ import print_function
from behave import given, when, then, step
from behave_manners.pagelems import DOMScope
from behave_manners.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
@when(u'I click to have the dropdown visible')
def click_dropdown1... | [
"behave.when",
"behave.then"
] | [((255, 300), 'behave.when', 'when', (['u"""I click to have the dropdown visible"""'], {}), "(u'I click to have the dropdown visible')\n", (259, 300), False, 'from behave import given, when, then, step\n'), ((623, 666), 'behave.when', 'when', (['u"""I click again to hide the dropdown"""'], {}), "(u'I click again to hid... |
import datetime
import os
import sys
from optparse import make_option
from django.core.management.base import BaseCommand
from django.conf import settings
try:
from django.contrib.gis.utils import LayerMapping
except ImportError:
print("gdal is required")
sys.exit(1)
from tigerline.models import County
... | [
"os.path.join",
"datetime.datetime.now",
"sys.exit",
"django.contrib.gis.utils.LayerMapping"
] | [((1321, 1388), 'django.contrib.gis.utils.LayerMapping', 'LayerMapping', (['County', 'county_shp', 'county_mapping'], {'encoding': '"""LATIN1"""'}), "(County, county_shp, county_mapping, encoding='LATIN1')\n", (1333, 1388), False, 'from django.contrib.gis.utils import LayerMapping\n'), ((270, 281), 'sys.exit', 'sys.exi... |
from __future__ import print_function
import os
import time
import tensorflow as tf
import numpy as np
import sys
from zoneout_wrapper import ZoneoutWrapper
class SequencePredictor():
def add_placeholders(self):
"""Generates placeholder variables to represent the input tensors
"""
self.inp... | [
"tensorflow.shape",
"tensorflow.get_variable",
"numpy.log",
"tensorflow.nn.rnn_cell.DropoutWrapper",
"tensorflow.nn.sparse_softmax_cross_entropy_with_logits",
"tensorflow.placeholder",
"tensorflow.nn.rnn_cell.GRUCell",
"tensorflow.nn.dynamic_rnn",
"tensorflow.matmul",
"tensorflow.train.AdamOptimiz... | [((338, 410), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {'shape': '(None, self.config.max_length)', 'name': '"""x"""'}), "(tf.int32, shape=(None, self.config.max_length), name='x')\n", (352, 410), True, 'import tensorflow as tf\n'), ((445, 517), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32']... |
# Importando as dependencias
from os import system, chdir, mkdir, rmdir
from time import sleep
from socket import gethostname, gethostbyname
# Informações
__version__ = "1.0"
__tag_version__ = "Osys2 Beta"
# Ethernet and Socket informations
hostname = gethostname()
host = gethostbyname(hostname)
# Modulos e funções ... | [
"socket.gethostbyname",
"time.sleep",
"os.mkdir",
"os.system",
"socket.gethostname"
] | [((254, 267), 'socket.gethostname', 'gethostname', ([], {}), '()\n', (265, 267), False, 'from socket import gethostname, gethostbyname\n'), ((275, 298), 'socket.gethostbyname', 'gethostbyname', (['hostname'], {}), '(hostname)\n', (288, 298), False, 'from socket import gethostname, gethostbyname\n'), ((353, 366), 'os.sy... |
import numpy as np
import toyplot as tp
from banditutil import create_running_ema
def selection_emas(simulation_output, alpha=0.99):
k = simulation_output["k"]
rema = create_running_ema(alpha, initial=1/k)
return [rema((a == i for a in simulation_output["selection"]), return_list=True)
for i i... | [
"banditutil.create_running_ema"
] | [((177, 217), 'banditutil.create_running_ema', 'create_running_ema', (['alpha'], {'initial': '(1 / k)'}), '(alpha, initial=1 / k)\n', (195, 217), False, 'from banditutil import create_running_ema\n')] |
from pyg_base import reducer, reducing, dictable
import pytest
from operator import add, mul
from functools import reduce
def test_reducer():
assert reducer(add, [1,2,3,4]) == 10
assert reducer(mul, [1,2,3,4]) == 24
assert reducer(add, [1]) == 1
assert reducer(add, []) is None
with pytest.... | [
"functools.reduce",
"pyg_base.dictable",
"pyg_base.reducer",
"pytest.raises",
"pyg_base.reducing"
] | [((606, 633), 'pyg_base.dictable', 'dictable', ([], {'a': '[1, 2, 3, 5, 4]'}), '(a=[1, 2, 3, 5, 4])\n', (614, 633), False, 'from pyg_base import reducer, reducing, dictable\n'), ((158, 184), 'pyg_base.reducer', 'reducer', (['add', '[1, 2, 3, 4]'], {}), '(add, [1, 2, 3, 4])\n', (165, 184), False, 'from pyg_base import r... |
from datetime import datetime
from typing import Any
from yarl import URL
from newsapp.config import Config
from newsapp.models.article import Article
from newsapp.scraper import NewsItem, ScrapeError, scrape
def get_category_url(category: str) -> URL:
category_path = Config.CATEGORIES[category]["url... | [
"newsapp.scraper.ScrapeError",
"newsapp.scraper.NewsItem",
"datetime.datetime.strptime",
"newsapp.scraper.scrape",
"yarl.URL"
] | [((505, 525), 'newsapp.scraper.scrape', 'scrape', (['category_url'], {}), '(category_url)\n', (511, 525), False, 'from newsapp.scraper import NewsItem, ScrapeError, scrape\n'), ((1228, 1249), 'newsapp.scraper.scrape', 'scrape', (['news_item.url'], {}), '(news_item.url)\n', (1234, 1249), False, 'from newsapp.scraper imp... |
# Copyright (c) 2015 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sub... | [
"StringIO.StringIO",
"os.path.exists",
"re.escape",
"os.rename",
"os.path.isfile",
"os.remove",
"Bio.Phylo.write",
"AnalyseCDR.AnalyseCDR",
"subprocess.call",
"copy.deepcopy",
"os.path.abspath",
"Bio.Phylo.read",
"Alignment.Alignment",
"Bio.AlignIO.write"
] | [((3033, 3053), 'copy.deepcopy', 'copy.deepcopy', (['ptree'], {}), '(ptree)\n', (3046, 3053), False, 'import copy\n'), ((4240, 4291), 'Bio.Phylo.write', 'Phylo.write', (['qtree', "(wdir + '/' + 'intree')", '"""newick"""'], {}), "(qtree, wdir + '/' + 'intree', 'newick')\n", (4251, 4291), False, 'from Bio import Phylo\n'... |
from traits.api import (HasPrivateTraits, Instance, List, Dict)
from .player import Player
from .board import GameBoard
from .tech_board import TechBoard
from gaia_project.faction_board.player_panel import PlayerPanel
from .layout import Layout
from .constants import BASIC_4P_SETUP
import pygame
import sys
class C... | [
"traits.api.Instance",
"pygame.init",
"pygame.event.set_allowed",
"pygame.event.get",
"pygame.quit",
"pygame.event.set_blocked",
"sys.exit",
"gaia_project.faction_board.player_panel.PlayerPanel"
] | [((464, 483), 'traits.api.Instance', 'Instance', (['GameBoard'], {}), '(GameBoard)\n', (472, 483), False, 'from traits.api import HasPrivateTraits, Instance, List, Dict\n'), ((499, 518), 'traits.api.Instance', 'Instance', (['TechBoard'], {}), '(TechBoard)\n', (507, 518), False, 'from traits.api import HasPrivateTraits,... |
import base64
import json
import activity
import os
import requests
import boto.sqs
from boto.sqs.message import Message
from provider import eif
"""
ConvertJATS.py activity
"""
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.sys.path.insert(0, parentdir)
class activity_ApprovePublication(... | [
"json.loads",
"activity.activity.__init__",
"requests.auth.HTTPBasicAuth",
"provider.eif.extract_update_date",
"json.dumps",
"os.sys.path.insert",
"boto.sqs.message.Message",
"requests.put",
"os.path.abspath",
"base64.decodestring"
] | [((251, 283), 'os.sys.path.insert', 'os.sys.path.insert', (['(0)', 'parentdir'], {}), '(0, parentdir)\n', (269, 283), False, 'import os\n'), ((223, 248), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (238, 248), False, 'import os\n'), ((433, 511), 'activity.activity.__init__', 'activity.acti... |
"""
Spam comments to be classified by the relational model.
"""
import os
import numpy as np
class Comments:
def __init__(self, config_obj, util_obj):
self.config_obj = config_obj
self.util_obj = util_obj
# public
def build(self, df, dset, data_f=None, tuffy=False, iden='0'):
"""... | [
"os.path.exists",
"os.makedirs"
] | [((1070, 1092), 'os.path.exists', 'os.path.exists', (['data_f'], {}), '(data_f)\n', (1084, 1092), False, 'import os\n'), ((1106, 1125), 'os.makedirs', 'os.makedirs', (['data_f'], {}), '(data_f)\n', (1117, 1125), False, 'import os\n')] |
import os
import logging
import json
from nnattack.variables import auto_var, get_file_name
from params import (
compare_attacks,
compare_defense,
#compare_nns,
nn_k1_robustness,
nn_k3_robustness,
nn_k1_approx_robustness_figs,
dt_robustness_figs,
rf_robustness_figs,
nn_k1_robustn... | [
"nnattack.variables.auto_var.set_intermidiate_variable",
"nnattack.variables.auto_var.get_var",
"nnattack.variables.auto_var.run_grid_params",
"os.path.exists",
"numpy.where",
"params.dt_robustness",
"sklearn.preprocessing.MinMaxScaler",
"nnattack.variables.get_file_name",
"nnattack.variables.auto_v... | [((595, 635), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (614, 635), False, 'import logging\n'), ((653, 683), 'os.environ.get', 'os.environ.get', (['"""DEBUG"""', '(False)'], {}), "('DEBUG', False)\n", (667, 683), False, 'import os\n'), ((1680, 1738), 'nna... |
import torch
import os
from tqdm import tqdm
import numpy as np
from multiprocessing.pool import Pool
from itertools import islice, cycle
from utils.logging import logger
from utils.misc import ensure_dir
class Vocab(object):
def __init__(self):
self.tok2idx = {}
self.idx2tok = []
self.ad... | [
"os.path.exists",
"itertools.cycle",
"itertools.islice",
"utils.misc.ensure_dir",
"os.path.join",
"numpy.asarray",
"torch.save",
"multiprocessing.pool.Pool",
"utils.logging.logger.info"
] | [((2338, 2358), 'utils.misc.ensure_dir', 'ensure_dir', (['save_dir'], {}), '(save_dir)\n', (2348, 2358), False, 'from utils.misc import ensure_dir\n'), ((2449, 2506), 'utils.logging.logger.info', 'logger.info', (["('Building %s shard %d' % (mode, shard_index))"], {}), "('Building %s shard %d' % (mode, shard_index))\n",... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from functools import reduce
from operator import mul
from compas.geometry import Point
from compas.geometry import Scale
from compas.geometry import Translation
from compas.geometry import Rotation
from compa... | [
"compas.geometry.Point",
"compas.geometry.Translation.from_vector",
"functools.reduce",
"compas.geometry.Rotation.from_euler_angles",
"compas.geometry.Scale.from_factors",
"compas.geometry.transform_points"
] | [((2171, 2187), 'compas.geometry.Point', 'Point', (['*location'], {}), '(*location)\n', (2176, 2187), False, 'from compas.geometry import Point\n'), ((2669, 2683), 'compas.geometry.Point', 'Point', (['(0)', '(0)', '(0)'], {}), '(0, 0, 0)\n', (2674, 2683), False, 'from compas.geometry import Point\n'), ((2045, 2059), 'c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Protocol Data Units
===================
"""
import struct
from bacpypes.debugging import bacpypes_debugging, DebugContents, ModuleLogger
from bacpypes.comm import PDUData, PCI
from bacpypes.errors import DecodingError
# some debugging
_debug = 0
_log = ModuleLogger... | [
"bacpypes.comm.PCI.__init__",
"bacpypes.comm.PDUData.__init__",
"bacpypes.comm.PCI.update",
"struct.pack",
"bacpypes.errors.DecodingError"
] | [((12248, 12283), 'bacpypes.comm.PCI.__init__', 'PCI.__init__', (['self', '*args'], {}), '(self, *args, **kwargs)\n', (12260, 12283), False, 'from bacpypes.comm import PDUData, PCI\n'), ((12535, 12557), 'bacpypes.comm.PCI.update', 'PCI.update', (['self', 'mpci'], {}), '(self, mpci)\n', (12545, 12557), False, 'from bacp... |
import re
import logging
from pydispatch import dispatcher
__author__ = 'edzard'
logger = logging.getLogger(__name__)
_filters = {}
def _handler(sender, **kwargs):
global _filters
for parameter_name in kwargs:
if parameter_name in _filters:
data = kwargs[parameter_name]
if _... | [
"logging.getLogger",
"pydispatch.dispatcher.connect",
"re.compile"
] | [((92, 119), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (109, 119), False, 'import logging\n'), ((474, 548), 'pydispatch.dispatcher.connect', 'dispatcher.connect', (['_handler'], {'signal': 'dispatcher.Any', 'sender': 'dispatcher.Any'}), '(_handler, signal=dispatcher.Any, sender=dispa... |
# pylint: disable=no-self-use
import re
import pytest
from . import AbstractViewsTests, factory_build_layers, get_test_default_layers
@pytest.fixture(scope="function")
@pytest.mark.usefixtures("dbsession", "transact")
def layer_vectortiles_test_data(dbsession, transact):
del transact
from c2cgeoportal_com... | [
"re.match",
"pytest.mark.usefixtures",
"pytest.fixture",
"c2cgeoportal_commons.models.main.LayerVectorTiles",
"c2cgeoportal_commons.models.main.OGCServer"
] | [((140, 172), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (154, 172), False, 'import pytest\n'), ((174, 222), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""dbsession"""', '"""transact"""'], {}), "('dbsession', 'transact')\n", (197, 222), False, 'import py... |
#encoding: utf-8
from __future__ import print_function
from builtins import str
import ipaddress
import datetime
import os
import sys
from twisted.names import client, dns, server, hosts as hosts_module, root, cache, resolve
from twisted.internet import reactor
from twisted.python.runtime import platform
TTL = 0
dict ... | [
"twisted.names.hosts.nativeString",
"twisted.names.cache.CacheResolver",
"twisted.names.dns.Record_A",
"twisted.names.server.DNSServerFactory.buildProtocol",
"twisted.names.client.Resolver",
"twisted.names.root.bootstrap",
"twisted.names.client._ThreadedResolverImpl",
"twisted.internet.reactor.listenU... | [((6386, 6419), 'twisted.internet.reactor.listenUDP', 'reactor.listenUDP', (['PORT', 'protocol'], {}), '(PORT, protocol)\n', (6403, 6419), False, 'from twisted.internet import reactor\n'), ((6424, 6456), 'twisted.internet.reactor.listenTCP', 'reactor.listenTCP', (['PORT', 'factory'], {}), '(PORT, factory)\n', (6441, 64... |
#!/usr/bin/env python
#from difflib import SequenceMatcher
import discord
import numpy as np
from joblib import dump, load
import sys
import os
import math
helpText = "Tell me the sizes of two of your gems and i will calculate the optimal size of the third gem based on the current ritual bonus. If running a ritual wi... | [
"discord.Client",
"math.ceil",
"joblib.dump",
"joblib.load"
] | [((2147, 2163), 'discord.Client', 'discord.Client', ([], {}), '()\n', (2161, 2163), False, 'import discord\n'), ((1004, 1024), 'joblib.load', 'load', (['"""bonus.joblib"""'], {}), "('bonus.joblib')\n", (1008, 1024), False, 'from joblib import dump, load\n'), ((1986, 2011), 'joblib.dump', 'dump', (['val', '"""bonus.jobl... |
from flask import current_app
from flask_script import Manager
from flask_migrate import MigrateCommand
from info import create_app
# 创建应用
app = create_app("dev")
# 创建管理器
mgr = Manager(app)
# 添加迁移命令
mgr.add_command("mc", MigrateCommand)
# 生成超级管理员命令
@mgr.option("-u", dest="username")
@mgr.option("-p", dest="password"... | [
"info.models.User",
"info.db.session.add",
"flask_script.Manager",
"info.create_app",
"info.db.session.rollback",
"info.db.session.commit",
"flask.current_app.logger.error"
] | [((146, 163), 'info.create_app', 'create_app', (['"""dev"""'], {}), "('dev')\n", (156, 163), False, 'from info import create_app\n'), ((178, 190), 'flask_script.Manager', 'Manager', (['app'], {}), '(app)\n', (185, 190), False, 'from flask_script import Manager\n'), ((511, 517), 'info.models.User', 'User', ([], {}), '()... |
from typing import List
from hwtHls.ssa.context import SsaContext
from hwtHls.ssa.instr import SsaInstrBranch, SsaInstr
from hwtHls.ssa.phi import SsaPhi
class SsaBasicBlock():
"""
Basic Block from Static Single Assignment (SSA) normal form of code.
:ivar label: label for debug purposes
:ivar predec... | [
"hwtHls.ssa.instr.SsaInstrBranch"
] | [((956, 976), 'hwtHls.ssa.instr.SsaInstrBranch', 'SsaInstrBranch', (['self'], {}), '(self)\n', (970, 976), False, 'from hwtHls.ssa.instr import SsaInstrBranch, SsaInstr\n')] |
#!/usr/bin/env python
"""cli module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import click
import traceback
import importlib
from . import version
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.command(context_settings=CONTE... | [
"click.argument",
"importlib.import_module",
"click.option",
"click.version_option",
"click.command"
] | [((284, 332), 'click.command', 'click.command', ([], {'context_settings': 'CONTEXT_SETTINGS'}), '(context_settings=CONTEXT_SETTINGS)\n', (297, 332), False, 'import click\n'), ((334, 362), 'click.argument', 'click.argument', (['"""modulename"""'], {}), "('modulename')\n", (348, 362), False, 'import click\n'), ((364, 411... |
import os
import time
import argparse
import numpy as np
import tensorflow as tf
from tqdm import tqdm
from config import get_config, export_config
from model.textcnn import TextCNN
from model.textrnn import TextRNN
from sklearn.model_selection import train_test_split
from dataloader import Word2VecEmbeddings, Doc2Vec... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"model.textcnn.TextCNN",
"numpy.array",
"tensorflow.set_random_seed",
"dataloader.DataLoader",
"model.textrnn.TextRNN",
"matplotlib.pyplot.imshow",
"config.export_config",
"dataloader.Doc2VecEmbeddings",
"argparse.ArgumentParser",
"numpy.de... | [((388, 476), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""train/test movie review classification model"""'}), "(description=\n 'train/test movie review classification model')\n", (411, 476), False, 'import argparse\n'), ((791, 803), 'config.get_config', 'get_config', ([], {}), '()\... |
import pytest
from flake8.exceptions import ExecutionError
from flake8_adjustable_complexity.config import DEFAULT_CONFIG
@pytest.mark.parametrize(
('args', 'max_mccabe_complexity'),
[
(['--max-mccabe-complexity=5'], 5),
(['--max-adjustable-complexity=10'], 10),
([], DEFAULT_CONFIG.ma... | [
"pytest.mark.parametrize",
"pytest.raises"
] | [((126, 318), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('args', 'max_mccabe_complexity')", "[(['--max-mccabe-complexity=5'], 5), (['--max-adjustable-complexity=10'], \n 10), ([], DEFAULT_CONFIG.max_mccabe_complexity)]"], {}), "(('args', 'max_mccabe_complexity'), [([\n '--max-mccabe-complexity=5'],... |
"""
Profile the time needed for retrieval.
We consider retrieval in a corpus of 1M videos, 1K videos are added, 10K queries are retrieved.
Calculate the time needed for adding 1K videos, and performing retrieval for 10K queries.
1, Data Loading time is ignored, consider it is hidden by computation time.
2, Sort time i... | [
"logging.getLogger",
"logging.basicConfig",
"torch.ones",
"argparse.ArgumentParser",
"tqdm.trange",
"baselines.crossmodal_moment_localization.model_xml.XML",
"torch.FloatTensor",
"torch.cuda.synchronize",
"baselines.clip_alignment_with_language.model.CALWithSub",
"baselines.excl.model.EXCL",
"ut... | [((869, 896), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (886, 896), False, 'import logging\n'), ((897, 1046), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s.%(msecs)03d:%(levelname)s:%(name)s - %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""', 'lev... |
"""Project: Eskapade - A python-based package for data analysis.
Macro: esk501_fix_pandas_dataframe
Created: 2017/04/26
Description:
Macro illustrates how to call FixPandasDataFrame link that gives columns
consistent names and datatypes.
Default settings perform the following clean-up steps on an
inp... | [
"eskapade.Chain",
"eskapade.logger.Logger",
"eskapade.process_manager.service",
"eskapade.analysis.ReadToDf",
"tempfile.NamedTemporaryFile",
"eskapade.data_quality.FixPandasDataFrame",
"eskapade.analysis.WriteFromDf",
"eskapade.core_ops.PrintDs"
] | [((1299, 1307), 'eskapade.logger.Logger', 'Logger', ([], {}), '()\n', (1305, 1307), False, 'from eskapade.logger import Logger\n'), ((1522, 1559), 'eskapade.process_manager.service', 'process_manager.service', (['ConfigObject'], {}), '(ConfigObject)\n', (1545, 1559), False, 'from eskapade import process_manager\n'), ((... |
import numpy as np
import microdf as mdf
def gini(df, col, w=None, negatives=None):
"""Calculates Gini index.
:param df: DataFrame.
:param col: Name of column in df representing value.
:param w: Column representing weight in df.
:param negatives: An optional string indicating how to treat negati... | [
"numpy.amin",
"numpy.sort",
"numpy.argsort",
"numpy.array",
"numpy.sum",
"microdf.weighted_sum",
"numpy.cumsum",
"microdf.weighted_quantile"
] | [((1888, 1936), 'microdf.weighted_quantile', 'mdf.weighted_quantile', (['df', 'col', 'w', '(1 - top_x_pct)'], {}), '(df, col, w, 1 - top_x_pct)\n', (1909, 1936), True, 'import microdf as mdf\n'), ((1957, 2007), 'microdf.weighted_sum', 'mdf.weighted_sum', (['df[df[col] >= threshold]', 'col', 'w'], {}), '(df[df[col] >= t... |
from django.db import models
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from embed_video.fields import EmbedYoutubeField, EmbedSoundcloudField
from .custom_model_fields import RestrictedImageField
from .default_settings import ADOPTEE_STORIES_CONFIG as config
... | [
"django.utils.encoding.force_text",
"django.utils.translation.ugettext_lazy"
] | [((2790, 2802), 'django.utils.translation.ugettext_lazy', '_', (['"""Adoptee"""'], {}), "('Adoptee')\n", (2791, 2802), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((2890, 2903), 'django.utils.translation.ugettext_lazy', '_', (['"""Adoptees"""'], {}), "('Adoptees')\n", (2891, 2903), True, 'from d... |
import tensorflow as tf
def check_gpu():
n_gpus = len(tf.config.experimental.list_physical_devices('GPU'))
print("Num GPUs Available: ", n_gpus)
check_gpu()
| [
"tensorflow.config.experimental.list_physical_devices"
] | [((60, 111), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (104, 111), True, 'import tensorflow as tf\n')] |
from django.utils.translation import get_language
def django_settings(request):
return {
"LANGUAGE": get_language(),
}
| [
"django.utils.translation.get_language"
] | [((116, 130), 'django.utils.translation.get_language', 'get_language', ([], {}), '()\n', (128, 130), False, 'from django.utils.translation import get_language\n')] |
# -*- coding: utf-8 -*-
import wx
from wx.py.shell import Shell
import scipy.ndimage as ndimg
import numpy as np
# from imagepy import IPy
from imagepy.core.engine import Free
from sciapp import Source
cmds = {'app':'app', 'np':np, 'ndimg':ndimg, 'update':None, 'get_img':None}
class Macros(dict):
def __init__(se... | [
"sciapp.Source.manager",
"wx.BoxSizer",
"wx.py.shell.Shell",
"wx.Size"
] | [((1208, 1232), 'wx.py.shell.Shell', 'Shell', (['self'], {'locals': 'cmds'}), '(self, locals=cmds)\n', (1213, 1232), False, 'from wx.py.shell import Shell\n'), ((1250, 1274), 'wx.BoxSizer', 'wx.BoxSizer', (['wx.VERTICAL'], {}), '(wx.VERTICAL)\n', (1261, 1274), False, 'import wx\n'), ((342, 366), 'sciapp.Source.manager'... |
from django.db import models
# Create your models here.
class Car_basic(models.Model):
car_number = models.CharField(max_length=10, null=True, blank=True)
car_color = models.CharField(max_length=10, null=True, blank=True)
register_date = models.DateTimeField(null=True, blank=True)
user_name = models.C... | [
"django.db.models.DateTimeField",
"django.db.models.DecimalField",
"django.db.models.CharField"
] | [((106, 160), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)', 'null': '(True)', 'blank': '(True)'}), '(max_length=10, null=True, blank=True)\n', (122, 160), False, 'from django.db import models\n'), ((177, 231), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)', ... |
# build.py
import os
import platform
import sys
from distutils.core import setup
from torch.utils.ffi import create_extension
extra_compile_args = ['-std=c++11', '-fPIC']
warp_ctc_path = "../build"
if platform.system() == 'Darwin':
lib_ext = ".dylib"
else:
lib_ext = ".so"
if "WARP_CTC_PATH" in os.environ:
... | [
"distutils.core.setup",
"os.path.join",
"os.path.realpath",
"platform.system",
"sys.exit"
] | [((1137, 1234), 'distutils.core.setup', 'setup', ([], {'name': '"""warpctc_pytorch"""', 'version': '"""0.1"""', 'packages': "['warpctc_pytorch']", 'ext_modules': '[ffi]'}), "(name='warpctc_pytorch', version='0.1', packages=['warpctc_pytorch'],\n ext_modules=[ffi])\n", (1142, 1234), False, 'from distutils.core import... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 26 16:48:20 2017
@author: AC
"""
import logging
from lxml import html
import requests
import zoopla_rq
logger = logging.getLogger()
class HomeListing():
def __init__(self, config, parent_id, history_id, survey_id):
self.config = config
self.par... | [
"logging.getLogger",
"zoopla_rq.rq_request_with_repeats",
"lxml.html.fromstring"
] | [((162, 181), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (179, 181), False, 'import logging\n'), ((678, 746), 'zoopla_rq.rq_request_with_repeats', 'zoopla_rq.rq_request_with_repeats', (['self.config', 'property_history_url'], {}), '(self.config, property_history_url)\n', (711, 746), False, 'import zoop... |
import math
import numpy as np
from numba import cuda, float32
from numba.cuda.testing import unittest
import numba.cuda.random
from numba.cuda.testing import skip_on_cudasim, CUDATestCase
from numba.cuda.random import \
xoroshiro128p_uniform_float32, xoroshiro128p_normal_float32, \
xoroshiro128p_uniform_flo... | [
"numba.cuda.random.create_xoroshiro128p_states",
"numba.cuda.random.xoroshiro128p_normal_float64",
"numba.cuda.random.xoroshiro128p_uniform_float32",
"numpy.unique",
"numba.cuda.grid",
"numba.cuda.random.xoroshiro128p_normal_float32",
"math.sqrt",
"numba.cuda.random.xoroshiro128p_uniform_float64",
"... | [((512, 524), 'numba.cuda.grid', 'cuda.grid', (['(1)'], {}), '(1)\n', (521, 524), False, 'from numba import cuda, float32\n'), ((891, 903), 'numba.cuda.grid', 'cuda.grid', (['(1)'], {}), '(1)\n', (900, 903), False, 'from numba import cuda, float32\n'), ((2636, 2688), 'numba.cuda.testing.skip_on_cudasim', 'skip_on_cudas... |
# -*- coding: utf-8 -*-
# Functions and Script to extract data
import blocksci
import pandas as pd
import numpy as np
import networkx as nx
import multiprocessing as mp
import itertools
import random
import time
import string
import pickle
import csv
import gc
import os, sys
from functools import partial
#********... | [
"networkx.number_of_selfloops",
"networkx.induced_subgraph",
"multiprocessing.cpu_count",
"numpy.array",
"blocksci.Blockchain",
"os.path.exists",
"networkx.info",
"itertools.chain.from_iterable",
"networkx.number_of_nodes",
"pandas.DataFrame",
"sys.stdout.flush",
"networkx.MultiDiGraph",
"ra... | [((8556, 8570), 'multiprocessing.cpu_count', 'mp.cpu_count', ([], {}), '()\n', (8568, 8570), True, 'import multiprocessing as mp\n'), ((8579, 8622), 'blocksci.Blockchain', 'blocksci.Blockchain', (['"""/home/ubuntu/bitcoin"""'], {}), "('/home/ubuntu/bitcoin')\n", (8598, 8622), False, 'import blocksci\n'), ((9788, 9799),... |
# Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd.
# 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/LI... | [
"absl.logging.set_verbosity",
"sys.exit"
] | [((1360, 1395), 'absl.logging.set_verbosity', 'logging.set_verbosity', (['logging.INFO'], {}), '(logging.INFO)\n', (1381, 1395), False, 'from absl import logging\n'), ((1503, 1515), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-1)\n', (1511, 1515), False, 'import sys\n')] |
import functools
from gevent import spawn
from ..task import Task
class GeventTask(Task):
"""
Task that spawns a greenlet
"""
def start(self, *args, **kwargs):
return spawn(functools.partial(Task.start, self, *args, **kwargs))
| [
"functools.partial"
] | [((198, 250), 'functools.partial', 'functools.partial', (['Task.start', 'self', '*args'], {}), '(Task.start, self, *args, **kwargs)\n', (215, 250), False, 'import functools\n')] |
from elasticapm.instrumentation.packages.base import AbstractInstrumentedModule
from elasticapm.traces import capture_span
from elasticapm.utils import default_ports
from elasticapm.utils.compat import urlparse
def get_host_from_url(url):
parsed_url = urlparse.urlparse(url)
host = parsed_url.hostname or " "
... | [
"elasticapm.utils.compat.urlparse.urlparse",
"elasticapm.utils.default_ports.get",
"elasticapm.traces.capture_span"
] | [((258, 280), 'elasticapm.utils.compat.urlparse.urlparse', 'urlparse.urlparse', (['url'], {}), '(url)\n', (275, 280), False, 'from elasticapm.utils.compat import urlparse\n'), ((347, 383), 'elasticapm.utils.default_ports.get', 'default_ports.get', (['parsed_url.scheme'], {}), '(parsed_url.scheme)\n', (364, 383), False,... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-03-27 14:01
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('python_management', '0003_added_unique_constraint'),
]
operations = [
migrations.Re... | [
"django.db.migrations.RemoveField"
] | [((307, 403), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""pythonmanagementdeleterequest"""', 'name': '"""virtual_env_name"""'}), "(model_name='pythonmanagementdeleterequest', name=\n 'virtual_env_name')\n", (329, 403), False, 'from django.db import migrations\n'), ((443, 547... |
# author__Farhad_Mirkarimi-*- coding: utf-8 -*-
import os
import h5py
import glob, os
import numpy as np
import matplotlib.pyplot as plt
from numpy import mean
from numpy import std
import torch
import torch.nn as nn
from tqdm.auto import tqdm, trange
from numpy.random import default_rng
import torch.nn.functional as F... | [
"all_params.all_params",
"joint_training.joint_training",
"argparse.ArgumentParser",
"gc.collect"
] | [((347, 359), 'gc.collect', 'gc.collect', ([], {}), '()\n', (357, 359), False, 'import gc\n'), ((527, 619), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""provide arguments for neural capacity estimation"""'}), "(description=\n 'provide arguments for neural capacity estimation')\n", (... |
import datetime
import numpy as np
import libpySat as pySat
from astropy import _erfa as erfa
from scipy.misc import derivative
from scipy import interpolate
class TransformPolarMotion:
def __init__(self,fxp,fyp):
self.fxp=fxp
self.fyp=fyp
self.epochSave = datetime.datetime.now()
... | [
"astropy._erfa.sp00",
"libpySat.UTC2MJD",
"libpySat.pySatTime.UTC2MJD",
"scipy.misc.derivative",
"datetime.datetime.now",
"libpySat.RotationMatrix3DZ",
"libpySat.RotationMatrix3DY",
"numpy.matmul",
"libpySat.RotationMatrix3DX",
"numpy.matrix"
] | [((288, 311), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (309, 311), False, 'import datetime\n'), ((335, 392), 'numpy.matrix', 'np.matrix', (['([0, 0, 0], [0, 0, 0], [0, 0, 0])'], {'dtype': 'float'}), '(([0, 0, 0], [0, 0, 0], [0, 0, 0]), dtype=float)\n', (344, 392), True, 'import numpy as np\n'... |
import numpy as np
import pandas as pd
class WetChickenBaselinePolicy:
def __init__(self, env, gamma, method='heuristic', epsilon=0.1, convergence=0.1, learning_rate=0.1, max_nb_it=999,
order_epsilon=3, order_learning_rate=3):
self.env = env
self.gamma = gamma
self.nb_stat... | [
"numpy.ones",
"numpy.random.choice",
"numpy.argmax",
"numpy.max",
"numpy.zeros"
] | [((7130, 7141), 'numpy.zeros', 'np.zeros', (['(5)'], {}), '(5)\n', (7138, 7141), True, 'import numpy as np\n'), ((394, 436), 'numpy.ones', 'np.ones', (['(self.nb_states, self.nb_actions)'], {}), '((self.nb_states, self.nb_actions))\n', (401, 436), True, 'import numpy as np\n'), ((859, 902), 'numpy.zeros', 'np.zeros', (... |