code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
# Copyright © 2018 VMware, Inc. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause
"""
Test the "ycexplain" management command
"""
import django_yamlconf
from django_yamlconf.tests import MockSettings
from django_yamlconf.tests import YCTestCase
class TestInvalidYAML(YCTestCase):
... | [
"django_yamlconf.tests.MockSettings",
"django_yamlconf.load"
] | [((464, 478), 'django_yamlconf.tests.MockSettings', 'MockSettings', ([], {}), '()\n', (476, 478), False, 'from django_yamlconf.tests import MockSettings\n'), ((706, 769), 'django_yamlconf.load', 'django_yamlconf.load', ([], {'project': '"""invalid"""', 'settings': 'self.settings'}), "(project='invalid', settings=self.s... |
##
import os
import numpy as np
import argparse
import shutil
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import optim
import torch.utils.data as data_utils
from dataset import Polygon3DSample
from network import ImplicitNet, LossFunction
from common_tools.utils import read_json, dra... | [
"common_tools.geometry.write_obj_file",
"common_tools.utils.read_json",
"torch.exp",
"torch.cuda.is_available",
"torch.sum",
"os.path.exists",
"argparse.ArgumentParser",
"torch.randn",
"torch.ones_like",
"os.path.isfile",
"torch.autograd.grad",
"time.time",
"network.ImplicitNet",
"torch.ca... | [((2201, 2270), 'numpy.sum', 'np.sum', (['((np_points[:, None, :] - np_points[None, :, :]) ** 2)'], {'axis': '(-1)'}), '((np_points[:, None, :] - np_points[None, :, :]) ** 2, axis=-1)\n', (2207, 2270), True, 'import numpy as np\n'), ((2761, 2803), 'torch.exp', 'torch.exp', (['(-knn_sqdist * inv_sigma_spatial)'], {}), '... |
"""
Helper functions for recipy tests.
"""
# Copyright (c) 2016 University of Edinburgh.
import os
import os.path
import re
import shutil
try:
from ConfigParser import SafeConfigParser
except:
from configparser import SafeConfigParser
from integration_test import database
from integration_test import enviro... | [
"integration_test.recipy_environment.get_recipy_dir",
"integration_test.database.get_filediffs",
"re.search",
"os.remove",
"integration_test.environment.get_tinydatestr_as_date",
"integration_test.database.get_log",
"os.path.isdir",
"integration_test.database.open_db",
"os.mkdir",
"integration_tes... | [((1463, 1500), 'configparser.SafeConfigParser', 'SafeConfigParser', ([], {'allow_no_value': '(True)'}), '(allow_no_value=True)\n', (1479, 1500), False, 'from configparser import SafeConfigParser\n'), ((2125, 2158), 'integration_test.database.open_db', 'database.open_db', (['connection_data'], {}), '(connection_data)\n... |
from pathlib import Path
from aiopathlib import AsyncPath
def test_glob_rglob():
ap = AsyncPath(__file__).parent
p = Path(ap)
assert [Path(i) for i in ap.glob("*")] == list(p.glob("*"))
assert [Path(i) for i in ap.rglob("*")] == list(p.rglob("*"))
| [
"aiopathlib.AsyncPath",
"pathlib.Path"
] | [((128, 136), 'pathlib.Path', 'Path', (['ap'], {}), '(ap)\n', (132, 136), False, 'from pathlib import Path\n'), ((93, 112), 'aiopathlib.AsyncPath', 'AsyncPath', (['__file__'], {}), '(__file__)\n', (102, 112), False, 'from aiopathlib import AsyncPath\n'), ((149, 156), 'pathlib.Path', 'Path', (['i'], {}), '(i)\n', (153, ... |
import unittest
import pytest
from click.testing import CliRunner
from pytest_localserver import http
from doodledashboard.cli import start
from doodledashboard.component import StaticComponentSource, DisplayCreator
from doodledashboard.displays.display import Display
from tests.doodledashboard.it.support import CliT... | [
"unittest.main",
"pytest_localserver.http.ContentServer",
"doodledashboard.component.StaticComponentSource.add",
"click.testing.CliRunner"
] | [((3483, 3498), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3496, 3498), False, 'import unittest\n'), ((1888, 1908), 'pytest_localserver.http.ContentServer', 'http.ContentServer', ([], {}), '()\n', (1906, 1908), False, 'from pytest_localserver import http\n'), ((2142, 2153), 'click.testing.CliRunner', 'CliRunn... |
# -*- coding: UTF-8 -*-
"""PyRamen Homework Starter."""
# @TODO: Import libraries
import csv
from pathlib import Path
# @TODO: Set file paths for menu_data.csv and sales_data.csv
menu_filepath = Path('./Resources/menu_data.csv')
sales_filepath = Path('./Resources/sales_data.csv')
# @TODO: Initialize list objects to ... | [
"csv.reader",
"pathlib.Path"
] | [((197, 230), 'pathlib.Path', 'Path', (['"""./Resources/menu_data.csv"""'], {}), "('./Resources/menu_data.csv')\n", (201, 230), False, 'from pathlib import Path\n'), ((248, 282), 'pathlib.Path', 'Path', (['"""./Resources/sales_data.csv"""'], {}), "('./Resources/sales_data.csv')\n", (252, 282), False, 'from pathlib impo... |
import datetime
from urllib.parse import quote_plus
from django.urls import reverse
from django.utils import timezone
from rest_framework import status
from rest_framework.test import APITestCase
from faker import Faker
from resources_portal.test.factories import NotificationFactory, UserFactory
fake = Faker()
cl... | [
"resources_portal.test.factories.UserFactory",
"faker.Faker",
"django.utils.timezone.now",
"resources_portal.test.factories.NotificationFactory",
"django.urls.reverse",
"datetime.timedelta"
] | [((308, 315), 'faker.Faker', 'Faker', ([], {}), '()\n', (313, 315), False, 'from faker import Faker\n'), ((466, 479), 'resources_portal.test.factories.UserFactory', 'UserFactory', ([], {}), '()\n', (477, 479), False, 'from resources_portal.test.factories import NotificationFactory, UserFactory\n'), ((514, 558), 'resour... |
import os
with open(os.path.join(os.path.dirname(__file__), "input.txt"), "r") as file:
ins = [l.strip() for l in file.readlines()]
card_count = 10007
stack = []
for j in range(card_count):
stack.append(j)
initial_stack = stack.copy()
count = 0
for i in ins:
if "stack" in i:
stack.reverse()
... | [
"os.path.dirname"
] | [((34, 59), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (49, 59), False, 'import os\n')] |
from django.db import models
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
class Meta:
verbose_name = 'пользователь'
verbose_name_plural = 'пользователи'
username = models.CharField(max_length=32, verbose_name='пользователь')
name = models.CharField(max_leng... | [
"django.db.models.TextField",
"django.db.models.CharField"
] | [((223, 283), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(32)', 'verbose_name': '"""пользователь"""'}), "(max_length=32, verbose_name='пользователь')\n", (239, 283), False, 'from django.db import models\n'), ((295, 385), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '... |
import discord
from discord.ext import commands
import datetime
class AmountConverter(commands.Converter):
async def convert(self, ctx, argument):
try:
return int(argument)
except:
pass
if "all" in argument:
coins = await ctx.bot.pool.fetchval("SELECT co... | [
"discord.ext.commands.has_permissions",
"datetime.datetime.utcnow",
"discord.Color.dark_red",
"discord.ext.commands.bot_has_permissions",
"discord.ext.commands.group",
"discord.ext.commands.check",
"discord.Color.dark_teal"
] | [((1254, 1297), 'discord.ext.commands.group', 'commands.group', ([], {'invoke_without_command': '(True)'}), '(invoke_without_command=True)\n', (1268, 1297), False, 'from discord.ext import commands\n'), ((2275, 2322), 'discord.ext.commands.bot_has_permissions', 'commands.bot_has_permissions', ([], {'manage_roles': '(Tr... |
import logging
import requests
import tenacity
from smart_getenv import getenv
from urllib.parse import urljoin
logger = logging.getLogger(__name__)
RETRIES = getenv("EXT_RETRIES", type=int, default=3)
WAIT_BETWEEN_RETRIES = getenv(
"EXT_WAIT_BETWEEN_RETRIES", type=float, default=0.4
)
class WebClientError(Exce... | [
"logging.getLogger",
"requests.session",
"tenacity.retry_if_exception_type",
"urllib.parse.urljoin",
"tenacity.wait_fixed",
"smart_getenv.getenv",
"tenacity.stop_after_attempt"
] | [((122, 149), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (139, 149), False, 'import logging\n'), ((161, 203), 'smart_getenv.getenv', 'getenv', (['"""EXT_RETRIES"""'], {'type': 'int', 'default': '(3)'}), "('EXT_RETRIES', type=int, default=3)\n", (167, 203), False, 'from smart_getenv im... |
import numpy as np
import torch
import torch.nn as nn
class DataScaler(nn.Module):
def __init__(
self,
bias=None, scale=None,
channels=None, dtype=None, device=None,
**kwargs
):
super(DataScaler, self).__init__()
if bias is None:
asse... | [
"torch.ones",
"torch.tensor",
"torch.zeros",
"torch.cat",
"torch.device"
] | [((396, 454), 'torch.zeros', 'torch.zeros', (['(1)', 'channels', '(1)', '(1)'], {'dtype': 'dtype', 'device': 'device'}), '(1, channels, 1, 1, dtype=dtype, device=device)\n', (407, 454), False, 'import torch\n'), ((475, 532), 'torch.ones', 'torch.ones', (['(1)', 'channels', '(1)', '(1)'], {'dtype': 'dtype', 'device': 'd... |
import os
from os import getenv
from flask import Flask, render_template
from flask_bootstrap import Bootstrap
from .models import DB, User,Tweet, add_test_users
from .twitter import add_or_update_user, add_users, update_all_users
from .predict import predict_user
from .admin.routes import admin
from .main.routes impo... | [
"flask_bootstrap.Bootstrap",
"os.getenv",
"flask.Flask"
] | [((400, 415), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (405, 415), False, 'from flask import Flask, render_template\n'), ((444, 458), 'flask_bootstrap.Bootstrap', 'Bootstrap', (['app'], {}), '(app)\n', (453, 458), False, 'from flask_bootstrap import Bootstrap\n'), ((539, 561), 'os.getenv', 'getenv', ... |
from urllib import request, parse, error
from time import strftime,localtime,time
from os import listdir,getcwd,remove
from os.path import isfile
from openpyxl import Workbook
import sqlite3
import json
import ssl
import re
class Net:
ssl._create_default_https_context = ssl._create_unverified_context
# 获取... | [
"sqlite3.connect",
"os.getcwd",
"os.path.isfile",
"openpyxl.Workbook",
"re.finditer",
"urllib.parse.urlencode",
"time.time",
"urllib.request.urlopen",
"os.remove"
] | [((382, 412), 're.finditer', 're.finditer', (['"""[^/]+/\\\\d+"""', 'url'], {}), "('[^/]+/\\\\d+', url)\n", (393, 412), False, 'import re\n'), ((1048, 1071), 'urllib.request.urlopen', 'request.urlopen', (['string'], {}), '(string)\n', (1063, 1071), False, 'from urllib import request, parse, error\n'), ((2008, 2024), 'o... |
# Generated by Django 2.2.5 on 2019-09-14 15:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adjudication', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='appearance',
name='representing... | [
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((229, 297), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""appearance"""', 'name': '"""representing"""'}), "(model_name='appearance', name='representing')\n", (251, 297), False, 'from django.db import migrations, models\n'), ((342, 408), 'django.db.migrations.RemoveField', 'migr... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing 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 the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unles... | [
"cgpm.utils.general.gen_rng",
"cgpm.crosscat.engine.Engine"
] | [((832, 845), 'cgpm.utils.general.gen_rng', 'gu.gen_rng', (['(1)'], {}), '(1)\n', (842, 845), True, 'from cgpm.utils import general as gu\n'), ((859, 917), 'cgpm.crosscat.engine.Engine', 'Engine', ([], {'X': '[[1]]', 'cctypes': "['normal']", 'num_states': '(2)', 'rng': 'rng'}), "(X=[[1]], cctypes=['normal'], num_states... |
import torch
import torch.nn as nn
import copy
from spirl.utils.general_utils import ParamDict, AttrDict
from spirl.modules.layers import LayerBuilderParams
from spirl.modules.subnetworks import Encoder, Predictor, HybridConvMLPEncoder
class Critic(nn.Module):
"""Base critic class."""
def __init__(self):
... | [
"spirl.modules.layers.LayerBuilderParams",
"spirl.utils.general_utils.AttrDict",
"spirl.utils.general_utils.ParamDict",
"copy.deepcopy",
"torch.cat",
"spirl.modules.subnetworks.Predictor"
] | [((442, 517), 'spirl.utils.general_utils.ParamDict', 'ParamDict', (["{'action_dim': 1, 'normalization': 'none', 'action_input': True}"], {}), "({'action_dim': 1, 'normalization': 'none', 'action_input': True})\n", (451, 517), False, 'from spirl.utils.general_utils import ParamDict, AttrDict\n'), ((939, 955), 'spirl.uti... |
import asyncio
import collections
import concurrent.futures
import math
import time
import async_timeout
import discord
from discord.ext import commands
# noinspection PyUnreachableCode
if False:
import alice
class Helper:
# region discord stuff
@staticmethod
async def react_or_false(ctx, reactions:... | [
"async_timeout.timeout",
"math.sqrt",
"asyncio.sleep",
"time.time",
"asyncio.Future"
] | [((11523, 11539), 'asyncio.Future', 'asyncio.Future', ([], {}), '()\n', (11537, 11539), False, 'import asyncio\n'), ((3768, 3784), 'asyncio.Future', 'asyncio.Future', ([], {}), '()\n', (3782, 3784), False, 'import asyncio\n'), ((5351, 5362), 'time.time', 'time.time', ([], {}), '()\n', (5360, 5362), False, 'import time\... |
import os
import sys
import cv2
import time
import torch
import imutils
import pathlib
import warnings
import onnxruntime
warnings.filterwarnings('ignore')
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
__dir__ = pathlib.Path(os.path.abspath(__file__))
sys.path.append(str(__dir__))
sys.path.append(str(__dir__.parent.par... | [
"utils.crop_util.crop",
"os.path.exists",
"os.listdir",
"utils.util.detect",
"utils.crop_util.load_cropper",
"post_processing.get_post_processing",
"utils.util.load_detector",
"utils.util.draw_bbox",
"cv2.imshow",
"imutils.resize",
"cv2.waitKey",
"time.time",
"os.path.abspath",
"cv2.imread... | [((124, 157), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (147, 157), False, 'import warnings\n'), ((225, 250), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (240, 250), False, 'import os\n'), ((457, 483), 'os.path.exists', 'os.path.exists', ... |
from caplena.api.api_base_uri import ApiBaseUri
from caplena.configuration import Configuration
from caplena.http.requests_http_client import RequestsHttpClient
from caplena.logging.logger import LoggingLevel
common_api_key = "<KEY>"
common_config = Configuration(
api_key=common_api_key,
http_client=RequestsH... | [
"caplena.configuration.Configuration"
] | [((252, 390), 'caplena.configuration.Configuration', 'Configuration', ([], {'api_key': 'common_api_key', 'http_client': 'RequestsHttpClient', 'api_base_uri': 'ApiBaseUri.LOCAL', 'logging_level': 'LoggingLevel.DEBUG'}), '(api_key=common_api_key, http_client=RequestsHttpClient,\n api_base_uri=ApiBaseUri.LOCAL, logging... |
import logging
import random
from constants import SLUG_LENGTH, SLUG_CHARACTERS, RESERVED_SLUGS
log = logging.getLogger(__name__)
def generate_slug() -> str:
while True:
slug = "".join([random.choice(SLUG_CHARACTERS) for _ in range(SLUG_LENGTH)])
if slug not in RESERVED_SLUGS:
return... | [
"logging.getLogger",
"random.choice"
] | [((104, 131), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (121, 131), False, 'import logging\n'), ((202, 232), 'random.choice', 'random.choice', (['SLUG_CHARACTERS'], {}), '(SLUG_CHARACTERS)\n', (215, 232), False, 'import random\n')] |
"""
This indexer is for the Sample objects represented in the SampleService and
the SampleSet object in the Workspace.
"""
# import uuid
from src.utils.es_utils import _get_document
from src.utils.sample_utils import get_sample as _get_sample
def _flatten_meta(meta, prefix=None):
""" Flattens metadata fields in a... | [
"src.utils.es_utils._get_document",
"src.utils.sample_utils.get_sample"
] | [((3285, 3319), 'src.utils.es_utils._get_document', '_get_document', (['"""sample"""', 'sample_id'], {}), "('sample', sample_id)\n", (3298, 3319), False, 'from src.utils.es_utils import _get_document\n'), ((3157, 3174), 'src.utils.sample_utils.get_sample', '_get_sample', (['samp'], {}), '(samp)\n', (3168, 3174), True, ... |
#!/bin/python_3.9
import hashlib,os
try:
from cryptography_me_she import bases
except:
import bases
class Hashing():
def __init__(self) -> None:
pass
def hashing(self, type_hash: str, masg: str) -> str:
masg: bytes = bytes(masg, "ascii")
hash2: str = ""
... | [
"hashlib.sha256",
"bases.base_encde",
"hashlib.md5",
"hashlib.sha3_224",
"hashlib.sha224",
"os.getcwd",
"hashlib.sha512",
"hashlib.sha1"
] | [((1072, 1083), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1081, 1083), False, 'import hashlib, os\n'), ((382, 399), 'hashlib.md5', 'hashlib.md5', (['masg'], {}), '(masg)\n', (393, 399), False, 'import hashlib, os\n'), ((483, 501), 'hashlib.sha1', 'hashlib.sha1', (['masg'], {}), '(masg)\n', (495, 501), False, 'import... |
#!/usr/bin/env python3
##############################################################################
## This file is part of 'ATLAS ALTIROC DEV'.
## It is subject to the license terms in the LICENSE.txt file found in the
## top-level directory of this distribution and at:
## https://confluence.slac.stanford.edu/d... | [
"pyrogue.RemoteVariable",
"pyrogue.Device"
] | [((2241, 2390), 'pyrogue.RemoteVariable', 'pr.RemoteVariable', ([], {'name': '"""rstL"""', 'description': '"""Shift Register\'s reset (active LOW)"""', 'offset': '(4092)', 'bitSize': '(1)', 'mode': '"""RW"""', 'base': 'pr.UInt', 'value': '(1)'}), '(name=\'rstL\', description=\n "Shift Register\'s reset (active LOW)"... |
import requests, json
class Joofday:
def __init__(self):
self.url = 'https://icanhazdadjoke.com/'
self.headers = {'Accept': 'application/json'}
self.req = requests.get(self.url, headers=self.headers)
def TwitterSend(self, api):
data = json.loads(self.req.text)
message ... | [
"json.loads",
"requests.get"
] | [((184, 228), 'requests.get', 'requests.get', (['self.url'], {'headers': 'self.headers'}), '(self.url, headers=self.headers)\n', (196, 228), False, 'import requests, json\n'), ((278, 303), 'json.loads', 'json.loads', (['self.req.text'], {}), '(self.req.text)\n', (288, 303), False, 'import requests, json\n')] |
import logging
import requests
from flask_app.model.declarations import BaseModel
logger = logging.getLogger(__name__)
class SimSwapModel(BaseModel):
def __init__(self):
self.predictor = None
self.sim_swap_url = ""
def init_model(self, config):
self.sim_swap_url = config['MODEL_CONF... | [
"logging.getLogger",
"requests.post"
] | [((93, 120), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (110, 120), False, 'import logging\n'), ((719, 765), 'requests.post', 'requests.post', (['self.sim_swap_url'], {'json': 'payload'}), '(self.sim_swap_url, json=payload)\n', (732, 765), False, 'import requests\n')] |
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 19 13:15:14 2019
@author: HP
"""
import cv2
import numpy as np
from flask import Flask,render_template
import json
app= Flask(__name__)
@app.route('/')
def hello():
return render_template('index.html')
hand_hist = None
traverse_point = []
total_rectangle = 9
hand... | [
"flask.render_template",
"cv2.rectangle",
"cv2.normalize",
"flask.Flask",
"cv2.filter2D",
"cv2.convexityDefects",
"numpy.array",
"cv2.destroyAllWindows",
"cv2.calcHist",
"cv2.calcBackProject",
"cv2.threshold",
"json.dumps",
"cv2.contourArea",
"cv2.waitKey",
"cv2.add",
"cv2.merge",
"n... | [((170, 185), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (175, 185), False, 'from flask import Flask, render_template\n'), ((227, 256), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (242, 256), False, 'from flask import Flask, render_template\n'), ((574, 63... |
from pathlib import Path
from tempfile import TemporaryDirectory
import numpy as np
import torch
from agent import DqnAgent
from model import DqnModel
from replay_buffer import ReplayBuffer
from strategy import EpsilonGreedyStrategy
from torch import nn
import pytest
BATCH_SIZE = 5
@pytest.fixture
def agent():
... | [
"tempfile.TemporaryDirectory",
"model.DqnModel",
"pathlib.Path",
"replay_buffer.ReplayBuffer",
"numpy.random.randint",
"torch.nn.Linear",
"strategy.EpsilonGreedyStrategy",
"numpy.random.randn"
] | [((329, 345), 'torch.nn.Linear', 'nn.Linear', (['(10)', '(2)'], {}), '(10, 2)\n', (338, 345), False, 'from torch import nn\n'), ((359, 375), 'replay_buffer.ReplayBuffer', 'ReplayBuffer', (['(10)'], {}), '(10)\n', (371, 375), False, 'from replay_buffer import ReplayBuffer\n'), ((491, 522), 'numpy.random.randn', 'np.rand... |
import pytz
from rest_framework import serializers
from data.models import Summary
class RegionListSerializer(serializers.Serializer):
region = serializers.CharField(max_length=200)
region_slug = serializers.CharField(max_length=200)
class Meta:
ref_name = "RegionListV1"
class RegionSerializer... | [
"rest_framework.serializers.DateTimeField",
"rest_framework.serializers.IntegerField",
"rest_framework.serializers.SerializerMethodField",
"rest_framework.serializers.CharField",
"rest_framework.serializers.FloatField"
] | [((151, 188), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (172, 188), False, 'from rest_framework import serializers\n'), ((207, 244), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(200)'}), '(max_length=20... |
# Test the GalSim interface to a PixelMapCollection
from __future__ import print_function
import pixmappy
import time
import numpy as np
import os
import galsim
def test_basic():
"""Test basic operation of the GalSimWCS class """
# Check that building a GalSimWCS builds successfully and has some useful attrib... | [
"pixmappy.GalSimWCS",
"galsim.config.ImportModules",
"galsim.config.BuildWCS",
"pickle.dumps",
"numpy.testing.assert_allclose",
"os.path.join",
"numpy.testing.assert_raises",
"galsim.PositionD",
"numpy.array",
"numpy.testing.assert_almost_equal",
"pstats.Stats",
"galsim.Image",
"pickle.loads... | [((442, 453), 'time.time', 'time.time', ([], {}), '()\n', (451, 453), False, 'import time\n'), ((464, 542), 'pixmappy.GalSimWCS', 'pixmappy.GalSimWCS', ([], {'yaml_file': 'yaml_file', 'dir': 'input_dir', 'exp': 'exp', 'ccdnum': 'ccdnum'}), '(yaml_file=yaml_file, dir=input_dir, exp=exp, ccdnum=ccdnum)\n', (482, 542), Fa... |
# -*- coding: utf-8 -*-
"""
tests.tengri
-----------------
Unit tests.
:copyright: (c) 2017 by <NAME>.
:license: MIT, see the LICENSE for more details.
"""
import pytest
import mock
import io
from tengri import weather
from tengri import web
@pytest.fixture(scope="module")
def root():
test_... | [
"tengri.weather._load_root_from_string",
"tengri.weather.load_html",
"tengri.weather.forecast",
"tengri.weather.get_valid_place",
"tengri.web.weather_pages",
"mock.Mock",
"tengri.weather.get_first_link",
"io.open",
"tengri.weather.get_arg_parser",
"tengri.web._meteoblue_page",
"pytest.raises",
... | [((268, 298), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (282, 298), False, 'import pytest\n'), ((370, 409), 'tengri.weather._load_root_from_file', 'weather._load_root_from_file', (['test_file'], {}), '(test_file)\n', (398, 409), False, 'from tengri import weather\n'), ((... |
import subprocess
import os.path
class McciError(Exception):
pass
class McciConnExerciser(object):
def __init__(self, stationConfig, operatorInterface):
self._operator_interface = operatorInterface
self._path_to_mcci_bin = stationConfig.MCCI_BIN
self._mcci_sn = stationConfig.MCCI_SN
... | [
"subprocess.Popen"
] | [((525, 613), 'subprocess.Popen', 'subprocess.Popen', (['string'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE', 'shell': '(True)'}), '(string, stdout=subprocess.PIPE, stderr=subprocess.PIPE,\n shell=True)\n', (541, 613), False, 'import subprocess\n')] |
# These are a few helper functions for the Lecture 1 IPython notebook.
import time
from random import choice
# a few helpful functions
def getDigits(x): # takes an integer x and returns a list of digits, most significant first
return [ int(a) for a in str(x) ]
def makeInt(digits): # takes a list of digits (as re... | [
"time.time"
] | [((1590, 1601), 'time.time', 'time.time', ([], {}), '()\n', (1599, 1601), False, 'import time\n'), ((1645, 1656), 'time.time', 'time.time', ([], {}), '()\n', (1654, 1656), False, 'import time\n')] |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... | [
"marquez_client.log.debug",
"requests.post",
"marquez_client.errors.APIError",
"json.dumps",
"os.environ.get",
"requests.get",
"requests.put",
"time.time"
] | [((1768, 1793), 'marquez_client.log.debug', 'log.debug', (['self._api_base'], {}), '(self._api_base)\n', (1777, 1793), False, 'from marquez_client import log\n'), ((11157, 11234), 'requests.post', 'requests.post', ([], {'url': 'url', 'headers': '_HEADERS', 'json': 'payload', 'timeout': 'self._timeout'}), '(url=url, hea... |
from django.views import generic
from vida.firestation.views import LoginRequiredMixin
from django.db.models import Q
import helpers
from vida.vida.models import Person, Shelter
# class DISTScoreContextMixin(object):
#
# @staticmethod
# def add_dist_values_to_context():
# context = {}
# score_... | [
"vida.vida.models.Person.objects.all",
"django.db.models.Q",
"helpers.is_int_str"
] | [((625, 645), 'vida.vida.models.Person.objects.all', 'Person.objects.all', ([], {}), '()\n', (643, 645), False, 'from vida.vida.models import Person, Shelter\n'), ((1204, 1234), 'helpers.is_int_str', 'helpers.is_int_str', (['string_val'], {}), '(string_val)\n', (1222, 1234), False, 'import helpers\n'), ((1775, 1803), '... |
import time
from netmiko import ConnectHandler, redispatch
from netmiko.ssh_exception import NetMikoTimeoutException
from netmiko.ssh_exception import NetMikoAuthenticationException
from paramiko.ssh_exception import SSHException
from getpass import getpass
# tested in python3.7
# this script is useful when there is a... | [
"netmiko.ConnectHandler",
"netmiko.redispatch",
"time.sleep",
"getpass.getpass"
] | [((943, 981), 'getpass.getpass', 'getpass', (['"""Jump Server Exec Password: """'], {}), "('Jump Server Exec Password: ')\n", (950, 981), False, 'from getpass import getpass\n'), ((1040, 1076), 'getpass.getpass', 'getpass', (['"""End Cisco Exec Password: """'], {}), "('End Cisco Exec Password: ')\n", (1047, 1076), Fals... |
import datautil
import os
from functools import reduce
trace_profile = datautil.getJSONDataFromFile();
print(trace_profile.keys());
nodes = trace_profile["nodes"];
datautil.toTxt(nodes, "test_nodes");
start = trace_profile["startTime"];
end = trace_profile["endTime"]; | [
"datautil.toTxt",
"datautil.getJSONDataFromFile"
] | [((76, 106), 'datautil.getJSONDataFromFile', 'datautil.getJSONDataFromFile', ([], {}), '()\n', (104, 106), False, 'import datautil\n'), ((172, 207), 'datautil.toTxt', 'datautil.toTxt', (['nodes', '"""test_nodes"""'], {}), "(nodes, 'test_nodes')\n", (186, 207), False, 'import datautil\n')] |
#%% First
import numpy as np
import json
import os
from numpy.lib.type_check import _asfarray_dispatcher
import pandas as pd
import requests
from contextlib import closing
import time
from datetime import datetime
import seaborn as sns
from matplotlib import pyplot as plt
abspath = os.path.abspath(__file__)
dname = os... | [
"psycopg2.connect",
"datetime.datetime.fromtimestamp",
"numpy.unique",
"pandas.DataFrame",
"sqlalchemy.create_engine",
"requests.get",
"os.chdir",
"os.path.dirname",
"json.load",
"numpy.array",
"datetime.datetime.fromisoformat",
"os.path.abspath",
"json.dump"
] | [((284, 309), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (299, 309), False, 'import os\n'), ((318, 342), 'os.path.dirname', 'os.path.dirname', (['abspath'], {}), '(abspath)\n', (333, 342), False, 'import os\n'), ((343, 358), 'os.chdir', 'os.chdir', (['dname'], {}), '(dname)\n', (351, 358)... |
# import sendgrid
# import os
# from sendgrid.helpers.mail import Mail, Email, To, Content
# from .models import StudentUser
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
# my_sg = sendgrid.SendGridAPIClient(api_key=os.environ.get('SENDGRID_API_KEY'))
# def ... | [
"django.core.mail.EmailMultiAlternatives",
"django.template.loader.render_to_string"
] | [((1144, 1202), 'django.template.loader.render_to_string', 'render_to_string', (['"""email/studentemail.txt"""', "{'name': name}"], {}), "('email/studentemail.txt', {'name': name})\n", (1160, 1202), False, 'from django.template.loader import render_to_string\n'), ((1221, 1280), 'django.template.loader.render_to_string'... |
def error_handler(decorated):
def wrapper(self, *args, **kwargs):
try:
return decorated(self, *args, **kwargs)
except Exception as exc:
if self.ctx.debug:
import traceback
traceback.print_exc()
if "ServiceException" in str(type(exc... | [
"traceback.print_exc"
] | [((248, 269), 'traceback.print_exc', 'traceback.print_exc', ([], {}), '()\n', (267, 269), False, 'import traceback\n')] |
from django.contrib import admin
from django.urls import path, include
from . import views
urlpatterns = [
path('', views.index),
path('ajax/load_week/', views.week_timetable, name="ajax_load_timetable"),
path('makeNew/', views.make_timetableEntry, name="name_new_timetable")
]
| [
"django.urls.path"
] | [((111, 132), 'django.urls.path', 'path', (['""""""', 'views.index'], {}), "('', views.index)\n", (115, 132), False, 'from django.urls import path, include\n'), ((137, 210), 'django.urls.path', 'path', (['"""ajax/load_week/"""', 'views.week_timetable'], {'name': '"""ajax_load_timetable"""'}), "('ajax/load_week/', views... |
# Generated by Django 2.1.15 on 2020-03-19 02:19
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Email',
fields=[
... | [
"django.db.models.EmailField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.BigIntegerField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((335, 428), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (351, 428), False, 'from django.db import migrations, models\... |
import utils
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from modules.transformer import TransformerEncoder
class ClassEmbedding(nn.Module):
def __init__(self, cfg, trainable=True):
super(ClassEmbedding, self).__init__()
idx2vocab = utils.load_files(cfg["... | [
"torch.nn.Dropout",
"torch.nn.Tanh",
"torch.from_numpy",
"torch.sum",
"torch.bmm",
"torch.nn.functional.softmax",
"torch.arange",
"torch.nn.Sigmoid",
"utils.zeros",
"torch.matmul",
"torch.nn.Embedding",
"torch.Tensor",
"torch.nn.functional.log_softmax",
"torch.reshape",
"torch.cat",
"u... | [((298, 343), 'utils.load_files', 'utils.load_files', (["cfg['DATASET']['IDX2VOCAB']"], {}), "(cfg['DATASET']['IDX2VOCAB'])\n", (314, 343), False, 'import utils\n'), ((460, 506), 'torch.nn.Embedding', 'nn.Embedding', (['self.n_token', 'self.word_emb_size'], {}), '(self.n_token, self.word_emb_size)\n', (472, 506), True,... |
# pylint: disable=attribute-defined-outside-init
import unittest
from tests import vcr
from corkus import Corkus
class TestCorkus(unittest.IsolatedAsyncioTestCase):
@vcr.use_cassette
async def test_context_manager(self):
async with Corkus() as corkus:
player = await corkus.player.get('MrBa... | [
"corkus.Corkus"
] | [((250, 258), 'corkus.Corkus', 'Corkus', ([], {}), '()\n', (256, 258), False, 'from corkus import Corkus\n')] |
# Generated by Django 3.2.7 on 2021-10-29 13:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Bake_bot', '0012_alter_order_customer'),
]
operations = [
migrations.AddField(
model_name='order',
name='customer_ch... | [
"django.db.models.CharField"
] | [((346, 441), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(256)', 'null': '(True)', 'verbose_name': '"""Chat ID Покупателя"""'}), "(blank=True, max_length=256, null=True, verbose_name=\n 'Chat ID Покупателя')\n", (362, 441), False, 'from django.db import migrations, mode... |
#!/usr/bin/env python3
import click
from anormbookmarker.model.__model__ import *
from anormbookmarker.model.BookmarkClassConstructor import tagbookmarks_table
from anormbookmarker.model.Word import WordMisSpelling
from anormbookmarker.test.test_enviroment import Tag
from anormbookmarker.test.test_enviroment import Bo... | [
"click.command"
] | [((566, 581), 'click.command', 'click.command', ([], {}), '()\n', (579, 581), False, 'import click\n')] |
import os
from rnalign2d.rm_mod import unmodify_file
def test_calculate_alignment_from_file():
filename = os.path.normpath(os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'data', 'test_dot_bracket'))
unmodify_file(filename, 'out_filename')
result = open('out_filename', 'r').read()
f... | [
"os.path.abspath",
"rnalign2d.rm_mod.unmodify_file",
"os.remove"
] | [((229, 268), 'rnalign2d.rm_mod.unmodify_file', 'unmodify_file', (['filename', '"""out_filename"""'], {}), "(filename, 'out_filename')\n", (242, 268), False, 'from rnalign2d.rm_mod import unmodify_file\n'), ((472, 497), 'os.remove', 'os.remove', (['"""out_filename"""'], {}), "('out_filename')\n", (481, 497), False, 'im... |
import tcatpost
import datetime
def get_info(startLocations, endLocations):
bus_info = {}
for startLocation in startLocations:
for endLocation in endLocations:
key = startLocation[0]["Name"] + "|" + endLocation[0]["Name"]
bus_info[key] = {}
routes, boardTimes, offTi... | [
"datetime.datetime.strptime",
"datetime.datetime.now",
"datetime.timedelta",
"tcatpost.getRouteInfo"
] | [((342, 413), 'tcatpost.getRouteInfo', 'tcatpost.getRouteInfo', (["startLocation[0]['Name']", "endLocation[0]['Name']"], {}), "(startLocation[0]['Name'], endLocation[0]['Name'])\n", (363, 413), False, 'import tcatpost\n'), ((795, 848), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['boardTimes[t]', '"""%... |
import sys
from Crypto.PublicKey import ECC
from config import EC_CURVE
from util import corrupt_key, get_ec_private_key_bytes, get_ec_public_key_bytes
if __name__ == "__main__":
mismatches = int(sys.argv[1])
host_priv_key = ECC.generate(curve=EC_CURVE)
host_priv_key_bytes = get_ec_private_key_bytes(ho... | [
"Crypto.PublicKey.ECC.generate",
"util.get_ec_private_key_bytes",
"util.corrupt_key",
"util.get_ec_public_key_bytes"
] | [((238, 266), 'Crypto.PublicKey.ECC.generate', 'ECC.generate', ([], {'curve': 'EC_CURVE'}), '(curve=EC_CURVE)\n', (250, 266), False, 'from Crypto.PublicKey import ECC\n'), ((293, 332), 'util.get_ec_private_key_bytes', 'get_ec_private_key_bytes', (['host_priv_key'], {}), '(host_priv_key)\n', (317, 332), False, 'from uti... |
from typing import Dict, List, Tuple, no_type_check
import jmespath
# import turvallisuusneuvonta.csaf.core.rules.mandatory.acyclic_product_ids as acy_product_ids
# import turvallisuusneuvonta.csaf.core.rules.mandatory.consistent_product_status as con_pro_sta
import turvallisuusneuvonta.csaf.core.rules.mandatory.defi... | [
"jmespath.search"
] | [((2253, 2305), 'jmespath.search', 'jmespath.search', (['"""product_tree.branches[]"""', 'document'], {}), "('product_tree.branches[]', document)\n", (2268, 2305), False, 'import jmespath\n'), ((2862, 2920), 'jmespath.search', 'jmespath.search', (['uni_gro_ids.CONDITION_JMES_PATH', 'document'], {}), '(uni_gro_ids.CONDI... |
import unittest
from dna_lib import *
class NucleotideToNumberTest(unittest.TestCase):
def test_dna_adenine_to_number(self):
self.assertEqual(nucleotide_to_number('A'), 0)
def test_dna_thymine_to_number(self):
self.assertEqual(nucleotide_to_number('T'), 3)
def test_dna_cytos... | [
"unittest.main"
] | [((28595, 28610), 'unittest.main', 'unittest.main', ([], {}), '()\n', (28608, 28610), False, 'import unittest\n')] |
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import shutil
import math
from glob import glob
import cv2
import random
import copy
import numpy as np
import imageio
from skimage import measure
import logging
import subproc... | [
"numpy.clip",
"logging.warn",
"cv2.imencode",
"subprocess.check_call",
"cv2.erode",
"os.path.join",
"os.path.dirname",
"numpy.zeros",
"cv2.cvtColor",
"cv2.dilate",
"cv2.imread",
"os.remove"
] | [((392, 418), 'os.path.join', 'os.path.join', (['ROOT', '"""data"""'], {}), "(ROOT, 'data')\n", (404, 418), False, 'import os\n'), ((2078, 2134), 'logging.warn', 'logging.warn', (['"""Importing images into PicPac database..."""'], {}), "('Importing images into PicPac database...')\n", (2090, 2134), False, 'import loggi... |
# -*- coding: utf-8 -*-
from random import choice, randint
from json import dumps, loads
from time import time, sleep, strftime, gmtime
import requests
URL = 'https://api.telegram.org/bot'
TOKEN = 'TOKEN_HERE'
offset = int(0)
logAPIError = True
def record(text, toConsole = False, end = '\n'):
file = open("data/bot.... | [
"json.loads",
"random.choice",
"requests.post",
"json.dumps",
"time.sleep",
"requests.get",
"time.gmtime",
"time.time",
"random.randint"
] | [((2273, 2340), 'requests.post', 'requests.post', (["(URL + TOKEN + '/' + method)"], {'data': 'params', 'files': 'files'}), "(URL + TOKEN + '/' + method, data=params, files=files)\n", (2286, 2340), False, 'import requests\n'), ((4811, 4828), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (4823, 4828), False,... |
#!/usr/bin/python3
# freshReadmeSnippet: example
from gremlin_python.driver.client import Client
from gremlin_python.driver.request import RequestMessage
from gremlin_python.driver.serializer import GraphSONMessageSerializer
serializer = GraphSONMessageSerializer()
# workaround to avoid exception on any opProcessor ... | [
"gremlin_python.driver.client.Client",
"gremlin_python.driver.serializer.GraphSONMessageSerializer",
"gremlin_python.driver.request.RequestMessage"
] | [((241, 268), 'gremlin_python.driver.serializer.GraphSONMessageSerializer', 'GraphSONMessageSerializer', ([], {}), '()\n', (266, 268), False, 'from gremlin_python.driver.serializer import GraphSONMessageSerializer\n'), ((408, 481), 'gremlin_python.driver.client.Client', 'Client', (['"""ws://localhost:8182/gremlin"""', ... |
#!/usr/bin/env python
import datetime
import logging
import os
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# http://www.gao.gov/about/workforce/ig_reports.html
# Oldest report: 2008
# options:
# standard since/year options for a year range to fetch from.
#
# N... | [
"logging.debug",
"utils.inspector.save_report",
"datetime.datetime.strptime",
"datetime.datetime.strftime",
"bs4.BeautifulSoup",
"utils.inspector.year_range",
"utils.utils.run",
"utils.utils.download"
] | [((566, 595), 'utils.inspector.year_range', 'inspector.year_range', (['options'], {}), '(options)\n', (586, 595), False, 'from utils import utils, inspector\n'), ((1203, 1263), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['published_node.text', '"""%b %d, %Y"""'], {}), "(published_node.text, '%b %d, %Y... |
#! /usr/bin/env python
#
# Originally written in 2015 by <NAME> (Precision Translation Tools).
#
# This file is part of moses. Its use is licensed under the GNU Lesser General
# Public License version 2.1 or, at your option, any later version.
"""Reformat project source code, and/or check for style errors ("lint").
... | [
"argparse.ArgumentParser",
"subprocess.Popen",
"subprocess.CalledProcessError",
"os.getcwd",
"sys.stderr.write",
"sys.exit",
"sys.stdout.write"
] | [((3110, 3165), 'subprocess.Popen', 'Popen', (['command_line'], {'stdout': 'PIPE', 'stderr': 'PIPE'}), '(command_line, stdout=PIPE, stderr=PIPE, **kwargs)\n', (3115, 3165), False, 'from subprocess import CalledProcessError, PIPE, Popen\n'), ((3213, 3237), 'sys.stdout.write', 'sys.stdout.write', (['stdout'], {}), '(stdo... |
import numpy as np
import tensorflow as tf
from wf_psf.tf_layers import TF_poly_Z_field, TF_zernike_OPD, TF_batch_poly_PSF
from wf_psf.tf_layers import TF_NP_poly_OPD, TF_batch_mono_PSF
class TF_SemiParam_field_l2_OPD(tf.keras.Model):
""" PSF field forward model!
Semi parametric model based on the Zernike po... | [
"wf_psf.tf_layers.TF_batch_mono_PSF",
"wf_psf.tf_layers.TF_poly_Z_field",
"wf_psf.tf_layers.TF_batch_poly_PSF",
"tensorflow.shape",
"tensorflow.math.square",
"wf_psf.tf_layers.TF_zernike_OPD",
"tensorflow.math.add",
"wf_psf.tf_layers.TF_NP_poly_OPD"
] | [((3100, 3206), 'wf_psf.tf_layers.TF_poly_Z_field', 'TF_poly_Z_field', ([], {'x_lims': 'self.x_lims', 'y_lims': 'self.y_lims', 'n_zernikes': 'self.n_zernikes', 'd_max': 'self.d_max'}), '(x_lims=self.x_lims, y_lims=self.y_lims, n_zernikes=self.\n n_zernikes, d_max=self.d_max)\n', (3115, 3206), False, 'from wf_psf.tf_... |
import pyqtgraph as pg
import numpy as np
x = np.arange(1000)
y = np.random.normal(size=(3, 1000))
plotWidget = pg.plot(title="Three plot curves")
for i in range(3):
plotWidget.plot(x, y[i], pen=(i,3)) ## setting pen=(i,3) automaticaly creates three different-colored pens
| [
"numpy.random.normal",
"pyqtgraph.plot",
"numpy.arange"
] | [((46, 61), 'numpy.arange', 'np.arange', (['(1000)'], {}), '(1000)\n', (55, 61), True, 'import numpy as np\n'), ((66, 98), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(3, 1000)'}), '(size=(3, 1000))\n', (82, 98), True, 'import numpy as np\n'), ((112, 146), 'pyqtgraph.plot', 'pg.plot', ([], {'title': '"""T... |
from easydict import EasyDict as edict
import numpy as np
import torch.nn as nn
__C = edict()
cfg = __C
### Define config flags here
### Some flags are dummy, would be removed later
### Name of the config
__C.TAG = 'default'
### Training and validation
__C.GT_DEPTH_DIR = None
__C.TRAIN_SIZE = [256,512]
__C... | [
"ast.literal_eval",
"easydict.EasyDict",
"numpy.array",
"yaml.load"
] | [((87, 94), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (92, 94), True, 'from easydict import EasyDict as edict\n'), ((5708, 5720), 'yaml.load', 'yaml.load', (['f'], {}), '(f)\n', (5717, 5720), False, 'import yaml\n'), ((7209, 7224), 'ast.literal_eval', 'literal_eval', (['v'], {}), '(v)\n', (7221, 7224), False, 'fr... |
#!/usr/bin/env python3.5
import time
e = time.time()
import sys
debug = False
fileWrite = True
if fileWrite:
fWPath = "processed/" + sys.argv[1] + "-processed.jpg"
displayProcessed = False
import cv2
import numpy as np
import pickle
if debug:
print ("imports: " + str(format(time.time() - e, '.5f')))
star... | [
"numpy.int32",
"cv2.imshow",
"numpy.array",
"cv2.approxPolyDP",
"cv2.destroyAllWindows",
"cv2.contourArea",
"cv2.waitKey",
"cv2.add",
"cv2.drawContours",
"cv2.circle",
"cv2.moments",
"cv2.cvtColor",
"cv2.resize",
"cv2.GaussianBlur",
"time.time",
"cv2.imread",
"cv2.convexHull",
"cv2... | [((41, 52), 'time.time', 'time.time', ([], {}), '()\n', (50, 52), False, 'import time\n'), ((1569, 1664), 'cv2.imread', 'cv2.imread', (["('/home/solomon/frc/the-deal/pythonCV/RealFullField/' + sys.argv[1] + '.jpg')", '(1)'], {}), "('/home/solomon/frc/the-deal/pythonCV/RealFullField/' + sys.argv[\n 1] + '.jpg', 1)\n"... |
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('cms_put/', include('cms_put.urls')),
path('calc/', include('calc.urls')),
path('admin/', admin.site.urls),
]
| [
"django.urls.path",
"django.urls.include"
] | [((180, 211), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (184, 211), False, 'from django.urls import include, path\n'), ((109, 132), 'django.urls.include', 'include', (['"""cms_put.urls"""'], {}), "('cms_put.urls')\n", (116, 132), False, 'from django.urls imp... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
from cleverhans.attacks import Attack
class TestAttackClassInitArguments(unittest.TestCase):
def test_model(self):
import tensorflow as tf
... | [
"tensorflow.Session",
"tensorflow.placeholder",
"numpy.asarray",
"numpy.zeros",
"unittest.main",
"cleverhans.attacks.Attack"
] | [((2545, 2560), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2558, 2560), False, 'import unittest\n'), ((335, 347), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (345, 347), True, 'import tensorflow as tf\n'), ((1440, 1452), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (1450, 1452), True, 'impo... |
import pandas
from math import sqrt
from .. import backends as be
from .. import math_utils
from ..metrics.generator_metrics import KLDivergence, ReverseKLDivergence
class PCA(object):
def __init__(self, num_components, stepsize=0.001):
"""
Computes the principal components of a dataset using sto... | [
"pandas.DataFrame",
"math.sqrt"
] | [((6321, 6346), 'math.sqrt', 'sqrt', (['(error / num_samples)'], {}), '(error / num_samples)\n', (6325, 6346), False, 'from math import sqrt\n'), ((1803, 1821), 'pandas.DataFrame', 'pandas.DataFrame', ([], {}), '()\n', (1819, 1821), False, 'import pandas\n')] |
from tortoise import Tortoise
from .controllers import router
def init(app):
app.include_router(router, prefix="/users", tags=["Users"])
Tortoise.init_models(["app.users.models"], "users")
| [
"tortoise.Tortoise.init_models"
] | [((148, 199), 'tortoise.Tortoise.init_models', 'Tortoise.init_models', (["['app.users.models']", '"""users"""'], {}), "(['app.users.models'], 'users')\n", (168, 199), False, 'from tortoise import Tortoise\n')] |
# -*- coding: utf-8 -*-
import numpy as np
def solver_constrained_newton(f, x0, maxiter=10000, tol=1e-6,
delta_step=0.9999,
max_step=1.0,
print_frequency=None):
delta_step = 0.9999
control_value = 10**-200
x = x0.cop... | [
"numpy.abs",
"numpy.linalg.solve",
"numpy.min"
] | [((928, 941), 'numpy.min', 'np.min', (['step_'], {}), '(step_)\n', (934, 941), True, 'import numpy as np\n'), ((468, 494), 'numpy.linalg.solve', 'np.linalg.solve', (['jac', '(-res)'], {}), '(jac, -res)\n', (483, 494), True, 'import numpy as np\n'), ((671, 686), 'numpy.abs', 'np.abs', (['delta_x'], {}), '(delta_x)\n', (... |
from keras.models import load_model
import pandas as pd
import numpy as np
from sklearn.model_selection import KFold
import pickle as pk
import os
from keras.utils import to_categorical ,Sequence
import pandas as pd
from sklearn.metrics import accuracy_score
pd.options.mode.chained_assignment = None # default='... | [
"os.path.exists",
"pandas.read_csv",
"numpy.argmax",
"os.mkdir",
"pandas.DataFrame",
"numpy.load",
"sklearn.metrics.accuracy_score"
] | [((379, 414), 'pandas.read_csv', 'pd.read_csv', (['"""data/train_label.csv"""'], {}), "('data/train_label.csv')\n", (390, 414), True, 'import pandas as pd\n'), ((582, 610), 'os.path.exists', 'os.path.exists', (['predict_path'], {}), '(predict_path)\n', (596, 610), False, 'import os\n'), ((616, 638), 'os.mkdir', 'os.mkd... |
from math import factorial
def main():
# input
A, B, K = map(int, input().split())
# compute
n = factorial(A+B) // factorial(A) // factorial(B)
s = ''
while n//2 != 0:
n //= 2
if K <= n:
s += 'a'
else:
s += 'b'
# output
print(s)
if __n... | [
"math.factorial"
] | [((149, 161), 'math.factorial', 'factorial', (['B'], {}), '(B)\n', (158, 161), False, 'from math import factorial\n'), ((115, 131), 'math.factorial', 'factorial', (['(A + B)'], {}), '(A + B)\n', (124, 131), False, 'from math import factorial\n'), ((133, 145), 'math.factorial', 'factorial', (['A'], {}), '(A)\n', (142, 1... |
import uos
from pybricks.experimental import run_parallel
from pybricks.tools import wait
if uos.getenv("PYBRICKS_BUILD_ENV") == "docker-armel":
# qemu-user-static has issues with threads
print("SKIP")
raise SystemExit
def task1():
wait(1000)
return "OK1"
def task2():
wait(500)
return ... | [
"pybricks.tools.wait",
"uos.getenv",
"pybricks.experimental.run_parallel"
] | [((536, 562), 'pybricks.experimental.run_parallel', 'run_parallel', (['task1', 'task2'], {}), '(task1, task2)\n', (548, 562), False, 'from pybricks.experimental import run_parallel\n'), ((894, 927), 'pybricks.experimental.run_parallel', 'run_parallel', (['task1', 'task2', 'task4'], {}), '(task1, task2, task4)\n', (906,... |
#
# 2018 Copyright BoxBoat Technologies
# All Rights Reserved
#
# Author: <NAME>
#
import logging
from six import iteritems
from . import client_factory as aws_client_factory
log = logging.getLogger(__name__)
def get_asg_name(instance_id, region=None):
"""Get the asg name associated with this instance id (if o... | [
"logging.getLogger",
"six.iteritems"
] | [((184, 211), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (201, 211), False, 'import logging\n'), ((1101, 1120), 'six.iteritems', 'iteritems', (['instance'], {}), '(instance)\n', (1110, 1120), False, 'from six import iteritems\n')] |
from xmlrpc.server import SimpleXMLRPCServer
import os
import pandas as pd
def persist_data(data):
data.to_csv("notas.csv", sep=";", encoding="utf-8", index=False)
def read_data():
return pd.read_csv("notas.csv", sep=";", encoding="utf-8")
def maybe_create_file():
files = os.listdir('.')
if(not(... | [
"pandas.DataFrame",
"os.listdir",
"xmlrpc.server.SimpleXMLRPCServer",
"pandas.read_csv"
] | [((198, 249), 'pandas.read_csv', 'pd.read_csv', (['"""notas.csv"""'], {'sep': '""";"""', 'encoding': '"""utf-8"""'}), "('notas.csv', sep=';', encoding='utf-8')\n", (209, 249), True, 'import pandas as pd\n'), ((288, 303), 'os.listdir', 'os.listdir', (['"""."""'], {}), "('.')\n", (298, 303), False, 'import os\n'), ((568,... |
from onegov.ticket.handler import Handler, HandlerRegistry
handlers = HandlerRegistry() # noqa
from onegov.ticket.model import Ticket
from onegov.ticket.model import TicketPermission
from onegov.ticket.collection import TicketCollection
__all__ = [
'Handler',
'handlers',
'Ticket',
'TicketCollection'... | [
"onegov.ticket.handler.HandlerRegistry"
] | [((70, 87), 'onegov.ticket.handler.HandlerRegistry', 'HandlerRegistry', ([], {}), '()\n', (85, 87), False, 'from onegov.ticket.handler import Handler, HandlerRegistry\n')] |
"""
Random walker segmentation algorithm
from *Random walks for image segmentation*, <NAME>, IEEE Trans
Pattern Anal Mach Intell. 2006 Nov;28(11):1768-83.
This code is mostly adapted from scikit-image 0.11.3 release.
Location of file in scikit image: random_walker function and its supporting
sub functions in skimage.... | [
"numpy.hstack",
"numpy.logical_not",
"numpy.array",
"numpy.arange",
"numpy.asarray",
"numpy.diff",
"numpy.exp",
"scipy.sparse.coo_matrix",
"warnings.warn",
"scipy.sparse.csr_matrix",
"numpy.abs",
"numpy.argmax",
"numpy.any",
"numpy.copy",
"sklearn.utils.as_float_array",
"numpy.unique",... | [((1475, 1523), 'numpy.hstack', 'np.hstack', (['(edges_deep, edges_right, edges_down)'], {}), '((edges_deep, edges_right, edges_down))\n', (1484, 1523), True, 'import numpy as np\n'), ((2049, 2067), 'numpy.exp', 'np.exp', (['(-gradients)'], {}), '(-gradients)\n', (2055, 2067), True, 'import numpy as np\n'), ((2537, 255... |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 13 09:28:17 2018
@author: <NAME>
"""
import seaborn as sns
import pandas as pd
import read_attributes_signatures
import matplotlib.pyplot as plt
def plot_CAMELS(att_df):
"""
Plots all the attributes of CAMELS in one figure
"""
fig, axes = plt.subplots(n... | [
"matplotlib.pyplot.savefig",
"read_attributes_signatures.seperate_attributes_signatures",
"seaborn.violinplot",
"read_attributes_signatures.read_meta",
"matplotlib.pyplot.subplots"
] | [((306, 336), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(5)', 'ncols': '(3)'}), '(nrows=5, ncols=3)\n', (318, 336), True, 'import matplotlib.pyplot as plt\n'), ((716, 755), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""atts_CAMELS.png"""'], {'dpi': '(200)'}), "('atts_CAMELS.png', dpi=200)\n", (7... |
import json
import sys
import requests
from arcgis2geojson import arcgis2geojson
# Worarkound for the fact that the existing tools aren't able to pull geometry
# More info: https://github.com/openaddresses/pyesridump/issues/43
if __name__ == "__main__":
res = requests.get(
(
"https://www.co.c... | [
"json.dumps",
"requests.get"
] | [((1152, 1304), 'requests.get', 'requests.get', (['f"""https://www.co.coles.il.us/ccwgis/rest/services/CountyClerk/VoterPrecincts/MapServer/1/{obj[\'attributes\'][\'OBJECTID\']}?f=json"""'], {}), '(\n f"https://www.co.coles.il.us/ccwgis/rest/services/CountyClerk/VoterPrecincts/MapServer/1/{obj[\'attributes\'][\'OBJE... |
import json
import logging
import os
import time
from pprint import pformat
import requests
from flask import abort, make_response
from config import db, executor
from config.db_lib import db_session
from models import (
Activator,
ActivatorMetadata,
ActivatorMetadataVariable,
Applicati... | [
"logging.getLogger",
"requests.post",
"tb_houston_service.tools.ModelTools.get_utc_timestamp",
"tb_houston_service.notification.create",
"time.sleep",
"tb_houston_service.activator_extension.expand_activator",
"json.dumps",
"flask.abort",
"config.executor.submit",
"json.loads",
"tb_houston_servi... | [((850, 912), 'logging.getLogger', 'logging.getLogger', (['"""tb_houston_service.application_deployment"""'], {}), "('tb_houston_service.application_deployment')\n", (867, 912), False, 'import logging\n'), ((7082, 7123), 'config.executor.submit', 'executor.submit', (['start_deployment', 'app_id'], {}), '(start_deployme... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/1/25 10:38 PM
# @Author : sean10
# @Site :
# @File : service.py
# @Software: PyCharm
"""
"""
from flask import current_app, Blueprint, request
import logging
import requests
import yaml
import json
import os
from .common import *
service = Bluep... | [
"json.loads",
"logging.debug",
"yaml.load",
"collections.defaultdict",
"flask.Blueprint",
"json.dump"
] | [((315, 368), 'flask.Blueprint', 'Blueprint', (['"""service"""', '__name__'], {'url_prefix': '"""/service"""'}), "('service', __name__, url_prefix='/service')\n", (324, 368), False, 'from flask import current_app, Blueprint, request\n'), ((435, 452), 'collections.defaultdict', 'defaultdict', (['zero'], {}), '(zero)\n',... |
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import GenericRelation
from django.core import validators
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Avg, Sum, Count, Q
from django.db.models.functions import Coalesce
fr... | [
"django.core.validators.MaxValueValidator",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.Count",
"django.db.models.Avg",
"django.core.exceptions.ValidationError",
"django.db.models.BigIntegerField",
"django.db.models.ImageField",
"django.core.validators.MinValueVa... | [((5896, 5933), 'django.dispatch.dispatcher.receiver', 'receiver', (['post_delete'], {'sender': 'Package'}), '(post_delete, sender=Package)\n', (5904, 5933), False, 'from django.dispatch.dispatcher import receiver\n'), ((7320, 7388), 'django.dispatch.dispatcher.receiver', 'receiver', (['post_save'], {'sender': 'Package... |
import os
import app
from app import db
from werkzeug.security import generate_password_hash
os.environ["PI_USERNAME"] = 'pi'
os.environ["PI_PASSWORD"] = generate_password_hash("pi")
app = app.create_app({
"ENV": 'development',
"DEBUG": True,
"TESTING": True
})
if __name__ == "__main__":
app.run() | [
"app.run",
"werkzeug.security.generate_password_hash",
"app.create_app"
] | [((155, 183), 'werkzeug.security.generate_password_hash', 'generate_password_hash', (['"""pi"""'], {}), "('pi')\n", (177, 183), False, 'from werkzeug.security import generate_password_hash\n'), ((191, 261), 'app.create_app', 'app.create_app', (["{'ENV': 'development', 'DEBUG': True, 'TESTING': True}"], {}), "({'ENV': '... |
from django.db.models.query import QuerySet
from django.http import Http404
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from rest_framework.decorators import action
from rest_framework.generics import get_object_or_404
from rest_framework.mixins import (Crea... | [
"ui.models.UiConfig.get_active_config",
"ui.models.UiConfig.objects.select_related",
"shop.models.CartItem.objects.all",
"rest_framework.generics.get_object_or_404",
"shop.models.Cart.get_current_cart",
"shop.models.Product.objects.all",
"rest_framework.response.Response",
"django.views.decorators.cac... | [((1119, 1189), 'ui.models.UiConfig.objects.select_related', 'UiConfig.objects.select_related', (['"""carousel"""', '"""contact_info"""', '"""content"""'], {}), "('carousel', 'contact_info', 'content')\n", (1150, 1189), False, 'from ui.models import UiConfig\n'), ((1285, 1322), 'rest_framework.decorators.action', 'acti... |
#!/usr/bin/env python
from selenium import webdriver
import os
import time
options = webdriver.ChromeOptions()
#CHROMEDRIVER_PATH = '/app/.chromedriver/bin/chromedriver'
#CHROMEDRIVER_PATH = '/usr/bin/chromedriver'
#GOOGLE_CHROME_SHIM = os.getenv('GOOGLE_CHROME_SHIM',"chromedriver")
#options.binary_location = '/app... | [
"selenium.webdriver.Chrome",
"selenium.webdriver.ChromeOptions",
"time.sleep"
] | [((88, 113), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (111, 113), False, 'from selenium import webdriver\n'), ((668, 708), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'chrome_options': 'options'}), '(chrome_options=options)\n', (684, 708), False, 'from selenium import ... |
from scipy import signal
import numpy as np
import pyqtgraph
# Create the data
fs = 10e3
N = 1e5
amp = 2 * np.sqrt(2)
# noise_power = 0.01 * fs / 2
time = np.arange(N) / float(fs)
mod = 500*np.cos(2*np.pi*0.25*time)
carrier = amp * np.sin(2*np.pi*3e3*time + mod)
# noise = np.random.normal(scale=np.sqrt(noise_power), s... | [
"pyqtgraph.Qt.QtGui.QApplication.instance",
"numpy.sqrt",
"scipy.signal.spectrogram",
"pyqtgraph.HistogramLUTItem",
"pyqtgraph.ImageItem",
"numpy.min",
"numpy.size",
"pyqtgraph.setConfigOptions",
"numpy.max",
"pyqtgraph.mkQApp",
"numpy.cos",
"pyqtgraph.GraphicsLayoutWidget",
"numpy.sin",
"... | [((490, 521), 'scipy.signal.spectrogram', 'signal.spectrogram', (['carrier', 'fs'], {}), '(carrier, fs)\n', (508, 521), False, 'from scipy import signal\n'), ((580, 634), 'pyqtgraph.setConfigOptions', 'pyqtgraph.setConfigOptions', ([], {'imageAxisOrder': '"""row-major"""'}), "(imageAxisOrder='row-major')\n", (606, 634)... |
#coding=utf-8
'''
Created on 2018-12-10
Update on 2018-12-10
@author: Mashiro @ https://2heng.xin
Desc: Convert Hearthstone cards data to MySQL.
'''
import MySQLdb
import json
import os
import requests
def jsonToMySQL(host, user, passwd, db_name, table_name):
json_url = 'https://api.hearthstonejson.com/v1/lates... | [
"MySQLdb.connect",
"requests.get"
] | [((359, 381), 'requests.get', 'requests.get', (['json_url'], {}), '(json_url)\n', (371, 381), False, 'import requests\n'), ((469, 547), 'MySQLdb.connect', 'MySQLdb.connect', (['host', 'user', 'passwd', 'db_name'], {'use_unicode': '(True)', 'charset': '"""utf8"""'}), "(host, user, passwd, db_name, use_unicode=True, char... |
import random
import numpy as np
import torch
def set_seed(seed):
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
def cuda_if(torch_object, cuda):
return torch_object.cuda() if cuda else torch_object
def gae(rewards, masks, values, gamma, lambd):
""" Generalized Advantage Estimatio... | [
"torch.manual_seed",
"torch.zeros",
"numpy.random.seed",
"random.seed"
] | [((71, 88), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (82, 88), False, 'import random\n'), ((93, 113), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (107, 113), True, 'import numpy as np\n'), ((118, 141), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (135, 14... |
"""
The input data for the fine-tune flow. Directory structure in "user@118:/home/students/oron/animation/data$"
data:
\TRAIN_Series:
\triplets:
\guid.jpg
\triplets.json
\model:
\keyframe_detections:
\guid.jpg
\animationdetectionoutput.json
"""
import json
import os
import shutil
import uuid
from t... | [
"os.rename",
"os.path.join",
"Featurizer.featurizer.Featurizer.get_base_model",
"uuid.uuid4",
"os.path.isfile",
"os.path.isdir",
"os.path.basename",
"Animator.utils.create_dir_if_not_exist",
"Utils.gpu_profiler.nvidia_smi",
"json.load",
"Animator.consolidation_api.CharacterDetectionOutput.read_f... | [((757, 822), 'os.path.join', 'os.path.join', (['output_model_repo', 'f"""ft_{config[\'session_id\']}.pth"""'], {}), '(output_model_repo, f"ft_{config[\'session_id\']}.pth")\n', (769, 822), False, 'import os\n'), ((840, 928), 'Featurizer.featurizer.Featurizer.get_base_model', 'Featurizer.get_base_model', (["config['gpu... |
import numpy as np
def split(dataset, splits_p):
splits = len(dataset)*np.array(splits_p)
splits = [int(p) for p in list(splits)]
return splits | [
"numpy.array"
] | [((76, 94), 'numpy.array', 'np.array', (['splits_p'], {}), '(splits_p)\n', (84, 94), True, 'import numpy as np\n')] |
"""Constants and helper functions used in this module"""
from wordler.__about__ import __title__
from enum import Enum
import logging
from typing import List, Union
from pkg_resources import resource_filename
ALPHABET = "abcdefghijklmnopqrstuvwxyz".upper()
def get_full_dicionary(word_length: int = 5) -> List[str]:... | [
"logging.getLogger",
"logging.Formatter",
"logging.StreamHandler",
"pkg_resources.resource_filename"
] | [((405, 453), 'pkg_resources.resource_filename', 'resource_filename', (['__title__', '"""assets/words.txt"""'], {}), "(__title__, 'assets/words.txt')\n", (422, 453), False, 'from pkg_resources import resource_filename\n'), ((1330, 1349), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1347, 1349), False, '... |
import unittest
from torch_complex import torch
class TestComplexTensor(unittest.TestCase):
def test_empty(self):
torch.empty(2, 2, dtype=torch.complex64)
torch.empty(2, 2, dtype=torch.complex128)
def test_indexing(self):
t = torch.empty(2, 2, dtype=torch.complex128)
t[1]
... | [
"unittest.main",
"torch_complex.torch.empty",
"torch_complex.torch.ones"
] | [((722, 737), 'unittest.main', 'unittest.main', ([], {}), '()\n', (735, 737), False, 'import unittest\n'), ((128, 168), 'torch_complex.torch.empty', 'torch.empty', (['(2)', '(2)'], {'dtype': 'torch.complex64'}), '(2, 2, dtype=torch.complex64)\n', (139, 168), False, 'from torch_complex import torch\n'), ((177, 218), 'to... |
from benchmark.main import Benchmark
from benchmark.modules.configs.paddle_recognizer_config import PaddleRecognizerConfig
from benchmark.modules.recognizer.paddle_recognizer import PaddleRecognizer
config = PaddleRecognizerConfig("benchmark/configs/plate.yaml")
bm = Benchmark(config)
# bm.GenPythonRecord()
# bm.GenCp... | [
"benchmark.modules.configs.paddle_recognizer_config.PaddleRecognizerConfig",
"benchmark.main.Benchmark"
] | [((209, 263), 'benchmark.modules.configs.paddle_recognizer_config.PaddleRecognizerConfig', 'PaddleRecognizerConfig', (['"""benchmark/configs/plate.yaml"""'], {}), "('benchmark/configs/plate.yaml')\n", (231, 263), False, 'from benchmark.modules.configs.paddle_recognizer_config import PaddleRecognizerConfig\n'), ((269, 2... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import sys
sys.path.append('.')
import time
import concurrent
import logging
import sys
from pyDist import Interfaces, Nodes
from pyDist.TaskManager import TaskManager
from pyDist import exSheet
#logging utility
logging.getLogger("Nodes").setLevel(logging.WARNING)
... | [
"logging.basicConfig",
"logging.getLogger",
"pyDist.Nodes.ClusterNode",
"pyDist.Interfaces.ClusterExecutor",
"time.sleep",
"time.time",
"sys.path.append"
] | [((61, 81), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (76, 81), False, 'import sys\n'), ((377, 513), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(name)-12s:%(lineno)-3s | %(levelname)-8s | %(message)s"""', 'stream': 'sys.stdout', 'level': 'logging.DEBUG'}), "(format=\n ... |
# Generated by Django 3.2.9 on 2021-11-12 16:19
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('academy_app', '0001_init... | [
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.FileField",
"django.db.models.DateTimeField",
"django.db.models.BooleanField",
"django.db.migrations.AlterModelOptions",
"django.db.models.BigAutoField",
"django.db.models.ImageField",
"django.db.migrations.swappable_d... | [((227, 284), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (258, 284), False, 'from django.db import migrations, models\n'), ((361, 446), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], ... |
import gym
import torch
from collections import deque
import numpy as np
from torch.utils.tensorboard import SummaryWriter
from ppo import PPOAgent
from pathlib import Path
from datetime import datetime
import utils
# create environment
env = gym.make("Pendulum-v0")
# set random seeds
seed = 123456
torch.manual_seed... | [
"torch.manual_seed",
"numpy.mean",
"collections.deque",
"pathlib.Path",
"torch.tensor",
"numpy.random.seed",
"ppo.PPOAgent",
"gym.make",
"utils.load_agent"
] | [((245, 268), 'gym.make', 'gym.make', (['"""Pendulum-v0"""'], {}), "('Pendulum-v0')\n", (253, 268), False, 'import gym\n'), ((303, 326), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (320, 326), False, 'import torch\n'), ((342, 362), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)... |
import logging
from .Device import Device
_LOGGER = logging.getLogger(__name__)
class Installation:
"""Manage a Daikin AirzoneCloud installation"""
_api = None
_data = {}
_devices = []
def __init__(self, api, data):
self._api = api
self._data = data
# log
_LOGG... | [
"logging.getLogger"
] | [((53, 80), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (70, 80), False, 'import logging\n')] |
from django.contrib import admin
from .models import *
admin.site.register(User)
admin.site.register(Profile)
admin.site.register(Customer)
admin.site.register(Account)
admin.site.register(Event)
admin.site.register(Format)
admin.site.register(Language)
admin.site.register(Product)
admin.site.register(Picture)
| [
"django.contrib.admin.site.register"
] | [((56, 81), 'django.contrib.admin.site.register', 'admin.site.register', (['User'], {}), '(User)\n', (75, 81), False, 'from django.contrib import admin\n'), ((82, 110), 'django.contrib.admin.site.register', 'admin.site.register', (['Profile'], {}), '(Profile)\n', (101, 110), False, 'from django.contrib import admin\n')... |
import unittest
from jivago.wsgi.invocation.resource_invoker import ResourceInvoker
from jivago.wsgi.invocation.rewrite.path_rewriting_route_handler_decorator import PathRewritingRouteHandlerDecorator
from jivago.wsgi.methods import GET
from jivago.wsgi.routing.routing_rule import RoutingRule
from jivago.wsgi.routing.... | [
"jivago.wsgi.routing.routing_rule.RoutingRule",
"test_utils.request_builder.RequestBuilder",
"jivago.wsgi.routing.table.tree_routing_table.TreeRoutingTable"
] | [((518, 536), 'jivago.wsgi.routing.table.tree_routing_table.TreeRoutingTable', 'TreeRoutingTable', ([], {}), '()\n', (534, 536), False, 'from jivago.wsgi.routing.table.tree_routing_table import TreeRoutingTable\n'), ((674, 696), 'jivago.wsgi.routing.routing_rule.RoutingRule', 'RoutingRule', (['"""/"""', 'None'], {}), "... |
r"""
Graded modules with basis
"""
#*****************************************************************************
# Copyright (C) 2008 <NAME> (CNRS) <<EMAIL>>
# 2008-2011 <NAME> <nthiery at users.sf.net>
#
# Distributed under the terms of the GNU General Public License (GPL)
# htt... | [
"sage.modules.with_basis.subquotient.SubmoduleWithBasis",
"sage.modules.with_basis.subquotient.QuotientModuleWithBasis"
] | [((8626, 8760), 'sage.modules.with_basis.subquotient.SubmoduleWithBasis', 'SubmoduleWithBasis', (['gens', '*args'], {'ambient': 'self', 'support_order': 'support_order', 'unitriangular': 'unitriangular', 'category': 'category'}), '(gens, *args, ambient=self, support_order=support_order,\n unitriangular=unitriangular... |
import os
import abc
import cv2
import numpy as np
import tensorflow as tf
class TFRecordGenerator(abc.ABC):
def __init__(self, tfrecord_path, labels, dir_paths=None, file_paths=None):
# tfrecord_path : record tfrecord_path
# dir_paths : dir paths of different image sources
# labels ... | [
"tensorflow.data.TFRecordDataset",
"os.listdir",
"tensorflow.io.parse_single_example",
"tensorflow.compat.v1.data.make_one_shot_iterator",
"tensorflow.io.TFRecordWriter",
"os.path.join",
"tensorflow.train.Features",
"tensorflow.io.FixedLenFeature",
"tensorflow.train.FloatList",
"os.path.abspath",
... | [((3902, 3932), 'os.path.abspath', 'os.path.abspath', (['tfrecord_path'], {}), '(tfrecord_path)\n', (3917, 3932), False, 'import os\n'), ((4202, 4247), 'tensorflow.data.TFRecordDataset', 'tf.data.TFRecordDataset', (['[self.tfrecord_path]'], {}), '([self.tfrecord_path])\n', (4225, 4247), True, 'import tensorflow as tf\n... |
# coding: utf-8
# This file is a part of VK4XMPP transport
# © simpleApps, 2014.
import xmpp
import urllib
from socket import error
from hashlib import sha1
def apply(instance, args=()):
"""
Executes instance(*args), but just return None on error occurred
"""
try:
code = instance(*args)
except Exception:
co... | [
"socket.error.getTag",
"xmpp.Error",
"urllib.urlopen",
"xmpp.DataForm"
] | [((1410, 1441), 'xmpp.Error', 'xmpp.Error', (['stanza', 'error', '(True)'], {}), '(stanza, error, True)\n', (1420, 1441), False, 'import xmpp\n'), ((917, 949), 'xmpp.DataForm', 'xmpp.DataForm', (['type', 'data', 'title'], {}), '(type, data, title)\n', (930, 949), False, 'import xmpp\n'), ((1460, 1481), 'socket.error.ge... |
from django.shortcuts import render, redirect, get_object_or_404
from .models import Book, Author, Review
from .forms import ReviewForm
def book_detail(request, book_id):
book = Book.objects.get(pk=book_id)
try:
last_review_list = Review.objects.filter(book_id=book_id)[:5]
except Review.DoesNotExi... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"django.shortcuts.get_object_or_404"
] | [((653, 814), 'django.shortcuts.render', 'render', (['request', '"""catalog/book_detail.html"""', "{'form': form, 'book': book, 'last_review_list': last_review_list, 'flag':\n flag, 'user_review': user_review}"], {}), "(request, 'catalog/book_detail.html', {'form': form, 'book': book,\n 'last_review_list': last_r... |
# -*- coding: utf-8 -*-
# NeuralCorefRes main
#
# Author: <NAME> <<EMAIL>>
#
# For license information, see LICENSE
import argparse
import gc
import os
import pprint
import re
import sys
from itertools import zip_longest
from typing import List
import nltk
import numpy as np
from nltk.corpus import stopwords
from nlt... | [
"neuralcorefres.model.coreference_network.CoreferenceNetwork.custom_cluster_to_nn_input",
"neuralcorefres.parsedata.preco_parser.PreCoParser.get_preco_data",
"neuralcorefres.parsedata.preco_parser.PreCoParser.prep_for_nn",
"pprint.pprint",
"neuralcorefres.model.cluster_network.ClusterNetwork",
"neuralcore... | [((1168, 1190), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {}), '()\n', (1188, 1190), False, 'import pprint\n'), ((1804, 1822), 'neuralcorefres.feature_extraction.gender_classifier.GenderClassifier', 'GenderClassifier', ([], {}), '()\n', (1820, 1822), False, 'from neuralcorefres.feature_extraction.gender_clas... |
import numpy as np
import sys
import random
import os
import time
import argparse
import glob
import matplotlib.pyplot as plt
from functools import partial
try:
from mayavi import mlab as mayalab
except:
pass
np.random.seed(2)
# from contact_point_dataset_torch_multi_label import MyDataset
from hang_dataset impor... | [
"numpy.mean",
"argparse.ArgumentParser",
"numpy.std",
"os.path.join",
"simple_dataset.MyDataset",
"numpy.max",
"numpy.array",
"numpy.random.seed",
"numpy.expand_dims",
"numpy.min",
"os.path.abspath",
"numpy.load",
"sys.path.append"
] | [((213, 230), 'numpy.random.seed', 'np.random.seed', (['(2)'], {}), '(2)\n', (227, 230), True, 'import numpy as np\n'), ((455, 481), 'sys.path.append', 'sys.path.append', (['UTILS_DIR'], {}), '(UTILS_DIR)\n', (470, 481), False, 'import sys\n'), ((361, 386), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__... |