code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import json
class Params:
pass
def load_params():
json_data = open("settings.json")
data = json.load(json_data)
params = Params()
params.data_dir = data["data_dir"]
params.cache_dir = data["cache_dir"]
params.partitions = data["num_partitions"]
return params
def toin... | [
"json.load"
] | [((116, 136), 'json.load', 'json.load', (['json_data'], {}), '(json_data)\n', (125, 136), False, 'import json\n')] |
### tensorflow==2.2.0
import tensorflow as tf
# Weight Quantization - Input/Output=float32
converter = tf.lite.TFLiteConverter.from_saved_model('saved_model_mosaic')
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS,tf.lite.OpsSet.SELE... | [
"tensorflow.lite.TFLiteConverter.from_saved_model"
] | [((105, 167), 'tensorflow.lite.TFLiteConverter.from_saved_model', 'tf.lite.TFLiteConverter.from_saved_model', (['"""saved_model_mosaic"""'], {}), "('saved_model_mosaic')\n", (145, 167), True, 'import tensorflow as tf\n')] |
import numpy as np
from pendulum.pendulum import Pendulum2D
import matplotlib.pyplot as plt
h = 0.001 # [s] Integration step
t0 = 0 # [s] Starting time
tf = 10 # [s] End time
g = 9.81 # [m/s^2] Gravitational acceleration
L = 1 # [m] Pend... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"pendulum.pendulum.Pendulum2D",
"matplotlib.pyplot.plot",
"numpy.shape",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((668, 709), 'pendulum.pendulum.Pendulum2D', 'Pendulum2D', (['h', 'g', 'L', 'theta_0', 'omega_0', 't0'], {}), '(h, g, L, theta_0, omega_0, t0)\n', (678, 709), False, 'from pendulum.pendulum import Pendulum2D\n'), ((898, 910), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (908, 910), True, 'import matplot... |
import os
import pytest
import dcos_installer.config_util
@pytest.fixture(autouse=True)
def mock_installer_latest_complete_artifact(monkeypatch):
monkeypatch.setattr(
dcos_installer.config_util,
'installer_latest_complete_artifact',
lambda _: {'bootstrap': os.getenv('BOOTSTRAP_ID', '1234... | [
"pytest.fixture",
"os.getenv"
] | [((63, 91), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (77, 91), False, 'import pytest\n'), ((289, 323), 'os.getenv', 'os.getenv', (['"""BOOTSTRAP_ID"""', '"""12345"""'], {}), "('BOOTSTRAP_ID', '12345')\n", (298, 323), False, 'import os\n')] |
from flask import Flask
from app.config import config
def create_app(config_name: str):
"""
Factory to create Flask application context based on choosen config.
Args:
config_name: Configname
Returns:
Flask application context
"""
app = Flask(__name__)
app.config.from_obje... | [
"flask.Flask"
] | [((280, 295), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (285, 295), False, 'from flask import Flask\n')] |
import numpy as np
import math
eye_vec = np.array([0, 0, 0])
at_vec = np.array([0, 0, -1])
up_vec = np.array([0, 1, 0])
viewport = np.array([0, 0 , 800, 600])
coordinates = (np.array([10, 20 ,100, 0]))
near = 1
far = 100
def norm(vector):
return vector/np.sqrt(np.sum(np.square(vector)))
def view_matrix(eye, at, ... | [
"numpy.eye",
"math.radians",
"numpy.empty",
"math.tan",
"numpy.square",
"numpy.cross",
"numpy.transpose",
"numpy.append",
"numpy.array",
"numpy.linalg.inv",
"numpy.matmul",
"numpy.dot"
] | [((42, 61), 'numpy.array', 'np.array', (['[0, 0, 0]'], {}), '([0, 0, 0])\n', (50, 61), True, 'import numpy as np\n'), ((71, 91), 'numpy.array', 'np.array', (['[0, 0, -1]'], {}), '([0, 0, -1])\n', (79, 91), True, 'import numpy as np\n'), ((101, 120), 'numpy.array', 'np.array', (['[0, 1, 0]'], {}), '([0, 1, 0])\n', (109,... |
import sys
sys.path.append(".")
import logging
from emulation import order_event_reporter
from model.blocks import order
from model.runnables.proc_anim import run_animation_with_interface_configuration
logging.getLogger().setLevel("INFO")
order.update = order_event_reporter.update
run_animation_with_interface_conf... | [
"sys.path.append",
"model.runnables.proc_anim.run_animation_with_interface_configuration",
"logging.getLogger"
] | [((12, 32), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (27, 32), False, 'import sys\n'), ((287, 353), 'model.runnables.proc_anim.run_animation_with_interface_configuration', 'run_animation_with_interface_configuration', ([], {'emulation_active': '(False)'}), '(emulation_active=False)\n', (329, ... |
import matplotlib.pyplot as plt
import pandas as pd
import os
import json
import urllib.request as request
import numpy as np
from time import time
from datetime import datetime, timedelta
from math import log
# COSTANTI
############################################################################################
# UR... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.yscale",
"pandas.read_csv",
"matplotlib.pyplot.style.use",
"numpy.arange",
"matplotlib.pyplot.fill_between",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.close",
"os.path.dirname",
"matplotlib.pyplot.yticks",
"u... | [((9244, 9260), 'pandas.read_csv', 'pd.read_csv', (['url'], {}), '(url)\n', (9255, 9260), True, 'import pandas as pd\n'), ((14836, 14850), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (14848, 14850), True, 'import matplotlib.pyplot as plt\n'), ((15535, 15595), 'matplotlib.pyplot.figtext', 'plt.figtex... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from .. import utilities, tables
class Subnet(pulumi.CustomResource):
... | [
"warnings.warn"
] | [((6450, 6525), 'warnings.warn', 'warnings.warn', (['"""explicit use of __name__ is deprecated"""', 'DeprecationWarning'], {}), "('explicit use of __name__ is deprecated', DeprecationWarning)\n", (6463, 6525), False, 'import warnings\n'), ((6608, 6707), 'warnings.warn', 'warnings.warn', (['"""explicit use of __opts__ i... |
#!/usr/bin/env python3
"""Unit tests for phpbb2slack.py."""
import io
import json
import logging
import os
import sys
import time
from unittest.mock import patch
import pytest
import phpbb2slack # noqa:I100,I202
import rss2irc
ITEM_EXPIRATION = int(time.time())
SCRIPT_PATH = os.path.dirname(os.path.realpath(__file_... | [
"unittest.mock.patch.object",
"io.StringIO",
"json.loads",
"phpbb2slack.update_cache",
"rss2irc.CachedData",
"os.path.realpath",
"phpbb2slack.get_authors_from_file",
"rss2irc.read_cache",
"time.time",
"phpbb2slack.scrub_cache",
"phpbb2slack.main",
"phpbb2slack.format_message",
"pytest.mark.p... | [((498, 1081), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""test_data"""', "[{'url': 'http://www.example.com', 'attrs': {'category': 'test',\n 'comments_cnt': 12, 'title': 'someTitle'}, 'handle': 'someHandle',\n 'expected': {'type': 'section', 'text': {'type': 'mrkdwn', 'text':\n '[someHandle-te... |
import cv2, numpy as np
img = np.zeros((512,512,3),np.uint8)
#print(img.shape)
#img[200:300,100:300] = 255,0,0
cv2.line(img,(0,0),(img.shape[1],img.shape[0]),(0,255,0),3)
cv2.rectangle(img,(0,0),(250,350),(0,0,255),cv2.FILLED)
cv2.circle(img,(400,50),30,(255,255,0),5)
cv2.putText(img," OPENCV ",(300,200),cv2.FONT_HER... | [
"cv2.line",
"cv2.circle",
"cv2.putText",
"cv2.waitKey",
"numpy.zeros",
"cv2.rectangle",
"cv2.imshow"
] | [((31, 64), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)', 'np.uint8'], {}), '((512, 512, 3), np.uint8)\n', (39, 64), True, 'import cv2, numpy as np\n'), ((113, 180), 'cv2.line', 'cv2.line', (['img', '(0, 0)', '(img.shape[1], img.shape[0])', '(0, 255, 0)', '(3)'], {}), '(img, (0, 0), (img.shape[1], img.shape[0]), (0, 25... |
#!/usr/bin/env python3
# -*- coding=utf-8 -*-
import cv2 as cv
"""
对象检测 - HAAR级联检测器
opencv中使用HAAR级联检测器支持人脸检测、微笑、眼镜与嘴巴检测等,通过opencv源码中已训练好的xml模型数据可实现相关对象检测。api
如下:
cv.CascadeClassifier.detectMultiScale(image, scaleFactor, minNeighbors, flags, minSize, maxSize)
- image: 输入图像
... | [
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.rectangle",
"cv2.CascadeClassifier",
"cv2.destroyAllWindows"
] | [((684, 712), 'cv2.VideoCapture', 'cv.VideoCapture', (['video_param'], {}), '(video_param)\n', (699, 712), True, 'import cv2 as cv\n'), ((729, 764), 'cv2.CascadeClassifier', 'cv.CascadeClassifier', (['cascade_param'], {}), '(cascade_param)\n', (749, 764), True, 'import cv2 as cv\n'), ((1235, 1257), 'cv2.destroyAllWindo... |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, ForeignKey, Integer, String, Date
Base = declarative_base()
class Tournament(Base):
__tablename__ = "tournament"
id_tournament = Column(Integer, primary_key=True, index=True)
name_tournament = Column(String, unique=Tru... | [
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.ForeignKey",
"sqlalchemy.Column"
] | [((129, 147), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (145, 147), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((227, 272), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)', 'index': '(True)'}), '(Integer, primary_key=True, index=... |
import os
import random
import regex
import string
def remove_dir(path_to_dir):
'''Removes a non-empty dir.'''
for root, dirs, files in os.walk(path_to_dir, topdown=False):
for target_file in files:
os.remove(os.path.join(root, target_file))
os.rmdir(root)
def split_into_sentences... | [
"regex.findall",
"regex.compile",
"os.walk",
"random.choice",
"regex.sub",
"os.rmdir",
"os.path.join"
] | [((146, 181), 'os.walk', 'os.walk', (['path_to_dir'], {'topdown': '(False)'}), '(path_to_dir, topdown=False)\n', (153, 181), False, 'import os\n'), ((1011, 1046), 'regex.findall', 'regex.findall', (['_regex[0]', 'text_unit'], {}), '(_regex[0], text_unit)\n', (1024, 1046), False, 'import regex\n'), ((1502, 1537), 'regex... |
from PIL import Image
from sys import argv
if len(argv) != 4:
exit("usage: python resize.py n infile outfile")
n = int(argv[1])
infile = argv[2]
outfile = argv[3]
inimage = Image.open(infile)
width, heigh = inimage.size
outimage = inimage.resize((width * n, height * n))
outimage.save(outfile)
# To resize small... | [
"PIL.Image.open"
] | [((180, 198), 'PIL.Image.open', 'Image.open', (['infile'], {}), '(infile)\n', (190, 198), False, 'from PIL import Image\n')] |
from setuptools import setup, find_packages
extensions = []
reqs = []
for line in open('requirements.txt', 'r').readlines():
reqs.append(line)
with open ("README.md", "r") as fh:
long_description = fh.read()
setup(
name="pyneid",
version="1.0.6",
author="<NAME>",
description="NEID archiv... | [
"setuptools.find_packages"
] | [((768, 783), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (781, 783), False, 'from setuptools import setup, find_packages\n')] |
# Generated by Django 3.2 on 2021-06-02 17:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0005_auto_20210601_0709'),
]
operations = [
migrations.AddField(
model_name='pagamento',
name='limite',
... | [
"django.db.models.DecimalField"
] | [((331, 396), 'django.db.models.DecimalField', 'models.DecimalField', ([], {'decimal_places': '(2)', 'default': '(0.0)', 'max_digits': '(60)'}), '(decimal_places=2, default=0.0, max_digits=60)\n', (350, 396), False, 'from django.db import migrations, models\n')] |
import matplotlib.pyplot as plt
import pandas as pd
def plot_histograms(feature_count_table,
feature_count_start_column):
feature_count_table_df = pd.read_table(feature_count_table)
feature_count_table_df_value = _extract_value_matrix(feature_count_table_df,
... | [
"pandas.read_table",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.hist"
] | [((173, 207), 'pandas.read_table', 'pd.read_table', (['feature_count_table'], {}), '(feature_count_table)\n', (186, 207), True, 'import pandas as pd\n'), ((752, 765), 'matplotlib.pyplot.figure', 'plt.figure', (['i'], {}), '(i)\n', (762, 765), True, 'import matplotlib.pyplot as plt\n'), ((774, 827), 'matplotlib.pyplot.h... |
from datetime import datetime
import logging as log
import os
def red(text): return '\033[0;31m' + text + '\033[0m'
def green(text): return '\033[0;32m' + text + '\033[0m'
def yellow(text): return '\033[0;33m' + text + '\033[0m'
def blue(text): return '\033[0;34m' + text + '\033[0m'
def magenta(text): return '\033[0;3... | [
"os.environ.get",
"datetime.datetime.now"
] | [((782, 796), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (794, 796), False, 'from datetime import datetime\n'), ((691, 725), 'os.environ.get', 'os.environ.get', (['"""LOGLEVEL"""', '"""INFO"""'], {}), "('LOGLEVEL', 'INFO')\n", (705, 725), False, 'import os\n')] |
import os
import sys
import logging
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler,PatternMatchingEventHandler
from gii.core import EditorModule, app, signals
##----------------------------------------------------------------##
class ModuleFileWatcher( EditorMo... | [
"watchdog.observers.Observer",
"logging.warning",
"os.path.realpath",
"logging.info",
"gii.core.app.getAssetLibrary",
"gii.core.signals.connect",
"gii.core.signals.emit"
] | [((532, 542), 'watchdog.observers.Observer', 'Observer', ([], {}), '()\n', (540, 542), False, 'from watchdog.observers import Observer\n'), ((572, 619), 'gii.core.signals.connect', 'signals.connect', (['"""file.moved"""', 'self.onFileMoved'], {}), "('file.moved', self.onFileMoved)\n", (587, 619), False, 'from gii.core ... |
import pytest
import random
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from feiertag.data.vocab import Vocab
from feiertag.models.bilstm_tagger import BiLSTMTagger
from feiertag.models.bilstm_crf_tagger import BiLSTM_CRF_Tagger
import pytorch_lightning as pl
@pytest.fixture
def wor... | [
"feiertag.data.vocab.Vocab",
"pytorch_lightning.Trainer",
"random.randint",
"torch.utils.data.DataLoader",
"torch.LongTensor",
"torch.nn.Embedding"
] | [((343, 350), 'feiertag.data.vocab.Vocab', 'Vocab', ([], {}), '()\n', (348, 350), False, 'from feiertag.data.vocab import Vocab\n'), ((463, 470), 'feiertag.data.vocab.Vocab', 'Vocab', ([], {}), '()\n', (468, 470), False, 'from feiertag.data.vocab import Vocab\n'), ((996, 1029), 'torch.utils.data.DataLoader', 'DataLoade... |
# Generated by Django 2.2.6 on 2020-08-07 21:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('table', '0002_auto_20200807_1706'),
]
operations = [
migrations.AddField(
model_name='cell',
name='archived',
... | [
"django.db.models.BooleanField"
] | [((332, 366), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (351, 366), False, 'from django.db import migrations, models\n')] |
import pandas as pd
import altair as alt
class AltairChart:
"""
AltairChart is a representation of a chart.
Common utilities for charts that is independent of chart types should go here.
See Also
--------
altair-viz.github.io
"""
def __init__(self, view):
self.view = view
# self.data = pd.read_json(vi... | [
"altair.Color"
] | [((1004, 1065), 'altair.Color', 'alt.Color', (['colorAttr[0].attribute'], {'type': 'colorAttr[0].dataType'}), '(colorAttr[0].attribute, type=colorAttr[0].dataType)\n', (1013, 1065), True, 'import altair as alt\n')] |
#!/usr/bin/env python3
import os
import stat
from typing import List
class MtimeFixer:
def __init__(self, fix_ctimes: bool = False, fix_files: bool = False):
self.fix_ctimes: bool = False
self.fix_files: bool = fix_files
self.librt = None
if fix_ctimes:
if self._setup_... | [
"subprocess.run",
"subprocess.Popen",
"os.path.join",
"os.stat",
"stat.S_ISDIR",
"os.utime",
"os.listdir"
] | [((926, 1091), 'subprocess.Popen', 'subprocess.Popen', (["['timedatectl', 'set-ntp', 'true']"], {'stdin': 'subprocess.DEVNULL', 'stdout': 'subprocess.DEVNULL', 'stderr': 'subprocess.DEVNULL', 'start_new_session': '(True)'}), "(['timedatectl', 'set-ntp', 'true'], stdin=subprocess.\n DEVNULL, stdout=subprocess.DEVNULL... |
from django import template
from django.db.models import Count
from ..models import Article
register = template.Library()
@register.simple_tag
def total_articles():
return Article.objects.count()
@register.inclusion_tag('articles/post/latest_articles.html')
def show_latest_articles(count=5):
latest_articl... | [
"django.db.models.Count",
"django.template.Library"
] | [((105, 123), 'django.template.Library', 'template.Library', ([], {}), '()\n', (121, 123), False, 'from django import template\n'), ((539, 556), 'django.db.models.Count', 'Count', (['"""comments"""'], {}), "('comments')\n", (544, 556), False, 'from django.db.models import Count\n')] |
import random
import torch
from ddpg_agent import Agent
from utils import ReplayBuffer, OUNoise
BUFFER_SIZE = int(1e6) # replay buffer size
BATCH_SIZE = 128 # minibatch size
GAMMA = 0.99 # discount factor
LEARN_FREQUENCY = 3
N_LEARNING_EXP = 4
class MADDPG():
"""Creates set of agents to in... | [
"utils.ReplayBuffer",
"random.seed",
"ddpg_agent.Agent"
] | [((782, 806), 'random.seed', 'random.seed', (['random_seed'], {}), '(random_seed)\n', (793, 806), False, 'import random\n'), ((1096, 1159), 'utils.ReplayBuffer', 'ReplayBuffer', (['action_size', 'BUFFER_SIZE', 'BATCH_SIZE', 'random_seed'], {}), '(action_size, BUFFER_SIZE, BATCH_SIZE, random_seed)\n', (1108, 1159), Fals... |
#! python
import utils
import math
def process_input(i):
return [list(map(int,b)) for b in i]
def find_most_common_bits(l):
mcbits = []
for pos, _ in enumerate(l[0]):
total = 0
for bina in l:
total += bina[pos]
mcbits.append(math.floor(total/len(l)+.5))
return mcb... | [
"utils.process_raw_input"
] | [((1211, 1240), 'utils.process_raw_input', 'utils.process_raw_input', (['"""i3"""'], {}), "('i3')\n", (1234, 1240), False, 'import utils\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-17 22:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('correctiv_eurosfueraerzte', '0017_auto_20170317_1734'),
]
operations = [
mi... | [
"django.db.models.DateTimeField",
"django.db.migrations.AlterModelOptions",
"django.db.migrations.RenameField"
] | [((318, 494), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""zerodocsubmission"""', 'options': "{'ordering': ('date',), 'verbose_name': 'Zero Doctor Submission',\n 'verbose_name_plural': 'Zero Doctors'}"}), "(name='zerodocsubmission', options={'ordering':\n ('date',), ... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! Inc. 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.or... | [
"os.path.dirname",
"os.path.join"
] | [((1715, 1750), 'os.path.join', 'os.path.join', (['STACK_BIN_DIR', '"""conf"""'], {}), "(STACK_BIN_DIR, 'conf')\n", (1727, 1750), False, 'import os\n'), ((1770, 1811), 'os.path.join', 'os.path.join', (['STACK_CONFIG_DIR', '"""distros"""'], {}), "(STACK_CONFIG_DIR, 'distros')\n", (1782, 1811), False, 'import os\n'), ((1... |
from statistics import median
fluxes = [17.3, 70.1, 22.3, 16.2, 20.7]
m = median(fluxes)
print(m) | [
"statistics.median"
] | [((76, 90), 'statistics.median', 'median', (['fluxes'], {}), '(fluxes)\n', (82, 90), False, 'from statistics import median\n')] |
#!/usr/bin/python
import sys
import CppHeaderParser
import json
import pprint
import re
cppHeader = CppHeaderParser.CppHeader(sys.argv[1])
#pp = pprint.PrettyPrinter(indent=4)
#pp.pprint(cppHeader)
#sys.exit(0)
def convertType(type):
if type == "int":
return "number"
elif type == "con... | [
"CppHeaderParser.CppHeader",
"re.sub"
] | [((108, 146), 'CppHeaderParser.CppHeader', 'CppHeaderParser.CppHeader', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (133, 146), False, 'import CppHeaderParser\n'), ((455, 491), 're.sub', 're.sub', (['"""\\\\s*\\\\*\\\\s*$"""', '""""""', 'type[7:]'], {}), "('\\\\s*\\\\*\\\\s*$', '', type[7:])\n", (461, 491), False, 'impor... |
from datetime import datetime, timedelta
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy.orm import Session
from api.models.database import Base
class Requests(Base):
__tablename__ = "requests"
id = Column(Integer, primary_key=True, index=True)
ipaddr = Column(String)
url = Column... | [
"datetime.datetime.now",
"datetime.timedelta",
"sqlalchemy.Column"
] | [((233, 278), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)', 'index': '(True)'}), '(Integer, primary_key=True, index=True)\n', (239, 278), False, 'from sqlalchemy import Column, Integer, String, DateTime\n'), ((289, 303), 'sqlalchemy.Column', 'Column', (['String'], {}), '(String)\n', (295, 303),... |
from requests import get
from requests.exceptions import RequestException
from contextlib import closing
from bs4 import BeautifulSoup
from openpyxl import load_workbook, Workbook
import os.path, xlsxwriter
def simple_get(url):
# Get content by user input url by making an HTTP GET request.
# Content type can be HTML/X... | [
"bs4.BeautifulSoup",
"xlsxwriter.Workbook",
"openpyxl.load_workbook",
"requests.get"
] | [((3718, 3748), 'xlsxwriter.Workbook', 'xlsxwriter.Workbook', (['file_name'], {}), '(file_name)\n', (3737, 3748), False, 'import os.path, xlsxwriter\n'), ((7588, 7621), 'openpyxl.load_workbook', 'load_workbook', ([], {'filename': 'file_name'}), '(filename=file_name)\n', (7601, 7621), False, 'from openpyxl import load_w... |
import argparse
import os
import platform
import operations
import sys
# Initialising operation module
try:
file_opr = operations.file()
editor_opr = operations.editor()
template_opr = operations.template()
system_settings = operations.system_settings()
except FileNotFoundError:
print("File is not ... | [
"operations.template",
"argparse.ArgumentParser",
"os.system",
"platform.system",
"operations.file",
"operations.editor",
"operations.system_settings",
"sys.exit"
] | [((935, 1267), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""Auto CPP Compiler"""', 'formatter_class': 'argparse.RawDescriptionHelpFormatter', 'description': 'LOGO', 'epilog': '"""Example:\n > acc prog.cpp\n > acc --ct\n > acc --ce vim\n > acc prog.cpp -eo output.out\n \nFor... |
#!/usr/bin/env python
import unittest
from netutils_linux_monitoring.softnet_stat import SoftnetStat
class SoftnetStatTests(unittest.TestCase):
first = """
9d3cbd5e 00000000 0000004d 00000000 00000000 00000000 00000000 00000000 00000000 00000000
301350a8 00000000 00000025 00000000 00000000 00000000 00000... | [
"unittest.main",
"netutils_linux_monitoring.softnet_stat.SoftnetStat"
] | [((2164, 2179), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2177, 2179), False, 'import unittest\n'), ((2058, 2071), 'netutils_linux_monitoring.softnet_stat.SoftnetStat', 'SoftnetStat', ([], {}), '()\n', (2069, 2071), False, 'from netutils_linux_monitoring.softnet_stat import SoftnetStat\n'), ((1747, 1760), 'n... |
from django.db import models
from django.contrib.auth.models import User
from s10day12bbs import settings
# Create your models here.
class Article(models.Model):
title = models.CharField(max_length=256)
category = models.ForeignKey('Category') # 一对多关系,单选
content = models.TextField()
summary = mode... | [
"django.db.models.TextField",
"django.db.models.OneToOneField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.ImageField",
"django.db.models.DateTimeField"
] | [((177, 209), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(256)'}), '(max_length=256)\n', (193, 209), False, 'from django.db import models\n'), ((225, 254), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""Category"""'], {}), "('Category')\n", (242, 254), False, 'from django.db impor... |
"""Tests for module generate_code."""
import unittest
import requests
import yaml
import generate_code
# pylint: disable=protected-access
class TestUnit(unittest.TestCase):
"""Unit tests for generate_code."""
def test_pythonize_name(self):
"""Test function that converts cli name to pythonic name."""... | [
"generate_code.pythonize_name",
"unittest.skip",
"generate_code.get_commands",
"yaml.safe_load",
"generate_code._get_az_function_def",
"requests.get"
] | [((1987, 2036), 'unittest.skip', 'unittest.skip', (['"""this hasn\'t been implemented yet"""'], {}), '("this hasn\'t been implemented yet")\n', (2000, 2036), False, 'import unittest\n'), ((2753, 2790), 'unittest.skip', 'unittest.skip', (['"""not implemented yet."""'], {}), "('not implemented yet.')\n", (2766, 2790), Fa... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import numpy as np
from keras.regularizers import Regularizer
from keras import backend as K
from keras.utils.generic_utils import get_from_module
class KLRegularizer(Regularizer):
def __init__(self, beta=0.0):
self.beta = K.cast_to_floatx(beta)
def __call__(sel... | [
"keras.backend.sum",
"keras.backend.cast_to_floatx"
] | [((278, 300), 'keras.backend.cast_to_floatx', 'K.cast_to_floatx', (['beta'], {}), '(beta)\n', (294, 300), True, 'from keras import backend as K\n'), ((400, 427), 'keras.backend.sum', 'K.sum', (['logalpha'], {'keepdims': '(0)'}), '(logalpha, keepdims=0)\n', (405, 427), True, 'from keras import backend as K\n')] |
import pytest
from gerrychain import Graph, Partition
from gerrychain.random import random
from gerrychain.updaters import cut_edges
import networkx
@pytest.fixture
def three_by_three_grid():
"""Returns a graph that looks like this:
0 1 2
3 4 5
6 7 8
"""
graph = Graph()
graph.add_edges_fr... | [
"gerrychain.random.random.randint",
"networkx.complete_graph",
"gerrychain.Graph",
"pytest.mark.skip",
"gerrychain.Partition"
] | [((290, 297), 'gerrychain.Graph', 'Graph', ([], {}), '()\n', (295, 297), False, 'from gerrychain import Graph, Partition\n'), ((1124, 1150), 'networkx.complete_graph', 'networkx.complete_graph', (['(3)'], {}), '(3)\n', (1147, 1150), False, 'import networkx\n'), ((1203, 1257), 'gerrychain.Partition', 'Partition', (['gra... |
# Copyright 2019 <NAME>. All rights reserved.
# Licensed under the MIT License.
import pathlib
import shutil
from nose.tools import ok_, eq_
import luigi
import mlflow
from projects.base import ProjectBase
from tests.utils.dummy_schedular import DummyFactory
class DummyProject(ProjectBase):
param1 = luigi.IntPar... | [
"nose.tools.ok_",
"pathlib.Path",
"nose.tools.eq_",
"shutil.rmtree",
"luigi.IntParameter",
"tests.utils.dummy_schedular.DummyFactory"
] | [((308, 328), 'luigi.IntParameter', 'luigi.IntParameter', ([], {}), '()\n', (326, 328), False, 'import luigi\n'), ((1038, 1090), 'nose.tools.eq_', 'eq_', (['project.parameters', "{'param1': 10, 'param2': 2}"], {}), "(project.parameters, {'param1': 10, 'param2': 2})\n", (1041, 1090), False, 'from nose.tools import ok_, ... |
import os
import pickle
import pandas as pd
_cwd = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
def add_metadata_to_exp(exp, met):
"""
Adds metadata to the expression dataframe and returns the combined object
:param pd.DataFrame exp: Expression dataframe
:param pd.DataFram... | [
"os.getcwd",
"os.path.dirname",
"os.path.join"
] | [((3991, 4040), 'os.path.join', 'os.path.join', (['_cwd', '"""cancer-MAB-gene-targets.txt"""'], {}), "(_cwd, 'cancer-MAB-gene-targets.txt')\n", (4003, 4040), False, 'import os\n'), ((4857, 4893), 'os.path.join', 'os.path.join', (['_cwd', '"""UCSF-genes.csv"""'], {}), "(_cwd, 'UCSF-genes.csv')\n", (4869, 4893), False, '... |
"""
Module with util functions connected to email addresses
"""
import re
def is_email(email: str) -> bool:
""" Uses regex to check if a incoming string is an email address"""
regex = "^([a-zA-Z0-9]+[\\._-]?[a-zA-Z0-9]+)[@](\\w+[.])+\\w{2,3}$"
return re.search(regex, email)
| [
"re.search"
] | [((265, 288), 're.search', 're.search', (['regex', 'email'], {}), '(regex, email)\n', (274, 288), False, 'import re\n')] |
from __future__ import division, unicode_literals, print_function, absolute_import
import json
import sys
import requests
from flask_oauthlib.client import OAuthResponse
sys.path.extend([
'./../',
'./',
'./../../',
])
from flask import Flask
from six.moves.urllib.parse import urlparse, parse_qs
import r... | [
"six.moves.urllib.parse.parse_qs",
"sys.path.extend",
"flask.Flask",
"os.path.dirname",
"mock.patch",
"json.dumps",
"requests.auth._basic_auth_str",
"requests.Response",
"oauth_middleware.providers.zalando.make_zalando_oauth",
"oauth_middleware.make_oauth_wsgi",
"six.moves.urllib.parse.urlparse"... | [((173, 217), 'sys.path.extend', 'sys.path.extend', (["['./../', './', './../../']"], {}), "(['./../', './', './../../'])\n", (188, 217), False, 'import sys\n'), ((1238, 1253), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (1243, 1253), False, 'from flask import Flask\n'), ((1452, 1480), 'oauth_middleware... |
'''
Created on April 27, 2018
@author: <NAME>
'''
from evaluation.experiment import Experiment
import data.load_data as load_data
import numpy as np
import os
gt, annos, doc_start, text, gt_nocrowd, doc_start_nocrowd, text_nocrowd, gt_val, _ = \
load_data.load_ner_data(False)
# debug with subset -------
s = 100
... | [
"os.mkdir",
"data.load_data.load_ner_data",
"os.path.isdir",
"evaluation.experiment.Experiment",
"numpy.argwhere",
"os.path.join"
] | [((252, 282), 'data.load_data.load_ner_data', 'load_data.load_ner_data', (['(False)'], {}), '(False)\n', (275, 282), True, 'import data.load_data as load_data\n'), ((545, 594), 'os.path.join', 'os.path.join', (['load_data.output_root_dir', '"""ner_al"""'], {}), "(load_data.output_root_dir, 'ner_al')\n", (557, 594), Fal... |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo
from app.models import User
class LoginForm(FlaskForm):
username = StringField('Usuário', validators=[DataRequired()])
password... | [
"wtforms.validators.Email",
"wtforms.BooleanField",
"wtforms.SubmitField",
"app.models.User.query.filter_by",
"wtforms.validators.EqualTo",
"wtforms.validators.DataRequired",
"wtforms.validators.ValidationError"
] | [((398, 430), 'wtforms.BooleanField', 'BooleanField', (['"""Lembre-me de mim"""'], {}), "('Lembre-me de mim')\n", (410, 430), False, 'from wtforms import StringField, PasswordField, BooleanField, SubmitField\n'), ((444, 464), 'wtforms.SubmitField', 'SubmitField', (['"""Logar"""'], {}), "('Logar')\n", (455, 464), False,... |
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings
from rest_framework import routers
from .views import UserViewset
router = routers.DefaultRouter()
router.register('', UserViewset)
app_name = 'users'
urlpatterns = [
... | [
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((225, 248), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (246, 248), False, 'from rest_framework import routers\n'), ((332, 352), 'django.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (339, 352), False, 'from django.urls import path, include\n')] |
import gym
import pybulletgym # required to register the pybullet envs
import traceback
from pybulletgym.tests.roboschool.agents.policies import SmallReactivePolicy
import pybulletgym.tests.roboschool.agents.AntPyBulletEnv_v0_2017may as AntWeights
import pybulletgym.tests.roboschool.agents.AtlasPyBulletEnv_v0_2017jul... | [
"traceback.format_exc",
"gym.envs.registry.all",
"gym.make",
"pybulletgym.tests.roboschool.agents.policies.SmallReactivePolicy"
] | [((1408, 1431), 'gym.envs.registry.all', 'gym.envs.registry.all', ([], {}), '()\n', (1429, 1431), False, 'import gym\n'), ((9029, 9047), 'gym.make', 'gym.make', (['env_name'], {}), '(env_name)\n', (9037, 9047), False, 'import gym\n'), ((9176, 9285), 'pybulletgym.tests.roboschool.agents.policies.SmallReactivePolicy', 'S... |
"""
Django settings for miniature-potato DEMO project.
Generated by 'django-admin startproject' using Django 2.0.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
... | [
"os.environ.get",
"os.path.abspath",
"os.path.join",
"dj_database_url.config"
] | [((902, 925), 'os.environ.get', 'os.environ.get', (['"""DEBUG"""'], {}), "('DEBUG')\n", (916, 925), False, 'import os\n'), ((2554, 2594), 'os.environ.get', 'os.environ.get', (['"""SOCIAL_AUTH_GITHUB_KEY"""'], {}), "('SOCIAL_AUTH_GITHUB_KEY')\n", (2568, 2594), False, 'import os\n'), ((2623, 2666), 'os.environ.get', 'os.... |
from threading import Thread
import time
import WonderPy.core.wwMain
from WonderPy.core.wwConstants import WWRobotConstants
from WonderPy.components.wwMedia import WWMedia
"""
This example shows connecting to the robot and issuing some simple commands.
See the other 'tutorial' and 'misc' examples for more complex sc... | [
"threading.Thread",
"time.sleep"
] | [((1432, 1445), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (1442, 1445), False, 'import time\n'), ((581, 628), 'threading.Thread', 'Thread', ([], {'target': 'self.thread_hello', 'args': '(robot,)'}), '(target=self.thread_hello, args=(robot,))\n', (587, 628), False, 'from threading import Thread\n')] |
# Copyright (C) 2014 Optiv, Inc. (<EMAIL>), Updated 2016 for Cuckoo 2.0
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
from lib.cuckoo.common.abstracts import Signature
import struct
class Bootkit(Signature):
name = "bootkit"
descript... | [
"lib.cuckoo.common.abstracts.Signature.__init__"
] | [((593, 634), 'lib.cuckoo.common.abstracts.Signature.__init__', 'Signature.__init__', (['self', '*args'], {}), '(self, *args, **kwargs)\n', (611, 634), False, 'from lib.cuckoo.common.abstracts import Signature\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Ficapy
# Create: '15/8/10'
# 压缩所有图片至jpg格式,且限制大小,调用convert(imagemagick)
import sys
import os
from shutil import copyfile
from os.path import join, dirname, getsize, split, splitext, abspath
def back_up():
for root, dirs, files in os.walk(dirname(abspath(__... | [
"os.remove",
"os.path.abspath",
"os.makedirs",
"os.path.getsize",
"os.path.splitext",
"shutil.copyfile",
"os.path.split",
"os.path.join",
"sys.exit"
] | [((862, 873), 'os.path.split', 'split', (['file'], {}), '(file)\n', (867, 873), False, 'from os.path import join, dirname, getsize, split, splitext, abspath\n'), ((895, 909), 'os.path.splitext', 'splitext', (['file'], {}), '(file)\n', (903, 909), False, 'from os.path import join, dirname, getsize, split, splitext, absp... |
# Generated by Django 2.2 on 2019-05-23 13:12
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0003_post_likes'),
]
operations = [
migrations.AlterField(
model_name='post',
... | [
"django.db.models.ManyToManyField"
] | [((353, 448), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(True)', 'related_name': '"""post_likes"""', 'to': 'settings.AUTH_USER_MODEL'}), "(blank=True, related_name='post_likes', to=settings.\n AUTH_USER_MODEL)\n", (375, 448), False, 'from django.db import migrations, models\n')] |
import os
import wikifile
from wikifile.utils import Widget
from wikifile.wikiFile import WikiFile
from wikifile.metamodel import Context, Topic, UML, Property, MetaModelElement
from wikifile.smw import SMWPart, SMW, Form, ListOf, Query, TemplatePage
import json
import sys
import jinja2
from distutils.sysconfig import... | [
"json.load",
"json.loads",
"os.path.dirname",
"distutils.sysconfig.get_python_lib",
"sys.exit",
"wikifile.wikiFile.WikiFile",
"jinja2.Environment",
"jinja2.FileSystemLoader",
"wikifile.smw.SMWPart.getAll",
"jinja2.ChoiceLoader",
"wikifile.metamodel.MetaModelElement.get_metamodels",
"wikifile.m... | [((11530, 11548), 'sys.exit', 'sys.exit', (['exitCode'], {}), '(exitCode)\n', (11538, 11548), False, 'import sys\n'), ((5447, 5474), 'jinja2.ChoiceLoader', 'jinja2.ChoiceLoader', (['loader'], {}), '(loader)\n', (5466, 5474), False, 'import jinja2\n'), ((5497, 5538), 'jinja2.Environment', 'jinja2.Environment', ([], {'lo... |
#!/usr/bin/python3.4
#
# Copyright 2015 - The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | [
"acts.asserts.explicit_pass",
"acts.asserts.assert_equal"
] | [((885, 939), 'acts.asserts.assert_equal', 'asserts.assert_equal', (["self.user_params['icecream']", '(42)'], {}), "(self.user_params['icecream'], 42)\n", (905, 939), False, 'from acts import asserts\n'), ((948, 1009), 'acts.asserts.assert_equal', 'asserts.assert_equal', (["self.user_params['extra_param']", '"""haha"""... |
# Modified from https://github.com/neulab/compare-mt/blob/master/compare_mt/reporters.py
import matplotlib
from argparse import ArgumentParser
matplotlib.use('agg')
from matplotlib import pyplot as plt
plt.rcParams['font.family'] = 'sans-serif'
import numpy as np
import os
import logging as log
log.basicConfig(lev... | [
"argparse.ArgumentParser",
"logging.basicConfig",
"os.makedirs",
"os.path.exists",
"matplotlib.pyplot.subplots",
"matplotlib.use",
"matplotlib.pyplot.xticks",
"os.path.join",
"matplotlib.pyplot.savefig"
] | [((145, 166), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (159, 166), False, 'import matplotlib\n'), ((301, 332), 'logging.basicConfig', 'log.basicConfig', ([], {'level': 'log.INFO'}), '(level=log.INFO)\n', (316, 332), True, 'import logging as log\n'), ((617, 633), 'argparse.ArgumentParser', '... |
import os
import logging
from subprocess import Popen, PIPE
import xml.etree.ElementTree as ET
from .bases import StorAvailPlugin, StorAvailInstance
from pystatus.helpers import peek_binary
def _check_path(path: str, log: logging.Logger):
p = Popen([path, "version"], stdin=PIPE, stdout=PIPE, stderr=PIPE)
(std... | [
"subprocess.Popen",
"pystatus.helpers.peek_binary"
] | [((249, 311), 'subprocess.Popen', 'Popen', (["[path, 'version']"], {'stdin': 'PIPE', 'stdout': 'PIPE', 'stderr': 'PIPE'}), "([path, 'version'], stdin=PIPE, stdout=PIPE, stderr=PIPE)\n", (254, 311), False, 'from subprocess import Popen, PIPE\n'), ((1685, 1703), 'pystatus.helpers.peek_binary', 'peek_binary', (['"""zfs"""... |
from rpyc import Service
import rpyc
from rpyc.utils.server import ThreadedServer
from rpyc import BgServingThread
from rpyc.utils.helpers import classpartial
import os
import random
import configparser
import uuid
import pandas as pd
from threading import Thread
import time
import logging
NAMENODE_HOST = '192.168.43.... | [
"threading.Thread",
"os.remove",
"os.makedirs",
"logging.basicConfig",
"rpyc.utils.helpers.classpartial",
"os.getcwd",
"random.randint",
"rpyc.utils.server.ThreadedServer",
"os.path.exists",
"logging.log",
"time.sleep",
"rpyc.connect",
"os.listdir"
] | [((698, 808), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""datanode.log"""', 'level': 'logging.DEBUG', 'format': 'LOG_FORMAT', 'datefmt': 'DATE_FORMAT'}), "(filename='datanode.log', level=logging.DEBUG, format=\n LOG_FORMAT, datefmt=DATE_FORMAT)\n", (717, 808), False, 'import logging\n'), ((30... |
#!/usr/bin/env python
import inspect
from public import public
# for frame, filename, line_number, function_name, lines, index in frames:
@public
def caller_modules():
frames = inspect.getouterframes(inspect.currentframe())[1:]
modules = []
for frame, _, _, _, _, _ in frames:
module = inspect.get... | [
"inspect.getmodule",
"inspect.currentframe"
] | [((309, 333), 'inspect.getmodule', 'inspect.getmodule', (['frame'], {}), '(frame)\n', (326, 333), False, 'import inspect\n'), ((207, 229), 'inspect.currentframe', 'inspect.currentframe', ([], {}), '()\n', (227, 229), False, 'import inspect\n')] |
import logging
import unittest
from animal_avatar.utils import rand
logger = logging.getLogger(__name__)
class TestCustomRandom(unittest.TestCase):
def test_custom_random(self):
seeds = (
'seed', 'test', 'some long string over there!'
)
expected_results = (
(-2038... | [
"unittest.main",
"animal_avatar.utils.rand.seed_random",
"logging.getLogger"
] | [((79, 106), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (96, 106), False, 'import logging\n'), ((1148, 1163), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1161, 1163), False, 'import unittest\n'), ((720, 742), 'animal_avatar.utils.rand.seed_random', 'rand.seed_random', (['seed... |
# -*- coding: utf-8 -*-
import datetime
import os
import pathlib
import re
from jinja2 import Environment
from jinja2.environment import Template
from jinja2.loaders import BaseLoader
import filepaths
ENVIRONMENT = Environment(loader=BaseLoader())
def filter(function):
ENVIRONMENT.filters[function.__name__] ... | [
"jinja2.loaders.BaseLoader",
"datetime.datetime.utcnow",
"pathlib.Path",
"filepaths.SMARTHANDS_DIRECTORY.glob",
"os.getenv"
] | [((1833, 1882), 'filepaths.SMARTHANDS_DIRECTORY.glob', 'filepaths.SMARTHANDS_DIRECTORY.glob', (['"""**/*.jinja"""'], {}), "('**/*.jinja')\n", (1868, 1882), False, 'import filepaths\n'), ((239, 251), 'jinja2.loaders.BaseLoader', 'BaseLoader', ([], {}), '()\n', (249, 251), False, 'from jinja2.loaders import BaseLoader\n'... |
import os
import time
import json
import logging
from subprocess import Popen, DEVNULL
from threading import Thread
from socket import socket, AF_UNIX, SOCK_DGRAM
from . import Server, _Manager
TIMEOUT = 90 # Must > 30
CHECK_PERIOD = 180
class Manager(_Manager):
def __init__(self, print_ss_log=True, manager_... | [
"threading.Thread",
"subprocess.Popen",
"os.remove",
"logging.debug",
"os.makedirs",
"json.dump",
"logging.warning",
"socket.socket",
"os.path.exists",
"time.sleep",
"time.time",
"logging.info",
"os.path.join"
] | [((653, 701), 'threading.Thread', 'Thread', ([], {'target': 'self._receiving_stat', 'daemon': '(True)'}), '(target=self._receiving_stat, daemon=True)\n', (659, 701), False, 'from threading import Thread\n'), ((733, 794), 'threading.Thread', 'Thread', ([], {'target': 'self._restarting_inactive_servers', 'daemon': '(True... |
# Copyright 2021 ICON Foundation
#
# 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... | [
"scripts.deploy_contract.deploy",
"random.randint"
] | [((1836, 1851), 'random.randint', 'randint', (['(1)', '(100)'], {}), '(1, 100)\n', (1843, 1851), False, 'from random import randint\n'), ((2569, 2584), 'random.randint', 'randint', (['(2)', '(100)'], {}), '(2, 100)\n', (2576, 2584), False, 'from random import randint\n'), ((1084, 1117), 'scripts.deploy_contract.deploy'... |
from django.urls import include, path
from . import views
from django.views.static import serve
from django.conf.urls import url
app_name = 'data'
urlpatterns = [
path('<int:account_id>/<str:prestatus>/', views.detail, name='detail'),
path('<int:account_id>/before_add', views.before_add, name='before_add'),
path(... | [
"django.urls.path"
] | [((165, 235), 'django.urls.path', 'path', (['"""<int:account_id>/<str:prestatus>/"""', 'views.detail'], {'name': '"""detail"""'}), "('<int:account_id>/<str:prestatus>/', views.detail, name='detail')\n", (169, 235), False, 'from django.urls import include, path\n'), ((239, 311), 'django.urls.path', 'path', (['"""<int:ac... |
from ..managers import IWarnManager
from holobot.discord.sdk.actions import ReplyAction
from holobot.discord.sdk.commands import CommandBase, CommandInterface
from holobot.discord.sdk.commands.models import CommandResponse, ServerChatInteractionContext
from holobot.discord.sdk.enums import Permission
from holobot.sdk.i... | [
"holobot.sdk.utils.textify_timedelta",
"holobot.sdk.ioc.decorators.injectable"
] | [((402, 430), 'holobot.sdk.ioc.decorators.injectable', 'injectable', (['CommandInterface'], {}), '(CommandInterface)\n', (412, 430), False, 'from holobot.sdk.ioc.decorators import injectable\n'), ((1109, 1143), 'holobot.sdk.utils.textify_timedelta', 'textify_timedelta', (['decay_threshold'], {}), '(decay_threshold)\n',... |
import json
from flask import request
from flask_restplus import Resource
from chameleon.utils import db_instance
class Annotate(Resource):
""" return annotations
"""
def get(self):
return {'hello': 'world'}
def post(self):
data = request.get_json()
print(data)
return... | [
"flask.request.get_json"
] | [((267, 285), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (283, 285), False, 'from flask import request\n')] |
import asyncio
import datetime
import random
import discord
from datetime import date, datetime
from discord import guild
from discord.ext import commands
from discord.utils import get
class Events(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listene... | [
"discord.utils.get",
"discord.guild.fetch_channel",
"random.randint",
"discord.Embed",
"discord.guild.fetch_member",
"discord.guild.create_category",
"discord.ext.commands.Cog.listener",
"datetime.datetime.utcnow",
"discord.guild.create_role",
"discord.PermissionOverwrite",
"discord.guild.create... | [((300, 323), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (321, 323), False, 'from discord.ext import commands\n'), ((1936, 1982), 'discord.utils.get', 'discord.utils.get', (['guild.roles'], {'name': '"""Support"""'}), "(guild.roles, name='Support')\n", (1953, 1982), False, 'import d... |
# -*- coding:utf-8 -*-
import tensorflow as tf
from nlp.text_classification.cnn_multiclass import train
from nlp.text_classification.cnn_multiclass import predict
import argparse
def main(args):
if args.process == tf.estimator.ModeKeys.TRAIN:
train.train_cnn_classfier(args)
elif args.process == tf.es... | [
"nlp.text_classification.cnn_multiclass.train.train_cnn_classfier",
"argparse.ArgumentParser",
"nlp.text_classification.cnn_multiclass.predict.predict"
] | [((499, 524), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (522, 524), False, 'import argparse\n'), ((258, 289), 'nlp.text_classification.cnn_multiclass.train.train_cnn_classfier', 'train.train_cnn_classfier', (['args'], {}), '(args)\n', (283, 289), False, 'from nlp.text_classification.cnn_mu... |
from pyfileconf import Selector
from tests.input_files.example_config import ConfigExample
def a_function(a: str) -> str:
s = Selector()
config: ConfigExample = s.dcpm.confs.ConfigExample()
return a + 'd' | [
"pyfileconf.Selector"
] | [((133, 143), 'pyfileconf.Selector', 'Selector', ([], {}), '()\n', (141, 143), False, 'from pyfileconf import Selector\n')] |
import h5py
import numpy
import numpy as np
from pathlib import Path
import torch
from matplotlib import pyplot
title_font = {
'fontsize': 50,
'fontweight': 'bold'
}
file_path = 'data/raw/MVP_Test_CP.h5'
input_file = h5py.File(file_path, 'r')
index = 4000
temp = index // 26
incomplete_pcd = np.array(input_... | [
"matplotlib.pyplot.title",
"h5py.File",
"matplotlib.pyplot.show",
"matplotlib.pyplot.figure",
"numpy.array"
] | [((228, 253), 'h5py.File', 'h5py.File', (['file_path', '"""r"""'], {}), "(file_path, 'r')\n", (237, 253), False, 'import h5py\n'), ((305, 351), 'numpy.array', 'np.array', (["input_file['incomplete_pcds'][index]"], {}), "(input_file['incomplete_pcds'][index])\n", (313, 351), True, 'import numpy as np\n'), ((367, 410), '... |
__all__ = ['Invitation']
import sqlalchemy as sa
from sqlalchemy.orm import relationship
from sqlalchemy.dialects import postgresql as psql
from sqlalchemy_utils import EmailType
from sqlalchemy import event
from baselayer.app.models import Base, AccessibleIfUserMatches
from baselayer.app.env import load_env
from ..... | [
"sqlalchemy.dialects.postgresql.ARRAY",
"sqlalchemy.ForeignKey",
"baselayer.app.models.AccessibleIfUserMatches",
"sqlalchemy.orm.relationship",
"sqlalchemy_utils.EmailType",
"sqlalchemy.Column",
"sqlalchemy.String",
"sqlalchemy.event.listens_for",
"baselayer.app.env.load_env"
] | [((402, 412), 'baselayer.app.env.load_env', 'load_env', ([], {}), '()\n', (410, 412), False, 'from baselayer.app.env import load_env\n'), ((1734, 1779), 'sqlalchemy.event.listens_for', 'event.listens_for', (['Invitation', '"""after_insert"""'], {}), "(Invitation, 'after_insert')\n", (1751, 1779), False, 'from sqlalchem... |
from v1_0.user_roles import anonymous_user, authenticated_user, bumblebee_user
import unittest
class HarbourServiceTest(unittest.TestCase):
def test_anonymous_user(self):
r = anonymous_user.get('harbour/mirrors')
self.assertEqual(r.status_code, 401)
def check_harbour_service(self, user=authen... | [
"unittest.main",
"v1_0.user_roles.anonymous_user.get"
] | [((634, 649), 'unittest.main', 'unittest.main', ([], {}), '()\n', (647, 649), False, 'import unittest\n'), ((189, 226), 'v1_0.user_roles.anonymous_user.get', 'anonymous_user.get', (['"""harbour/mirrors"""'], {}), "('harbour/mirrors')\n", (207, 226), False, 'from v1_0.user_roles import anonymous_user, authenticated_user... |
import urllib.parse
from django.conf import settings
from django.shortcuts import render
from rest_framework.decorators import api_view
from rest_framework.exceptions import AuthenticationFailed
from rest_framework.response import Response
from .. import serializers
from ..services import google, spotify, spotify_sta... | [
"django.shortcuts.render",
"rest_framework.exceptions.AuthenticationFailed",
"rest_framework.decorators.api_view",
"rest_framework.response.Response"
] | [((525, 543), 'rest_framework.decorators.api_view', 'api_view', (["['POST']"], {}), "(['POST'])\n", (533, 543), False, 'from rest_framework.decorators import api_view\n'), ((1399, 1416), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (1407, 1416), False, 'from rest_framework.decorat... |
import json
import time
import pathlib
import datetime as dt
from clumper import Clumper
from rich.table import Table
from rich.console import Console
from argparse import Namespace
import subprocess
import numpy as np
from memo import memfile, memfunc
from rasa.cli.utils import get_validated_path
from rasa.model imp... | [
"subprocess.run",
"memo.memfunc",
"rasa.shared.nlu.training_data.message.Message",
"json.loads",
"rasa.model.get_model",
"rasa.cli.utils.get_validated_path",
"time.time",
"memo.memfile",
"rasa.core.interpreter.RasaNLUInterpreter",
"rasa.model.get_model_subdirectories",
"pathlib.Path",
"rasa.mo... | [((668, 677), 'rich.console.Console', 'Console', ([], {}), '()\n', (675, 677), False, 'from rich.console import Console\n'), ((1910, 1934), 'memo.memfile', 'memfile', (['"""results.jsonl"""'], {}), "('results.jsonl')\n", (1917, 1934), False, 'from memo import memfile, memfunc\n'), ((1936, 1956), 'memo.memfunc', 'memfun... |
# Generated by Django 2.2.12 on 2020-06-10 21:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('games', '0012_game_attendance_is_confirmed'),
]
operations = [
migrations.AlterField(
model_name='game',
... | [
"django.db.models.CharField"
] | [((358, 620), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('FINISHED', 'Finished'),\n ('ARCHIVED', 'Archived'), ('CANCELED', 'Canceled'), ('VOID', 'Void'), (\n 'RECORDED', 'Archived')]", 'default': "('SCHEDULED', 'Scheduled')", 'max_length... |
import numpy as np
import pandas as pd
import urllib.request
import json
import time
import argparse
from youtube_transcript_api import YouTubeTranscriptApi
# Note: An API key is only necessary when getting videos from a channel
global api_key
api_key = ''
def get_channel_videos(channel_id, delay=0):
if api_k... | [
"pandas.DataFrame",
"json.load",
"numpy.vectorize",
"argparse.ArgumentParser",
"pandas.read_csv",
"youtube_transcript_api.YouTubeTranscriptApi.get_transcript",
"time.sleep",
"numpy.array"
] | [((1452, 1476), 'numpy.vectorize', 'np.vectorize', (['clean_link'], {}), '(clean_link)\n', (1464, 1476), True, 'import numpy as np\n'), ((1707, 1732), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1730, 1732), False, 'import argparse\n'), ((690, 707), 'time.sleep', 'time.sleep', (['delay'], {... |
from rest_framework import serializers
class EchoSerializer(serializers.Serializer):
scheme = serializers.CharField()
body = serializers.CharField()
path = serializers.CharField()
method = serializers.CharField()
userAgent = serializers.CharField()
nowTime = serializers.DateTimeField()
requ... | [
"rest_framework.serializers.IPAddressField",
"rest_framework.serializers.CharField",
"rest_framework.serializers.DateTimeField"
] | [((99, 122), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (120, 122), False, 'from rest_framework import serializers\n'), ((134, 157), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (155, 157), False, 'from rest_framework import serializers\n'), ... |
#!/usr/bin/python3
from client import Client
VERSION = "1.3.4"
def main():
client = Client(VERSION)
client.go()
if __name__ == '__main__':
main()
| [
"client.Client"
] | [((91, 106), 'client.Client', 'Client', (['VERSION'], {}), '(VERSION)\n', (97, 106), False, 'from client import Client\n')] |
from flask import Flask, render_template, jsonify, request, url_for
from shapely.geometry import Point as Shapely_point, mapping
from geojson import Point as Geoj_point, Polygon as Geoj_polygon, Feature, FeatureCollection
from datetime import datetime
from sqlalchemy import *
import pandas as pd
import geopandas as gpd... | [
"datetime.datetime.strftime",
"pandas.DataFrame",
"netCDF4.Dataset",
"numpy.dstack",
"flask.request.args.get",
"flask.Flask",
"timezonefinder.TimezoneFinder",
"plotly.express.line",
"json.dumps",
"geopy.geocoders.Nominatim",
"numpy.append",
"datetime.datetime.strptime",
"flask.jsonify",
"p... | [((4628, 4685), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['updatedDtStr', '"""%Y%m%d_%H%M%S"""'], {}), "(updatedDtStr, '%Y%m%d_%H%M%S')\n", (4654, 4685), False, 'import datetime\n'), ((4704, 4760), 'datetime.datetime.strftime', 'datetime.datetime.strftime', (['updatedDt', '"""%Y-%m-%dT%H%M%S"""'], {... |
import torch
from torch import nn
def conv3(inchannel, outchannel):
return nn.Conv2d(in_channels=inchannel,
out_channels=outchannel,
kernel_size=3,
stride=1,
padding=1)
class block(nn.Module):
def __init__(self, inchannel, o... | [
"torch.flatten",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d",
"torch.nn.Linear",
"torch.nn.MaxPool2d"
] | [((81, 178), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': 'inchannel', 'out_channels': 'outchannel', 'kernel_size': '(3)', 'stride': '(1)', 'padding': '(1)'}), '(in_channels=inchannel, out_channels=outchannel, kernel_size=3,\n stride=1, padding=1)\n', (90, 178), False, 'from torch import nn\n'), ((440, 466),... |
from lenskit import topn
import numpy as np
import lk_test_utils as lktu
def test_unrated():
ratings = lktu.ml_pandas.renamed.ratings
unrate = topn.UnratedCandidates(ratings)
cs = unrate(100)
items = ratings.item.unique()
rated = ratings[ratings.user == 100].item.unique()
assert len(cs) == ... | [
"lenskit.topn.UnratedCandidates",
"numpy.intersect1d"
] | [((155, 186), 'lenskit.topn.UnratedCandidates', 'topn.UnratedCandidates', (['ratings'], {}), '(ratings)\n', (177, 186), False, 'from lenskit import topn\n'), ((359, 384), 'numpy.intersect1d', 'np.intersect1d', (['cs', 'rated'], {}), '(cs, rated)\n', (373, 384), True, 'import numpy as np\n')] |
import cv2 as cv
import numpy as np
import time
import matplotlib.pyplot as plt
def ntr(vid,n,d):
blank_image = np.zeros((1920,1080,3), np.uint8)
fps= int(vid.get(cv.CAP_PROP_FPS))
data = []
fm = 0
out = cv.VideoWriter((d + "\\dots" + str(n) + ".avi"),cv.VideoWriter_fourcc('M','J','P','G'... | [
"cv2.GaussianBlur",
"cv2.contourArea",
"cv2.circle",
"cv2.VideoWriter_fourcc",
"cv2.cvtColor",
"cv2.imwrite",
"cv2.threshold",
"numpy.savetxt",
"numpy.zeros",
"numpy.asarray",
"cv2.waitKey",
"cv2.boundingRect",
"cv2.inRange",
"cv2.findContours",
"numpy.sqrt"
] | [((123, 158), 'numpy.zeros', 'np.zeros', (['(1920, 1080, 3)', 'np.uint8'], {}), '((1920, 1080, 3), np.uint8)\n', (131, 158), True, 'import numpy as np\n'), ((3772, 3857), 'numpy.savetxt', 'np.savetxt', (['nm', 'data'], {'delimiter': '""","""', 'fmt': '"""%.2f"""', 'header': '"""cx,cy,n,v"""', 'comments': '""""""'}), "(... |
from haven import haven_utils as hu
import itertools, copy
EXP_GROUPS = {}
count_list = []
for network in ['fcn8_vgg16']:
for loss in ['density','lcfcn', ]:
count_list += [{'name':'semseg_counting',
# 'clip_grad':True,
'n_classes':2,
... | [
"haven.haven_utils.cartesian_exp_group"
] | [((726, 1393), 'haven.haven_utils.cartesian_exp_group', 'hu.cartesian_exp_group', (["{'batch_size': 1, 'num_channels': 1, 'dataset': [{'name': 'synbols', 'mode':\n 'crowded', 'n_classes': 2, 'transform': 'basic', 'transform_mode': None\n }, {'name': 'synbols', 'mode': 'fixed_scale', 'n_classes': 2,\n 'transfor... |
from itertools import permutations
s, k = input().split()
k = int(k)
for _ in sorted(list(permutations(s, k))):
print(''.join(_)) | [
"itertools.permutations"
] | [((92, 110), 'itertools.permutations', 'permutations', (['s', 'k'], {}), '(s, k)\n', (104, 110), False, 'from itertools import permutations\n')] |
import os
import boto3
import redis
import time
import signal
import json
import logging
import subprocess
import shutil
import multiprocessing
from multiprocessing import Process
from pathlib import Path
from vw_serving.utils import dynamic_import, parse_s3_url, gen_random_string
import vw_serving.sagemaker.config.en... | [
"redis.Redis",
"subprocess.Popen",
"vw_serving.sagemaker.exceptions.AlgorithmError",
"vw_serving.sagemaker.exceptions.CustomerError",
"boto3.Session",
"boto3.dynamodb.conditions.Key",
"vw_serving.firehose_producer.FirehoseProducer",
"vw_serving.utils.gen_random_string",
"time.sleep",
"vw_serving.s... | [((687, 706), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (704, 706), False, 'import logging\n'), ((10697, 10797), 'subprocess.Popen', 'subprocess.Popen', (['"""redis-cli ping"""'], {'shell': '(True)', 'stderr': 'subprocess.STDOUT', 'stdout': 'subprocess.PIPE'}), "('redis-cli ping', shell=True, stderr=s... |
import time
import matplotlib.pyplot as plt
import numpy as np
import torch
import math
import pickle
plt.style.use('fivethirtyeight')
print(f'Imports complete')
def sin(x):
return math.sin(x*np.pi/180)
def cos(x):
return math.cos(x*np.pi/180)
class Rocket():
def __init__(self, init_pos, init_vel):
... | [
"math.sqrt",
"numpy.argmax",
"math.sin",
"matplotlib.pyplot.style.use",
"numpy.arange",
"math.cos"
] | [((102, 134), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""fivethirtyeight"""'], {}), "('fivethirtyeight')\n", (115, 134), True, 'import matplotlib.pyplot as plt\n'), ((187, 212), 'math.sin', 'math.sin', (['(x * np.pi / 180)'], {}), '(x * np.pi / 180)\n', (195, 212), False, 'import math\n'), ((234, 259), 'math... |
from django.test import (
Client,
TestCase
)
from django.contrib.auth.models import User
from gbe.models import Event
from tests.factories.gbe_factories import(
ActFactory,
BusinessFactory,
EventFactory,
GenericEventFactory,
ProfileFactory,
StyleElementFactory,
StyleGroupFactory,
... | [
"tests.factories.gbe_factories.ActFactory",
"tests.factories.gbe_factories.StyleLabelFactory",
"tests.factories.gbe_factories.StyleElementFactory",
"django.test.Client",
"tests.factories.gbe_factories.GenericEventFactory",
"tests.factories.gbe_factories.TechInfoFactory",
"tests.factories.gbe_factories.T... | [((595, 603), 'django.test.Client', 'Client', ([], {}), '()\n', (601, 603), False, 'from django.test import Client, TestCase\n'), ((667, 727), 'django.contrib.auth.models.User.objects.create_superuser', 'User.objects.create_superuser', (['"""myuser"""', '"""<EMAIL>"""', 'password'], {}), "('myuser', '<EMAIL>', password... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
class Flatten(nn.Module):
def forward(self, x):
return x.view(x.size(0), -1)
class ActorCritic(nn.Module):
def __init__(self, obs_shape, act_shape, hidden_size, recurrent):
super(Act... | [
"torch.nn.GRU",
"torch.nn.ReLU",
"torch.zeros_like",
"torch.nn.Conv2d",
"torch.nn.functional.softmax",
"torch.nn.init.constant_",
"torch.nn.Linear",
"torch.nn.init.calculate_gain",
"torch.nn.init.orthogonal_"
] | [((928, 961), 'torch.nn.Linear', 'nn.Linear', (['hidden_size', 'act_shape'], {}), '(hidden_size, act_shape)\n', (937, 961), True, 'import torch.nn as nn\n'), ((984, 1009), 'torch.nn.Linear', 'nn.Linear', (['hidden_size', '(1)'], {}), '(hidden_size, 1)\n', (993, 1009), True, 'import torch.nn as nn\n'), ((1755, 1804), 't... |
# (C) 2022 GoodData Corporation
from __future__ import annotations
import datetime
import re
from typing import Union
import gooddata_fdw.column_utils as column_utils
from gooddata_fdw.environment import ColumnDefinition, Qual
from gooddata_fdw.pg_logging import _log_debug, _log_info
from gooddata_sdk.compute_model i... | [
"gooddata_fdw.column_utils.table_col_as_computable",
"gooddata_sdk.compute_model.AbsoluteDateFilter",
"gooddata_fdw.pg_logging._log_info",
"datetime.timedelta",
"gooddata_sdk.compute_model.PositiveAttributeFilter",
"gooddata_sdk.compute_model.NegativeAttributeFilter",
"gooddata_fdw.pg_logging._log_debug... | [((1959, 2059), 'gooddata_fdw.pg_logging._log_debug', '_log_debug', (['f"""extract_filters_from_quals: filter_column={filter_entity} is date attribute"""'], {}), "(\n f'extract_filters_from_quals: filter_column={filter_entity} is date attribute'\n )\n", (1969, 2059), False, 'from gooddata_fdw.pg_logging import _l... |
#!/usr/bin/python3
import glob, os
import re
import ipwhois
def main():
unique = dict()
#unique = set()
for filename in glob.glob("*.log"):
with open(filename, 'r') as f:
line = None
while line != '':
line = f.readline().strip()
attr = line.sp... | [
"ipwhois.IPWhois",
"re.sub",
"glob.glob"
] | [((133, 151), 'glob.glob', 'glob.glob', (['"""*.log"""'], {}), "('*.log')\n", (142, 151), False, 'import glob, os\n'), ((1181, 1199), 'ipwhois.IPWhois', 'ipwhois.IPWhois', (['k'], {}), '(k)\n', (1196, 1199), False, 'import ipwhois\n'), ((567, 603), 're.sub', 're.sub', (['"""/\\\\d{2,4}"""', '""""""', 'new_attr[1]'], {}... |
from django.urls import path
from webapi.views import ProductListView, ProductDetailView, HomeIndexView, SearchView, SendMailView, AboutTemplateView
urlpatterns = [
path('', HomeIndexView.as_view(), name='home_index'),
path('products/', ProductListView.as_view(), name='products'),
path('products/<pro_type>... | [
"webapi.views.ProductDetailView.as_view",
"webapi.views.SendMailView.as_view",
"webapi.views.ProductListView.as_view",
"webapi.views.AboutTemplateView.as_view",
"webapi.views.HomeIndexView.as_view",
"webapi.views.SearchView.as_view"
] | [((179, 202), 'webapi.views.HomeIndexView.as_view', 'HomeIndexView.as_view', ([], {}), '()\n', (200, 202), False, 'from webapi.views import ProductListView, ProductDetailView, HomeIndexView, SearchView, SendMailView, AboutTemplateView\n'), ((246, 271), 'webapi.views.ProductListView.as_view', 'ProductListView.as_view', ... |
# https://deeplearningcourses.com/c/data-science-supervised-machine-learning-in-python
# https://www.udemy.com/data-science-supervised-machine-learning-in-python
from __future__ import print_function, division
from future.utils import iteritems
from builtins import range, input
# Note: you may need to update your versi... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.scatter",
"numpy.zeros",
"knn.KNN",
"builtins.range"
] | [((512, 528), 'numpy.zeros', 'np.zeros', (['(N, 2)'], {}), '((N, 2))\n', (520, 528), True, 'import numpy as np\n'), ((537, 548), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (545, 548), True, 'import numpy as np\n'), ((588, 600), 'builtins.range', 'range', (['width'], {}), '(width)\n', (593, 600), False, 'from buil... |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# 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 o... | [
"os.path.realpath",
"os.path.islink",
"os.path.join",
"os.path.basename"
] | [((1686, 1712), 'os.path.basename', 'os.path.basename', (['filename'], {}), '(filename)\n', (1702, 1712), False, 'import os\n'), ((3755, 3779), 'os.path.join', 'os.path.join', (['dirpath', 'd'], {}), '(dirpath, d)\n', (3767, 3779), False, 'import os\n'), ((3837, 3856), 'os.path.realpath', 'os.path.realpath', (['d'], {}... |
import logging
import socketserver
from utilitarian_collector.conf import settings
from utilitarian_collector.utils.module_loading import import_string
logger = logging.getLogger(__name__)
def run(address, port, threading=False):
server_cls = import_string(settings.SERVER_CLASS)
request_handler = import_st... | [
"utilitarian_collector.utils.module_loading.import_string",
"logging.getLogger"
] | [((163, 190), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (180, 190), False, 'import logging\n'), ((252, 288), 'utilitarian_collector.utils.module_loading.import_string', 'import_string', (['settings.SERVER_CLASS'], {}), '(settings.SERVER_CLASS)\n', (265, 288), False, 'from utilitarian... |
# Copyright 2020 Makani Technologies LLC
#
# 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... | [
"makani.gs.monitor2.apps.plugins.indicators.node_status.TetherNodePowerIndicator",
"makani.gs.monitor2.apps.plugins.indicators.node_status.TetherNodeFailureIndicator",
"makani.gs.monitor2.apps.plugins.common.WingTms570Nodes",
"makani.gs.monitor2.apps.plugins.indicators.node_status.TetherNodeHumidityIndicator"... | [((810, 834), 'makani.gs.monitor2.apps.plugins.common.WingTms570Nodes', 'common.WingTms570Nodes', ([], {}), '()\n', (832, 834), False, 'from makani.gs.monitor2.apps.plugins import common\n'), ((1025, 1146), 'makani.gs.monitor2.apps.plugins.indicators.node_status.TetherNodeNetworkIndicator', 'node_status.TetherNodeNetwo... |
#!/usr/bin/python
from anytree import Node, RenderTree, find, AnyNode
class SubtreeBuilder():
"""Utility class for rebuilding dependency (sub)trees from a list of (word, annos) tuples"""
def __init__(self, depindpos=0, dephdpos=1, deprelpos=2):
self.depindpos = int(depindpos)
self.dephdpos = ... | [
"anytree.AnyNode",
"anytree.find",
"anytree.RenderTree"
] | [((1330, 1387), 'anytree.find', 'find', (['rootnode', '(lambda node: node.depind == target_depind)'], {}), '(rootnode, lambda node: node.depind == target_depind)\n', (1334, 1387), False, 'from anytree import Node, RenderTree, find, AnyNode\n'), ((3215, 3271), 'anytree.AnyNode', 'AnyNode', ([], {'word': '"""TOP"""', 'de... |
"""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 restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicen... | [
"re.compile"
] | [((1594, 1613), 're.compile', 're.compile', (['DATA_RE'], {}), '(DATA_RE)\n', (1604, 1613), False, 'import re\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-27 18:13
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | [
"django.db.models.CharField",
"django.db.models.OneToOneField",
"django.db.migrations.swappable_dependency",
"django.db.models.AutoField"
] | [((312, 369), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (343, 369), False, 'from django.db import migrations, models\n'), ((506, 599), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
# coding: utf-8
"""
Octopus Server API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2019.6.7+Branch.tags-2019.6.7.Sha.aa18dc6809953218c66f57eff7d26481d9b23d6a
Generated by: https://github.com/swagger-api... | [
"unittest.main"
] | [((5891, 5906), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5904, 5906), False, 'import unittest\n')] |
import matplotlib.pyplot as plt
import torch
# mode = 'train'
# mode = 'val'
mode = 'test'
if mode == 'train':
attention_weights = torch.load('./attention_weights_train.pt',
map_location='cpu')
elif mode == 'val':
attention_weights = torch.load('./attention_weights_val.pt',
... | [
"matplotlib.pyplot.show",
"torch.load",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"torch.from_numpy"
] | [((561, 573), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (571, 573), True, 'import matplotlib.pyplot as plt\n'), ((574, 592), 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {}), '()\n', (590, 592), True, 'import matplotlib.pyplot as plt\n'), ((809, 819), 'matplotlib.pyplot.show', 'plt.show'... |
import math
class Solution(object):
def countNodes(self, root):
"""
:type root: TreeNode
:rtype: int
"""
ret = 0
if not root:
return ret
leftmost = rightmost = 0
left = right = root
while left is not None:
leftmost ... | [
"math.pow"
] | [((505, 526), 'math.pow', 'math.pow', (['(2)', 'leftmost'], {}), '(2, leftmost)\n', (513, 526), False, 'import math\n')] |