code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from agent.util import load_values, get_sim_dir, load_valid_data, get_norm_reward
from analyze.util import create_cdfs, save_dict
from utils import safe_reindex
from agent.const import DELTA_SLR
from featnames import LOOKUP
def main():
d = dict()
obs = load_valid_data(byr=False)
# value comparison
f... | [
"agent.util.get_norm_reward",
"analyze.util.save_dict",
"agent.util.get_sim_dir",
"agent.util.load_values",
"analyze.util.create_cdfs",
"utils.safe_reindex",
"agent.util.load_valid_data"
] | [((264, 290), 'agent.util.load_valid_data', 'load_valid_data', ([], {'byr': '(False)'}), '(byr=False)\n', (279, 290), False, 'from agent.util import load_values, get_sim_dir, load_valid_data, get_norm_reward\n'), ((1510, 1533), 'analyze.util.save_dict', 'save_dict', (['d', '"""slrvals"""'], {}), "(d, 'slrvals')\n", (15... |
import requests
from bs4 import BeautifulSoup
# stackoverflow scrape begins
headers = dict()
headers[
"User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
def get_ques_text_and_link(q):
res = requests.get("https://stackoverflow.... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((284, 356), 'requests.get', 'requests.get', (["('https://stackoverflow.com/search?q=' + q)"], {'headers': 'headers'}), "('https://stackoverflow.com/search?q=' + q, headers=headers)\n", (296, 356), False, 'import requests\n'), ((462, 500), 'bs4.BeautifulSoup', 'BeautifulSoup', (['res.text', '"""html.parser"""'], {}), ... |
import math
import os
import time
import numpy as np
import pybullet as p
import pybullet_utils.bullet_client as bc
from gripper_module import load_gripper
from misc.urdf_editor import UrdfEditor
import utils
from fusion import TSDFVolume
class Gripper(object):
"""
A moving mount and a gripper.
the mou... | [
"numpy.abs",
"numpy.tan",
"numpy.random.random",
"fusion.TSDFVolume",
"misc.urdf_editor.UrdfEditor",
"numpy.array",
"numpy.linspace",
"numpy.cos",
"gripper_module.load_gripper",
"numpy.sin",
"numpy.all",
"numpy.transpose",
"time.time",
"os.remove"
] | [((1374, 1386), 'misc.urdf_editor.UrdfEditor', 'UrdfEditor', ([], {}), '()\n', (1384, 1386), False, 'from misc.urdf_editor import UrdfEditor\n'), ((1494, 1506), 'misc.urdf_editor.UrdfEditor', 'UrdfEditor', ([], {}), '()\n', (1504, 1506), False, 'from misc.urdf_editor import UrdfEditor\n'), ((2897, 2916), 'os.remove', '... |
from flask import Flask
from flaskslack.flaskslack import FlaskSlack
from flaskslack.slack import ResponseType, Slack
app = Flask(__name__)
# If you want to get your config in a non default way,
# you can create a slack client with: Slack('slack_oauth_token', 'slack_signing_secret')
slack = Slack.create()
flask_slack... | [
"flaskslack.flaskslack.FlaskSlack",
"flaskslack.slack.Slack.create",
"flaskslack.slack.Slack.create_response",
"flask.Flask"
] | [((126, 141), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (131, 141), False, 'from flask import Flask\n'), ((294, 308), 'flaskslack.slack.Slack.create', 'Slack.create', ([], {}), '()\n', (306, 308), False, 'from flaskslack.slack import ResponseType, Slack\n'), ((323, 345), 'flaskslack.flaskslack.FlaskSl... |
from __future__ import annotations
from typing import Union, List, Tuple, Set, Dict
from datetime import date
from IPython.display import display, Markdown as md
from itertools import chain
from rich.table import Table
from rich.console import Console
from wow import SPECIALIZATION_DATA, CLASS_DATA, ENCOUNTER_DATA, ... | [
"itertools.chain",
"wow.query.Predicate.isEventIn",
"wow.cDifficulty.get",
"wow.query.Predicate.isActor",
"wow.query.Predicate.getActor",
"wow.query.Predicate.getActionId",
"wow.query.Predicate.isPetAction",
"wow.query.Predicate.getActorInfo",
"IPython.display.Markdown",
"wow.query.Predicate.getDa... | [((2352, 2386), 'wow.cDifficulty.get', 'cDifficulty.get', (['self.beg[3]', 'None'], {}), '(self.beg[3], None)\n', (2367, 2386), False, 'from wow import SPECIALIZATION_DATA, CLASS_DATA, ENCOUNTER_DATA, cDifficulty\n'), ((3865, 3887), 'rich.table.Table', 'Table', ([], {'title': '"""Players"""'}), "(title='Players')\n", (... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
"""
Created on Sun Feb 10 09:32:48 2019
@author: yansl
Target:
1. apply YCrCB & HSV color space to create standard color space
"""
import cv2
import numpy as np
#%%
"""
secondary functions
"""
def channel_merge(*, B, G, R):
#merging the cha... | [
"cv2.merge",
"cv2.cvtColor"
] | [((453, 473), 'cv2.merge', 'cv2.merge', (['[B, G, R]'], {}), '([B, G, R])\n', (462, 473), False, 'import cv2\n'), ((699, 744), 'cv2.cvtColor', 'cv2.cvtColor', (['temp_ycrcb', 'cv2.COLOR_YCrCb2BGR'], {}), '(temp_ycrcb, cv2.COLOR_YCrCb2BGR)\n', (711, 744), False, 'import cv2\n'), ((931, 972), 'cv2.cvtColor', 'cv2.cvtColo... |
#from Members import Uyeler as uye
import csv
import errno
import os
baseProgramPath = "Programlar/"
days = [["Pazartesi"], ["Salı"], ["Çarşamba"], ["Perşembe"], ["Cuma"], ["Cumartesi"], ["Pazar"]]
csv.register_dialect('myDialect', delimiter='|', quoting=csv.QUOTE_NONE, skipinitialspace=True, quotechar='')
class Pro... | [
"csv.register_dialect",
"csv.writer",
"os.getcwd",
"csv.reader",
"os.remove"
] | [((199, 312), 'csv.register_dialect', 'csv.register_dialect', (['"""myDialect"""'], {'delimiter': '"""|"""', 'quoting': 'csv.QUOTE_NONE', 'skipinitialspace': '(True)', 'quotechar': '""""""'}), "('myDialect', delimiter='|', quoting=csv.QUOTE_NONE,\n skipinitialspace=True, quotechar='')\n", (219, 312), False, 'import ... |
import sqlalchemy
from sqlalchemy import *
from sqlalchemy.dialects.postgresql import CIDR
from sqlalchemy.orm import relationship, Session
from models import Network
from db import db
import ipaddress as ip
class Subnet(db.Model):
__tablename__ = "subnet"
id = Column(String, primary_key=True)
network_id... | [
"sqlalchemy.orm.relationship",
"db.db.event.listens_for",
"ipaddress.IPv4Network"
] | [((980, 1025), 'db.db.event.listens_for', 'db.event.listens_for', (['Subnet', '"""before_update"""'], {}), "(Subnet, 'before_update')\n", (1000, 1025), False, 'from db import db\n'), ((1165, 1210), 'db.db.event.listens_for', 'db.event.listens_for', (['Subnet', '"""before_insert"""'], {}), "(Subnet, 'before_insert')\n",... |
# -*- coding: UTF-8 -*-
import cv2
import face_recognition
video = cv2.VideoCapture("short_biden.mp4")
fps = video.get(cv2.CAP_PROP_FPS)
frameCount = video.get(cv2.CAP_PROP_FRAME_COUNT)
size = (int(video.get(cv2.CAP_PROP_FRAME_WIDTH)), int(video.get(cv2.CAP_PROP_FRAME_HEIGHT)))
biden_image = face_recognition.load_ima... | [
"cv2.rectangle",
"face_recognition.face_locations",
"cv2.putText",
"face_recognition.face_encodings",
"cv2.VideoCapture",
"cv2.VideoWriter_fourcc",
"face_recognition.load_image_file",
"face_recognition.compare_faces"
] | [((68, 103), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""short_biden.mp4"""'], {}), "('short_biden.mp4')\n", (84, 103), False, 'import cv2\n'), ((295, 340), 'face_recognition.load_image_file', 'face_recognition.load_image_file', (['"""biden.jpg"""'], {}), "('biden.jpg')\n", (327, 340), False, 'import face_recognition... |
import threading
from . import _impl
from .entry import NetworkTableEntry
from .messages import *
__all__ = ["BadMessageError", "StreamEOF", "NetworkTableConnection",
"ReadManager", "PROTOCOL_REVISION"]
class StreamEOF(IOError):
pass
class ReadStream:
def __init__(self, f):
self.f = f
... | [
"threading.Thread"
] | [((4419, 4463), 'threading.Thread', 'threading.Thread', ([], {'target': 'self.run', 'name': 'name'}), '(target=self.run, name=name)\n', (4435, 4463), False, 'import threading\n')] |
"""
Scattering GUI
"""
import sys, os
import matplotlib.pyplot as plt # Plotting
import numpy as np
if sys.version_info[0] < 3:
import Tkinter as tk
else:
import tkinter as tk
from .. import functions_general as fg
from .. import functions_crystallography as fc
from .basic_widgets import StringViewer
from .b... | [
"tkinter.IntVar",
"tkinter.LabelFrame",
"tkinter.Entry",
"tkinter.Checkbutton",
"tkinter.BooleanVar",
"tkinter.Button",
"tkinter.StringVar",
"tkinter.Tk",
"tkinter.Label",
"tkinter.DoubleVar",
"tkinter.OptionMenu",
"numpy.fromstring",
"tkinter.Frame",
"matplotlib.pyplot.show"
] | [((743, 750), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (748, 750), True, 'import tkinter as tk\n'), ((1146, 1165), 'tkinter.Frame', 'tk.Frame', (['self.root'], {}), '(self.root)\n', (1154, 1165), True, 'import tkinter as tk\n'), ((1260, 1284), 'tkinter.DoubleVar', 'tk.DoubleVar', (['frame', '(8.0)'], {}), '(frame, 8.0)... |
import sys
import codecs
import jieba
'''
训练语言模型,将语料库中的文章分词
'''
if __name__ == '__main__':
input_file = sys.argv[1]
output_file = sys.argv[2]
input_reader = codecs.open(input_file, 'r', encoding='utf-8')
out_writer = codecs.open(output_file, 'w', encoding='utf-8')
line = input_reader.readline()
line_num = 1... | [
"codecs.open",
"jieba.cut"
] | [((164, 210), 'codecs.open', 'codecs.open', (['input_file', '"""r"""'], {'encoding': '"""utf-8"""'}), "(input_file, 'r', encoding='utf-8')\n", (175, 210), False, 'import codecs\n'), ((225, 272), 'codecs.open', 'codecs.open', (['output_file', '"""w"""'], {'encoding': '"""utf-8"""'}), "(output_file, 'w', encoding='utf-8'... |
# -*- coding: utf8 -*-
"""
SPARQL Wrapper Utils
@authors: U{<NAME><http://www.ivan-herman.net>}, U{<NAME><http://www.wikier.org>}, U{<NAME><http://www.dayures.net>}
@organization: U{World Wide Web Consortium<http://www.w3.org>} and U{Foundation CTIC<http://www.fundacionctic.org/>}.
@license: U{W3C SOFTWARE NOTICE AN... | [
"warnings.warn"
] | [((719, 831), 'warnings.warn', 'warnings.warn', (["('Call to deprecated function %s.' % func.__name__)"], {'category': 'DeprecationWarning', 'stacklevel': '(2)'}), "('Call to deprecated function %s.' % func.__name__, category=\n DeprecationWarning, stacklevel=2)\n", (732, 831), False, 'import warnings\n')] |
# Generated by Django 2.0.4 on 2018-05-28 06:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('instruments', '0006_instruments_production'),
]
operations = [
migrations.AlterField(
model_name='instruments',
name... | [
"django.db.models.IntegerField"
] | [((351, 381), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (370, 381), False, 'from django.db import migrations, models\n')] |
__author__ = '<NAME>'
from datetime import time, date, datetime
StandardEventTimes = []
StandardEventTimes.append(('noon', time(12, 00, 00)))
StandardEventTimes.append(('midnight', time(00, 00, 00)))
def time_string(a_time):
for seTime in StandardEventTimes:
if a_time == seTime[1]:
return s... | [
"datetime.time.strptime",
"datetime.time",
"datetime.datetime.strptime"
] | [((126, 140), 'datetime.time', 'time', (['(12)', '(0)', '(0)'], {}), '(12, 0, 0)\n', (130, 140), False, 'from datetime import time, date, datetime\n'), ((184, 197), 'datetime.time', 'time', (['(0)', '(0)', '(0)'], {}), '(0, 0, 0)\n', (188, 197), False, 'from datetime import time, date, datetime\n'), ((570, 602), 'datet... |
from time import clock
import sys
sys.path.append('../../../')
print (sys.path)
from tspdb.src.data import generateHarmonics as gH
from tspdb.src.data import generateTrend as gT
import tspdb.src.data.generateARMA as gA
import numpy as np
from tspdb.src.hdf_util import write_data
import matplotlib.pyplot as pl... | [
"numpy.sqrt",
"time.clock",
"tspdb.src.data.generateARMA.generate",
"tspdb.src.data.generateTrend.generate",
"matplotlib.pyplot.plot",
"tspdb.src.hdf_util.write_data",
"tspdb.src.data.generateHarmonics.generate",
"sys.path.append",
"matplotlib.pyplot.show"
] | [((36, 64), 'sys.path.append', 'sys.path.append', (['"""../../../"""'], {}), "('../../../')\n", (51, 64), False, 'import sys\n'), ((1375, 1382), 'time.clock', 'clock', ([], {}), '()\n', (1380, 1382), False, 'from time import clock\n'), ((2049, 2082), 'matplotlib.pyplot.plot', 'plt.plot', (['combinedTS'], {'label': '"""... |
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class feedback_data(models.Model):
improvements=models.CharField(max_length=500)
complain=models.CharField(max_length=500)
| [
"django.db.models.CharField"
] | [((147, 179), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(500)'}), '(max_length=500)\n', (163, 179), False, 'from django.db import models\n'), ((190, 222), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(500)'}), '(max_length=500)\n', (206, 222), False, 'from django.d... |
"""
Some useful I/O functions
"""
import os
import pickle
import shutil
# get all directories in a specific directory
def get_directories(path):
return [f for f in os.listdir(path) if os.path.isdir(os.path.join(path, f))]
# get all the files in a specific directory
# extension can be string or tuple of strings
... | [
"os.path.exists",
"os.listdir",
"pickle.dump",
"os.makedirs",
"pickle.load",
"os.path.join",
"shutil.rmtree",
"os.path.relpath"
] | [((1042, 1069), 'os.path.relpath', 'os.path.relpath', (['path', 'root'], {}), '(path, root)\n', (1057, 1069), False, 'import os\n'), ((635, 655), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (649, 655), False, 'import os\n'), ((729, 749), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n'... |
import os
import sys
import math
import numpy as np
import pandas as pd
sys.path.append(os.getcwd())
pdata = pd.read_csv(os.getcwd() + '/Bayes/data/train_data.csv', header=None)
test_data = pd.read_csv(os.getcwd() + '/Bayes/data/test_data.csv', header=None)
npdata = pd.DataFrame(pdata).values
final_test = pd.DataFram... | [
"math.sqrt",
"os.getcwd",
"numpy.array",
"numpy.sum",
"pandas.DataFrame",
"math.exp"
] | [((1836, 1853), 'pandas.DataFrame', 'pd.DataFrame', (['res'], {}), '(res)\n', (1848, 1853), True, 'import pandas as pd\n'), ((88, 99), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (97, 99), False, 'import os\n'), ((269, 288), 'pandas.DataFrame', 'pd.DataFrame', (['pdata'], {}), '(pdata)\n', (281, 288), True, 'import pan... |
import pandas as pd
import os
def load_data(dir_path, N=-1):
"""
Reads the data files
:param dir_path path to files:
:param N how many to read, -1 means all:
:return: pandas.DataFrame with data
"""
data = []
for i, filename in enumerate(os.listdir(dir_path)):
if N > 0 and i > N... | [
"pandas.DataFrame",
"os.listdir",
"os.path.join"
] | [((585, 627), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': "['id', 'text']"}), "(data, columns=['id', 'text'])\n", (597, 627), True, 'import pandas as pd\n'), ((271, 291), 'os.listdir', 'os.listdir', (['dir_path'], {}), '(dir_path)\n', (281, 291), False, 'import os\n'), ((397, 429), 'os.path.join', 'os.pa... |
#!/usr/bin/python3
from cpe import CPE
import vulners
import argparse
APIKey = "<KEY>"
"""
format:
{'cpe:/a:apache:tomcat:7.0.27': {
'total':15, # number of CVE concerning this CPE
'highest': 9.8, # highest CVSS score in all the CVEs
'remotelyExploitable':... | [
"cpe.CPE",
"vulners.Vulners",
"argparse.ArgumentParser"
] | [((2901, 2999), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Giving the CVEs that affect a given CPE"""', 'add_help': '(True)'}), "(description=\n 'Giving the CVEs that affect a given CPE', add_help=True)\n", (2924, 2999), False, 'import argparse\n'), ((4303, 4334), 'vulners.Vulners... |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 18:43:25 2020
@author: white
"""
import functools
import operator
import ignored
def frequency(some_df, column):
word_list_block = []
answers = list(some_df[column])
for i in range(len(answers)):
answers[i] = answers[i].lower().... | [
"functools.reduce",
"ignored.ignore_these_words",
"operator.itemgetter"
] | [((439, 494), 'functools.reduce', 'functools.reduce', (['operator.iconcat', 'word_list_block', '[]'], {}), '(operator.iconcat, word_list_block, [])\n', (455, 494), False, 'import functools\n'), ((562, 590), 'ignored.ignore_these_words', 'ignored.ignore_these_words', ([], {}), '()\n', (588, 590), False, 'import ignored\... |
from ledgerblue.comm import getDongle
keyIndex = raw_input("Specify Key Index: ")
# pubKeyB = raw_input("Enter public key for Steem Account B: ")
pubKeyB = "<KEY>"
if pubKeyB.startswith("STM") == False:
print("Error: Steem public keys must start with STM.")
exit(1)
elif len(pubKeyB) != 53:
print("Error: I... | [
"ledgerblue.comm.getDongle"
] | [((574, 589), 'ledgerblue.comm.getDongle', 'getDongle', (['(True)'], {}), '(True)\n', (583, 589), False, 'from ledgerblue.comm import getDongle\n')] |
#!/usr/bin/env python
import tensorflow as tf
import numpy as np
import time
# shortcut
tfs = tf.sparse
logger = tf.compat.v1.logging
# eager execution
#tf.enable_eager_execution()
config = tf.ConfigProto()
config.inter_op_parallelism_threads = 4
config.intra_op_parallelism_threads = 4
tf.compat.v1.enable_eager_execu... | [
"numpy.random.normal",
"numpy.sqrt",
"numpy.reshape",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.Flatten",
"numpy.random.randint",
"tensorflow.keras.layers.Dense",
"tensorflow.compat.v1.enable_eager_execution",
"time.time",
"tensorflow.ConfigProto",
"numpy.random.randn"
] | [((192, 208), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (206, 208), True, 'import tensorflow as tf\n'), ((289, 339), 'tensorflow.compat.v1.enable_eager_execution', 'tf.compat.v1.enable_eager_execution', ([], {'config': 'config'}), '(config=config)\n', (324, 339), True, 'import tensorflow as tf\n'), ... |
import PIL
from skimage.io import imread
import numpy as np
# https://stackoverflow.com/questions/27026866/convert-an-image-to-2d-array-in-python
im = imread("snowboarder.jpg")
indices = np.dstack(np.indices(im.shape[:2]))
data = np.concatenate((im, indices), axis=-1)
new_data = data[:, :, :]
print(new_data)
# np.sa... | [
"skimage.io.imread",
"numpy.indices",
"numpy.concatenate"
] | [((153, 178), 'skimage.io.imread', 'imread', (['"""snowboarder.jpg"""'], {}), "('snowboarder.jpg')\n", (159, 178), False, 'from skimage.io import imread\n'), ((232, 270), 'numpy.concatenate', 'np.concatenate', (['(im, indices)'], {'axis': '(-1)'}), '((im, indices), axis=-1)\n', (246, 270), True, 'import numpy as np\n')... |
import asyncio
import logging
from collections.abc import AsyncIterator, Iterator
import aiobotocore.session
import aiohttp
import pytest
from aiobotocore.client import AioBaseClient
from async_timeout import timeout
from docker import DockerClient
from docker.errors import NotFound as ContainerNotFound
from docker.mo... | [
"logging.getLogger",
"aiohttp.ClientSession",
"platform_buckets_api.providers.BMCWrapper",
"async_timeout.timeout",
"pytest.fail",
"asyncio.sleep",
"pytest.fixture",
"yarl.URL"
] | [((439, 466), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (456, 466), False, 'import logging\n'), ((470, 501), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (484, 501), False, 'import pytest\n'), ((595, 626), 'pytest.fixture', 'pytest.fixt... |
"""Setup file to install ddsrouter_yaml_validator module."""
from setuptools import setup
package_name = 'ddsrouter_yaml_validator'
setup(
name=package_name,
version='0.3.0',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package... | [
"setuptools.setup"
] | [((135, 904), 'setuptools.setup', 'setup', ([], {'name': 'package_name', 'version': '"""0.3.0"""', 'packages': '[package_name]', 'data_files': "[('share/ament_index/resource_index/packages', ['resource/' + package_name]\n ), ('share/' + package_name, ['package.xml']), ('share/' + package_name,\n [package_name + '... |
# Copyright 2014 Facebook, Inc.
# You are hereby granted a non-exclusive, worldwide, royalty-free license to
# use, copy, modify, and distribute this software in source code or binary
# form for use in connection with the web services and APIs provided by
# Facebook.
# As with any software that integrates with the Fa... | [
"os.path.dirname",
"os.path.join",
"re.search"
] | [((1155, 1180), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1170, 1180), False, 'import os\n'), ((1209, 1249), 'os.path.join', 'os.path.join', (['this_dir', '"""../__init__.py"""'], {}), "(this_dir, '../__init__.py')\n", (1221, 1249), False, 'import os\n'), ((1378, 1469), 're.search', 're... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Girder plugin framework and tests adapted from Kitware Inc. source and
# documentation by the Imaging and Visualization Group, Advanced Biomedical
# Computational Science, Frederick Nation... | [
"json.dumps",
"girder.models.file.File",
"girder.models.setting.Setting",
"uuid.uuid4"
] | [((2991, 3042), 'json.dumps', 'json.dumps', (["{'isHistogram': True, 'fakeId': fakeId}"], {}), "({'isHistogram': True, 'fakeId': fakeId})\n", (3001, 3042), False, 'import json\n'), ((2765, 2777), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (2775, 2777), False, 'import uuid\n'), ((2485, 2494), 'girder.models.setting.S... |
from flask import Flask, request, redirect, url_for, render_template
import requests
import json
from .spotify import get_token, authorize, get_audio_features, get_user, get_user_playlists
from .analysis import analyse_playlist, group_by_day
def create_app(test_config=None):
app = Flask(__name__)
@app.route(... | [
"flask.request.args.get",
"flask.url_for",
"json.dumps",
"flask.Flask"
] | [((288, 303), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (293, 303), False, 'from flask import Flask, request, redirect, url_for, render_template\n'), ((358, 383), 'flask.request.args.get', 'request.args.get', (['"""token"""'], {}), "('token')\n", (374, 383), False, 'from flask import Flask, request, r... |
from pywaterkotte.ecotouch import (Ecotouch, EcotouchTag, InvalidResponseException, StatusException)
import responses
import pytest
from datetime import datetime
HOSTNAME = 'hostname'
@pytest.fixture
def wp_instance():
return Ecotouch(HOSTNAME)
# Helper functions
def prepare_response(action, body):
response... | [
"datetime.datetime",
"responses.add",
"pywaterkotte.ecotouch.Ecotouch",
"pytest.raises"
] | [((232, 250), 'pywaterkotte.ecotouch.Ecotouch', 'Ecotouch', (['HOSTNAME'], {}), '(HOSTNAME)\n', (240, 250), False, 'from pywaterkotte.ecotouch import Ecotouch, EcotouchTag, InvalidResponseException, StatusException\n'), ((312, 397), 'responses.add', 'responses.add', (['responses.GET', "('http://%s/cgi/%s' % (HOSTNAME, ... |
from . import views
from django.urls import path
from django.contrib import admin
urlpatterns=[
path("admin/", admin.site.urls),
path("",views.index, name="index"),
path("maps", views.base, name="base"),
path("profile", views.profile, name="profile"),
path("add_todo",views.add_todo, nam... | [
"django.urls.path"
] | [((109, 140), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (113, 140), False, 'from django.urls import path\n'), ((147, 182), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (151, 182), Fals... |
import re
import bs4
from LimeSoup.lime_soup import Soup, RuleIngredient
from LimeSoup.parser.elsevier_xml import (
resolve_elsevier_entities, extract_ce_text, find_non_empty_children,
node_named, extract_ce_para, extract_ce_section, extract_ce_abstract,
extract_ce_title, remove_consecutive_whitespaces)
... | [
"LimeSoup.parser.elsevier_xml.extract_ce_section",
"LimeSoup.parser.elsevier_xml.node_named",
"LimeSoup.parser.elsevier_xml.resolve_elsevier_entities",
"re.match",
"LimeSoup.parser.elsevier_xml.extract_ce_para",
"bs4.BeautifulSoup",
"LimeSoup.parser.elsevier_xml.find_non_empty_children",
"LimeSoup.par... | [((3398, 3430), 'LimeSoup.lime_soup.Soup', 'Soup', ([], {'parser_version': '__version__'}), '(parser_version=__version__)\n', (3402, 3430), False, 'from LimeSoup.lime_soup import Soup, RuleIngredient\n'), ((557, 591), 'LimeSoup.parser.elsevier_xml.resolve_elsevier_entities', 'resolve_elsevier_entities', (['xml_str'], {... |
import os
from pathlib import Path
import click
import toml
def get_config(app_name: str, config_name: str, default_config: str):
"""
Try retrieving the configuration file content from the following sources
in the following order:
1. <APP_NAME>_CONFIG_PATH env var, if provided
2. '/etc/<app_name>... | [
"click.get_app_dir",
"os.environ.get",
"pathlib.Path"
] | [((812, 836), 'os.environ.get', 'os.environ.get', (['env_name'], {}), '(env_name)\n', (826, 836), False, 'import os\n'), ((911, 923), 'pathlib.Path', 'Path', (['"""/etc"""'], {}), "('/etc')\n", (915, 923), False, 'from pathlib import Path\n'), ((1041, 1068), 'click.get_app_dir', 'click.get_app_dir', (['app_name'], {}),... |
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
import logging
import configparser
import time
import json
import concurrent.futures
logger = logging.getLogger(__name__)
config = configparser.ConfigParser()
config.read('config.ini')
crxcavator_api = c... | [
"logging.getLogger",
"requests.Session",
"configparser.ConfigParser",
"requests.adapters.HTTPAdapter",
"json.dumps",
"time.sleep",
"requests.packages.urllib3.util.retry.Retry"
] | [((209, 236), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (226, 236), False, 'import logging\n'), ((247, 274), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (272, 274), False, 'import configparser\n'), ((2071, 2089), 'requests.Session', 'requests.Session',... |
# =================================================================
# Copyright (C) 2021-2021 52°North Spatial Information Research 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
# h... | [
"logging.getLogger",
"os.path.exists",
"logging.basicConfig",
"odcprovider.connector.OdcConnector",
"argparse.ArgumentParser",
"pathlib.Path",
"yaml.dump",
"logging.config.dictConfig",
"yaml.load"
] | [((1229, 1264), 'os.path.exists', 'os.path.exists', (['logging_config_file'], {}), '(logging_config_file)\n', (1243, 1264), False, 'import os\n'), ((1821, 1848), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1838, 1848), False, 'import logging\n'), ((1778, 1810), 'logging.basicConfig', ... |
"""Convert a CP trace to NCP or VIP.
blaze run convert_traces -- \
--tracefile=german_partial_prior.npz \
--model=german_credit_lognormalcentered \
--vip_json=german_credit_lognormalcentered_data/cVIP_exp_tied.json
"""
from absl import app
from absl import flags
import io
import json
import os
import numpy as n... | [
"tensorflow_probability.edward2.tape",
"numpy.savez",
"tensorflow.io.gfile.GFile",
"tensorflow.compat.v1.Session",
"io.BytesIO",
"absl.app.run",
"tensorflow.vectorized_map",
"tensorflow.reshape",
"json.load",
"models.get_model_by_name",
"numpy.load",
"absl.flags.DEFINE_string",
"tensorflow.i... | [((421, 474), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""tracefile"""'], {'default': '""""""', 'help': '""""""'}), "('tracefile', default='', help='')\n", (440, 474), False, 'from absl import flags\n'), ((475, 527), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""vip_json"""'], {'default': '"""""... |
import cv2
import numpy as np
def ColorAzul():
black_screen = np.zeros([500, 500, 3], dtype=np.uint8)
black_screen[:, :, 0] = np.ones([500, 500]) * 255
black_screen[:, :, 1] = np.ones([500, 500]) * 0
black_screen[:, :, 2] = np.ones([500, 500]) * 0
return black_screen
def ColorRojo():
black... | [
"numpy.ones",
"cv2.createButton",
"cv2.imshow",
"numpy.zeros",
"cv2.destroyAllWindows",
"cv2.waitKey",
"cv2.namedWindow"
] | [((708, 732), 'cv2.namedWindow', 'cv2.namedWindow', (['"""Frame"""'], {}), "('Frame')\n", (723, 732), False, 'import cv2\n'), ((733, 771), 'cv2.createButton', 'cv2.createButton', (['"""Cahnge Color"""', 'back'], {}), "('Cahnge Color', back)\n", (749, 771), False, 'import cv2\n'), ((937, 951), 'cv2.waitKey', 'cv2.waitKe... |
import datetime
import math
import os
from entomb import (
constants,
exceptions,
utilities,
)
@utilities.hide_cursor()
def produce_report(path, include_git):
"""Print a report.
Parameters
----------
path : str
An absolute path.
include_git: bool
Whether to include gi... | [
"entomb.utilities.file_is_immutable",
"os.path.exists",
"math.floor",
"os.path.join",
"entomb.utilities.print_header",
"entomb.utilities.hide_cursor",
"datetime.datetime.now",
"entomb.utilities.print_progress_bar",
"os.path.isdir",
"entomb.utilities.count_file_paths",
"os.path.islink",
"os.wal... | [((111, 134), 'entomb.utilities.hide_cursor', 'utilities.hide_cursor', ([], {}), '()\n', (132, 134), False, 'from entomb import constants, exceptions, utilities\n'), ((500, 520), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (514, 520), False, 'import os\n'), ((968, 1002), 'entomb.utilities.print_head... |
import os
import re
from typing import Dict, Iterable, Tuple
from .gh import Developer, GitHub, Repository, TrendingSince, BASE_URL
from .tg import Telegram
def format_message(
repos: Dict[TrendingSince, Iterable[Tuple[Repository, Iterable[str]]]],
developers: Dict[TrendingSince, Iterable[Developer]],
) -> s... | [
"re.sub",
"os.getenv"
] | [((1799, 1820), 'os.getenv', 'os.getenv', (['"""GH_TOKEN"""'], {}), "('GH_TOKEN')\n", (1808, 1820), False, 'import os\n'), ((1836, 1857), 'os.getenv', 'os.getenv', (['"""TG_TOKEN"""'], {}), "('TG_TOKEN')\n", (1845, 1857), False, 'import os\n'), ((361, 414), 're.sub', 're.sub', (['"""([_*\\\\[\\\\]()~`>#+=|{}.!-])"""', ... |
import os
from torch import nn
from torch import optim
from robustcode.models.modules.neural_model_base import NeuralModelBase
from robustcode.models.robust.adversary.adversary import AdversarialMode
from robustcode.models.robust.adversary.adversary import AdversaryAccuracyStats
from robustcode.models.robust.adversar... | [
"os.path.exists",
"robustcode.models.robust.dataset_util.dataset_to_trees",
"torch.nn.CrossEntropyLoss",
"os.makedirs",
"robustcode.util.misc.Logger.end_scope",
"torch.load",
"os.path.join",
"robustcode.models.robust.adversary.rules.NodeValueIndex",
"robustcode.models.robust.dataset_util.dataset_to_... | [((1399, 1442), 'os.path.join', 'os.path.join', (['args.save_dir', 'args.tag', 'name'], {}), '(args.save_dir, args.tag, name)\n', (1411, 1442), False, 'import os\n'), ((1917, 1944), 'torch.load', 'torch.load', (['checkpoint_file'], {}), '(checkpoint_file)\n', (1927, 1944), False, 'import torch\n'), ((2343, 2378), 'robu... |
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models import Q
from django.utils import timezone
from django.core.validators import MaxValueValidator, MinValueValidator
from django.shortcuts import get_object_or_404
from itertools import chain
... | [
"itertools.chain",
"django.core.validators.MinValueValidator",
"django.db.models.FloatField",
"django.core.validators.MaxValueValidator",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.shortcuts.get_object_or_404",
"django.db.models.ManyToManyField",
"django.db.models.FileField... | [((2642, 2665), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {}), '(User)\n', (2659, 2665), False, 'from django.db import models\n'), ((2678, 2710), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)'}), '(max_length=128)\n', (2694, 2710), False, 'from django.db import models... |
import torch
from time import time
from IPython import display
import numpy as np
import matplotlib.pyplot as plt
import random
import torch.utils.data as Data
from torch.nn import init
import torch.nn as nn
# 3.3.1 生成数据集
# 我们生成与上一节中相同的数据集。其中features是训练数据特征,labels是标签
num_inputs = 2 #x1,x2 有几个x
num_examples = 1000
true_... | [
"numpy.random.normal",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"torch.utils.data.TensorDataset",
"torch.nn.MSELoss",
"torch.nn.Linear",
"torch.utils.data.DataLoader",
"torch.nn.init.normal_"
] | [((751, 787), 'torch.utils.data.TensorDataset', 'Data.TensorDataset', (['features', 'labels'], {}), '(features, labels)\n', (769, 787), True, 'import torch.utils.data as Data\n'), ((810, 860), 'torch.utils.data.DataLoader', 'Data.DataLoader', (['dataset', 'batch_size'], {'shuffle': '(True)'}), '(dataset, batch_size, sh... |
from django.db import models
from multi_tenant_users.users import AbstractUserMixin, TenantUser
from tenant_schemas.models import TenantMixin
class Tenant(TenantMixin):
name = models.CharField(max_length=100)
class User(TenantUser, AbstractUserMixin):
def __init__(self, *args, **kwargs):
# is_staff ... | [
"django.db.models.CharField"
] | [((182, 214), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (198, 214), False, 'from django.db import models\n')] |
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator
from django.shortcuts import get_object_or_404, redirect, render
from django.views.decorators.cache import cache_page
from .forms import CommentForm, PostForm
from .models import Follow, Group, Post, User
@cache_page... | [
"django.shortcuts.render",
"django.shortcuts.get_object_or_404",
"django.shortcuts.redirect",
"django.views.decorators.cache.cache_page",
"django.core.paginator.Paginator"
] | [((310, 349), 'django.views.decorators.cache.cache_page', 'cache_page', (['(20)'], {'key_prefix': '"""index_page"""'}), "(20, key_prefix='index_page')\n", (320, 349), False, 'from django.views.decorators.cache import cache_page\n'), ((443, 467), 'django.core.paginator.Paginator', 'Paginator', (['post_list', '(10)'], {}... |
"""
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario: Add two numbers
Given I have powered calculator on
When I enter "50" into the calculator
And I enter "70" into the calculator
And I press add
Then the result should ... | [
"unittest.main",
"morelia.verify",
"calculator.Calculator"
] | [((1989, 2004), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2002, 2004), False, 'import unittest\n'), ((1219, 1273), 'morelia.verify', 'verify', (['__doc__', 'self'], {'scenario': '"""Subsequent additions"""'}), "(__doc__, self, scenario='Subsequent additions')\n", (1225, 1273), False, 'from morelia import ver... |
import unittest
from datetime import datetime, timedelta
from redis import Redis
from extensions import *
redis = Redis()
class EventBitmapTestCase(unittest.TestCase):
def setUp(self):
self.EA = EventAnalytics('test')
def _tearDown(self):
self.EA.delete_all_events('test')
def test_crea... | [
"unittest.main",
"datetime.datetime.today",
"datetime.timedelta",
"redis.Redis"
] | [((117, 124), 'redis.Redis', 'Redis', ([], {}), '()\n', (122, 124), False, 'from redis import Redis\n'), ((724, 739), 'unittest.main', 'unittest.main', ([], {}), '()\n', (737, 739), False, 'import unittest\n'), ((412, 428), 'datetime.datetime.today', 'datetime.today', ([], {}), '()\n', (426, 428), False, 'from datetime... |
"""
tt URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vi... | [
"ecommerce.views.ItemDetailView.as_view",
"ecommerce.views.ItemDeleteView.as_view",
"django.urls.include",
"ecommerce.views.UserItemListView.as_view",
"ecommerce.views.OrderSummaryView.as_view",
"django.contrib.auth.views.LogoutView.as_view",
"django.conf.urls.static.static",
"django.contrib.auth.view... | [((1133, 1164), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (1137, 1164), False, 'from django.urls import path, include\n'), ((1206, 1261), 'django.urls.path', 'path', (['"""register/"""', 'user_views.register'], {'name': '"""register"""'}), "('register/', use... |
import pandas as pd
from autosktime.data import DatasetProperties
from sktime.forecasting.base import ForecastingHorizon
from ConfigSpace import ConfigurationSpace, CategoricalHyperparameter
from autosktime.constants import IGNORES_EXOGENOUS_X, HANDLES_UNIVARIATE, HANDLES_MISSING, HANDLES_MULTIVARIATE, \
SUPPORTE... | [
"ConfigSpace.ConfigurationSpace",
"sktime.forecasting.naive.NaiveForecaster",
"ConfigSpace.CategoricalHyperparameter"
] | [((832, 883), 'sktime.forecasting.naive.NaiveForecaster', 'NaiveForecaster', ([], {'sp': 'self.sp', 'strategy': 'self.strategy'}), '(sp=self.sp, strategy=self.strategy)\n', (847, 883), False, 'from sktime.forecasting.naive import NaiveForecaster\n'), ((2033, 2097), 'ConfigSpace.CategoricalHyperparameter', 'CategoricalH... |
import datetime
import unittest
from flask import Blueprint, request, jsonify
from freezegun import freeze_time
from mock import Mock, patch
import jwt
from requests.exceptions import HTTPError
from shared_helpers import services
from testing import TrottoTestCase, LIVE_APP_HOST
class TestFunctions(unittest.TestCas... | [
"jwt.decode",
"mock.patch",
"shared_helpers.services.validate_internal_request",
"datetime.datetime.utcnow",
"mock.Mock",
"shared_helpers.services.get",
"datetime.timedelta",
"datetime.datetime.now",
"shared_helpers.services._create_internal_token",
"freezegun.freeze_time",
"flask.Blueprint",
... | [((8030, 8057), 'flask.Blueprint', 'Blueprint', (['"""test"""', '__name__'], {}), "('test', __name__)\n", (8039, 8057), False, 'from flask import Blueprint, request, jsonify\n'), ((328, 430), 'mock.patch', 'patch', (['"""shared_helpers.services.get_service_config"""'], {'return_value': "{'signing_secret': 'so_secret'}"... |
"""renamed video field
Revision ID: 4d378428eac7
Revises: aea30a52<PASSWORD>d
Create Date: 2018-07-29 19:03:47.869795
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4d378428eac7'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def upgrade():
... | [
"alembic.op.drop_constraint",
"alembic.op.f",
"alembic.op.drop_column",
"sqlalchemy.VARCHAR",
"sqlalchemy.String",
"alembic.op.drop_index",
"alembic.op.create_index",
"alembic.op.create_unique_constraint"
] | [((390, 451), 'alembic.op.drop_index', 'op.drop_index', (['"""ix_question_order_pos"""'], {'table_name': '"""question"""'}), "('ix_question_order_pos', table_name='question')\n", (403, 451), False, 'from alembic import op\n'), ((456, 541), 'alembic.op.create_unique_constraint', 'op.create_unique_constraint', (['"""ques... |
from setuptools import Extension, setup
ext = Extension(
name='vkjson',
sources=[
'./src/commands.cpp',
'./src/commands/create/create_instance.cpp',
'./src/commands/custom/export.cpp',
'./src/commands/custom/import.cpp',
'./src/parse.cpp',
'./src/run_scope.cpp',
... | [
"setuptools.Extension",
"setuptools.setup"
] | [((47, 1269), 'setuptools.Extension', 'Extension', ([], {'name': '"""vkjson"""', 'sources': "['./src/commands.cpp', './src/commands/create/create_instance.cpp',\n './src/commands/custom/export.cpp', './src/commands/custom/import.cpp',\n './src/parse.cpp', './src/run_scope.cpp', './src/vkjson.cpp']", 'depends': "[... |
import glob
from xml.etree import ElementTree as et
import cipush
def get_coverage_from_cobertura_xml(tree):
root = tree.getroot()
assert root.tag == 'coverage'
return float(root.attrib['line-rate'])
def get_num_tests_from_junit_xml(tree):
root = tree.getroot()
if root.tag == 'testsuite':
... | [
"xml.etree.ElementTree.parse",
"glob.glob"
] | [((819, 842), 'glob.glob', 'glob.glob', (['path_pattern'], {}), '(path_pattern)\n', (828, 842), False, 'import glob\n'), ((1087, 1110), 'glob.glob', 'glob.glob', (['path_pattern'], {}), '(path_pattern)\n', (1096, 1110), False, 'import glob\n'), ((1437, 1452), 'xml.etree.ElementTree.parse', 'et.parse', (['file_'], {}), ... |
from tableschema import Table
# Data from WEB, schema from MEMORY
SOURCE = 'https://raw.githubusercontent.com/frictionlessdata/tableschema-py/master/data/data_infer.csv'
SCHEMA = {'fields': [{'name': 'id', 'type': 'integer'}, {'name': 'age', 'type': 'integer'}, {'name': 'name', 'type': 'string'}] }
# If schema is not... | [
"tableschema.Table"
] | [((356, 384), 'tableschema.Table', 'Table', (['SOURCE'], {'schema': 'SCHEMA'}), '(SOURCE, schema=SCHEMA)\n', (361, 384), False, 'from tableschema import Table\n')] |
import os
import shutil
import subprocess
import hashlib
def hash_kwargs(kwargs):
kwargs = tuple(sorted(list(kwargs.items())))
kwargs_hash = hashlib.sha224(repr(kwargs)).hexdigest()
return kwargs_hash
class Sentinal(object):
def __init__(self, sentinal_filename):
self.sentinal_filename = sen... | [
"os.path.exists",
"os.makedirs",
"subprocess.check_call",
"os.rename",
"os.path.join",
"os.symlink",
"os.getcwd",
"os.chdir",
"os.path.dirname",
"os.path.basename",
"shutil.rmtree",
"os.path.abspath",
"os.remove"
] | [((1672, 1711), 'os.path.join', 'os.path.join', (['link_directory', 'link_name'], {}), '(link_directory, link_name)\n', (1684, 1711), False, 'import os\n'), ((1753, 1778), 'os.path.abspath', 'os.path.abspath', (['filename'], {}), '(filename)\n', (1768, 1778), False, 'import os\n'), ((1783, 1818), 'os.symlink', 'os.syml... |
import numpy as np
from netCDF4 import Dataset
from datetime import datetime
from datetime import timedelta
import os
import sys
TOP = "/data_ballantine02/miyoshi-t/honda/SCALE-LETKF/BAIU2018_5.3.6"
stime = datetime( 2018, 6, 30, 0, 0, 0 )
vtime = datetime( 2018, 7, 6, 0, 0, 0 )
adt = timedelta( hours=24 )
m = 1
... | [
"datetime.datetime",
"numpy.abs",
"netCDF4.Dataset",
"cartopy.crs.PlateCarree",
"numpy.sum",
"matplotlib.pyplot.figure",
"cartopy.mpl.ticker.LatitudeFormatter",
"cartopy.mpl.ticker.LongitudeFormatter",
"sys.exit",
"datetime.timedelta",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotli... | [((211, 241), 'datetime.datetime', 'datetime', (['(2018)', '(6)', '(30)', '(0)', '(0)', '(0)'], {}), '(2018, 6, 30, 0, 0, 0)\n', (219, 241), False, 'from datetime import datetime\n'), ((252, 281), 'datetime.datetime', 'datetime', (['(2018)', '(7)', '(6)', '(0)', '(0)', '(0)'], {}), '(2018, 7, 6, 0, 0, 0)\n', (260, 281)... |
'''
TShock, a server mod for Terraria
Copyright (C) 2011-2016 <NAME> (fka. The TShock Team)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any la... | [
"json.loads",
"requests.post",
"os.path.getsize",
"json.dumps",
"requests.get",
"subprocess.call"
] | [((3851, 3919), 'subprocess.call', 'subprocess.call', (["('mv tshock_release.zip ' + release_name)"], {'shell': '(True)'}), "('mv tshock_release.zip ' + release_name, shell=True)\n", (3866, 3919), False, 'import subprocess\n'), ((4351, 4367), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (4361, 4367), False, ... |
#
# Copyright (c) 2011 <NAME> <EMAIL>
#
# test_cleanup_qs.py 14-Apr-2011
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | [
"spyder.processor.cleanupquery.CleanupQueryString",
"spyder.core.settings.Settings"
] | [((848, 858), 'spyder.core.settings.Settings', 'Settings', ([], {}), '()\n', (856, 858), False, 'from spyder.core.settings import Settings\n'), ((871, 892), 'spyder.processor.cleanupquery.CleanupQueryString', 'CleanupQueryString', (['s'], {}), '(s)\n', (889, 892), False, 'from spyder.processor.cleanupquery import Clean... |
from functools import reduce
from math import pi
from neuron import h
def _new_property(obj_hierarchy, attr_name):
"""
Returns a new property, mapping attr_name to obj_hierarchy.attr_name.
For example, suppose that an object of class A has an attribute b which
itself has an attribute c which itself h... | [
"neuron.h.Section",
"neuron.h.eLIF",
"neuron.h.mAdExp"
] | [((833, 844), 'neuron.h.Section', 'h.Section', ([], {}), '()\n', (842, 844), False, 'from neuron import h\n'), ((966, 983), 'neuron.h.eLIF', 'h.eLIF', (['self._seg'], {}), '(self._seg)\n', (972, 983), False, 'from neuron import h\n'), ((2043, 2054), 'neuron.h.Section', 'h.Section', ([], {}), '()\n', (2052, 2054), False... |
import os
from os import path
from glob import glob
import json
import re
import pickle
import argparse
import numpy as np
from scipy import ndimage, misc
from config import cfg
from parse_ingredients import preprocess_ingredients
def load_recipe(filename):
"""Load a single recipe file
"""
with open(filename, 'r') ... | [
"json.load",
"parse_ingredients.preprocess_ingredients",
"os.path.join"
] | [((338, 350), 'json.load', 'json.load', (['f'], {}), '(f)\n', (347, 350), False, 'import json\n'), ((662, 706), 'parse_ingredients.preprocess_ingredients', 'preprocess_ingredients', (["value['ingredients']"], {}), "(value['ingredients'])\n", (684, 706), False, 'from parse_ingredients import preprocess_ingredients\n'), ... |
#!/usr/bin/env python3
import argparse
import Bio.Seq
import Bio.SeqIO
import Bio.SeqRecord
import datetime
import gemmi
import glob
import gzip
import modules.create_mr_set.utils.models as models
import os
import modules.create_mr_set.utils.pdbtools as pdbtools
import random
import modules.create_mr_set.utils.rcsb as... | [
"modules.create_mr_set.utils.utils.parallel",
"modules.create_mr_set.utils.utils.print_section_title"
] | [((2528, 2579), 'modules.create_mr_set.utils.utils.print_section_title', 'utils.print_section_title', (['"""Getting Full Sequences"""'], {}), "('Getting Full Sequences')\n", (2553, 2579), True, 'import modules.create_mr_set.utils.utils as utils\n'), ((2647, 2751), 'modules.create_mr_set.utils.utils.parallel', 'utils.pa... |
import os
import pymongo
import argparse
import pandas as pd
from stages.first.first import first
def main():
# Creamos la carpeta donde almacenaremos los complejos.
results_directory = os.path.join(os.getcwd(), './results')
myclient = pymongo.MongoClient(
"mongodb+srv://claudio:<EMAIL>/myFirst... | [
"argparse.ArgumentParser",
"os.getcwd",
"os.path.isdir",
"os.mkdir",
"stages.first.first.first",
"pymongo.MongoClient"
] | [((253, 359), 'pymongo.MongoClient', 'pymongo.MongoClient', (['"""mongodb+srv://claudio:<EMAIL>/myFirstDatabase?retryWrites=true&w=majority"""'], {}), "(\n 'mongodb+srv://claudio:<EMAIL>/myFirstDatabase?retryWrites=true&w=majority'\n )\n", (272, 359), False, 'import pymongo\n'), ((713, 759), 'argparse.ArgumentPar... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.9.1+dev
# kernelspec:
# display_name: Python [conda env:annorxiver]
# language: python
# name: conda-env-annorxiver-... | [
"pandas.read_csv",
"plotnine.coord_flip",
"plotnine.aes",
"plotnine.position_dodge",
"sklearn.linear_model.LogisticRegressionCV",
"pathlib.Path",
"matplotlib.pyplot.twinx",
"pandas.DataFrame.from_dict",
"pandas.Categorical",
"numpy.random.seed",
"tqdm.tqdm_notebook",
"requests.get",
"plotnin... | [((1494, 1515), 'requests.get', 'requests.get', (['api_url'], {}), '(api_url)\n', (1506, 1515), False, 'import requests\n'), ((1603, 1622), 'numpy.random.seed', 'np.random.seed', (['(100)'], {}), '(100)\n', (1617, 1622), True, 'import numpy as np\n'), ((1649, 1688), 'numpy.random.randint', 'np.random.randint', (['(0)',... |
"""
Problem 55: Lychrel numbers
https://projecteuler.net/problem=55
If we take 47, reverse and add, 47 + 74 = 121, which is palindromic.
Not all numbers produce palindromes so quickly. For example,
349 + 943 = 1292,
1292 + 2921 = 4213
4213 + 3124 = 7337
That is, 349 took three iterations to arrive at a palindrome.
... | [
"src.common.calculations.calculate_large_sum",
"src.common.palindromes.is_palindromic_number"
] | [((1984, 2041), 'src.common.calculations.calculate_large_sum', 'calculate_large_sum', (['(number_string, number_string[::-1])'], {}), '((number_string, number_string[::-1]))\n', (2003, 2041), False, 'from src.common.calculations import calculate_large_sum\n'), ((2053, 2089), 'src.common.palindromes.is_palindromic_numbe... |
from common.config import get_env_variable_value, get_secret_value
class ProductionConfig:
"""Production application configuration - pulled from task environment."""
CLIENT_ID = get_env_variable_value('CLIENT_ID', is_mandatory=True)
QUEUE_URL = get_env_variable_value('CLIENT_SQS_URL', is_mandatory=True)
... | [
"common.config.get_secret_value",
"common.config.get_env_variable_value"
] | [((188, 242), 'common.config.get_env_variable_value', 'get_env_variable_value', (['"""CLIENT_ID"""'], {'is_mandatory': '(True)'}), "('CLIENT_ID', is_mandatory=True)\n", (210, 242), False, 'from common.config import get_env_variable_value, get_secret_value\n'), ((259, 318), 'common.config.get_env_variable_value', 'get_e... |
from utils import initMysql, getByAid
# 起始 和 终止 AID
startAid = 1190000016801859
endAid = 1190000016900000
connect = initMysql()
for aid in range(startAid, endAid):
getByAid(aid, connect)
| [
"utils.getByAid",
"utils.initMysql"
] | [((118, 129), 'utils.initMysql', 'initMysql', ([], {}), '()\n', (127, 129), False, 'from utils import initMysql, getByAid\n'), ((171, 193), 'utils.getByAid', 'getByAid', (['aid', 'connect'], {}), '(aid, connect)\n', (179, 193), False, 'from utils import initMysql, getByAid\n')] |
""" Calorizator parser application. """
import argparse
from calorizator_parser.parser import main as parser_main
def run() -> None:
""" CLI for the app. """
parser = argparse.ArgumentParser(prog="calorizator_parser", description="Parser for calorizator site")
parser.add_argument("--output", type=str, h... | [
"calorizator_parser.parser.main",
"argparse.ArgumentParser"
] | [((179, 277), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""calorizator_parser"""', 'description': '"""Parser for calorizator site"""'}), "(prog='calorizator_parser', description=\n 'Parser for calorizator site')\n", (202, 277), False, 'import argparse\n'), ((403, 420), 'calorizator_parser.... |
import os
import json
import base64
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import models
engine = create_engine(os.environ['SQLALCHEMY_DATABASE_URL'])
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
def parse_block(block, chain_id):
out = {
... | [
"sqlalchemy.orm.sessionmaker",
"models.Event",
"models.Attribute",
"sqlalchemy.create_engine",
"base64.b64decode",
"models.Transaction",
"models.Block"
] | [((140, 192), 'sqlalchemy.create_engine', 'create_engine', (["os.environ['SQLALCHEMY_DATABASE_URL']"], {}), "(os.environ['SQLALCHEMY_DATABASE_URL'])\n", (153, 192), False, 'from sqlalchemy import create_engine\n'), ((208, 268), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {'autocommit': '(False)', 'autoflush': '... |
# Car Pooling
'''
You are driving a vehicle that has capacity empty seats initially available for passengers. The vehicle only drives east (ie. it cannot turn around and drive west.)
Given a list of trips, trip[i] = [num_passengers, start_location, end_location] contains information about the i-th trip: the number o... | [
"numpy.array"
] | [((1856, 1871), 'numpy.array', 'np.array', (['trips'], {}), '(trips)\n', (1864, 1871), True, 'import numpy as np\n')] |
import requests
import json
import logging
import time
API_URL = "https://api.coindesk.com/v1/bpi/currentprice.json"
def main():
response = GetAPIResponse(API_URL)
getDBObject(response)
time.sleep(60)
def getDBObject(response):
return {
"code": response["bpi"]["USD"]["code"],
"time"... | [
"requests.get",
"logging.error",
"time.sleep"
] | [((202, 216), 'time.sleep', 'time.sleep', (['(60)'], {}), '(60)\n', (212, 216), False, 'import time\n'), ((529, 546), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (541, 546), False, 'import requests\n'), ((665, 708), 'logging.error', 'logging.error', (['"""GetAPIResponse: No Request"""'], {}), "('GetAPIRes... |
import datetime
import unittest
from unittest import mock
import py_client.algorithm_interface_test.test_helper.SessionMockFactory as SessionMockFactory
from py_client.aidm import UpdateStopTimesTrainPathNode, AlgorithmTrain, AlgorithmTrainPathNode, StopStatus, \
UpdateRunTimesTrainPathSegment
from py_clien... | [
"datetime.datetime",
"datetime.timedelta",
"unittest.mock.patch",
"py_client.algorithm_interface_test.test_helper.SessionMockFactory.create_response_mock",
"py_client.algorithm_interface_test.test_helper.SessionMockTestBase.get_api_url"
] | [((2769, 2844), 'unittest.mock.patch', 'mock.patch', (['"""requests.Session"""'], {'side_effect': 'UpdateTrajectoryTestMockSession'}), "('requests.Session', side_effect=UpdateTrajectoryTestMockSession)\n", (2779, 2844), False, 'from unittest import mock\n'), ((2978, 3053), 'unittest.mock.patch', 'mock.patch', (['"""req... |
# Copyright 2018 NOKIA
#
# 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 wri... | [
"oslo_serialization.jsonutils.dumps",
"neutronclient.i18n._",
"neutronclient.common.utils.str2dict_type"
] | [((819, 843), 'oslo_serialization.jsonutils.dumps', 'jsonutils.dumps', (['physnet'], {}), '(physnet)\n', (834, 843), False, 'from oslo_serialization import jsonutils\n'), ((1504, 1536), 'neutronclient.i18n._', '_', (['"""Name of the Nuage L2Bridge."""'], {}), "('Name of the Nuage L2Bridge.')\n", (1505, 1536), False, 'f... |
from math import trunc
numero = float(input('Digite um numero inteiro: '))
print('O valor digitado foi {} e a sua porção inteira é {}'.format(numero, trunc(numero)))
'''
int (numero) => tambem funciona para estrair um inteiro
'''
| [
"math.trunc"
] | [((154, 167), 'math.trunc', 'trunc', (['numero'], {}), '(numero)\n', (159, 167), False, 'from math import trunc\n')] |
import numpy as np
import sys,os
##################################### INPUT ############################################
realizations = 2000
########################################################################################
root1 = '/simons/scratch/fvillaescusa/pdf_information/Snapshots/latin_hypercube'
root2 ... | [
"os.system",
"os.path.exists"
] | [((612, 672), 'os.system', 'os.system', (["('cp %s/CAMB.params %s/' % (folder_in, folder_out))"], {}), "('cp %s/CAMB.params %s/' % (folder_in, folder_out))\n", (621, 672), False, 'import sys, os\n'), ((675, 745), 'os.system', 'os.system', (["('cp %s/ICs/Pk_mm_z=0.000.txt %s/' % (folder_in, folder_out))"], {}), "('cp %s... |
# Generated by Django 2.2.6 on 2019-10-10 19:01
from uuid import uuid4
from django.db import migrations
def apply_migration(apps, migration):
"""Apply App Token data migration"""
Group = apps.get_model('auth', 'Group')
Group.objects.create(
name='App Token'
)
def revert_migration(apps, mig... | [
"django.db.migrations.RunPython"
] | [((612, 667), 'django.db.migrations.RunPython', 'migrations.RunPython', (['apply_migration', 'revert_migration'], {}), '(apply_migration, revert_migration)\n', (632, 667), False, 'from django.db import migrations\n')] |
from app import schemas
import pytest
def test_get_all_products(authorized_client,test_products):
res=authorized_client.get("/products/")
assert len(res.json()) ==len(test_products)
assert res.status_code ==200
def test_unathorized_get_all_products(client,test_products):
res=client.get("/products/")
... | [
"pytest.mark.parametrize"
] | [((1035, 1177), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""product_name, quantity_init, quantity_left, status_code"""', "[(None, None, 33, 422), ('chambre', 23, 44, 201)]"], {}), "(\n 'product_name, quantity_init, quantity_left, status_code', [(None, None,\n 33, 422), ('chambre', 23, 44, 201)])\n... |
# -*- coding: utf-8 -*-
import math
import pandas as pd
import xml.etree.ElementTree as ET
import matplotlib.pyplot as plt
import os.path as osp
from PIL import Image
import numpy as np
plt.rcParams['font.sans-serif'] = ['SimHei'] #用来正常显示中文标签
plt.rcParams['font.family']='sans-serif'
plt.rcParams['figure.figsize'] ... | [
"PIL.Image.open",
"xml.etree.ElementTree.parse",
"matplotlib.pyplot.savefig",
"os.path.join",
"math.sqrt",
"numpy.array",
"pandas.DataFrame"
] | [((6121, 6265), 'pandas.DataFrame', 'pd.DataFrame', (['count_wh'], {'index': "['0-0.25', '0.25-0.33', '0.33-0.5', '0.5-1', '1-1.5', '1.5-2', '2-2.5',\n '2.5-3', '3-4', '>4']", 'columns': "['宽高比']"}), "(count_wh, index=['0-0.25', '0.25-0.33', '0.33-0.5', '0.5-1',\n '1-1.5', '1.5-2', '2-2.5', '2.5-3', '3-4', '>4'],... |
#!/usr/bin/env python3.5
# driver.py
#
# <NAME> and <NAME>
#
# Major Modification log:
# 2018-06-12 bam - refactored DAS to modularize code found in the run function
# 2017-12-10 slg - refactored the creation of objects for the DAS() object.
# 2017-11-19 slg - rewrite for abstract modular design, created experime... | [
"logging.debug",
"experiment.initial_state",
"logging.info",
"ctools.clogging.setup",
"ctools.hierarchical_configparser.HierarchicalConfigParser",
"os.path.exists",
"argparse.ArgumentParser",
"os.path.isdir",
"os.mkdir",
"os.getpid",
"ctools.clogging.add_argument",
"experiment.runExperiment",
... | [((1128, 1139), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1137, 1139), False, 'import os\n'), ((1157, 1182), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1172, 1182), False, 'import os\n'), ((23607, 23668), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'formatter_class': 'ArgumentD... |
# -*- coding: utf-8 -*-
import os
import dj_database_url
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = os.environ.get(
'SECRET_KEY',
'YOUR_SECRET_KEY'
)
DEBUG = bool(os.environ.get('DEBUG', True))
TEMPLATE_DEBUG = DEBUG
CUSTOM_APPS = (
'resources',
'rest_framework',
)
INSTALLE... | [
"dj_database_url.config",
"os.environ.get",
"os.path.join",
"os.path.dirname",
"os.path.abspath"
] | [((126, 173), 'os.environ.get', 'os.environ.get', (['"""SECRET_KEY"""', '"""YOUR_SECRET_KEY"""'], {}), "('SECRET_KEY', 'YOUR_SECRET_KEY')\n", (140, 173), False, 'import os\n'), ((85, 110), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (100, 110), False, 'import os\n'), ((198, 227), 'os.envir... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack LLC.
# 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/... | [
"keystone.backends.memcache.MEMCACHE_SERVER.get",
"keystone.backends.memcache.MEMCACHE_SERVER.delete",
"keystone.backends.memcache.MEMCACHE_SERVER.set"
] | [((1219, 1255), 'keystone.backends.memcache.MEMCACHE_SERVER.set', 'MEMCACHE_SERVER.set', (['token.id', 'token'], {}), '(token.id, token)\n', (1238, 1255), False, 'from keystone.backends.memcache import MEMCACHE_SERVER\n'), ((1264, 1307), 'keystone.backends.memcache.MEMCACHE_SERVER.set', 'MEMCACHE_SERVER.set', (['tenant... |
"""
main_module - 模型参数测试,测试时将对应方法的@unittest.skip注释掉.
Main members:
# __main__ - 程序入口.
"""
import unittest
from torch import nn
class TestParameters(unittest.TestCase):
"""模型参数测试.
Main methods:
test_parameters - 模型参数测试.
"""
# @unittest.skip('debug')
de... | [
"unittest.main",
"torch.nn.Sequential",
"torch.nn.Linear"
] | [((1230, 1245), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1243, 1245), False, 'import unittest\n'), ((456, 471), 'torch.nn.Sequential', 'nn.Sequential', ([], {}), '()\n', (469, 471), False, 'from torch import nn\n'), ((506, 521), 'torch.nn.Linear', 'nn.Linear', (['(5)', '(1)'], {}), '(5, 1)\n', (515, 521), F... |
from candidate_nn import CandidateNN
import os
# clear logging dir
os.system('rm -R /tmp/gennn/')
c = CandidateNN(1,"a",
runtime_spec={'id': 1,
'datadir': 'MNIST_data',
'logdir': 'log/',
'validate_each_n_steps': 10,
'm... | [
"os.system",
"candidate_nn.CandidateNN"
] | [((67, 97), 'os.system', 'os.system', (['"""rm -R /tmp/gennn/"""'], {}), "('rm -R /tmp/gennn/')\n", (76, 97), False, 'import os\n'), ((104, 295), 'candidate_nn.CandidateNN', 'CandidateNN', (['(1)', '"""a"""'], {'runtime_spec': "{'id': 1, 'datadir': 'MNIST_data', 'logdir': 'log/',\n 'validate_each_n_steps': 10, 'max_... |
from django.db import models
from django.contrib.auth.models import (AbstractBaseUser, BaseUserManager, PermissionsMixin)
class Base(models.Model):
created = models.DateTimeField(auto_now_add=True, null=True)
modified = models.DateTimeField(auto_now=True)
class Meta:
abstract = True
class Product... | [
"django.db.models.EmailField",
"django.db.models.OneToOneField",
"django.db.models.BooleanField",
"django.db.models.DateTimeField",
"django.db.models.DecimalField",
"django.db.models.CharField"
] | [((163, 213), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)', 'null': '(True)'}), '(auto_now_add=True, null=True)\n', (183, 213), False, 'from django.db import models\n'), ((229, 264), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)'}), '(aut... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 8 14:45:56 2019
@author: Xuan-Laptop
"""
import pandas as pd
import numpy as np
from utils import np_macro_f1, encoding
from sklearn.linear_model import LinearRegression, LogisticRegression
import warnings
warnings.filterwarnings("ignore")
def calibration... | [
"numpy.dstack",
"numpy.mean",
"sklearn.linear_model.LinearRegression",
"pandas.read_csv",
"pandas.merge",
"numpy.log",
"numpy.array",
"pandas.DataFrame",
"warnings.filterwarnings",
"utils.np_macro_f1"
] | [((268, 301), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (291, 301), False, 'import warnings\n'), ((1301, 1344), 'pandas.read_csv', 'pd.read_csv', (['"""./data/sample_submission.csv"""'], {}), "('./data/sample_submission.csv')\n", (1312, 1344), True, 'import pandas as ... |
# Generated by Django 3.0.5 on 2020-04-14 15:25
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
migrations.swa... | [
"django.db.models.OneToOneField",
"django.db.models.FloatField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.Q",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((306, 363), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (337, 363), False, 'from django.db import migrations, models\n'), ((554, 647), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
"""A thin wrapping of the VoIP.ms REST API to make it slightly less than
horrible to use.
"""
import contextlib
from collections import Mapping
import requests
from functools import partial
def validate_response(response_obj):
"""Check for HTTP failures, API failures, and return JSON."""
if response_obj.stat... | [
"functools.partial",
"requests.get"
] | [((1394, 1416), 'functools.partial', 'partial', (['DID'], {'api': 'self'}), '(DID, api=self)\n', (1401, 1416), False, 'from functools import partial\n'), ((2558, 2587), 'requests.get', 'requests.get', (['self.api.url', 'p'], {}), '(self.api.url, p)\n', (2570, 2587), False, 'import requests\n'), ((3925, 3959), 'requests... |
from axis_fifo import AXIS_FIFO
from devices import fifo_devices
import struct
class GPIO_seq_point:
def __init__(self, address, time, output):
self.address = address
self.time = time
self.output = output
def write_point(fifo, point):
#01XXAAAA TTTTTTTT DDDDDDDD
fifo.write_axis_fifo("\x01\x00" + str... | [
"struct.pack",
"axis_fifo.AXIS_FIFO"
] | [((486, 521), 'axis_fifo.AXIS_FIFO', 'AXIS_FIFO', (["fifo_devices['GPIO_seq']"], {}), "(fifo_devices['GPIO_seq'])\n", (495, 521), False, 'from axis_fifo import AXIS_FIFO\n'), ((374, 403), 'struct.pack', 'struct.pack', (['""">I"""', 'point.time'], {}), "('>I', point.time)\n", (385, 403), False, 'import struct\n'), ((428... |
import re
import lib.core.common
__product__ = "3dcart"
__description__ = (
"The 3dcart Shopping Cart Software is a complete e-commerce solution for anyone."
)
def search(html, **kwargs):
html = str(html)
headers = kwargs.get("headers", None)
plugin_detection_schema = (
re.compile(r"3dcart.... | [
"re.compile"
] | [((300, 332), 're.compile', 're.compile', (['"""3dcart.stats"""', 're.I'], {}), "('3dcart.stats', re.I)\n", (310, 332), False, 'import re\n'), ((343, 372), 're.compile', 're.compile', (['"""/3dvisit/"""', 're.I'], {}), "('/3dvisit/', re.I)\n", (353, 372), False, 'import re\n')] |
"""
Plot different high-thrust corrections used in BEM
"""
# --- Common libraries
import numpy as np
import matplotlib.pyplot as plt
# --- Local libraries
from welib.BEM.highthrust import *
from welib.tools.figure import defaultRC; defaultRC();
def main(test=False):
Ct=np.linspace(0,2,50)
a =np.linspace(0,1... | [
"welib.tools.repo.export_figs_callback",
"welib.tools.figure.defaultRC",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((235, 246), 'welib.tools.figure.defaultRC', 'defaultRC', ([], {}), '()\n', (244, 246), False, 'from welib.tools.figure import defaultRC\n'), ((278, 299), 'numpy.linspace', 'np.linspace', (['(0)', '(2)', '(50)'], {}), '(0, 2, 50)\n', (289, 299), True, 'import numpy as np\n'), ((305, 326), 'numpy.linspace', 'np.linspac... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from sarna.viz import highlight
def compare_box_and_slice(x, box, slc):
'''Function used to compare slice limits and box range of a rectangle.'''
halfsample = np.diff(x).mean() / 2
correct_limits = x[slc][[0, -1]]... | [
"numpy.allclose",
"sarna.viz.highlight",
"numpy.random.random",
"matplotlib.pyplot.plot",
"numpy.diff",
"matplotlib.pyplot.close",
"numpy.array",
"numpy.arange"
] | [((497, 539), 'numpy.allclose', 'np.allclose', (['correct_limits', 'bbox_x_limits'], {}), '(correct_limits, bbox_x_limits)\n', (508, 539), True, 'import numpy as np\n'), ((572, 599), 'numpy.arange', 'np.arange', (['(0)', '(10)'], {'step': '(0.05)'}), '(0, 10, step=0.05)\n', (581, 599), True, 'import numpy as np\n'), ((... |
# Copyright 2016 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | [
"vitrage_tempest_plugin.tests.common.vitrage_utils.add_template",
"vitrage_tempest_plugin.tests.common.vitrage_utils.delete_template",
"vitrage_tempest_plugin.tests.common.nova_utils.create_instances",
"oslo_log.log.getLogger"
] | [((931, 958), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (948, 958), True, 'from oslo_log import log as logging\n'), ((1236, 1288), 'vitrage_tempest_plugin.tests.common.vitrage_utils.add_template', 'v_utils.add_template', (['"""host_aodh_alarm_for_rca.yaml"""'], {}), "('host_aodh... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module is for testing unit functions of the hyperparameter loader
"""
import os
import pytest
from pykg2vec.common import KGEArgParser
from pykg2vec.common import HyperparameterLoader
def test_load_default_hyperparameter_file():
hp_loader = HyperparameterLoade... | [
"os.path.dirname",
"pykg2vec.common.KGEArgParser",
"pytest.raises"
] | [((736, 761), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (751, 761), False, 'import os\n'), ((850, 875), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (865, 875), False, 'import os\n'), ((1415, 1447), 'pytest.raises', 'pytest.raises', (['FileNotFoundError'], {}... |
from django.urls import path
from django.urls.resolvers import URLPattern
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('products/', views.get_all_products, name='all_products'),
path('releases/<int:pk>', views.get_releases, name="releases"),
path('testresults/', views.g... | [
"django.urls.path"
] | [((115, 150), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (119, 150), False, 'from django.urls import path\n'), ((156, 218), 'django.urls.path', 'path', (['"""products/"""', 'views.get_all_products'], {'name': '"""all_products"""'}), "('products... |
from wasmer import engine, Store, Module, Instance
from wasmer_compiler_cranelift import Compiler as Cranelift
from wasmer_compiler_llvm import Compiler as LLVM
from wasmer_compiler_singlepass import Compiler as Singlepass
TEST_BYTES = open('benchmarks/nbody.wasm', 'rb').read()
def test_benchmark_headless_time_nbody_... | [
"wasmer.engine.Native",
"wasmer.Instance",
"wasmer.engine.JIT",
"wasmer.Module",
"wasmer.Module.deserialize"
] | [((400, 425), 'wasmer.Module', 'Module', (['store', 'TEST_BYTES'], {}), '(store, TEST_BYTES)\n', (406, 425), False, 'from wasmer import engine, Store, Module, Instance\n'), ((717, 742), 'wasmer.Module', 'Module', (['store', 'TEST_BYTES'], {}), '(store, TEST_BYTES)\n', (723, 742), False, 'from wasmer import engine, Stor... |
import numpy as np
import matplotlib.pyplot as plt
from numpy import pi as pi
from numpy import sin as sin
from numpy import cos as cos
from scipy import signal
# example 1a
N=1000
f=50
T=1/f
t=np.arange(N)
Phi=np.random.normal(0,1,N)
X=sin(2*pi*f*t/N)
Y=sin(2*pi*f*t/N + Phi)
plt.plot(Phi)
plt.plot(X)
plt.plot(Y)
pl... | [
"numpy.random.normal",
"matplotlib.pyplot.semilogy",
"matplotlib.pyplot.grid",
"numpy.arange",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.subplot",
"numpy.cos",
"numpy.sin",
"scipy.signal.periodogram",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((196, 208), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (205, 208), True, 'import numpy as np\n'), ((213, 238), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', 'N'], {}), '(0, 1, N)\n', (229, 238), True, 'import numpy as np\n'), ((239, 262), 'numpy.sin', 'sin', (['(2 * pi * f * t / N)'], {}), '(2 * ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from .base import RedisTestCase
from redis_collections import List
class ListTest(RedisTestCase):
def create_list(self, *args, **kwargs):
kwargs['redis'] = self.redis
return List(*args, **kwargs)
def test_init(self):
l ... | [
"unittest.main",
"redis_collections.List"
] | [((4535, 4550), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4548, 4550), False, 'import unittest\n'), ((262, 283), 'redis_collections.List', 'List', (['*args'], {}), '(*args, **kwargs)\n', (266, 283), False, 'from redis_collections import List\n')] |
from django.urls import path
from .views import UserRetrieveUpdateDestroyView, activate, register, CheckUserAPIView, custom_login, reset_password, reset_password_email
urlpatterns = [
path("user/", UserRetrieveUpdateDestroyView.as_view()),
path("signup/", register),
path("check/", CheckUserAPIView.as_view(... | [
"django.urls.path"
] | [((249, 274), 'django.urls.path', 'path', (['"""signup/"""', 'register'], {}), "('signup/', register)\n", (253, 274), False, 'from django.urls import path\n'), ((328, 356), 'django.urls.path', 'path', (['"""login/"""', 'custom_login'], {}), "('login/', custom_login)\n", (332, 356), False, 'from django.urls import path\... |
# -*- coding: utf-8 -*-
import unittest
import numpy as np
import tensorflow as tf
from tfsnippet.bayes import BernoulliLayer, StochasticTensor
from tests.helper import TestCase
class BernoulliLayerTestCase(TestCase):
def test_basic(self):
layer = BernoulliLayer()
output = layer({'logits': tf.z... | [
"numpy.ones",
"numpy.zeros",
"tfsnippet.bayes.BernoulliLayer",
"unittest.main",
"tensorflow.zeros"
] | [((748, 763), 'unittest.main', 'unittest.main', ([], {}), '()\n', (761, 763), False, 'import unittest\n'), ((265, 281), 'tfsnippet.bayes.BernoulliLayer', 'BernoulliLayer', ([], {}), '()\n', (279, 281), False, 'from tfsnippet.bayes import BernoulliLayer, StochasticTensor\n'), ((316, 333), 'tensorflow.zeros', 'tf.zeros',... |
from enum import IntEnum
import os
import pygame
import random
import re
import time
import traceback
from cmg import color
from cmg.color import Color, Colors
from cmg import math
from cmg.input import *
from cmg.graphics import *
from cmg.application import *
from cmg.event import Event
from study_tool import card_at... | [
"study_tool.config.Config.app.card_database.get_card_by_russian_key",
"cmg.widgets.Widget",
"study_tool.config.Config.app.card_database.get_card_by_english_key",
"study_tool.card.get_card_russian_key",
"study_tool.card.Card",
"cmg.widgets.HBoxLayout",
"study_tool.card_set.CardSet",
"study_tool.config.... | [((1916, 1949), 'cmg.widgets.TextEdit.on_draw', 'widgets.TextEdit.on_draw', (['self', 'g'], {}), '(self, g)\n', (1940, 1949), False, 'from cmg import widgets\n'), ((3695, 3702), 'cmg.event.Event', 'Event', ([], {}), '()\n', (3700, 3702), False, 'from cmg.event import Event\n'), ((3735, 3754), 'cmg.event.Event', 'Event'... |
import os
from PIL import Image
from os.path import join, getsize
def get_location_for_code():
# :releative location
access_area = '/home/joseph/Desktop/STC'
# access_area = os.getcwd()
return access_area
def select_case():
case = 4
return case
home_address = get_location_for_code()
address =... | [
"os.walk"
] | [((429, 450), 'os.walk', 'os.walk', (['home_address'], {}), '(home_address)\n', (436, 450), False, 'import os\n')] |