code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from flask import *
from werkzeug.security import *
from flask_jwt_extended import *
from iml_global import *
from lms_auth import sejong_api
from werkzeug import secure_filename
import os
import datetime
bp = Blueprint('user', __name__)
UPLOAD_PATH = "/static/img_save/"
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg',... | [
"datetime.datetime.strptime",
"werkzeug.secure_filename",
"lms_auth.sejong_api"
] | [((1866, 1914), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['exp_date', '"""%Y-%m-%d"""'], {}), "(exp_date, '%Y-%m-%d')\n", (1892, 1914), False, 'import datetime\n'), ((5321, 5349), 'lms_auth.sejong_api', 'sejong_api', (['user_id', 'user_pw'], {}), '(user_id, user_pw)\n', (5331, 5349), False, 'from lm... |
from IPython import get_ipython
# %%
####################
# GRAPH GENERATION #
####################
# TODO: remove duplicate of nbIndividuals in viz
nbIndividuals = 1000 # number of people in the graph | nombre d'individus dans le graphe
initHealthy = 0.85 # proportion of healthy people at start | la proportion de per... | [
"matplotlib.pyplot.show",
"random.randint",
"random.uniform",
"numpy.random.exponential",
"matplotlib.pyplot.subplots",
"random.random",
"matplotlib.pyplot.tight_layout",
"numpy.random.lognormal"
] | [((23541, 23577), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {'figsize': '[15, 10]'}), '(2, 2, figsize=[15, 10])\n', (23553, 23577), True, 'import matplotlib.pyplot as plt\n'), ((27386, 27404), 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {}), '()\n', (27402, 27404), True, 'import matp... |
import pandas
## read the csv file into a pandas dataframe
roads = pandas.read_csv("../data/input_data/artificial_roads_by_region.csv")
## print out the column headers
# print("column headers:")
# print(list(roads))
## extract roads from 2011
roads_2011 = roads['2011']
# print(roads_2011)
## convert the data type f... | [
"pandas.read_csv"
] | [((68, 136), 'pandas.read_csv', 'pandas.read_csv', (['"""../data/input_data/artificial_roads_by_region.csv"""'], {}), "('../data/input_data/artificial_roads_by_region.csv')\n", (83, 136), False, 'import pandas\n')] |
__author__ = 'andreap'
from flask import current_app
from flask_restful import Resource
class ClearCache(Resource):
''' clear the aplication cache
'''
def get(self ):
return current_app.cache.clear()
| [
"flask.current_app.cache.clear"
] | [((200, 225), 'flask.current_app.cache.clear', 'current_app.cache.clear', ([], {}), '()\n', (223, 225), False, 'from flask import current_app\n')] |
import socket
def main():
client = socket.socket()
client.connect(("127.0.0.1",12335))
print("Connection Established to {}".format("127.0.0.1"))
fole=client.recv(1024)
data = fole.split("\n")
for i,v in enumerate(data):
print("{} : {}".format(i,v))
inp=int(input("enter file no to get"))
client.send(data[in... | [
"socket.socket"
] | [((37, 52), 'socket.socket', 'socket.socket', ([], {}), '()\n', (50, 52), False, 'import socket\n')] |
import pandas as pd
# import numpy as np
# import nltk
import re
# from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
# import math
import enchant
from stemming.porter2 import stem
import pathConfig as pc
# --------------------------------
# Path
pathStopwords = "/home/hasan/Desktop/FYP-II/model... | [
"pandas.DataFrame",
"pandas.read_csv",
"enchant.Dict",
"re.sub",
"nltk.tokenize.word_tokenize"
] | [((618, 633), 'pandas.read_csv', 'pd.read_csv', (['fd'], {}), '(fd)\n', (629, 633), True, 'import pandas as pd\n'), ((1615, 1634), 'nltk.tokenize.word_tokenize', 'word_tokenize', (['text'], {}), '(text)\n', (1628, 1634), False, 'from nltk.tokenize import word_tokenize\n'), ((2767, 2800), 're.sub', 're.sub', (['"""[^\\\... |
import unittest
from jmetal.core.solution import Solution
from jmetal.util.constraint_handling import is_feasible, number_of_violated_constraints, \
overall_constraint_violation_degree, feasibility_ratio
class ConstraintHandlingTestCases(unittest.TestCase):
def test_should_is_feasible_return_true_if_the_sol... | [
"unittest.main",
"jmetal.util.constraint_handling.is_feasible",
"jmetal.util.constraint_handling.feasibility_ratio",
"jmetal.util.constraint_handling.overall_constraint_violation_degree",
"jmetal.core.solution.Solution",
"jmetal.util.constraint_handling.number_of_violated_constraints"
] | [((4423, 4438), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4436, 4438), False, 'import unittest\n'), ((379, 464), 'jmetal.core.solution.Solution', 'Solution', ([], {'number_of_variables': '(2)', 'number_of_objectives': '(2)', 'number_of_constraints': '(0)'}), '(number_of_variables=2, number_of_objectives=2, n... |
import pdfkit
import os
from jinja2 import Environment, FileSystemLoader, PackageLoader
from pprint import pprint
class Pdf(object):
def __init__(self, tpl, filename):
self.tpl = tpl
self.filename = filename + '.pdf'
self.dir = os.path.dirname(os.path.abspath(__file__))
def _add_util_... | [
"jinja2.PackageLoader",
"os.path.abspath",
"pdfkit.from_string"
] | [((786, 844), 'pdfkit.from_string', 'pdfkit.from_string', (['rendered', "('documents/' + self.filename)"], {}), "(rendered, 'documents/' + self.filename)\n", (804, 844), False, 'import pdfkit\n'), ((274, 299), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (289, 299), False, 'import os\n'), (... |
import paho.mqtt.client as mqtt
import time
import sys
def on_connect(client, userdata, flags, rc):
print(f"Connected with result code {rc}")
client = mqtt.Client()
client.on_connect = on_connect
client.connect("broker.emqx.io", 1883, 60)
client.publish(f'raspberry/sensorweb{sys.argv[1]}', payload=sys.a... | [
"paho.mqtt.client.Client"
] | [((162, 175), 'paho.mqtt.client.Client', 'mqtt.Client', ([], {}), '()\n', (173, 175), True, 'import paho.mqtt.client as mqtt\n')] |
from lxml import etree
from lxml.objectify import dump
from references_data import *
class Cproperty:
def __init__(self,node=None,type='NAF'):
self.type = type
if node is None:
self.node = etree.Element('property')
else:
self.node = node
def get_node(self)... | [
"lxml.etree.Element"
] | [((224, 249), 'lxml.etree.Element', 'etree.Element', (['"""property"""'], {}), "('property')\n", (237, 249), False, 'from lxml import etree\n'), ((1264, 1291), 'lxml.etree.Element', 'etree.Element', (['"""properties"""'], {}), "('properties')\n", (1277, 1291), False, 'from lxml import etree\n'), ((2419, 2444), 'lxml.et... |
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import Messages
from .serializers import MessagesSerializer
class MessagesListView(APIView):
def get(sel... | [
"rest_framework.response.Response",
"drf_yasg.openapi.Schema"
] | [((805, 830), 'rest_framework.response.Response', 'Response', (['serializer.data'], {}), '(serializer.data)\n', (813, 830), False, 'from rest_framework.response import Response\n'), ((1305, 1330), 'rest_framework.response.Response', 'Response', (['serializer.data'], {}), '(serializer.data)\n', (1313, 1330), False, 'fro... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | [
"utils.apply_mutations",
"numpy.random.RandomState",
"utils.merge_multiple_mutation_sets",
"itertools.combinations",
"collections.Counter",
"utils.get_top_n_mutation_pairs"
] | [((2032, 2081), 'itertools.combinations', 'itertools.combinations', (['mutations', '(num_rounds + 1)'], {}), '(mutations, num_rounds + 1)\n', (2054, 2081), False, 'import itertools\n'), ((2514, 2523), 'collections.Counter', 'Counter', ([], {}), '()\n', (2521, 2523), False, 'from collections import Counter\n'), ((3273, ... |
import random
import itertools
# global variables
tree = []
trees = 0
_flag = []
flags = 0
_apples = []
_clear = []
width = 0
height = 0
cleared = 0
stack = []
neighbour = []
linked = []
verbose = False
seed = 0
emoji = True
ClearingTechnique = 1
LumberjackTechnique = 0
ForresterTechnique = 0
TwinsTechnique = 0
Trip... | [
"random.seed",
"random.randrange"
] | [((39027, 39044), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (39038, 39044), False, 'import random\n'), ((39054, 39078), 'random.randrange', 'random.randrange', (['height'], {}), '(height)\n', (39070, 39078), False, 'import random\n'), ((39087, 39110), 'random.randrange', 'random.randrange', (['width'], ... |
import numpy as np
def cubic_lattice(N):
array = np.arange(N)
xs, ys, zs = np.meshgrid(array, array, array)
return np.vstack((xs.flatten(), ys.flatten(), zs.flatten())).T
def donut(inner_r, outer_r, height=5, point_density=24, n_viewpoints=60,
offset=1e-3):
assert(isinstance(height, int))
... | [
"numpy.meshgrid",
"numpy.zeros",
"numpy.sin",
"numpy.arange",
"numpy.linspace",
"numpy.cos",
"numpy.vstack"
] | [((55, 67), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (64, 67), True, 'import numpy as np\n'), ((85, 117), 'numpy.meshgrid', 'np.meshgrid', (['array', 'array', 'array'], {}), '(array, array, array)\n', (96, 117), True, 'import numpy as np\n'), ((856, 873), 'numpy.arange', 'np.arange', (['height'], {}), '(heigh... |
# example-3.18-repressilator.py - Transcriptional regulation
# RMM, 29 Aug 2021
#
# Figure 3.26: The repressilator genetic regulatory network. (a) A schematic
# diagram of the repressilator, showing the layout of the genes in the
# plasmid that holds the circuit as well as the circuit diagram
# (center). (b) A simulati... | [
"matplotlib.pyplot.title",
"control.NonlinearIOSystem",
"numpy.log",
"matplotlib.pyplot.plot",
"numpy.empty",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"numpy.linspace",
"control.input_output_response",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlab... | [((3513, 3629), 'control.NonlinearIOSystem', 'ct.NonlinearIOSystem', ([], {'updfcn': 'repressilator', 'outfcn': '(lambda t, x, u, params: x[3:])', 'states': '(6)', 'inputs': '(0)', 'outputs': '(3)'}), '(updfcn=repressilator, outfcn=lambda t, x, u, params: x\n [3:], states=6, inputs=0, outputs=3)\n', (3533, 3629), Tr... |
"""System tests for RedisState."""
import pickle # noqa: S403
import pytest
from Arbie.Actions.redis_state import RedisState
from Arbie.address import dummy_token_generator
collection_key = "pool_finder.1.pools"
item_key = "pool_finder.1.pools.0xAb12C"
@pytest.fixture
def token():
return dummy_token_generator... | [
"pytest.raises",
"Arbie.address.dummy_token_generator",
"pickle.dumps"
] | [((299, 332), 'Arbie.address.dummy_token_generator', 'dummy_token_generator', (['"""my_token"""'], {}), "('my_token')\n", (320, 332), False, 'from Arbie.address import dummy_token_generator\n'), ((377, 408), 'Arbie.address.dummy_token_generator', 'dummy_token_generator', (['"""token1"""'], {}), "('token1')\n", (398, 40... |
import argparse
import re
import sys
import numpy as np
import pandas as pd
import tpch
from pydrill.client import PyDrill
def get_table_occurrences(query):
# [ y for y in a if y not in b]
return [name for name in tpch.tableNames if name in query.split()]
def replace_all(text, dic):
for i, j in dic.item... | [
"argparse.ArgumentParser",
"tpch.init_schema",
"numpy.asarray",
"numpy.dtype",
"pydrill.client.PyDrill",
"pandas.api.types.is_categorical_dtype",
"re.sub",
"pandas.to_numeric"
] | [((6477, 6513), 'pydrill.client.PyDrill', 'PyDrill', ([], {'host': '"""localhost"""', 'port': '(8047)'}), "(host='localhost', port=8047)\n", (6484, 6513), False, 'from pydrill.client import PyDrill\n'), ((6608, 6699), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate Input Generato... |
from ns_portal.database.meta import (
Log_Db_Base
)
from sqlalchemy import (
Column,
DateTime,
Integer,
String,
Sequence,
func
)
class TLOG_MESSAGES(Log_Db_Base):
__tablename__ = 'TLOG_MESSAGES'
ID = Column(
Integer,
Sequence('Equipment__id_seq'),
primary_k... | [
"sqlalchemy.DateTime",
"sqlalchemy.func.now",
"sqlalchemy.Column",
"sqlalchemy.String",
"sqlalchemy.Sequence"
] | [((466, 496), 'sqlalchemy.Column', 'Column', (['Integer'], {'nullable': '(True)'}), '(Integer, nullable=True)\n', (472, 496), False, 'from sqlalchemy import Column, DateTime, Integer, String, Sequence, func\n'), ((272, 301), 'sqlalchemy.Sequence', 'Sequence', (['"""Equipment__id_seq"""'], {}), "('Equipment__id_seq')\n"... |
import tensorflow as tf
import Dataset
import histogram
import visualizer
import os
# from os import listdir
# import cv2
# data_dir = "G:/fax/diplomski/Datasets/third/combined_tiff_relighted/img_corrected_1/"
# for filename in listdir(data_dir):
# if filename.endswith(".png") and filename > "245.png":
# ... | [
"histogram.decode_bins",
"histogram.bin",
"histogram.encode_bins",
"Dataset.dataset",
"histogram.from_uv",
"histogram.hist",
"visualizer.visualize",
"os.listdir",
"tensorflow.expand_dims",
"tensorflow.math.reduce_sum"
] | [((592, 657), 'Dataset.dataset', 'Dataset.dataset', (['data_dir'], {'bs': 'bs', 'cache': '(False)', 'type': 'Dataset.VALID'}), '(data_dir, bs=bs, cache=False, type=Dataset.VALID)\n', (607, 657), False, 'import Dataset\n'), ((717, 770), 'visualizer.visualize', 'visualizer.visualize', (['[image_batch[0], mask_batch[0]]']... |
# -*- coding: utf-8 -*-
"""
Click-specific code to define a CLI.
"""
import click
from . import store
@click.group()
def config() -> None:
"""
Configure the application.
"""
@config.command(name="set")
@click.argument('key')
@click.argument('value')
def set_config(key: str, value: str) -> None:
"""
... | [
"click.group",
"click.echo",
"click.argument"
] | [((106, 119), 'click.group', 'click.group', ([], {}), '()\n', (117, 119), False, 'import click\n'), ((219, 240), 'click.argument', 'click.argument', (['"""key"""'], {}), "('key')\n", (233, 240), False, 'import click\n'), ((242, 265), 'click.argument', 'click.argument', (['"""value"""'], {}), "('value')\n", (256, 265), ... |
import torch
from up.tasks.det.models.utils.assigner import map_rois_to_level
from up.tasks.det.models.utils.bbox_helper import (
clip_bbox,
filter_by_size
)
def mlvl_extract_roi_features(rois, x_features, fpn_levels,
fpn_strides, base_scale, roi_extractor,
... | [
"torch.where",
"up.tasks.det.models.utils.bbox_helper.filter_by_size",
"torch.cat",
"up.tasks.det.models.utils.bbox_helper.clip_bbox",
"up.tasks.det.models.utils.assigner.map_rois_to_level",
"torch.no_grad"
] | [((384, 431), 'up.tasks.det.models.utils.assigner.map_rois_to_level', 'map_rois_to_level', (['fpn_levels', 'base_scale', 'rois'], {}), '(fpn_levels, base_scale, rois)\n', (401, 431), False, 'from up.tasks.det.models.utils.assigner import map_rois_to_level\n'), ((998, 1028), 'torch.cat', 'torch.cat', (['pooled_feats'], ... |
#
# wtfdmdg.py
#
# Where The Fuck Did My Day Go, dot pie
#
# A tool to help answer that question.
#
from PyQt5 import Qt, QtGui, QtWidgets, QtCore
import pyqtgraph as pg
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
import sys
import re
import collections
import datetime
import time
imp... | [
"pylab.get_cmap",
"pathlib.Path.home",
"PyQt5.QtGui.QColor",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtGui.QBrush",
"pyqtgraph.mkBrush",
"PyQt5.QtWidgets.QHeaderView",
"PyQt5.QtWidgets.QWidget",
"os.path.exists",
"datetime.timedelta",
"datetime.datetime.now",
"time.localtime",
"datetime.dateti... | [((172, 209), 'pyqtgraph.setConfigOption', 'pg.setConfigOption', (['"""background"""', '"""w"""'], {}), "('background', 'w')\n", (190, 209), True, 'import pyqtgraph as pg\n'), ((210, 247), 'pyqtgraph.setConfigOption', 'pg.setConfigOption', (['"""foreground"""', '"""k"""'], {}), "('foreground', 'k')\n", (228, 247), True... |
import pandas as pd
import sys, os
import random
def preprocessing(dataset_path, columns_list):
if os.path.exists(os.getcwd()+'/'+ "datasets/"+dataset_path):
dataset_path = os.getcwd()+'/'+ "datasets/"+dataset_path
elif os.path.exists(dataset_path):
pass
else:
print (dataset_path, ... | [
"pandas.DataFrame",
"os.makedirs",
"pandas.read_csv",
"random.shuffle",
"os.getcwd",
"os.path.exists",
"random.seed",
"pandas.Series",
"sys.exit"
] | [((420, 455), 'pandas.read_csv', 'pd.read_csv', (['dataset_path'], {'sep': '"""\t"""'}), "(dataset_path, sep='\\t')\n", (431, 455), True, 'import pandas as pd\n'), ((779, 803), 'pandas.Series', 'pd.Series', (['total_samples'], {}), '(total_samples)\n', (788, 803), True, 'import pandas as pd\n'), ((862, 877), 'random.se... |
import github
from .github_repository import GithubRepository
from .github_repository_collection import GithubRepositoryCollection
class Github:
def __init__(self, auth=None, command=None):
if auth.type == 'token':
self.api = github.Github(auth.token)
else:
self.a... | [
"github.Github"
] | [((253, 278), 'github.Github', 'github.Github', (['auth.token'], {}), '(auth.token)\n', (266, 278), False, 'import github\n'), ((325, 364), 'github.Github', 'github.Github', (['auth.user', 'auth.password'], {}), '(auth.user, auth.password)\n', (338, 364), False, 'import github\n')] |
import unittest
from app.models import Comment
class CommentModelTest(unittest.TestCase):
"""
test class to test the behavior of the Comment class
"""
def setUp(self):
self.new_comment = Comment("1","josphat","<EMAIL>", "1234", "yudbc", "this is a great article") #create comment object
| [
"app.models.Comment"
] | [((207, 285), 'app.models.Comment', 'Comment', (['"""1"""', '"""josphat"""', '"""<EMAIL>"""', '"""1234"""', '"""yudbc"""', '"""this is a great article"""'], {}), "('1', 'josphat', '<EMAIL>', '1234', 'yudbc', 'this is a great article')\n", (214, 285), False, 'from app.models import Comment\n')] |
from flask import render_template, request, current_app, redirect, url_for, g
from maintain_frontend.dependencies.search_api.local_land_charge_service import LocalLandChargeService
from maintain_frontend.dependencies.local_authority_api.local_authority_api_service import LocalAuthorityService
from maintain_frontend.exc... | [
"maintain_frontend.dependencies.audit_api.audit_api.AuditAPIService.audit_event",
"maintain_frontend.services.build_extents_from_features.build_extents_from_features",
"maintain_frontend.models.LocalLandChargeItem.from_json",
"flask.g.session.commit",
"maintain_frontend.dependencies.local_authority_api.loca... | [((1073, 1118), 'maintain_frontend.decorators.requires_permission', 'requires_permission', (['[Permissions.cancel_llc]'], {}), '([Permissions.cancel_llc])\n', (1092, 1118), False, 'from maintain_frontend.decorators import requires_permission\n'), ((4265, 4310), 'maintain_frontend.decorators.requires_permission', 'requi... |
from flask import Flask, jsonify
from time import sleep
import first_servo
#import servo1.py
import sys
sys.path.append('/home/pi/tracer/python')
#Rest API
app = Flask("Yeehaw")
@app.route("/")
def hello():
return "Hello World!"
@app.route("/Servo")
def servohome():
return "What do you want to do with the s... | [
"sys.path.append",
"first_servo.min",
"flask.Flask",
"first_servo.mid",
"flask.jsonify",
"first_servo.max"
] | [((105, 146), 'sys.path.append', 'sys.path.append', (['"""/home/pi/tracer/python"""'], {}), "('/home/pi/tracer/python')\n", (120, 146), False, 'import sys\n'), ((164, 179), 'flask.Flask', 'Flask', (['"""Yeehaw"""'], {}), "('Yeehaw')\n", (169, 179), False, 'from flask import Flask, jsonify\n'), ((412, 429), 'first_servo... |
from bbpipe import PipelineStage
from .types import FitsFile, DirFile, HTMLFile, NpzFile
import sacc
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import dominate as dom
import dominate.tags as dtg
import os
class BBPlotter(PipelineStage):
name="BBPlotter"
inputs=[(... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.yscale",
"numpy.sum",
"bbpipe.PipelineStage.main",
"matplotlib.pyplot.figure",
"getdist.MCSamples",
"numpy.diag",
"matplotlib.pyplot.close",
"dominate.tags.link",
"matplotlib.pyplot.errorbar",
"dominate.tags.h1",
"numpy.ones_like",
"matplotlib.py... | [((138, 159), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (152, 159), False, 'import matplotlib\n'), ((11386, 11406), 'bbpipe.PipelineStage.main', 'PipelineStage.main', ([], {}), '()\n', (11404, 11406), False, 'from bbpipe import PipelineStage\n'), ((952, 991), 'dominate.document', 'dom.docume... |
from abc import ABCMeta, abstractmethod, abstractproperty
from inspect import getdoc, ismethod
from types import FunctionType, MethodType
from six import add_metaclass
from custom_inherit import doc_inherit
try:
from inspect import signature
except ImportError:
from inspect import getargspec as signature
d... | [
"inspect.ismethod",
"inspect.getdoc",
"six.add_metaclass",
"inspect.getargspec",
"custom_inherit.doc_inherit"
] | [((358, 380), 'six.add_metaclass', 'add_metaclass', (['ABCMeta'], {}), '(ABCMeta)\n', (371, 380), False, 'from six import add_metaclass\n'), ((422, 450), 'custom_inherit.doc_inherit', 'doc_inherit', (['""""""'], {'style': 'style'}), "('', style=style)\n", (433, 450), False, 'from custom_inherit import doc_inherit\n'), ... |
import sys
from tkinter import *
def quit(): # a custom callback handler
print('Hello, I must be going...') # kill windows and process
sys.exit()
widget = Button(None, text='Hello event world', command=quit)
widget.pack()
widget.mainloop()
| [
"sys.exit"
] | [((183, 193), 'sys.exit', 'sys.exit', ([], {}), '()\n', (191, 193), False, 'import sys\n')] |
from db import get_train_data
from supervised import AutoML
# get the training data
X_train, y_train = get_train_data()
# train AutoML
automl = AutoML(results_path="Response_Classifier")
automl.fit(X_train, y_train)
| [
"db.get_train_data",
"supervised.AutoML"
] | [((105, 121), 'db.get_train_data', 'get_train_data', ([], {}), '()\n', (119, 121), False, 'from db import get_train_data\n'), ((146, 188), 'supervised.AutoML', 'AutoML', ([], {'results_path': '"""Response_Classifier"""'}), "(results_path='Response_Classifier')\n", (152, 188), False, 'from supervised import AutoML\n')] |
# Finite Decks, Aces = reactive
# this program just uses the count information to maximize score.
import numpy as np
import matplotlib.pyplot as plt
import random
from rl_tools import (
simulation,
scorecalc,
countcalc,
initializedrawpile,
actionupdate,
acecheck,
cardvalue,
... | [
"rl_tools.initializedrawpile",
"matplotlib.pyplot.show",
"numpy.sum",
"rl_tools.twist",
"rl_tools.simulation",
"numpy.asarray",
"numpy.zeros",
"rl_tools.countcalc",
"numpy.append",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"numpy.array",
"rl_tools.newcard"
] | [((432, 452), 'numpy.zeros', 'np.zeros', (['(34, 2, 5)'], {}), '((34, 2, 5))\n', (440, 452), True, 'import numpy as np\n'), ((640, 660), 'numpy.zeros', 'np.zeros', (['(34, 2, 5)'], {}), '((34, 2, 5))\n', (648, 660), True, 'import numpy as np\n'), ((906, 918), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', ... |
import pytest
from sphinxcontrib.needs.api.need import NeedsDuplicatedId
@pytest.mark.parametrize("test_app", [{"buildername": "html", "srcdir": "doc_test/broken_doc"}], indirect=True)
def test_doc_build_html(test_app):
with pytest.raises(NeedsDuplicatedId):
app = test_app
app.build()
ht... | [
"pytest.mark.parametrize",
"pytest.raises"
] | [((77, 191), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""test_app"""', "[{'buildername': 'html', 'srcdir': 'doc_test/broken_doc'}]"], {'indirect': '(True)'}), "('test_app', [{'buildername': 'html', 'srcdir':\n 'doc_test/broken_doc'}], indirect=True)\n", (100, 191), False, 'import pytest\n'), ((232, 2... |
"""Stream type classes for tap-stackexchange."""
from typing import Any, Dict, Optional
import requests
from singer_sdk import typing as th
from tap_stackexchange.client import StackExchangeStream
SHALLOW_USER = th.ObjectType(
th.Property("accept_rate", th.IntegerType),
th.Property("account_id", th.IntegerT... | [
"singer_sdk.typing.ArrayType",
"singer_sdk.typing.Property"
] | [((235, 277), 'singer_sdk.typing.Property', 'th.Property', (['"""accept_rate"""', 'th.IntegerType'], {}), "('accept_rate', th.IntegerType)\n", (246, 277), True, 'from singer_sdk import typing as th\n'), ((283, 324), 'singer_sdk.typing.Property', 'th.Property', (['"""account_id"""', 'th.IntegerType'], {}), "('account_id... |
from rest_framework import serializers
from linkanywhere.apps.likes.services import get_liked
from linkanywhere.apps.links.models import Link
from linkanywhere.apps.links.serializers import LinkSerializer
from .models import User
class UserSerializer(serializers.ModelSerializer):
password = serializers.CharField... | [
"rest_framework.serializers.CharField",
"linkanywhere.apps.likes.services.get_liked",
"rest_framework.serializers.SerializerMethodField"
] | [((299, 367), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(128)', 'min_length': '(8)', 'write_only': '(True)'}), '(max_length=128, min_length=8, write_only=True)\n', (320, 367), False, 'from rest_framework import serializers\n'), ((417, 452), 'rest_framework.serializers.Seriali... |
# Copyright (c) 2021 Qualcomm Technologies, Inc.
# All Rights Reserved.
import numpy as np
from ignite.metrics import Metric
def softmax(logit):
e_x = np.exp(logit - np.max(logit))
return e_x / e_x.sum()
def sigmoid(logit):
return 1 / (1 + np.exp(-logit))
class Hitat1(Metric):
"""
Performs a ... | [
"numpy.stack",
"numpy.average",
"numpy.argmax",
"numpy.any",
"numpy.argsort",
"numpy.max",
"numpy.cumsum",
"numpy.arange",
"numpy.exp",
"numpy.concatenate"
] | [((2169, 2184), 'numpy.stack', 'np.stack', (['preds'], {}), '(preds)\n', (2177, 2184), True, 'import numpy as np\n'), ((2200, 2214), 'numpy.stack', 'np.stack', (['acts'], {}), '(acts)\n', (2208, 2214), True, 'import numpy as np\n'), ((2239, 2259), 'numpy.any', 'np.any', (['acts'], {'axis': '(1)'}), '(acts, axis=1)\n', ... |
import pygame
import random
from datetime import datetime, timedelta
from pysnake.constants import X_SIZE, Y_SIZE, CAPTION, WHITE_COLOR
from pysnake.snake import Snake
from pysnake.egg import Egg
from pysnake.utils import random_pos
class Game(object):
def __init__(self, game_id, players):
self.game_id = ... | [
"pysnake.utils.random_pos",
"pygame.quit",
"random.randint",
"pygame.event.get",
"datetime.datetime.utcnow",
"pygame.display.update"
] | [((354, 371), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (369, 371), False, 'from datetime import datetime, timedelta\n'), ((1407, 1430), 'pygame.display.update', 'pygame.display.update', ([], {}), '()\n', (1428, 1430), False, 'import pygame\n'), ((892, 910), 'pygame.event.get', 'pygame.event.get'... |
import numpy as np
import tensorflow as tf
class BatchRollout:
def __init__(self, env, max_episode_steps):
self.env = env
self.max_episode_steps = max_episode_steps
def __call__(self, policy, episodes, render=False):
assert len(self.env) == episodes
observation_space = self.e... | [
"tensorflow.convert_to_tensor",
"numpy.where",
"numpy.zeros",
"numpy.all"
] | [((410, 521), 'numpy.zeros', 'np.zeros', ([], {'shape': '((episodes, self.max_episode_steps) + observation_space.shape)', 'dtype': 'observation_space.dtype'}), '(shape=(episodes, self.max_episode_steps) + observation_space.shape,\n dtype=observation_space.dtype)\n', (418, 521), True, 'import numpy as np\n'), ((571, ... |
from typing import Callable
import numpy as np
def newtonSolver(f: Callable, f_prime: Callable, guess: float,
tol: float=10e-6, prev: float=0) -> float:
"""Newton method solver for 1 dimension, implemented recursively.
Arguments:
f {Callable} -- Objective function (must have zero... | [
"numpy.abs"
] | [((903, 923), 'numpy.abs', 'np.abs', (['(x_old - prev)'], {}), '(x_old - prev)\n', (909, 923), True, 'import numpy as np\n')] |
"""
Definition of the :class:`StorageScpSerializer` class.
"""
from django_dicom.models.networking import StorageServiceClassProvider
from rest_framework import serializers
class StorageScpSerializer(serializers.HyperlinkedModelSerializer):
"""
A serializer class for the
:class:`~django_dicom.models.netwo... | [
"rest_framework.serializers.SerializerMethodField"
] | [((400, 435), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {}), '()\n', (433, 435), False, 'from rest_framework import serializers\n')] |
import glob
import xml.etree.ElementTree as ET
from pprint import pprint
import sys
dir = sys.argv[1] if len(sys.argv) > 0 else "./"
def load_labels():
labels = {}
count = 0
with open(dir + "/labels.txt") as label_file:
for label in label_file.read().splitlines():
labels[label] = count... | [
"xml.etree.ElementTree.fromstring",
"glob.glob"
] | [((418, 455), 'glob.glob', 'glob.glob', (["(dir + '/Annotations/*.xml')"], {}), "(dir + '/Annotations/*.xml')\n", (427, 455), False, 'import glob\n'), ((536, 552), 'xml.etree.ElementTree.fromstring', 'ET.fromstring', (['s'], {}), '(s)\n', (549, 552), True, 'import xml.etree.ElementTree as ET\n')] |
#!/usr/bin/env python
import tweepy
import flask
from flask import *
from pydocumentdb import document_client
from azure.cosmos import CosmosClient
import praw
import sys
# Create the application.
APP = flask.Flask(__name__)
APP.secret_key = 'secret key'
#### CosmosDB Creds #####
url = 'Cosmos DB ... | [
"azure.cosmos.CosmosClient",
"tweepy.API",
"flask.Flask",
"flask.render_template",
"tweepy.OAuthHandler",
"praw.Reddit"
] | [((218, 239), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (229, 239), False, 'import flask\n'), ((543, 738), 'praw.Reddit', 'praw.Reddit', ([], {'client_id': '"""Reddit Access Key"""', 'client_secret': '"""Reddit Secret Access Key"""', 'user_agent': '"""pnaithani"""', 'redirect_uri': '"""http://lo... |
# -*- coding: utf-8 -*-
#%%
######################################################
# libraries
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1 import AxesGrid
import math
from scipy import stats
# matplotlib params
mpl.rcParams["axes.titlesiz... | [
"matplotlib.pyplot.title",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"numpy.arange",
"pandas.Grouper",
"matplotlib.pyplot.xlabel",
"scipy.stats.lognorm.pdf",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.set_cmap",
"matplotlib.pyplot.subplots",
"scipy.stats.kstest",
"numpy.size",
"ma... | [((598, 686), 'pandas.read_csv', 'pd.read_csv', (['infile'], {'encoding': '"""utf-8"""', 'index_col': 'None', 'header': '(0)', 'lineterminator': '"""\n"""'}), "(infile, encoding='utf-8', index_col=None, header=0,\n lineterminator='\\n')\n", (609, 686), True, 'import pandas as pd\n'), ((1883, 1926), 'pandas.crosstab'... |
#!/usr/bin/python3
import configparser
import requests
from json import dumps, loads
from subprocess import Popen
from os import getcwd, path
import sys
CURRENT_PATH = getcwd()
repositoryName = sys.argv[1]
config = configparser.ConfigParser()
configPath = path.join(CURRENT_PATH,
'/'.join(__fil... | [
"os.getcwd",
"subprocess.Popen",
"configparser.ConfigParser",
"json.dumps"
] | [((170, 178), 'os.getcwd', 'getcwd', ([], {}), '()\n', (176, 178), False, 'from os import getcwd, path\n'), ((218, 245), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (243, 245), False, 'import configparser\n'), ((1543, 1574), 'subprocess.Popen', 'Popen', (["['git', 'clone', sshUrl]"], {})... |
import argparse
import configparser
import os
import sys
import catminer
def check_dir(path: str) -> bool:
"""Check if directory or folder exists.
Parameters
----------
path: str
Path to directory or file.
Returns
-------
bool
Returns true if the directory exists.
""... | [
"os.startfile",
"os.path.abspath",
"argparse.ArgumentParser",
"catminer.CATMiner",
"os.makedirs",
"os.path.isdir",
"os.getcwd",
"os.path.exists",
"configparser.ConfigParser",
"sys.exit"
] | [((333, 354), 'os.path.abspath', 'os.path.abspath', (['path'], {}), '(path)\n', (348, 354), False, 'import os\n'), ((918, 938), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (932, 938), False, 'import os\n'), ((1001, 1165), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""... |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
MAIL_SERVER = 'debugmail.io'
MAIL_PORT = 9025
MAIL_USE_TLS = True
MAIL_USERNAME = '<EMAIL>'
MAIL_PASSWORD = '<PASSWORD>'
APP_MAIL_SUBJECT_PREFIX = '[A... | [
"os.environ.get",
"os.path.dirname",
"os.path.join"
] | [((671, 706), 'os.path.join', 'os.path.join', (['basedir', '"""app/files/"""'], {}), "(basedir, 'app/files/')\n", (683, 706), False, 'import os\n'), ((36, 61), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (51, 61), False, 'import os\n'), ((78, 106), 'os.environ.get', 'os.environ.get', (['""... |
import os
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (
QVBoxLayout,
QTableWidget,
QHeaderView,
QTableWidgetItem,
QWidget
)
from cemu.utils import (
ishex
)
class MemoryMappingWidget(QWidget):
def __init__(self, *args, **kwargs):
super(MemoryMappingWidget, self).__in... | [
"PyQt5.QtWidgets.QTableWidgetItem",
"PyQt5.QtWidgets.QVBoxLayout"
] | [((344, 357), 'PyQt5.QtWidgets.QVBoxLayout', 'QVBoxLayout', ([], {}), '()\n', (355, 357), False, 'from PyQt5.QtWidgets import QVBoxLayout, QTableWidget, QHeaderView, QTableWidgetItem, QWidget\n'), ((1521, 1544), 'PyQt5.QtWidgets.QTableWidgetItem', 'QTableWidgetItem', (['entry'], {}), '(entry)\n', (1537, 1544), False, '... |
# ##############################################################################
# This file is part of Interdiode #
# #
# Copyright (C) 2020 <NAME> <<EMAIL>> #
# All Rights Reserved ... | [
"django.utils.module_loading.import_string",
"django.conf.urls.include",
"django.urls.path",
"django.views.i18n.JavaScriptCatalog.as_view",
"django.utils.module_loading.autodiscover_modules",
"df_websockets.load.load_celery",
"df_config.utils.get_view_from_string"
] | [((1548, 1612), 'django.views.i18n.JavaScriptCatalog.as_view', 'JavaScriptCatalog.as_view', ([], {'packages': 'settings.DF_JS_CATALOG_VIEWS'}), '(packages=settings.DF_JS_CATALOG_VIEWS)\n', (1573, 1612), False, 'from django.views.i18n import JavaScriptCatalog\n'), ((1633, 1677), 'django.urls.path', 'path', (['"""jsi18n/... |
import pandas as pd
import numpy as np
from MPGeneticSolver import MPGeneticSolver
class SolutionRunner:
def __init__(self, save_fname='solution.csv', verbosity=0):
self.save_fname = save_fname
self.verbosity = verbosity
self.log = []
self.running_avg = 0
self.n = 0
def solve_df(self, df, fir... | [
"pandas.Series",
"MPGeneticSolver.MPGeneticSolver"
] | [((359, 396), 'MPGeneticSolver.MPGeneticSolver', 'MPGeneticSolver', ([], {'early_stopping': '(False)'}), '(early_stopping=False)\n', (374, 396), False, 'from MPGeneticSolver import MPGeneticSolver\n'), ((1107, 1155), 'pandas.Series', 'pd.Series', (['flat_board'], {'index': 'solution_df.columns'}), '(flat_board, index=s... |
# Generated by Django 3.1.3 on 2021-01-13 09:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0049_auto_20210113_1518'),
]
operations = [
migrations.AlterField(
model_name='account',
name='gender',
... | [
"django.db.models.IntegerField"
] | [((335, 433), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'choices': "[(1, 'Male'), (2, 'Female'), (3, 'Prefer not to say')]", 'default': '(3)'}), "(choices=[(1, 'Male'), (2, 'Female'), (3,\n 'Prefer not to say')], default=3)\n", (354, 433), False, 'from django.db import migrations, models\n')] |
from numpy.lib.function_base import copy
import torch
class CopyBaseline:
def __init__(self):
pass
def __call__(self, batch):
correct = 0.0
predictions = []
for sequence, sequence_len in zip(batch["event_types"], batch["sequence_lengths"]):
for idx in range(sequence... | [
"torch.tensor"
] | [((617, 634), 'torch.tensor', 'torch.tensor', (['[0]'], {}), '([0])\n', (629, 634), False, 'import torch\n')] |
import socket
import sys
from ScreenHelper import ScreenHelper
class Client(object):
ip = "localhost"
port = 9999
screen_helper = ScreenHelper()
def __init__(self):
super(Client, self).__init__()
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.c... | [
"ScreenHelper.ScreenHelper",
"socket.socket"
] | [((148, 162), 'ScreenHelper.ScreenHelper', 'ScreenHelper', ([], {}), '()\n', (160, 162), False, 'from ScreenHelper import ScreenHelper\n'), ((243, 292), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (256, 292), False, 'import socket\n')] |
import tensorflow as tf
def cross_entropy(labels_tensor, logits_tensor):
diff = tf.nn.softmax_cross_entropy_with_logits_v2(logits=logits_tensor, labels=labels_tensor)
loss = tf.reduce_mean(diff)
return loss
| [
"tensorflow.nn.softmax_cross_entropy_with_logits_v2",
"tensorflow.reduce_mean"
] | [((86, 177), 'tensorflow.nn.softmax_cross_entropy_with_logits_v2', 'tf.nn.softmax_cross_entropy_with_logits_v2', ([], {'logits': 'logits_tensor', 'labels': 'labels_tensor'}), '(logits=logits_tensor, labels=\n labels_tensor)\n', (128, 177), True, 'import tensorflow as tf\n'), ((184, 204), 'tensorflow.reduce_mean', 't... |
import requests
import re
from BeautifulSoup import BeautifulSoup
class Show:
def __init__(self, name, url):
self.name = name
self.url = url
def name(self):
return self.name
def url(self):
return self.name
class Shows:
def __init__(self, name):
self.name = n... | [
"BeautifulSoup.BeautifulSoup",
"re.sub",
"requests.get",
"re.compile"
] | [((1432, 1476), 'requests.get', 'requests.get', (['"""http://www.tvseriesonline.pl"""'], {}), "('http://www.tvseriesonline.pl')\n", (1444, 1476), False, 'import requests\n'), ((1488, 1560), 'BeautifulSoup.BeautifulSoup', 'BeautifulSoup', (['page.content'], {'convertEntities': 'BeautifulSoup.HTML_ENTITIES'}), '(page.con... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'urunekleme.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import... | [
"PyQt5.QtWidgets.QComboBox",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QGroupBox",
"PyQt5.QtCore.QMetaObject.connectSlotsByName"
] | [((569, 594), 'PyQt5.QtWidgets.QGroupBox', 'QtWidgets.QGroupBox', (['Form'], {}), '(Form)\n', (588, 594), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((805, 841), 'PyQt5.QtWidgets.QGridLayout', 'QtWidgets.QGridLayout', (['self.groupBox'], {}), '(self.groupBox)\n', (826, 841), False, 'from PyQt5 import QtCor... |
from distutils.core import setup
setup(
name='luke',
version='1.0',
description='simple Web Crawler',
author='tzh',
author_email='<EMAIL>',
license='MIT',
packages=['luke'],
requires=['requests', 'pymongo']
)
| [
"distutils.core.setup"
] | [((34, 216), 'distutils.core.setup', 'setup', ([], {'name': '"""luke"""', 'version': '"""1.0"""', 'description': '"""simple Web Crawler"""', 'author': '"""tzh"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT"""', 'packages': "['luke']", 'requires': "['requests', 'pymongo']"}), "(name='luke', version='1.0', desc... |
"""solution.py"""
import math
import os
import random
import re
import sys
import time
from pynput.keyboard import Key, Controller
def diagonalDifference(arr):
"""
Time O(n) Iterate only 1 time
Space O(2n)
"""
n = len(arr)
l2r = []
r2l = []
for i in range(n):
l2r.append(arr[i... | [
"pynput.keyboard.Controller",
"os.listdir",
"time.time"
] | [((482, 504), 'os.listdir', 'os.listdir', (['input_path'], {}), '(input_path)\n', (492, 504), False, 'import os\n'), ((605, 617), 'pynput.keyboard.Controller', 'Controller', ([], {}), '()\n', (615, 617), False, 'from pynput.keyboard import Key, Controller\n'), ((841, 852), 'time.time', 'time.time', ([], {}), '()\n', (8... |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from lib.camera.camera import CameraInfoPacket, catesian2homogenous
import ipdb
import copy
import json
import numpy as np
from camera_augmentation import h36m_cameras_intrinsic_params
from camera_augmentation import init_camera_h36m... | [
"camera_augmentation.get_intrinsic",
"json.dump",
"copy.deepcopy",
"numpy.load",
"numpy.savez",
"lib.camera.camera.catesian2homogenous",
"os.path.dirname",
"camera_augmentation.rotate_camera",
"camera_augmentation.check_in_frame",
"camera_augmentation.camera_translation",
"lib.camera.camera.Came... | [((1249, 1267), 'camera_augmentation.init_camera_h36m', 'init_camera_h36m', ([], {}), '()\n', (1265, 1267), False, 'from camera_augmentation import init_camera_h36m, get_camera_pose, camera_translation, mkdirs\n'), ((1286, 1314), 'camera_augmentation.get_camera_pose', 'get_camera_pose', (['camera_info'], {}), '(camera_... |
# basics
from typing import List, Tuple, DefaultDict, Dict, Union
from collections import defaultdict
import pandas as pd
import numpy as np
# pytorch
import torch
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
#segnlp
from segnlp import utils
class DirLinkLabeler(nn.Module):
... | [
"pandas.DataFrame",
"numpy.zeros_like",
"segnlp.utils.np_cumsum_zero",
"torch.nn.functional.cross_entropy",
"segnlp.utils.ensure_numpy",
"torch.nn.Linear",
"torch.max",
"numpy.logical_or",
"numpy.repeat",
"segnlp.utils.init_weights",
"torch.logical_and"
] | [((1376, 1410), 'torch.nn.Linear', 'nn.Linear', (['input_size', 'output_size'], {}), '(input_size, output_size)\n', (1385, 1410), True, 'import torch.nn as nn\n'), ((1419, 1456), 'segnlp.utils.init_weights', 'utils.init_weights', (['self', 'weight_init'], {}), '(self, weight_init)\n', (1437, 1456), False, 'from segnlp ... |
#!/usr/bin/env python3
import datetime
import json
import os.path
import sys
from timeit import default_timer as timer
from typing import Dict, List, Set
from xml.etree import ElementTree
from mitmproxy.http import HTTPFlow
from mitmproxy.flow import Flow
from mitmproxy.io import FlowReader, tnetstring
from flowdeta... | [
"json.dump",
"json.load",
"json.loads",
"xml.etree.ElementTree.fromstring",
"timeit.default_timer",
"datetime.strptime",
"mitmproxy.io.FlowReader",
"mitmproxy.io.tnetstring.load",
"datetime.timedelta",
"flowdetails.PssFlowDetails"
] | [((7852, 7874), 'flowdetails.PssFlowDetails', 'PssFlowDetails', (['result'], {}), '(result)\n', (7866, 7874), False, 'from flowdetails import PssFlowDetails, ResponseStructure\n'), ((10328, 10335), 'timeit.default_timer', 'timer', ([], {}), '()\n', (10333, 10335), True, 'from timeit import default_timer as timer\n'), (... |
import cv2
import click
import os
@click.command()
@click.option('-i', '--indir', required=True, help='Input figure directory')
@click.option('-o', '--output', type=str, default=None, help='Output video path')
@click.option('-r', '--rate', type=int, default=10, help='Playback rate (images per second)')
def main(indir... | [
"cv2.putText",
"cv2.VideoWriter_fourcc",
"os.path.dirname",
"click.option",
"click.command",
"os.path.splitext",
"cv2.VideoWriter",
"cv2.destroyAllWindows",
"os.path.join",
"os.listdir"
] | [((37, 52), 'click.command', 'click.command', ([], {}), '()\n', (50, 52), False, 'import click\n'), ((54, 129), 'click.option', 'click.option', (['"""-i"""', '"""--indir"""'], {'required': '(True)', 'help': '"""Input figure directory"""'}), "('-i', '--indir', required=True, help='Input figure directory')\n", (66, 129),... |
import time
from selenium import webdriver
def main():
driver = webdriver.Chrome(executable_path='chromedriver.exe')
driver.get('https://www.google.com/')
time.sleep(2)
driver.find_element_by_name('q').send_keys('selenium')
input()
if __name__ == '__main__':
main() | [
"selenium.webdriver.Chrome",
"time.sleep"
] | [((69, 121), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'executable_path': '"""chromedriver.exe"""'}), "(executable_path='chromedriver.exe')\n", (85, 121), False, 'from selenium import webdriver\n'), ((168, 181), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (178, 181), False, 'import time\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "SAI"
__license__ = "GPLv3"
__email__ = "<EMAIL>"
__status__ = "Dev"
from aioconsole import ainput
from ipaddress import ip_address, ip_network
from collections import namedtuple
from aiofiles import open as aiofiles_open
from os import path
import ujson
impor... | [
"asyncio.gather",
"aioconsole.ainput",
"ipaddress.ip_network",
"asyncio.Semaphore",
"argparse.ArgumentParser",
"asyncio.get_event_loop",
"aiofiles.open",
"asyncio.Queue",
"asyncio.sleep",
"copy.copy",
"ipaddress.ip_address",
"os.path.isfile",
"collections.namedtuple",
"asyncio.create_subpr... | [((3520, 3539), 'copy.copy', 'copy.copy', (['settings'], {}), '(settings)\n', (3529, 3539), False, 'import copy\n'), ((3628, 3659), 'collections.namedtuple', 'namedtuple', (['"""Target"""', 'key_names'], {}), "('Target', key_names)\n", (3638, 3659), False, 'from collections import namedtuple\n'), ((4010, 4042), 'ipaddr... |
import logging
import numpy as np
import pandas as pd
from sklearn import linear_model
RESOURCE_DIR = '/home/lucasx/PycharmProjects/DataHouse/DataSet/'
logging.basicConfig(format='%(levelname)s:%(asctime)s:%(message)s \t', level=logging.INFO, filemode='a',
filename='loginfo.log')
def train_and_p... | [
"sklearn.externals.joblib.dump",
"numpy.concatenate",
"logging.basicConfig",
"pandas.read_excel",
"logging.info",
"numpy.array",
"sklearn.externals.joblib.load",
"numpy.array_split",
"sklearn.linear_model.Lasso"
] | [((154, 286), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s:%(asctime)s:%(message)s \t"""', 'level': 'logging.INFO', 'filemode': '"""a"""', 'filename': '"""loginfo.log"""'}), "(format='%(levelname)s:%(asctime)s:%(message)s \\t',\n level=logging.INFO, filemode='a', filename='loginfo.... |
# Copyright 2022 Amazon.com, Inc. or its affiliates
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | [
"aws_ddk_core.resources.S3Factory.bucket",
"aws_cdk.assertions.Template.from_stack",
"pathlib.Path",
"aws_ddk_core.pipelines.Pipeline",
"aws_ddk_core.stages.S3EventStage"
] | [((964, 1039), 'aws_ddk_core.resources.S3Factory.bucket', 'S3Factory.bucket', ([], {'scope': 'test_stack', 'id': '"""dummy-bucket"""', 'environment_id': '"""dev"""'}), "(scope=test_stack, id='dummy-bucket', environment_id='dev')\n", (980, 1039), False, 'from aws_ddk_core.resources import S3Factory\n'), ((1093, 1243), '... |
from flask import Response
from flask.blueprints import Blueprint
import logging
from flask_login import login_required, current_user
from flask.templating import render_template
from flask.globals import request
from flask.helpers import flash, url_for, make_response
from waitlist.blueprints.settings import add_menu_... | [
"waitlist.permissions.perm_manager.define_permission",
"flask_login.current_user.get_eve_id",
"datetime.datetime.utcnow",
"flask_babel.lazy_gettext",
"flask.templating.render_template",
"waitlist.base.db.session.commit",
"flask.abort",
"flask.helpers.url_for",
"datetime.timedelta",
"waitlist.stora... | [((599, 626), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (616, 626), False, 'import logging\n'), ((639, 670), 'flask.blueprints.Blueprint', 'Blueprint', (['"""feedback"""', '__name__'], {}), "('feedback', __name__)\n", (648, 670), False, 'from flask.blueprints import Blueprint\n'), ((... |
from .. import moment
from .. import mhealth_format as mh
import numpy as np
import pkg_resources
import pandas as pd
from loguru import logger
def _get_annotation_durations(annot_df):
durations = annot_df.groupby(annot_df.columns[3]).apply(
lambda rows: np.sum(rows.iloc[:, 2] - rows.iloc[:, 1]))
retu... | [
"numpy.sum",
"pandas.DataFrame.from_dict",
"pandas.read_csv",
"loguru.logger.warning",
"pkg_resources.resource_filename",
"numpy.timedelta64"
] | [((4347, 4419), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""arus"""', '"""spades_lab/task_class_map.csv"""'], {}), "('arus', 'spades_lab/task_class_map.csv')\n", (4378, 4419), False, 'import pkg_resources\n'), ((4440, 4465), 'pandas.read_csv', 'pd.read_csv', (['map_filepath'], {}), '(map... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 24 13:31:37 2019
@author: gsolana
Based on:
https://github.com/sam-cox/pytides/wiki/How-to-make-your-own-Tide-Table-using-Python-and-Pytides
https://ocefpaf.github.io/python4oceanographers/blog/2014/07/07/pytides/
"""
import csv
import numpy as np... | [
"pandas.DataFrame",
"matplotlib.pyplot.subplot",
"pytides.tide.Tide.decompose",
"csv.reader",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"datetime.datetime.strptime",
"pandas.to_datetime",
"numpy.array",
"datetime.timedelta",
"matplotlib.pyplot.savefig"
] | [((828, 848), 'csv.reader', 'csv.reader', (['csv_file'], {}), '(csv_file)\n', (838, 848), False, 'import csv\n'), ((1731, 1770), 'csv.reader', 'csv.reader', (['csv_file2011'], {'delimiter': '""","""'}), "(csv_file2011, delimiter=',')\n", (1741, 1770), False, 'import csv\n'), ((2620, 2795), 'pandas.read_csv', 'read_csv'... |
#!/usr/bin/env python3
'''
Code by <NAME>, <<EMAIL>>
based on "How to Share a Secret" by <NAME>
Published by :Communications of the ACM
November 1979, Volume 22, Num. 11
'''
import numpy as np
import random
def split_secret(secret, k, n):
'''
Secret in an integer
k is the minimum number of keys to get ... | [
"numpy.linalg.solve",
"numpy.array",
"random.randrange"
] | [((1611, 1622), 'numpy.array', 'np.array', (['A'], {}), '(A)\n', (1619, 1622), True, 'import numpy as np\n'), ((1631, 1642), 'numpy.array', 'np.array', (['D'], {}), '(D)\n', (1639, 1642), True, 'import numpy as np\n'), ((1651, 1672), 'numpy.linalg.solve', 'np.linalg.solve', (['a', 'd'], {}), '(a, d)\n', (1666, 1672), T... |
import cv2
import pdb
def computeFeatures(image_data):
# static thread_local Ptr<ORB> detector = cv::ORB::create(2000);
# detector->(img, noArray(), keypoints, descriptors);
# cout << "Found " << keypoints.size() << " ORB features on image " << id << endl;
orb = cv2.ORB_create(nfeatures=500, s... | [
"cv2.ORB_create",
"cv2.drawMatches"
] | [((289, 348), 'cv2.ORB_create', 'cv2.ORB_create', ([], {'nfeatures': '(500)', 'scoreType': 'cv2.ORB_FAST_SCORE'}), '(nfeatures=500, scoreType=cv2.ORB_FAST_SCORE)\n', (303, 348), False, 'import cv2\n'), ((699, 872), 'cv2.drawMatches', 'cv2.drawMatches', (["img1['img']", "img1['keypoints']", "img2['img']", "img2['keypoin... |
from antelope import ExchangeInterface, EntityNotFound
from .basic import BasicImplementation
class ExchangeImplementation(BasicImplementation, ExchangeInterface):
"""
This provides access to detailed exchange values and computes the exchange relation.
Creates no additional requirements on the archive.
... | [
"antelope.EntityNotFound"
] | [((1337, 1360), 'antelope.EntityNotFound', 'EntityNotFound', (['process'], {}), '(process)\n', (1351, 1360), False, 'from antelope import ExchangeInterface, EntityNotFound\n')] |
'''
Differentiable transform for parameters that are non-negative and sum to one.
Common parameter: log_pi_K : element-wise log of K-vector that is non-negative and sums to one
Unconstrained parameter: rho_K : real valued vector of size K
Transform from unconstrained to constrained:
log_pi_K = rho_K - logsumexp(rho_... | [
"autograd.scipy.special.logsumexp"
] | [((1377, 1393), 'autograd.scipy.special.logsumexp', 'logsumexp', (['rho_K'], {}), '(rho_K)\n', (1386, 1393), False, 'from autograd.scipy.special import logsumexp\n')] |
# project
import random
import string
print(random.randint(5,10))
letters=string.ascii_lowercase
print(letters)
URLS_DB={}
def get_short_url(url):
# Convert a long url to short url and save in the database
l=random.randint(4,6)
short_url="as.in/"
for i in range(l):
short_url+=random.choice(lette... | [
"random.choice",
"random.randint"
] | [((44, 65), 'random.randint', 'random.randint', (['(5)', '(10)'], {}), '(5, 10)\n', (58, 65), False, 'import random\n'), ((216, 236), 'random.randint', 'random.randint', (['(4)', '(6)'], {}), '(4, 6)\n', (230, 236), False, 'import random\n'), ((301, 323), 'random.choice', 'random.choice', (['letters'], {}), '(letters)\... |
#coding=utf-8
#pickle腌制过程
import pickle
#开始腌制,使用dumps(object)将对象序列化
messageA=["hello","Challenger","CY"]
messageB=pickle.dumps(messageA)
print(messageB)
#loads(object)将数据(对象和类型)都原样恢复
messageC=pickle.loads(messageB)
print(messageC)
#使用dump(object,file)将数据序列化到文件中
messageD=("hello","Challenger","CY")
file1=file("1.p... | [
"pickle.loads",
"pickle.dump",
"pickle.load",
"pickle.dumps"
] | [((118, 140), 'pickle.dumps', 'pickle.dumps', (['messageA'], {}), '(messageA)\n', (130, 140), False, 'import pickle\n'), ((197, 219), 'pickle.loads', 'pickle.loads', (['messageB'], {}), '(messageB)\n', (209, 219), False, 'import pickle\n'), ((330, 358), 'pickle.dump', 'pickle.dump', (['messageD', 'file1'], {}), '(messa... |
#data visualization
import plotting as plt
#data retrieval
import Market_Data as md
#Create Dashboard
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
from datetime import date
today = date.to... | [
"plotting.financials_table",
"plotting.volume_plot",
"dash.Dash",
"dash_html_components.Div",
"dash.dependencies.State",
"datetime.datetime.now",
"plotting.stats_table",
"dash.dependencies.Output",
"plotting.stock_plot",
"dash_core_components.DatePickerRange",
"datetime.date.today",
"datetime.... | [((667, 745), 'dash.Dash', 'dash.Dash', ([], {'external_stylesheets': '[Dark_Mode]', 'suppress_callback_exceptions': '(True)'}), '(external_stylesheets=[Dark_Mode], suppress_callback_exceptions=True)\n', (676, 745), False, 'import dash\n'), ((421, 444), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n'... |
from django.urls import path, include
from sample1.views import HomePageView
urlpatterns = [
path('', HomePageView.as_view(), name='home')
] | [
"sample1.views.HomePageView.as_view"
] | [((113, 135), 'sample1.views.HomePageView.as_view', 'HomePageView.as_view', ([], {}), '()\n', (133, 135), False, 'from sample1.views import HomePageView\n')] |
import unittest
from shared.common.comparison_diagnostic import ComparisonDiagnostic
class TestComparisonDiagnostic(unittest.TestCase):
def setUp(self):
self.comparison_1 = ComparisonDiagnostic('comparison_1', [1,2,3], [[2,2,2], [2,2,2]],
'ref_1', ['test_1a', 't... | [
"unittest.main",
"shared.common.comparison_diagnostic.ComparisonDiagnostic"
] | [((813, 828), 'unittest.main', 'unittest.main', ([], {}), '()\n', (826, 828), False, 'import unittest\n'), ((187, 295), 'shared.common.comparison_diagnostic.ComparisonDiagnostic', 'ComparisonDiagnostic', (['"""comparison_1"""', '[1, 2, 3]', '[[2, 2, 2], [2, 2, 2]]', '"""ref_1"""', "['test_1a', 'test_1b']"], {}), "('com... |
import socket
address = '127.0.0.1'
port = 47011
socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket.connect((address, port))
socketf = socket.makefile(mode='rw')
socketf.write('Hello, World!\n')
socketf.flush()
print(socketf.readline()) | [
"socket.socket",
"socket.makefile",
"socket.connect"
] | [((60, 109), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (73, 109), False, 'import socket\n'), ((110, 141), 'socket.connect', 'socket.connect', (['(address, port)'], {}), '((address, port))\n', (124, 141), False, 'import socket\n'), ((152, ... |
#imports to get the files
import os
import sys
import openpyxl
import pandas as pd
from test_path import AbbVie_path, AbbVie_ATM_path
parent_path = os.path.abspath(os.pardir)
path = os.path.join(parent_path,'ma_option_vol')
#adds the file path for the ma_options_vol module to the path that python will search in order t... | [
"sys.path.append",
"os.path.abspath",
"os.path.join",
"create_atm_vol_series.create_average_vol_sheet"
] | [((148, 174), 'os.path.abspath', 'os.path.abspath', (['os.pardir'], {}), '(os.pardir)\n', (163, 174), False, 'import os\n'), ((182, 224), 'os.path.join', 'os.path.join', (['parent_path', '"""ma_option_vol"""'], {}), "(parent_path, 'ma_option_vol')\n", (194, 224), False, 'import os\n'), ((339, 360), 'sys.path.append', '... |
import numpy as np
id = None
with open('set_splits/bboxes_train_val_test_split_3buckets.csv', 'r') as bboxes:
count_boxes = []
boxes = 0
for line in bboxes:
filename, x1, y1, x2, y2, class_name, bucket, set = line.strip().split(',')
new_id = filename.split('_')[0]
if no... | [
"numpy.mean",
"numpy.array"
] | [((542, 563), 'numpy.array', 'np.array', (['count_boxes'], {}), '(count_boxes)\n', (550, 563), True, 'import numpy as np\n'), ((574, 589), 'numpy.mean', 'np.mean', (['np_arr'], {}), '(np_arr)\n', (581, 589), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2019 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Pytest configuration."""
from __future__ import absolute_import, print_function
... | [
"invenio_records.InvenioRecords",
"invenio_indexer.InvenioIndexer",
"invenio_db.db.session.remove",
"shutil.rmtree",
"invenio_records_files.api.Record.create",
"pytest.yield_fixture",
"invenio_db.db.create_all",
"tempfile.mkdtemp",
"invenio_files_rest.models.Location.query.delete",
"invenio_db.Inv... | [((949, 971), 'pytest.yield_fixture', 'pytest.yield_fixture', ([], {}), '()\n', (969, 971), False, 'import pytest\n'), ((1806, 1828), 'pytest.yield_fixture', 'pytest.yield_fixture', ([], {}), '()\n', (1826, 1828), False, 'import pytest\n'), ((2066, 2082), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (2080, 208... |
import numpy as np
from numpy.linalg import norm
from funcs.general_functions import *
from Topologies.Icosahedron import getNewBaseIcosahedron, subdivide
from funcs.general_functions import getFlatAngle
LABEL = "Truncated Icosahedron"
OPERATOR = "mesh.create_truncated_icosahedron"
# create operator
class MESH_OT_... | [
"Topologies.Icosahedron.subdivide",
"numpy.cross",
"numpy.linalg.norm",
"numpy.array",
"numpy.dot",
"Topologies.Icosahedron.getNewBaseIcosahedron",
"funcs.general_functions.getFlatAngle"
] | [((1778, 1807), 'Topologies.Icosahedron.getNewBaseIcosahedron', 'getNewBaseIcosahedron', (['radius'], {}), '(radius)\n', (1799, 1807), False, 'from Topologies.Icosahedron import getNewBaseIcosahedron, subdivide\n'), ((1871, 1904), 'Topologies.Icosahedron.subdivide', 'subdivide', (['bm', 'iterations', 'radius'], {}), '(... |
from django.contrib import admin
from api.models import Restaurant
class RestaurantAdmin(admin.ModelAdmin):
list_display = ('name', )
admin.site.register(Restaurant, RestaurantAdmin) | [
"django.contrib.admin.site.register"
] | [((144, 192), 'django.contrib.admin.site.register', 'admin.site.register', (['Restaurant', 'RestaurantAdmin'], {}), '(Restaurant, RestaurantAdmin)\n', (163, 192), False, 'from django.contrib import admin\n')] |
from honeybee_schema.energy.programtype import ProgramTypeAbridged, ProgramType
import os
# target folder where all of the samples live
root = os.path.dirname(os.path.dirname(__file__))
target_folder = os.path.join(root, 'samples', 'program_type')
def test_program_type_abridged_plenum():
file_path = os.path.join... | [
"honeybee_schema.energy.programtype.ProgramType.parse_file",
"os.path.dirname",
"os.path.join",
"honeybee_schema.energy.programtype.ProgramTypeAbridged.parse_file"
] | [((203, 248), 'os.path.join', 'os.path.join', (['root', '"""samples"""', '"""program_type"""'], {}), "(root, 'samples', 'program_type')\n", (215, 248), False, 'import os\n'), ((160, 185), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (175, 185), False, 'import os\n'), ((308, 372), 'os.path.j... |
"""
2016 Day 18
https://adventofcode.com/2016/day/18
"""
from typing import Sequence
import aocd # type: ignore
Line = Sequence[int]
TRAP_COMBOS = {
(False, False, True),
(True, False, False),
(False, True, True),
(True, True, False),
}
def is_safe(index: int, line: Line) -> bool:
"""
Retu... | [
"aocd.get_data"
] | [((1229, 1261), 'aocd.get_data', 'aocd.get_data', ([], {'year': '(2016)', 'day': '(18)'}), '(year=2016, day=18)\n', (1242, 1261), False, 'import aocd\n')] |
from fastapi import Depends, FastAPI
from .config import get_settings, Settings
from .routers import jobs, debug
from .database import database
app = FastAPI()
@app.on_event("startup")
async def startup():
await database.connect()
@app.on_event("shutdown")
async def shutdown():
await database.disconnect(... | [
"fastapi.Depends",
"fastapi.FastAPI"
] | [((153, 162), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (160, 162), False, 'from fastapi import Depends, FastAPI\n'), ((445, 466), 'fastapi.Depends', 'Depends', (['get_settings'], {}), '(get_settings)\n', (452, 466), False, 'from fastapi import Depends, FastAPI\n')] |
import datetime
import random
import string
from django.db import models
class Parameter(models.Model):
name = models.CharField(max_length=40)
description = models.CharField(max_length=200, blank=True)
notes = models.TextField(blank=True, default='')
class Meta:
ordering = ['name']
d... | [
"django.db.models.TextField",
"django.db.models.URLField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"random.choice",
"django.db.models.IntegerField",
"django.db.models.DateField"
] | [((117, 148), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(40)'}), '(max_length=40)\n', (133, 148), False, 'from django.db import models\n'), ((167, 211), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'blank': '(True)'}), '(max_length=200, blank=True)\n', (183... |
from types import SimpleNamespace
from random import choice, random, randint
import pytest
import lark
import os
from pathlib import Path
from lark import Token
TOKEN_MAP = {
"ID": "IDENTIFIER",
"INT": "INTEGER",
"EQ": "EQUAL",
"DIV": "SLASH",
}
EXEMPLOS = """
main = f ( returns integer ) 42
ID EQ F L... | [
"pytest.mark.parametrize",
"pytest.raises",
"random.randint",
"lark.Token"
] | [((729, 768), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ex"""', 'EXEMPLOS'], {}), "('ex', EXEMPLOS)\n", (752, 768), False, 'import pytest\n'), ((1289, 1313), 'pytest.raises', 'pytest.raises', (['Exception'], {}), '(Exception)\n', (1302, 1313), False, 'import pytest\n'), ((1145, 1168), 'lark.Token', 'T... |
import psycopg2
import pytest
from portal.db import get_db
from portal.grades import get_grades, grade_calc
# Join Table - To View
# SELECT a.name, g.points_earned a.points
# FROM assignments a, grades g
# WHERE g.assignment_id = a.id;
# Join Table - If Course ID is needed
# SELECT a.course_id, a.section, a.name, g.... | [
"portal.grades.grade_calc",
"portal.db.get_db",
"portal.grades.get_grades"
] | [((1416, 1424), 'portal.db.get_db', 'get_db', ([], {}), '()\n', (1422, 1424), False, 'from portal.db import get_db\n'), ((1992, 2000), 'portal.db.get_db', 'get_db', ([], {}), '()\n', (1998, 2000), False, 'from portal.db import get_db\n'), ((2723, 2736), 'portal.grades.get_grades', 'get_grades', (['(1)'], {}), '(1)\n', ... |
# -*- coding: utf-8 -*-
import sys
import msgpack
sys.path.append("/opt/drch_spider/spider/finace")
from finace.utils.redis_db import RedisClient
from finace.utils.rong_city import SpiderCity
class RongSpider(object):
redis_client = RedisClient().redis_client()
city = SpiderCity()
name = 'rong360_list'
... | [
"sys.path.append",
"finace.utils.rong_city.SpiderCity",
"finace.utils.redis_db.RedisClient",
"msgpack.unpackb",
"msgpack.packb"
] | [((51, 100), 'sys.path.append', 'sys.path.append', (['"""/opt/drch_spider/spider/finace"""'], {}), "('/opt/drch_spider/spider/finace')\n", (66, 100), False, 'import sys\n'), ((280, 292), 'finace.utils.rong_city.SpiderCity', 'SpiderCity', ([], {}), '()\n', (290, 292), False, 'from finace.utils.rong_city import SpiderCit... |
from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
class Movies(models.Model):
title = models.CharField(max_length=255)
duration = models.CharField(max_length=255)
premiere = models.CharField(max_length=255)
classification = models.IntegerField()
s... | [
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.core.validators.MinValueValidator",
"django.db.models.BooleanField",
"django.db.models.IntegerField",
"django.core.validators.MaxValueValidator"
] | [((143, 175), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (159, 175), False, 'from django.db import models\n'), ((191, 223), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (207, 223), False, 'from django.d... |
# This file is public domain, it can be freely copied without restrictions.
# SPDX-License-Identifier: CC0-1.0
import numpy as np
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import FallingEdge, Timer
import sys
sys.path.append('../../../py/')
import pdm
WINDOW_LEN = 250
def get_msg(i, receive... | [
"sys.path.append",
"cocotb.clock.Clock",
"pdm.pcm_to_pdm_pwm",
"cocotb.triggers.Timer",
"cocotb.test",
"cocotb.triggers.FallingEdge",
"numpy.random.randint",
"numpy.linspace",
"pdm.pdm_to_pcm",
"numpy.cos"
] | [((236, 267), 'sys.path.append', 'sys.path.append', (['"""../../../py/"""'], {}), "('../../../py/')\n", (251, 267), False, 'import sys\n'), ((2134, 2147), 'cocotb.test', 'cocotb.test', ([], {}), '()\n', (2145, 2147), False, 'import cocotb\n'), ((502, 522), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'n'], {}), '(0... |
import numpy as np
from numpy.polynomial import polynomial as poly
import scipy.signal as signal
import matplotlib.pyplot as plt
# Component values
GAIN = 1.0
R6 = 10e3
Ra = 100e3 * GAIN
R10b = 2e3 + 100e3 * (1-GAIN)
R11 = 15e3
R12 = 422e3
C3 = 0.1e-6
C5 = 68e-9
C7 = 82e-9
C8 = 390e-12
a0s = C7 * C8 * R10b * R11 *... | [
"numpy.logspace",
"matplotlib.pyplot.show",
"numpy.finfo"
] | [((613, 623), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (621, 623), True, 'import matplotlib.pyplot as plt\n'), ((503, 530), 'numpy.logspace', 'np.logspace', (['(1.3)', '(4.3)', '(1000)'], {}), '(1.3, 4.3, 1000)\n', (514, 530), True, 'import numpy as np\n'), ((590, 605), 'numpy.finfo', 'np.finfo', (['floa... |
from os import walk as walk_os
from os.path import exists
import cv2 as cv
from utils.disparity_map import save_disp_map, windowing_disp_map
from utils.utils import get_key_pts, get_resize_shape, parse_camera_c2, pre_processing, rectify_corresp_imgs
from utils.variables import MAX_DISP_LOOKUP, MEDIAN_FLT_SZ, MIN_DISP_... | [
"utils.utils.pre_processing",
"cv2.medianBlur",
"utils.utils.parse_camera_c2",
"os.walk",
"os.path.exists",
"utils.utils.get_key_pts",
"utils.utils.rectify_corresp_imgs",
"cv2.imread",
"utils.disparity_map.save_disp_map",
"utils.utils.get_resize_shape",
"utils.disparity_map.windowing_disp_map",
... | [((450, 469), 'os.walk', 'walk_os', (['WORKDIR_C2'], {}), '(WORKDIR_C2)\n', (457, 469), True, 'from os import walk as walk_os\n'), ((2096, 2118), 'cv2.destroyAllWindows', 'cv.destroyAllWindows', ([], {}), '()\n', (2116, 2118), True, 'import cv2 as cv\n'), ((634, 687), 'cv2.imread', 'cv.imread', (['f"""{c_dir}/{workdir}... |
#
# Copyright (c) 2015-2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from nfv_vim.database._database import database_create
from nfv_vim.database._database import database_get
def database_dump_data(filename):
"""
Dump database data to a file
"""
database = database_get()
... | [
"nfv_vim.database._database.database_get",
"nfv_vim.database._database.database_create"
] | [((302, 316), 'nfv_vim.database._database.database_get', 'database_get', ([], {}), '()\n', (314, 316), False, 'from nfv_vim.database._database import database_get\n'), ((452, 466), 'nfv_vim.database._database.database_get', 'database_get', ([], {}), '()\n', (464, 466), False, 'from nfv_vim.database._database import dat... |
import numpy as np
from sklearn.manifold import TSNE
from keyphrase.dataset import keyphrase_test_dataset
from keyphrase.dataset.keyphrase_test_dataset import testing_data_loader
from emolga.dataset.build_dataset import deserialize_from_file, serialize_to_file
from keyphrase.config import *
# We'll use matplotlib for... | [
"seaborn.set_style",
"numpy.set_printoptions",
"matplotlib.pyplot.show",
"sklearn.manifold.TSNE",
"keyphrase.dataset.keyphrase_test_dataset.load_additional_testing_data",
"matplotlib.pyplot.annotate",
"matplotlib.pyplot.scatter",
"numpy.asarray",
"emolga.dataset.build_dataset.deserialize_from_file",... | [((489, 514), 'seaborn.set_style', 'sns.set_style', (['"""darkgrid"""'], {}), "('darkgrid')\n", (502, 514), True, 'import seaborn as sns\n'), ((515, 539), 'seaborn.set_palette', 'sns.set_palette', (['"""muted"""'], {}), "('muted')\n", (530, 539), True, 'import seaborn as sns\n'), ((540, 612), 'seaborn.set_context', 'sn... |
from django.shortcuts import render
# Create your views here.
from django.shortcuts import render, get_object_or_404, redirect, reverse
from .models import *
from django.views.generic import ListView, DetailView
from django.contrib import messages
from django.http import HttpResponseRedirect
class KidListView(ListV... | [
"django.shortcuts.redirect",
"django.contrib.messages.error",
"django.shortcuts.get_object_or_404",
"django.shortcuts.render",
"django.contrib.messages.success",
"django.shortcuts.reverse"
] | [((921, 963), 'django.shortcuts.reverse', 'reverse', (['"""kids:kid_detail"""'], {'args': '(kid_id,)'}), "('kids:kid_detail', args=(kid_id,))\n", (928, 963), False, 'from django.shortcuts import render, get_object_or_404, redirect, reverse\n'), ((1102, 1135), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (... |
from typing import Union, Tuple, Optional
from torch_geometric.typing import (OptPairTensor, Adj, Size, NoneType,
OptTensor)
import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import Parameter
from torch_sparse import SparseTensor
# from torch_geomet... | [
"torch_geometric.nn.inits.zeros",
"torch_geometric.nn.inits.glorot",
"torch.nn.functional.dropout",
"torch.einsum",
"torch.Tensor",
"torch.arange",
"torch.nn.functional.leaky_relu",
"torch_geometric.utils.softmax"
] | [((4207, 4225), 'torch_geometric.nn.inits.glorot', 'glorot', (['self.lin_l'], {}), '(self.lin_l)\n', (4213, 4225), False, 'from torch_geometric.nn.inits import glorot, zeros\n'), ((4234, 4252), 'torch_geometric.nn.inits.glorot', 'glorot', (['self.lin_r'], {}), '(self.lin_r)\n', (4240, 4252), False, 'from torch_geometri... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import nlpregex.abs_graph.double_link
import nlpregex.abs_graph.node
import nlpregex.abs_graph.edge
import nlpregex.abs_graph.graph
import nlpregex.regular_language.fa
import nlpregex.regular_language.ast
from nlpregex.regular_language.sse_symbol_manager imp... | [
"nlpregex.regular_language.common_substring_reducer.CommonSubstringReducer",
"nlpregex.regular_language.common_subtree_reducer.CommonSubtreeReducer",
"nlpregex.regular_language.common_repetition_reducer.CommonRepetitionReducer",
"nlpregex.regular_language.sse_solver.SymbolicSimultaneousEquations",
"nlpregex... | [((3517, 3537), 'nlpregex.regular_language.sse_symbol_manager.sseSymbolManager', 'sseSymbolManager', (['fa'], {}), '(fa)\n', (3533, 3537), False, 'from nlpregex.regular_language.sse_symbol_manager import sseSymbolManager\n'), ((3937, 3968), 'nlpregex.regular_language.sse_solver.SymbolicSimultaneousEquations', 'Symbolic... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 expandtab number
################################################################################
#
# Copyright (c) 2018 Baidu.com, Inc. All Rights Reserved
#
################################################################################
""... | [
"qPyUtils.log.writer.init_log",
"pathlib.Path"
] | [((623, 848), 'qPyUtils.log.writer.init_log', 'writer.init_log', (['self.log_file_stem'], {'logger_name': '__name__', 'level': 'logging.INFO', 'show_logger_src': '(False)', 'fmt': '"""%(levelname)s: %(asctime)s: %(filename)s:%(lineno)d * %(thread)d %(message)s"""', 'datefmt': '"""%m-%d %H:%M:%S"""'}), "(self.log_file_s... |