code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pdb, math, os, sys, pickle, gzip, re
from pprint import pprint
import torch, matplotlib.pyplot as plt, numpy as np
if __name__ == "__main__":
matches = lambda x: re.match(r"all_results_[0-9]{3}.pkl.gz", x) is not None
fnames = sum(
[
[os.path.join(root, fname) for fname in fnames i... | [
"gzip.open",
"os.walk",
"re.match",
"pickle.load",
"pprint.pprint",
"os.path.join"
] | [((999, 1008), 'pprint.pprint', 'pprint', (['v'], {}), '(v)\n', (1005, 1008), False, 'from pprint import pprint\n'), ((176, 218), 're.match', 're.match', (['"""all_results_[0-9]{3}.pkl.gz"""', 'x'], {}), "('all_results_[0-9]{3}.pkl.gz', x)\n", (184, 218), False, 'import pdb, math, os, sys, pickle, gzip, re\n'), ((486, ... |
import yaml
import click
import requests
from kubernetes.client.rest import ApiException
from openshift.dynamic.exceptions import ResourceNotFoundError
from openshift.dynamic import Resource, ResourceField, ResourceInstance
from ..cli import root
from .. import kube
def _format_as_columns(columns, data):
data ... | [
"openshift.dynamic.ResourceInstance",
"click.argument",
"click.option",
"click.echo",
"yaml.safe_load",
"requests.get"
] | [((1142, 1239), 'click.option', 'click.option', (['"""-f"""', '"""--filename"""'], {'default': 'None', 'help': '"""File contains the workshop to import."""'}), "('-f', '--filename', default=None, help=\n 'File contains the workshop to import.')\n", (1154, 1239), False, 'import click\n'), ((1243, 1321), 'click.option... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import web
from bson.objectid import ObjectId
from config import setting
import helper
db = setting.db_web
# 页面管理
url = ('/plat/pages')
PAGE_SIZE = 30
# 返回目录里所有问题节点的数量
def count_question(parent_id):
question = 0
r2 = db.pages.find({'parent_id':str(parent_id)}... | [
"bson.objectid.ObjectId",
"helper.create_render",
"web.input",
"helper.logged",
"helper.get_session_uname",
"web.seeother",
"helper.get_privilege_name"
] | [((756, 789), 'web.input', 'web.input', ([], {'page': '"""0"""', 'parent_id': '""""""'}), "(page='0', parent_id='')\n", (765, 789), False, 'import web\n'), ((806, 828), 'helper.create_render', 'helper.create_render', ([], {}), '()\n', (826, 828), False, 'import helper\n'), ((654, 700), 'helper.logged', 'helper.logged',... |
import chess
import algorithm
import agent
def evaluate():
"""Evaluates the current status of the board by computing a score.
Calculates a total score which is the combination of two scores: the material
score and the mobility score. The material score is calculated for each piece
with a specific we... | [
"chess.Board",
"agent.Agent",
"chess.square_rank"
] | [((2407, 2427), 'agent.Agent', 'agent.Agent', ([], {'depth': '(3)'}), '(depth=3)\n', (2418, 2427), False, 'import agent\n'), ((2440, 2453), 'chess.Board', 'chess.Board', ([], {}), '()\n', (2451, 2453), False, 'import chess\n'), ((3261, 3297), 'chess.square_rank', 'chess.square_rank', (['ai_move.to_square'], {}), '(ai_m... |
from typing import Union, Any
from datetime import datetime
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from app import schemas, models
from app.api import dependencies as deps
from app.core import strings
from app.utils import is_guest_user
from app.crud import crud_report_... | [
"fastapi.HTTPException",
"app.crud.crud_report_world.remove",
"app.crud.crud_report_world.create",
"app.crud.crud_report_world.update",
"fastapi.Depends",
"app.utils.is_guest_user",
"datetime.datetime.now",
"fastapi.APIRouter"
] | [((415, 426), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (424, 426), False, 'from fastapi import APIRouter, Depends, HTTPException\n'), ((590, 610), 'fastapi.Depends', 'Depends', (['deps.get_db'], {}), '(deps.get_db)\n', (597, 610), False, 'from fastapi import APIRouter, Depends, HTTPException\n'), ((666, 696)... |
#!/usr/bin/python3
from pathlib import Path
from mseg_semantic.utils.img_path_utils import (
dump_relpath_txt,
get_unique_stem_from_last_k_strs
)
_ROOT = Path(__file__).resolve().parent
def test_dump_relpath_txt():
""" """
jpg_dir = f'{_ROOT}/test_data/test_imgs_relpaths'
txt_output_dir = f'{_ROOT}/test_data/te... | [
"mseg_semantic.utils.img_path_utils.dump_relpath_txt",
"pathlib.Path",
"mseg_semantic.utils.img_path_utils.get_unique_stem_from_last_k_strs"
] | [((348, 389), 'mseg_semantic.utils.img_path_utils.dump_relpath_txt', 'dump_relpath_txt', (['jpg_dir', 'txt_output_dir'], {}), '(jpg_dir, txt_output_dir)\n', (364, 389), False, 'from mseg_semantic.utils.img_path_utils import dump_relpath_txt, get_unique_stem_from_last_k_strs\n'), ((737, 781), 'mseg_semantic.utils.img_pa... |
import json
from time import sleep
from unittest import TestCase
import websockets
import asyncio
from .utils.wiremock import set_bootstrap_response
from settings import WS_URI
class TestSetupConnection(TestCase):
"""
Simple test for setting up a websocket connection
"""
def test_subscribe_ws_gives_... | [
"websockets.connect",
"asyncio.get_event_loop",
"json.loads",
"time.sleep"
] | [((417, 443), 'websockets.connect', 'websockets.connect', (['WS_URI'], {}), '(WS_URI)\n', (435, 443), False, 'import websockets\n'), ((511, 526), 'json.loads', 'json.loads', (['res'], {}), '(res)\n', (521, 526), False, 'import json\n'), ((675, 699), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', ... |
import json # pragma : no cover
from rest_framework.renderers import JSONRenderer
class ProfileRenderer(JSONRenderer):
charset = 'utf-8'
def render(self, data, *args, **kwargs):
""" Renders a profle Response"""
errors = data.get('errors', None)
if errors is not None:
r... | [
"json.dumps"
] | [((384, 413), 'json.dumps', 'json.dumps', (["{'profile': data}"], {}), "({'profile': data})\n", (394, 413), False, 'import json\n')] |
# -*- coding: utf-8 -*-
"""Test indexes"""
import unittest
from pyrseas.testutils import DatabaseToMapTestCase
from pyrseas.testutils import InputMapToSqlTestCase, fix_indent
CREATE_TABLE_STMT = "CREATE TABLE t1 (c1 integer, c2 text)"
CREATE_STMT = "CREATE INDEX t1_idx ON t1 (c1)"
COMMENT_STMT = "COMMENT ON INDEX t1... | [
"unittest.main",
"unittest.TestLoader",
"pyrseas.testutils.fix_indent"
] | [((13683, 13717), 'unittest.main', 'unittest.main', ([], {'defaultTest': '"""suite"""'}), "(defaultTest='suite')\n", (13696, 13717), False, 'import unittest\n'), ((6272, 6290), 'pyrseas.testutils.fix_indent', 'fix_indent', (['sql[0]'], {}), '(sql[0])\n', (6282, 6290), False, 'from pyrseas.testutils import InputMapToSql... |
import torch
import torch.nn as nn
def conv1x1(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
def conv3x3(in_planes, out_planes, stride=1, groups=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, padding=1,
... | [
"torch.flatten",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d",
"torch.nn.Linear",
"torch.nn.MaxPool2d"
] | [((94, 168), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': '(1)', 'stride': 'stride', 'bias': '(False)'}), '(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)\n', (103, 168), True, 'import torch.nn as nn\n'), ((238, 342), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out... |
"""
Semi supervised GAN on MNIST
"""
import argparse
import pprint
import sys
from itertools import chain
import torch
import torch.nn as nn
from torchlib.dataset.image.mnist import get_mnist_data_loader, get_mnist_subset_data_loader
from torchlib.utils.layers import conv2d_bn_lrelu_dropout_block, conv2d_trans_bn_lr... | [
"torch.nn.BCEWithLogitsLoss",
"torchlib.generative_model.gan.sgan.sgan.SemiSupervisedGAN",
"argparse.ArgumentParser",
"torchlib.generative_model.gan.sgan.utils.SampleImage",
"torch.nn.Tanh",
"torchlib.dataset.image.mnist.get_mnist_subset_data_loader",
"torchlib.utils.layers.conv2d_bn_lrelu_dropout_block... | [((3630, 3683), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""SGAN for MNIST"""'}), "(description='SGAN for MNIST')\n", (3653, 3683), False, 'import argparse\n'), ((3917, 3936), 'pprint.pprint', 'pprint.pprint', (['args'], {}), '(args)\n', (3930, 3936), False, 'import pprint\n'), ((4023... |
"""
#code
>>> import helper, op, script, tx
#endcode
#unittest
tx:TxTest:test_verify_p2pkh:
#endunittest
#code
>>> # Transaction Construction Example
>>> from ecc import PrivateKey
>>> from helper import decode_base58, SIGHASH_ALL
>>> from script import p2pkh_script, Script
>>> from tx import Tx, TxIn, TxOut
>>> # Ste... | [
"ecc.S256Point.parse",
"op.encode_num",
"ecc.Signature.parse",
"helper.SIGHASH_ALL.to_bytes",
"script.Script",
"helper.encode_base58_checksum"
] | [((16819, 16837), 'script.Script', 'Script', (['[sig, sec]'], {}), '([sig, sec])\n', (16825, 16837), False, 'from script import p2pkh_script, Script\n'), ((18063, 18100), 'helper.encode_base58_checksum', 'encode_base58_checksum', (['(prefix + h160)'], {}), '(prefix + h160)\n', (18085, 18100), False, 'from helper import... |
import os.path as osp
import sys
import torch.nn as nn
sys.path.append(osp.dirname(osp.dirname(osp.dirname(osp.abspath(__file__)))))
from criteria_comparing_sets_pcs.jsd_calculator import JsdCalculator
class JSDBasedEvaluator(nn.Module):
def __init__(self):
super().__init__()
@staticmethod
def... | [
"os.path.abspath",
"criteria_comparing_sets_pcs.jsd_calculator.JsdCalculator.forward"
] | [((575, 632), 'criteria_comparing_sets_pcs.jsd_calculator.JsdCalculator.forward', 'JsdCalculator.forward', (['val_data', 'synthetic_data'], {}), '(val_data, synthetic_data, **kwargs)\n', (596, 632), False, 'from criteria_comparing_sets_pcs.jsd_calculator import JsdCalculator\n'), ((110, 131), 'os.path.abspath', 'osp.ab... |
from functools import wraps
import importlib
import logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from lib.nn import SynchronizedBatchNorm2d
from core.config import cfg
from model.roi_pooling.functions.roi_pool import RoIPoolFunction
#from model.roi_cro... | [
"modeling.semseg_heads.ModelBuilder",
"importlib.import_module",
"modeling.spn_online.SPN",
"torch.equal",
"torch.softmax",
"torch.nn.NLLLoss",
"torch.nn.functional.softmax",
"torch.max",
"modeling.fcn8s.FCN8s",
"functools.wraps",
"torch.nn.functional.log_softmax",
"utils.resnet_weights_helper... | [((875, 902), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (892, 902), False, 'import logging\n'), ((1871, 1886), 'functools.wraps', 'wraps', (['net_func'], {}), '(net_func)\n', (1876, 1886), False, 'from functools import wraps\n'), ((1460, 1496), 'importlib.import_module', 'importlib.i... |
import argparse
import mxnet as mx
import os
import sys
from cam import Cam
from cam import Cam_resp
def parse_args():
parser = argparse.ArgumentParser(description='Class activation mapping demo')
parser.add_argument('--network', dest='network', type=str, default='densenet121',
... | [
"cam.Cam",
"argparse.ArgumentParser",
"os.getcwd",
"os.path.isfile",
"mxnet.cpu",
"cam.Cam_resp",
"mxnet.gpu"
] | [((143, 211), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Class activation mapping demo"""'}), "(description='Class activation mapping demo')\n", (166, 211), False, 'import argparse\n'), ((2158, 2185), 'os.path.isfile', 'os.path.isfile', (['class_names'], {}), '(class_names)\n', (2172... |
"""Test HADGEM2-ES fixes."""
import unittest
from esmvalcore.cmor._fixes.cmip5.hadgem2_es import O2, AllVars, Cl
from esmvalcore.cmor._fixes.common import ClFixHybridHeightCoord
from esmvalcore.cmor.fix import Fix
class TestAllVars(unittest.TestCase):
"""Test allvars fixes."""
def test_get(self):
""... | [
"esmvalcore.cmor.fix.Fix.get_fixes",
"esmvalcore.cmor._fixes.cmip5.hadgem2_es.O2",
"esmvalcore.cmor._fixes.cmip5.hadgem2_es.AllVars",
"esmvalcore.cmor._fixes.cmip5.hadgem2_es.Cl"
] | [((774, 824), 'esmvalcore.cmor.fix.Fix.get_fixes', 'Fix.get_fixes', (['"""CMIP5"""', '"""HadGEM2-ES"""', '"""Amon"""', '"""cl"""'], {}), "('CMIP5', 'HadGEM2-ES', 'Amon', 'cl')\n", (787, 824), False, 'from esmvalcore.cmor.fix import Fix\n'), ((380, 431), 'esmvalcore.cmor.fix.Fix.get_fixes', 'Fix.get_fixes', (['"""CMIP5"... |
"""
Created: 2018-08-08
Modified: 2019-03-07
Author: <NAME> <<EMAIL>>
"""
from numpy import array, zeros, arange
from scipy.optimize import root
from scipy.interpolate import lagrange
import common
from common import r0, th0, ph0, pph0, timesteps, get_val, get_der
from plotting import plot_orbit
steps_per_bounce =... | [
"plotting.plot_orbit",
"numpy.zeros",
"common.timesteps",
"time.time",
"numpy.array",
"numpy.arange",
"scipy.optimize.root"
] | [((333, 373), 'common.timesteps', 'timesteps', (['steps_per_bounce'], {'nbounce': '(100)'}), '(steps_per_bounce, nbounce=100)\n', (342, 373), False, 'from common import r0, th0, ph0, pph0, timesteps, get_val, get_der\n'), ((424, 442), 'numpy.zeros', 'zeros', (['[3, nt + 1]'], {}), '([3, nt + 1])\n', (429, 442), False, ... |
import yfinance as yf
import yahoo_fin.stock_info as si
import pandas as pd
import requests
from math import isnan
from bs4 import BeautifulSoup
class Financials:
def __init__(self, stock_batch):
self.stock_batch = []
self.batch_earnings = []
self.batch_stats = []
self.batch_info =... | [
"yahoo_fin.stock_info.get_quote_table",
"yahoo_fin.stock_info.get_earnings_history",
"requests.get",
"yfinance.Ticker",
"bs4.BeautifulSoup",
"yahoo_fin.stock_info.get_stats"
] | [((4853, 4865), 'yfinance.Ticker', 'yf.Ticker', (['x'], {}), '(x)\n', (4862, 4865), True, 'import yfinance as yf\n'), ((5214, 5290), 'requests.get', 'requests.get', (['f"""https://ca.finance.yahoo.com/quote/{s}/key-statistics?p={s}"""'], {}), "(f'https://ca.finance.yahoo.com/quote/{s}/key-statistics?p={s}')\n", (5226, ... |
import pygame
from pygame.locals import DOUBLEBUF, OPENGL, RESIZABLE
import math
import numpy as np
from OpenGL.GL import glLineWidth, glBegin, GL_LINES, glColor3f, glVertex3fv, glEnd, glPointSize, GL_POINTS, glVertex3f, \
glScaled, GLfloat, glGetFloatv, GL_MODELVIEW_MATRIX, glRotatef, glTranslatef, glClear, GL_COL... | [
"OpenGL.GL.glVertex3fv",
"pygame.event.get",
"OpenGL.GL.glScaled",
"OpenGL.GL.glClear",
"OpenGL.GL.glGetFloatv",
"OpenGL.GL.glTranslatef",
"OpenGL.GL.glBegin",
"pygame.display.set_mode",
"OpenGL.GL.glVertex3f",
"OpenGL.GL.glLineWidth",
"pygame.quit",
"pygame.mouse.get_pressed",
"math.sqrt",
... | [((563, 579), 'OpenGL.GL.glLineWidth', 'glLineWidth', (['(1.5)'], {}), '(1.5)\n', (574, 579), False, 'from OpenGL.GL import glLineWidth, glBegin, GL_LINES, glColor3f, glVertex3fv, glEnd, glPointSize, GL_POINTS, glVertex3f, glScaled, GLfloat, glGetFloatv, GL_MODELVIEW_MATRIX, glRotatef, glTranslatef, glClear, GL_COLOR_B... |
import numpy as np
def sigmoid(x, derivative=False):
# Sigmoida in odvod
s = 1/(1 + np.exp(-x))
if not derivative:
return s
else:
return s * (1 - s)
def ReLu(x, derivative=False):
if not derivative:
return x if x > 0 else 0,
else:
return 1 if x > 0 else 0,
k... | [
"numpy.exp"
] | [((94, 104), 'numpy.exp', 'np.exp', (['(-x)'], {}), '(-x)\n', (100, 104), True, 'import numpy as np\n')] |
###################
# PyCon 2018 Project Submission
# "Visualizing Global Refugee Crisis using Pythonic ETL"
# <EMAIL>
###################
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.basemap import Basemap
###################
# Generate a bar chart for total popul... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"pandas.DataFrame.from_dict",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid",
"mpl_toolkits.basemap.Basemap"
... | [((591, 689), 'matplotlib.pyplot.title', 'plt.title', (['"""Total Refugee Population: 1952-2016"""'], {'fontweight': '"""bold"""', 'color': '"""g"""', 'fontsize': '"""12"""'}), "('Total Refugee Population: 1952-2016', fontweight='bold', color=\n 'g', fontsize='12')\n", (600, 689), True, 'from matplotlib import pyplo... |
import sys
sys.path.append('../')
from python_terragrunt import python_terragrunt
class TestTerragrunt(object):
def test_apply(self):
tf = python_terragrunt.Terragrunt()
assert tf.apply()
def test_destroy(self):
tf = python_terragrunt.Terragrunt()
assert tf.destroy()
| [
"sys.path.append",
"python_terragrunt.python_terragrunt.Terragrunt"
] | [((11, 33), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (26, 33), False, 'import sys\n'), ((152, 182), 'python_terragrunt.python_terragrunt.Terragrunt', 'python_terragrunt.Terragrunt', ([], {}), '()\n', (180, 182), False, 'from python_terragrunt import python_terragrunt\n'), ((251, 281), 'py... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#==========================================================
# gmailで操作するルームモニターシステム
#==========================================================
import subprocess
import sys
import re
import time
import datetime
import picamera
import os
import shutil
import RPi.GPIO as GPIO
i... | [
"matplotlib.pyplot.title",
"os.mkdir",
"smtplib.SMTP_SSL",
"email.mime.text.MIMEText",
"email.mime.base.MIMEBase",
"email.header.Header",
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"matplotlib.pyplot.close",
"email.encoders.encode_base64",
"email.mime.multipart.MIMEMultipart",
"shutil.copyfile",
... | [((688, 709), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (702, 709), False, 'import matplotlib\n'), ((1122, 1147), 'datetime.datetime.today', 'datetime.datetime.today', ([], {}), '()\n', (1145, 1147), False, 'import datetime\n'), ((10999, 11033), 're.search', 're.search', (['"""チ"""', "self.e... |
"""Auto-generated file, do not edit by hand. FR metadata"""
from phonenumbers.phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_FR = PhoneMetadata(id='FR', country_code=33, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='3\\d{6}', possible_number_patt... | [
"phonenumbers.phonemetadata.PhoneNumberDesc",
"phonenumbers.phonemetadata.NumberFormat"
] | [((249, 360), 'phonenumbers.phonemetadata.PhoneNumberDesc', 'PhoneNumberDesc', ([], {'national_number_pattern': '"""3\\\\d{6}"""', 'possible_number_pattern': '"""\\\\d{7}"""', 'possible_length': '(7,)'}), "(national_number_pattern='3\\\\d{6}', possible_number_pattern=\n '\\\\d{7}', possible_length=(7,))\n", (264, 36... |
import logging
from google.cloud import bigquery
def load_temp_to_perm(table_id:str, dataset_id:str, source_filename:str, client:bigquery.Client):
dataset = client.create_dataset(dataset_id)
table_ref = dataset.table('block_from_local_file')
job_config = bigquery.LoadJobConfig(
source_format=big... | [
"google.cloud.bigquery.LoadJobConfig",
"logging.info",
"logging.errors"
] | [((271, 376), 'google.cloud.bigquery.LoadJobConfig', 'bigquery.LoadJobConfig', ([], {'source_format': 'bigquery.SourceFormat.CSV', 'skip_leading_rows': '(1)', 'autodetect': '(True)'}), '(source_format=bigquery.SourceFormat.CSV,\n skip_leading_rows=1, autodetect=True)\n', (293, 376), False, 'from google.cloud import ... |
import sys
import math
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QWidget, QLabel, QLineEdit, QApplication, QWidget
from PyQt5.QtWidgets import QPushButton
from PyQt5.QtCore import QSize
from PyQt5.QtGui import QIcon
import sqlite3
import re
con = sqlite3.connect("chemi.... | [
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtGui.QIcon",
"PyQt5.QtWidgets.QMainWindow.__init__",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtCore.QSize",
"sqlite3.connect",
"PyQt5.QtWidgets.QApplication",
"re.compile"
] | [((297, 324), 'sqlite3.connect', 'sqlite3.connect', (['"""chemi.db"""'], {}), "('chemi.db')\n", (312, 324), False, 'import sqlite3\n'), ((906, 948), 're.compile', 're.compile', (['"""(\\\\()(\\\\w*)(\\\\))(\\\\d*)"""', 're.I'], {}), "('(\\\\()(\\\\w*)(\\\\))(\\\\d*)', re.I)\n", (916, 948), False, 'import re\n'), ((1580... |
import time
import numpy as np
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau
# from torch_geometric.nn import VGAE
from torch_geometric.loader import DataLoader
from torch_geometric.utils import (degree, negative_sampling,
batched_negative_sampling,
... | [
"matplotlib.pyplot.title",
"argparse.ArgumentParser",
"time.ctime",
"matplotlib.pyplot.figure",
"numpy.mean",
"genome_graph.gen_g2g_graph",
"torch.no_grad",
"dcj_comp.dcj_dist",
"torch_geometric.loader.DataLoader",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"torch.utils.tensorboard.SummaryWri... | [((960, 985), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (983, 985), False, 'import argparse\n'), ((3434, 3449), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3447, 3449), False, 'import torch\n'), ((4276, 4291), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (4289, 4291), False... |
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
# Path to the SQLite database file
SQLALCHEMY_DATABASE_URL = 'sqlite:///./sql_app.db'
# URL to the PostgreSQL database
# SQLALCHEMY_DATABASE_URL = 'postgresql://user:password@postgresser... | [
"sqlalchemy.create_engine",
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.orm.sessionmaker"
] | [((421, 507), 'sqlalchemy.create_engine', 'create_engine', (['SQLALCHEMY_DATABASE_URL'], {'connect_args': "{'check_same_thread': False}"}), "(SQLALCHEMY_DATABASE_URL, connect_args={'check_same_thread': \n False})\n", (434, 507), False, 'from sqlalchemy import create_engine\n'), ((546, 606), 'sqlalchemy.orm.sessionma... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
import json
import pymysql
# import sqlalchemy
# from sqlalchemy.ext.declarative import declarative_base
# from sqlalchemy.or... | [
"pymysql.connect"
] | [((1024, 1126), 'pymysql.connect', 'pymysql.connect', ([], {'host': '"""127.0.0.1"""', 'port': '(3306)', 'user': '"""root"""', 'password': '"""<PASSWORD>"""', 'db': '"""spiderwork"""'}), "(host='127.0.0.1', port=3306, user='root', password=\n '<PASSWORD>', db='spiderwork')\n", (1039, 1126), False, 'import pymysql\n'... |
# -*- coding: utf-8 -*-
# @Time : 2019/4/18 14:24
# @Author : MrCocoaCat
# @Email : <EMAIL>
# @File : OVSDB_vsctl.py
from ryu.lib.ovs import vsctl
# 判断格式是否正确
#
# vsctl.valid_ovsdb_addr(OVSDB_ADDR)
OVSDB_ADDR = 'tcp:192.168.83.137:6640'
ovs_vsctl = vsctl.VSCtl(OVSDB_ADDR)
command = vsctl.VSCtlCommand(comm... | [
"ryu.lib.ovs.vsctl.VSCtl",
"ryu.lib.ovs.vsctl.VSCtlCommand"
] | [((263, 286), 'ryu.lib.ovs.vsctl.VSCtl', 'vsctl.VSCtl', (['OVSDB_ADDR'], {}), '(OVSDB_ADDR)\n', (274, 286), False, 'from ryu.lib.ovs import vsctl\n'), ((297, 346), 'ryu.lib.ovs.vsctl.VSCtlCommand', 'vsctl.VSCtlCommand', ([], {'command': '"""add-br"""', 'args': "['s1']"}), "(command='add-br', args=['s1'])\n", (315, 346)... |
## Imports and Setup
print("Importing")
# Suppress all the deprecated warnings!
from warnings import simplefilter
simplefilter(action='ignore', category=FutureWarning)
import argparse
import numpy as np
import tensorflow as tf
from time import time
from data_loader import load_data, load_npz, load_random, load_ogb, ... | [
"analysis.plot_accs",
"os.mkdir",
"numpy.random.seed",
"argparse.ArgumentParser",
"tensorflow.logging.set_verbosity",
"data_loader.load_data",
"warnings.simplefilter",
"data_loader.load_random",
"tensorflow.set_random_seed",
"data_loader.load_npz",
"train.train",
"analysis.plot_losses",
"ana... | [((116, 169), 'warnings.simplefilter', 'simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (128, 169), False, 'from warnings import simplefilter\n'), ((627, 669), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.ERROR... |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\venues\cafe_venue\cafe_reader_situation.py
# Compiled at: 2016-08-29 23:13:06
# Size of source mod 2... | [
"venues.cafe_venue.cafe_situations_common._OrderCoffeeState.TunableFactory",
"sims4.tuning.instances.lock_instance_tunables",
"services.current_zone",
"random.choice",
"services.definition_manager",
"situations.situation_complex.TunableSituationJobAndRoleState",
"situations.situation_complex.SituationSt... | [((4928, 5119), 'sims4.tuning.instances.lock_instance_tunables', 'lock_instance_tunables', (['CafeReaderSituation'], {'exclusivity': 'BouncerExclusivityCategory.NORMAL', 'creation_ui_option': 'SituationCreationUIOption.NOT_AVAILABLE', '_implies_greeted_status': '(False)'}), '(CafeReaderSituation, exclusivity=\n Boun... |
# coding=utf-8
# Author: <NAME> & <NAME>
# Date: Jan 06, 2021
#
# Description: Parse Epilepsy Foundation Forums and extract dictionary matches
#
import os
import sys
#
#include_path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 'include'))
include_path = '/nfs/nfs7/home/rionbr/myaura/i... | [
"pandas.DataFrame",
"sys.path.insert",
"db_init.connectToMySQL",
"load_dictionary.build_term_parser",
"pandas.set_option",
"pandas.to_datetime",
"utils.ensurePathExists",
"termdictparser.Sentences",
"pandas.read_sql",
"load_dictionary.load_dictionary"
] | [((328, 360), 'sys.path.insert', 'sys.path.insert', (['(0)', 'include_path'], {}), '(0, include_path)\n', (343, 360), False, 'import sys\n'), ((383, 421), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(100)'], {}), "('display.max_rows', 100)\n", (396, 421), True, 'import pandas as pd\n'), ((422, 46... |
"""django_maps URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | [
"django.conf.urls.include",
"django.conf.urls.url"
] | [((785, 816), 'django.conf.urls.url', 'url', (['"""^admin/"""', 'admin.site.urls'], {}), "('^admin/', admin.site.urls)\n", (788, 816), False, 'from django.conf.urls import url, include\n'), ((823, 847), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.landing'], {}), "('^$', views.landing)\n", (826, 847), False, 'fr... |
from databricks_dbapi import hive
def test_workspace(host, http_path_workspace, token_workspace):
connection = hive.connect(host=host, http_path=http_path_workspace, token=token_workspace)
cursor = connection.cursor()
print(cursor)
| [
"databricks_dbapi.hive.connect"
] | [((117, 194), 'databricks_dbapi.hive.connect', 'hive.connect', ([], {'host': 'host', 'http_path': 'http_path_workspace', 'token': 'token_workspace'}), '(host=host, http_path=http_path_workspace, token=token_workspace)\n', (129, 194), False, 'from databricks_dbapi import hive\n')] |
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
import matplotlib.pyplot as plt
import seaborn as sns
# Load dataset
breast_cancer_data = load_breast_cancer()
# View dataset
# print(breast_cancer_data.data[0])
# pr... | [
"matplotlib.pyplot.title",
"seaborn.set_style",
"seaborn.lineplot",
"matplotlib.pyplot.show",
"sklearn.model_selection.train_test_split",
"sklearn.datasets.load_breast_cancer",
"sklearn.neighbors.KNeighborsClassifier",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"seaborn.set_context"
] | [((243, 263), 'sklearn.datasets.load_breast_cancer', 'load_breast_cancer', ([], {}), '()\n', (261, 263), False, 'from sklearn.datasets import load_breast_cancer\n'), ((538, 641), 'sklearn.model_selection.train_test_split', 'train_test_split', (['breast_cancer_data.data', 'breast_cancer_data.target'], {'test_size': '(0.... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
dump Type 2 Charstring
"""
import os, sys, re
import argparse
from fontTools.ttLib import TTFont
class ProgramDumper(object):
def __init__(self, in_font):
self.in_font = in_font
# https://github.com/googlei18n/compreffor/blob/master/src/python/compr... | [
"fontTools.ttLib.TTFont",
"argparse.ArgumentParser"
] | [((926, 970), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (949, 970), False, 'import argparse\n'), ((381, 401), 'fontTools.ttLib.TTFont', 'TTFont', (['self.in_font'], {}), '(self.in_font)\n', (387, 401), False, 'from fontTools.ttLib import TTFont\n'... |
import optparse
from jira_pert.jira_wrapper import JiraAPIv2
from jira_pert.diagram.pert_diagram import PertDiagram
from jira_pert.model.pert_graph import PertGraph
def parse_arguments():
parser = optparse.OptionParser()
parser.add_option('-k', '--key',
action="store", dest="key",
... | [
"jira_pert.model.pert_graph.PertGraph",
"jira_pert.jira_wrapper.JiraAPIv2",
"jira_pert.diagram.pert_diagram.PertDiagram",
"optparse.OptionParser"
] | [((204, 227), 'optparse.OptionParser', 'optparse.OptionParser', ([], {}), '()\n', (225, 227), False, 'import optparse\n'), ((565, 576), 'jira_pert.jira_wrapper.JiraAPIv2', 'JiraAPIv2', ([], {}), '()\n', (574, 576), False, 'from jira_pert.jira_wrapper import JiraAPIv2\n'), ((643, 662), 'jira_pert.model.pert_graph.PertGr... |
from functools import partial
import numpy as np
import scarlet
from numpy.testing import assert_almost_equal, assert_equal
class TestWavelet(object):
def get_psfs(self, sigmas, boxsize):
psf = scarlet.GaussianPSF(sigmas, boxsize=boxsize)
return psf.get_model()
"""Test the wavelet object"""
... | [
"scarlet.GaussianPSF",
"scarlet.Starlet.from_coefficients",
"numpy.testing.assert_almost_equal",
"scarlet.Starlet.from_image",
"numpy.testing.assert_equal"
] | [((209, 253), 'scarlet.GaussianPSF', 'scarlet.GaussianPSF', (['sigmas'], {'boxsize': 'boxsize'}), '(sigmas, boxsize=boxsize)\n', (228, 253), False, 'import scarlet\n'), ((426, 467), 'scarlet.Starlet.from_image', 'scarlet.Starlet.from_image', (['psf'], {'scales': '(3)'}), '(psf, scales=3)\n', (452, 467), False, 'import ... |
from flask import Flask, render_template, request, session, redirect, url_for, flash, g
from flask_sqlalchemy import SQLAlchemy
import secrets,os
base_dir = os.path.abspath(os.path.dirname(__file__))
db_file = os.path.join(base_dir, "db.sqlite")
app = Flask(__name__)
app.secret_key = secrets.token_bytes(16)
app.con... | [
"secrets.token_bytes",
"os.path.dirname",
"flask.Flask",
"flask.session.get",
"flask_sqlalchemy.SQLAlchemy",
"app.models.User.query.filter_by",
"os.path.join"
] | [((213, 248), 'os.path.join', 'os.path.join', (['base_dir', '"""db.sqlite"""'], {}), "(base_dir, 'db.sqlite')\n", (225, 248), False, 'import secrets, os\n'), ((256, 271), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (261, 271), False, 'from flask import Flask, render_template, request, session, redirect,... |
#!/usr/bin/env python
# Copyright 2015-2016 <NAME> and the splitflap contributors
#
# 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... | [
"os.path.isdir",
"os.path.join",
"os.makedirs",
"logging.basicConfig"
] | [((778, 818), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (797, 818), False, 'import logging\n'), ((836, 857), 'os.path.join', 'os.path.join', (['"""build"""'], {}), "('build')\n", (848, 857), False, 'import os\n'), ((868, 894), 'os.makedirs', 'os.makedirs'... |
from __future__ import absolute_import
import eduid_userdb
from eduid_userdb.testing import MongoTestCase, MOCKED_USER_STANDARD as M
from eduid_userdb.locked_identity import LockedIdentityList, LockedIdentityNin
from eduid_userdb.exceptions import MultipleUsersReturned, UserDoesNotExist, EduIDUserDBError
from bson imp... | [
"eduid_userdb.locked_identity.LockedIdentityList",
"eduid_am.consistency_checks.unverify_duplicates",
"eduid_userdb.locked_identity.LockedIdentityNin",
"eduid_am.consistency_checks.check_locked_identity",
"eduid_userdb.User",
"bson.ObjectId"
] | [((1412, 1422), 'bson.ObjectId', 'ObjectId', ([], {}), '()\n', (1420, 1422), False, 'from bson import ObjectId\n'), ((1753, 1789), 'bson.ObjectId', 'ObjectId', (['"""901234567890123456789012"""'], {}), "('901234567890123456789012')\n", (1761, 1789), False, 'from bson import ObjectId\n'), ((2145, 2196), 'eduid_am.consis... |
#coding=utf8
import re,urllib
try:
import urllib.request
except:
pass
from bs4 import BeautifulSoup
import sqlite3
import datetime
# 设置要抓取的总页数
ALL_PAGE_NUMBER = 21
# 保存到本地Sqlite
def saveToSqlite(lesson_info):
# 获取lesson_info字典中的信息
name = lesson_info['name']
link = lesson_info['link']
des = lesson_i... | [
"bs4.BeautifulSoup",
"sqlite3.connect",
"datetime.datetime.now"
] | [((462, 490), 'sqlite3.connect', 'sqlite3.connect', (['"""lesson.db"""'], {}), "('lesson.db')\n", (477, 490), False, 'import sqlite3\n'), ((2666, 2689), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (2687, 2689), False, 'import datetime\n'), ((2720, 2743), 'datetime.datetime.now', 'datetime.dateti... |
from plume.tree import DecisionTreeClassifier
from plume.knn import KNeighborClassifier
from plume.ensemble import AdaBoostClassifier, BaggingClassifier, \
RandomForestsClassifier
import numpy as np
def test_adaboost():
clf = AdaBoostClassifier(DecisionTreeClassifier)
train_x = np.array([
[1, 1, 0]... | [
"numpy.array",
"plume.ensemble.BaggingClassifier",
"plume.ensemble.AdaBoostClassifier",
"plume.ensemble.RandomForestsClassifier",
"plume.knn.KNeighborClassifier"
] | [((235, 277), 'plume.ensemble.AdaBoostClassifier', 'AdaBoostClassifier', (['DecisionTreeClassifier'], {}), '(DecisionTreeClassifier)\n', (253, 277), False, 'from plume.ensemble import AdaBoostClassifier, BaggingClassifier, RandomForestsClassifier\n'), ((292, 357), 'numpy.array', 'np.array', (['[[1, 1, 0], [0, 1, 0], [1... |
# Copyright (c) 2019. Partners HealthCare, Harvard Medical School’s
# Department of Biomedical Informatics, <NAME>
#
# Developed by <NAME> and <NAME>, based on contributions by:
# <NAME>, <NAME>,
# <NAME>, <NAME> and other members of Division of Genetics,
# Brigham and Women's Hospital
#
# Licensed under the Apa... | [
"io.BytesIO",
"array.array"
] | [((1531, 1547), 'array.array', 'array.array', (['"""Q"""'], {}), "('Q')\n", (1542, 1547), False, 'import array, bz2\n'), ((1657, 1685), 'array.array', 'array.array', (['self.mArrayType'], {}), '(self.mArrayType)\n', (1668, 1685), False, 'import array, bz2\n'), ((1825, 1834), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (... |
#!d:\projects\123recipes\recipes\scripts\python.exe
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| [
"django.core.management.execute_from_command_line"
] | [((119, 157), 'django.core.management.execute_from_command_line', 'management.execute_from_command_line', ([], {}), '()\n', (155, 157), False, 'from django.core import management\n')] |
"""CuLE (CUda Learning Environment module)
This module provides access to several RL environments that generate data
on the CPU or GPU.
"""
import atari_py
import gym
import os
import site
from torchcule_atari import AtariRom
# def get_rom(roms_path, env_name):
def get_rom(env_name):
# roms = [os.path.splitext(... | [
"atari_py.get_game_path",
"atari_py.list_games",
"os.path.exists"
] | [((390, 411), 'atari_py.list_games', 'atari_py.list_games', ([], {}), '()\n', (409, 411), False, 'import atari_py\n'), ((556, 583), 'atari_py.get_game_path', 'atari_py.get_game_path', (['rom'], {}), '(rom)\n', (578, 583), False, 'import atari_py\n'), ((928, 953), 'os.path.exists', 'os.path.exists', (['game_path'], {}),... |
#!/usr/bin/env python
import copy
from collections import namedtuple
from proxy import ReadOnlyProxy
from twisted.internet import reactor
from twisted.internet.task import LoopingCall
Activity = namedtuple("Activity", ["activity", "frequency"])
AuxData = namedtuple("AuxData", ["data", "owner", "writable"])
class Mes... | [
"copy.deepcopy",
"proxy.ReadOnlyProxy",
"twisted.internet.reactor.run",
"collections.namedtuple",
"twisted.internet.reactor.stop",
"twisted.internet.task.LoopingCall",
"twisted.internet.reactor.callLater"
] | [((197, 246), 'collections.namedtuple', 'namedtuple', (['"""Activity"""', "['activity', 'frequency']"], {}), "('Activity', ['activity', 'frequency'])\n", (207, 246), False, 'from collections import namedtuple\n'), ((257, 309), 'collections.namedtuple', 'namedtuple', (['"""AuxData"""', "['data', 'owner', 'writable']"], ... |
import numpy as np
# array A / B
arrayA, arrayB = (np.array([int(i) for i in input().split()]) for _ in range(2))
# produ interno
# produ externo
print('{}\n{}'.format(np.inner(arrayA, arrayB), np.outer(arrayA, arrayB)))
| [
"numpy.outer",
"numpy.inner"
] | [((169, 193), 'numpy.inner', 'np.inner', (['arrayA', 'arrayB'], {}), '(arrayA, arrayB)\n', (177, 193), True, 'import numpy as np\n'), ((195, 219), 'numpy.outer', 'np.outer', (['arrayA', 'arrayB'], {}), '(arrayA, arrayB)\n', (203, 219), True, 'import numpy as np\n')] |
#!/usr/bin/python3
#
# privacy_bot
#
# Privacy bot interprets WireGuard output and generates a list of connected clients
# That haven't performed a handshake in the last 2 minutes. Privacy bot then re-peers these
# clients with the WireGuard server to remove the known IP Address from the server's memory.
import privac... | [
"os.remove",
"privacybot.get_repeer_list",
"os.system",
"wgm_db.connect"
] | [((1792, 1817), 'os.remove', 'os.remove', (['wg_output_path'], {}), '(wg_output_path)\n', (1801, 1817), False, 'import os\n'), ((629, 645), 'wgm_db.connect', 'wgm_db.connect', ([], {}), '()\n', (643, 645), False, 'import wgm_db\n'), ((1170, 1257), 'os.system', 'os.system', (['(\'ssh root@%s "sudo wg" > %s\' % (server[\... |
# statistics.py
# author: <NAME>
# description: contains functions that give various statistical information for
# analysis of motifs found within a genetic sequence
from math import *
from compareTool import *
from scipy import stats,interpolate
import statistics
from multiprocessing import Pool
def mean(array):
... | [
"scipy.stats.combine_pvalues",
"scipy.stats.zscore",
"scipy.interpolate.splev",
"scipy.interpolate.splrep",
"scipy.stats.binom_test"
] | [((9522, 9569), 'scipy.stats.zscore', 'stats.zscore', (['[seq_matched[x] for x in matches]'], {}), '([seq_matched[x] for x in matches])\n', (9534, 9569), False, 'from scipy import stats, interpolate\n'), ((10805, 10852), 'scipy.stats.zscore', 'stats.zscore', (['[seq_matched[x] for x in matches]'], {}), '([seq_matched[x... |
# !/usr/bin/env python
# -*- coding: UTF-8 -*-
from typing import Optional
from pandas import DataFrame
from base import BaseObject
from datagit.graph.dmo.util import GraphNodeDefGenerator
from datagit.graph.dmo.util import GraphNodeIdGenerator
from datagit.graph.dmo.util import GraphTextSplitter
from datagit.graph... | [
"datagit.graph.dmo.util.GraphNodeIdGenerator",
"datamongo.CendantRecordParser",
"base.BaseObject.__init__",
"datagit.graph.dmo.util.GraphNodeDefGenerator",
"datagit.graph.dmo.util.GraphTextSplitter.split_text",
"datagit.graph.dmo.util.SocialNodeSizeGenerator"
] | [((2158, 2193), 'base.BaseObject.__init__', 'BaseObject.__init__', (['self', '__name__'], {}), '(self, __name__)\n', (2177, 2193), False, 'from base import BaseObject\n'), ((2354, 2398), 'datamongo.CendantRecordParser', 'CendantRecordParser', ([], {'is_debug': 'self._is_debug'}), '(is_debug=self._is_debug)\n', (2373, 2... |
"""5"""
import torch
from torch.autograd import Variable
import matplotlib.pyplot as plt
import numpy as np
def train_func(model, epochs, data_loader, loss_func, optimizer):
dataset_size = len(data_loader.dataset)
batch_size = data_loader.batch_size
batch_acc_list = []
batch_record = 1
... | [
"torch.max",
"matplotlib.pyplot.show",
"torch.sum"
] | [((1669, 1679), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1677, 1679), True, 'import matplotlib.pyplot as plt\n'), ((911, 937), 'torch.max', 'torch.max', (['outputs.data', '(1)'], {}), '(outputs.data, 1)\n', (920, 937), False, 'import torch\n'), ((1123, 1154), 'torch.sum', 'torch.sum', (['(preds == label... |
#!python3
#import stuff so we find everything
import sys
sys.path.append('../../')
import piloet.piloet as piloet
import piloet.task as task
# tasks here
# startup everything
pilot = piloet.Piloet()
#add tasks
#run!
pilot.run()
| [
"sys.path.append",
"piloet.piloet.Piloet"
] | [((60, 85), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (75, 85), False, 'import sys\n'), ((201, 216), 'piloet.piloet.Piloet', 'piloet.Piloet', ([], {}), '()\n', (214, 216), True, 'import piloet.piloet as piloet\n')] |
from django.forms import ModelForm
from django import forms
from crispy_forms.layout import Layout, Field, HTML
from models import RequestUrlBase, ToolVersion, SupportedResTypes, ToolIcon,\
SupportedSharingStatus, AppHomePageUrl
from hs_core.forms import BaseFormHelper
from utils import get_SupportedResTypes_choi... | [
"django.forms.CheckboxSelectMultiple",
"crispy_forms.layout.Field",
"django.forms.URLField",
"utils.get_SupportedResTypes_choices",
"django.forms.MultipleChoiceField",
"django.forms.CharField"
] | [((1724, 1771), 'django.forms.URLField', 'forms.URLField', ([], {'max_length': '(1024)', 'required': '(False)'}), '(max_length=1024, required=False)\n', (1738, 1771), False, 'from django import forms\n'), ((4542, 4573), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(128)'}), '(max_length=128)\n', (4... |
from flask import Flask
app = Flask(__name__)
app.config['SECRET_KEY'] = "your-secret-key"
from routes import *
if __name__ == '__main__':
app.run(debug=True)
| [
"flask.Flask"
] | [((31, 46), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (36, 46), False, 'from flask import Flask\n')] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import platform
__author__ = "<NAME>"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__license__ = ""
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__credits__ = [] # check amplify/agent/main.py for the actual credits list
# Detect old Centos6... | [
"amplify.__file__.split",
"gevent.monkey.patch_all",
"sys.path.insert",
"amplify.agent.main.run",
"platform.linux_distribution"
] | [((376, 433), 'platform.linux_distribution', 'platform.linux_distribution', ([], {'full_distribution_name': '(False)'}), '(full_distribution_name=False)\n', (403, 433), False, 'import platform\n'), ((816, 848), 'sys.path.insert', 'sys.path.insert', (['(0)', 'amplify_path'], {}), '(0, amplify_path)\n', (831, 848), False... |
import json
from typing import Mapping
import pytest
from unittest.mock import MagicMock, mock_open, patch
from reconcile.queries import UserFilter
from reconcile.utils.secret_reader import SecretReader
from tools.cli_commands.gpg_encrypt import (
ArgumentException,
GPGEncryptCommand,
GPGEncryptCommandData... | [
"unittest.mock.MagicMock",
"json.dumps",
"tools.cli_commands.gpg_encrypt.GPGEncryptCommand.create",
"unittest.mock.patch",
"pytest.raises",
"reconcile.queries.UserFilter",
"tools.cli_commands.gpg_encrypt.GPGEncryptCommandData"
] | [((735, 775), 'unittest.mock.patch', 'patch', (['"""reconcile.utils.gpg.gpg_encrypt"""'], {}), "('reconcile.utils.gpg.gpg_encrypt')\n", (740, 775), False, 'from unittest.mock import MagicMock, mock_open, patch\n'), ((777, 816), 'unittest.mock.patch', 'patch', (['"""reconcile.queries.get_users_by"""'], {}), "('reconcile... |
import gevent
from gevent import Greenlet
class YoSoyUnGreenlet(Greenlet):
def __init__(self, message, n):
Greenlet.__init__(self)
self.message = message
self.n = n
def _run(self):
print(self.message)
gevent.sleep(self.n)
yo = YoSoyUnGreenlet("Hi there!", 3)
yo.star... | [
"gevent.Greenlet.__init__",
"gevent.sleep"
] | [((122, 145), 'gevent.Greenlet.__init__', 'Greenlet.__init__', (['self'], {}), '(self)\n', (139, 145), False, 'from gevent import Greenlet\n'), ((253, 273), 'gevent.sleep', 'gevent.sleep', (['self.n'], {}), '(self.n)\n', (265, 273), False, 'import gevent\n')] |
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the MGTAXA package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
"""Some support for logging"""
import logging
def ... | [
"logging.basicConfig"
] | [((638, 891), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'level', 'datefmt': '"""%y-%m-%d %H:%M:%S"""', 'filemode': '"""a"""', 'format': "('%(asctime)s [%(levelname)5.5s] pid:%(process)-5s\\t' +\n 'thread:%(threadName)10.10s\\t' +\n '%(module)20.20s.:%(funcName)-12.12s:%(lineno)-5s:\\t' + '%(mes... |
# -*- coding: utf-8 -*-
"""Specification for Generation of training data sets"""
import os
import pathlib
import shutil
from sets.training_sets import (
TrainingSets,
XML_NS
)
from cv2 import (
cv2
)
import pytest
import numpy as np
import lxml.etree as etree
RES_ROOT = os.path.join('tests', 'resources'... | [
"cv2.cv2.putText",
"sets.training_sets.TrainingSets",
"numpy.random.rand",
"os.path.dirname",
"pytest.fixture",
"os.path.exists",
"pathlib.Path",
"shutil.copyfile",
"sets.training_sets.XML_NS.items",
"os.path.join"
] | [((287, 321), 'os.path.join', 'os.path.join', (['"""tests"""', '"""resources"""'], {}), "('tests', 'resources')\n", (299, 321), False, 'import os\n'), ((1869, 1908), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""fixture_alto_tif"""'}), "(name='fixture_alto_tif')\n", (1883, 1908), False, 'import pytest\n'), ((34... |
from __future__ import annotations
from base64 import b64decode
from copy import deepcopy
from typing import Any, TypedDict
from boto3.dynamodb.types import TypeDeserializer
AttributeValueMap = dict[str, dict[str, Any]]
class Identity(TypedDict, total=False):
PrincipalId: str
Type: str
class StreamRecord... | [
"copy.deepcopy",
"base64.b64decode"
] | [((1519, 1540), 'copy.deepcopy', 'deepcopy', (['self.__keys'], {}), '(self.__keys)\n', (1527, 1540), False, 'from copy import deepcopy\n'), ((1835, 1861), 'copy.deepcopy', 'deepcopy', (['self.__new_image'], {}), '(self.__new_image)\n', (1843, 1861), False, 'from copy import deepcopy\n'), ((2156, 2182), 'copy.deepcopy',... |
# -*- coding: utf-8 -*-
from vplanet import Quantity
import matplotlib
import matplotlib.pyplot
from matplotlib.figure import Figure
from matplotlib.axes import Axes
import astropy.units as u
def _get_array_info(array, max_label_length=40):
if hasattr(array, "unit") and hasattr(array, "tags"):
if array.un... | [
"vplanet.Quantity",
"vplanet.quantity_support.quantity_support",
"astropy.units.Unit"
] | [((3463, 3481), 'vplanet.quantity_support.quantity_support', 'quantity_support', ([], {}), '()\n', (3479, 3481), False, 'from vplanet.quantity_support import quantity_support\n'), ((4490, 4501), 'vplanet.Quantity', 'Quantity', (['x'], {}), '(x)\n', (4498, 4501), False, 'from vplanet import Quantity\n'), ((4503, 4514), ... |
# coding=utf-8
# Copyright (c) 2019 <NAME>
# MIT License
"""
Data loading functions for Token level Classification with BERT
Reads data in the CONLL format.
"""
import os
import csv
import copy
import json
import logging
import torch
from torch.utils.data import DataLoader, RandomSampler, SequentialSampler
from torch... | [
"copy.deepcopy",
"csv.reader",
"os.makedirs",
"torch.utils.data.RandomSampler",
"torch.utils.data.DataLoader",
"torch.load",
"os.path.exists",
"torch.nn.CrossEntropyLoss",
"logging.getLogger",
"torch.save",
"os.path.isfile",
"torch.utils.data.SequentialSampler",
"torch.utils.data.TensorDatas... | [((432, 482), 'typing.TypeVar', 'TypeVar', (['"""InputExampleTCAttribute"""', 'str', 'List[str]'], {}), "('InputExampleTCAttribute', str, List[str])\n", (439, 482), False, 'from typing import Tuple, List, Dict, Sequence, TypeVar, Any\n'), ((493, 520), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__na... |
#!/usr/bin/pypy
import sys
def mult(m1, m2):
'''minimal-cost matrix product m1 * m2'''
return [ [ min(m1[i][k] + m2[k][j] for k in range(n)) for j in range(n) ] for i in range(n) ]
n, m = map(int, sys.stdin.readline().split())
c = [ [ list(map(int, sys.stdin.readline().split())) for _ in range(n) ] ]
# matrix po... | [
"sys.stdin.readline",
"sys.exit"
] | [((588, 599), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (596, 599), False, 'import sys\n'), ((203, 223), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (221, 223), False, 'import sys\n'), ((255, 275), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (273, 275), False, 'import sys\n')] |
# -*- coding: utf-8 -*-
import numpy as np
def bou(z):
#razones adimensionales
a=4.6 #dimensiones zapata
b=14. #dimensiones zapata
q=1000./(a*b) #carga
m=a/z #adimensional
n=b/z #adimensional
#solución de la ecuación de ... | [
"numpy.arcsin"
] | [((441, 538), 'numpy.arcsin', 'np.arcsin', (['(2 * m * n * (m ** 2 + n ** 2 + 1) ** 0.5 / (m ** 2 + n ** 2 + 1 + m ** 2 *\n n ** 2))'], {}), '(2 * m * n * (m ** 2 + n ** 2 + 1) ** 0.5 / (m ** 2 + n ** 2 + 1 +\n m ** 2 * n ** 2))\n', (450, 538), True, 'import numpy as np\n')] |
from enum import Enum, IntEnum
from pytest import raises
from typing import NewType
from datetime import date, time, datetime
from squema import Squema, Config, UNSET
NewInt = NewType("NewInt", int)
Choice = Enum("Choice", ["yes", "no"])
class Entity(Squema):
boolean: bool
class SampleModel(Squema):
numb... | [
"datetime.time",
"enum.Enum",
"datetime.date",
"datetime.datetime",
"enum.IntEnum",
"pytest.raises",
"squema.Config",
"typing.NewType"
] | [((179, 201), 'typing.NewType', 'NewType', (['"""NewInt"""', 'int'], {}), "('NewInt', int)\n", (186, 201), False, 'from typing import NewType\n'), ((211, 240), 'enum.Enum', 'Enum', (['"""Choice"""', "['yes', 'no']"], {}), "('Choice', ['yes', 'no'])\n", (215, 240), False, 'from enum import Enum, IntEnum\n'), ((2466, 250... |
#!/usr/bin/python3
# -*- coding: utf8 -*-
# Copyright (c) 2020 Baidu, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | [
"json.dumps",
"QCompute.QPlatform.Error.ArgumentError",
"QCompute.QPlatform.QRegPool.QRegPool",
"pathlib.Path",
"os.close",
"QCompute.QPlatform.CircuitTools.QEnvToProtobuf",
"QCompute.Define.Utils.loadPythonModule",
"QCompute.QPlatform.Utilities.destoryObject",
"copy.deepcopy",
"QCompute.OpenConve... | [((2569, 2583), 'QCompute.QPlatform.QRegPool.QRegPool', 'QRegPool', (['self'], {}), '(self)\n', (2577, 2583), False, 'from QCompute.QPlatform.QRegPool import QRegPool\n'), ((2609, 2633), 'QCompute.QPlatform.ProcedureParameterPool.ProcedureParameterPool', 'ProcedureParameterPool', ([], {}), '()\n', (2631, 2633), False, ... |
from flask import Flask,render_template,url_for,request
from database import post,get_data
app = Flask(__name__)
@app.route('/' , methods=['GET','POST'])
def home():
if request.method == 'POST':
name = request.form.get('name')
msg = request.form.get('message')
post(name,msg)
database ... | [
"flask.request.form.get",
"database.get_data",
"flask.Flask",
"database.post",
"flask.render_template"
] | [((98, 113), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (103, 113), False, 'from flask import Flask, render_template, url_for, request\n'), ((322, 332), 'database.get_data', 'get_data', ([], {}), '()\n', (330, 332), False, 'from database import post, get_data\n'), ((344, 391), 'flask.render_template', ... |
# Aprendizaje Automático: Proyecto Final
# Clasificación de símbolos Devanagari
# <NAME>
# <NAME>
# png_to_np.py
# Lee los datos en formato .png y los escribe como arrays de numpy (sin marco)
import glob
import numpy as np
import matplotlib.pyplot as plt
# Paths
CHARACTERS='datos/characters.txt'
TRAIN_IMG_DIR='dato... | [
"numpy.savez_compressed",
"numpy.array",
"numpy.reshape",
"glob.glob",
"matplotlib.pyplot.imread"
] | [((1383, 1431), 'numpy.reshape', 'np.reshape', (['train_mat', '(train_mat.shape[0], 784)'], {}), '(train_mat, (train_mat.shape[0], 784))\n', (1393, 1431), True, 'import numpy as np\n'), ((1702, 1748), 'numpy.reshape', 'np.reshape', (['test_mat', '(test_mat.shape[0], 784)'], {}), '(test_mat, (test_mat.shape[0], 784))\n'... |
from mandaw import *
from mandaw.prefabs.platformer_controller import PlatformerController2D
mandaw = Mandaw(title = "Platformer!", width = 800, height = 600, bg_color = color["cyan"])
player = PlatformerController2D(mandaw, x = 0, y = 0, centered = True)
ground = Entity(mandaw, width = 5000, height = 100, x = 0, y ... | [
"mandaw.prefabs.platformer_controller.PlatformerController2D"
] | [((196, 251), 'mandaw.prefabs.platformer_controller.PlatformerController2D', 'PlatformerController2D', (['mandaw'], {'x': '(0)', 'y': '(0)', 'centered': '(True)'}), '(mandaw, x=0, y=0, centered=True)\n', (218, 251), False, 'from mandaw.prefabs.platformer_controller import PlatformerController2D\n')] |
import os
import sys
import torch
# import torchvision
# import torchvision.transforms as transforms
from torch.utils.data import Dataset
sys.path.append(os.path.abspath('.'))
# from utils.utils import stringify
is_cuda = torch.cuda.is_available()
device = torch.device("cuda" if is_cuda else "cpu")
class dataset(... | [
"os.path.abspath",
"torch.cuda.is_available",
"torch.device"
] | [((226, 251), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (249, 251), False, 'import torch\n'), ((261, 303), 'torch.device', 'torch.device', (["('cuda' if is_cuda else 'cpu')"], {}), "('cuda' if is_cuda else 'cpu')\n", (273, 303), False, 'import torch\n'), ((156, 176), 'os.path.abspath', 'os... |
#!/usr/bin/env python
import rospy
import time
from std_msgs.msg import String, UInt8
from roah_rsbb_comm_ros.msg import Benchmark, BenchmarkState
from geometry_msgs.msg import Pose2D
import std_srvs.srv
class Comms():
def __init__(self):
self.currentGoal = 0
self.lastReached = 0
rospy.Subscriber('/roah_rs... | [
"rospy.Subscriber",
"rospy.ServiceProxy",
"rospy.Publisher",
"time.sleep",
"rospy.loginfo",
"rospy.init_node",
"rospy.spin"
] | [((2430, 2480), 'rospy.init_node', 'rospy.init_node', (['"""fbm2_controller"""'], {'anonymous': '(True)'}), "('fbm2_controller', anonymous=True)\n", (2445, 2480), False, 'import rospy\n'), ((2482, 2523), 'rospy.loginfo', 'rospy.loginfo', (['"""fbm2_controller: Started"""'], {}), "('fbm2_controller: Started')\n", (2495,... |
import unittest
import os.path
from tableaudocumentapi import Datasource, Workbook
TEST_ASSET_DIR = os.path.join(
os.path.dirname(__file__),
'assets'
)
EPHEMERAL_FIELD_FILE = os.path.join(
TEST_ASSET_DIR,
'ephemeral_field.twb'
)
SHAPES_FILE = os.path.join(
TEST_ASSET_DIR,
'shapes_test.twb'
)
... | [
"tableaudocumentapi.Workbook"
] | [((509, 539), 'tableaudocumentapi.Workbook', 'Workbook', (['EPHEMERAL_FIELD_FILE'], {}), '(EPHEMERAL_FIELD_FILE)\n', (517, 539), False, 'from tableaudocumentapi import Datasource, Workbook\n'), ((653, 674), 'tableaudocumentapi.Workbook', 'Workbook', (['SHAPES_FILE'], {}), '(SHAPES_FILE)\n', (661, 674), False, 'from tab... |
from abc import ABC, abstractmethod
from typing import Union
import numpy as np
import pandas as pd
from sklearn import preprocessing
from sklearn.base import BaseEstimator
from carla.data.api import Data
class MLModel(ABC):
"""
Abstract class to implement custom black-box-model for a given dataset with enc... | [
"sklearn.preprocessing.MinMaxScaler",
"sklearn.preprocessing.OneHotEncoder"
] | [((1304, 1332), 'sklearn.preprocessing.MinMaxScaler', 'preprocessing.MinMaxScaler', ([], {}), '()\n', (1330, 1332), False, 'from sklearn import preprocessing\n'), ((1574, 1639), 'sklearn.preprocessing.OneHotEncoder', 'preprocessing.OneHotEncoder', ([], {'handle_unknown': '"""error"""', 'sparse': '(False)'}), "(handle_u... |
from menu_item import MenuItem
menu_item1 = MenuItem('Sandwich', 5)
menu_item2 = MenuItem('Chocolate Cake', 4)
menu_item3 = MenuItem('Coffee', 3)
menu_item4 = MenuItem('Orange Juice', 2)
menu_items = [menu_item1, menu_item2, menu_item3, menu_item4]
# Define the index variable and assign 0 to it
index = 0
for menu_i... | [
"menu_item.MenuItem"
] | [((45, 68), 'menu_item.MenuItem', 'MenuItem', (['"""Sandwich"""', '(5)'], {}), "('Sandwich', 5)\n", (53, 68), False, 'from menu_item import MenuItem\n'), ((82, 111), 'menu_item.MenuItem', 'MenuItem', (['"""Chocolate Cake"""', '(4)'], {}), "('Chocolate Cake', 4)\n", (90, 111), False, 'from menu_item import MenuItem\n'),... |
import unittest
import numpy as np
from eoflow.models.losses import CategoricalCrossEntropy, CategoricalFocalLoss
from eoflow.models.losses import JaccardDistanceLoss, TanimotoDistanceLoss
class TestLosses(unittest.TestCase):
def test_shapes(self):
for loss_fn in [CategoricalFocalLoss(from_logits=True), ... | [
"unittest.main",
"numpy.stack",
"eoflow.models.losses.CategoricalFocalLoss",
"eoflow.models.losses.TanimotoDistanceLoss",
"numpy.zeros",
"numpy.ones",
"eoflow.models.losses.JaccardDistanceLoss",
"numpy.array",
"eoflow.models.losses.CategoricalCrossEntropy",
"numpy.concatenate"
] | [((4703, 4718), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4716, 4718), False, 'import unittest\n'), ((896, 913), 'numpy.ones', 'np.ones', (['(32, 32)'], {}), '((32, 32))\n', (903, 913), True, 'import numpy as np\n'), ((930, 948), 'numpy.zeros', 'np.zeros', (['(32, 32)'], {}), '((32, 32))\n', (938, 948), True... |
import numpy as np
from keras import backend as Theano
from keras.layers import Dense, Input, Convolution2D, Flatten, merge
from keras.layers.normalization import BatchNormalization
from keras.models import Model
from keras.optimizers import Adadelta, RMSprop, Adam, SGD
from keras.regularizers import l1, l2
from keras.... | [
"keras.layers.Convolution2D",
"keras.backend.function",
"keras.layers.Flatten",
"keras.backend.T.sum",
"keras.models.Model",
"numpy.ones",
"keras.backend.T.arange",
"keras.layers.Dense",
"numpy.arange",
"keras.layers.Input",
"keras.optimizers.RMSprop",
"keras.layers.merge"
] | [((627, 648), 'keras.layers.Input', 'Input', (['self.state_dim'], {}), '(self.state_dim)\n', (632, 648), False, 'from keras.layers import Dense, Input, Convolution2D, Flatten, merge\n'), ((1840, 1868), 'keras.models.Model', 'Model', (['self.state_in', 'self.q'], {}), '(self.state_in, self.q)\n', (1845, 1868), False, 'f... |
import os
import numpy as np
from scipy.ndimage import gaussian_filter
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import np_tif
from stack_registration import bucket
def main():
assert os.path.isdir('./../images')
if not os.path.isdir('./../images/figure_3... | [
"mpl_toolkits.axes_grid1.make_axes_locatable",
"os.mkdir",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.show",
"numpy.amin",
"os.path.isdir",
"scipy.ndimage.gaussian_filter",
"numpy.zeros",
"matplotlib.pyplot.colorbar",
"numpy.amax",
"stack_registration.bucket",
"matplotlib.pyplot.subplots"... | [((244, 272), 'os.path.isdir', 'os.path.isdir', (['"""./../images"""'], {}), "('./../images')\n", (257, 272), False, 'import os\n'), ((3460, 3511), 'scipy.ndimage.gaussian_filter', 'gaussian_filter', (['STE_stack'], {'sigma': '(0, sigma, sigma)'}), '(STE_stack, sigma=(0, sigma, sigma))\n', (3475, 3511), False, 'from sc... |
# Generated by Django 3.1.3 on 2021-08-02 16:51
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('classic_tetris_project', '0053_auto_20210607_0343'),
]
operations = [
migrations.AddField(
mode... | [
"django.db.models.ForeignKey",
"django.db.models.DateTimeField"
] | [((385, 428), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (405, 428), False, 'from django.db import migrations, models\n'), ((556, 681), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', ... |
import copy
import numpy as np
import time
import matplotlib.pyplot as plt
import memory_profiler
from floris.simulation import Floris
from conftest import SampleInputs
def time_profile(input_dict):
floris = Floris.from_dict(input_dict.floris)
start = time.perf_counter()
floris.steady_state_atmospheric_c... | [
"copy.deepcopy",
"floris.simulation.Floris",
"floris.simulation.Floris.from_dict",
"numpy.sum",
"numpy.zeros",
"time.perf_counter",
"memory_profiler.memory_usage",
"conftest.SampleInputs"
] | [((215, 250), 'floris.simulation.Floris.from_dict', 'Floris.from_dict', (['input_dict.floris'], {}), '(input_dict.floris)\n', (231, 250), False, 'from floris.simulation import Floris\n'), ((263, 282), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (280, 282), False, 'import time\n'), ((341, 360), 'time.per... |
from django.shortcuts import render, redirect
from django.utils.timezone import now
from .models import (
Machine,
Mower,
GreensMower,
TeeMower,
FairwayMower,
RoughMower,
Roller,
Aerator,
Sprayer,
Cart,
TrapRake,
UtilVehicle,
Tractor,
FertSpreader,
HourReadin... | [
"django.utils.timezone.now",
"django.shortcuts.redirect",
"maintenance.models.BedknifeToReel.objects.filter",
"maintenance.models.Repair.objects.filter",
"django.shortcuts.render",
"maintenance.models.OilChange.objects.filter"
] | [((694, 699), 'django.utils.timezone.now', 'now', ([], {}), '()\n', (697, 699), False, 'from django.utils.timezone import now\n'), ((789, 836), 'django.shortcuts.render', 'render', (['request', '"""machines/index.html"""', 'context'], {}), "(request, 'machines/index.html', context)\n", (795, 836), False, 'from django.s... |
import tensorflow as tf
class RNN_cell(object):
"""
RNN cell object which takes 3 arguments for initialization.
input_size = Input Vector size
hidden_layer_size = Hidden layer size
target_size = Output vector size
"""
def __init__(self, input_size, hidden_layer_size, target_size):
... | [
"tensorflow.nn.softmax",
"tensorflow.log",
"tensorflow.argmax",
"tensorflow.transpose",
"tensorflow.placeholder",
"tensorflow.cast",
"tensorflow.zeros",
"tensorflow.multiply",
"tensorflow.matmul",
"tensorflow.map_fn",
"tensorflow.train.AdamOptimizer",
"tensorflow.truncated_normal",
"tensorfl... | [((4495, 4563), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[None, target_size]', 'name': '"""inputs"""'}), "(tf.float32, shape=[None, target_size], name='inputs')\n", (4509, 4563), True, 'import tensorflow as tf\n'), ((4917, 4943), 'tensorflow.nn.softmax', 'tf.nn.softmax', (['last_output'],... |
from math import floor, atan2, sqrt, pi
import numpy as np
from numba import cuda, void, float64, float32, complex128, complex64, int32
from ._spherical_harmonics import gen_sph
from ..plists import nlist
class ql:
def __init__(self, frame, ls=np.asarray([4, 6]), cell_guess=15, n_guess=10):
self.frame =... | [
"numba.void",
"numpy.ceil",
"math.sqrt",
"math.atan2",
"numpy.asarray",
"numpy.dtype",
"numba.cuda.get_current_device",
"numba.cuda.to_device",
"numba.cuda.atomic.add",
"numpy.zeros",
"math.floor",
"numba.cuda.local.array",
"numpy.max",
"numba.cuda.grid",
"numba.cuda.synchronize"
] | [((252, 270), 'numpy.asarray', 'np.asarray', (['[4, 6]'], {}), '([4, 6])\n', (262, 270), True, 'import numpy as np\n'), ((825, 845), 'numpy.dtype', 'np.dtype', (['np.float64'], {}), '(np.float64)\n', (833, 845), True, 'import numpy as np\n'), ((1567, 1590), 'numba.cuda.to_device', 'cuda.to_device', (['self.ls'], {}), '... |
import os
from datetime import datetime
from typing import List, Tuple
from docx import Document
from docx.shared import Pt, RGBColor, Inches
from docx.oxml.ns import qn, nsdecls
from docx.oxml import parse_xml
from fastapi import FastAPI
from fastapi.responses import FileResponse
from utils import set_cell_border
a... | [
"os.mkdir",
"fastapi.responses.FileResponse",
"os.path.exists",
"docx.Document",
"datetime.datetime.now",
"docx.shared.Inches",
"uvicorn.run",
"docx.oxml.ns.qn",
"docx.shared.Pt",
"fastapi.FastAPI"
] | [((325, 334), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (332, 334), False, 'from fastapi import FastAPI\n'), ((653, 687), 'docx.Document', 'Document', (['artificial_template_path'], {}), '(artificial_template_path)\n', (661, 687), False, 'from docx import Document\n'), ((854, 860), 'docx.shared.Pt', 'Pt', (['(10)... |
import json
import logging
import os
import re
import youtube_dl
from pressurecooker.youtube import YouTubeResource
from le_utils.constants.languages import getlang_by_name, getlang
LOGGER = logging.getLogger("RefugeeResponseUtils")
LOGGER.setLevel(logging.DEBUG)
YOUTUBE_CACHE_DIR = os.path.join('chefdata', 'youtube... | [
"os.mkdir",
"pressurecooker.youtube.YouTubeResource",
"os.path.isdir",
"os.path.exists",
"le_utils.constants.languages.getlang",
"le_utils.constants.languages.getlang_by_name",
"os.path.join",
"logging.getLogger",
"re.compile"
] | [((193, 234), 'logging.getLogger', 'logging.getLogger', (['"""RefugeeResponseUtils"""'], {}), "('RefugeeResponseUtils')\n", (210, 234), False, 'import logging\n'), ((287, 327), 'os.path.join', 'os.path.join', (['"""chefdata"""', '"""youtubecache"""'], {}), "('chefdata', 'youtubecache')\n", (299, 327), False, 'import os... |
import pycparser
from pycparser import c_parser, c_ast, parse_file, preprocess_file
from pathlib import Path
class UnprocessibleFunc(Exception):
pass
class UnrecoverableArg(Exception):
pass
def CPP2DRLTace(srcFile, cpp_args):
#tf.write_text(preprocess_file(str(srcFile), cpp_args=cpp_args)
ast = parse_file(str... | [
"pathlib.Path"
] | [((1386, 1403), 'pathlib.Path', 'Path', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (1390, 1403), False, 'from pathlib import Path\n')] |
import logging
import logging.handlers
import os.path
import settings
from .file_ops import mkdir_p
class EncodingFormatter(logging.Formatter):
def __init__(self, fmt, datefmt=None, encoding=None):
logging.Formatter.__init__(self, fmt, datefmt)
self.encoding = encoding
def format(self, rec... | [
"logging.Formatter.format",
"logging.Formatter.__init__",
"logging.handlers.SMTPHandler",
"logging.StreamHandler",
"logging.Formatter",
"logging.getLogger"
] | [((814, 846), 'logging.getLogger', 'logging.getLogger', (['function_name'], {}), '(function_name)\n', (831, 846), False, 'import logging\n'), ((890, 922), 'logging.Formatter', 'logging.Formatter', (['format_string'], {}), '(format_string)\n', (907, 922), False, 'import logging\n'), ((1097, 1120), 'logging.StreamHandler... |
#! /usr/bin/env python3
import curses
import random
from time import sleep
def updateBall(stdscr, ball, paddle):
stdscr.addstr(ball['y'], ball['x'], ' ')
ball['x'] += ball['dx']
ball['y'] += ball['dy']
if (ball['y'] == 0 or ball['y'] == curses.LINES - 1):
ball['dy'] = -ball['dy']
if (ball[... | [
"curses.wrapper",
"random.choice",
"time.sleep",
"curses.cbreak",
"curses.halfdelay",
"curses.curs_set",
"curses.flushinp"
] | [((1421, 1440), 'curses.halfdelay', 'curses.halfdelay', (['(2)'], {}), '(2)\n', (1437, 1440), False, 'import curses\n'), ((1445, 1467), 'curses.curs_set', 'curses.curs_set', (['(False)'], {}), '(False)\n', (1460, 1467), False, 'import curses\n'), ((1813, 1835), 'random.choice', 'random.choice', (['[-1, 1]'], {}), '([-1... |
from starlette.applications import Starlette
from starlette.requests import Request
from starlette.responses import PlainTextResponse, Response
application = Starlette()
@application.route("/")
async def root(request: Request) -> Response:
return PlainTextResponse("Hello, world!")
| [
"starlette.responses.PlainTextResponse",
"starlette.applications.Starlette"
] | [((159, 170), 'starlette.applications.Starlette', 'Starlette', ([], {}), '()\n', (168, 170), False, 'from starlette.applications import Starlette\n'), ((254, 288), 'starlette.responses.PlainTextResponse', 'PlainTextResponse', (['"""Hello, world!"""'], {}), "('Hello, world!')\n", (271, 288), False, 'from starlette.respo... |
from django.conf.urls import url
from . import views
from . import api_views
app_name = 'images'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^api/list_imagesets/$', views.api_index, name='Index (REST API)'),
url(r'^image/delete/(\d+)/$', views.delete_images, name='delete_images'),
url... | [
"django.conf.urls.url"
] | [((119, 155), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.index'], {'name': '"""index"""'}), "('^$', views.index, name='index')\n", (122, 155), False, 'from django.conf.urls import url\n'), ((162, 232), 'django.conf.urls.url', 'url', (['"""^api/list_imagesets/$"""', 'views.api_index'], {'name': '"""Index (REST ... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | [
"os.path.abspath"
] | [((593, 613), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (608, 613), False, 'import os\n')] |
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
path('', include('home.urls')),
path('workouts/', include('workouts.urls')),
path('api/', include('workouts.api.urls')),
] + static(settings.STATIC_URL, document_root=settings.... | [
"django.conf.urls.static.static",
"django.urls.include"
] | [((269, 332), 'django.conf.urls.static.static', 'static', (['settings.STATIC_URL'], {'document_root': 'settings.STATIC_ROOT'}), '(settings.STATIC_URL, document_root=settings.STATIC_ROOT)\n', (275, 332), False, 'from django.conf.urls.static import static\n'), ((145, 165), 'django.urls.include', 'include', (['"""home.url... |
import numpy as np
import numba
from src.data import Problem, Case, Matter
from src.operator.solver.common.shape import is_same
@numba.jit('i8(i8[:, :], i8)', nopython=True)
def find_periodicity_row(x_arr, background):
"""
:param x_arr: np.array(int)
:param background: int
:return: int, minimum period... | [
"numpy.abs",
"numpy.zeros",
"numpy.ones",
"src.operator.solver.common.shape.is_same",
"src.data.Matter",
"numba.jit",
"numpy.unique"
] | [((131, 175), 'numba.jit', 'numba.jit', (['"""i8(i8[:, :], i8)"""'], {'nopython': '(True)'}), "('i8(i8[:, :], i8)', nopython=True)\n", (140, 175), False, 'import numba\n'), ((843, 897), 'numba.jit', 'numba.jit', (['"""i8[:, :](i8[:, :], i8, i8)"""'], {'nopython': '(True)'}), "('i8[:, :](i8[:, :], i8, i8)', nopython=Tru... |
import sys
FILENAME = 'background.ppm'
WIDTH = 1600
HEIGHT = 900
def color_text(r, g, b):
return f'{r} {g} {b}\n'
def convert_percent_to_rgb(percent):
return int(percent * 255)
def add_progress():
sys.stdout.write(f'=')
sys.stdout.flush()
def write_header(file):
file.write('P3\n')
file.writ... | [
"sys.stdout.write",
"sys.stdout.flush"
] | [((213, 235), 'sys.stdout.write', 'sys.stdout.write', (['f"""="""'], {}), "(f'=')\n", (229, 235), False, 'import sys\n'), ((240, 258), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (256, 258), False, 'import sys\n'), ((400, 433), 'sys.stdout.write', 'sys.stdout.write', (['f"""[{100 * \' \'}"""'], {}), '(f"[... |
import argparse
import os
from itertools import product
from torch import FloatTensor
from torch_geometric.datasets import Planetoid, Coauthor
from torch_geometric.utils import dense_to_sparse, to_dense_adj
from data_utils import preprocess_dataset, get_ppr_matrix_dense, save_adj, save_features, \
save_labels, sa... | [
"data_utils.save_labels",
"data_utils.save_ppr",
"torch_geometric.datasets.Planetoid",
"os.makedirs",
"argparse.ArgumentParser",
"os.path.exists",
"data_utils.save_features",
"torch.FloatTensor",
"data_utils.get_ppr_matrix_dense",
"data_utils.preprocess_dataset",
"data_utils.save_adj",
"torch_... | [((383, 408), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (406, 408), False, 'import argparse\n'), ((690, 715), 'os.path.exists', 'os.path.exists', (['data_root'], {}), '(data_root)\n', (704, 715), False, 'import os\n'), ((725, 747), 'os.makedirs', 'os.makedirs', (['data_root'], {}), '(data_... |
import sys
from django.core.management.base import NoArgsCommand
from django.template.loader import render_to_string
from wordpress.models import Post, Author
import wordpress
class Command(NoArgsCommand):
def handle_noargs(self, **options):
context = {
'authors': Author.objects.all(),
... | [
"wordpress.models.Author.objects.all",
"wordpress.models.Post.objects.published",
"django.template.loader.render_to_string"
] | [((295, 315), 'wordpress.models.Author.objects.all', 'Author.objects.all', ([], {}), '()\n', (313, 315), False, 'from wordpress.models import Post, Author\n'), ((338, 362), 'wordpress.models.Post.objects.published', 'Post.objects.published', ([], {}), '()\n', (360, 362), False, 'from wordpress.models import Post, Autho... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import wx
import images
from PhrResource import strVersion
import os
class FrmAbout(wx.Frame):
def __init__(self):
title = u"卸载 " + strVersion
meWidth = 450
meHeight = 350
wx.Frame.__init__(self, None, -1, title, size=(meWidth, meHe... | [
"wx.BoxSizer",
"images.getProblemIcon",
"os.getcwd",
"wx.Panel",
"wx.StaticText",
"wx.Button",
"wx.Frame.__init__",
"wx.TextCtrl",
"wx.PySimpleApp",
"wx.Font"
] | [((2256, 2272), 'wx.PySimpleApp', 'wx.PySimpleApp', ([], {}), '()\n', (2270, 2272), False, 'import wx\n'), ((260, 421), 'wx.Frame.__init__', 'wx.Frame.__init__', (['self', 'None', '(-1)', 'title'], {'size': '(meWidth, meHeight)', 'style': '(wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER ^ wx.MAXIMIZE_BOX ^ wx.MINIMIZE_BOX)'... |
# Code is from OpenAI Baseline and Tensor2Tensor
import itertools
import numpy as np
from gym.envs.box2d import CarRacing
import multiprocessing as mp
def printstar(string, num_stars=50):
print("*" * num_stars)
print(string)
print("*" * num_stars)
def make_env():
def _thunk():
env = CarRacin... | [
"pickle.loads",
"numpy.stack",
"gym.envs.box2d.CarRacing",
"cloudpickle.dumps",
"multiprocessing.Pipe"
] | [((312, 431), 'gym.envs.box2d.CarRacing', 'CarRacing', ([], {'grayscale': '(0)', 'show_info_panel': '(0)', 'discretize_actions': '"""hard"""', 'frames_per_state': '(1)', 'num_lanes': '(1)', 'num_tracks': '(1)'}), "(grayscale=0, show_info_panel=0, discretize_actions='hard',\n frames_per_state=1, num_lanes=1, num_trac... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# =================================================================
# =================================================================
from nova import exception
from paxes_nova import _
class IBMPowerVMMigrationFailed(exception.NovaException):
msg_fmt = _("The migr... | [
"paxes_nova._"
] | [((309, 350), 'paxes_nova._', '_', (['"""The migration task failed. %(error)s"""'], {}), "('The migration task failed. %(error)s')\n", (310, 350), False, 'from paxes_nova import _\n'), ((429, 479), 'paxes_nova._', '_', (['"""Migration of %(lpar)s is already in progress."""'], {}), "('Migration of %(lpar)s is already in... |