code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from functools import wraps
import inspect
# TODO: Make pickeable; will involve adding '__getstate__'
class Options(object):
"""An immutable place to save options for a simulation run."""
def __init__(self, **kwargs):
"""Pass the options to save using the """
super(Options, self).__setattr__('... | [
"inspect.signature",
"functools.wraps"
] | [((2025, 2045), 'inspect.signature', 'inspect.signature', (['f'], {}), '(f)\n', (2042, 2045), False, 'import inspect\n'), ((2119, 2127), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (2124, 2127), False, 'from functools import wraps\n')] |
import numpy as np
from frontend import signal
class stt_framework():
def __init__(self, transformation, **kwargs):
self.transformationInst = transformation(**kwargs)
def stt_transform(self, y_signal:signal, nSamplesWindow:int=2**10, overlapFactor:int=0, windowType:str=None, suppressPrint:bool=False)... | [
"frontend.signal",
"numpy.floor"
] | [((1795, 1803), 'frontend.signal', 'signal', ([], {}), '()\n', (1801, 1803), False, 'from frontend import signal\n'), ((1568, 1614), 'numpy.floor', 'np.floor', (['(nSamplesWindow * (1 - overlapFactor))'], {}), '(nSamplesWindow * (1 - overlapFactor))\n', (1576, 1614), True, 'import numpy as np\n')] |
import os
import pandas as pd
import sqlite3
import warnings
warnings.simplefilter(action='ignore', category=UserWarning)
# First load and explore csv file in pandas
df = pd.read_csv('titanic.csv')
# print(df)
df.index.rename("id", inplace=True) # assigns a column label "id" for the index column
df.index += 1 # star... | [
"warnings.simplefilter",
"sqlite3.connect",
"pandas.read_csv"
] | [((61, 121), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'UserWarning'}), "(action='ignore', category=UserWarning)\n", (82, 121), False, 'import warnings\n'), ((172, 198), 'pandas.read_csv', 'pd.read_csv', (['"""titanic.csv"""'], {}), "('titanic.csv')\n", (183, 198), Tr... |
import streamlit as st
from twilight import basic_eda, file_parsing
from twilight.basic_eda import Features
import pandas as pd
# st.beta_set_page_config(layout="wide")
st.title("Welcome to Twilight")
st.write(
"Twilight is a python package to work with text data efficiently. It's a no code tool to quickly unders... | [
"twilight.file_parsing.get_file_obj",
"streamlit.image",
"pandas.read_csv",
"streamlit.number_input",
"twilight.basic_eda.Features",
"streamlit.button",
"streamlit.file_uploader",
"streamlit.write",
"streamlit.multiselect",
"streamlit.text",
"streamlit.subheader",
"streamlit.header",
"stream... | [((170, 201), 'streamlit.title', 'st.title', (['"""Welcome to Twilight"""'], {}), "('Welcome to Twilight')\n", (178, 201), True, 'import streamlit as st\n'), ((203, 418), 'streamlit.write', 'st.write', (['"""Twilight is a python package to work with text data efficiently. It\'s a no code tool to quickly understand any ... |
from typing import Tuple
import os
from azure.core.exceptions import ResourceNotFoundError
from azure.ai.formrecognizer import FormRecognizerClient, CustomFormModel, FormTrainingClient, RecognizedForm
from azure.core.credentials import AzureKeyCredential
import json
from NewDeclarationInQueue.formular_converter impor... | [
"azure.core.credentials.AzureKeyCredential",
"NewDeclarationInQueue.processfiles.cmodelprocess.model_definition.ModelDefinition",
"NewDeclarationInQueue.formular_converter.FormularConverter"
] | [((4537, 4554), 'NewDeclarationInQueue.processfiles.cmodelprocess.model_definition.ModelDefinition', 'ModelDefinition', ([], {}), '()\n', (4552, 4554), False, 'from NewDeclarationInQueue.processfiles.cmodelprocess.model_definition import ModelDefinition\n'), ((4869, 4888), 'NewDeclarationInQueue.formular_converter.Form... |
import json
import matplotlib.style as style
import numpy as np
import pandas as pd
import pylab as pl
def make_rows(cngrs_prsn):
"""Output a list of dicitonaries for each JSON object representing a
congressperson.
Each individaul dictionary will contain information about the congressperson
as well as inf... | [
"pylab.title",
"numpy.repeat",
"pylab.tight_layout",
"pylab.savefig",
"pylab.xlabel",
"pandas.bdate_range",
"json.load",
"matplotlib.style.use",
"numpy.concatenate",
"pandas.DataFrame",
"pylab.ylabel",
"pandas.to_datetime"
] | [((2609, 2639), 'matplotlib.style.use', 'style.use', (['"""seaborn-whitegrid"""'], {}), "('seaborn-whitegrid')\n", (2618, 2639), True, 'import matplotlib.style as style\n'), ((2720, 2755), 'pylab.title', 'pl.title', (['"""Average Age of Congress"""'], {}), "('Average Age of Congress')\n", (2728, 2755), True, 'import py... |
# -*- coding: utf-8 -*-
import urllib, urllib2, re, os, sys, math
import xbmcgui, xbmc, xbmcaddon, xbmcplugin
from urlparse import urlparse, parse_qs
import urlparse
from BeautifulSoup import BeautifulSoup
import time, datetime
import HTMLParser
#todo: BeautifulSoup
scriptID = 'plugin.video.mrknow'
scriptname = "Film... | [
"re.compile",
"search.Search",
"urllib.quote",
"xbmcaddon.Addon",
"mrknow_pCommon.mystat",
"xbmc.Player",
"mrknow_Parser.mrknow_Parser",
"urllib.quote_plus",
"xbmcgui.ListItem",
"re.finditer",
"mrknow_pCommon.common",
"mrknow_urlparser.mrknow_urlparser",
"BeautifulSoup.BeautifulSoup",
"xbm... | [((359, 384), 'xbmcaddon.Addon', 'xbmcaddon.Addon', (['scriptID'], {}), '(scriptID)\n', (374, 384), False, 'import xbmcgui, xbmc, xbmcaddon, xbmcplugin\n'), ((621, 639), 'mrknow_pLog.pLog', 'mrknow_pLog.pLog', ([], {}), '()\n', (637, 639), False, 'import mrknow_pLog, mrknow_pCommon, mrknow_Parser, mrknow_urlparser\n'),... |
from dataclasses import dataclass
from django.utils.text import slugify
@dataclass(frozen=True)
class Track:
service_name: str
collection_name: str
track_number: int
track_id: str
title: str
primary_artists: list[str]
featured_artists: list[str]
queries: list[str]
raw: dict
d... | [
"django.utils.text.slugify",
"dataclasses.dataclass"
] | [((76, 98), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (85, 98), False, 'from dataclasses import dataclass\n'), ((752, 771), 'django.utils.text.slugify', 'slugify', (['self.title'], {}), '(self.title)\n', (759, 771), False, 'from django.utils.text import slugify\n'), ((775, 795... |
"""
Use this script to get the commands to run
"""
import subprocess
import json
import traceback
import os
from config import *
def main():
for suite in SUITE:
try:
SUITE[suite]["commands"].clear()
os.chdir(SUITE_PATH + SUITE[suite]["name"] + RUN_PATH)
... | [
"os.chdir",
"subprocess.getoutput",
"traceback.print_exc",
"json.dumps"
] | [((716, 733), 'json.dumps', 'json.dumps', (['SUITE'], {}), '(SUITE)\n', (726, 733), False, 'import json\n'), ((257, 311), 'os.chdir', 'os.chdir', (["(SUITE_PATH + SUITE[suite]['name'] + RUN_PATH)"], {}), "(SUITE_PATH + SUITE[suite]['name'] + RUN_PATH)\n", (265, 311), False, 'import os\n'), ((368, 405), 'subprocess.geto... |
#!/usr/bin/env python
#===============================================================================
# objdump2vmh.py
#===============================================================================
#
# -h --help Display this message
# -v --verbose Verbose mode
# -f --file Objdump file to parse
#
# Author... | [
"fileinput.lineno",
"re.match",
"fileinput.input",
"sys.exit"
] | [((766, 794), 'fileinput.input', 'fileinput.input', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (781, 794), False, 'import fileinput\n'), ((811, 830), 're.match', 're.match', (['"""#"""', 'line'], {}), "('#', line)\n", (819, 830), False, 'import re\n'), ((836, 855), 'sys.exit', 'sys.exit', (["(msg != '')"], {}), "(msg !=... |
#--------------------------------------------#
# 该部分代码只用于看网络结构,并非测试代码
#--------------------------------------------#
from nets.mobilenet import MobileNet
from nets.resnet50 import ResNet50
from nets.vgg16 import VGG16
if __name__ == "__main__":
model = MobileNet([224,224,3], classes=1000)
model.summary()
... | [
"nets.mobilenet.MobileNet"
] | [((260, 298), 'nets.mobilenet.MobileNet', 'MobileNet', (['[224, 224, 3]'], {'classes': '(1000)'}), '([224, 224, 3], classes=1000)\n', (269, 298), False, 'from nets.mobilenet import MobileNet\n')] |
# Generated by Django 2.2.11 on 2020-05-05 15:42
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("organisations", "0006_auto_20200501_1129"),
]
operations = [
migrations.AddField(
model_name="... | [
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((391, 527), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'choices': "[('land_based', 'Land based'), ('sea_based', 'Vessel (sea) based')]", 'max_length': '(20)', 'null': '(True)'}), "(blank=True, choices=[('land_based', 'Land based'), (\n 'sea_based', 'Vessel (sea) based')], max_length... |
#!/usr/bin/python3
import setuptools
from pybind11.setup_helpers import Pybind11Extension, build_ext
ext_modules = [
Pybind11Extension(
"udaq_analysis_lib.fletcher_16",
sources=[
'src/fletcher_16.cpp',
]
),
Pybind11Extension(
"udaq_analysis_lib.analyze_hitbuffer"... | [
"setuptools.setup",
"pybind11.setup_helpers.Pybind11Extension"
] | [((401, 783), 'setuptools.setup', 'setuptools.setup', ([], {'name': '"""udaq_analysis_lib"""', 'version': '"""0.0.1"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""provides fast C++ functions for analyzing uDAQ data files"""', 'ext_modules': 'ext_modules', 'extras_require': "{'test': ... |
from flask.globals import request
from flask_login import login_required
from . import main
from flask import render_template
from .requests import get_quotes
from flask import abort, flash, redirect, url_for
from .. import photos, db
from ..models import Blog, Category, Comment, MailingList, User
from .forms import Co... | [
"flask.render_template",
"flask.flash",
"flask.url_for"
] | [((601, 699), 'flask.render_template', 'render_template', (['"""index.html"""'], {'new_quote': 'new_quote', 'blog1': 'blog', 'blog2': 'blog2', 'blogList': 'blogList'}), "('index.html', new_quote=new_quote, blog1=blog, blog2=blog2,\n blogList=blogList)\n", (616, 699), False, 'from flask import render_template\n'), ((... |
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('C:\Code_python\Image\Picture\Tiger.jpg',0)
# img2 = cv2.equalizeHist(img)
hist,bins = np.histogram(img.flatten(),256,[0,256])
cdf = hist.cumsum()
cdf_normalized = cdf * hist.max()/ cdf.max()
cdf_m = np.ma.masked_equal(cdf,0)
c... | [
"numpy.ma.masked_equal",
"cv2.imshow",
"numpy.ma.filled",
"cv2.destroyAllWindows",
"cv2.waitKey",
"cv2.namedWindow",
"cv2.imread"
] | [((76, 135), 'cv2.imread', 'cv2.imread', (['"""C:\\\\Code_python\\\\Image\\\\Picture\\\\Tiger.jpg"""', '(0)'], {}), "('C:\\\\Code_python\\\\Image\\\\Picture\\\\Tiger.jpg', 0)\n", (86, 135), False, 'import cv2\n'), ((292, 318), 'numpy.ma.masked_equal', 'np.ma.masked_equal', (['cdf', '(0)'], {}), '(cdf, 0)\n', (310, 318)... |
import argparse
from textwrap import dedent
from .. import __version__
parser = argparse.ArgumentParser(
usage="wormhole-server SUBCOMMAND (subcommand-options)",
description=dedent("""
Create a Magic Wormhole and communicate through it. Wormholes are created
by speaking the same magic CODE in two diffe... | [
"textwrap.dedent"
] | [((183, 434), 'textwrap.dedent', 'dedent', (['"""\n Create a Magic Wormhole and communicate through it. Wormholes are created\n by speaking the same magic CODE in two different places at the same time.\n Wormholes are secure against anyone who doesn\'t use the same code."""'], {}), '(\n """\n Create a Ma... |
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import (
UserCreationForm as BaseUserCreationForm,
UserChangeForm as BaseUserChangeForm
)
User = get_user_model()
class UserCreationForm(BaseUserCreationForm):
class Meta:
model = User
fields = ('email', 'user... | [
"django.contrib.auth.get_user_model"
] | [((185, 201), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (199, 201), False, 'from django.contrib.auth import get_user_model\n')] |
"""Console script for interacting with GivEnergy inverters."""
import datetime
import logging
import click
from givenergy_modbus.client import GivEnergyClient
from givenergy_modbus.model.register_cache import RegisterCache
from givenergy_modbus.util import InterceptHandler
_logger = logging.getLogger(__package__)
... | [
"logging.getLogger",
"click.Choice",
"click.argument",
"givenergy_modbus.util.InterceptHandler",
"click.group",
"click.option",
"givenergy_modbus.model.register_cache.RegisterCache",
"givenergy_modbus.client.GivEnergyClient",
"click.echo",
"click.DateTime"
] | [((287, 317), 'logging.getLogger', 'logging.getLogger', (['__package__'], {}), '(__package__)\n', (304, 317), False, 'import logging\n'), ((546, 559), 'click.group', 'click.group', ([], {}), '()\n', (557, 559), False, 'import click\n'), ((561, 639), 'click.option', 'click.option', (['"""-h"""', '"""--host"""'], {'type'... |
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import datetime
class MyWindow(QMainWindow):
def __init__(self):
super().__init__()
timer = QTimer(self)
timer.start(1000) # 1 sec
timer.timeout.connect(self.display_price)
def display_price(self):... | [
"datetime.datetime.now"
] | [((335, 358), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (356, 358), False, 'import datetime\n')] |
from click.testing import CliRunner
from pytest_mock import mocker # noqa: F401
import ldap_tools
from ldap_tools.audit import CLI as AuditCli
def describe_audit():
def describe_commandline_operations():
runner = CliRunner()
def it_lists_groups_by_user(mocker): # noqa: F811
mocker.... | [
"pytest_mock.mocker.patch",
"ldap_tools.audit.API.by_user.assert_called_once_with",
"ldap_tools.audit.API.by_group.assert_called_once_with",
"click.testing.CliRunner"
] | [((229, 240), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (238, 240), False, 'from click.testing import CliRunner\n'), ((313, 376), 'pytest_mock.mocker.patch', 'mocker.patch', (['"""ldap_tools.audit.API.by_user"""'], {'return_value': 'None'}), "('ldap_tools.audit.API.by_user', return_value=None)\n", (325,... |
# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
from itemloaders.processors import MapCompose, TakeFirst
def get_price(price):
return price[1:]
def get_cur(price):
return price[0]
class AmazoneScrapperItem(scrapy.It... | [
"itemloaders.processors.TakeFirst",
"itemloaders.processors.MapCompose"
] | [((454, 465), 'itemloaders.processors.TakeFirst', 'TakeFirst', ([], {}), '()\n', (463, 465), False, 'from itemloaders.processors import MapCompose, TakeFirst\n'), ((524, 545), 'itemloaders.processors.MapCompose', 'MapCompose', (['get_price'], {}), '(get_price)\n', (534, 545), False, 'from itemloaders.processors import ... |
"""
Django settings for sensorgridapi project.
Generated by 'django-admin startproject' using Django 1.11.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
imp... | [
"os.path.abspath",
"os.environ.get"
] | [((489, 514), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (504, 514), False, 'import os\n'), ((535, 569), 'os.environ.get', 'env.get', (['"""APPLICATION_DOMAINS"""', '""""""'], {}), "('APPLICATION_DOMAINS', '')\n", (542, 569), True, 'from os import environ as env\n')] |
"""A module for housing the Cursor class.
Exported Classes:
Cursor -- Class for representing a database cursor.
"""
from collections import deque
from .statement import Statement, PreparedStatement
from .exception import Error, NotSupportedError, ProgrammingError
class Cursor(object):
"""Class for represent... | [
"collections.deque"
] | [((7905, 7912), 'collections.deque', 'deque', ([], {}), '()\n', (7910, 7912), False, 'from collections import deque\n')] |
from insights.parsers import sap_host_profile, SkipException
from insights.parsers.sap_host_profile import SAPHostProfile
from insights.tests import context_wrap
import doctest
import pytest
HOST_PROFILE_DOC = """
SAPSYSTEMNAME = SAP
SAPSYSTEM = 99
service/porttypes = SAPHostControl SAPOscol SAPCCMS
DIR_LIBRARY =
DIR_... | [
"insights.tests.context_wrap",
"doctest.testmod",
"pytest.raises"
] | [((1291, 1335), 'doctest.testmod', 'doctest.testmod', (['sap_host_profile'], {'globs': 'env'}), '(sap_host_profile, globs=env)\n', (1306, 1335), False, 'import doctest\n'), ((809, 839), 'insights.tests.context_wrap', 'context_wrap', (['HOST_PROFILE_DOC'], {}), '(HOST_PROFILE_DOC)\n', (821, 839), False, 'from insights.t... |
from mesa import Agent, Model
from mesa.time import RandomActivation
from mesa.space import MultiGrid
from mesa.datacollection import DataCollector
from mesa.batchrunner import BatchRunner
import matplotlib.pyplot as plt
import numpy as np
def compute_gini(model):
agent_wealths = [agent.wealth for agent in model... | [
"matplotlib.pyplot.imshow",
"mesa.datacollection.DataCollector",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.plot",
"mesa.space.MultiGrid",
"numpy.zeros",
"mesa.time.RandomActivation",
"matplotlib.pyplot.show"
] | [((2715, 2762), 'numpy.zeros', 'np.zeros', (['(model.grid.width, model.grid.height)'], {}), '((model.grid.width, model.grid.height))\n', (2723, 2762), True, 'import numpy as np\n'), ((2903, 2952), 'matplotlib.pyplot.imshow', 'plt.imshow', (['agent_counts'], {'interpolation': '"""nearest"""'}), "(agent_counts, interpola... |
from rest_framework.response import Response
from login.api.serializers import RegistrationSerializer
from rest_framework.authtoken.models import Token
from rest_framework import status
from login import models
from rest_framework.views import APIView
from django.contrib.auth.models import User
from posts.models imp... | [
"posts.api.serializers.PostSerializer",
"rest_framework.response.Response",
"posts.models.Post.objects.filter",
"django.contrib.auth.models.User.objects.get",
"posts.models.Post.objects.get"
] | [((889, 914), 'posts.api.serializers.PostSerializer', 'PostSerializer', ([], {'data': 'data'}), '(data=data)\n', (903, 914), False, 'from posts.api.serializers import PostSerializer\n'), ((3114, 3152), 'posts.api.serializers.PostSerializer', 'PostSerializer', (['post_object'], {'data': 'data'}), '(post_object, data=dat... |
import json
import io
import time
import numpy as np
try:
to_unicode = unicode
except NameError:
to_unicode = str
def save_json(file_path, dictionary):
with io.open(file_path , 'w', encoding='utf8') as outfile:
str_ = json.dumps(dictionary,
... | [
"numpy.identity",
"json.dumps",
"numpy.tan",
"io.open"
] | [((726, 740), 'numpy.identity', 'np.identity', (['(3)'], {}), '(3)\n', (737, 740), True, 'import numpy as np\n'), ((186, 226), 'io.open', 'io.open', (['file_path', '"""w"""'], {'encoding': '"""utf8"""'}), "(file_path, 'w', encoding='utf8')\n", (193, 226), False, 'import io\n'), ((260, 336), 'json.dumps', 'json.dumps', ... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'plugin_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_pluginDialog(object):
def setupUi(self, pluginDialog):
p... | [
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QDialogButtonBox",
"PyQt5.QtWidgets.QListView",
"PyQt5.QtCore.QMetaObject.connectSlotsByName"
] | [((430, 465), 'PyQt5.QtWidgets.QVBoxLayout', 'QtWidgets.QVBoxLayout', (['pluginDialog'], {}), '(pluginDialog)\n', (451, 465), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((550, 583), 'PyQt5.QtWidgets.QListView', 'QtWidgets.QListView', (['pluginDialog'], {}), '(pluginDialog)\n', (569, 583), False, 'from PyQt... |
from __future__ import division
from cctbx.eltbx.xray_scattering import gaussian
# http://it.iucr.org/Cb/ch4o3v0001/sec4o3o2/ 2011-04-25
# Elastic atomic scattering factors of electrons for neutral atoms
# and s up to 2.0 A^-1
ito_vol_c_2011_table_4_3_2_2 = """\
H 1 0.0349 0.1201 0.1970 0.0573 0.1195 0.5347 3.5867 1... | [
"cctbx.eltbx.xray_scattering.get_standard_label",
"libtbx.containers.OrderedDict",
"cctbx.eltbx.xray_scattering.gaussian"
] | [((8901, 8961), 'cctbx.eltbx.xray_scattering.get_standard_label', 'xray_scattering.get_standard_label', ([], {'label': 'label', 'exact': 'exact'}), '(label=label, exact=exact)\n', (8935, 8961), False, 'from cctbx.eltbx import xray_scattering\n'), ((8172, 8185), 'libtbx.containers.OrderedDict', 'OrderedDict', ([], {}), ... |
import os
import sys
import gym
import time
import math
import time
import scipy
import skimage
import random
import logging
import pybullet
import numpy as np
from gym import spaces
from gym.utils import seeding
from pprint import pprint
from skimage.transform import rescale
from PIL import Image, ImageDraw
from ..uti... | [
"math.sqrt",
"numpy.array",
"numpy.linalg.norm",
"math.exp",
"logging.info",
"pprint.pprint",
"pybullet.getEulerFromQuaternion",
"numpy.arange",
"numpy.less",
"pybullet.getQuaternionFromEuler",
"numpy.linspace",
"numpy.dot",
"numpy.tile",
"numpy.abs",
"gym.spaces.Discrete",
"math.atan2... | [((1822, 1847), 'numpy.zeros', 'np.zeros', (['reference_shape'], {}), '(reference_shape)\n', (1830, 1847), True, 'import numpy as np\n'), ((3943, 3990), 'math.sqrt', 'math.sqrt', (["(DEFAULTS['timestep'] / self.timestep)"], {}), "(DEFAULTS['timestep'] / self.timestep)\n", (3952, 3990), False, 'import math\n'), ((5715, ... |
"""
PDF Converter from IPYNB to TEX to PDF
"""
import nbformat
from nbconvert import PDFExporter
from nbconvert import LatexExporter
import os
import sys
import shutil
import glob
from io import open
import subprocess
from sphinx.util.osutil import ensuredir
from sphinx.util import logging
from nbconvert.preprocessors... | [
"os.path.exists",
"distutils.dir_util.copy_tree",
"shutil.move",
"subprocess.Popen",
"sphinx.util.osutil.ensuredir",
"nbconvert.LatexExporter",
"nbconvert.PDFExporter",
"subprocess.run",
"os.path.join",
"io.open",
"os.chdir",
"shutil.copytree",
"sphinx.util.logging.getLogger",
"glob.glob",... | [((524, 551), 'sphinx.util.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (541, 551), False, 'from sphinx.util import logging\n'), ((901, 914), 'nbconvert.PDFExporter', 'PDFExporter', ([], {}), '()\n', (912, 914), False, 'from nbconvert import PDFExporter\n'), ((943, 958), 'nbconvert.Latex... |
import gzip
import sys
from subprocess import Popen, PIPE
from os.path import exists
from uuid import uuid4
step_id = str(uuid4())
def format_err(lines):
for line in lines:
yield line.strip()
ZRTIFI_ONTOLOGY = "http://www.zrtifi.org/ontology#"
if __name__ == "__main__":
file = sys.argv[1]
if exi... | [
"os.path.exists",
"subprocess.Popen",
"uuid.uuid4"
] | [((123, 130), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (128, 130), False, 'from uuid import uuid4\n'), ((317, 329), 'os.path.exists', 'exists', (['file'], {}), '(file)\n', (323, 329), False, 'from os.path import exists\n'), ((380, 416), 'subprocess.Popen', 'Popen', (["['gunzip', file]"], {'stderr': 'PIPE'}), "(['gunzip... |
#!/usr/bin/env python
# coding=utf-8
"""
Copyright 2012 Load Impact
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 la... | [
"unittest.main",
"os.path.abspath"
] | [((6269, 6284), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6282, 6284), False, 'import unittest\n'), ((682, 707), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (697, 707), False, 'import os\n')] |
from __future__ import unicode_literals
import matplotlib.pyplot as plt
import fileinput
import sys
#
# Displays one ore more CSV files in a graph. Intended to be used
# with the `bench_tables.rs` example.
#
# Accepts data from STDIN and additional files can be passed in as
# command line arguments. A use ca... | [
"fileinput.hook_encoded",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1059, 1073), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1071, 1073), True, 'import matplotlib.pyplot as plt\n'), ((1370, 1380), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1378, 1380), True, 'import matplotlib.pyplot as plt\n'), ((1131, 1162), 'fileinput.hook_encoded', 'fileinput.h... |
# coding: utf-8
# [] for list
# () for tuple
# {} for dictionary
#standard modules
import os
#my modules
from controller import Controller
from views import MainMenuView, ShowWordView, EditWordView, NewWordView
from translator import GlosbeTranslator
from phrase import Phrase
from model import Model
dictionary = ... | [
"model.Model",
"translator.GlosbeTranslator",
"views.ShowWordView",
"views.MainMenuView",
"views.NewWordView",
"views.EditWordView"
] | [((320, 327), 'model.Model', 'Model', ([], {}), '()\n', (325, 327), False, 'from model import Model\n'), ((341, 359), 'translator.GlosbeTranslator', 'GlosbeTranslator', ([], {}), '()\n', (357, 359), False, 'from translator import GlosbeTranslator\n'), ((393, 407), 'views.MainMenuView', 'MainMenuView', ([], {}), '()\n',... |
import io
import os
import re
from collections import namedtuple
from pathlib import PurePath, PurePosixPath, PureWindowsPath
DigestEntry = namedtuple('DigestEntry', ['digest', 'flag', 'path'])
class DigestError(Exception):
pass
class DigestParserError(DigestError):
pass
class DigestFormatError(DigestEr... | [
"collections.namedtuple",
"re.compile",
"io.TextIOWrapper"
] | [((142, 195), 'collections.namedtuple', 'namedtuple', (['"""DigestEntry"""', "['digest', 'flag', 'path']"], {}), "('DigestEntry', ['digest', 'flag', 'path'])\n", (152, 195), False, 'from collections import namedtuple\n'), ((1119, 1163), 'io.TextIOWrapper', 'io.TextIOWrapper', (['buf'], {'newline': 'self._linesep'}), '(... |
import numpy as np
def fx(x):
return (np.sin(np.sqrt(100 * x))) ** 2
def trapezoidal(a, b, e):
n = 1
h = []
er = []
i = []
h.append((b - a) / n)
s = (fx(a) + fx(b)) / 2
i.append(h[0] * s)
er.append(" ------")
for m in range(1, 1000, 1):
n = 2 * n
h.append((b... | [
"numpy.sqrt"
] | [((51, 67), 'numpy.sqrt', 'np.sqrt', (['(100 * x)'], {}), '(100 * x)\n', (58, 67), True, 'import numpy as np\n')] |
from livewires import games, color
import pygame
from director import Director
from rocket import Rocket
class Game:
""" class containing game elements """
background_image = games.load_image("textures\\background.png",
transparent = False)
def __in... | [
"director.Director",
"rocket.Rocket",
"livewires.games.screen.clear",
"livewires.games.load_image",
"livewires.games.screen.add",
"livewires.games.Text"
] | [((197, 260), 'livewires.games.load_image', 'games.load_image', (['"""textures\\\\background.png"""'], {'transparent': '(False)'}), "('textures\\\\background.png', transparent=False)\n", (213, 260), False, 'from livewires import games, color\n'), ((437, 451), 'director.Director', 'Director', (['self'], {}), '(self)\n',... |
"""
Simple example of library usage.
"""
import time
import struct
import board
import busio
import digitalio as dio
from circuitpython_nrf24l01 import RF24
# addresses needs to be in a buffer protocol object (bytearray)
address = b'1Node'
# change these (digital output) pins accordingly
ce = dio.DigitalInOut(board.D... | [
"busio.SPI",
"time.monotonic",
"struct.pack",
"time.sleep",
"circuitpython_nrf24l01.RF24",
"struct.unpack",
"digitalio.DigitalInOut"
] | [((296, 322), 'digitalio.DigitalInOut', 'dio.DigitalInOut', (['board.D4'], {}), '(board.D4)\n', (312, 322), True, 'import digitalio as dio\n'), ((329, 355), 'digitalio.DigitalInOut', 'dio.DigitalInOut', (['board.D5'], {}), '(board.D5)\n', (345, 355), True, 'import digitalio as dio\n'), ((471, 522), 'busio.SPI', 'busio.... |
# split_file.py
# MIT license; Copyright (c) 2020 - 2021 <NAME>
import os
import datetime
import time
import cfg
# Checks if there is more than one file in the raw dir to be processed.
def new_file_in_dir(dir):
i = 0
for file in os.listdir(dir):
try:
int(file)
i += 1
... | [
"os.listdir",
"os.rename",
"cfg.BUOY_ID.items",
"os.stat",
"os.remove"
] | [((239, 254), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (249, 254), False, 'import os\n'), ((3918, 3961), 'os.listdir', 'os.listdir', (['(cfg.BUOY_DATA_DIR + cfg.RAW_DIR)'], {}), '(cfg.BUOY_DATA_DIR + cfg.RAW_DIR)\n', (3928, 3961), False, 'import os\n'), ((4015, 4064), 'os.listdir', 'os.listdir', (['(cfg.BU... |
# -*- coding: utf-8 -*-
from __future__ import division, unicode_literals, absolute_import
import pycseg.definitions as definitions
from pycseg.data_store import Feature, Atom, Word, WordsGraph, DataStore
class Segment(object):
"""分词"""
def __init__(self, sentence, d_store=None):
self.sentence = se... | [
"pycseg.data_store.Feature",
"pycseg.data_store.WordsGraph"
] | [((385, 397), 'pycseg.data_store.WordsGraph', 'WordsGraph', ([], {}), '()\n', (395, 397), False, 'from pycseg.data_store import Feature, Atom, Word, WordsGraph, DataStore\n'), ((1191, 1218), 'pycseg.data_store.Feature', 'Feature', ([], {'tag_code': 'prev_type'}), '(tag_code=prev_type)\n', (1198, 1218), False, 'from pyc... |
from django.db import models
# Create your models here.
class Goods(models.Model):
goods_name = models.CharField(max_length=30)
goods_number = models.IntegerField()
goods_price = models.FloatField()
goods_sales = models.IntegerField('销量', default=0)
class Meta:
verbose_name_plural = "商品管... | [
"django.db.models.FloatField",
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((103, 134), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (119, 134), False, 'from django.db import models\n'), ((154, 175), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (173, 175), False, 'from django.db import models\n'), ((194, 213... |
#!/usr/bin/env python3
import os
import sys
import json
from pathlib import Path
from shutil import copyfile
appName = "Warspite Map Exporter"
appVer = "1.0.1.0"
appDesc = """Corrects paths and moves maps and their dependencies."""
sImgFormats = [
".png",
".jpg",
".webp",
".tiff"
]
def DoesParameter... | [
"os.path.exists",
"pathlib.Path",
"os.path.join",
"os.getcwd",
"os.path.isfile",
"shutil.copyfile",
"os.mkdir",
"sys.exit",
"json.load",
"json.dump"
] | [((1455, 1478), 'os.path.isfile', 'os.path.isfile', (['mapFile'], {}), '(mapFile)\n', (1469, 1478), False, 'import os\n'), ((1542, 1568), 'os.path.exists', 'os.path.exists', (['workingDir'], {}), '(workingDir)\n', (1556, 1568), False, 'import os\n'), ((3080, 3108), 'shutil.copyfile', 'copyfile', (['iTileSet', 'dTileSet... |
import pandas as pd
from pangea_api import (
Sample,
SampleAnalysisResultField,
SampleGroupAnalysisResultField,
SampleGroup,
)
from ..base_module import Module
from ..data_utils import (
categories_from_metadata,
scrub_category_val,
group_samples_by_metadata,
sample_module_field,
)
fro... | [
"pandas.DataFrame.from_dict"
] | [((3312, 3412), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['{sample.name: sample.mgs_metadata for sample in samples}'], {'orient': '"""index"""'}), "({sample.name: sample.mgs_metadata for sample in\n samples}, orient='index')\n", (3334, 3412), True, 'import pandas as pd\n')] |
from __future__ import print_function
import africastalking
class SMS:
def __init__(self):
self.username = "sandbox"
self.api_key = "<KEY>"
# Initialize the SDK
africastalking.initialize(self.username, self.api_key)
# Get the SMS service
self.sms = africastalking.SM... | [
"africastalking.initialize"
] | [((199, 253), 'africastalking.initialize', 'africastalking.initialize', (['self.username', 'self.api_key'], {}), '(self.username, self.api_key)\n', (224, 253), False, 'import africastalking\n')] |
from django.urls import path
from mainpage import views
# app_name = 'mainpage'
urlpatterns = [
path("", views.home, name="home"),
path("admin/mainpage/post/add/", views.newpost, name="newpost"),
path('<int:year>/<int:month>/<slug:slug>/', views.detailedpost, name="detailedpost"),
path('organisms/<slu... | [
"django.urls.path"
] | [((102, 135), 'django.urls.path', 'path', (['""""""', 'views.home'], {'name': '"""home"""'}), "('', views.home, name='home')\n", (106, 135), False, 'from django.urls import path\n'), ((141, 204), 'django.urls.path', 'path', (['"""admin/mainpage/post/add/"""', 'views.newpost'], {'name': '"""newpost"""'}), "('admin/mainp... |
# The MIT License (MIT)
#
# 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, subl... | [
"VirtualPet.lib.VirtualPetFramebuf.VirtualPetFramebuf",
"gamepad.GamePad",
"time.sleep",
"audiocore.RawSample",
"random.random",
"neopixel.NeoPixel",
"time.time",
"audioio.AudioOut",
"digitalio.DigitalInOut",
"math.sin",
"VirtualPet.lib.VirtualPet.VirtualPet",
"random.randint"
] | [((2052, 2111), 'neopixel.NeoPixel', 'neopixel.NeoPixel', (['board.NEOPIXEL', 'PIX_NUM'], {'brightness': '(0.05)'}), '(board.NEOPIXEL, PIX_NUM, brightness=0.05)\n', (2069, 2111), False, 'import neopixel\n'), ((2699, 2750), 'gamepad.GamePad', 'gamepad.GamePad', (['buttons[0]', 'buttons[1]', 'buttons[2]'], {}), '(buttons... |
import unittest
import random
from collection.set import Set
class TestSet(unittest.TestCase):
def setUp(self):
self.set = Set()
def test_constructor(self):
self.assertTrue(self.set.is_empty())
self.assertEquals(0, len(self.set))
def test_one_add(self):
element = 'foo'
... | [
"collection.set.Set"
] | [((138, 143), 'collection.set.Set', 'Set', ([], {}), '()\n', (141, 143), False, 'from collection.set import Set\n'), ((2238, 2247), 'collection.set.Set', 'Set', (['lst0'], {}), '(lst0)\n', (2241, 2247), False, 'from collection.set import Set\n'), ((2263, 2272), 'collection.set.Set', 'Set', (['lst1'], {}), '(lst1)\n', (... |
import socket
import threading
HEADER = 64
# The first message is going to be always 64 bytes of length
# so we first receive a message with: "(num of bytes the msg) + padding to be 64"
# After that, we prepare the server for that num of bytes.
PORT = 5050
SERVER = socket.gethostbyname(socket.gethostname())
ADDR = (SE... | [
"threading.active_count",
"threading.Thread",
"socket.gethostname",
"socket.socket"
] | [((393, 442), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (406, 442), False, 'import socket\n'), ((288, 308), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (306, 308), False, 'import socket\n'), ((1653, 1710), 'threading.Thr... |
import factory
from intake import models
from django.contrib.auth.models import User
from .status_notification_factory import StatusNotificationFactory
class StatusUpdateFactory(factory.DjangoModelFactory):
status_type = factory.Iterator(models.StatusType.objects.filter(
is_a_status_update_choice=True))
... | [
"factory.RelatedFactory",
"django.contrib.auth.models.User.objects.filter",
"intake.models.Application.objects.all",
"intake.models.NextStep.objects.first",
"intake.models.StatusType.objects.filter"
] | [((1121, 1187), 'factory.RelatedFactory', 'factory.RelatedFactory', (['StatusNotificationFactory', '"""status_update"""'], {}), "(StatusNotificationFactory, 'status_update')\n", (1143, 1187), False, 'import factory\n'), ((245, 309), 'intake.models.StatusType.objects.filter', 'models.StatusType.objects.filter', ([], {'i... |
import autogp
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import sklearn.metrics.pairwise as sk
import time
import scipy
import seaborn as sns
import random
from kerpy.Kernel import Kernel
from kerpy.MaternKernel import MaternKernel
from kerpy.GaussianKernel import GaussianKernel
# T... | [
"matplotlib.pyplot.ylabel",
"numpy.array",
"kerpy.GaussianKernel.GaussianKernel",
"numpy.arange",
"numpy.reshape",
"numpy.repeat",
"numpy.random.poisson",
"seaborn.distplot",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.asarray",
"autogp.datasets.DataSet",
"numpy.exp",
"num... | [((928, 948), 'numpy.random.seed', 'np.random.seed', (['(1500)'], {}), '(1500)\n', (942, 948), True, 'import numpy as np\n'), ((1205, 1252), 'numpy.random.normal', 'np.random.normal', ([], {'loc': '(0.0)', 'scale': '(1.0)', 'size': 'None'}), '(loc=0.0, scale=1.0, size=None)\n', (1221, 1252), True, 'import numpy as np\n... |
import matplotlib.pyplot as plt
import numpy as np
def plot_bars_by_group(grouped_data,colors,edgecolor=None,property_name="Data by group",ylabel="Value",figsize=(16,6),annotations = True):
"""Make bar graph by group.
Params:
------
grouped_data: (dict)
Each key represents a grou... | [
"matplotlib.pyplot.subplots",
"numpy.arange"
] | [((1072, 1091), 'numpy.arange', 'np.arange', (['n_labels'], {}), '(n_labels)\n', (1081, 1091), True, 'import numpy as np\n'), ((1391, 1405), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1403, 1405), True, 'import matplotlib.pyplot as plt\n')] |
"""
Aqualink API documentation
The Aqualink public API documentation # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from aqualink_sdk.api_client import ApiClient, Endpoint as _Endpoint
from a... | [
"aqualink_sdk.api_client.Endpoint",
"aqualink_sdk.api_client.ApiClient"
] | [((1151, 1787), 'aqualink_sdk.api_client.Endpoint', '_Endpoint', ([], {'settings': "{'response_type': (User,), 'auth': [], 'endpoint_path': '/users',\n 'operation_id': 'users_controller_create', 'http_method': 'POST',\n 'servers': None}", 'params_map': "{'all': ['create_user_dto'], 'required': ['create_user_dto']... |
"""supervisr dns provider compat tests"""
from unittest.mock import patch
from supervisr.core.models import Domain, ProviderAcquirableRelationship
from supervisr.core.providers.objects import ProviderObjectTranslator
from supervisr.core.utils.constants import TEST_DOMAIN
from supervisr.core.utils.tests import TestCas... | [
"supervisr.core.models.Domain.objects.get_or_create",
"supervisr.dns.providers.compat.CompatDNSTranslator",
"supervisr.dns.models.DataRecord.objects.create",
"supervisr.dns.models.SetRecord.objects.create",
"supervisr.dns.utils.date_to_soa",
"supervisr.core.models.ProviderAcquirableRelationship.objects.cr... | [((2349, 2421), 'unittest.mock.patch', 'patch', (['"""supervisr.dns.providers.compat.CompatDNSProvider.get_translator"""'], {}), "('supervisr.dns.providers.compat.CompatDNSProvider.get_translator')\n", (2354, 2421), False, 'from unittest.mock import patch\n'), ((736, 827), 'supervisr.core.models.Domain.objects.get_or_c... |
import json
import re
import tempfile
from pathlib import Path
from typing import Dict, Optional
from samples_validator import errors
from samples_validator.base import run_shell_command
from .base import CodeRunner
class CurlRunner(CodeRunner):
def prepare_sample(
self,
path: Path,
... | [
"json.loads",
"tempfile.gettempdir",
"samples_validator.base.run_shell_command"
] | [((734, 776), 'samples_validator.base.run_shell_command', 'run_shell_command', (['[bash_bin, sample_path]'], {}), '([bash_bin, sample_path])\n', (751, 776), False, 'from samples_validator.base import run_shell_command\n'), ((1284, 1300), 'json.loads', 'json.loads', (['body'], {}), '(body)\n', (1294, 1300), False, 'impo... |
from notebook.auth import passwd
import os
PASSWORD=os.environ['PASSWORD']
with open('/tmp/sha1-psswd', 'w') as f:
f.write(passwd(PASSWORD)) | [
"notebook.auth.passwd"
] | [((129, 145), 'notebook.auth.passwd', 'passwd', (['PASSWORD'], {}), '(PASSWORD)\n', (135, 145), False, 'from notebook.auth import passwd\n')] |
from src.model.networks.local import LocalModel
from src.model import loss
import src.model.functions as smfunctions
from src.model.archs.baseArch import BaseArch
from src.data import dataloaders
import torch, os
import torch.optim as optim
from torch.utils.data import DataLoader
import pickle as pkl
import numpy as np... | [
"src.model.networks.local.LocalModel",
"os.remove",
"src.model.functions.rand_affine_grid",
"torch.nn.functional.grid_sample",
"numpy.mean",
"src.model.functions.warp3d",
"torch.mean",
"src.model.loss.global_mutual_information",
"src.model.loss.jacobian_determinant",
"os.path.dirname",
"src.mode... | [((15480, 15495), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (15493, 15495), False, 'import torch, os\n'), ((18207, 18222), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (18220, 18222), False, 'import torch, os\n'), ((18486, 18501), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (18499, 18501), Fals... |
from datetime import datetime, timedelta
import rumps
rumps.debug_mode(True)
# Icon font:
# https://fonts.google.com/icons?selected=Material%20Icons%3Atimer
config = {
'app_name': "MenubarTimer",
'app_icon': 'menubar-icon.png',
'button_until': "Start timer until ",
'button_add_five': "Add 5 mins to ti... | [
"rumps.MenuItem",
"rumps.App",
"rumps.debug_mode",
"rumps.Timer",
"datetime.datetime.now",
"datetime.timedelta"
] | [((55, 77), 'rumps.debug_mode', 'rumps.debug_mode', (['(True)'], {}), '(True)\n', (71, 77), False, 'import rumps\n'), ((1089, 1108), 'datetime.timedelta', 'timedelta', ([], {'hours': '(-1)'}), '(hours=-1)\n', (1098, 1108), False, 'from datetime import datetime, timedelta\n'), ((1179, 1253), 'rumps.App', 'rumps.App', ([... |
import chevrons
from setuptools import setup, find_packages
setup(
name = 'chevrons',
packages = find_packages(),
version = '0.1.3',
description = 'Rapidly build pipelines for out-of-core data processing using higher order functions.',
author = '<NAME>',
author_email = '<EMAIL>',
classifiers = ['Program... | [
"setuptools.find_packages"
] | [((102, 117), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (115, 117), False, 'from setuptools import setup, find_packages\n')] |
from sciapp.action import dataio
import numpy as np
def imread(path):
return np.loadtxt(path, dtype=float)
def imsave(path, img):
np.savetxt(path, img)
dataio.ReaderManager.add("dat", imread, "img")
dataio.WriterManager.add("dat", imsave, "img")
class OpenFile(dataio.Reader):
title = "DAT Open"
... | [
"sciapp.action.dataio.WriterManager.add",
"numpy.loadtxt",
"sciapp.action.dataio.ReaderManager.add",
"numpy.savetxt"
] | [((166, 212), 'sciapp.action.dataio.ReaderManager.add', 'dataio.ReaderManager.add', (['"""dat"""', 'imread', '"""img"""'], {}), "('dat', imread, 'img')\n", (190, 212), False, 'from sciapp.action import dataio\n'), ((213, 259), 'sciapp.action.dataio.WriterManager.add', 'dataio.WriterManager.add', (['"""dat"""', 'imsave'... |
"""Implementation of Optimal F1 score based on TorchMetrics."""
import torch
from torchmetrics import Metric, PrecisionRecallCurve
class OptimalF1(Metric):
"""Optimal F1 Metric.
Compute the optimal F1 score at the adaptive threshold, based on the F1 metric of the true labels and the
predicted anomaly sco... | [
"torchmetrics.PrecisionRecallCurve",
"torch.max",
"torch.argmax"
] | [((460, 505), 'torchmetrics.PrecisionRecallCurve', 'PrecisionRecallCurve', ([], {'num_classes': 'num_classes'}), '(num_classes=num_classes)\n', (480, 505), False, 'from torchmetrics import Metric, PrecisionRecallCurve\n'), ((1461, 1480), 'torch.max', 'torch.max', (['f1_score'], {}), '(f1_score)\n', (1470, 1480), False,... |
import urllib
from bugsy import Bugsy
def rest_url(*parts, **kwargs):
base = '/'.join(['https://bugzilla.mozilla.org/rest'] +
[str(p) for p in parts])
kwargs.setdefault('include_fields', Bugsy.DEFAULT_SEARCH)
params = urllib.urlencode(kwargs, True)
if params:
return '%s?%s'... | [
"urllib.urlencode"
] | [((252, 282), 'urllib.urlencode', 'urllib.urlencode', (['kwargs', '(True)'], {}), '(kwargs, True)\n', (268, 282), False, 'import urllib\n')] |
import pytest
import uuid
from eha_jsonpath import parse
from eha_jsonpath.ext_functions import BaseFn
src = {
'space': '1 2 3 4',
'pipe': '1|2|3|4',
'comma': '1,2,3,4',
'float': '1.04',
'bad_float': '1.04s',
'epoch1': '0',
'epoch2': 1_000_000_000,
'epoch3': 1_000_000_000_000_000,
... | [
"uuid.UUID",
"eha_jsonpath.ext_functions.BaseFn",
"pytest.mark.parametrize",
"eha_jsonpath.parse",
"pytest.raises"
] | [((5410, 5560), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""cmd1,cmd2"""', "[('$.hashable1.`hash(a)`', '$.hashable2.`hash(a)`'), (\n '$.hashable3.`hash(a)`', '$.hashable4.`hash(a)`')]"], {}), "('cmd1,cmd2', [('$.hashable1.`hash(a)`',\n '$.hashable2.`hash(a)`'), ('$.hashable3.`hash(a)`',\n '$.ha... |
import struct
import sys
import matplotlib.pyplot as plt
import numpy as np
import mmap
import os
if len(sys.argv) < 2:
print("Usage: %s <path>" %(sys.argv[0]))
file = sys.argv[1]
filename = file.split("/")[-1]
arr = np.memmap(file, dtype='float64', mode='r')
plt.plot(arr)
plt.title(filename)
print("saving="+fi... | [
"matplotlib.pyplot.title",
"numpy.memmap",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.plot"
] | [((224, 266), 'numpy.memmap', 'np.memmap', (['file'], {'dtype': '"""float64"""', 'mode': '"""r"""'}), "(file, dtype='float64', mode='r')\n", (233, 266), True, 'import numpy as np\n'), ((267, 280), 'matplotlib.pyplot.plot', 'plt.plot', (['arr'], {}), '(arr)\n', (275, 280), True, 'import matplotlib.pyplot as plt\n'), ((2... |
import os
import discord
from discord.ext import commands
from discord.ext.commands import BucketType, cooldown
import motor.motor_asyncio
import nest_asyncio
import json
with open('./data.json') as f:
d1 = json.load(f)
with open('./market.json') as f:
d2 = json.load(f)
items = {}
for x in d2["IoT"]:
i =... | [
"discord.ext.commands.Cog.listener",
"discord.ext.commands.group",
"json.load",
"discord.ext.commands.cooldown",
"discord.ext.commands.command",
"discord.Embed",
"nest_asyncio.apply"
] | [((550, 570), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (568, 570), False, 'import nest_asyncio\n'), ((212, 224), 'json.load', 'json.load', (['f'], {}), '(f)\n', (221, 224), False, 'import json\n'), ((267, 279), 'json.load', 'json.load', (['f'], {}), '(f)\n', (276, 279), False, 'import json\n'), ((8... |
# -*- coding: utf-8 -*-
"""
Data Table Widget
=================
"""
# %% IMPORTS
# Built-in imports
# Package imports
from qtpy import QtCore as QC, QtGui as QG, QtWidgets as QW
# GuiPy imports
from guipy import layouts as GL, widgets as GW
from guipy.plugins.data_table.widgets.view import DataTableView
from guip... | [
"qtpy.QtGui.QIcon.fromTheme",
"guipy.widgets.set_box_value",
"guipy.widgets.DualSpinBox",
"guipy.plugins.data_table.widgets.view.DataTableView",
"guipy.widgets.QLabel",
"guipy.widgets.get_modified_signal",
"guipy.widgets.QToolButton",
"guipy.widgets.get_box_value",
"guipy.layouts.QVBoxLayout",
"gu... | [((4481, 4490), 'qtpy.QtCore.Slot', 'QC.Slot', ([], {}), '()\n', (4488, 4490), True, 'from qtpy import QtCore as QC, QtGui as QG, QtWidgets as QW\n'), ((4851, 4860), 'qtpy.QtCore.Slot', 'QC.Slot', ([], {}), '()\n', (4858, 4860), True, 'from qtpy import QtCore as QC, QtGui as QG, QtWidgets as QW\n'), ((896, 916), 'guipy... |
# Generated by Django 3.0.3 on 2020-03-18 19:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('staff', '0010_auto_20200318_1846'),
]
operations = [
migrations.RenameField(
model_name='instructor',
old_name='text_history... | [
"django.db.migrations.RenameField"
] | [((225, 321), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""instructor"""', 'old_name': '"""text_history"""', 'new_name': '"""history"""'}), "(model_name='instructor', old_name='text_history',\n new_name='history')\n", (247, 321), False, 'from django.db import migrations\n'), ... |
from golem import actions
description = 'Verify wait_for_alert_present action'
def test(data):
actions.navigate(data.env.url+'alert/')
actions.click('#alert-delay-button')
actions.wait_for_alert_present(10)
actions.verify_alert_present()
actions.dismiss_alert()
actions.click('#alert-delay-but... | [
"golem.actions.dismiss_alert",
"golem.actions.click",
"golem.actions.verify_alert_present",
"golem.actions.navigate",
"golem.actions.wait_for_alert_present"
] | [((102, 143), 'golem.actions.navigate', 'actions.navigate', (["(data.env.url + 'alert/')"], {}), "(data.env.url + 'alert/')\n", (118, 143), False, 'from golem import actions\n'), ((146, 182), 'golem.actions.click', 'actions.click', (['"""#alert-delay-button"""'], {}), "('#alert-delay-button')\n", (159, 182), False, 'fr... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
imp... | [
"os.getenv",
"azure.iot.device.aio.IoTHubDeviceClient.create_from_connection_string",
"time.sleep",
"uuid.uuid4",
"cellulariot.cellulariot.CellularIoTApp"
] | [((677, 721), 'os.getenv', 'os.getenv', (['"""IOTHUB_DEVICE_CONNECTION_STRING"""'], {}), "('IOTHUB_DEVICE_CONNECTION_STRING')\n", (686, 721), False, 'import os\n'), ((815, 873), 'azure.iot.device.aio.IoTHubDeviceClient.create_from_connection_string', 'IoTHubDeviceClient.create_from_connection_string', (['conn_str'], {}... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
def time_in_range(start, end, x):
"""
Return true if x is in the range [start, end]
"""
if start <= end:
return start <= x <= end
else:
return start <= x or x <= end
def formated_date(timestamp):
return datetime.d... | [
"datetime.datetime",
"datetime.datetime.strptime",
"datetime.datetime.utcnow"
] | [((889, 924), 'datetime.datetime', 'datetime.datetime', (['year', 'month', 'day'], {}), '(year, month, day)\n', (906, 924), False, 'import datetime\n'), ((975, 1041), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['str_formated_date', '"""%Y-%m-%d %H:%M:%S"""'], {}), "(str_formated_date, '%Y-%m-%d %H:%M:... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2021 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.
"""
Example implementation of MAML++ on miniImageNet.
"""
import learn2learn as l2l
import numpy as np
import random
import torch
from collections import namedtuple
... | [
"torch.nn.CrossEntropyLoss",
"torch.randperm",
"torch.max",
"torch.cuda.device_count",
"torch.min",
"examples.vision.mamlpp.cnn4_bnrs.CNN4_BNRS",
"learn2learn.vision.benchmarks.get_tasksets",
"numpy.random.seed",
"collections.namedtuple",
"torch.Tensor",
"examples.vision.mamlpp.MAMLpp.MAMLpp",
... | [((486, 526), 'collections.namedtuple', 'namedtuple', (['"""MetaBatch"""', '"""support query"""'], {}), "('MetaBatch', 'support query')\n", (496, 526), False, 'from collections import namedtuple\n'), ((1071, 1090), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (1083, 1090), False, 'import torch\n'),... |
import xdsl
pfizer = xdsl.Model("Pf_March_GeNie_01-03-22.xdsl")
# n1_Pfizer_dose
# n2_Age_group
# n3_Sex
# n4_Community_transmission
# n5_Vaccine_associated_myocarditis
# n6_Myocarditis_background
# n7_Vaccine_effectiveness_against_infection
# n8_Vaccine_effectiveness_against_death
# n9_Risk_of_infection_by_aget_and_... | [
"xdsl.Model"
] | [((22, 64), 'xdsl.Model', 'xdsl.Model', (['"""Pf_March_GeNie_01-03-22.xdsl"""'], {}), "('Pf_March_GeNie_01-03-22.xdsl')\n", (32, 64), False, 'import xdsl\n')] |
import time
class Preprocessed:
def __init__(self, c, db, profile, summoners):
"""
:type profile: str
:type db: darkarisulolstats.lolstats.database.Database
:type c: darkarisulolstats.arisu.console.Console
"""
db.preprocessed.add(profile, "matchlists", generate_matc... | [
"time.gmtime"
] | [((13357, 13385), 'time.gmtime', 'time.gmtime', (['(c_time / 1000.0)'], {}), '(c_time / 1000.0)\n', (13368, 13385), False, 'import time\n')] |
#!../../../../datadir_local/virtualenv/bin/python3
# -*- coding: utf-8 -*-
# transit_search_worker_v2.py
"""
Run speed tests as requested through the RabbitMQ message queue
See:
https://stackoverflow.com/questions/14572020/handling-long-running-tasks-in-pika-rabbitmq/52951933#52951933
https://github.com/pika/pika/blo... | [
"logging.getLogger",
"traceback.format_exc",
"json.loads",
"logging.StreamHandler",
"argparse.ArgumentParser",
"pika.URLParameters",
"os.path.join",
"time.sleep",
"os.getcwd",
"os.chdir",
"functools.partial",
"logging.FileHandler",
"time.time",
"plato_wp36.task_runner.TaskRunner",
"plato... | [((1111, 1122), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1120, 1122), False, 'import os\n'), ((1189, 1205), 'json.loads', 'json.loads', (['body'], {}), '(body)\n', (1199, 1205), False, 'import json\n'), ((1306, 1359), 'plato_wp36.task_runner.TaskRunner', 'task_runner.TaskRunner', ([], {'results_target': 'results_ta... |
from django.core.management.base import BaseCommand, CommandError
from apps.products.tasks import ProductsGenerator as generator
class Command(BaseCommand):
"""Command class."""
help = 'Generate all products in database.'
def add_arguments(self, parser):
"""Arguments."""
# Positional ar... | [
"apps.products.tasks.ProductsGenerator.generate_products"
] | [((598, 684), 'apps.products.tasks.ProductsGenerator.generate_products', 'generator.generate_products', ([], {'max_pages': "options['pages']", 'celery': "options['celery']"}), "(max_pages=options['pages'], celery=options[\n 'celery'])\n", (625, 684), True, 'from apps.products.tasks import ProductsGenerator as genera... |
#!/bin/python3
import torch
print(torch.__version__)
print('CUDA available: ' + str(torch.cuda.is_available()))
print('cuDNN version: ' + str(torch.backends.cudnn.version()))
a = torch.cuda.FloatTensor(2).zero_()
print('Tensor a = ' + str(a))
b = torch.randn(2).cuda()
print('Tensor b = ' + str(b))
c = a + b
print('Te... | [
"torch.cuda.is_available",
"torch.cuda.FloatTensor",
"torch.randn",
"torch.backends.cudnn.version"
] | [((181, 206), 'torch.cuda.FloatTensor', 'torch.cuda.FloatTensor', (['(2)'], {}), '(2)\n', (203, 206), False, 'import torch\n'), ((249, 263), 'torch.randn', 'torch.randn', (['(2)'], {}), '(2)\n', (260, 263), False, 'import torch\n'), ((85, 110), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (10... |
import math
import numpy
__author__ = 'Matt'
def drawWheelDisplay(canvas, x, y, size, data):
wheelSize = size / 6
drawWheel(canvas, x+size*1/4, y+size/6, wheelSize, data.frontLeftWheel)
drawWheel(canvas, x+size*1/4, y+size/6*3, wheelSize, data.midLeftWheel)
drawWheel(canvas, x+size*1/4, y+size/6*5, ... | [
"math.cos",
"numpy.matrix",
"math.sin"
] | [((1001, 1136), 'numpy.matrix', 'numpy.matrix', (['[[-half_length, -half_length], [-half_length, half_length], [half_length,\n half_length], [half_length, -half_length]]'], {}), '([[-half_length, -half_length], [-half_length, half_length], [\n half_length, half_length], [half_length, -half_length]])\n', (1013, 11... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# third party modules
import luigi
# local modules
from alleletraj import utils
from alleletraj.gatk import GATKIndelRealigner
from alleletraj.ref import ReferenceFASTA
# how many reads to use to estimate the damage frequency
MAPDAMAGE_DOWNSAMPLE = 100000
class MapDama... | [
"alleletraj.utils.run_cmd",
"alleletraj.gatk.GATKIndelRealigner",
"luigi.Parameter",
"alleletraj.ref.ReferenceFASTA"
] | [((544, 561), 'luigi.Parameter', 'luigi.Parameter', ([], {}), '()\n', (559, 561), False, 'import luigi\n'), ((575, 592), 'luigi.Parameter', 'luigi.Parameter', ([], {}), '()\n', (590, 592), False, 'import luigi\n'), ((609, 626), 'luigi.Parameter', 'luigi.Parameter', ([], {}), '()\n', (624, 626), False, 'import luigi\n')... |
import time
from functools import partial
from operator import is_not
import requests
from lxml import html
from lxml.cssselect import CSSSelector
from reppy.cache import RobotsCache
from reppy.exceptions import ConnectionException
try:
from urlparse import urlparse, urljoin
except ImportError:
from urllib.par... | [
"requests.session",
"urllib.parse.urlparse",
"lxml.html.fromstring",
"time.sleep",
"reppy.cache.RobotsCache",
"functools.partial",
"urllib.parse.urljoin"
] | [((1622, 1640), 'urllib.parse.urlparse', 'urlparse', (['self.url'], {}), '(self.url)\n', (1630, 1640), False, 'from urllib.parse import urlparse, urljoin\n'), ((1168, 1204), 'reppy.cache.RobotsCache', 'RobotsCache', ([], {'capacity': 'reppy_capacity'}), '(capacity=reppy_capacity)\n', (1179, 1204), False, 'from reppy.ca... |
import argparse
import numpy as np
import os
import torch
from my_utils import get_state_dict_from_checkpoint
parser = argparse.ArgumentParser()
parser.add_argument('-source_path', type=str, default='',
help='path to models whose kernel slice should be read out')
parser.add_argument('... | [
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"torch.reshape",
"torch.cat",
"torch.device"
] | [((130, 155), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (153, 155), False, 'import argparse\n'), ((859, 909), 'os.path.join', 'os.path.join', (['args.target_path', 'args.arch', 'dim_str'], {}), '(args.target_path, args.arch, dim_str)\n', (871, 909), False, 'import os\n'), ((965, 1002), 'os... |
from jinja2 import Template
class Persone:
def __init__(self, name ,age):
self.name = name
self.age = age
def getAge(self):
return self.age
def getName(self):
return self.name
person = Persone('peter',23)
tn = Template("my name is {{ per.getName()}} and I am {{ per.getAge... | [
"jinja2.Template"
] | [((258, 328), 'jinja2.Template', 'Template', (['"""my name is {{ per.getName()}} and I am {{ per.getAge() }} """'], {}), "('my name is {{ per.getName()}} and I am {{ per.getAge() }} ')\n", (266, 328), False, 'from jinja2 import Template\n')] |
import gym
import numpy as np
from grpc import RpcError
from robo_gym.utils.exceptions import InvalidStateError, RobotServerError
class MoveEffectorToWayPoints(gym.Wrapper):
"""
Add environment a goal that the robot end-effector must reach all waypoints.
"""
def __init__(self, env, wayPoints: np.ndarra... | [
"numpy.copy",
"numpy.array",
"numpy.linalg.norm"
] | [((1296, 1314), 'numpy.copy', 'np.copy', (['wayPoints'], {}), '(wayPoints)\n', (1303, 1314), True, 'import numpy as np\n'), ((2536, 2677), 'numpy.array', 'np.array', (["[observation[self.endEffectorName + '_x'], observation[self.endEffectorName +\n '_y'], observation[self.endEffectorName + '_z']]"], {}), "([observat... |
import pandas as pd
import numpy as np
import os
from keras import backend
from keras.preprocessing.sequence import pad_sequences
from keras.preprocessing.text import Tokenizer
from keras.layers.merge import concatenate
from keras.models import Sequential, Model
from keras.layers import Dense, Embedding, Activation, me... | [
"keras.backend.sum",
"pandas.read_csv",
"keras.layers.MaxPool1D",
"keras.backend.floatx",
"keras.backend.squeeze",
"keras.backend.dot",
"keras.layers.Activation",
"keras.layers.Dense",
"keras.preprocessing.sequence.pad_sequences",
"numpy.arange",
"keras.backend.tanh",
"keras.layers.merge.conca... | [((1167, 1202), 'pandas.read_csv', 'pd.read_csv', (['"""data/train_first.csv"""'], {}), "('data/train_first.csv')\n", (1178, 1202), True, 'import pandas as pd\n'), ((1210, 1247), 'pandas.read_csv', 'pd.read_csv', (['"""data/predict_first.csv"""'], {}), "('data/predict_first.csv')\n", (1221, 1247), True, 'import pandas ... |
"""
Synopsis: A binder for enabling this package using numpy arrays.
Author: <NAME> <<EMAIL>, <EMAIL>>
"""
from ctypes import cdll, POINTER, c_int, c_double, byref
import numpy as np
import ctypes
import pandas as pd
from numpy.ctypeslib import ndpointer
lib = cdll.LoadLibrary("./miniball_python.so")
def m... | [
"ctypes.byref",
"ctypes.POINTER",
"ctypes.cdll.LoadLibrary",
"numpy.array",
"numpy.ctypeslib.ndpointer",
"ctypes.c_double"
] | [((272, 312), 'ctypes.cdll.LoadLibrary', 'cdll.LoadLibrary', (['"""./miniball_python.so"""'], {}), "('./miniball_python.so')\n", (288, 312), False, 'from ctypes import cdll, POINTER, c_int, c_double, byref\n'), ((842, 853), 'ctypes.c_double', 'c_double', (['(0)'], {}), '(0)\n', (850, 853), False, 'from ctypes import cd... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
import os
import sys
import random
from pathlib import Path
from dotenv import load_dotenv
from PIL import Image, ImageDraw, ImageFont
def create_dest_dir(final_dir):
"""Crete a destination dir for NFTs"""
try:
os.mkdir("nfts")
except FileExistsErro... | [
"os.getenv",
"pathlib.Path",
"PIL.Image.new",
"PIL.ImageFont.truetype",
"dotenv.load_dotenv",
"PIL.ImageDraw.Draw",
"os.mkdir",
"sys.exit"
] | [((551, 584), 'dotenv.load_dotenv', 'load_dotenv', ([], {'dotenv_path': 'env_path'}), '(dotenv_path=env_path)\n', (562, 584), False, 'from dotenv import load_dotenv\n'), ((597, 611), 'os.getenv', 'os.getenv', (['key'], {}), '(key)\n', (606, 611), False, 'import os\n'), ((1420, 1471), 'PIL.Image.new', 'Image.new', (['""... |
"""
This library contains the functions that allow stacktrain to produce
Windows batch files.
"""
# Force Python 2 to use float division even for ints
from __future__ import division
from __future__ import print_function
import logging
import io
import ntpath
import os
import re
from string import Template
from sh... | [
"logging.getLogger",
"stacktrain.core.helpers.strip_top_dir",
"logging.debug",
"ntpath.join",
"stacktrain.core.helpers.clean_dir",
"os.path.join",
"re.match",
"logging.info",
"io.open",
"logging.exception",
"os.path.basename",
"sys.exit",
"ntpath.normpath",
"stacktrain.core.helpers.create_... | [((430, 457), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (447, 457), False, 'import logging\n'), ((476, 512), 'os.path.join', 'os.path.join', (['conf.top_dir', '"""wbatch"""'], {}), "(conf.top_dir, 'wbatch')\n", (488, 512), False, 'import os\n'), ((546, 614), 'os.path.join', 'os.path.... |
import numpy as np
import os
import csv
import argparse
import torchvision.transforms as transforms
from PIL import Image
def loading_ucf_lists():
dataset_root = "/home/ubuntu/data/ucf101"
split = 'split_1'
# data frame root
dataset_frame_root = os.path.join(dataset_root, 'rawframes')
# data lis... | [
"torchvision.transforms.CenterCrop",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"os.path.splitext",
"numpy.array",
"numpy.linspace",
"numpy.concatenate",
"numpy.load",
"torchvision.transforms.Compose"
] | [((265, 304), 'os.path.join', 'os.path.join', (['dataset_root', '"""rawframes"""'], {}), "(dataset_root, 'rawframes')\n", (277, 304), False, 'import os\n'), ((349, 458), 'os.path.join', 'os.path.join', (['dataset_root', '"""ucfTrainTestlist"""', "('ucf101_' + 'train' + '_' + split + '_rawframes' + '.txt')"], {}), "(dat... |
#! /usr/local/bin/python3
import json
import athletemodel
import yate
names = athletemodel.get_names_from_store()
print(yate.start_response('application/json'))
print(json.dumps(sorted(names)))
| [
"athletemodel.get_names_from_store",
"yate.start_response"
] | [((80, 115), 'athletemodel.get_names_from_store', 'athletemodel.get_names_from_store', ([], {}), '()\n', (113, 115), False, 'import athletemodel\n'), ((123, 162), 'yate.start_response', 'yate.start_response', (['"""application/json"""'], {}), "('application/json')\n", (142, 162), False, 'import yate\n')] |
#!/usr/bin/env python3
#encoding=utf-8
#-------------------------------------------------
# Usage: python3 timeseqs.py
# Description: the usage of time module
#-------------------------------------------------
'''
Test the relative speed of iteration tool alternatives
'''
import sys, timer
reps = 10000
repslis... | [
"timer.bestoftotal"
] | [((867, 899), 'timer.bestoftotal', 'timer.bestoftotal', (['(5)', '(1000)', 'test'], {}), '(5, 1000, test)\n', (884, 899), False, 'import sys, timer\n')] |
from flask_restx import Api, Resource
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
api = Api(app)
db = SQLAlchemy(app)
# db.init_app(app)
@api.route('/hello')
class HelloWorld(Resource):
def get(self):
return {'hello': 'world'}
if __name__ == '__main__':
app.r... | [
"flask_sqlalchemy.SQLAlchemy",
"flask_restx.Api",
"flask.Flask"
] | [((109, 124), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (114, 124), False, 'from flask import Flask\n'), ((131, 139), 'flask_restx.Api', 'Api', (['app'], {}), '(app)\n', (134, 139), False, 'from flask_restx import Api, Resource\n'), ((145, 160), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {... |
import tensorflow as tf
slim = tf.contrib.slim
from helper_net.inception_v4 import *
import pickle
import numpy as np
def get_weights():
checkpoint_file = '../checkpoints/inception_v4.ckpt'
sess = tf.Session()
arg_scope = inception_v4_arg_scope()
input_tensor = tf.placeholder(tf.float32, (None, 299, 299, 3))
with... | [
"pickle.dump",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.train.Saver",
"tensorflow.global_variables"
] | [((200, 212), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (210, 212), True, 'import tensorflow as tf\n'), ((267, 314), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '(None, 299, 299, 3)'], {}), '(tf.float32, (None, 299, 299, 3))\n', (281, 314), True, 'import tensorflow as tf\n'), ((427, 443), 't... |
from __future__ import division
import sys
import numpy as np
import matplotlib.pyplot as plt
import itertools
from matplotlib import rcParams
rcParams['font.family'] = 'sans-serif'
rcParams['font.sans-serif'] = ['Tahoma']
rcParams['ps.useafm'] = True
rcParams['pdf.use14corefonts'] = True
rcParams['text.usetex'] = Tru... | [
"itertools.cycle",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"numpy.load",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((404, 466), 'itertools.cycle', 'itertools.cycle', (["('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i')"], {}), "(('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'))\n", (419, 466), False, 'import itertools\n'), ((472, 519), 'itertools.cycle', 'itertools.cycle', (["('o', 'v', '*', 'D', 'x', '+')"], {}), "(('o', 'v', '*', 'D', ... |
from commons.util import most_similar, create_co_matrix, ppmi
from datasets import ptb
import numpy as np
window_size = 2
wordvec_size = 100
corpus, word_to_id, id_to_word = ptb.load_data('train')
vocab_size = len(word_to_id)
print('Calculating coincide number ...')
C = create_co_matrix(corpus, vocab_size, window_siz... | [
"commons.util.create_co_matrix",
"sklearn.utils.extmath.randomized_svd",
"commons.util.most_similar",
"datasets.ptb.load_data",
"commons.util.ppmi",
"numpy.linalg.svd"
] | [((176, 198), 'datasets.ptb.load_data', 'ptb.load_data', (['"""train"""'], {}), "('train')\n", (189, 198), False, 'from datasets import ptb\n'), ((273, 322), 'commons.util.create_co_matrix', 'create_co_matrix', (['corpus', 'vocab_size', 'window_size'], {}), '(corpus, vocab_size, window_size)\n', (289, 322), False, 'fro... |
import re
from collections import Counter
from difflib import unified_diff
from typing import List, Optional, Tuple, Union
from bx_django_utils.dbperf.query_recorder import SQLQueryRecorder
from bx_django_utils.stacktrace import StacktraceAfter
def counter_diff(c1, c2, fromfile=None, tofile=None):
def pformat(co... | [
"collections.Counter",
"re.findall",
"bx_django_utils.stacktrace.StacktraceAfter"
] | [((1365, 1409), 'bx_django_utils.stacktrace.StacktraceAfter', 'StacktraceAfter', ([], {'after_modules': 'after_modules'}), '(after_modules=after_modules)\n', (1380, 1409), False, 'from bx_django_utils.stacktrace import StacktraceAfter\n'), ((1556, 1565), 'collections.Counter', 'Counter', ([], {}), '()\n', (1563, 1565),... |
# Importing the Kratos Library
import KratosMultiphysics
import KratosMultiphysics.kratos_utilities as kratos_utils
# Import applications
import KratosMultiphysics.StructuralMechanicsApplication as KSM
# Other imports
import os
def Factory(settings, Model):
if(type(settings) != KratosMultiphysics.Parameters):
... | [
"KratosMultiphysics.StructuralMechanicsApplication.PostprocessEigenvaluesProcess",
"KratosMultiphysics.Parameters",
"os.mkdir",
"KratosMultiphysics.kratos_utilities.DeleteDirectoryIfExisting"
] | [((488, 643), 'KratosMultiphysics.Parameters', 'KratosMultiphysics.Parameters', (['"""{\n "folder_name" : "EigenResults",\n "save_output_files_in_folder" : true\n }"""'], {}), '(\n """{\n "folder_name" : "EigenResults",\n "save_output_files_in_folder" : ... |
import requests
import kivy
kivy.require('1.9.2')
from kivy.app import App
from kivy.properties import ObjectProperty, StringProperty
from kivy.uix.gridlayout import GridLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Label
api_key = 'get from wunderground.com'
class WU_GridLayout(BoxLayo... | [
"kivy.require",
"kivy.properties.StringProperty",
"requests.get"
] | [((28, 49), 'kivy.require', 'kivy.require', (['"""1.9.2"""'], {}), "('1.9.2')\n", (40, 49), False, 'import kivy\n'), ((340, 358), 'kivy.properties.StringProperty', 'StringProperty', (['""""""'], {}), "('')\n", (354, 358), False, 'from kivy.properties import ObjectProperty, StringProperty\n'), ((374, 392), 'kivy.propert... |
# -*- coding: utf-8 -*-
from __future__ import division
import bz2
from datetime import datetime
import os
import pickle
import numpy as np
import torch
from tqdm import trange
from agent import Agent
from utils import initialize_environment
from memory import ReplayMemory
from test import test
from parsers import pa... | [
"os.path.exists",
"parsers.parser.parse_args",
"pickle.dump",
"os.makedirs",
"os.path.join",
"pickle.load",
"test.test",
"utils.initialize_environment",
"datetime.datetime.now",
"agent.Agent",
"numpy.random.randint",
"torch.cuda.is_available",
"numpy.random.seed",
"memory.ReplayMemory",
... | [((341, 360), 'parsers.parser.parse_args', 'parser.parse_args', ([], {}), '()\n', (358, 360), False, 'from parsers import parser\n'), ((455, 487), 'os.path.join', 'os.path.join', (['"""results"""', 'args.id'], {}), "('results', args.id)\n", (467, 487), False, 'import os\n'), ((638, 663), 'numpy.random.seed', 'np.random... |
from flask_restx import Resource, abort
from .dataset_api import data_point_model
from ...model.model import model
from ...data.dimension_reduction_loader import reduction_models_loader
from ...flask_setup.flask import app
from ..models.classification_models import classification_api, classification_input
from .dataset... | [
"flask_restx.abort"
] | [((1174, 1244), 'flask_restx.abort', 'abort', (['(400)', '"""An empty list was provided. Please send text to classify"""'], {}), "(400, 'An empty list was provided. Please send text to classify')\n", (1179, 1244), False, 'from flask_restx import Resource, abort\n'), ((2693, 2729), 'flask_restx.abort', 'abort', (['(500)... |
from turtle import *
import random
import pygame
w=Turtle()
s=Screen()
shape("circle")
l=[ "red","blue","orange","yellow","green"]
s.bgcolor("black")
w.speed(-1)
w.pensize(1)
def t(x):
w.rt(60)
w.fd(x)
w.rt(120)
w.fd(x)
w.rt(120)
w.fd(x)
def sq(x):
for i in range(2):
w.fd(x... | [
"random.choice"
] | [((1027, 1043), 'random.choice', 'random.choice', (['l'], {}), '(l)\n', (1040, 1043), False, 'import random\n'), ((1202, 1218), 'random.choice', 'random.choice', (['l'], {}), '(l)\n', (1215, 1218), False, 'import random\n'), ((1291, 1307), 'random.choice', 'random.choice', (['l'], {}), '(l)\n', (1304, 1307), False, 'im... |
from distutils.core import setup
setup(
name = 'python-tee',
packages = ['tee'],
version = '0.0.5',
license='MIT',
description = '',
author = '<NAME>',
url = 'https://github.com/dante-biase/python-tee',
download_url = 'https://github.com/dante-biase/python-tee/archive/v0.0.5.tar.gz',
classifiers=[
... | [
"distutils.core.setup"
] | [((33, 528), 'distutils.core.setup', 'setup', ([], {'name': '"""python-tee"""', 'packages': "['tee']", 'version': '"""0.0.5"""', 'license': '"""MIT"""', 'description': '""""""', 'author': '"""<NAME>"""', 'url': '"""https://github.com/dante-biase/python-tee"""', 'download_url': '"""https://github.com/dante-biase/python-... |