code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
class MyFarmerManager(BaseUserManager):
def create_user(self, first_name , last_name, username, email, phone, password=None):
if not first_name:
raise ValueError("User must have First Name")
... | [
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.EmailField",
"django.db.models.ImageField",
"django.db.models.DateTimeField"
] | [((1476, 1546), 'django.db.models.CharField', 'models.CharField', ([], {'verbose_name': '"""first name"""', 'max_length': '(200)', 'null': '(True)'}), "(verbose_name='first name', max_length=200, null=True)\n", (1492, 1546), False, 'from django.db import models\n'), ((1563, 1632), 'django.db.models.CharField', 'models.... |
"""Bare bones test for rgb model in i3d.
"""
import mxnet as mx
import i3d
ctx = mx.cpu()
_IMAGE_SIZE = 224
_NUM_CLASSES = 4
_SAMPLE_VIDEO_FRAMES = 79
_BATCH_SIZE = 1
_NUM_CHANNELS = 3
def _test_model(net, ctx, x):
net.initialize()
net.collect_params().reset_ctx(ctx)
net(x)
mx.nd.waitall()
def te... | [
"mxnet.nd.waitall",
"nose.runmodule",
"mxnet.random.uniform",
"i3d.i3d",
"mxnet.cpu"
] | [((85, 93), 'mxnet.cpu', 'mx.cpu', ([], {}), '()\n', (91, 93), True, 'import mxnet as mx\n'), ((296, 311), 'mxnet.nd.waitall', 'mx.nd.waitall', ([], {}), '()\n', (309, 311), True, 'import mxnet as mx\n'), ((393, 507), 'mxnet.random.uniform', 'mx.random.uniform', ([], {'shape': '(_BATCH_SIZE, _NUM_CHANNELS, _SAMPLE_VIDE... |
# Copyright 2018 BMW Car IT GmbH
#
# 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 writi... | [
"git.Repo",
"logging.getLogger",
"pathlib.Path",
"git.Repo.clone_from",
"zubbi.scraper.exceptions.CheckoutError"
] | [((811, 838), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (828, 838), False, 'import logging\n'), ((1251, 1278), 'pathlib.Path', 'Path', (['git_con.workspace_dir'], {}), '(git_con.workspace_dir)\n', (1255, 1278), False, 'from pathlib import Path\n'), ((1775, 1794), 'git.Repo', 'Repo', ... |
from flask_restplus import Namespace, fields
class UserDto:
api = Namespace('user', description='user related operations')
user = api.model('user', {
'email': fields.String(required=True, description='user email address'),
'username': fields.String(required=True, description='user username'),
... | [
"flask_restplus.fields.String",
"flask_restplus.Namespace",
"flask_restplus.fields.Integer"
] | [((72, 128), 'flask_restplus.Namespace', 'Namespace', (['"""user"""'], {'description': '"""user related operations"""'}), "('user', description='user related operations')\n", (81, 128), False, 'from flask_restplus import Namespace, fields\n'), ((815, 881), 'flask_restplus.Namespace', 'Namespace', (['"""auth"""'], {'des... |
#!/usr/bin/env python3
import rospy
import subprocess
import unittest
from appctl_msg_defs.msg import Mode
# this must match the number of nodes in the .test file
NUM_INSTANCES = 100
# this must match the expected mode in mode_spin_test.py script
TEST_MODE = Mode('test_appctl')
# this must not match anything else
NO... | [
"subprocess.check_output",
"rostest.rosrun",
"rospy.Publisher",
"rospy.sleep",
"appctl_msg_defs.msg.Mode",
"unittest.skip",
"rospy.init_node"
] | [((262, 281), 'appctl_msg_defs.msg.Mode', 'Mode', (['"""test_appctl"""'], {}), "('test_appctl')\n", (266, 281), False, 'from appctl_msg_defs.msg import Mode\n'), ((328, 340), 'appctl_msg_defs.msg.Mode', 'Mode', (['"""none"""'], {}), "('none')\n", (332, 340), False, 'from appctl_msg_defs.msg import Mode\n'), ((1034, 109... |
import configparser
from datetime import datetime
import os
from pyspark.sql import SparkSession
from pyspark.sql.functions import col
from pyspark.sql.functions import from_unixtime
from pyspark.sql.functions import monotonically_increasing_id
from pyspark.sql.functions import year, month, dayofmonth, hour, weekofyear... | [
"pyspark.sql.functions.dayofmonth",
"pyspark.sql.functions.month",
"pyspark.sql.SparkSession.builder.config",
"pyspark.sql.functions.monotonically_increasing_id",
"pyspark.sql.functions.weekofyear",
"pyspark.sql.functions.hour",
"pyspark.sql.functions.date_format",
"pyspark.sql.functions.col",
"conf... | [((344, 371), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (369, 371), False, 'import configparser\n'), ((1235, 1285), 'os.path.join', 'os.path.join', (['input_data', '"""song_data/*/*/*/*.json"""'], {}), "(input_data, 'song_data/*/*/*/*.json')\n", (1247, 1285), False, 'import os\n'), ((2... |
from tradssat.tmpl.var import CharacterVar, FloatVar, IntegerVar
vars_ = {
CharacterVar('INSI', 4, spc=2, info='Institute + Site code'),
FloatVar('LAT', 8, 3, info='Latitude, degrees (decimals)'),
FloatVar('LONG', 8, 3, info='Longitude, degrees (decimals)'),
FloatVar('ELEV', 5, 0, info='Elevation, m'),... | [
"tradssat.tmpl.var.IntegerVar",
"tradssat.tmpl.var.CharacterVar",
"tradssat.tmpl.var.FloatVar"
] | [((80, 140), 'tradssat.tmpl.var.CharacterVar', 'CharacterVar', (['"""INSI"""', '(4)'], {'spc': '(2)', 'info': '"""Institute + Site code"""'}), "('INSI', 4, spc=2, info='Institute + Site code')\n", (92, 140), False, 'from tradssat.tmpl.var import CharacterVar, FloatVar, IntegerVar\n'), ((146, 204), 'tradssat.tmpl.var.Fl... |
# encoding: utf-8
from __future__ import unicode_literals
import os
import shutil
import uuid
import tempfile
import logging
import warnings
from git import Repo
from git.exc import GitCommandNotFound
from unittest import TestCase
import pytest
from dvc.command.remote import CmdRemoteAdd
from dvc.repo import Repo a... | [
"os.mkdir",
"dvc.utils.compat.str",
"shutil.rmtree",
"os.path.join",
"os.chdir",
"dvc.repo.Repo.init",
"os.path.dirname",
"tempfile.mkdtemp",
"git.Repo.init",
"unittest.TestCase.__init__",
"os.path.realpath",
"pytest.fixture",
"uuid.uuid4",
"os.getpid",
"os.makedirs",
"os.path.isdir",
... | [((380, 404), 'logging.getLogger', 'logging.getLogger', (['"""dvc"""'], {}), "('dvc')\n", (397, 404), False, 'import logging\n'), ((482, 520), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""data_sub_dir"""'], {}), "(DATA_DIR, 'data_sub_dir')\n", (494, 520), False, 'import os\n'), ((532, 562), 'os.path.join', 'os.pat... |
from . import config
from .file_util import FileUtil
from .log_helper import LogHelper
import copy
import json
import requests
import sys
_logger = LogHelper.getLogger()
_REGISTER = config.NUMBERS_API_URL + "/nit_create_asset"
class Numbers:
"""Handles interactions with Numbers Protocol."""
@staticmethod
... | [
"requests.post",
"copy.copy",
"json.dumps"
] | [((1427, 1450), 'copy.copy', 'copy.copy', (['asset_extras'], {}), '(asset_extras)\n', (1436, 1450), False, 'import copy\n'), ((2569, 2684), 'requests.post', 'requests.post', (['_REGISTER'], {'headers': "{'Authorization': f'Bearer {config.NUMBERS_API_KEY}'}", 'data': 'registration_data'}), "(_REGISTER, headers={'Authori... |
from concurrent.futures import thread
from os import spawnl
from attr.validators import instance_of
import pytest
import time
import copy
import random
from mpire import WorkerPool
from ding.framework import Task
from ding.framework.context import Context
from ding.framework.parallel import Parallel
from ding.utils.des... | [
"mpire.WorkerPool",
"ding.framework.Task",
"time.sleep",
"random.random",
"pytest.raises",
"ding.framework.parallel.Parallel.runner"
] | [((595, 601), 'ding.framework.Task', 'Task', ([], {}), '()\n', (599, 601), False, 'from ding.framework import Task\n'), ((1266, 1272), 'ding.framework.Task', 'Task', ([], {}), '()\n', (1270, 1272), False, 'from ding.framework import Task\n'), ((1691, 1712), 'ding.framework.Task', 'Task', ([], {'async_mode': '(True)'}),... |
#!/usr/bin/python3
import time
import math
from mininet.net import Mininet
from mininet.node import Controller, OVSKernelSwitch, RemoteController,OVSSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.link import TCLink,Link
from mininet.topo import Topo
class MyTopo(Topo):
"... | [
"mininet.topo.Topo.__init__",
"mininet.net.Mininet",
"mininet.log.setLogLevel",
"time.sleep",
"mininet.cli.CLI"
] | [((2227, 2246), 'mininet.log.setLogLevel', 'setLogLevel', (['"""info"""'], {}), "('info')\n", (2238, 2246), False, 'from mininet.log import setLogLevel, info\n'), ((2277, 2349), 'mininet.net.Mininet', 'Mininet', ([], {'topo': 'topo', 'controller': 'None', 'link': 'TCLink', 'switch': 'OVSKernelSwitch'}), '(topo=topo, co... |
# Scanner i2c en MicroPython | MicroPython i2c scanner
# Renvoi l'adresse en decimal et hexa de chaque device connecte sur le bus i2c
# Return decimal and hexa adress of each i2c device
# https://projetsdiy.fr - https://diyprojects.io (dec. 2017)
import machine
import ssd1306
i2c = machine.I2C(scl=machine.Pin(22), sd... | [
"machine.Pin",
"ssd1306.SSD1306_I2C"
] | [((625, 674), 'ssd1306.SSD1306_I2C', 'ssd1306.SSD1306_I2C', (['oled_width', 'oled_height', 'i2c'], {}), '(oled_width, oled_height, i2c)\n', (644, 674), False, 'import ssd1306\n'), ((301, 316), 'machine.Pin', 'machine.Pin', (['(22)'], {}), '(22)\n', (312, 316), False, 'import machine\n'), ((322, 337), 'machine.Pin', 'ma... |
import os
from .application import DatalabframeworkApp
from traitlets import Unicode, Dict
from cookiecutter.main import cookiecutter
class DlfInitApp(DatalabframeworkApp):
name = Unicode(u'datalabframework-init')
description = "Generating a data science project template"
config_file = Unicode(u'', hel... | [
"traitlets.Unicode",
"os.path.realpath",
"cookiecutter.main.cookiecutter",
"os.path.join"
] | [((188, 221), 'traitlets.Unicode', 'Unicode', (['u"""datalabframework-init"""'], {}), "(u'datalabframework-init')\n", (195, 221), False, 'from traitlets import Unicode, Dict\n'), ((458, 498), 'traitlets.Unicode', 'Unicode', (['u"""natbusa"""'], {'help': '"""Project name"""'}), "(u'natbusa', help='Project name')\n", (46... |
from typing import *
import collections
class Solution:
"""
给定一个包含红色、白色和蓝色,一共 n 个元素的数组,原地对它们进行排序,使得相同颜色的元素相邻,并按照红色、白色、蓝色顺序排列。
此题中,我们使用整数 0、 1 和 2 分别表示红色、白色和蓝色。
注意:
不能使用代码库中的排序函数来解决这道题。
示例:
输入: [2,0,2,1,1,0]
输出: [0,0,1,1,2,2]
进阶:
一个直观的解决方案是使用计数排序的两趟扫描算法。
首先,迭代计算出0、1 和 2 元素的个... | [
"collections.defaultdict",
"doctest.testmod"
] | [((735, 763), 'collections.defaultdict', 'collections.defaultdict', (['int'], {}), '(int)\n', (758, 763), False, 'import collections\n'), ((1756, 1773), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (1771, 1773), False, 'import doctest\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import cv_bridge
from jsk_topic_tools import ConnectionBasedTransport
import rospy
from sensor_msgs.msg import Image
class ImageToLabel(ConnectionBasedTransport):
def __init__(self):
super(ImageToLabel, self).__init__()
self._pub =... | [
"cv_bridge.CvBridge",
"rospy.Subscriber",
"numpy.ones",
"rospy.init_node",
"rospy.spin"
] | [((884, 917), 'rospy.init_node', 'rospy.init_node', (['"""image_to_label"""'], {}), "('image_to_label')\n", (899, 917), False, 'import rospy\n'), ((953, 965), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (963, 965), False, 'import rospy\n'), ((414, 462), 'rospy.Subscriber', 'rospy.Subscriber', (['"""~input"""', 'Image... |
import numpy as np
from sgmrfmix import sGMRFmix
def check_model() -> None:
m = sGMRFmix(K=5, rho=0.8)
train = np.genfromtxt('../Examples/Data/train.csv', delimiter=',', skip_header=True)[:, 1:]
test = np.genfromtxt('../Examples/Data/test.csv', delimiter=',', skip_header=True)[:, 1:]
print(m)
# def t... | [
"numpy.allclose",
"numpy.genfromtxt",
"sgmrfmix.sGMRFmix"
] | [((86, 108), 'sgmrfmix.sGMRFmix', 'sGMRFmix', ([], {'K': '(5)', 'rho': '(0.8)'}), '(K=5, rho=0.8)\n', (94, 108), False, 'from sgmrfmix import sGMRFmix\n'), ((121, 197), 'numpy.genfromtxt', 'np.genfromtxt', (['"""../Examples/Data/train.csv"""'], {'delimiter': '""","""', 'skip_header': '(True)'}), "('../Examples/Data/tra... |
import os
from unittest import TestCase
import math
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
import tensorflow as tf
from pose_format.tensorflow.representation.distance import DistanceRepresentation
representation = DistanceRepresentation()
class TestDistanceRepresentation(TestCase):
def test_call_value_s... | [
"math.sqrt",
"pose_format.tensorflow.representation.distance.DistanceRepresentation",
"tensorflow.constant"
] | [((224, 248), 'pose_format.tensorflow.representation.distance.DistanceRepresentation', 'DistanceRepresentation', ([], {}), '()\n', (246, 248), False, 'from pose_format.tensorflow.representation.distance import DistanceRepresentation\n'), ((359, 405), 'tensorflow.constant', 'tf.constant', (['[[[[1, 2, 3]]]]'], {'dtype':... |
# The MIT License (MIT)
#
# Copyright (c) snkas
#
# 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, p... | [
"numpy.zeros"
] | [((7051, 7067), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (7059, 7067), True, 'import numpy as np\n'), ((7251, 7267), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (7259, 7267), True, 'import numpy as np\n'), ((7498, 7514), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (7506, ... |
"""
Created on 22/06/2019
@author: nidragedd
"""
import torch
import numpy as np
import json
from pathlib import Path
from src.preprocess import preprocess
from src.utils import utils, constants, load_restore, display
def predict(image_path, model, class2idx, topk=5):
"""
Predict the class (or classes) of a... | [
"src.utils.load_restore.load_checkpoint",
"torch.from_numpy",
"json.load",
"src.utils.utils.define_predict_input_parameters",
"pathlib.Path",
"torch.cuda.is_available",
"src.preprocess.preprocess.process_image",
"torch.no_grad",
"src.utils.display.display_most_likely_classes"
] | [((781, 817), 'src.preprocess.preprocess.process_image', 'preprocess.process_image', (['image_path'], {}), '(image_path)\n', (805, 817), False, 'from src.preprocess import preprocess\n'), ((1701, 1740), 'src.utils.utils.define_predict_input_parameters', 'utils.define_predict_input_parameters', ([], {}), '()\n', (1738, ... |
# Copyright (c) 2017 Sony Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | [
"numpy.minimum",
"numpy.abs",
"numpy.ones_like",
"numpy.copy",
"numpy.sum",
"numpy.log2",
"numpy.floor",
"numpy.empty",
"numpy.transpose",
"numpy.flatnonzero",
"numpy.random.RandomState",
"numpy.any",
"nbla_test_utils.list_context",
"nbla_test_utils.function_tester",
"numpy.random.randin... | [((718, 743), 'nbla_test_utils.list_context', 'list_context', (['"""INQAffine"""'], {}), "('INQAffine')\n", (730, 743), False, 'from nbla_test_utils import list_context\n'), ((3687, 3734), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ctx, func_name"""', 'ctxs'], {}), "('ctx, func_name', ctxs)\n", (3710, ... |
# Created by <NAME> (<EMAIL>)
from collections.abc import Iterable
import numpy as np
from .cost import Cost
class SumCost(Cost):
def __init__(self, system, costs):
"""
A cost which is the sum of other cost terms. It can be created by combining
other Cost objects with the `+` operator
... | [
"numpy.zeros"
] | [((705, 757), 'numpy.zeros', 'np.zeros', (['(self.system.obs_dim, self.system.obs_dim)'], {}), '((self.system.obs_dim, self.system.obs_dim))\n', (713, 757), True, 'import numpy as np\n'), ((774, 826), 'numpy.zeros', 'np.zeros', (['(self.system.obs_dim, self.system.obs_dim)'], {}), '((self.system.obs_dim, self.system.ob... |
#!/usr/bin/env python3
import requests
def main():
url = "http://ip.wang-li.top:93/4u6385IP"
MyIP = requests.get(url).text
print(MyIP)
if __name__ == '__main__':
main() | [
"requests.get"
] | [((110, 127), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (122, 127), False, 'import requests\n')] |
import pandas as pd
import pymysql
class SentNER:
def __init__(self, sent_list, attr_list):
self.article_id = sent_list[1]
self.sent_id = attr_list[0]
self.cui1_dic = attr_list[1]
self.cui2_dic = attr_list[2]
self.title = sent_list[2]
self.text = sent_lis... | [
"pandas.read_table"
] | [((3478, 3528), 'pandas.read_table', 'pd.read_table', (['relation_path'], {'sep': '"""|"""', 'header': 'None'}), "(relation_path, sep='|', header=None)\n", (3491, 3528), True, 'import pandas as pd\n')] |
# Show Linux/Raspian status/information on OLED-Display (SSD1306)
# Script run once... Supposted to be launched via crontab.
#
# Get local HostName = HostName
# Get locval IP-adfress = IP
# Get CPU-load = CPU
# Get TotaltMemry/UsedMemory info. = MemUsage
# Get TotalStorage/UsedStorage info. = Disk
#
import time
impor... | [
"Adafruit_SSD1306.SSD1306_128_64",
"PIL.Image.new",
"PIL.ImageFont.load_default",
"subprocess.check_output",
"socket.socket",
"socket.gethostname",
"PIL.ImageDraw.Draw",
"datetime.datetime.now"
] | [((792, 843), 'Adafruit_SSD1306.SSD1306_128_64', 'Adafruit_SSD1306.SSD1306_128_64', ([], {'rst': 'RST', 'i2c_bus': '(1)'}), '(rst=RST, i2c_bus=1)\n', (823, 843), False, 'import Adafruit_SSD1306\n'), ((1068, 1099), 'PIL.Image.new', 'Image.new', (['"""1"""', '(width, height)'], {}), "('1', (width, height))\n", (1077, 109... |
#!/usr/bin/env python
# coding: utf-8
import logging
import os, re, shlex, sys
from typing import Iterator
logging.root.setLevel(logging.DEBUG)
logger = logging.getLogger("air")
def log(msg, *args, **kwargs):
text = msg
try:
text = msg.format(*args, **kwargs)
except:
try:
text = msg % args
exc... | [
"logging.root.setLevel",
"statsmodels.tsa.arima_model.ARIMA",
"pandas.read_csv",
"shlex.split",
"os.path.exists",
"logging.getLogger"
] | [((109, 145), 'logging.root.setLevel', 'logging.root.setLevel', (['logging.DEBUG'], {}), '(logging.DEBUG)\n', (130, 145), False, 'import logging\n'), ((155, 179), 'logging.getLogger', 'logging.getLogger', (['"""air"""'], {}), "('air')\n", (172, 179), False, 'import logging\n'), ((2281, 2305), 'pandas.read_csv', 'pd.rea... |
#!/usr/bin/env python3
from collections import defaultdict
year = 2018
semester = 3
DAYS = ('M', 'T', 'W', 'Th', 'F')
STYLE = '''
<style>
table {
border-collapse: collapse;
}
table th, table td{
border: 1px solid black;
}
.day col:nth-child(odd){
background: lightgray;
}
.day col:nth-child(even){
bac... | [
"collections.defaultdict",
"json.load"
] | [((6502, 6517), 'json.load', 'json.load', (['file'], {}), '(file)\n', (6511, 6517), False, 'import json\n'), ((2952, 2998), 'collections.defaultdict', 'defaultdict', (["(lambda : {'label': '', 'span': 1})"], {}), "(lambda : {'label': '', 'span': 1})\n", (2963, 2998), False, 'from collections import defaultdict\n'), ((3... |
import click
from cmr import render
from connect.cli.core.utils import continue_or_quit
from connect.cli.plugins.customer.constants import SYNC_RESULT_OUTPUT
def print_sync_result(skipped, created, updated, errors):
msg = SYNC_RESULT_OUTPUT
errors_count = len(errors)
processed = skipped + created + upda... | [
"connect.cli.core.utils.continue_or_quit",
"click.secho",
"click.echo",
"cmr.render"
] | [((839, 862), 'click.secho', 'click.secho', (['msg'], {'fg': 'fg'}), '(msg, fg=fg)\n', (850, 862), False, 'import click\n'), ((887, 905), 'connect.cli.core.utils.continue_or_quit', 'continue_or_quit', ([], {}), '()\n', (903, 905), False, 'from connect.cli.core.utils import continue_or_quit\n'), ((676, 687), 'cmr.render... |
# ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
# MIT License
#
# Copyright (c) 2021 <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 res... | [
"numpy.stack",
"matplotlib.pyplot.show",
"torch.stack",
"numpy.abs",
"disent.util.lightning.callbacks._helper._get_dataset_and_ae_like",
"torch.norm",
"disent.util.visualize.plot.plt_subplots_imshow",
"numpy.zeros",
"torch.cat",
"numpy.triu_indices",
"torch.distributions.kl_divergence",
"disen... | [((2277, 2304), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2294, 2304), False, 'import logging\n'), ((3102, 3117), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3115, 3117), False, 'import torch\n'), ((3503, 3518), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3516, 351... |
from lib.records import TaskInfo, EniInfo
def extract_event_task_info(task_description) -> TaskInfo:
arn = task_description['taskArn']
# Parse the eni info out of the the attachments
enis = [
EniInfo(eni_id=detail['value']) for network_interface in task_description['attachments']
if netwo... | [
"lib.records.TaskInfo",
"lib.records.EniInfo"
] | [((517, 550), 'lib.records.TaskInfo', 'TaskInfo', ([], {'task_arn': 'arn', 'enis': 'enis'}), '(task_arn=arn, enis=enis)\n', (525, 550), False, 'from lib.records import TaskInfo, EniInfo\n'), ((215, 246), 'lib.records.EniInfo', 'EniInfo', ([], {'eni_id': "detail['value']"}), "(eni_id=detail['value'])\n", (222, 246), Fal... |
# Generated by Django 2.1.7 on 2019-04-19 06:43
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('landing', '0063_auto_20190419_0821'),
]
operations = [
migrations.RenameField(
model_name='section',
old_name='_survey',
... | [
"django.db.migrations.RenameField"
] | [((227, 323), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""section"""', 'old_name': '"""_survey"""', 'new_name': '"""section_survey"""'}), "(model_name='section', old_name='_survey', new_name=\n 'section_survey')\n", (249, 323), False, 'from django.db import migrations\n')] |
import numpy as np
from analysisdatalink import datalink
from collections import defaultdict
class AnalysisDataLinkExt(datalink.AnalysisDataLink):
def __init__(self, dataset_name, materialization_version=None,
sqlalchemy_database_uri=None, verbose=True,
annotation_endpoint=None)... | [
"collections.defaultdict",
"numpy.array"
] | [((3052, 3069), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (3063, 3069), False, 'from collections import defaultdict\n'), ((3098, 3115), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (3109, 3115), False, 'from collections import defaultdict\n'), ((6529, 6546), 'collect... |
# Copyright 2017 Kensho Technologies, LLC.
from abc import ABCMeta, abstractmethod
import json
import os
import requests
import six
@six.add_metaclass(ABCMeta)
class AbstractLoader(object):
"""Base class for loading configuration settings from a source"""
def reload(self):
"""Reload values from the ... | [
"requests.post",
"json.load",
"requests.get",
"six.add_metaclass"
] | [((136, 162), 'six.add_metaclass', 'six.add_metaclass', (['ABCMeta'], {}), '(ABCMeta)\n', (153, 162), False, 'import six\n'), ((4871, 4940), 'requests.post', 'requests.post', (['url'], {'data': "{'role_id': role_id, 'secret_id': secret_id}"}), "(url, data={'role_id': role_id, 'secret_id': secret_id})\n", (4884, 4940), ... |
#__BEGIN_LICENSE__
# Copyright (c) 2017, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The GeoRef platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in complianc... | [
"django.forms.ChoiceField",
"django.forms.BooleanField",
"django.forms.URLField",
"django.forms.ValidationError",
"django.forms.CharField",
"django.forms.FileField"
] | [((941, 972), 'django.forms.FileField', 'forms.FileField', ([], {'required': '(False)'}), '(required=False)\n', (956, 972), False, 'from django import forms\n'), ((988, 1018), 'django.forms.URLField', 'forms.URLField', ([], {'required': '(False)'}), '(required=False)\n', (1002, 1018), False, 'from django import forms\n... |
from distutils.core import setup
import py2exe
setup(
console = [{"script" : "PEInfo.py"}] ,
zipfile = None ,
options = {
"py2exe" : {
"bundle_files" : 1 ,
"compressed" : True ,
"includes" ... | [
"distutils.core.setup"
] | [((48, 233), 'distutils.core.setup', 'setup', ([], {'console': "[{'script': 'PEInfo.py'}]", 'zipfile': 'None', 'options': "{'py2exe': {'bundle_files': 1, 'compressed': True, 'includes': [\n 'xlsxwriter', 'chardet', 'pefile', 'requests']}}"}), "(console=[{'script': 'PEInfo.py'}], zipfile=None, options={'py2exe': {\n ... |
import os
from smartystreets_python_sdk import StaticCredentials, ClientBuilder
from smartystreets_python_sdk.international_street import Lookup
def run():
auth_id = "Your SmartyStreets Auth ID here"
auth_token = "Your SmartyStreets Auth Token here"
# We recommend storing your secret keys in environment... | [
"smartystreets_python_sdk.ClientBuilder",
"smartystreets_python_sdk.StaticCredentials",
"smartystreets_python_sdk.international_street.Lookup"
] | [((468, 506), 'smartystreets_python_sdk.StaticCredentials', 'StaticCredentials', (['auth_id', 'auth_token'], {}), '(auth_id, auth_token)\n', (485, 506), False, 'from smartystreets_python_sdk import StaticCredentials, ClientBuilder\n'), ((742, 750), 'smartystreets_python_sdk.international_street.Lookup', 'Lookup', ([], ... |
import os
import time
from functools import partial
from collections import namedtuple
import torch
from torch.optim.swa_utils import AveragedModel, SWALR
from torch.optim.lr_scheduler import CosineAnnealingLR
from torch.nn.parallel import DistributedDataParallel
from loguru import logger as my_logger
try:
from a... | [
"torch.ones_like",
"functools.partial",
"os.makedirs",
"torch.zeros_like",
"apex.amp.master_params",
"time.time",
"torch.save",
"loguru.logger.info",
"apex.amp.scale_loss",
"collections.namedtuple",
"torch.no_grad",
"os.path.join"
] | [((675, 881), 'collections.namedtuple', 'namedtuple', (['"""BatchEndParams"""', "['epoch', 'nbatch', 'rank', 'add_step', 'data_in_time',\n 'data_transfer_time', 'forward_time', 'backward_time', 'optimizer_time',\n 'metric_time', 'eval_metric', 'locals']"], {}), "('BatchEndParams', ['epoch', 'nbatch', 'rank', 'add... |
import os
import logging
import json
from collections import OrderedDict
from .GedcomIndividual import GedcomIndividual
from .GedcomFamily import GedcomFamily
from .ReadGedcom import read_data
from .InstanceContainer import InstanceContainer
logging.basicConfig() # level=20)
logger = logging.getLogger("life_line_cha... | [
"collections.OrderedDict",
"os.path.dirname",
"logging.getLogger",
"logging.basicConfig"
] | [((244, 265), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (263, 265), False, 'import logging\n'), ((288, 324), 'logging.getLogger', 'logging.getLogger', (['"""life_line_chart"""'], {}), "('life_line_chart')\n", (305, 324), False, 'import logging\n'), ((1166, 1179), 'collections.OrderedDict', 'Ordere... |
import re
from flask import request
class Stack(object):
"""
Stack data structure will not insert
equal sequential data
"""
def __init__(self, list=None, size=5):
self.size = size
self.data = list or []
def push(self, item):
if self.data:
if item !=... | [
"re.findall",
"flask.request.args.get"
] | [((780, 808), 'flask.request.args.get', 'request.args.get', (['"""group_by"""'], {}), "('group_by')\n", (796, 808), False, 'from flask import request\n'), ((1115, 1143), 're.findall', 're.findall', (['"""page_(.*)"""', 'arg'], {}), "('page_(.*)', arg)\n", (1125, 1143), False, 'import re\n'), ((1501, 1530), 're.findall'... |
import cv2
import numpy as np
import imutils
from text_recognition import text_name
import pytesseract
def auto_canny(image, sigma=0.55):
# compute the median of the single channel pixel intensities
v = np.median(image)
# apply automatic Canny edge detection using the computed median
lower = int(max(... | [
"cv2.boundingRect",
"cv2.Canny",
"text_recognition.text_name",
"cv2.medianBlur",
"numpy.median",
"cv2.cvtColor",
"cv2.morphologyEx",
"cv2.arcLength",
"cv2.imshow",
"numpy.ones",
"cv2.adaptiveThreshold",
"cv2.approxPolyDP",
"cv2.VideoCapture",
"cv2.waitKey",
"imutils.grab_contours",
"cv... | [((212, 228), 'numpy.median', 'np.median', (['image'], {}), '(image)\n', (221, 228), True, 'import numpy as np\n'), ((400, 430), 'cv2.Canny', 'cv2.Canny', (['image', 'lower', 'upper'], {}), '(image, lower, upper)\n', (409, 430), False, 'import cv2\n'), ((729, 748), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}),... |
from django import forms
from wagtail.core import blocks
from modules.core.blocks import section_page_blocks
class ResourcesBlock(blocks.StructBlock):
heading = blocks.CharBlock(required=True)
description = blocks.CharBlock(required=False)
def get_context(self, value, parent_context=None):
from ... | [
"wagtail.core.blocks.PageChooserBlock",
"modules.ai_lab.models.AiLabResourceIndexPage.objects.all",
"wagtail.core.blocks.CharBlock"
] | [((168, 199), 'wagtail.core.blocks.CharBlock', 'blocks.CharBlock', ([], {'required': '(True)'}), '(required=True)\n', (184, 199), False, 'from wagtail.core import blocks\n'), ((218, 250), 'wagtail.core.blocks.CharBlock', 'blocks.CharBlock', ([], {'required': '(False)'}), '(required=False)\n', (234, 250), False, 'from w... |
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--start", type=int)
parser.add_argument("--num", type=int)
parser.add_argument("--noX", action="count")
args = parser.parse_args()
start = args.start
num = args.num
noX = args.noX
def nextTen(n):
if (n % 10):
n = n + (10 - n % 10)
... | [
"argparse.ArgumentParser"
] | [((26, 51), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (49, 51), False, 'import argparse\n')] |
# Generated by Django 3.1.4 on 2021-06-03 13:44
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('reprohack_hub', '0001_initial'),
]
operations = [
migrations.RemoveField(
... | [
"django.db.migrations.RemoveField",
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((296, 355), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""paper"""', 'name': '"""archived"""'}), "(model_name='paper', name='archived')\n", (318, 355), False, 'from django.db import migrations, models\n'), ((400, 460), 'django.db.migrations.RemoveField', 'migrations.RemoveField... |
from setuptools import setup
from setuptools import find_packages
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(
name='d2ix',
version='1.3.5',
packages=find_packages(),
url='https://github.com/tum-ewk/d2ix',
license='Apache License Version 2.0',
author='<NA... | [
"setuptools.find_packages"
] | [((203, 218), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (216, 218), False, 'from setuptools import find_packages\n')] |
from app.models import Tag, Container, CleanupAlertRule, CleanupAlert, Baliza, Zone
from app import db
from datetime import datetime
from app.utils.helpers import Utils
def update_cleanup_rule(tag):
if(not tag.container_id or not tag.active):
return
if(tag.container.tag_type.name != "LIMPIEZA"):
... | [
"app.models.Baliza.query.filter_by",
"datetime.datetime.utcnow",
"app.db.session.commit",
"app.models.Zone.query.filter_by",
"app.models.CleanupAlert.query.filter_by",
"app.models.CleanupAlertRule.query.filter_by",
"app.models.Tag.query.filter_by"
] | [((463, 482), 'app.db.session.commit', 'db.session.commit', ([], {}), '()\n', (480, 482), False, 'from app import db\n'), ((548, 584), 'app.models.Tag.query.filter_by', 'Tag.query.filter_by', ([], {'zone_id': 'zone_id'}), '(zone_id=zone_id)\n', (567, 584), False, 'from app.models import Tag, Container, CleanupAlertRule... |
from setuptools import (
Extension,
setup,
)
setup(
ext_modules=[Extension('spam.spam', sources=['spam/spam.c'])],
)
| [
"setuptools.Extension"
] | [((78, 125), 'setuptools.Extension', 'Extension', (['"""spam.spam"""'], {'sources': "['spam/spam.c']"}), "('spam.spam', sources=['spam/spam.c'])\n", (87, 125), False, 'from setuptools import Extension, setup\n')] |
from flask import Flask
from flask import jsonify
import uuid
import datetime
import os
app = Flask(__name__)
@app.route("/")
def hello():
response = {
'uuid': str(uuid.uuid4()),
'time': str(datetime.datetime.now()),
'host': os.uname().nodename
}
return jsonify(response)
if __na... | [
"uuid.uuid4",
"flask.Flask",
"os.uname",
"flask.jsonify",
"datetime.datetime.now"
] | [((96, 111), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (101, 111), False, 'from flask import Flask\n'), ((294, 311), 'flask.jsonify', 'jsonify', (['response'], {}), '(response)\n', (301, 311), False, 'from flask import jsonify\n'), ((179, 191), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (189, 191),... |
import pandas as pd
from pkg_resources import resource_filename
from qtpy.QtWidgets import (
QPushButton,
QLabel,
QComboBox,
QMessageBox,
)
from imlib.cells.cells import Cell
brainglobe_logo = resource_filename(
"cellfinder_napari", "images/brainglobe.png"
)
def cells_df_as_np(cells_df, new_or... | [
"qtpy.QtWidgets.QLabel",
"pkg_resources.resource_filename",
"qtpy.QtWidgets.QPushButton",
"qtpy.QtWidgets.QMessageBox.information",
"qtpy.QtWidgets.QMessageBox.question",
"qtpy.QtWidgets.QComboBox"
] | [((213, 276), 'pkg_resources.resource_filename', 'resource_filename', (['"""cellfinder_napari"""', '"""images/brainglobe.png"""'], {}), "('cellfinder_napari', 'images/brainglobe.png')\n", (230, 276), False, 'from pkg_resources import resource_filename\n'), ((1042, 1053), 'qtpy.QtWidgets.QComboBox', 'QComboBox', ([], {}... |
import functools
from inspect import iscoroutinefunction
from typing import TypeVar
_T = TypeVar("_T")
def securities_are_cached(func: _T) -> _T:
@functools.wraps(func)
async def predicate(self, *args, **kwargs):
if not self._securities_cache:
await self._fetch_securities()
if isc... | [
"inspect.iscoroutinefunction",
"typing.TypeVar",
"functools.wraps"
] | [((90, 103), 'typing.TypeVar', 'TypeVar', (['"""_T"""'], {}), "('_T')\n", (97, 103), False, 'from typing import TypeVar\n'), ((154, 175), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (169, 175), False, 'import functools\n'), ((317, 342), 'inspect.iscoroutinefunction', 'iscoroutinefunction', (['func... |
"""arbin res-type data files"""
import os
import sys
import tempfile
import shutil
import logging
import platform
import warnings
import time
import numpy as np
import pandas as pd
from cellpy.readers.core import (
FileID,
Cell,
check64bit,
humanize_bytes,
xldate_as_datetime,
)
from cellpy.paramet... | [
"os.remove",
"pandas.read_csv",
"pypyodbc.drivers",
"pathlib.Path",
"os.path.isfile",
"cellpy.readers.core.humanize_bytes",
"sys.getsizeof",
"os.path.join",
"pandas.DataFrame",
"platform.architecture",
"cellpy.readers.core.Cell",
"cellpy.log.setup_logging",
"pandas.read_sql_query",
"pypyod... | [((932, 949), 'platform.system', 'platform.system', ([], {}), '()\n', (947, 949), False, 'import platform\n'), ((1023, 1050), 'logging.debug', 'logging.debug', (['"""DEBUG_MODE"""'], {}), "('DEBUG_MODE')\n", (1036, 1050), False, 'import logging\n'), ((1055, 1085), 'logging.debug', 'logging.debug', (['f"""ODBC: {ODBC}""... |
from apps.libs.register_blueprint import NestableBlueprint
blueprint = bp = NestableBlueprint(cur_name=__name__,cur_file=__file__)
@bp.route('/')
def index():
return str(__name__) | [
"apps.libs.register_blueprint.NestableBlueprint"
] | [((76, 131), 'apps.libs.register_blueprint.NestableBlueprint', 'NestableBlueprint', ([], {'cur_name': '__name__', 'cur_file': '__file__'}), '(cur_name=__name__, cur_file=__file__)\n', (93, 131), False, 'from apps.libs.register_blueprint import NestableBlueprint\n')] |
import os
import argparse
import torch
from mvn.pipeline.training import do_train
from mvn.pipeline.evaluation import do_eval
from mvn.utils.cfg import load_config
from mvn.utils.misc import is_master, is_distributed
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
'--confi... | [
"mvn.utils.misc.is_master",
"torch.distributed.init_process_group",
"argparse.ArgumentParser",
"mvn.utils.cfg.load_config",
"torch.manual_seed",
"mvn.utils.misc.is_distributed",
"torch.cuda.device_count",
"mvn.pipeline.training.do_train",
"torch.device",
"torch.cuda.set_device",
"mvn.pipeline.ev... | [((252, 277), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (275, 277), False, 'import argparse\n'), ((1118, 1156), 'torch.cuda.set_device', 'torch.cuda.set_device', (['args.local_rank'], {}), '(args.local_rank)\n', (1139, 1156), False, 'import torch\n'), ((1356, 1384), 'torch.manual_seed', 't... |
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import MaxPooling2D, Conv2D
from keras.utils import to_categorical
from keras.optimizers import rmsprop
from keras.preprocessing.image import ImageDataGenerator
import os
save_dir = os.path.join(os.getcw... | [
"keras.optimizers.rmsprop",
"keras.datasets.cifar10.load_data",
"os.makedirs",
"os.getcwd",
"keras.layers.Dropout",
"os.path.isdir",
"keras.layers.Flatten",
"keras.layers.Dense",
"keras.layers.Conv2D",
"keras.models.Sequential",
"os.path.join",
"keras.layers.MaxPooling2D",
"keras.utils.to_ca... | [((483, 502), 'keras.datasets.cifar10.load_data', 'cifar10.load_data', ([], {}), '()\n', (500, 502), False, 'from keras.datasets import cifar10\n'), ((750, 783), 'keras.utils.to_categorical', 'to_categorical', (['y_train_label', '(10)'], {}), '(y_train_label, 10)\n', (764, 783), False, 'from keras.utils import to_categ... |
#!python3
# -*- coding: utf-8 -*-
# automationpy/packagepy/htmlpy
# <NAME>
# created 21 Oktober 2020
# create html with dominate
import dominate
from dominate.tags import *
import os
import io
import whatsapp
def nama_tester(tester="<NAME>"):
# Function name tester
nama_tester = tester
return nama_tester... | [
"os.path.abspath",
"os.path.join",
"os.path.dirname",
"io.open",
"whatsapp.to_days"
] | [((19376, 19394), 'whatsapp.to_days', 'whatsapp.to_days', ([], {}), '()\n', (19392, 19394), False, 'import whatsapp\n'), ((9205, 9230), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (9220, 9230), False, 'import os\n'), ((9278, 9304), 'os.path.dirname', 'os.path.dirname', (['file_path'], {}),... |
#!/usr/bin/env python
# -*- encoding:utf-8 -*-
"""
Solution to Project Euler Problem 54
http://projecteuler.net/
by Apalala <<EMAIL>>
(cc) Attribution-ShareAlike
http://creativecommons.org/licenses/by-sa/3.0/
Poker hands
In the card game poker, a hand consists of five cards and are ranked,
from lowest to highest, ... | [
"itertools.groupby",
"pathlib.Path"
] | [((2379, 2393), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (2383, 2393), False, 'from pathlib import Path\n'), ((3407, 3423), 'itertools.groupby', 'groupby', (['it', 'key'], {}), '(it, key)\n', (3414, 3423), False, 'from itertools import groupby\n')] |
__all__ = ['checkEquivalentApprox']
import copy
import logging
import numpy as np
from LevelSetPy.Utilities import *
logger = logging.getLogger(__name__)
def checkEquivalentApprox(approx1, approx2,bound):
"""
checkEquivalentApprox: Checks two derivative approximations for equivalence.
[ relError, abs... | [
"numpy.nonzero",
"numpy.divide",
"numpy.abs",
"logging.getLogger"
] | [((127, 154), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (144, 154), False, 'import logging\n'), ((1616, 1645), 'numpy.nonzero', 'np.nonzero', (['(magnitude > bound)'], {}), '(magnitude > bound)\n', (1626, 1645), True, 'import numpy as np\n'), ((1664, 1694), 'numpy.nonzero', 'np.nonze... |
# coding: utf-8
from __future__ import absolute_import
import datetime
import re
import importlib
import six
from huaweicloudsdkcore.client import Client, ClientBuilder
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcore.utils import http_utils
from huaweicloudsdkcore.sdk_stream_request imp... | [
"huaweicloudsdkcore.client.ClientBuilder",
"huaweicloudsdkcore.utils.http_utils.select_header_content_type",
"importlib.import_module"
] | [((1034, 1087), 'importlib.import_module', 'importlib.import_module', (['"""huaweicloudsdkswr.v2.model"""'], {}), "('huaweicloudsdkswr.v2.model')\n", (1057, 1087), False, 'import importlib\n'), ((1421, 1441), 'huaweicloudsdkcore.client.ClientBuilder', 'ClientBuilder', (['clazz'], {}), '(clazz)\n', (1434, 1441), False, ... |
import urllib
import json
import datetime,math,re,os
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template import loader
from django.utils.html import strip_tags
def upload_location(instance, filename, *args, **kwargs):
try:
a = instance.__class__.__name... | [
"urllib.request.Request",
"urllib.parse.urlencode",
"django.template.loader.render_to_string",
"urllib.request.urlopen",
"django.core.mail.EmailMultiAlternatives",
"datetime.datetime.now"
] | [((876, 914), 'urllib.request.Request', 'urllib.request.Request', (['url'], {'data': 'data'}), '(url, data=data)\n', (898, 914), False, 'import urllib\n'), ((930, 957), 'urllib.request.urlopen', 'urllib.request.urlopen', (['req'], {}), '(req)\n', (952, 957), False, 'import urllib\n'), ((1400, 1539), 'django.template.lo... |
import pygame
import sys
import random as r
from pygame.locals import *
from math import *
###############################################################
##VARIABLES##
largo= 1280
ancho= 600
pygame.init()
Pant = pygame.display.set_mode([largo,ancho], pygame.RESIZABLE)
pygame.disp... | [
"pygame.quit",
"random.randint",
"pygame.font.SysFont",
"pygame.draw.rect",
"pygame.display.set_mode",
"pygame.event.get",
"pygame.Rect",
"pygame.init",
"pygame.display.update",
"pygame.mouse.get_pos",
"pygame.display.set_caption",
"pygame.time.Clock",
"sys.exit"
] | [((229, 242), 'pygame.init', 'pygame.init', ([], {}), '()\n', (240, 242), False, 'import pygame\n'), ((251, 308), 'pygame.display.set_mode', 'pygame.display.set_mode', (['[largo, ancho]', 'pygame.RESIZABLE'], {}), '([largo, ancho], pygame.RESIZABLE)\n', (274, 308), False, 'import pygame\n'), ((309, 362), 'pygame.displa... |
from paypalrestsdk import Order
import logging
logging.basicConfig(level=logging.INFO)
order = Order.find("<ORDER_ID>")
capture = order.capture({
"amount": {
"currency": "USD",
"total": "4.54"},
"is_final_capture": True})
if capture.success():
print("Capture[%s] successfully" % (capture.id... | [
"paypalrestsdk.Order.find",
"logging.basicConfig"
] | [((47, 86), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (66, 86), False, 'import logging\n'), ((96, 120), 'paypalrestsdk.Order.find', 'Order.find', (['"""<ORDER_ID>"""'], {}), "('<ORDER_ID>')\n", (106, 120), False, 'from paypalrestsdk import Order\n')] |
# Copyright (c) 2018 <NAME>.
# Uranium is released under the terms of the LGPLv3 or higher.
import math
from typing import Optional, Tuple, cast
from UM.Qt.Bindings.MainWindow import MainWindow
from UM.Qt.QtApplication import QtApplication
from UM.Tool import Tool
from UM.Event import Event, MouseEvent, KeyEvent
from... | [
"UM.Math.Vector.Vector",
"math.radians",
"PyQt5.QtWidgets.QApplication.keyboardModifiers",
"UM.Application.Application.getInstance",
"UM.Math.Matrix.Matrix",
"UM.Math.Vector.Vector.Unit_Y.cross",
"UM.Qt.QtApplication.QtApplication.getInstance"
] | [((930, 945), 'UM.Math.Vector.Vector', 'Vector', (['(0)', '(0)', '(0)'], {}), '(0, 0, 0)\n', (936, 945), False, 'from UM.Math.Vector import Vector\n'), ((3936, 3978), 'PyQt5.QtWidgets.QApplication.keyboardModifiers', 'QtWidgets.QApplication.keyboardModifiers', ([], {}), '()\n', (3976, 3978), False, 'from PyQt5 import Q... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import csv, unicodedata, sys
sentences = {}
with open("datasets/stanfordSentimentTreebank/original/datasetSentences.txt", "r") as f:
rd = csv.reader(f, delimiter='\t')
count = 0
for line in rd:
if count == 0:
count = 1
continue
... | [
"csv.reader",
"csv.writer"
] | [((185, 214), 'csv.reader', 'csv.reader', (['f'], {'delimiter': '"""\t"""'}), "(f, delimiter='\\t')\n", (195, 214), False, 'import csv, unicodedata, sys\n'), ((1455, 1483), 'csv.reader', 'csv.reader', (['f'], {'delimiter': '""","""'}), "(f, delimiter=',')\n", (1465, 1483), False, 'import csv, unicodedata, sys\n'), ((19... |
import datetime
from dateutil.tz import tzoffset
from hcloud.firewalls.domain import Firewall
class TestFirewall(object):
def test_created_is_datetime(self):
firewall = Firewall(id=1, created="2016-01-30T23:50+00:00")
assert firewall.created == datetime.datetime(
2016, 1, 30, 23, 50, ... | [
"hcloud.firewalls.domain.Firewall",
"dateutil.tz.tzoffset"
] | [((184, 232), 'hcloud.firewalls.domain.Firewall', 'Firewall', ([], {'id': '(1)', 'created': '"""2016-01-30T23:50+00:00"""'}), "(id=1, created='2016-01-30T23:50+00:00')\n", (192, 232), False, 'from hcloud.firewalls.domain import Firewall\n'), ((327, 344), 'dateutil.tz.tzoffset', 'tzoffset', (['None', '(0)'], {}), '(None... |
from flask import Flask
from flask_pymongo import PyMongo
app = Flask(__name__)
app.config.from_object('config.Config')
mongo = PyMongo(app)
from app.views import todo
app.register_blueprint(todo) | [
"flask_pymongo.PyMongo",
"flask.Flask"
] | [((66, 81), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (71, 81), False, 'from flask import Flask\n'), ((130, 142), 'flask_pymongo.PyMongo', 'PyMongo', (['app'], {}), '(app)\n', (137, 142), False, 'from flask_pymongo import PyMongo\n')] |
import schedule
import time
def invoke_email_workflow():
print("Check for pending emails in Queue and Send Email...")
def invoke_automation_workflow():
print("Check for pending automation runs in Queue and Invoke mvr automation API...")
if __name__ == "__main__":
try:
schedule.every(3).seconds.do... | [
"schedule.run_pending",
"schedule.every",
"time.sleep"
] | [((441, 463), 'schedule.run_pending', 'schedule.run_pending', ([], {}), '()\n', (461, 463), False, 'import schedule\n'), ((476, 489), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (486, 489), False, 'import time\n'), ((292, 309), 'schedule.every', 'schedule.every', (['(3)'], {}), '(3)\n', (306, 309), False, 'impo... |
import torch
import torch.nn as nn
import torchsummary
from layers import TransformerEncoder
class DepthwiseViT(nn.Module):
def __init__(self, in_c:int=3, num_classes:int=10, img_size:int=32, patch:int=8, dropout:float=0., num_layers:int=7, hidden:int=384, mlp_hidden:int=384*4, head:int=8):
super(Depthwis... | [
"torch.nn.Sequential",
"layers.TransformerEncoder",
"torch.randn",
"torch.nn.LayerNorm",
"torchsummary.summary",
"torch.nn.Linear"
] | [((1767, 1790), 'torch.randn', 'torch.randn', (['b', 'c', 'h', 'w'], {}), '(b, c, h, w)\n', (1778, 1790), False, 'import torch\n'), ((1979, 2015), 'torchsummary.summary', 'torchsummary.summary', (['net', '(c, h, w)'], {}), '(net, (c, h, w))\n', (1999, 2015), False, 'import torchsummary\n'), ((602, 622), 'torch.nn.Linea... |
from jigls.jeditor.utils import UniqueIdentifier
from typing import Dict, List, Optional
from uuid import UUID
class JAbstractBase:
def __init__(
self,
name: str,
uid: Optional[str] = None,
exec: bool = True,
traceback: bool = False,
) -> None:
self._name: str =... | [
"jigls.jeditor.utils.UniqueIdentifier"
] | [((351, 369), 'jigls.jeditor.utils.UniqueIdentifier', 'UniqueIdentifier', ([], {}), '()\n', (367, 369), False, 'from jigls.jeditor.utils import UniqueIdentifier\n')] |
from tqdm import tqdm
import requests
import os
def download_weight(link, file_name, verbose=True):
response = requests.get(link, stream=True)
total_size_in_bytes= int(response.headers.get('content-length', 0))
block_size = 1024 #1 Kibibyte
progress_bar = tqdm(total=total_size_in_bytes, unit='iB', unit... | [
"tqdm.tqdm",
"requests.get"
] | [((116, 147), 'requests.get', 'requests.get', (['link'], {'stream': '(True)'}), '(link, stream=True)\n', (128, 147), False, 'import requests\n'), ((273, 409), 'tqdm.tqdm', 'tqdm', ([], {'total': 'total_size_in_bytes', 'unit': '"""iB"""', 'unit_scale': '(True)', 'desc': '"""downloading defualt weights"""', 'disable': '(... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-07-17 06:09
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('iiits', '0058_auto_20160714_0829'),
]... | [
"django.db.models.TextField",
"django.db.migrations.RemoveField",
"django.db.models.CharField",
"django.db.models.AutoField",
"datetime.datetime",
"django.db.models.DateTimeField"
] | [((873, 936), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""topstory"""', 'name': '"""news_link"""'}), "(model_name='topstory', name='news_link')\n", (895, 936), False, 'from django.db import migrations, models\n'), ((452, 545), 'django.db.models.AutoField', 'models.AutoField', (... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" fil... | [
"pathlib.Path",
"json.loads"
] | [((770, 820), 'pathlib.Path', 'pathlib.Path', (["os.environ['LITANI_E2E_LITANI_PATH']"], {}), "(os.environ['LITANI_E2E_LITANI_PATH'])\n", (782, 820), False, 'import pathlib\n'), ((2097, 2117), 'json.loads', 'json.loads', (['run_dump'], {}), '(run_dump)\n', (2107, 2117), False, 'import json\n')] |
# Generated by Django 3.0.5 on 2020-04-18 18:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('critters', '0003_auto_20200418_1306'),
]
operations = [
migrations.AlterField(
model_name='bug',
name='end_time',
... | [
"django.db.models.IntegerField"
] | [((336, 377), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)', 'null': '(True)'}), '(default=0, null=True)\n', (355, 377), False, 'from django.db import migrations, models\n'), ((500, 541), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)', 'null': '(True)'}),... |
import torch
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.sampler import SubsetRandomSampler
import numpy as np
import json
import os
from random import shuffle
import math
PATH = os.path.join(os.getcwd(), "data4.0")
SPACEGROUP_FILE = {
0: "Triclinic.txt",
1: "Monoclin... | [
"torch.utils.data.sampler.SubsetRandomSampler",
"json.load",
"torch.utils.data.DataLoader",
"os.getcwd",
"random.shuffle",
"numpy.array",
"torch.from_numpy"
] | [((231, 242), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (240, 242), False, 'import os\n'), ((2619, 2649), 'torch.utils.data.sampler.SubsetRandomSampler', 'SubsetRandomSampler', (['valid_idx'], {}), '(valid_idx)\n', (2638, 2649), False, 'from torch.utils.data.sampler import SubsetRandomSampler\n'), ((2671, 2701), 'tor... |
#########
# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | [
"uuid.uuid4",
"manager_rest.storage.get_storage_manager",
"manager_rest.rest.rest_utils.parse_datetime_string",
"manager_rest.security.authorization.authorize",
"manager_rest.maintenance.is_bypass_maintenance_mode",
"flask_restful.reqparse.Argument",
"manager_rest.rest.rest_utils.get_json_and_verify_par... | [((2530, 2557), 'manager_rest.security.authorization.authorize', 'authorize', (['"""execution_list"""'], {}), "('execution_list')\n", (2539, 2557), False, 'from manager_rest.security.authorization import authorize\n'), ((2563, 2593), 'manager_rest.rest.rest_decorators.marshal_with', 'marshal_with', (['models.Execution'... |
import os, sys
import time
import argparse
import shutil
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
# import video_transforms
# import models
# import datasets
import traceback
import logging
from func... | [
"ptq_lapq.image_classifier_ptq_lapq",
"image_classifier.init_classifier_compression_arg_parser",
"image_classifier.create_activation_stats_collectors",
"image_classifier.load_data",
"os.path.dirname",
"os.path.realpath",
"logging.getLogger",
"distiller.model_summary",
"numpy.arange",
"traceback.fo... | [((554, 573), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (571, 573), False, 'import logging\n'), ((1154, 1230), 'image_classifier.load_data', 'classifier.load_data', (['args'], {'load_train': '(False)', 'load_val': '(False)', 'load_test': '(True)'}), '(args, load_train=False, load_val=False, load_test=... |
import policy as policy_module
import env_rna
import torch
import numpy as np
import torch.nn.functional as F
import matplotlib.pyplot as mlp
import arc_diagram
from torch.distributions import Categorical
env = env_rna.EnvRNA()
class Reinforce:
running_reward = 0
MAX_ITER = 1000
exploration_eps = 10
... | [
"numpy.random.uniform",
"torch.distributions.Categorical",
"torch.stack",
"numpy.zeros",
"env_rna.EnvRNA",
"numpy.random.randint",
"policy.Policy",
"arc_diagram.phrantheses_to_pairing_list",
"torch.nn.functional.smooth_l1_loss",
"torch.tensor"
] | [((212, 228), 'env_rna.EnvRNA', 'env_rna.EnvRNA', ([], {}), '()\n', (226, 228), False, 'import env_rna\n'), ((440, 463), 'policy.Policy', 'policy_module.Policy', (['N'], {}), '(N)\n', (460, 463), True, 'import policy as policy_module\n'), ((651, 669), 'torch.distributions.Categorical', 'Categorical', (['probs'], {}), '... |
import random
nb_couleur = 500
nb_point = 11
def creerCercle(nb_couleur,nb_point):
""""creation du cercle
out : tab avec le numero de la couleur de chaque point
ex : [1,0,2,4,0,...,1,0,0] pour n couleur = 5"""
cpt_couleur = [0]*nb_couleur
tab = []
while len(tab) != (nb_couleur*nb_point):
... | [
"random.randint"
] | [((333, 366), 'random.randint', 'random.randint', (['(0)', '(nb_couleur - 1)'], {}), '(0, nb_couleur - 1)\n', (347, 366), False, 'import random\n'), ((2400, 2421), 'random.randint', 'random.randint', (['(0)', '(10)'], {}), '(0, 10)\n', (2414, 2421), False, 'import random\n'), ((1375, 1396), 'random.randint', 'random.ra... |
import unittest
from app.models import Post
class PostModelTest(unittest.TestCase):
def setUp(self):
self.new_post= Post(id = 1, post_title = 'Python', post_content = 'Programming language that helps to build application')
def test_instance(self):
self.assertTrue(isinstance(self.new_post, Po... | [
"unittest.main",
"app.models.Post"
] | [((489, 504), 'unittest.main', 'unittest.main', ([], {}), '()\n', (502, 504), False, 'import unittest\n'), ((130, 235), 'app.models.Post', 'Post', ([], {'id': '(1)', 'post_title': '"""Python"""', 'post_content': '"""Programming language that helps to build application"""'}), "(id=1, post_title='Python', post_content=\n... |
from django.shortcuts import render
from .news_api import get_all_content, get_headlines
# Home - Breaking news
def home(request):
content_about = 'Breaking news'
context = {
'title': content_about,
'all_articles' : get_headlines()
}
template_name = 'news_app/index.html'
re... | [
"django.shortcuts.render"
] | [((325, 364), 'django.shortcuts.render', 'render', (['request', 'template_name', 'context'], {}), '(request, template_name, context)\n', (331, 364), False, 'from django.shortcuts import render\n'), ((630, 669), 'django.shortcuts.render', 'render', (['request', 'template_name', 'context'], {}), '(request, template_name,... |
"""
File-Name: [app]/views.py
File-Desc: App views for las-util-django
App-Name: las-util-django
Project-Name: Las-Util-Django
Copyright: Copyright (c) 2019, <NAME>
License-Identifier: BSD-3-Clause
"""
from django.shortcuts import render
from django.http import HttpResponseRedirect, HttpResponse
from django.http import... | [
"django.shortcuts.render",
"rest_framework.response.Response",
"rest_framework.renderers.JSONRenderer",
"django.urls.reverse"
] | [((1210, 1256), 'django.shortcuts.render', 'render', (['request', '"""las_util/home.html"""', 'context'], {}), "(request, 'las_util/home.html', context)\n", (1216, 1256), False, 'from django.shortcuts import render\n'), ((2289, 2337), 'django.shortcuts.render', 'render', (['request', '"""las_util/upload.html"""', 'cont... |
#!/usr/bin/env python
'''
IP/EA-RADC calculations for closed-shell N2
'''
from pyscf import gto, scf, adc
mol = gto.Mole()
r = 1.098
mol.atom = [
['N', ( 0., 0. , -r/2 )],
['N', ( 0., 0. , r/2)],]
mol.basis = {'N':'aug-cc-pvdz'}
mol.build()
mf = scf.RHF(mol)
mf.conv_tol = 1e-12
mf.kernel()
myadc ... | [
"pyscf.adc.ADC",
"pyscf.scf.RHF",
"pyscf.gto.Mole"
] | [((116, 126), 'pyscf.gto.Mole', 'gto.Mole', ([], {}), '()\n', (124, 126), False, 'from pyscf import gto, scf, adc\n'), ((268, 280), 'pyscf.scf.RHF', 'scf.RHF', (['mol'], {}), '(mol)\n', (275, 280), False, 'from pyscf import gto, scf, adc\n'), ((322, 333), 'pyscf.adc.ADC', 'adc.ADC', (['mf'], {}), '(mf)\n', (329, 333), ... |
import re
from functools import partial
from bottery.exceptions import ValidationError
class CaseSensitiveOptionMixin:
def clean_case_senstive(self):
if not self.kwargs.get('case_sensitive'):
self.message.text = self.message.text.lower()
class PlatformsOptionMixin:
def clean_platforms(s... | [
"functools.partial",
"re.compile"
] | [((2358, 2402), 'functools.partial', 'partial', (['_handle_msg'], {'Handler': 'DefaultHandler'}), '(_handle_msg, Handler=DefaultHandler)\n', (2365, 2402), False, 'from functools import partial\n'), ((2413, 2457), 'functools.partial', 'partial', (['_handle_msg'], {'Handler': 'MessageHandler'}), '(_handle_msg, Handler=Me... |
import numpy as np
from astropy.io import fits
def calc_erro(arquivo_1, arquivo_2, arquivo_3): #Define a funcao que calcula a soma quadratica dos erros dos 3 arquivos
hdul_1 = fits.open(arquivo_1) #Abre o arquivo Header Data Unit List, formado por um header e um data
hdul_2 = fits.open(arquivo_2)
hdul_3 = ... | [
"astropy.io.fits.PrimaryHDU",
"astropy.io.fits.open",
"numpy.sqrt"
] | [((181, 201), 'astropy.io.fits.open', 'fits.open', (['arquivo_1'], {}), '(arquivo_1)\n', (190, 201), False, 'from astropy.io import fits\n'), ((286, 306), 'astropy.io.fits.open', 'fits.open', (['arquivo_2'], {}), '(arquivo_2)\n', (295, 306), False, 'from astropy.io import fits\n'), ((320, 340), 'astropy.io.fits.open', ... |
__author__ = 'jamesma'
import asyncore
import socket
from cStringIO import StringIO
import logging
class SocketClient(asyncore.dispatcher):
def __init__(self, host, port):
asyncore.dispatcher.__init__(self)
self.read_buffer = StringIO()
self.logger = logging.getLogger()
self.write... | [
"cStringIO.StringIO",
"asyncore.dispatcher.__init__",
"logging.getLogger",
"asyncore.loop"
] | [((187, 221), 'asyncore.dispatcher.__init__', 'asyncore.dispatcher.__init__', (['self'], {}), '(self)\n', (215, 221), False, 'import asyncore\n'), ((249, 259), 'cStringIO.StringIO', 'StringIO', ([], {}), '()\n', (257, 259), False, 'from cStringIO import StringIO\n'), ((282, 301), 'logging.getLogger', 'logging.getLogger... |
from lttb.lttb import largest_triangle_three_buckets
import csv
def main():
with open('source.csv', 'r') as f:
c = 0
data = []
csvf = csv.reader(f, delimiter=',')
for row in csvf:
if c == 0:
c += 1
continue
data.append([int(ro... | [
"csv.reader",
"csv.writer",
"lttb.lttb.largest_triangle_three_buckets"
] | [((164, 192), 'csv.reader', 'csv.reader', (['f'], {'delimiter': '""","""'}), "(f, delimiter=',')\n", (174, 192), False, 'import csv\n'), ((380, 421), 'lttb.lttb.largest_triangle_three_buckets', 'largest_triangle_three_buckets', (['data', '(500)'], {}), '(data, 500)\n', (410, 421), False, 'from lttb.lttb import largest_... |
import wx, sys
from logging import getLogger; log = getLogger('Not Implemented')
def notImplemented():
# prep the error message
caller_info = sys._getframe(1).f_code
notImplMessage = "Unimplemented function. Function %s at line %d of file %s" \
% (caller_info.co_name, caller_info.co_firstl... | [
"sys._getframe",
"logging.getLogger"
] | [((52, 80), 'logging.getLogger', 'getLogger', (['"""Not Implemented"""'], {}), "('Not Implemented')\n", (61, 80), False, 'from logging import getLogger\n'), ((152, 168), 'sys._getframe', 'sys._getframe', (['(1)'], {}), '(1)\n', (165, 168), False, 'import wx, sys\n')] |
import smart_imports
smart_imports.all()
class TestClient(timers.Client):
def protobuf_to_type(self, type):
return type
def type_to_protobuf(self, type):
return type
timers_client = TestClient(entry_point=accounts_conf.settings.TT_PLAYERS_TIMERS_EMPTY_POINTS)
class CreateTimerTests(uti... | [
"smart_imports.all"
] | [((23, 42), 'smart_imports.all', 'smart_imports.all', ([], {}), '()\n', (40, 42), False, 'import smart_imports\n')] |
#weather bot example
#if you don't whish to set this
#just copy the file to the top-level
#folder and run it there w/out this
import os
import sys
sys.path.append("/app/.heroku/python/lib/python3.7/site-packages")
sys.path.append(".")
sys.path.append("/app/dokkaebi")
sys.path.append("dokkaebi")
print(sys.path)
print(o... | [
"sys.path.append",
"os.getcwd",
"dominate.document",
"timezonefinder.TimezoneFinder",
"os.environ.get",
"requests.get",
"configparser.ConfigParser",
"dominate.util.raw"
] | [((148, 214), 'sys.path.append', 'sys.path.append', (['"""/app/.heroku/python/lib/python3.7/site-packages"""'], {}), "('/app/.heroku/python/lib/python3.7/site-packages')\n", (163, 214), False, 'import sys\n'), ((215, 235), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (230, 235), False, 'import sy... |
import unittest, os
from TextClass.Cleaners import Cleaners
class TestCleaners(unittest.TestCase):
def test_initalization_with_stopwords_from_list(self):
stopwords=['a','the']
cl = Cleaners(stopwords)
self.assertEqual(cl.stopwords, stopwords)
def test_initalization_without_stopwords(s... | [
"os.getcwd",
"TextClass.Cleaners.Cleaners"
] | [((203, 222), 'TextClass.Cleaners.Cleaners', 'Cleaners', (['stopwords'], {}), '(stopwords)\n', (211, 222), False, 'from TextClass.Cleaners import Cleaners\n'), ((339, 363), 'TextClass.Cleaners.Cleaners', 'Cleaners', ([], {'stopwords': 'None'}), '(stopwords=None)\n', (347, 363), False, 'from TextClass.Cleaners import Cl... |
#!/usr/bin/python
#
# Copyright (c) 2019 Hewlett Packard Enterprise Development LP
#
# 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 re... | [
"time.sleep",
"ansible_collections.arubanetworks.aos_switch.plugins.module_utils.arubaoss.run_commands",
"ansible.module_utils._text.to_text",
"ansible.module_utils.basic.AnsibleModule",
"ansible_collections.arubanetworks.aos_switch.plugins.module_utils.arubaoss.get_config"
] | [((7660, 7718), 'ansible_collections.arubanetworks.aos_switch.plugins.module_utils.arubaoss.run_commands', 'run_commands', (['module', 'url', 'data', '"""POST"""'], {'wait_after_send': '(5)'}), "(module, url, data, 'POST', wait_after_send=5)\n", (7672, 7718), False, 'from ansible_collections.arubanetworks.aos_switch.pl... |
from core import GrblGcodeBuilder
from util import ShapelyUtil
from shapely.geometry import Polygon, LineString, MultiLineString
class ExtPerimeterActionProcess:
def __init__(self):
self.toolWidth = 0
self.toolLength = 0
self.wallOffset = 0
self.objectX = 0
self.objectY = 0... | [
"util.ShapelyUtil.getUnionPolygon",
"core.GrblGcodeBuilder"
] | [((1040, 1058), 'core.GrblGcodeBuilder', 'GrblGcodeBuilder', ([], {}), '()\n', (1056, 1058), False, 'from core import GrblGcodeBuilder\n'), ((1564, 1582), 'core.GrblGcodeBuilder', 'GrblGcodeBuilder', ([], {}), '()\n', (1580, 1582), False, 'from core import GrblGcodeBuilder\n'), ((2039, 2072), 'util.ShapelyUtil.getUnion... |
"""
Trains End 2 End VarNet
"""
import argparse
import os
from pathlib import Path
import random
import numpy as np
import torch
import torch.distributed as dist
from torch.optim import Adam, lr_scheduler
from torch.utils.data import DataLoader, DistributedSampler
from torch.utils import tensorboard
import fastmri
f... | [
"torch.optim.lr_scheduler.StepLR",
"argparse.ArgumentParser",
"fastmri.models.VarNet",
"fastmri.data.transforms.VarNetDataTransform",
"torch.cuda.device_count",
"pathlib.Path",
"numpy.mean",
"fastmri.data.mri_data.SliceDataset",
"torch.no_grad",
"torch.utils.data.DataLoader",
"torch.nn.parallel.... | [((576, 631), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train E2E VarNet"""'}), "(description='Train E2E VarNet')\n", (599, 631), False, 'import argparse\n'), ((2888, 2913), 'torch.cuda.device_count', 'torch.cuda.device_count', ([], {}), '()\n', (2911, 2913), False, 'import torch\n'... |
import torch
from einops import rearrange
import padertorch as pt
from padertorch.modules.dual_path_rnn import apply_examplewise
from padertorch.ops.mappings import ACTIVATION_FN_MAP
from graph_pit.examples.tasnet.coders import ConvolutionalEncoder, \
ConvolutionalDecoder
class SeparationNetwork(pt.Module):
... | [
"torch.mean",
"torch.nn.PReLU",
"padertorch.modules.dual_path_rnn.apply_examplewise",
"einops.rearrange",
"torch.chunk"
] | [((882, 898), 'torch.nn.PReLU', 'torch.nn.PReLU', ([], {}), '()\n', (896, 898), False, 'import torch\n'), ((1667, 1705), 'einops.rearrange', 'rearrange', (['separated', '"""b l n -> b n l"""'], {}), "(separated, 'b l n -> b n l')\n", (1676, 1705), False, 'from einops import rearrange\n'), ((2051, 2093), 'einops.rearran... |
#################################### IMPORTS ###################################
if __name__ == '__main__':
import sys
import os
pkg_dir = os.path.split(os.path.abspath(__file__))[0]
parent_dir, pkg_name = os.path.split(pkg_dir)
is_pygame_pkg = (pkg_name == 'tests' and
... | [
"pygame.event.wait",
"pygame.event.Event",
"pygame.event.get",
"test.test_utils.unittest.main",
"pygame.display.quit",
"os.path.abspath",
"pygame.event.post",
"pygame.event.event_name",
"pygame.event.pump",
"pygame.event.set_blocked",
"pygame.event.poll",
"pygame.event.clear",
"pygame.event.... | [((229, 251), 'os.path.split', 'os.path.split', (['pkg_dir'], {}), '(pkg_dir)\n', (242, 251), False, 'import os\n'), ((8844, 8859), 'test.test_utils.unittest.main', 'unittest.main', ([], {}), '()\n', (8857, 8859), False, 'from test.test_utils import test_not_implemented, unittest\n'), ((398, 428), 'sys.path.insert', 's... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import numpy as np
import cv2
import unittest
from random import randint
from ocr.classify import Classifier
from tempfile import NamedTemporaryFile
PARENT_DIR = os.path.dirname(__file__)
DATA_DIR = os.path.join(os.path.d... | [
"unittest.main",
"numpy.vsplit",
"ocr.classify.Classifier",
"ocr.classify.Classifier.from_pickle",
"cv2.cvtColor",
"os.path.dirname",
"numpy.hsplit",
"cv2.imread",
"numpy.array",
"numpy.reshape",
"os.path.join"
] | [((261, 286), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (276, 286), False, 'import os\n'), ((311, 338), 'os.path.dirname', 'os.path.dirname', (['PARENT_DIR'], {}), '(PARENT_DIR)\n', (326, 338), False, 'import os\n'), ((530, 566), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""digits.p... |
# --coding:utf-8--
#
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License,
# attached with Common Clause Condition 1.0, found in the LICENSES directory.
from meta.MetaService import Client
from storage.ttypes import ScanEdgeResponse
from nebula.ngData.data im... | [
"nebula.ngData.data.Row",
"nebula.ngData.data.Result",
"nebula.ngData.data.RowReader"
] | [((2331, 2343), 'nebula.ngData.data.Result', 'Result', (['rows'], {}), '(rows)\n', (2337, 2343), False, 'from nebula.ngData.data import Result\n'), ((1444, 1477), 'nebula.ngData.data.RowReader', 'RowReader', (['schema', 'schema_version'], {}), '(schema, schema_version)\n', (1453, 1477), False, 'from nebula.ngData.data ... |
from itertools import groupby
from requests.auth import HTTPBasicAuth
import json
import requests
import sys
def main(username, password):
"""Main."""
basic_auth = HTTPBasicAuth(username, password)
starred_repos = {}
page = 0
while True:
starred_url = 'https://api.github.com/users/{}/starr... | [
"requests.auth.HTTPBasicAuth",
"json.loads"
] | [((174, 207), 'requests.auth.HTTPBasicAuth', 'HTTPBasicAuth', (['username', 'password'], {}), '(username, password)\n', (187, 207), False, 'from requests.auth import HTTPBasicAuth\n'), ((618, 646), 'json.loads', 'json.loads', (['response.content'], {}), '(response.content)\n', (628, 646), False, 'import json\n')] |
#!/usr/bin/env python
import click
from intercom.models import Location
from intercom.repositories import CustomerRepository
from intercom.services import get_customers_close_to_office
@click.command()
@click.option('--dataset', default='dataset/customers.txt', help='Path to the dataset.')
@click.option('--max-dist... | [
"click.option",
"click.echo",
"click.command",
"intercom.services.get_customers_close_to_office",
"intercom.repositories.CustomerRepository",
"intercom.models.Location"
] | [((190, 205), 'click.command', 'click.command', ([], {}), '()\n', (203, 205), False, 'import click\n'), ((207, 299), 'click.option', 'click.option', (['"""--dataset"""'], {'default': '"""dataset/customers.txt"""', 'help': '"""Path to the dataset."""'}), "('--dataset', default='dataset/customers.txt', help=\n 'Path t... |
import numpy as np
import matplotlib.pyplot as plt
def create_gratings(n_spf, n_ori, n_phase, input_shape, x_train_mean, plot=False,
output_path=''):
# create various grating stimuli
grating_all = np.zeros((n_spf * n_ori * n_phase, ) + input_shape[:-1] + (3, ))
for s in range(n_spf):
... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.close",
"numpy.transpose",
"numpy.zeros",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.array",
"numpy.min",
"numpy.cos",
"numpy.max"
] | [((226, 288), 'numpy.zeros', 'np.zeros', (['((n_spf * n_ori * n_phase,) + input_shape[:-1] + (3,))'], {}), '((n_spf * n_ori * n_phase,) + input_shape[:-1] + (3,))\n', (234, 288), True, 'import numpy as np\n'), ((2844, 2887), 'numpy.cos', 'np.cos', (['(k_rot[1] * gx + k_rot[0] * gy + tau)'], {}), '(k_rot[1] * gx + k_rot... |
# -*- coding: utf-8 -*-
"""
"""
import numpy as np
import pytest
from motmot._queue import Queue
pytestmark = pytest.mark.order(3)
def test():
self = Queue(10)
assert not self
for i in range(7):
self.append(i)
assert len(self) == 7
assert self
assert np.all(self.queue[:7] == np.ar... | [
"pytest.mark.order",
"motmot._queue.Queue",
"numpy.arange"
] | [((113, 133), 'pytest.mark.order', 'pytest.mark.order', (['(3)'], {}), '(3)\n', (130, 133), False, 'import pytest\n'), ((159, 168), 'motmot._queue.Queue', 'Queue', (['(10)'], {}), '(10)\n', (164, 168), False, 'from motmot._queue import Queue\n'), ((885, 893), 'motmot._queue.Queue', 'Queue', (['(6)'], {}), '(6)\n', (890... |
import copy
import math
from ai.algorithms import Minimax
class Player:
def __init__(self, p_char):
self.char = p_char
self.is_player_turn = False
def __str__(self):
return self.char
def is_turn(self):
return self.is_player_turn
def make_turn(self, is_turn: bool):
... | [
"copy.deepcopy",
"ai.algorithms.Minimax"
] | [((711, 736), 'ai.algorithms.Minimax', 'Minimax', (['p_char', 'opp_char'], {}), '(p_char, opp_char)\n', (718, 736), False, 'from ai.algorithms import Minimax\n'), ((851, 876), 'copy.deepcopy', 'copy.deepcopy', (['game_board'], {}), '(game_board)\n', (864, 876), False, 'import copy\n')] |
#!/usr/bin/env python
import os
import sys
from pathlib import Path
module_name = '{{ cookiecutter.model_type }}'
PROJECT_DIRECTORY = Path(os.path.realpath(os.path.curdir))
FILES = {"zeuthen": PROJECT_DIRECTORY / Path("zeuthen-csrtrk.in"),
"bc": PROJECT_DIRECTORY / Path("bc-csrtrk.in"),
"esase": ... | [
"os.path.realpath",
"sys.exit",
"pathlib.Path"
] | [((142, 174), 'os.path.realpath', 'os.path.realpath', (['os.path.curdir'], {}), '(os.path.curdir)\n', (158, 174), False, 'import os\n'), ((218, 243), 'pathlib.Path', 'Path', (['"""zeuthen-csrtrk.in"""'], {}), "('zeuthen-csrtrk.in')\n", (222, 243), False, 'from pathlib import Path\n'), ((280, 300), 'pathlib.Path', 'Path... |