code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import threading
import settings as s
from collections import namedtuple, deque
from api.actions import Actions
from analytics_frame import Analytics
from api.agent_analytics_frame import AgentAnalyticsFrameAPI
import random
import math
import copy
from sklearn.preprocessing import MinMaxScaler
import numpy as np
imp... | [
"math.exp",
"random.sample",
"collections.namedtuple",
"collections.deque",
"torch.nn.Tanh",
"torch.autograd.set_detect_anomaly",
"torch.Tensor",
"torch.tensor",
"torch.no_grad",
"numpy.array",
"torch.nn.Linear",
"threading.Thread",
"random.random",
"sklearn.preprocessing.MinMaxScaler",
... | [((422, 441), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (434, 441), False, 'import torch\n'), ((501, 586), 'collections.namedtuple', 'namedtuple', (['"""Experience"""'], {'field_names': "['state', 'action', 'reward', 'next_state']"}), "('Experience', field_names=['state', 'action', 'reward',\n ... |
from pprint import pprint
from webapp.api.wsgi import app
import abc
import json
import requests
import unittest
__all__ = ['BaseAPITest']
def get_endpoint_name(url):
with app.test_request_context(url) as request_ctx:
url_rule = request_ctx.request.url_rule
if url_rule is None:
return 'Unkno... | [
"webapp.api.wsgi.app.test_request_context",
"json.loads",
"requests.Session",
"json.dumps",
"pprint.pprint"
] | [((477, 495), 'requests.Session', 'requests.Session', ([], {}), '()\n', (493, 495), False, 'import requests\n'), ((179, 208), 'webapp.api.wsgi.app.test_request_context', 'app.test_request_context', (['url'], {}), '(url)\n', (203, 208), False, 'from webapp.api.wsgi import app\n'), ((2973, 2994), 'pprint.pprint', 'pprint... |
#!/usr/bin/env python3
from imutils.video import VideoStream
import cv2
import argparse
import imutils
import time
import sys
import socket
import imagezmq
from math import acos, pi, cos, asin, sin, sqrt
from threading import Thread
import robot_controller
import asyncio
import numpy as np
iter_count = 0
dist_1 = 0
... | [
"math.acos",
"time.sleep",
"math.cos",
"numpy.reshape",
"imutils.video.VideoStream",
"argparse.ArgumentParser",
"cv2.line",
"cv2.aruco.Dictionary_get",
"asyncio.sleep",
"socket.gethostname",
"imagezmq.ImageSender",
"cv2.aruco.detectMarkers",
"cv2.aruco.DetectorParameters_create",
"cv2.circ... | [((8941, 8996), 'imagezmq.ImageSender', 'imagezmq.ImageSender', ([], {'connect_to': '"""tcp://localhost:5555"""'}), "(connect_to='tcp://localhost:5555')\n", (8961, 8996), False, 'import imagezmq\n'), ((9010, 9030), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (9028, 9030), False, 'import socket\n'), ((... |
"""Checks whether Control Plane logging is enabled for an EKS cluster"""
import os
import boto3
from botocore.exceptions import ClientError
from datetime import datetime, timedelta
import traceback
import logging
import json
from dateutil.tz import tzlocal
sqs_queue_url = os.environ["sqs_queue_url"]
logger = logging... | [
"logging.getLogger",
"logging.basicConfig",
"json.loads",
"boto3.client",
"json.dumps",
"logging.info",
"logging.error"
] | [((313, 332), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (330, 332), False, 'import logging\n'), ((363, 517), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s %(threadName)s [%(filename)s:%(lineno)d] %(message)s"""', 'datefmt': '"""%Y-%m-%d:%H:%M:%S"""', 'level': 'logging... |
#!/usr/bin/env %python
import re
import sys
import argparse
""" Regex matching the start of a non-function doc block /** """
RE_BLOCK_START = re.compile(r"^\s*/\*\*")
""" Regex matching the end of a doc block """
RE_BLOCK_END = re.compile(r"^\s*\*/")
def remove_line_comments(x):
return re.sub('(#|//).*$', '', x)
... | [
"re.sub",
"argparse.FileType",
"argparse.ArgumentParser",
"re.compile"
] | [((143, 169), 're.compile', 're.compile', (['"""^\\\\s*/\\\\*\\\\*"""'], {}), "('^\\\\s*/\\\\*\\\\*')\n", (153, 169), False, 'import re\n'), ((229, 252), 're.compile', 're.compile', (['"""^\\\\s*\\\\*/"""'], {}), "('^\\\\s*\\\\*/')\n", (239, 252), False, 'import re\n'), ((293, 319), 're.sub', 're.sub', (['"""(#|//).*$"... |
from Gato import Gato
from Perro import Perro
from Pajaro import Pajaro
class Factory:
@staticmethod
def creadorDeAnimales(type):
if type == "Perro":
return Perro()
elif type == "Gato":
return Gato()
elif type == "Pajaro":
return Pajaro()
els... | [
"Pajaro.Pajaro",
"Perro.Perro",
"Gato.Gato"
] | [((187, 194), 'Perro.Perro', 'Perro', ([], {}), '()\n', (192, 194), False, 'from Perro import Perro\n'), ((243, 249), 'Gato.Gato', 'Gato', ([], {}), '()\n', (247, 249), False, 'from Gato import Gato\n'), ((300, 308), 'Pajaro.Pajaro', 'Pajaro', ([], {}), '()\n', (306, 308), False, 'from Pajaro import Pajaro\n')] |
# add system path
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from backend_app.api import app
if __name__ == "__main__":
app.run(debug=True, port=5001)
| [
"os.path.dirname",
"backend_app.api.app.run"
] | [((165, 195), 'backend_app.api.app.run', 'app.run', ([], {'debug': '(True)', 'port': '(5001)'}), '(debug=True, port=5001)\n', (172, 195), False, 'from backend_app.api import app\n'), ((71, 96), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (86, 96), False, 'import os\n')] |
from copy import copy
from django.conf.urls import url
from django.urls import reverse
from .. import Event, Task, mixins
from ..activation import StartActivation, ViewActivation, STATUS
class BaseStart(mixins.TaskDescriptionViewMixin,
mixins.NextNodeMixin,
mixins.ActivateNextMixin,
... | [
"django.contrib.auth.get_user_model",
"copy.copy",
"django.urls.reverse"
] | [((6296, 6306), 'copy.copy', 'copy', (['self'], {}), '(self)\n', (6300, 6306), False, 'from copy import copy\n'), ((2749, 2766), 'django.urls.reverse', 'reverse', (['url_name'], {}), '(url_name)\n', (2756, 2766), False, 'from django.urls import reverse\n'), ((7918, 7995), 'django.urls.reverse', 'reverse', (['url_name']... |
"""
Main entry point of zserio pip module.
"""
import sys
import zserio.compiler
def main() -> int:
"""
Main entry point of zserio pip module.
This method envokes zserio compilers. It is called if zserio pip module is called on the command line
(using 'python3 -m zserio').
:returns: Exit value ... | [
"sys.exit"
] | [((434, 472), 'sys.exit', 'sys.exit', (['completed_process.returncode'], {}), '(completed_process.returncode)\n', (442, 472), False, 'import sys\n')] |
#%%
import datetime
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from graspologic.embed import AdjacencySpectralEmbed
from pkg.data import load_split_connectome
from pkg.io import OUT_PATH
from pkg.io import glue as default_glue
from pkg.io import savefig
fro... | [
"numpy.random.default_rng",
"numpy.log",
"matplotlib.pyplot.autoscale",
"datetime.timedelta",
"numpy.arange",
"matplotlib.pyplot.close",
"numpy.concatenate",
"pandas.DataFrame",
"numpy.tril_indices_from",
"graspologic.embed.AdjacencySpectralEmbed",
"pkg.io.glue",
"numpy.triu_indices_from",
"... | [((725, 736), 'time.time', 'time.time', ([], {}), '()\n', (734, 736), False, 'import time\n'), ((743, 770), 'numpy.random.default_rng', 'np.random.default_rng', (['(8888)'], {}), '(8888)\n', (764, 770), True, 'import numpy as np\n'), ((815, 860), 'pkg.data.load_split_connectome', 'load_split_connectome', (['dataset'], ... |
# flake8: noqa
import os
import sys
sys.path.insert(0, os.path.abspath("../.."))
# -- Project information -----------------------------------------------------
import caldera as pkg
from caldera.utils import deterministic_seed
deterministic_seed(0)
import datetime
now = datetime.datetime.now()
project = pkg.__tit... | [
"sphinx_bootstrap_theme.get_html_theme_path",
"caldera.__title__.capitalize",
"datetime.datetime.now",
"caldera.utils.deterministic_seed",
"os.path.abspath"
] | [((231, 252), 'caldera.utils.deterministic_seed', 'deterministic_seed', (['(0)'], {}), '(0)\n', (249, 252), False, 'from caldera.utils import deterministic_seed\n'), ((277, 300), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (298, 300), False, 'import datetime\n'), ((2239, 2283), 'sphinx_bootstrap... |
import uuid
import os
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin
from django.conf import settings
def profile_image_save_path(instance, fileName):
extension = fileName.split('.')[-1]
filename = f'{uuid.uuid4()}.{extension}'
retu... | [
"django.db.models.EmailField",
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"os.path.join",
"django.db.models.BooleanField",
"uuid.uuid4",
"django.db.models.ImageField",
"django.db.models.CharField"
] | [((323, 363), 'os.path.join', 'os.path.join', (['"""profile_image/"""', 'filename'], {}), "('profile_image/', filename)\n", (335, 363), False, 'import os\n'), ((516, 559), 'os.path.join', 'os.path.join', (['"""background_image/"""', 'filename'], {}), "('background_image/', filename)\n", (528, 559), False, 'import os\n'... |
import random
import matplotlib.pyplot as plt
account = 0
x=[]
y=[]
for i in range(365):
x.append(i+1)
bet= random.randint(1,10)
lucky_draw=random.randint(1,10)
#print("Bet:",bet)
#print("Lucky draw:",lucky_draw)
if bet == lucky_draw:
account=account+900-100
else:
... | [
"matplotlib.pyplot.plot",
"random.randint",
"matplotlib.pyplot.show"
] | [((420, 434), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {}), '(x, y)\n', (428, 434), True, 'import matplotlib.pyplot as plt\n'), ((435, 445), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (443, 445), True, 'import matplotlib.pyplot as plt\n'), ((125, 146), 'random.randint', 'random.randint', (['(1)',... |
import EasyPySpin
import cv2
NUM_IMAGES = 10
def main():
cap0 = EasyPySpin.VideoCapture(0)
cap1 = EasyPySpin.VideoCapture(1)
for n in range(NUM_IMAGES):
ret0, frame0 = cap0.read()
ret1, frame1 = cap1.read()
filename0 = "multiple-{0}-{1}.png".format(n, 0)
filename1 = "... | [
"cv2.imwrite",
"EasyPySpin.VideoCapture"
] | [((70, 96), 'EasyPySpin.VideoCapture', 'EasyPySpin.VideoCapture', (['(0)'], {}), '(0)\n', (93, 96), False, 'import EasyPySpin\n'), ((108, 134), 'EasyPySpin.VideoCapture', 'EasyPySpin.VideoCapture', (['(1)'], {}), '(1)\n', (131, 134), False, 'import EasyPySpin\n'), ((363, 393), 'cv2.imwrite', 'cv2.imwrite', (['filename0... |
# Generated by Django 2.2.5 on 2019-10-16 18:33
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import tinymce.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('wi... | [
"django.db.migrations.swappable_dependency",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((249, 306), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (280, 306), False, 'from django.db import migrations, models\n'), ((488, 617), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'default': '(1)', 'on... |
import sqlite3
from transformers.transformer import Transformer
from openapi_server.models.compound_info import CompoundInfo
from openapi_server.models.compound_info_identifiers import CompoundInfoIdentifiers
from openapi_server.models.names import Names
from openapi_server.models.attribute import Attribute
from opena... | [
"sqlite3.connect",
"openapi_server.models.attribute.Attribute",
"openapi_server.models.compound_info_identifiers.CompoundInfoIdentifiers",
"openapi_server.models.compound_info_structure.CompoundInfoStructure",
"openapi_server.models.names.Names"
] | [((2015, 2077), 'sqlite3.connect', 'sqlite3.connect', (['"""DrugCentral.sqlite"""'], {'check_same_thread': '(False)'}), "('DrugCentral.sqlite', check_same_thread=False)\n", (2030, 2077), False, 'import sqlite3\n'), ((1408, 1478), 'openapi_server.models.compound_info_identifiers.CompoundInfoIdentifiers', 'CompoundInfoId... |
import unittest
from collections import namedtuple
import src.replay_memory
class TestReplayMemoryPusher(unittest.TestCase):
def setUp(self):
self.test_type = namedtuple('Test', ('value'))
def test_push_to_capacity(self):
replay_memory = []
capacity = 5
pusher = src.replay_mem... | [
"collections.namedtuple"
] | [((173, 200), 'collections.namedtuple', 'namedtuple', (['"""Test"""', '"""value"""'], {}), "('Test', 'value')\n", (183, 200), False, 'from collections import namedtuple\n')] |
"""
In this file you can see examples of how to process the tweets that have been tracked and stored in a file.
Also in this case, you should try to understand the code and, most importantly, how you can reuse it in your implementation.
Note that the Twitter "stream" listener stores tweets in the JSON format. JSON is ... | [
"json.loads"
] | [((1257, 1273), 'json.loads', 'json.loads', (['line'], {}), '(line)\n', (1267, 1273), False, 'import json\n')] |
"""
Copyright (c) 2019 razaqq
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, sublice... | [
"PyQt5.QtGui.QFont"
] | [((1328, 1363), 'PyQt5.QtGui.QFont', 'QFont', (['"""Segoe UI"""', 'size', 'QFont.Bold'], {}), "('Segoe UI', size, QFont.Bold)\n", (1333, 1363), False, 'from PyQt5.QtGui import QFont\n'), ((1404, 1427), 'PyQt5.QtGui.QFont', 'QFont', (['"""Segoe UI"""', 'size'], {}), "('Segoe UI', size)\n", (1409, 1427), False, 'from PyQ... |
import mlflow
from mlflow.tracking import MlflowClient
import joblib
import importlib
from pathlib import Path
from src.model.nn import nn
from src.data.dataset import inputDataset
class Model:
# Model class is the main abstraction that interfaces with the API.
# All future models should match the methods ... | [
"pathlib.Path",
"src.data.dataset.inputDataset",
"src.model.nn.nn",
"joblib.load",
"mlflow.start_run",
"mlflow.log_metrics"
] | [((497, 514), 'src.model.nn.nn', 'nn', (['self.n_inputs'], {}), '(self.n_inputs)\n', (499, 514), False, 'from src.model.nn import nn\n'), ((2022, 2040), 'mlflow.start_run', 'mlflow.start_run', ([], {}), '()\n', (2038, 2040), False, 'import mlflow\n'), ((2209, 2242), 'mlflow.log_metrics', 'mlflow.log_metrics', (['model.... |
#!/usr/bin/env python
# coding: utf-8
# @Author: lapis-hong
# @Date : 2018/8/13
"""This module implements abstract model class for Knowledge-Graph-Embedding models."""
import abc
import math
from functools import reduce
import tensorflow as tf
from kge.model_utils import get_optimizer_instance
class BaseModel(objec... | [
"tensorflow.nn.embedding_lookup",
"tensorflow.summary.merge_all",
"tensorflow.variable_scope",
"tensorflow.Variable",
"tensorflow.nn.l2_normalize",
"tensorflow.train.Saver",
"math.sqrt",
"tensorflow.summary.histogram",
"tensorflow.trainable_variables",
"tensorflow.name_scope",
"kge.model_utils.g... | [((3859, 3883), 'tensorflow.trainable_variables', 'tf.trainable_variables', ([], {}), '()\n', (3881, 3883), True, 'import tensorflow as tf\n'), ((4358, 4374), 'tensorflow.train.Saver', 'tf.train.Saver', ([], {}), '()\n', (4372, 4374), True, 'import tensorflow as tf\n'), ((1013, 1063), 'tensorflow.variable_scope', 'tf.v... |
# Copyright (c) 2014-present PlatformIO <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"tarfile.open",
"platformio.compat.get_object_members",
"os.path.basename"
] | [((899, 922), 'platformio.compat.get_object_members', 'get_object_members', (['cls'], {}), '(cls)\n', (917, 922), False, 'from platformio.compat import get_object_members, string_types\n'), ((4956, 4977), 'os.path.basename', 'os.path.basename', (['url'], {}), '(url)\n', (4972, 4977), False, 'import os\n'), ((1453, 1484... |
from random import randint
from retrying import retry
import apysc as ap
from apysc._display.y_interface import YInterface
from apysc._type.variable_name_interface import VariableNameInterface
from tests.testing_helper import assert_attrs
class TestAnimationY:
@retry(stop_max_attempt_number=15, wai... | [
"tests.testing_helper.assert_attrs",
"apysc.AnimationY",
"apysc._display.y_interface.YInterface",
"apysc._type.variable_name_interface.VariableNameInterface",
"random.randint"
] | [((426, 449), 'apysc._type.variable_name_interface.VariableNameInterface', 'VariableNameInterface', ([], {}), '()\n', (447, 449), False, 'from apysc._type.variable_name_interface import VariableNameInterface\n'), ((539, 639), 'apysc.AnimationY', 'ap.AnimationY', ([], {'target': 'target', 'y': '(100)', 'duration': '(200... |
import pytest
import falcon
import json
from unittest.mock import patch, Mock, MagicMock
from history.api.models import STHHistory, DeviceHistory
class TestSTHH:
@patch('pymongo.collection.Collection')
@patch('history.api.models.HistoryUtil.get_collection')
@patch('history.api.models.DeviceHistory.parse_r... | [
"history.api.models.STHHistory.on_get",
"unittest.mock.MagicMock",
"unittest.mock.patch",
"falcon.Response"
] | [((169, 207), 'unittest.mock.patch', 'patch', (['"""pymongo.collection.Collection"""'], {}), "('pymongo.collection.Collection')\n", (174, 207), False, 'from unittest.mock import patch, Mock, MagicMock\n'), ((213, 267), 'unittest.mock.patch', 'patch', (['"""history.api.models.HistoryUtil.get_collection"""'], {}), "('his... |
import setuptools
setuptools.setup(
name="src",
version="",
author="",
author_email="",
description="",
url="",
packages=setuptools.find_packages(),
install_requires=[],
) | [
"setuptools.find_packages"
] | [((150, 176), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (174, 176), False, 'import setuptools\n')] |
"""
Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
WSO2 Inc. licenses this file to you 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/LIC... | [
"numpy.copy",
"pyro.infer.Trace_ELBO",
"numpy.diag",
"torch.is_tensor",
"torch.tensor",
"pyro.set_rng_seed",
"numpy.random.seed",
"torch.no_grad",
"pyro.__version__.startswith"
] | [((736, 772), 'pyro.__version__.startswith', 'pyro.__version__.startswith', (['"""1.0.0"""'], {}), "('1.0.0')\n", (763, 772), False, 'import pyro\n'), ((842, 862), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (856, 862), True, 'import numpy as np\n'), ((863, 886), 'pyro.set_rng_seed', 'pyro.set_rn... |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
# Custom Profile linked to a User
from rooms.models import Org
class Profile(models.Model):
def __str__(self):
return 'Profile: ' + self.user.get_full_name(... | [
"django.db.models.OneToOneField",
"django.db.models.Manager",
"django.db.models.ForeignKey",
"django.dispatch.receiver",
"django.db.models.CharField"
] | [((1613, 1645), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'User'}), '(post_save, sender=User)\n', (1621, 1645), False, 'from django.dispatch import receiver\n'), ((1764, 1796), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'User'}), '(post_save, sender=User)\n', (1772, 1796... |
import pyrebase
import time
firebaseConfig = {
"apiKey": "<KEY>",
"authDomain": "hpc-procect-2021.firebaseapp.com",
"databaseURL": "https://hpc-procect-2021-default-rtdb.firebaseio.com/",
"projectId": "hpc-procect-2021",
"storageBucket": "hpc-procect-2021.appspot.com",
"messagingSenderId": "7162... | [
"pyrebase.initialize_app"
] | [((439, 478), 'pyrebase.initialize_app', 'pyrebase.initialize_app', (['firebaseConfig'], {}), '(firebaseConfig)\n', (462, 478), False, 'import pyrebase\n')] |
#!/usr/bin/env python
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Copies file_manager/main.html to file_manager/test.html.
Modifies it to be able to run the CrOS FileManager app
as a regular web p... | [
"os.path.dirname",
"os.path.join",
"argparse.ArgumentParser"
] | [((431, 456), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (454, 456), False, 'import argparse\n'), ((578, 612), 'os.path.join', 'os.path.join', (['sys.path[0]', '"""../.."""'], {}), "(sys.path[0], '../..')\n", (590, 612), False, 'import os\n'), ((1017, 1041), 'os.path.join', 'os.path.join', ... |
import numpy as np
from ..rdkit import smiles_list_to_fingerprints, precursors_from_templates
def tanimoto(fp1, fp2):
a = fp1.sum()
b = fp2.sum()
c = float((fp1&fp2).sum())
return c/(a+b-c)
def pairwise_tanimoto(arr1, arr2, metric=tanimoto):
if arr1.size == 0:
return np.array([[]])
ret... | [
"numpy.argsort",
"numpy.array",
"numpy.fill_diagonal"
] | [((627, 662), 'numpy.fill_diagonal', 'np.fill_diagonal', (['diversity', 'np.nan'], {}), '(diversity, np.nan)\n', (643, 662), True, 'import numpy as np\n'), ((298, 312), 'numpy.array', 'np.array', (['[[]]'], {}), '([[]])\n', (306, 312), True, 'import numpy as np\n'), ((970, 987), 'numpy.argsort', 'np.argsort', (['(-pred... |
from app import app
from flask import render_template
from .request import get_newss
@app.route('/')
def index():
items = get_newss('sources')
title = 'Top Headlines'
return render_template('index.html',title = title,sources=items)
| [
"flask.render_template",
"app.app.route"
] | [((89, 103), 'app.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (98, 103), False, 'from app import app\n'), ((191, 248), 'flask.render_template', 'render_template', (['"""index.html"""'], {'title': 'title', 'sources': 'items'}), "('index.html', title=title, sources=items)\n", (206, 248), False, 'from flask imp... |
#!/usr/bin/env python
import numpy as np
from os import path
def createSourceString(config, energy, angle):
'''Creates a source file from a configurator object and a specific
angle and energy.
config: the .yaml file used
energy:
angle:
'''
from utils import getFilenameFromDetails
... | [
"numpy.log10",
"os.path.expandvars",
"yaml.load",
"numpy.linspace",
"numpy.rad2deg",
"utils.getFilenameFromDetails"
] | [((330, 422), 'utils.getFilenameFromDetails', 'getFilenameFromDetails', (["{'base': config['run']['basename'], 'keV': energy, 'Cos': angle}"], {}), "({'base': config['run']['basename'], 'keV': energy,\n 'Cos': angle})\n", (352, 422), False, 'from utils import getFilenameFromDetails\n'), ((2578, 2703), 'numpy.linspac... |
#gives the right answer in the end but because of the sqrt() rounding it is off by one before correction
import math
def isprime(number):
for i in range(2, int(math.ceil(math.sqrt(number)))):
if number % i == 0:
return False
return True
i = 2
prime_count = 0
while True:
i... | [
"math.sqrt"
] | [((181, 198), 'math.sqrt', 'math.sqrt', (['number'], {}), '(number)\n', (190, 198), False, 'import math\n')] |
import argparse
from numpy.core.fromnumeric import shape
from tool.torch_utils import do_detect
import torch
import torch.backends.cudnn as cudnn
from tool.darknet2pytorch import Darknet
import timeit, time
import os
import numpy as np
import cv2
import json
import random
FRAME_SIZES = [64, 96, 128, 160, 192, 224, ... | [
"tool.darknet2pytorch.Darknet",
"numpy.array",
"torch.cuda.synchronize",
"argparse.ArgumentParser",
"time.perf_counter",
"numpy.random.seed",
"numpy.fromstring",
"random.randint",
"tool.torch_utils.do_detect",
"cv2.resize",
"torch.cuda.set_device",
"torch.cuda.manual_seed_all",
"torch.manual... | [((459, 482), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (476, 482), False, 'import torch\n'), ((487, 519), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['seed'], {}), '(seed)\n', (513, 519), False, 'import torch\n'), ((609, 629), 'numpy.random.seed', 'np.random.seed', (['seed... |
import cv2 as cv
import numpy as np
from ray.tune import registry
try:
from envs.procgen_env_wrapper import ProcgenEnvWrapper
except ModuleNotFoundError:
from custom.envs.procgen_env_wrapper import ProcgenEnvWrapper
class ZoomInEnvWrapper(ProcgenEnvWrapper):
def __init__(self, config, factor=1.5):
... | [
"cv2.resize"
] | [((780, 823), 'cv2.resize', 'cv.resize', (['zoomed_in', 'observation.shape[:2]'], {}), '(zoomed_in, observation.shape[:2])\n', (789, 823), True, 'import cv2 as cv\n')] |
import pymysql,requests
def my_db(msg):
conn = pymysql.Connect(
host='192.168.3.11',##mysql服务器地址
port=3306,##mysql服务器端口号
user='yhj666',##用户名
passwd='<PASSWORD>',##密码 <PASSWORD>";~OVazNl%y)?
db='yhj666',##数据库名
charset='utf8',##连接编码
)
sq1 = 'SELECT * FROM cityi... | [
"pymysql.Connect",
"requests.get"
] | [((51, 168), 'pymysql.Connect', 'pymysql.Connect', ([], {'host': '"""192.168.3.11"""', 'port': '(3306)', 'user': '"""yhj666"""', 'passwd': '"""<PASSWORD>"""', 'db': '"""yhj666"""', 'charset': '"""utf8"""'}), "(host='192.168.3.11', port=3306, user='yhj666', passwd=\n '<PASSWORD>', db='yhj666', charset='utf8')\n", (66... |
import numpy as np
from Utils.Data.DatasetUtils import is_test_or_val_set, get_train_set_id_from_test_or_val_set, \
get_test_or_val_set_id_from_train
from Utils.Data.Features.Generated.TweetFeature.IsEngagementType import *
from Utils.Data.Features.MappedFeatures import MappedFeatureEngagerId, MappedFeatureCreator... | [
"Utils.Data.DatasetUtils.is_test_or_val_set",
"Utils.Data.DatasetUtils.get_train_set_id_from_test_or_val_set",
"Utils.Data.DatasetUtils.get_test_or_val_set_id_from_train",
"Utils.Data.Features.MappedFeatures.MappedFeatureCreatorId",
"Utils.Data.Features.MappedFeatures.MappedFeatureEngagerId",
"Utils.Data.... | [((1741, 1776), 'Utils.Data.DatasetUtils.is_test_or_val_set', 'is_test_or_val_set', (['self.dataset_id'], {}), '(self.dataset_id)\n', (1759, 1776), False, 'from Utils.Data.DatasetUtils import is_test_or_val_set, get_train_set_id_from_test_or_val_set, get_test_or_val_set_id_from_train\n'), ((2185, 2225), 'Utils.Data.Fea... |
from math import isclose
from pandac.PandaModules import ConfigVariableString # pylint: disable=no-name-in-module
from adam.visualization.panda3d_interface import SituationVisualizer
from adam.visualization.utils import Shape
# sets the rendering engine to not run, as it can't be handled by CI system
ConfigVariableS... | [
"pandac.PandaModules.ConfigVariableString",
"math.isclose",
"adam.visualization.panda3d_interface.SituationVisualizer"
] | [((475, 496), 'adam.visualization.panda3d_interface.SituationVisualizer', 'SituationVisualizer', ([], {}), '()\n', (494, 496), False, 'from adam.visualization.panda3d_interface import SituationVisualizer\n'), ((616, 676), 'math.isclose', 'isclose', (['model_scales[Shape.SQUARE.name][0]', '(1)'], {'rel_tol': '(0.05)'}),... |
import math
import os
import re
import itertools
import matplotlib.cbook as cbook
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib.font_manager import FontProperties
from scipy import stats
plot_markers = ('D', 'o', '^', 's', 'p', 'd', 'h', '8', r... | [
"matplotlib.pyplot.boxplot",
"matplotlib.pyplot.ylabel",
"matplotlib.cbook.boxplot_stats",
"numpy.array",
"numpy.isfinite",
"scipy.stats.sem",
"matplotlib.pyplot.errorbar",
"numpy.mean",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.yscale",
"itertools.cycle",
"matplotlib.pyplot.gcf",
"os.p... | [((4032, 4057), 'matplotlib.cbook.boxplot_stats', 'cbook.boxplot_stats', (['data'], {}), '(data)\n', (4051, 4057), True, 'import matplotlib.cbook as cbook\n'), ((4309, 4342), 'numpy.array', 'np.array', (['confidence_intervals[0]'], {}), '(confidence_intervals[0])\n', (4317, 4342), True, 'import numpy as np\n'), ((4373,... |
#!/usr/bin/env python
# pylint: disable=C0111, C0325
import logging
import sys
import tempfile
from pprint import pprint
from cutlass import Proteome
from cutlass import iHMPSession
username = "test"
password = "<PASSWORD>"
def set_logging():
""" Setup logging. """
root = logging.getLogger()
root.setLev... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.Formatter",
"cutlass.Proteome",
"cutlass.iHMPSession",
"tempfile.NamedTemporaryFile",
"cutlass.Proteome.load",
"pprint.pprint",
"cutlass.Proteome.required_fields"
] | [((583, 614), 'cutlass.iHMPSession', 'iHMPSession', (['username', 'password'], {}), '(username, password)\n', (594, 614), False, 'from cutlass import iHMPSession\n'), ((689, 699), 'cutlass.Proteome', 'Proteome', ([], {}), '()\n', (697, 699), False, 'from cutlass import Proteome\n'), ((285, 304), 'logging.getLogger', 'l... |
from job.nclimber import NClimber
from math import ceil
from multiprocessing.context import Process
from behavior.oscillator import Oscillator
from multiprocessing import Pool
from util.run import Run
from numpy import floor
import wandb
from job.learner import Learner
from rl_ctrnn.ctrnn import Ctrnn
import itertools
... | [
"job.learner.Learner",
"numpy.power",
"itertools.product",
"numpy.floor",
"behavior.oscillator.Oscillator",
"rl_ctrnn.ctrnn.Ctrnn.from_dict",
"multiprocessing.context.Process",
"job.nclimber.NClimber",
"random.randint"
] | [((412, 442), 'random.randint', 'random.randint', (['(100000)', '(999999)'], {}), '(100000, 999999)\n', (426, 442), False, 'import random\n'), ((483, 730), 'rl_ctrnn.ctrnn.Ctrnn.from_dict', 'Ctrnn.from_dict', (["{'time_constants': {(0): 1.0, (1): 1.0}, 'biases': {(0): 5.154455202973727,\n (1): -10.756384207938911}, ... |
# -*- coding: utf-8 -*-
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Copyright 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/li... | [
"snap_plugin.v1.namespace_element.NamespaceElement.static_namespace_element",
"snap_plugin.v1.namespace_element.NamespaceElement.dynamic_namespace_element",
"snap_plugin.v1.plugin_pb2.Metric"
] | [((1362, 1411), 'snap_plugin.v1.namespace_element.NamespaceElement.static_namespace_element', 'NamespaceElement.static_namespace_element', (['"""runc"""'], {}), "('runc')\n", (1403, 1411), False, 'from snap_plugin.v1.namespace_element import NamespaceElement\n'), ((1421, 1478), 'snap_plugin.v1.namespace_element.Namespa... |
from logging import exception
from os import read
from unittest.case import TestCase
import json, unittest, sys
from user_agents import parse
import application.analysis.views_by_location as vbl
import application.analysis.views_by_browser as vbb
import application.analysis.reader_profiles as rp
import application.ana... | [
"application.analysis.also_likes.also_likes",
"unittest.TestSuite",
"json.loads",
"application.analysis.views_by_browser.views_by_browser",
"application.analysis.reader_profiles.reader_profiles",
"unittest.TextTestRunner",
"unittest.TestLoader",
"application.analysis.views_by_location.views_by_locatio... | [((365, 388), 'application.analysis.views_by_location.views_by_location', 'vbl.views_by_location', ([], {}), '()\n', (386, 388), True, 'import application.analysis.views_by_location as vbl\n'), ((408, 430), 'application.analysis.views_by_browser.views_by_browser', 'vbb.views_by_browser', ([], {}), '()\n', (428, 430), T... |
import vaex
import pytest
fs_options = {'anonymous': 'true'}
@pytest.mark.skipif(vaex.utils.devmode, reason='runs too slow when developing')
@pytest.mark.parametrize("base_url", ["gs://vaex-data", "s3://vaex"])
@pytest.mark.parametrize("cache", ["true", "false"])
def test_cloud_dataset_basics(base_url, cache):
d... | [
"pytest.mark.parametrize",
"vaex.open",
"vaex.file.glob",
"pytest.mark.skipif"
] | [((65, 143), 'pytest.mark.skipif', 'pytest.mark.skipif', (['vaex.utils.devmode'], {'reason': '"""runs too slow when developing"""'}), "(vaex.utils.devmode, reason='runs too slow when developing')\n", (83, 143), False, 'import pytest\n'), ((145, 213), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""base_url"... |
from django.db import models
import datetime as dt
from django.contrib.auth.models import User
from django.urls import reverse
#from tinymce.models import HTMLField
#from django.conf import settings
class Pic(models.Model):
pic = models.ImageField(upload_to='media')
user = models.ForeignKey(User, null=True)
... | [
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.db.models.ImageField",
"django.db.models.CharField"
] | [((236, 272), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""media"""'}), "(upload_to='media')\n", (253, 272), False, 'from django.db import models\n'), ((284, 318), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'null': '(True)'}), '(User, null=True)\n', (301, 318), False, ... |
###
# Copyright (c) 2013 <NAME> <<EMAIL>>
#
# rabbitmq-greenplum-loader is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.
###
from multiprocessing import Process
import logging
import uuid
from loader import load_data_file
class Consumer():... | [
"logging.log",
"multiprocessing.Process",
"uuid.uuid4"
] | [((524, 584), 'logging.log', 'logging.log', (['logging.INFO', '"""[c]: Greenplum consumer started"""'], {}), "(logging.INFO, '[c]: Greenplum consumer started')\n", (535, 584), False, 'import logging\n'), ((685, 744), 'logging.log', 'logging.log', (['logging.INFO', '"""[c]: Flushing in process loads"""'], {}), "(logging... |
from openpyxl import load_workbook, Workbook
from openpyxl.utils import get_column_letter
wb = load_workbook('Myname.xlsx')
ws = wb.active
ws.move_range('C1:D11', rows=2, cols=2)
wb.save('Myname.xlsx')
| [
"openpyxl.load_workbook"
] | [((95, 123), 'openpyxl.load_workbook', 'load_workbook', (['"""Myname.xlsx"""'], {}), "('Myname.xlsx')\n", (108, 123), False, 'from openpyxl import load_workbook, Workbook\n')] |
#idea: build an app to sign up for tests that takes 5 inputs: first name, last name, email,student ID, and a dropdown menu to select which test they are signing up for and when a button is pressed all of the information is stored in a table and all fields are wiped
#download pgAdmin?
import tkinter as tk
from tkinte... | [
"tkinter.messagebox.showerror",
"tkinter.Button",
"tkinter.Tk",
"tkinter.Label",
"tkinter.Text"
] | [((405, 412), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (410, 412), True, 'import tkinter as tk\n'), ((1163, 1204), 'tkinter.Label', 'tk.Label', (['win'], {'text': '"""Sign up for the ACT"""'}), "(win, text='Sign up for the ACT')\n", (1171, 1204), True, 'import tkinter as tk\n'), ((1355, 1396), 'tkinter.Label', 'tk.Labe... |
import uuid
class ScenarioEvent():
"""
To serialize/deserialize with json
"""
def __init__(self, **kwargs):
if kwargs:
self.__dict__ = kwargs
return
self.guid = uuid.uuid4().hex
self.time = None
self.commandname = "wait"
self.arguments = ... | [
"uuid.uuid4"
] | [((219, 231), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (229, 231), False, 'import uuid\n')] |
from systems.commands.index import Command
class Abort(Command('log.abort')):
def exec(self):
def abort_command(log_key):
self.publish_abort(log_key)
self.wait_for_tasks(log_key)
self.success("Task {} successfully aborted".format(log_key))
self.run_list(self.l... | [
"systems.commands.index.Command"
] | [((57, 77), 'systems.commands.index.Command', 'Command', (['"""log.abort"""'], {}), "('log.abort')\n", (64, 77), False, 'from systems.commands.index import Command\n')] |
from moto import mock_lambda, mock_logs
from newrelic_lambda_cli.cli import cli, register_groups
@mock_lambda
@mock_logs
def test_subscriptions_install(aws_credentials, cli_runner):
"""
Assert that 'newrelic-lambda subscriptions install' attempts to install the
New Relic log subscription on a function.
... | [
"newrelic_lambda_cli.cli.register_groups"
] | [((331, 351), 'newrelic_lambda_cli.cli.register_groups', 'register_groups', (['cli'], {}), '(cli)\n', (346, 351), False, 'from newrelic_lambda_cli.cli import cli, register_groups\n'), ((2029, 2049), 'newrelic_lambda_cli.cli.register_groups', 'register_groups', (['cli'], {}), '(cli)\n', (2044, 2049), False, 'from newrel... |
import requests
import json
import datetime
url = "http://api-gateway-dbs-techtrek.ap-southeast-1.elasticbeanstalk.com/transactions/10"
querystring = {"from":"01-01-2019","to":"01-31-2019"}
payload = ""
headers = {
'identity': "Group11",
'token': "<PASSWORD>",
'cache-control': "no-cache",
'Postman-To... | [
"json.loads",
"requests.request"
] | [((357, 436), 'requests.request', 'requests.request', (['"""GET"""', 'url'], {'data': 'payload', 'headers': 'headers', 'params': 'querystring'}), "('GET', url, data=payload, headers=headers, params=querystring)\n", (373, 436), False, 'import requests\n'), ((477, 498), 'json.loads', 'json.loads', (['json_data'], {}), '(... |
from __future__ import annotations
from collections import ChainMap
from typing import Any, Callable, Dict, Iterable, Tuple, TypeVar, Union
from pykelihood.utils import flatten_dict
_T = TypeVar("_T")
def ensure_parametrized(x: Any, constant=False) -> Parametrized:
if isinstance(x, Parametrized):
retur... | [
"collections.ChainMap",
"typing.TypeVar"
] | [((190, 203), 'typing.TypeVar', 'TypeVar', (['"""_T"""'], {}), "('_T')\n", (197, 203), False, 'from typing import Any, Callable, Dict, Iterable, Tuple, TypeVar, Union\n'), ((3591, 3628), 'collections.ChainMap', 'ChainMap', (['new_params', 'self.param_dict'], {}), '(new_params, self.param_dict)\n', (3599, 3628), False, ... |
import json
from os import path
from copy import copy
class MNHost:
ID = ""
IP = "127.0.0.1"
ELEM = None
def __init__(self, ID, IP):
self.ID = ID
self.IP = IP
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
class MNSwitch:
ID = ""
ELEM = None
def __in... | [
"os.path.isfile",
"json.load",
"copy.copy"
] | [((1046, 1071), 'os.path.isfile', 'path.isfile', (['jsonFilePath'], {}), '(jsonFilePath)\n', (1057, 1071), False, 'from os import path\n'), ((6242, 6263), 'copy.copy', 'copy', (['connectionsList'], {}), '(connectionsList)\n', (6246, 6263), False, 'from copy import copy\n'), ((1146, 1161), 'json.load', 'json.load', (['d... |
import asyncio
import json
import aiohttp
import yarl
from ..log import logger
from ..tasks import Task
from .endpoints import AbstractCoroutineInputEndpoint, AbstractCoroutineOutputEndpoint
__all__ = ['HTTPInputEndpoint', 'HTTPOutputEndpoint']
class HTTPClient:
def __init__(self, **conf):
self._url = ... | [
"aiohttp.ClientSession",
"yarl.URL",
"asyncio.sleep"
] | [((984, 1056), 'aiohttp.ClientSession', 'aiohttp.ClientSession', ([], {'conn_timeout': 'self._timeout', 'raise_for_status': '(True)'}), '(conn_timeout=self._timeout, raise_for_status=True)\n', (1005, 1056), False, 'import aiohttp\n'), ((1824, 1840), 'asyncio.sleep', 'asyncio.sleep', (['(1)'], {}), '(1)\n', (1837, 1840)... |
from typing import List
import pydantic
from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, status
from sqlalchemy.orm import Session
from app import crud, schemas, models
from app.exceptions import MissionAlreadyAccepted
from app.api.utils.db import get_db
from app.api.utils.security import get_c... | [
"app.crud.get_mission_by_uuid",
"app.crud.create_volunteer",
"app.schemas.VolunteerCreatedResponse",
"fastapi.HTTPException",
"app.schemas.PhoneNumberNeedSMSAuthenticate.description",
"app.crud.get_all_volunteer_mission_statuses",
"app.crud.set_volunteer_whatsapp_subscription",
"fastapi.APIRouter",
... | [((468, 479), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (477, 479), False, 'from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, status\n'), ((1231, 1246), 'fastapi.Depends', 'Depends', (['get_db'], {}), '(get_db)\n', (1238, 1246), False, 'from fastapi import APIRouter, BackgroundTasks, Dep... |
import textwrap
import npyscreen
from sanctum_dnd import resource_manager, character, settings
from sanctum_dnd.ui.cli import stat_box
from sanctum_dnd.utils import columns
class TraitGrid(npyscreen.BoxTitle):
_contained_widget = npyscreen.GridColTitles
class LogEntry(npyscreen.Popup):
DEFAULT_LINES = sett... | [
"sanctum_dnd.resource_manager.get_ability",
"sanctum_dnd.resource_manager.get_effect",
"sanctum_dnd.resource_manager.has_ability",
"sanctum_dnd.resource_manager.get_item",
"sanctum_dnd.character.active_selector",
"textwrap.wrap",
"sanctum_dnd.resource_manager.has_effect",
"sanctum_dnd.resource_manager... | [((665, 705), 'sanctum_dnd.resource_manager.has_item', 'resource_manager.has_item', (['self.log_item'], {}), '(self.log_item)\n', (690, 705), False, 'from sanctum_dnd import resource_manager, character, settings\n'), ((791, 833), 'sanctum_dnd.resource_manager.has_effect', 'resource_manager.has_effect', (['self.log_item... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import json
from requests_oauthlib import OAuth1Session, OAuth2Session, oauth1_session
from oauthlib.oauth2 import BackendApplicationClient
KEYS = {
'consumer_key': os.environ['CONSUMER_KEY'],
'consumer_secret': os.environ['CONSUMER_SECRET'],
'callb... | [
"oauthlib.oauth2.BackendApplicationClient",
"requests_oauthlib.OAuth1Session",
"json.loads",
"requests_oauthlib.OAuth2Session"
] | [((2164, 2353), 'requests_oauthlib.OAuth1Session', 'OAuth1Session', (["KEYS['consumer_key']"], {'client_secret': "KEYS['consumer_secret']", 'resource_owner_key': "access_token['oauth_token']", 'resource_owner_secret': "access_token['oauth_token_secret']"}), "(KEYS['consumer_key'], client_secret=KEYS['consumer_secret'],... |
import torch
import torch.nn as nn
from torch.nn import functional as F
import torch.distributions as distributions
import numpy as np
import math
from ptbaselines.algos.common.torch_utils import init_weight
class Pd(object):
"""
A particular probability distribution
"""
def flatparam(self):
ra... | [
"ptbaselines.algos.common.torch_utils.init_weight",
"torch.distributions.Normal",
"torch.log",
"torch.Tensor",
"torch.exp",
"math.log",
"torch.nn.Linear",
"torch.nn.functional.softmax",
"torch.argmax"
] | [((1874, 1897), 'torch.nn.Linear', 'nn.Linear', (['in_dim', 'ncat'], {}), '(in_dim, ncat)\n', (1883, 1897), True, 'import torch.nn as nn\n'), ((1906, 1949), 'ptbaselines.algos.common.torch_utils.init_weight', 'init_weight', (['self.fc', 'init_scale', 'init_bias'], {}), '(self.fc, init_scale, init_bias)\n', (1917, 1949)... |
from django.contrib import admin
from .models import Cargo, Servico, Funcionario, Feature, Preco
@admin.register(Cargo)
class CargoAdmin(admin.ModelAdmin):
list_display = ('cargo', 'ativo', 'modificado')
@admin.register(Servico)
class ServicoAdmin(admin.ModelAdmin):
list_display = ('servico', 'icone', 'ati... | [
"django.contrib.admin.register"
] | [((101, 122), 'django.contrib.admin.register', 'admin.register', (['Cargo'], {}), '(Cargo)\n', (115, 122), False, 'from django.contrib import admin\n'), ((214, 237), 'django.contrib.admin.register', 'admin.register', (['Servico'], {}), '(Servico)\n', (228, 237), False, 'from django.contrib import admin\n'), ((342, 369)... |
from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Schema
class DateTimeModelMixin(BaseModel):
created_at: Optional[datetime] = Schema(..., alias="createdAt")
updated_at: Optional[datetime] = Schema(..., alias="updatedAt")
class DBModelMixin(DateTimeModelMixin):
... | [
"pydantic.Schema"
] | [((172, 202), 'pydantic.Schema', 'Schema', (['...'], {'alias': '"""createdAt"""'}), "(..., alias='createdAt')\n", (178, 202), False, 'from pydantic import BaseModel, Schema\n'), ((240, 270), 'pydantic.Schema', 'Schema', (['...'], {'alias': '"""updatedAt"""'}), "(..., alias='updatedAt')\n", (246, 270), False, 'from pyda... |
from IntCode import IntCode
prog = [3, 1033, 1008, 1033, 1, 1032, 1005, 1032, 31, 1008, 1033, 2, 1032, 1005, 1032, 58, 1008, 1033, 3, 1032, 1005,
1032, 81, 1008, 1033, 4, 1032, 1005, 1032, 104, 99, 101, 0, 1034, 1039, 102, 1, 1036, 1041, 1001, 1035, -1,
1040, 1008, 1038, 0, 1043, 102, -1, 1043, 1032, ... | [
"IntCode.IntCode"
] | [((5503, 5530), 'IntCode.IntCode', 'IntCode', (['prog'], {'input_val': '[]'}), '(prog, input_val=[])\n', (5510, 5530), False, 'from IntCode import IntCode\n')] |
# Copyright (c) 2020, TU Wien, Department of Geodesy and Geoinformation
# 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,... | [
"datetime.datetime",
"ascat.level1.AscatL1Hdf5",
"ascat.level1.AscatL1Image",
"ascat.level1.AscatL1Eps",
"numpy.testing.assert_allclose",
"os.path.join",
"numpy.array",
"os.path.dirname",
"ascat.level1.AscatL1Nc",
"ascat.level1.AscatL1Bufr",
"numpy.finfo"
] | [((1829, 1849), 'numpy.finfo', 'np.finfo', (['np.float32'], {}), '(np.float32)\n', (1837, 1849), True, 'import numpy as np\n'), ((2085, 2210), 'os.path.join', 'os.path.join', (['data_path', '"""bufr"""', '"""M02-ASCA-ASCSZR1B0200-NA-9.1-20100609013900.000000000Z-20130824233100-1280350.bfr"""'], {}), "(data_path, 'bufr'... |
# Generated by Django 2.2.6 on 2020-09-28 17:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('control', '0027_auto_20200928_1146'),
]
operations = [
migrations.AlterField(
model_name='agentadmin',
name='zabbix_... | [
"django.db.models.BooleanField"
] | [((352, 385), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(True)'}), '(default=True)\n', (371, 385), False, 'from django.db import migrations, models\n')] |
#!/usr/bin/env python
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for
# full license information.
import logging
import internal_wrapper_glue
from internal_device_glue_sync import InternalDeviceGlueSync
try:
from internal_device_glue_async ... | [
"logging.getLogger",
"internal_device_glue_sync.InternalDeviceGlueSync",
"internal_device_glue_async.InternalDeviceGlueAsync"
] | [((390, 417), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (407, 417), False, 'import logging\n'), ((556, 581), 'internal_device_glue_async.InternalDeviceGlueAsync', 'InternalDeviceGlueAsync', ([], {}), '()\n', (579, 581), False, 'from internal_device_glue_async import InternalDeviceGlu... |
from investmentGame.Order import Order
#from investmentGame.Portfolio import Portfolio
from sqlalchemy import Column, Integer, String, Boolean
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
from investmentGame.db import Base
class User(Base):
__tablename__ = "users"... | [
"sqlalchemy.orm.relationship",
"sqlalchemy.Column",
"investmentGame.Order.Order"
] | [((330, 363), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (336, 363), False, 'from sqlalchemy import Column, Integer, String, Boolean\n'), ((375, 389), 'sqlalchemy.Column', 'Column', (['String'], {}), '(String)\n', (381, 389), False, 'from sqlalchemy import ... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | [
"tensorflow.data.TextLineDataset",
"tensorflow.decode_csv",
"pandas.read_csv",
"tensorflow.data.Dataset.from_tensor_slices"
] | [((1707, 1764), 'pandas.read_csv', 'pd.read_csv', (['train_path'], {'names': 'CSV_COLUMN_NAMES', 'header': '(0)'}), '(train_path, names=CSV_COLUMN_NAMES, header=0)\n', (1718, 1764), True, 'import pandas as pd\n'), ((1825, 1881), 'pandas.read_csv', 'pd.read_csv', (['test_path'], {'names': 'CSV_COLUMN_NAMES', 'header': '... |
import setuptools
setuptools.setup(
name="devrecargar",
version="0.1.4",
url="https://github.com/scottwoodall/django-devrecargar",
author="<NAME>",
author_email="<EMAIL>",
description="""
A Django app that automatically reloads your browser when a file
(py, html, js, css) chang... | [
"setuptools.find_packages"
] | [((394, 420), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (418, 420), False, 'import setuptools\n')] |
import itertools
from django.db import connections
from django.db import transaction
from django.db.models import AutoField
class BulkInsertSQLBuilder(object):
def __init__(self, model_class, objs, connection, fields):
self.raw = False
self.model_class = model_class
self.objs = objs
... | [
"django.db.transaction.atomic"
] | [((2423, 2473), 'django.db.transaction.atomic', 'transaction.atomic', ([], {'using': 'self.db', 'savepoint': '(False)'}), '(using=self.db, savepoint=False)\n', (2441, 2473), False, 'from django.db import transaction\n')] |
"""
Ctrl-Z FRC Team 4096
FIRST Robotics Competition 2016, "Stronghold"
Code for robot "Jaw-Z"
<EMAIL>
"""
from wpilib.buttons import Trigger
from networktables import NetworkTable
class SmartDashboard_Update_Trigger( Trigger ):
'''
Trigger used to check when entries are updated
in the SmartDashboard. Cou... | [
"networktables.NetworkTable.getTable"
] | [((776, 815), 'networktables.NetworkTable.getTable', 'NetworkTable.getTable', (['"""SmartDashboard"""'], {}), "('SmartDashboard')\n", (797, 815), False, 'from networktables import NetworkTable\n')] |
from typing import Any
import strawberry
from strawberry.types import Info
from src.api.context import Context
@strawberry.federation.type(extend=True)
class Query:
@strawberry.field
async def association_service(self, info: Info[Context, Any]) -> bool:
return True
| [
"strawberry.federation.type"
] | [((116, 155), 'strawberry.federation.type', 'strawberry.federation.type', ([], {'extend': '(True)'}), '(extend=True)\n', (142, 155), False, 'import strawberry\n')] |
# coding: utf-8
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__copyright__ = "Copyright 2018"
__version__ = "0.0.1"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
import smtplib
from traceback import format_exc
from email.mime.multipart import MIMEMultipart
from email.mime.text import ... | [
"email.mime.multipart.MIMEMultipart",
"traceback.format_exc",
"smtplib.SMTP",
"email.mime.text.MIMEText"
] | [((807, 841), 'smtplib.SMTP', 'smtplib.SMTP', ([], {'host': 'host', 'port': 'port'}), '(host=host, port=port)\n', (819, 841), False, 'import smtplib\n'), ((913, 928), 'email.mime.multipart.MIMEMultipart', 'MIMEMultipart', ([], {}), '()\n', (926, 928), False, 'from email.mime.multipart import MIMEMultipart\n'), ((1041, ... |
import torch
import torch.nn as nn
import numpy as np
import numpy.random as rand
from dset import idx2char
# We use cross entropy loss
loss_func = nn.CrossEntropyLoss(reduction='mean')
def compute_loss(rnn, xNy, h_list, device):
"""
compute_loss for a given RNN model using loss_func
Args:
RNN: m... | [
"torch.nn.functional.softmax",
"torch.nn.CrossEntropyLoss",
"numpy.array",
"numpy.random.randint",
"torch.no_grad",
"torch.zeros"
] | [((148, 185), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {'reduction': '"""mean"""'}), "(reduction='mean')\n", (167, 185), True, 'import torch.nn as nn\n'), ((1239, 1266), 'torch.zeros', 'torch.zeros', (['(1, char_size)'], {}), '((1, char_size))\n', (1250, 1266), False, 'import torch\n'), ((1595, 1610), '... |
import numpy as np
class InputLayer():
def __init__(self, number_neurons):
self.number_neurons = number_neurons
self.stored_output = []
def calc_feed_forward(self, input):
self.input = input
self.output = input
self.stored_output.append(self.output)
return np.... | [
"numpy.asarray"
] | [((317, 340), 'numpy.asarray', 'np.asarray', (['self.output'], {}), '(self.output)\n', (327, 340), True, 'import numpy as np\n')] |
"""Get Netflix History"""
import argparse
import mechanicalsoup
import json
import time
from slimit.lexer import Lexer
# Initialize credentials from command prompt arguments
parser = argparse.ArgumentParser(description='Log into Netflix.')
parser.add_argument('username')
parser.add_argument('password')
args = parser.p... | [
"json.loads",
"argparse.ArgumentParser",
"time.strftime",
"mechanicalsoup.Browser",
"time.time",
"slimit.lexer.Lexer",
"json.dump"
] | [((184, 240), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Log into Netflix."""'}), "(description='Log into Netflix.')\n", (207, 240), False, 'import argparse\n'), ((360, 384), 'mechanicalsoup.Browser', 'mechanicalsoup.Browser', ([], {}), '()\n', (382, 384), False, 'import mechanicalso... |
# Copyright (c) 2018 <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, ... | [
"os.path.exists",
"numpy.reshape",
"os.makedirs",
"dataset.DataSet",
"urllib.urlretrieve",
"os.path.join",
"subprocess.call",
"numpy.concatenate",
"os.stat",
"numpy.transpose",
"sys.version.startswith"
] | [((1319, 1346), 'sys.version.startswith', 'sys.version.startswith', (['"""3"""'], {}), "('3')\n", (1341, 1346), False, 'import sys\n'), ((1755, 1793), 'os.path.join', 'os.path.join', (['work_directory', 'filename'], {}), '(work_directory, filename)\n', (1767, 1793), False, 'import os\n'), ((3183, 3208), 'numpy.concaten... |
""" This module calculates turbulent viscosity at the cell faces.
Libraries/Modules:
numpy\n
"""
import numpy as np
# from Grid import Grid
# class BaldwinLomax():
# @profile
def turbulent_viscosity(model, ws, state):
""" Baldwin-lomax turbulence model: modtur = 2.
Calculates turbulent vi... | [
"numpy.sqrt",
"numpy.ones",
"numpy.floor",
"numpy.argmax",
"numpy.square",
"numpy.exp",
"numpy.argmin"
] | [((1340, 1351), 'numpy.ones', 'np.ones', (['nx'], {}), '(nx)\n', (1347, 1351), True, 'import numpy as np\n'), ((1364, 1375), 'numpy.ones', 'np.ones', (['nx'], {}), '(nx)\n', (1371, 1375), True, 'import numpy as np\n'), ((1386, 1403), 'numpy.ones', 'np.ones', (['(nx, ny)'], {}), '((nx, ny))\n', (1393, 1403), True, 'impo... |
import time
import cv2
import argparse
import numpy as np
import serial
# khoi tao bo dem
#open camera
cap = cv2.VideoCapture(0)
start = time.time()
#image = cv2.imread('199.jpg',1)
# Ham tra ve output layer
def get_output_layers(net):
layer_names = net.getLayerNames()
output_layers = [layer_names[i[0] - ... | [
"cv2.rectangle",
"cv2.dnn.blobFromImage",
"numpy.argmax",
"cv2.putText",
"cv2.imshow",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.dnn.NMSBoxes",
"time.time",
"cv2.dnn.readNet"
] | [((112, 131), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (128, 131), False, 'import cv2\n'), ((140, 151), 'time.time', 'time.time', ([], {}), '()\n', (149, 151), False, 'import time\n'), ((947, 994), 'cv2.dnn.readNet', 'cv2.dnn.readNet', (['"""yolov3.weights"""', '"""yolov3.cfg"""'], {}), "('yolov3... |
import logging
import requests
from .. import VERSION_STR
from ..exceptions import ConnectionError, ApiCallError
LOG = logging.getLogger(__name__)
class OpenRefsResponse:
"""Обёртка над ответом requests."""
def __init__(self, response: requests.Response):
"""
:param response:
"""
... | [
"logging.getLogger"
] | [((122, 149), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (139, 149), False, 'import logging\n')] |
from uuid import uuid4
from shutil import rmtree
from random import shuffle
from zipfile import ZipFile
from string import hexdigits
from requests import Session
from datetime import datetime
from hashlib import md5, sha1
from OpenSSL.crypto import X509
from re import findall, compile
from os import access, R_OK, listd... | [
"alert_api.models.SampleItem.save_sample",
"datetime.datetime.fromtimestamp",
"random.shuffle",
"alert_api.models.MimiAlertItem.objects.create",
"zipfile.ZipFile",
"hashlib.md5",
"requests.Session",
"unittest.mock.MagicMock",
"os.access",
"re.compile",
"canary_files.models.CanaryItem.create_cana... | [((1244, 1300), 'manage_api.models.User.create_user', 'User.create_user', (['username', 'password', 'email', 'phonenumber'], {}), '(username, password, email, phonenumber)\n', (1260, 1300), False, 'from manage_api.models import User\n'), ((1696, 1711), 'random.shuffle', 'shuffle', (['digits'], {}), '(digits)\n', (1703,... |
# copyright 2020 EtlamGit
import os
import os.path
from PIL import Image
class Chest:
def __init__(self, image_dimension_64):
self.scale = image_dimension_64 / 64.0
def scale_it(self, ox, oy, dx, dy):
return (int(ox * self.scale), int(oy * self.scale), int(ox * self.scale + dx * self.scale),... | [
"os.path.abspath",
"os.path.exists",
"PIL.Image.new",
"PIL.Image.open"
] | [((6458, 6511), 'os.path.exists', 'os.path.exists', (['(input_root + base_folder + input_file)'], {}), '(input_root + base_folder + input_file)\n', (6472, 6511), False, 'import os\n'), ((8938, 8991), 'os.path.exists', 'os.path.exists', (['(input_root + base_folder + input_file)'], {}), '(input_root + base_folder + inpu... |
from flask import request, redirect
import urllib.parse
from uuid import uuid4
from secrets import token_urlsafe
from app import app, bcrypt, db, ses_cli, render_template
from app.db_models import User
from app.templating.text import get_lexicon_and_lang
@app.route("/forgot-password", methods=["GET", "POST"])
def for... | [
"app.templating.text.get_lexicon_and_lang",
"flask.request.args.get",
"app.db.session.commit",
"app.render_template",
"secrets.token_urlsafe",
"uuid.uuid4",
"flask.redirect",
"app.bcrypt.generate_password_hash",
"app.app.route",
"app.ses_cli.send_email",
"app.db_models.User.get_by_name_or_email"... | [((258, 312), 'app.app.route', 'app.route', (['"""/forgot-password"""'], {'methods': "['GET', 'POST']"}), "('/forgot-password', methods=['GET', 'POST'])\n", (267, 312), False, 'from app import app, bcrypt, db, ses_cli, render_template\n'), ((355, 383), 'flask.request.args.get', 'request.args.get', (['"""continue"""'], ... |
#!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
import argparse
import asyncio
import configparser
import os
from collections import namedtuple
from dataclasses import dataclass, field
from datetime import datetime, date, timedelta
from typing import List, Tuple, Dict
import aiohttp
import keyring
import pytz
@data... | [
"os.path.exists",
"aiohttp.ClientSession",
"collections.namedtuple",
"datetime.datetime.min.time",
"argparse.ArgumentParser",
"dataclasses.dataclass",
"datetime.date.today",
"datetime.datetime.now",
"keyring.get_password",
"datetime.datetime.today",
"datetime.timedelta",
"configparser.RawConfi... | [((316, 337), 'dataclasses.dataclass', 'dataclass', ([], {'order': '(True)'}), '(order=True)\n', (325, 337), False, 'from dataclasses import dataclass, field\n'), ((379, 411), 'dataclasses.field', 'field', ([], {'compare': '(True)', 'default': '(0.0)'}), '(compare=True, default=0.0)\n', (384, 411), False, 'from datacla... |
# -*- coding: utf-8 -*-
import numpy as np
from skimage.util import img_as_float
from skimage.segmentation import slic
from skimage.io import imread
import os
from salientdetect.detector import calc_saliency_score
def _load_dist_mat():
npy_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "color_dis... | [
"skimage.util.img_as_float",
"salientdetect.detector.calc_saliency_score",
"skimage.io.imread",
"os.path.abspath",
"numpy.load"
] | [((339, 356), 'numpy.load', 'np.load', (['npy_path'], {}), '(npy_path)\n', (346, 356), True, 'import numpy as np\n'), ((424, 436), 'skimage.io.imread', 'imread', (['path'], {}), '(path)\n', (430, 436), False, 'from skimage.io import imread\n'), ((617, 667), 'salientdetect.detector.calc_saliency_score', 'calc_saliency_s... |
import numpy as np
from .lanczos import lanczos_resample_three, lanczos_resample_one
def invert_affine_transform_wcs(u, v, wcs):
"""Invert a galsim.AffineTransform WCS.
The AffineTransform WCS forward model is
[u, v] = Jac * ([x, y] - origin) + world_origin
where the `*` is a matrix multiplica... | [
"numpy.array",
"numpy.zeros",
"numpy.sum"
] | [((2358, 2408), 'numpy.zeros', 'np.zeros', (['(coadd_dim, coadd_dim)'], {'dtype': 'np.float64'}), '((coadd_dim, coadd_dim), dtype=np.float64)\n', (2366, 2408), True, 'import numpy as np\n'), ((2427, 2477), 'numpy.zeros', 'np.zeros', (['(coadd_dim, coadd_dim)'], {'dtype': 'np.float64'}), '((coadd_dim, coadd_dim), dtype=... |
""" Tradingview FXcross """
from sa_func import get_broker_affiliate_link
def get_tradingview_fxcross(width, height):
""" Get Tradingview FXcross """
return_data = ''
#theme = get_sa_theme()
url = get_broker_affiliate_link('Tradingview', 'baseurl')
if str(width) == '0':
width = '"100%"'
... | [
"sa_func.get_broker_affiliate_link"
] | [((214, 265), 'sa_func.get_broker_affiliate_link', 'get_broker_affiliate_link', (['"""Tradingview"""', '"""baseurl"""'], {}), "('Tradingview', 'baseurl')\n", (239, 265), False, 'from sa_func import get_broker_affiliate_link\n')] |
import pytest
from geniust import constants
from geniust.functions import customize
@pytest.mark.parametrize(
"lyrics_language", ["English", "Non-English", "English + Non-English"]
)
def test_cusotmize_menu(update_callback_query, context, lyrics_language):
update = update_callback_query
context.user_data... | [
"geniust.functions.customize.customize_menu",
"pytest.mark.parametrize",
"pytest.lazy_fixture",
"geniust.functions.customize.lyrics_language",
"geniust.functions.customize.include_annotations",
"geniust.functions.customize.bot_language"
] | [((88, 187), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""lyrics_language"""', "['English', 'Non-English', 'English + Non-English']"], {}), "('lyrics_language', ['English', 'Non-English',\n 'English + Non-English'])\n", (111, 187), False, 'import pytest\n'), ((365, 406), 'geniust.functions.customize.c... |
#!/usr/bin/env python
"""Perform an LDAP bind with an LDAP server.
Example execution:
$ ./ldap.py
Connecting to ldap.forumsys.com:389... done.
{'messageID': 1,
'protocolOp': ('bindRequest',
{'authentication': ('simple', b'password'),
'name': b'uid=tesla,dc=example,dc=com',
... | [
"socket.socket",
"os.path.join",
"asn1tools.compile_files",
"os.path.realpath",
"pprint.pprint"
] | [((1579, 1650), 'os.path.join', 'os.path.join', (['SCRIPT_DIR', '""".."""', '"""tests"""', '"""files"""', '"""ietf"""', '"""rfc4511.asn"""'], {}), "(SCRIPT_DIR, '..', 'tests', 'files', 'ietf', 'rfc4511.asn')\n", (1591, 1650), False, 'import os\n'), ((1854, 1895), 'asn1tools.compile_files', 'asn1tools.compile_files', ([... |
from urllib import request
import pandas as pd
import os
from tqdm import tqdm
url = "tiktok-trending.csv"
tiktok_dataset = pd.read_csv(url, on_bad_lines="skip")
for i in tqdm(range(len(tiktok_dataset))):
music_url = tiktok_dataset.loc[i, "Music URL"]
local_file = (
"downloadedMp3/"
+ str(tikto... | [
"os.path.exists",
"pandas.read_csv",
"urllib.request.urlretrieve"
] | [((125, 162), 'pandas.read_csv', 'pd.read_csv', (['url'], {'on_bad_lines': '"""skip"""'}), "(url, on_bad_lines='skip')\n", (136, 162), True, 'import pandas as pd\n'), ((534, 560), 'os.path.exists', 'os.path.exists', (['local_file'], {}), '(local_file)\n', (548, 560), False, 'import os\n'), ((593, 635), 'urllib.request.... |
# -------------------------------------------------------------------------
# Copyright (c) PTC Inc. and/or all its affiliates. All rights reserved.
# See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# User Management Example - ... | [
"kepconfig.admin.users.enable_user",
"kepconfig.admin.users.add_user",
"kepconfig.admin.user_groups.disable_user_group",
"kepconfig.admin.users.disable_user",
"kepconfig.admin.user_groups.modify_user_group",
"kepconfig.connection.server",
"kepconfig.admin.user_groups.enable_user_group",
"kepconfig.adm... | [((4094, 4170), 'kepconfig.connection.server', 'connection.server', ([], {'host': '"""127.0.0.1"""', 'port': '(57412)', 'user': '"""Administrator"""', 'pw': '""""""'}), "(host='127.0.0.1', port=57412, user='Administrator', pw='')\n", (4111, 4170), False, 'from kepconfig import connection, error\n'), ((4407, 4459), 'kep... |
import unittest
from mock import Mock
from records_mover.records.schema.field.numpy import details_from_numpy_dtype
import numpy as np
class TestNumpy(unittest.TestCase):
def test_details_from_numpy_dtype(self):
tests = {
np.dtype(str): 'string',
np.dtype(int): 'integer',
... | [
"mock.Mock",
"numpy.dtype",
"records_mover.records.schema.field.numpy.details_from_numpy_dtype"
] | [((248, 261), 'numpy.dtype', 'np.dtype', (['str'], {}), '(str)\n', (256, 261), True, 'import numpy as np\n'), ((285, 298), 'numpy.dtype', 'np.dtype', (['int'], {}), '(int)\n', (293, 298), True, 'import numpy as np\n'), ((323, 346), 'numpy.dtype', 'np.dtype', (['np.datetime64'], {}), '(np.datetime64)\n', (331, 346), Tru... |
from os import path
import requests
import json
from requests.exceptions import HTTPError
from tkinter import messagebox
from tkinter.constants import BOTTOM, CENTER, E, RIGHT, W, Y, X
from tkinter.ttk import Treeview, Scrollbar
from ibuki import Ibuki
from utils import fetch_local_data, get_config, messages
tv = Non... | [
"json.loads",
"requests.post",
"tkinter.messagebox.showerror",
"utils.get_config",
"utils.fetch_local_data",
"os.path.join",
"tkinter.ttk.Scrollbar",
"ibuki.Ibuki.filterOn",
"tkinter.messagebox.showinfo",
"tkinter.ttk.Treeview"
] | [((735, 783), 'tkinter.ttk.Treeview', 'Treeview', (['root'], {'columns': 'columns', 'show': '"""headings"""'}), "(root, columns=columns, show='headings')\n", (743, 783), False, 'from tkinter.ttk import Treeview, Scrollbar\n'), ((2651, 2687), 'tkinter.ttk.Scrollbar', 'Scrollbar', (['root'], {'orient': '"""horizontal"""'... |
from satchmo.discount.models import Discount
from django.contrib import admin
from django.utils.translation import get_language, ugettext_lazy as _
class DiscountOptions(admin.ModelAdmin):
list_display=('site', 'description','active')
list_display_links = ('description',)
filter_horizontal = ('validProduc... | [
"django.contrib.admin.site.register"
] | [((327, 373), 'django.contrib.admin.site.register', 'admin.site.register', (['Discount', 'DiscountOptions'], {}), '(Discount, DiscountOptions)\n', (346, 373), False, 'from django.contrib import admin\n')] |
import requests
import pandas as pd
import json
from covid_data_tracker.plugins.base import BasePlugin
class CzechRepublicPlugin(BasePlugin):
COUNTRY = "Czech Republic"
BASE_SOURCE = "https://onemocneni-aktualne.mzcr.cz/api/v2/covid-19"
TYPE = "JSON"
FREQUENCY = "daily"
AUTHOR = "<NAME>"
ARCH... | [
"pandas.DataFrame",
"json.loads",
"requests.get"
] | [((767, 794), 'json.loads', 'json.loads', (['cumulative_vals'], {}), '(cumulative_vals)\n', (777, 794), False, 'import json\n'), ((808, 838), 'pandas.DataFrame', 'pd.DataFrame', (["cum_dict['data']"], {}), "(cum_dict['data'])\n", (820, 838), True, 'import pandas as pd\n'), ((1399, 1431), 'json.loads', 'json.loads', (['... |
import time
import os
# for organization, encode parameters in dir name
def setOutDir(params):
timestamp = str(int(time.time()))
try:
jobid = os.environ['SLURM_JOBID']
except:
jobid = 'NOID'
if params['root'] is None:
root = os.path.join(os.environ['HOME'], "STM", "experiments"... | [
"os.path.join",
"time.time"
] | [((267, 321), 'os.path.join', 'os.path.join', (["os.environ['HOME']", '"""STM"""', '"""experiments"""'], {}), "(os.environ['HOME'], 'STM', 'experiments')\n", (279, 321), False, 'import os\n'), ((120, 131), 'time.time', 'time.time', ([], {}), '()\n', (129, 131), False, 'import time\n')] |
# Copyright 2021 The Private Cardinality Estimation Framework Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | [
"wfa_planning_evaluation_framework.data_generators.data_set_parameters.DataSetParameters",
"wfa_planning_evaluation_framework.data_generators.data_set_parameters.GeneratorParameters"
] | [((2067, 2156), 'wfa_planning_evaluation_framework.data_generators.data_set_parameters.GeneratorParameters', 'GeneratorParameters', (['"""FixedPrice"""', 'FixedPriceGenerator', "{'cost_per_impression': 0.1}"], {}), "('FixedPrice', FixedPriceGenerator, {\n 'cost_per_impression': 0.1})\n", (2086, 2156), False, 'from w... |
from functools import wraps
from django.db.models import Manager
from django.db.models.query import QuerySet
from django.utils.six import with_metaclass
def _make_proxy(name, fn):
@wraps(fn)
def _proxy(self, *args, **kwargs):
qs = self.get_queryset()
return getattr(qs, name)(*args, **kwargs)
... | [
"django.utils.six.with_metaclass",
"functools.wraps"
] | [((1408, 1458), 'django.utils.six.with_metaclass', 'with_metaclass', (['ChainableManagerMetaclass', 'Manager'], {}), '(ChainableManagerMetaclass, Manager)\n', (1422, 1458), False, 'from django.utils.six import with_metaclass\n'), ((188, 197), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (193, 197), False, 'from ... |
import time
import torch
from labml import monit, logger
from labml.logger import Text
N = 10_000
def no_section():
arr = torch.zeros((1000, 1000))
for i in range(N):
for t in range(10):
arr += 1
def section():
arr = torch.zeros((1000, 1000))
for i in range(N):
with ... | [
"labml.monit.section",
"time.time",
"torch.zeros"
] | [((131, 156), 'torch.zeros', 'torch.zeros', (['(1000, 1000)'], {}), '((1000, 1000))\n', (142, 156), False, 'import torch\n'), ((257, 282), 'torch.zeros', 'torch.zeros', (['(1000, 1000)'], {}), '((1000, 1000))\n', (268, 282), False, 'import torch\n'), ((433, 458), 'torch.zeros', 'torch.zeros', (['(1000, 1000)'], {}), '(... |
import json
import boto3
from boto3.dynamodb.conditions import Key
from loggingmixin import LoggingMixin
from awesomedecorators import memoized
from jsonrepo.backend import Backend
class DynamoDBBackend(Backend, LoggingMixin):
"""
Backend based on DynamoDB
"""
def __init__(self, prefix, key, sort_key... | [
"boto3.resource",
"json.loads",
"boto3.dynamodb.conditions.Key"
] | [((564, 590), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {}), "('dynamodb')\n", (578, 590), False, 'import boto3\n'), ((1385, 1402), 'json.loads', 'json.loads', (['value'], {}), '(value)\n', (1395, 1402), False, 'import json\n'), ((3135, 3149), 'boto3.dynamodb.conditions.Key', 'Key', (['self._key'], {}), ... |
#!/usr/bin/env python
import xmltodict
import re
from datetime import datetime, timedelta
from argparse import ArgumentParser
def ConvertLayout(filein, ntsc):
with open(filein) as fd:
docin = xmltodict.parse(fd.read())
zerotime = datetime.strptime("00:00:00", "%H:%M:%S")
if ntsc:
vformat ... | [
"datetime.datetime.strptime",
"argparse.ArgumentParser",
"xmltodict.unparse"
] | [((248, 289), 'datetime.datetime.strptime', 'datetime.strptime', (['"""00:00:00"""', '"""%H:%M:%S"""'], {}), "('00:00:00', '%H:%M:%S')\n", (265, 289), False, 'from datetime import datetime, timedelta\n'), ((2342, 2419), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Converts DVD Author layouts be... |