code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
import json
import subprocess
import platform
import base64
import glob
from .__shared import CACHE_DIR, SCRIPT_DIR, concourse_context
STARTER_DIR = "starter"
PYTHON_DIR = "pythonpath"
class Task:
def __init__(self, fun, jobname, secret_manager, image_resource, script, inputs=[], timeout="5m", privile... | [
"json.dump",
"os.path.abspath",
"json.load",
"os.makedirs",
"os.path.basename",
"os.path.dirname",
"subprocess.check_output",
"platform.system",
"os.path.join"
] | [((1696, 1744), 'os.path.join', 'os.path.join', (['CACHE_DIR', 'jobname', "(name + '.json')"], {}), "(CACHE_DIR, jobname, name + '.json')\n", (1708, 1744), False, 'import os\n'), ((3869, 3895), 'os.path.abspath', 'os.path.abspath', (['dir_local'], {}), '(dir_local)\n', (3884, 3895), False, 'import os\n'), ((2363, 2394)... |
from pydriller import Repository
for commit in Repository('https://github.com/williamsartijose/Trabalho-Cadastro-de-Aluno.git').traverse_commits():
print(commit.hash)
print(commit.msg)
print(commit.author.name)
print("\n")
for file in commit.modified_files:
print(file.filename, ' ... | [
"pydriller.Repository"
] | [((50, 135), 'pydriller.Repository', 'Repository', (['"""https://github.com/williamsartijose/Trabalho-Cadastro-de-Aluno.git"""'], {}), "('https://github.com/williamsartijose/Trabalho-Cadastro-de-Aluno.git'\n )\n", (60, 135), False, 'from pydriller import Repository\n')] |
#!/usr/bin/python
import rospy
from std_msgs.msg import Float32, Bool
from sensor_msgs.msg import Joy
from geometry_msgs.msg import Vector3
from geometry_msgs.msg import Twist
from math import pi
class SpotMicroJoystickControl():
BUTTON_IDLE = 0
BUTTON_WALK = 1
BUTTON_STAND = 2
BUTTON_ANGLE = 3
... | [
"geometry_msgs.msg.Vector3",
"rospy.Subscriber",
"rospy.Publisher",
"geometry_msgs.msg.Twist",
"rospy.loginfo",
"rospy.init_node",
"rospy.spin",
"std_msgs.msg.Bool"
] | [((771, 780), 'geometry_msgs.msg.Vector3', 'Vector3', ([], {}), '()\n', (778, 780), False, 'from geometry_msgs.msg import Vector3\n'), ((912, 919), 'geometry_msgs.msg.Twist', 'Twist', ([], {}), '()\n', (917, 919), False, 'from geometry_msgs.msg import Twist\n'), ((1193, 1199), 'std_msgs.msg.Bool', 'Bool', ([], {}), '()... |
import FWCore.ParameterSet.Config as cms
options = cms.untracked.PSet(
FailPath = cms.untracked.vstring(),
IgnoreCompletely = cms.untracked.vstring(),
Rethrow = cms.untracked.vstring(),
SkipEvent = cms.untracked.vstring(),
allowUnscheduled = cms.obsolete.untracked.bool,
canDeleteEarly = cms.unt... | [
"FWCore.ParameterSet.Config.untracked.vstring",
"FWCore.ParameterSet.Config.untracked.string",
"FWCore.ParameterSet.Config.untracked.bool",
"FWCore.ParameterSet.Config.untracked.PSet",
"FWCore.ParameterSet.Config.untracked.uint32"
] | [((87, 110), 'FWCore.ParameterSet.Config.untracked.vstring', 'cms.untracked.vstring', ([], {}), '()\n', (108, 110), True, 'import FWCore.ParameterSet.Config as cms\n'), ((135, 158), 'FWCore.ParameterSet.Config.untracked.vstring', 'cms.untracked.vstring', ([], {}), '()\n', (156, 158), True, 'import FWCore.ParameterSet.C... |
import array
import random
import numpy as np
from deap import algorithms
from deap import base
from deap import creator
from deap import tools
# パラメータ定義テーブル(Ax仕様)
PARAMETERS = [
{
"name": "x1",
"type": "range",
"bounds": [-10.0, 10.0],
"value_type": "float",
},
{
... | [
"deap.base.Toolbox",
"deap.tools.Statistics",
"deap.creator.create",
"numpy.array",
"deap.algorithms.eaSimple",
"deap.tools.HallOfFame"
] | [((441, 480), 'numpy.array', 'np.array', (['[128, 64, 32, 16, 8, 4, 2, 1]'], {}), '([128, 64, 32, 16, 8, 4, 2, 1])\n', (449, 480), True, 'import numpy as np\n'), ((900, 959), 'deap.creator.create', 'creator.create', (['"""FitnessMin"""', 'base.Fitness'], {'weights': '(-1.0,)'}), "('FitnessMin', base.Fitness, weights=(-... |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Prefer setuptools over distutils
from setuptools import setup
from setuptools import find_packages
setup(
name="oiio",
version="PACKAGE_VERSION",
description="OpenI... | [
"setuptools.find_packages"
] | [((575, 600), 'setuptools.find_packages', 'find_packages', ([], {'exclude': '[]'}), '(exclude=[])\n', (588, 600), False, 'from setuptools import find_packages\n')] |
from .decorators import (
onlineChain,
)
import click
from peerplays.asset import Asset
from peerplays.exceptions import AssetDoesNotExistsException
from prettytable import PrettyTable
from .main import main
@main.command()
@click.pass_context
@onlineChain
def assets(ctx):
"List Assets"
MAX_ASSET = 10... | [
"click.echo",
"prettytable.PrettyTable"
] | [((526, 539), 'prettytable.PrettyTable', 'PrettyTable', ([], {}), '()\n', (537, 539), False, 'from prettytable import PrettyTable\n'), ((991, 1013), 'click.echo', 'click.echo', (['assetTable'], {}), '(assetTable)\n', (1001, 1013), False, 'import click\n')] |
"""
Module to process and analyse rheology data
containing stress ramps
Created: March 24th, 2020
Author: <NAME>
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
class Rstressramp():
"""
Class with the functions relevant to stress ramps
Main focus on extracting data from .csv f... | [
"matplotlib.pyplot.loglog",
"pandas.read_csv",
"numpy.logspace",
"numpy.isnan",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.interp",
"matplotlib.pyplot.fill_between",
"pandas.DataFrame",
"numpy.std",
"numpy.max",
"numpy.log10",
"matplotlib.pyplot.pause",
"numpy.min",
"matplotlib.pyp... | [((2099, 2142), 'pandas.read_csv', 'pd.read_csv', (['filename'], {'sep': 'sep', 'decimal': 'dec'}), '(filename, sep=sep, decimal=dec)\n', (2110, 2142), True, 'import pandas as pd\n'), ((5868, 5884), 'numpy.array', 'np.array', (['stress'], {}), '(stress)\n', (5876, 5884), True, 'import numpy as np\n'), ((5902, 5918), 'n... |
import logging
from PySide2.QtWidgets import QFrame, QLabel, QVBoxLayout, QHBoxLayout, QScrollArea, QLineEdit,\
QWidget
from PySide2.QtGui import QPainter, QBrush, QPen
from PySide2.QtCore import Qt, QSize
from ...config import Conf
from .qast_viewer import QASTViewer
l = logging.getLogger('ui.widgets.qregister_... | [
"PySide2.QtGui.QPainter",
"PySide2.QtCore.QSize",
"PySide2.QtWidgets.QScrollArea",
"PySide2.QtWidgets.QLabel",
"PySide2.QtWidgets.QVBoxLayout",
"PySide2.QtWidgets.QLineEdit",
"PySide2.QtGui.QPen",
"logging.getLogger",
"PySide2.QtWidgets.QHBoxLayout"
] | [((280, 328), 'logging.getLogger', 'logging.getLogger', (['"""ui.widgets.qregister_viewer"""'], {}), "('ui.widgets.qregister_viewer')\n", (297, 328), False, 'import logging\n'), ((1262, 1276), 'PySide2.QtGui.QPainter', 'QPainter', (['self'], {}), '(self)\n', (1270, 1276), False, 'from PySide2.QtGui import QPainter, QBr... |
# !/usr/bin/env python
# -- coding: utf-8 --
# @Time : 2020/10/28 16:41
# @Author : liumin
# @File : ICNet.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
__all__ = ["ICNet"]
def Conv1x1BN(in_channels,out_channels):
return nn.Sequential(
nn.Co... | [
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.randn",
"torch.nn.functional.adaptive_avg_pool2d",
"torchvision.models.resnet50",
"torch.nn.BatchNorm2d",
"torch.nn.functional.interpolate"
] | [((4958, 4985), 'torch.randn', 'torch.randn', (['(1)', '(3)', '(512)', '(512)'], {}), '(1, 3, 512, 512)\n', (4969, 4985), False, 'import torch\n'), ((315, 417), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': 'in_channels', 'out_channels': 'out_channels', 'kernel_size': '(1)', 'stride': '(1)', 'bias': '(False)'}),... |
import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy
from numpy.linalg import inv
from scipy.linalg import schur, sqrtm
import numpy as np
def invSqrt(a,b,c):
eps = 1e-12
mask = (b != 0)
r1 = mask * (c - a) / (2. * b + eps)
t1 = np.sign(r1) / (np.abs(r1) + np.sqrt(1. + r1... | [
"copy.deepcopy",
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.imshow",
"numpy.zeros",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.linalg.svd",
"numpy.array",
"numpy.sin",
"numpy.linspace",
"numpy.sign",
"numpy.matmul",
"numpy.cos",
"numpy.dia... | [((550, 564), 'numpy.sqrt', 'np.sqrt', (['(x * z)'], {}), '(x * z)\n', (557, 564), True, 'import numpy as np\n'), ((748, 764), 'numpy.zeros', 'np.zeros', (['(2, 3)'], {}), '((2, 3))\n', (756, 764), True, 'import numpy as np\n'), ((974, 1020), 'numpy.sqrt', 'np.sqrt', (['(A[0, 0] * A[1, 1] - A[1, 0] * A[0, 1])'], {}), '... |
# -*- coding: utf-8 -*-
# @Time : 2019/3/4 9:29
# @Author : Mr.Robot
# @Site :
# @File : secl2txt.py
# @Software: PyCharm
import struct
import os
# 拼音表偏移,
startPy = 0x1540;
# 汉语词组表偏移
startChinese = 0x2628;
# 全局拼音表
GPy_Table = {}
# 解析结果
# 元组(词频,拼音,中文词组)的列表
GTable = []
# 原始字节码转为字符串
def byte2str(data):
... | [
"os.path.join",
"os.listdir"
] | [((2765, 2793), 'os.path.join', 'os.path.join', (['in_path', 'src_f'], {}), '(in_path, src_f)\n', (2777, 2793), False, 'import os\n'), ((2676, 2695), 'os.listdir', 'os.listdir', (['in_path'], {}), '(in_path)\n', (2686, 2695), False, 'import os\n')] |
import functools
from typing import Iterable, List
__all__ = ['DocGroundtruthPair']
if False:
from . import Document
class DocGroundtruthPair:
"""
Helper class to expose common interface to the traversal logic of the BaseExecutable Driver.
It is important to note that it checks the matching structur... | [
"functools.wraps"
] | [((2577, 2596), 'functools.wraps', 'functools.wraps', (['fn'], {}), '(fn)\n', (2592, 2596), False, 'import functools\n')] |
# Copyright (c) 2021 PaddlePaddle Authors. 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-2.0
#
# Unless required by appli... | [
"sys.path.append",
"functools.partial",
"program_config.OpConfig",
"hypothesis.strategies.sampled_from",
"numpy.random.random",
"numpy.random.randint",
"hypothesis.strategies.integers",
"hypothesis.strategies.floats"
] | [((622, 643), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (637, 643), False, 'import sys\n'), ((1647, 1769), 'program_config.OpConfig', 'OpConfig', ([], {'type': '"""increment"""', 'inputs': "{'X': ['input_data']}", 'outputs': "{'Out': ['output_data']}", 'attrs': "{'step': step_data}"}), "(typ... |
from selenium.webdriver.support.select import Select
from model.contact import Contact
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def check_if_contacts_page(self):
wd = self.app.wd
if not (len(wd.find_elements_by_link_text("Logout")) > 0 and len(wd.find_ele... | [
"model.contact.Contact",
"re.search"
] | [((6617, 6821), 'model.contact.Contact', 'Contact', ([], {'firstname': 'firstname', 'lastname': 'lastname', 'id': 'id', 'homephone': 'homephone', 'workphone': 'workphone', 'mobilephone': 'mobilephone', 'secondaryphone': 'secondaryphone', 'email': 'email', 'email2': 'email2', 'email3': 'email3'}), '(firstname=firstname,... |
from dash.dependencies import Input, Output
from dash import dcc
from app import app
from dash import html
from layouts.home import home_layout
# create server
server = app.server
app.layout = html.Div([
dcc.Location(id='url', refresh=False),
html.Div(id='page-content')
])
@app.callback(Output('page-conten... | [
"layouts.home.home_layout",
"dash.html.Div",
"dash.dcc.Location",
"dash.dependencies.Input",
"app.app.run_server",
"dash.dependencies.Output"
] | [((301, 335), 'dash.dependencies.Output', 'Output', (['"""page-content"""', '"""children"""'], {}), "('page-content', 'children')\n", (307, 335), False, 'from dash.dependencies import Input, Output\n'), ((351, 375), 'dash.dependencies.Input', 'Input', (['"""url"""', '"""pathname"""'], {}), "('url', 'pathname')\n", (356... |
# from turtle import Turtle, Screen
# # accessed this way
# turtle = Turtle()
# # or
# from turtle import *
# # accessed this way
# Turtle()
# # or
# import turtle
# # accessed this way
# tim = turtle.Turtle()
# # or
# import turtle as tur
# # accessed this way
# tim = tur.Turtle()
# turtle.shape("turtle")
# t... | [
"turtle.Screen",
"turtle.Turtle"
] | [((882, 890), 'turtle.Turtle', 'Turtle', ([], {}), '()\n', (888, 890), False, 'from turtle import Turtle, Screen\n'), ((1142, 1150), 'turtle.Screen', 'Screen', ([], {}), '()\n', (1148, 1150), False, 'from turtle import Turtle, Screen\n')] |
import pytest
from polzybackend import create_app, models, db
from config import Config
from copy import deepcopy
import polzyFunctions
import os
if not os.path.basename(os.getcwd()) == "tests":
os.chdir(os.path.join(os.path.dirname(polzyFunctions.__file__), "tests"))
@pytest.fixture(scope="session", params=["pq... | [
"polzybackend.create_app",
"os.getcwd",
"os.path.dirname",
"polzybackend.db.session.remove",
"pytest.fixture",
"polzybackend.db.session.query"
] | [((277, 324), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""', 'params': "['pqa']"}), "(scope='session', params=['pqa'])\n", (291, 324), False, 'import pytest\n'), ((591, 609), 'polzybackend.create_app', 'create_app', (['Config'], {}), '(Config)\n', (601, 609), False, 'from polzybackend import create... |
import numpy as np
from sklearn.metrics import f1_score
def optimize_f1(x: float, y_true: np.ndarray, y_pred: np.ndarray) -> float:
return -f1_score(y_true, y_pred >= x)
| [
"sklearn.metrics.f1_score"
] | [((146, 175), 'sklearn.metrics.f1_score', 'f1_score', (['y_true', '(y_pred >= x)'], {}), '(y_true, y_pred >= x)\n', (154, 175), False, 'from sklearn.metrics import f1_score\n')] |
import datetime
import pytz
from django.conf import settings
from django.test import TestCase
from mock import ANY, patch
from periods import models as period_models
from periods.management.commands import notify_upcoming_period
from periods.tests.factories import FlowEventFactory
class TestCommand(TestCase):
E... | [
"periods.management.commands.notify_upcoming_period.Command",
"mock.patch",
"datetime.datetime",
"periods.models.FlowEvent.objects.all",
"periods.tests.factories.FlowEventFactory"
] | [((927, 980), 'mock.patch', 'patch', (['"""django.core.mail.EmailMultiAlternatives.send"""'], {}), "('django.core.mail.EmailMultiAlternatives.send')\n", (932, 980), False, 'from mock import ANY, patch\n'), ((1182, 1235), 'mock.patch', 'patch', (['"""django.core.mail.EmailMultiAlternatives.send"""'], {}), "('django.core... |
# Copyright (c) 2019 PaddlePaddle Authors. 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-2.0
#
# Unless required by appli... | [
"paddle.fluid.layers.reduce_min",
"paddle.fluid.initializer.Constant",
"numpy.sin",
"numpy.arange",
"paddle.fluid.layers.transpose",
"paddle.fluid.layers.softmax_with_cross_entropy",
"paddle.fluid.layers.concat",
"paddle.fluid.layers.reduce_sum",
"paddle.fluid.layers.greater_than",
"paddle.fluid.l... | [((1145, 1166), 'numpy.arange', 'np.arange', (['n_position'], {}), '(n_position)\n', (1154, 1166), True, 'import numpy as np\n'), ((1427, 1454), 'numpy.expand_dims', 'np.expand_dims', (['position', '(1)'], {}), '(position, 1)\n', (1441, 1454), True, 'import numpy as np\n'), ((1457, 1490), 'numpy.expand_dims', 'np.expan... |
#!/usr/bin/env python3
import re
def rearrange_name(name):
result = re.search(r"^([\w .]*), ([\w .]*)$", name)
if result == None:
return result
return "{} {}".format(result[2], result[1])
| [
"re.search"
] | [((70, 113), 're.search', 're.search', (['"""^([\\\\w .]*), ([\\\\w .]*)$"""', 'name'], {}), "('^([\\\\w .]*), ([\\\\w .]*)$', name)\n", (79, 113), False, 'import re\n')] |
#!/usr/bin/env python3
# To the extent possible under law, the libtcod maintainers have waived all
# copyright and related or neighboring rights for this example. This work is
# published from: United States.
# https://creativecommons.org/publicdomain/zero/1.0/
"""An demonstration of event handling using the tcod.even... | [
"tcod.event.wait",
"tcod.context.new"
] | [((522, 566), 'tcod.context.new', 'tcod.context.new', ([], {'width': 'WIDTH', 'height': 'HEIGHT'}), '(width=WIDTH, height=HEIGHT)\n', (538, 566), False, 'import tcod\n'), ((1074, 1091), 'tcod.event.wait', 'tcod.event.wait', ([], {}), '()\n', (1089, 1091), False, 'import tcod\n')] |
from django.urls import path, include
from rest_framework import routers
from . import views
router = routers.DefaultRouter()
router.register(r'js_error', views.JSErrorViewSet)
app_name = "js_error_logger"
urlpatterns = [
path('', include(router.urls)),
]
| [
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((105, 128), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (126, 128), False, 'from rest_framework import routers\n'), ((239, 259), 'django.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (246, 259), False, 'from django.urls import path, include\n')] |
from aiohttp import web
import tomodachi
from tomodachi.transport.http import http
@tomodachi.service
class HttpServiceOne(tomodachi.Service):
name = 'test_http1'
options = {
'http': {
'port': 54322,
}
}
@http('GET', r'/test/?')
async def test(self, request: web.Reques... | [
"tomodachi.transport.http.http"
] | [((252, 274), 'tomodachi.transport.http.http', 'http', (['"""GET"""', '"""/test/?"""'], {}), "('GET', '/test/?')\n", (256, 274), False, 'from tomodachi.transport.http import http\n'), ((522, 544), 'tomodachi.transport.http.http', 'http', (['"""GET"""', '"""/test/?"""'], {}), "('GET', '/test/?')\n", (526, 544), False, '... |
'''
Copyright (c) 2015 by <NAME>
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: <NAME>
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import multiprocessing as mp
class ForEach(obj... | [
"multiprocessing.Pool",
"multiprocessing.cpu_count"
] | [((378, 392), 'multiprocessing.cpu_count', 'mp.cpu_count', ([], {}), '()\n', (390, 392), True, 'import multiprocessing as mp\n'), ((413, 422), 'multiprocessing.Pool', 'mp.Pool', ([], {}), '()\n', (420, 422), True, 'import multiprocessing as mp\n')] |
#!/usr/bin/env python
"""
This file will create a config file for use with the
TRExFitter/TtHFitter package
*** REQUIRES PYTHON3 ***
author: <NAME> <<EMAIL>>
"""
import sys
import subprocess
import aidapy.meta
f = open('aida.config','w')
print('Job: "myAIDAfit"', file=f)
print(' CmeLabel: "13 TeV"', file=f)
print... | [
"subprocess.call"
] | [((10781, 10828), 'subprocess.call', 'subprocess.call', (['"""rm -rf myAIDAfit"""'], {'shell': '(True)'}), "('rm -rf myAIDAfit', shell=True)\n", (10796, 10828), False, 'import subprocess\n')] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'AleksNeStu'
# Task05-02:
# Create simple threaded http server like in *task02-01.py* which can be extended using decorator-based plug-in model for handing requests.
# Example:
# ```python
# >>> from datetime import datetime
# >>> from server import run, get_han... | [
"EPAM.task02.Get_handler",
"datetime.datetime.now",
"EPAM.task02.Server"
] | [((636, 656), 'EPAM.task02.Get_handler', 'Get_handler', (['"""/date"""'], {}), "('/date')\n", (647, 656), False, 'from EPAM.task02 import Get_handler, Server\n'), ((680, 694), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (692, 694), False, 'from datetime import datetime\n'), ((728, 736), 'EPAM.task02.Serv... |
import re
from epcpy.epc_schemes.base_scheme import EPCScheme
from epcpy.utils.common import ConvertException
from epcpy.utils.regex import IMOVN_URI
IMOVN_URI_REGEX = re.compile(IMOVN_URI)
class IMOVN(EPCScheme):
"""IMOVN EPC scheme implementation.
IMOVN pure identities are of the form:
urn:epc:id... | [
"epcpy.utils.common.ConvertException",
"re.compile"
] | [((170, 191), 're.compile', 're.compile', (['IMOVN_URI'], {}), '(IMOVN_URI)\n', (180, 191), False, 'import re\n'), ((616, 672), 'epcpy.utils.common.ConvertException', 'ConvertException', ([], {'message': 'f"""Invalid IMOVN URI {epc_uri}"""'}), "(message=f'Invalid IMOVN URI {epc_uri}')\n", (632, 672), False, 'from epcpy... |
from __future__ import unicode_literals
import urlparse
class ContentType(object):
def detect(self, url, content_type):
pass
def render(self):
return None
class Video(ContentType):
def detect(self, url, content_type):
return 'video'
class Image(ContentType):
def detect(sel... | [
"urlparse.urlparse",
"urlparse.parse_qs"
] | [((450, 472), 'urlparse.urlparse', 'urlparse.urlparse', (['url'], {}), '(url)\n', (467, 472), False, 'import urlparse\n'), ((489, 522), 'urlparse.parse_qs', 'urlparse.parse_qs', (['url_data.query'], {}), '(url_data.query)\n', (506, 522), False, 'import urlparse\n'), ((684, 706), 'urlparse.urlparse', 'urlparse.urlparse'... |
import numpy as np
from scipy import optimize
import logging
logger = logging.getLogger(__name__)
def scipyFit(x, y, method,p0 = None,boundaries = (-np.inf, np.inf),sigma = None):
if boundaries is not None and len(boundaries) != 2:
raise ValueError("Boundaries need to be a two 2D tuple")
if p0 is not... | [
"numpy.sum",
"numpy.zeros",
"scipy.optimize.curve_fit",
"numpy.append",
"numpy.sinc",
"numpy.sin",
"numpy.arange",
"numpy.exp",
"numpy.diag",
"logging.getLogger",
"numpy.sqrt"
] | [((71, 98), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (88, 98), False, 'import logging\n'), ((519, 590), 'scipy.optimize.curve_fit', 'optimize.curve_fit', (['method', 'x', 'y'], {'p0': 'p0', 'bounds': 'boundaries', 'sigma': 'sigma'}), '(method, x, y, p0=p0, bounds=boundaries, sigma=s... |
from linkace_cli.api.base import APIBase
from linkace_cli import models
class Lists(APIBase):
"""CRUD interaction for all things list-based"""
def get(self, id: int = None, order_by: models.OrderBy = None, order_dir: models.OrderDir = None):
"""
Get all lists or a single list's details. The or... | [
"linkace_cli.models.LinksPagination",
"linkace_cli.models.List",
"linkace_cli.models.ListsPagination"
] | [((999, 1012), 'linkace_cli.models.List', 'models.List', ([], {}), '()\n', (1010, 1012), False, 'from linkace_cli import models\n'), ((1408, 1432), 'linkace_cli.models.LinksPagination', 'models.LinksPagination', ([], {}), '()\n', (1430, 1432), False, 'from linkace_cli import models\n'), ((714, 738), 'linkace_cli.models... |
"""
Neural net encoder/decoder (seperate)
(Not sure if I still want this...)
"""
from __future__ import absolute_import
from __future__ import division
import random
import numpy as np
import tensorflow as tf
from tensorflow.python.framework import ops
from tensorflow.python.framework import dtypes
from tensorflow.p... | [
"tensorflow.reduce_sum",
"tensorflow.reshape",
"tensorflow.Variable",
"tensorflow.python.ops.math_ops.tanh",
"tensorflow.reduce_max",
"tensorflow.get_variable",
"tensorflow.python.ops.rnn_cell._linear",
"tensorflow.to_int64",
"tensorflow.placeholder",
"tensorflow.cast",
"tensorflow.to_int32",
... | [((2771, 2802), 'tensorflow.Variable', 'tf.Variable', (['(0)'], {'trainable': '(False)'}), '(0, trainable=False)\n', (2782, 2802), True, 'import tensorflow as tf\n'), ((2829, 2855), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {}), '(tf.float32)\n', (2843, 2855), True, 'import tensorflow as tf\n'), ((28... |
import os
import warnings
import logging
import numpy as np
from activitysim.core import inject
import pandas as pd
import yaml
from activitysim.core import pipeline
from activitysim.core import config
warnings.filterwarnings('ignore', category=pd.io.pytables.PerformanceWarning)
pd.options.mode.chained_assignment ... | [
"pandas.HDFStore",
"warnings.filterwarnings",
"os.path.exists",
"activitysim.core.inject.injectable",
"os.path.join",
"activitysim.core.pipeline.close_on_exit",
"logging.getLogger"
] | [((207, 284), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'pd.io.pytables.PerformanceWarning'}), "('ignore', category=pd.io.pytables.PerformanceWarning)\n", (230, 284), False, 'import warnings\n'), ((337, 364), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__n... |
# Copyright 2008-2018 pydicom authors. See LICENSE file for details.
"""
Use the jpeg_ls (CharPyLS) python package to decode pixel transfer syntaxes.
"""
try:
import numpy
HAVE_NP = True
except ImportError:
HAVE_NP = False
try:
import jpeg_ls
HAVE_JPEGLS = True
except ImportError:
HAVE_JPEGLS ... | [
"numpy.frombuffer",
"numpy.dtype",
"pydicom.pixel_data_handlers.util.dtype_corrected_for_endianness"
] | [((3358, 3434), 'pydicom.pixel_data_handlers.util.dtype_corrected_for_endianness', 'dtype_corrected_for_endianness', (['dicom_dataset.is_little_endian', 'numpy_format'], {}), '(dicom_dataset.is_little_endian, numpy_format)\n', (3388, 3434), False, 'from pydicom.pixel_data_handlers.util import dtype_corrected_for_endian... |
# -*- coding: utf-8 -*-
from sqlalchemy import Table, Column, Integer, String, \
MetaData, ForeignKey, ForeignKeyConstraint, UniqueConstraint
from sqlalchemy.orm import relationship, backref
from config.config import db, metadata
from schema.users import User
from schema.admingroup import AdminGroup
__tablena... | [
"sqlalchemy.orm.backref",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.ForeignKey",
"sqlalchemy.Column"
] | [((424, 457), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (430, 457), False, 'from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey, ForeignKeyConstraint, UniqueConstraint\n'), ((1601, 1640), 'sqlalchemy.Column', 'Column', (['"""id"""',... |
"""
This script implements the "sandbox" AWS provisioning method, using device certificate from ECC.
It is intended to be invoked from iotprovison, but can also be run stand-alone.
"""
import os
from logging import getLogger
import hashlib
import binascii
from cryptography import x509
from cryptography.hazmat.primitive... | [
"hashlib.sha1",
"os.path.isfile",
"logging.getLogger",
"binascii.b2a_hex"
] | [((1168, 1187), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (1177, 1187), False, 'from logging import getLogger\n'), ((2054, 2091), 'os.path.isfile', 'os.path.isfile', (['self.device_cert_file'], {}), '(self.device_cert_file)\n', (2068, 2091), False, 'import os\n'), ((2672, 2693), 'binascii.b2... |
# Generated by Django 2.0.5 on 2019-02-25 23:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mirari', '0016_auto_20181219_1659'),
]
operations = [
migrations.AddField(
model_name='organization',
name='DASHBOAR... | [
"django.db.models.PositiveIntegerField"
] | [((353, 432), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'blank': '(True)', 'default': '"""0"""', 'help_text': '"""px"""', 'null': '(True)'}), "(blank=True, default='0', help_text='px', null=True)\n", (380, 432), False, 'from django.db import migrations, models\n')] |
import importlib
from hydroDL.master import basins
from hydroDL.app import waterQuality
from hydroDL import kPath
from hydroDL.model import trainTS
from hydroDL.data import gageII, usgs
from hydroDL.post import axplot, figplot
import torch
import os
import json
import numpy as np
import pandas as pd
import matplotlib.... | [
"hydroDL.post.axplot.plotTS",
"hydroDL.app.waterQuality.calErrSeq",
"hydroDL.post.figplot.clickMap",
"numpy.datetime64",
"hydroDL.master.basins.testModel",
"hydroDL.app.waterQuality.DataModelWQ",
"hydroDL.master.basins.loadSeq",
"importlib.reload",
"hydroDL.master.basins.loadMaster",
"numpy.array"... | [((389, 415), 'hydroDL.master.basins.loadMaster', 'basins.loadMaster', (['outName'], {}), '(outName)\n', (406, 415), False, 'from hydroDL.master import basins\n'), ((455, 489), 'hydroDL.app.waterQuality.DataModelWQ', 'waterQuality.DataModelWQ', (['dataName'], {}), '(dataName)\n', (479, 489), False, 'from hydroDL.app im... |
import os
import typing
import numpy as np
from aocd import get_data
from dotenv import load_dotenv
from utils import timeit
def get_session() -> str:
load_dotenv()
return os.getenv('SESSION_COOKIE')
def get_list(data: str = None, day: int = None, year: int = None) -> typing.List:
if not data:
... | [
"numpy.sum",
"numpy.roll",
"numpy.zeros",
"dotenv.load_dotenv",
"os.getenv"
] | [((159, 172), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (170, 172), False, 'from dotenv import load_dotenv\n'), ((184, 211), 'os.getenv', 'os.getenv', (['"""SESSION_COOKIE"""'], {}), "('SESSION_COOKIE')\n", (193, 211), False, 'import os\n'), ((1342, 1371), 'numpy.zeros', 'np.zeros', (['(9)'], {'dtype': 'np... |
import pickle
from keras.models import load_model
from sklearn.preprocessing import MultiLabelBinarizer
from gensim import models
from nltk.tokenize import RegexpTokenizer
from stop_words import get_stop_words
import numpy as np
import subprocess
subprocess.call(['sh', 'src/models/get_word2vec.sh'])
with open('data/p... | [
"keras.models.load_model",
"nltk.tokenize.RegexpTokenizer",
"stop_words.get_stop_words",
"numpy.zeros",
"numpy.argsort",
"pickle.load",
"subprocess.call",
"gensim.models.KeyedVectors.load_word2vec_format"
] | [((248, 301), 'subprocess.call', 'subprocess.call', (["['sh', 'src/models/get_word2vec.sh']"], {}), "(['sh', 'src/models/get_word2vec.sh'])\n", (263, 301), False, 'import subprocess\n'), ((413, 448), 'keras.models.load_model', 'load_model', (['"""models/overview_nn.h5"""'], {}), "('models/overview_nn.h5')\n", (423, 448... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 17 02:27:29 2018
@author: james
"""
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 29 15:00:40 2018
@author: JamesChiou
"""
import os
import random
import time
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
impo... | [
"os.mkdir",
"numpy.random.seed",
"numpy.argmax",
"pandas.read_csv",
"torch.nn.functional.dropout",
"torch.cat",
"torch.nn.Softmax",
"torch.device",
"torchvision.transforms.Normalize",
"pandas.DataFrame",
"torch.utils.data.DataLoader",
"torch.nn.functional.avg_pool2d",
"torch.load",
"torchv... | [((5450, 5475), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (5473, 5475), False, 'import torch\n'), ((5609, 5632), 'random.seed', 'random.seed', (['randomSeed'], {}), '(randomSeed)\n', (5620, 5632), False, 'import random\n'), ((5633, 5662), 'torch.manual_seed', 'torch.manual_seed', (['random... |
import pymetry
pymetry.circle(60, "brown", 4)
| [
"pymetry.circle"
] | [((15, 45), 'pymetry.circle', 'pymetry.circle', (['(60)', '"""brown"""', '(4)'], {}), "(60, 'brown', 4)\n", (29, 45), False, 'import pymetry\n')] |
import json
import mock
import pytest
from click.testing import CliRunner
from gradient.api_sdk import sdk_exceptions
from gradient.api_sdk.clients.http_client import default_headers
from gradient.cli import cli
from tests import MockResponse, example_responses
EXPECTED_HEADERS = default_headers.copy()
EXPECTED_HEAD... | [
"gradient.api_sdk.clients.http_client.default_headers.copy",
"json.loads",
"mock.call",
"gradient.api_sdk.sdk_exceptions.GradientSdkError",
"mock.patch",
"mock.MagicMock",
"tests.MockResponse",
"pytest.mark.parametrize",
"click.testing.CliRunner"
] | [((284, 306), 'gradient.api_sdk.clients.http_client.default_headers.copy', 'default_headers.copy', ([], {}), '()\n', (304, 306), False, 'from gradient.api_sdk.clients.http_client import default_headers\n'), ((4187, 4250), 'mock.patch', 'mock.patch', (['"""gradient.api_sdk.clients.http_client.requests.get"""'], {}), "('... |
# Generated by Django 2.2.1 on 2019-09-08 17:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('images', '0015_auto_20190909_0253'),
]
operations = [
migrations.RenameField(
model_name='comment',
old_name='refer',
... | [
"django.db.migrations.RenameField"
] | [((226, 318), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""comment"""', 'old_name': '"""refer"""', 'new_name': '"""referComment"""'}), "(model_name='comment', old_name='refer', new_name=\n 'referComment')\n", (248, 318), False, 'from django.db import migrations\n')] |
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PR... | [
"DV.riscv.trees.instruction_tree.RV32_G_map.pick",
"RandomUtils.random32",
"DV.riscv.trees.instruction_tree.RV_G_map.pick"
] | [((1537, 1563), 'RandomUtils.random32', 'RandomUtils.random32', (['(2)', '(5)'], {}), '(2, 5)\n', (1557, 1563), False, 'import RandomUtils\n'), ((2956, 2983), 'RandomUtils.random32', 'RandomUtils.random32', (['(0)', '(10)'], {}), '(0, 10)\n', (2976, 2983), False, 'import RandomUtils\n'), ((3072, 3103), 'DV.riscv.trees.... |
import pathlib
import matplotlib.pyplot as plt
import numpy as np
import imageio
def correct_line_shift(img: np.ndarray, value: int):
"""Corrects the lineshift of a given image."""
rolled = np.roll(img[::2, :], value, axis=1)
img[::2, :] = rolled
return img
def show_corrected_image(img: np.ndarray)... | [
"imageio.imread",
"pathlib.Path",
"matplotlib.pyplot.subplots",
"numpy.roll"
] | [((201, 236), 'numpy.roll', 'np.roll', (['img[::2, :]', 'value'], {'axis': '(1)'}), '(img[::2, :], value, axis=1)\n', (208, 236), True, 'import numpy as np\n'), ((336, 350), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (348, 350), True, 'import matplotlib.pyplot as plt\n'), ((468, 516), 'pathlib.Path... |
#! /usr/bin/env python
# vim: set fenc=utf8 ts=4 sw=4 et :
#
# Layer 2 network neighbourhood discovery tool
# written by <NAME> (mail at <EMAIL>)
from __future__ import absolute_import, division, print_function
import logging
import scapy.config
import scapy.layers.l2
import scapy.route
import socket
import netifaces
... | [
"netifaces.interfaces",
"couchdb.Server",
"json.dumps",
"math.log",
"netifaces.ifaddresses",
"socket.gethostbyaddr",
"pycurl.Curl",
"StringIO.StringIO"
] | [((683, 753), 'couchdb.Server', 'couchdb.Server', (["('http://' + c_user + ':' + c_pass + '@127.0.0.1:5984/')"], {}), "('http://' + c_user + ':' + c_pass + '@127.0.0.1:5984/')\n", (697, 753), False, 'import couchdb\n'), ((781, 803), 'netifaces.interfaces', 'netifaces.interfaces', ([], {}), '()\n', (801, 803), False, 'i... |
from __future__ import annotations
import os
import random
import re
import time
import discord
import pygame
from discord.errors import HTTPException
from pgbot import clock, common, docs, embed_utils, emotion, sandbox, utils
from pgbot.commands.base import BaseCommand, CodeBlock
class UserCommand(BaseCommand):
... | [
"os.remove",
"pgbot.utils.send_help_message",
"random.randint",
"pgbot.utils.code_block",
"discord.File",
"pgbot.docs.put_doc",
"os.path.getsize",
"pgbot.utils.format_time",
"time.time",
"pgbot.clock.user_clock",
"re.search",
"time.perf_counter_ns",
"pgbot.embed_utils.replace",
"pgbot.sand... | [((1044, 1055), 'time.time', 'time.time', ([], {}), '()\n', (1053, 1055), False, 'import time\n'), ((1308, 1333), 'os.remove', 'os.remove', (['f"""temp{t}.png"""'], {}), "(f'temp{t}.png')\n", (1317, 1333), False, 'import os\n'), ((3032, 3054), 'time.perf_counter_ns', 'time.perf_counter_ns', ([], {}), '()\n', (3052, 305... |
from collections import defaultdict
from typing import Any, Callable, Dict, Iterable, Sequence
import numpy as np
import pandas as pd
import scipy.optimize
from invoice_net.parsers import (
parses_as_full_date,
parses_as_amount,
parses_as_invoice_number,
)
from invoice_net.data_handler import DataHandler
... | [
"pandas.DataFrame",
"pandas.pivot_table",
"collections.defaultdict",
"numpy.where",
"numpy.array",
"pandas.DataFrame.from_records",
"pandas.concat"
] | [((723, 737), 'numpy.array', 'np.array', (['mask'], {}), '(mask)\n', (731, 737), True, 'import numpy as np\n'), ((939, 972), 'collections.defaultdict', 'defaultdict', (['(lambda : lambda x: x)'], {}), '(lambda : lambda x: x)\n', (950, 972), False, 'from collections import defaultdict\n'), ((1434, 1451), 'pandas.concat'... |
#!/usr/bin/env python
#
# Copyright (c) 2013-2015 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# All Rights Reserved.
#
from cgtsclient.common import utils
from cgtsclient import exc
from cgtsclient.v1 import ihost as ihost_utils
def _print_port_sho... | [
"cgtsclient.common.utils.print_tuple_list",
"cgtsclient.v1.ihost._find_ihost",
"cgtsclient.common.wrapping_formatters.build_best_guess_formatters_using_average_widths",
"cgtsclient.common.utils.arg",
"cgtsclient.common.wrapping_formatters.build_wrapping_formatters",
"cgtsclient.common.utils.get_terminal_s... | [((1511, 1596), 'cgtsclient.common.utils.arg', 'utils.arg', (['"""hostnameorid"""'], {'metavar': '"""<hostname or id>"""', 'help': '"""Name or ID of host"""'}), "('hostnameorid', metavar='<hostname or id>', help='Name or ID of host'\n )\n", (1520, 1596), False, 'from cgtsclient.common import utils\n'), ((1615, 1704)... |
# Instalem os pacotes no terminal dessa forma: python -m pip install pymongo dnspython
import os
import pymongo
from pokemon_dataset import dataset
from dotenv import load_dotenv
load_dotenv()
mongoDBString = os.getenv('MONGO_DB_LINK')
class Database:
def __init__(self):
self.clusterConnection = pymongo.M... | [
"dotenv.load_dotenv",
"pymongo.MongoClient",
"os.getenv"
] | [((180, 193), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (191, 193), False, 'from dotenv import load_dotenv\n'), ((210, 236), 'os.getenv', 'os.getenv', (['"""MONGO_DB_LINK"""'], {}), "('MONGO_DB_LINK')\n", (219, 236), False, 'import os\n'), ((311, 379), 'pymongo.MongoClient', 'pymongo.MongoClient', (['mongo... |
import re
import time
import requests
from pyquery import PyQuery as pq
from fetchers.BaseFetcher import BaseFetcher
class KaiXinFetcher(BaseFetcher):
"""
http://www.kxdaili.com/dailiip.html
代码由 [Zealot666](https://github.com/Zealot666) 提供
"""
def fetch(self):
"""
执行一次爬取,返回一个数组,每... | [
"pyquery.PyQuery",
"re.match",
"requests.get",
"re.compile"
] | [((707, 748), 're.compile', 're.compile', (['"""^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\\\\.\\\\d+$"""'], {}), "('^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\\\\.\\\\d+$')\n", (717, 748), False, 'import re\n'), ((764, 784), 're.compile', 're.compile', (['"""^\\\\d+$"""'], {}), "('^\\\\d+$')\n", (774, 784), False, 'import re\n'), ((897, 905), ... |
# IMPORT LIBRARIES
import random # For random number generation
import matplotlib.pyplot as plt # For plotting, use shorthand
from matplotlib.animation import FuncAnimation # For animation
import tkinter # For GUI programming
import csv # For reading in csv files
import agentframework1 # Contains the Agent class... | [
"matplotlib.pyplot.title",
"csv.reader",
"random.shuffle",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.imshow",
"tkinter.Tk",
"tkinter.Menu",
"csv.writer",
"tkinter.mainloop",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.legend",
"matplotlib.use",
"... | [((356, 379), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (370, 379), False, 'import matplotlib\n'), ((1068, 1111), 'csv.reader', 'csv.reader', (['f'], {'quoting': 'csv.QUOTE_NONNUMERIC'}), '(f, quoting=csv.QUOTE_NONNUMERIC)\n', (1078, 1111), False, 'import csv\n'), ((1751, 1808), 'agentfr... |
#!/usr/bin/python
# Copyright (c) 2020, NVIDIA CORPORATION. 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-2.0
#
# Unless... | [
"sys.path.append",
"json.load",
"argparse.ArgumentParser",
"dlrm.data.datasets.SyntheticDataset",
"os.makedirs",
"dlrm.model.single.Dlrm.from_dict",
"triton.deployer_lib.create_deployer",
"os.path.join"
] | [((885, 907), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (900, 907), False, 'import sys\n'), ((955, 980), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (978, 980), False, 'import argparse\n'), ((2687, 2715), 'dlrm.model.single.Dlrm.from_dict', 'Dlrm.from_dict', (['... |
import os
from setuptools import setup, find_packages
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
def getReqs(reqfile='requirements.txt'):
reqs = []
with open(os.path.join(os.path.dirname(__file__), reqfile)) as fp:
lines = f... | [
"os.path.abspath",
"os.path.dirname",
"setuptools.find_packages"
] | [((577, 592), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (590, 592), False, 'from setuptools import setup, find_packages\n'), ((135, 160), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (150, 160), False, 'import os\n'), ((259, 284), 'os.path.dirname', 'os.path.dirname', (... |
import sqlite3
import asyncio
import discord
import sys
import datetime
import os
from utils import models
from utils.models import db
from configparser import ConfigParser
SQLITE_FILE = './data/kurisu.sqlite'
IS_DOCKER = os.environ.get('IS_DOCKER', 0)
if IS_DOCKER:
db_user_file = os.environ.get('DB_USER')
d... | [
"utils.models.Flag.insert",
"utils.models.Warn.insert",
"utils.models.FriendCode.insert",
"utils.models.TimedRestriction.insert",
"datetime.timedelta",
"utils.models.db.set_bind",
"utils.models.db.gino.create_all",
"configparser.ConfigParser",
"utils.models.FilteredWord.insert",
"datetime.datetime... | [((224, 254), 'os.environ.get', 'os.environ.get', (['"""IS_DOCKER"""', '(0)'], {}), "('IS_DOCKER', 0)\n", (238, 254), False, 'import os\n'), ((289, 314), 'os.environ.get', 'os.environ.get', (['"""DB_USER"""'], {}), "('DB_USER')\n", (303, 314), False, 'import os\n'), ((338, 367), 'os.environ.get', 'os.environ.get', (['"... |
#!/usr/bin/env python3
import fire
class String():
"""
performs operations on string
"""
"""
strip removes leading and tailing spaces
"""
def strip(self, s: str):
return s.strip()
"""
startswith return true, if the string starts with given prefix
"""
def startsw... | [
"fire.Fire"
] | [((421, 438), 'fire.Fire', 'fire.Fire', (['String'], {}), '(String)\n', (430, 438), False, 'import fire\n')] |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"tests.common.tensorio.compare_tensor",
"tests.common.gen_random.random_gaussian",
"akg.utils.kernel_exec.op_build_test",
"numpy.broadcast_to",
"akg.topi.util.get_const_tuple",
"akg.utils.kernel_exec.mod_launch"
] | [((1025, 1143), 'akg.utils.kernel_exec.op_build_test', 'utils.op_build_test', (['prelu.prelu', '[shape, w_shape]', '[dtype, dtype]'], {'kernel_name': 'kernel_name', 'attrs': 'attrs', 'tuning': 't'}), '(prelu.prelu, [shape, w_shape], [dtype, dtype],\n kernel_name=kernel_name, attrs=attrs, tuning=t)\n', (1044, 1143), ... |
#!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=F0401
import optparse
import os
import shutil
import sys
import subprocess
GYP_ANDROID_DIR = os.path.join(os.path... | [
"sys.path.append",
"subprocess.check_call",
"optparse.OptionParser",
"os.path.basename",
"os.path.dirname",
"util.build_utils.DeleteDirectory",
"util.build_utils.ParseGypList",
"util.build_utils.MakeDirectory",
"shutil.copy"
] | [((524, 556), 'sys.path.append', 'sys.path.append', (['GYP_ANDROID_DIR'], {}), '(GYP_ANDROID_DIR)\n', (539, 556), False, 'import sys\n'), ((313, 338), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (328, 338), False, 'import os\n'), ((627, 665), 'util.build_utils.DeleteDirectory', 'build_util... |
#!/usr/bin/python3.8
# node to transform positive number to negative
from basics.srv import convert_positive_to_negative, convert_positive_to_negativeRequest, convert_positive_to_negativeResponse
import rospy
# Service callback function.
def process_service_request(req):
# Instantiate the response message object... | [
"basics.srv.convert_positive_to_negativeResponse",
"rospy.loginfo",
"rospy.init_node",
"rospy.spin",
"rospy.Service"
] | [((332, 370), 'basics.srv.convert_positive_to_negativeResponse', 'convert_positive_to_negativeResponse', ([], {}), '()\n', (368, 370), False, 'from basics.srv import convert_positive_to_negative, convert_positive_to_negativeRequest, convert_positive_to_negativeResponse\n'), ((793, 856), 'rospy.init_node', 'rospy.init_n... |
from bisect import bisect_right
from itertools import combinations
import sys
input = sys.stdin.readline
N, C = map(int, input().split())
W = list(map(int, input().split()))
def possible_weight(arr):
ret = []
for i in range(len(arr)+1):
for c in combinations(arr, i):
ret.append(sum(c))
... | [
"bisect.bisect_right",
"itertools.combinations"
] | [((264, 284), 'itertools.combinations', 'combinations', (['arr', 'i'], {}), '(arr, i)\n', (276, 284), False, 'from itertools import combinations\n'), ((444, 470), 'bisect.bisect_right', 'bisect_right', (['right', '(v - l)'], {}), '(right, v - l)\n', (456, 470), False, 'from bisect import bisect_right\n')] |
#!/usr/bin/env python
from zipline import TradingAlgorithm
from zipline.transforms import MovingAverage
from zipline.utils.factory import load_from_yahoo
from datetime import datetime
import pytz
import matplotlib.pyplot as plt
class DualMovingAverage(TradingAlgorithm):
"""Dual Moving Average Crossover algorithm.... | [
"zipline.utils.factory.load_from_yahoo",
"matplotlib.pyplot.figure",
"datetime.datetime"
] | [((1861, 1903), 'datetime.datetime', 'datetime', (['(1990)', '(1)', '(1)', '(0)', '(0)', '(0)', '(0)', 'pytz.utc'], {}), '(1990, 1, 1, 0, 0, 0, 0, pytz.utc)\n', (1869, 1903), False, 'from datetime import datetime\n'), ((1910, 1952), 'datetime.datetime', 'datetime', (['(2002)', '(1)', '(1)', '(0)', '(0)', '(0)', '(0)', ... |
from directory_manager import base_Directory, firstTExe,default_VE_NAME
from tfl_backend import universal_Path_database
with open(firstTExe) as file:
try:
terminator=int(file.read())
except:
terminator=0
""" This function checks that whether the software was previously was installed or not. "... | [
"tfl_backend.universal_Path_database"
] | [((457, 520), 'tfl_backend.universal_Path_database', 'universal_Path_database', (['"""add"""', 'default_VE_NAME', 'base_Directory'], {}), "('add', default_VE_NAME, base_Directory)\n", (480, 520), False, 'from tfl_backend import universal_Path_database\n')] |
import gensim
import pandas as pd
import numpy as np
from gensim.models.wrappers import LdaMallet
import sys
""" This class is creates a list of n recommendations that are the most similar to a list of paintings
liked by the user. It uses a Latent Dirichlet Allocation approach which expresses the paintings as
... | [
"pandas.read_csv",
"numpy.load",
"numpy.sum",
"gensim.models.wrappers.LdaMallet.load"
] | [((636, 684), 'pandas.read_csv', 'pd.read_csv', (['"""resources/datasets/ng-dataset.csv"""'], {}), "('resources/datasets/ng-dataset.csv')\n", (647, 684), True, 'import pandas as pd\n'), ((943, 972), 'gensim.models.wrappers.LdaMallet.load', 'LdaMallet.load', (['path_to_model'], {}), '(path_to_model)\n', (957, 972), Fals... |
# Copyright 2018 AT&T Intellectual Property. All other 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-2.0
#
# Unless required by ... | [
"six.add_metaclass"
] | [((641, 671), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (658, 671), False, 'import six\n')] |
import re
import logging
from rdflib import Graph
from rdflib.namespace import Namespace, NamespaceManager
from lxml import etree as et
import nltk.data
# language to be used by nlptk
sent_detector = nltk.data.load('tokenizers/punkt/english.pickle')
# available logging for RDF
logging.basicConfig(level=logging.INFO)
... | [
"rdflib.Graph",
"logging.basicConfig",
"rdflib.namespace.Namespace",
"lxml.etree.QName",
"re.compile"
] | [((280, 319), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (299, 319), False, 'import logging\n'), ((660, 682), 're.compile', 're.compile', (['"""[^\\\\d.]+"""'], {}), "('[^\\\\d.]+')\n", (670, 682), False, 'import re\n'), ((784, 809), 'lxml.etree.QName', 'et.... |
from os import read
from django.db.models.aggregates import Count, Sum
from django.db.models.fields import related_descriptors
from numpy.lib.twodim_base import triu_indices_from
from rest_framework import serializers
from rest_framework.fields import SerializerMethodField
from .models import DoubleCountingAgreement, D... | [
"rest_framework.serializers.SerializerMethodField",
"django.db.models.aggregates.Count",
"core.models.MatierePremiere.objects.filter",
"django.db.models.aggregates.Sum",
"rest_framework.serializers.SlugRelatedField"
] | [((2232, 2267), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {}), '()\n', (2265, 2267), False, 'from rest_framework import serializers\n'), ((2622, 2685), 'rest_framework.serializers.SlugRelatedField', 'serializers.SlugRelatedField', ([], {'read_only': '(True)', 'slug_fi... |
import discord
import sqlite3
from pokedb import PokeSQL
import os
# Housekeeping for login information
TOKEN_FILE_PATH = 'token.txt'
# The Discord client.
client = discord.Client()
# Command prefix.
COMMAND_PREFIX = '!'
scdir = os.path.dirname(os.path.abspath(__file__))
conn = sqlite3.connect(os.path.join(scdir, ... | [
"pokedb.PokeSQL",
"os.path.abspath",
"os.path.join",
"discord.Client"
] | [((167, 183), 'discord.Client', 'discord.Client', ([], {}), '()\n', (181, 183), False, 'import discord\n'), ((362, 372), 'pokedb.PokeSQL', 'PokeSQL', (['c'], {}), '(c)\n', (369, 372), False, 'from pokedb import PokeSQL\n'), ((249, 274), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (264, 274... |
#!/usr/bin/env python3
# https://discordapp.com/oauth2/authorize?client_id=633799032862408704&permissions=8&scope=bot
import discord
import wikiquotes
from discord.ext import commands
client = commands.Bot(command_prefix="<")
token = 'TOKEN_HERE'
@client.event
async def on_ready():
print("Bot is online.")
... | [
"discord.Activity",
"wikiquotes.quote_of_the_day",
"wikiquotes.random_quote",
"discord.ext.commands.Bot"
] | [((197, 229), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': '"""<"""'}), "(command_prefix='<')\n", (209, 229), False, 'from discord.ext import commands\n'), ((1578, 1620), 'wikiquotes.random_quote', 'wikiquotes.random_quote', (['author', '"""english"""'], {}), "(author, 'english')\n", (1601, 1620)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 3 2017
Webscrape
@author: dhingratul
"""
import urllib
import sys
sys.path.insert(0, '../tools/')
import utils
i_start = 1
i_end = 401
mdir = '../data/Andaman/'
base_url = "http://as1.and.nic.in/newElection/AllPdf/"
for i in range(i_start, i_end... | [
"sys.path.insert",
"utils.download_file"
] | [((139, 170), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../tools/"""'], {}), "(0, '../tools/')\n", (154, 170), False, 'import sys\n'), ((448, 483), 'utils.download_file', 'utils.download_file', (['url', 'mdir', 'fid'], {}), '(url, mdir, fid)\n', (467, 483), False, 'import utils\n')] |
from sqlalchemy import Column, Integer, String, DateTime
from app.models import Base
class AuthUser(Base):
__tablename__ = 'auth_user'
id = Column(Integer, primary_key=True)
password = Column(String(128), nullable=False)
last_login = Column(DateTime)
is_superuser = Column(Integer, nullable=False... | [
"sqlalchemy.String",
"sqlalchemy.Column"
] | [((152, 185), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (158, 185), False, 'from sqlalchemy import Column, Integer, String, DateTime\n'), ((254, 270), 'sqlalchemy.Column', 'Column', (['DateTime'], {}), '(DateTime)\n', (260, 270), False, 'from sqlalchemy im... |
#!/usr/bin/python
"""
Write random data to the data.txt file
takes in a universe size M, writes n
random digits to the universe M
"""
import argparse
import numpy as np
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--M', metavar='M', type=int, default=100,
help='The size of the unive... | [
"numpy.random.randint",
"argparse.ArgumentParser"
] | [((196, 221), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (219, 221), False, 'import argparse\n'), ((603, 633), 'numpy.random.randint', 'np.random.randint', (['(0)', '(M - 1)', 'n'], {}), '(0, M - 1, n)\n', (620, 633), True, 'import numpy as np\n')] |
import os
from ai import DDPGAI
from client.AIExchangeService import get_service
from client.aiExchangeMessages_pb2 import SimStateResponse, Control, SimulationID, VehicleID, DataRequest
service = get_service()
try:
username = os.environ['DRIVEBUILD_USER']
password = os.environ['DRIVEBUILD_PASSWORD']
except... | [
"client.aiExchangeMessages_pb2.SimulationID",
"client.aiExchangeMessages_pb2.VehicleID",
"ai.DDPGAI",
"client.AIExchangeService.get_service"
] | [((200, 213), 'client.AIExchangeService.get_service', 'get_service', ([], {}), '()\n', (211, 213), False, 'from client.AIExchangeService import get_service\n'), ((623, 634), 'client.aiExchangeMessages_pb2.VehicleID', 'VehicleID', ([], {}), '()\n', (632, 634), False, 'from client.aiExchangeMessages_pb2 import SimStateRe... |
# -*- coding: utf-8 -*-
import os
from distutils.util import strtobool
from dotenv import load_dotenv
load_dotenv()
BOT_NAME = "Book_Crawler"
SPIDER_MODULES = ["spiders"]
NEWSPIDER_MODULE = "spiders"
COMMANDS_MODULE = "commands"
START_URL = os.getenv("START_URL", "")
BASE_URL = os.getenv("BASE_URL", "")
PROXY = ... | [
"dotenv.load_dotenv",
"os.getenv"
] | [((105, 118), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (116, 118), False, 'from dotenv import load_dotenv\n'), ((247, 273), 'os.getenv', 'os.getenv', (['"""START_URL"""', '""""""'], {}), "('START_URL', '')\n", (256, 273), False, 'import os\n'), ((285, 310), 'os.getenv', 'os.getenv', (['"""BASE_URL"""', '"... |
import os
from collections import Counter
from itertools import islice, combinations
from multiprocessing import Pool, cpu_count
from tqdm import tqdm
import numpy as np
import pandas as pd
import nltk
try:
nltk.pos_tag(nltk.word_tokenize('This is a test sentence.'))
except LookupError:
print('Installing nltk ... | [
"tqdm.tqdm",
"os.remove",
"nltk.pos_tag",
"collections.Counter",
"nltk.ngrams",
"os.path.isfile",
"itertools.combinations",
"itertools.islice",
"multiprocessing.Pool",
"nltk.download",
"pandas.concat",
"nltk.word_tokenize",
"numpy.prod",
"multiprocessing.cpu_count"
] | [((225, 271), 'nltk.word_tokenize', 'nltk.word_tokenize', (['"""This is a test sentence."""'], {}), "('This is a test sentence.')\n", (243, 271), False, 'import nltk\n'), ((345, 388), 'nltk.download', 'nltk.download', (['"""averaged_perceptron_tagger"""'], {}), "('averaged_perceptron_tagger')\n", (358, 388), False, 'im... |
from django.shortcuts import render
# Create your views here.
def responsivehome(request):
context = {}
return render(request, 'design/responsivehome.html', context)
def responsiveproduct(request):
context = {}
return render(request, 'design/responsiveproduct.html', context)
def responsivepeople(req... | [
"django.shortcuts.render"
] | [((121, 175), 'django.shortcuts.render', 'render', (['request', '"""design/responsivehome.html"""', 'context'], {}), "(request, 'design/responsivehome.html', context)\n", (127, 175), False, 'from django.shortcuts import render\n'), ((237, 294), 'django.shortcuts.render', 'render', (['request', '"""design/responsiveprod... |
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
import logging
from six import itervalues
from flask_login import current_user
from flask_restx._http import HTTPStatus
from flask_marshmallow import Schema, base_fields
from marshmallow import validate, validates_schema, ValidationError
import sqlalchemy as... | [
"marshmallow.validate.OneOf",
"marshmallow.ValidationError",
"flask_marshmallow.base_fields.String",
"wbia.web.extensions.api.abort",
"six.itervalues",
"flask_marshmallow.base_fields.Raw",
"logging.getLogger"
] | [((332, 359), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (349, 359), False, 'import logging\n'), ((2271, 2304), 'flask_marshmallow.base_fields.String', 'base_fields.String', ([], {'required': '(True)'}), '(required=True)\n', (2289, 2304), False, 'from flask_marshmallow import Schema, ... |
#!/usr/bin/env python
# coding: utf-8
# <img style="float: left;" src="earth-lab-logo-rgb.png" width="150" height="150" />
#
# # Earth Analytics Education - EA Python Course Spring 2021
# ## Important - Assignment Guidelines
#
# 1. Before you submit your assignment to GitHub, make sure to run the entire notebook ... | [
"pandas.DataFrame",
"earthpy.data.get_data",
"rioxarray.open_rasterio",
"os.getcwd",
"numpy.allclose",
"matplotcheck.notebook.convert_axes",
"datetime.datetime.now",
"matplotlib.pyplot.subplots",
"datetime.datetime.strptime",
"matplotlib.dates.DateFormatter",
"numpy.nanmean",
"xarray.where",
... | [((9028, 9063), 'earthpy.data.get_data', 'et.data.get_data', (['"""ndvi-automation"""'], {}), "('ndvi-automation')\n", (9044, 9063), True, 'import earthpy as et\n'), ((9115, 9166), 'os.path.join', 'os.path.join', (['et.io.HOME', '"""earth-analytics"""', '"""data"""'], {}), "(et.io.HOME, 'earth-analytics', 'data')\n", (... |
"""Route declaration."""
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route('/')
def home():
"""Landing page."""
nav = [
{'name': 'Home', 'url': 'https://example.com/1'},
{'name': 'About', 'url': 'https://example.com/2'},
{'name': 'Pics', 'url'... | [
"flask.Flask",
"flask.render_template"
] | [((91, 106), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (96, 106), False, 'from flask import Flask\n'), ((364, 514), 'flask.render_template', 'render_template', (['"""home.html"""'], {'nav': 'nav', 'title': '"""Jinja Demo Site"""', 'description': '"""Smarter page templates with Flask & Jinja."""', 'sta... |
from rest_framework import serializers
from tests.testapp.models import Book, Course, Student, Phone
from django_restql.fields import NestedField, DynamicSerializerMethodField
from django_restql.mixins import DynamicFieldsMixin
from django_restql.serializers import NestedModelSerializer
######## Serializers for Data ... | [
"django_restql.fields.DynamicSerializerMethodField",
"django_restql.fields.NestedField",
"rest_framework.serializers.CharField"
] | [((2097, 2127), 'django_restql.fields.DynamicSerializerMethodField', 'DynamicSerializerMethodField', ([], {}), '()\n', (2125, 2127), False, 'from django_restql.fields import NestedField, DynamicSerializerMethodField\n'), ((3186, 3240), 'django_restql.fields.NestedField', 'NestedField', (['BookSerializer'], {'many': '(T... |
import argparse
import codecs
import os
import sys
import re
from pathlib import Path
from collections import defaultdict
from graphviz import Digraph
include_regex = re.compile('#include\s+["<"](.*)[">]')
valid_headers = [['.h', '.hpp'], 'red']
valid_sources = [['.c', '.cc', '.cpp'], 'blue']
valid_extensions = valid... | [
"codecs.open",
"argparse.ArgumentParser",
"os.path.basename",
"os.path.dirname",
"collections.defaultdict",
"pathlib.Path",
"graphviz.Digraph",
"re.compile"
] | [((169, 208), 're.compile', 're.compile', (['"""#include\\\\s+["<"](.*)[">]"""'], {}), '(\'#include\\\\s+["<"](.*)[">]\')\n', (179, 208), False, 'import re\n'), ((467, 489), 'os.path.basename', 'os.path.basename', (['path'], {}), '(path)\n', (483, 489), False, 'import os\n'), ((916, 926), 'pathlib.Path', 'Path', (['pat... |
# -*- coding: utf-8 -*-
"""Calendar is a dictionary like Python object that can render itself as VCAL
files according to rfc2445.
These are the defined components.
"""
from datetime import datetime, timedelta
from icalendar.caselessdict import CaselessDict
from icalendar.parser import Contentline
from icalendar.parser... | [
"icalendar.prop.TypesFactory",
"icalendar.parser.Contentline.from_parts",
"icalendar.compat.unicode_type",
"icalendar.parser.Parameters",
"icalendar.prop.vText",
"datetime.datetime",
"pytz.utc.localize",
"icalendar.parser.q_join",
"datetime.timedelta",
"icalendar.parser.q_split",
"icalendar.pars... | [((1637, 1699), 'icalendar.caselessdict.CaselessDict', 'CaselessDict', (["{'CATEGORIES': 1, 'RESOURCES': 1, 'FREEBUSY': 1}"], {}), "({'CATEGORIES': 1, 'RESOURCES': 1, 'FREEBUSY': 1})\n", (1649, 1699), False, 'from icalendar.caselessdict import CaselessDict\n'), ((26129, 26143), 'icalendar.prop.TypesFactory', 'TypesFact... |
import OpenGraph as og
from OpenGraph.tests import(
assert_graphs_equal,
assert_edges_equal,
assert_nodes_equal
)
def test_passing():
assert (1, 2, 3) == (1, 2, 3)
# thanks to numpy for this GenericTest class (numpy/testing/test_utils.py)
class _GenericTest:
@classmethod
def _test_equal(cls... | [
"OpenGraph.Graph"
] | [((1148, 1158), 'OpenGraph.Graph', 'og.Graph', ([], {}), '()\n', (1156, 1158), True, 'import OpenGraph as og\n'), ((1202, 1212), 'OpenGraph.Graph', 'og.Graph', ([], {}), '()\n', (1210, 1212), True, 'import OpenGraph as og\n'), ((1346, 1356), 'OpenGraph.Graph', 'og.Graph', ([], {}), '()\n', (1354, 1356), True, 'import O... |
#!/usr/bin/env python3
"""
Update the S3 bucket with new config files and assets.
"""
import glob
import json
import os
import re
import shutil
import subprocess
import sys
import time
import boto3
# Types of assets
ASSET_TYPES = {
'json': ['.json'],
'image': ['.png', '.gif', '.jpg'],
'text': ['.txt'],... | [
"subprocess.run",
"json.dump",
"os.makedirs",
"os.path.exists",
"re.match",
"json.dumps",
"time.time",
"boto3.resource",
"sys.argv.index",
"shutil.rmtree",
"os.path.join"
] | [((23587, 23607), 'boto3.resource', 'boto3.resource', (['"""s3"""'], {}), "('s3')\n", (23601, 23607), False, 'import boto3\n'), ((3306, 3329), 'os.makedirs', 'os.makedirs', (['output_dir'], {}), '(output_dir)\n', (3317, 3329), False, 'import os\n'), ((8613, 8658), 're.match', 're.match', (['"""[0-9]+[.][0-9]+[.][0-9]+"... |
import subprocess
import argparse
import os
from datetime import date
import time
import shutil
import stat
import sys
import json
import pprint
import webbrowser
import MachineConfigs as machine_configs
import Helpers as helpers
import WriteTestResultsToHTML as write_test_results_to_html
class TestsSetError(Excep... | [
"subprocess.Popen",
"json.load",
"os.path.abspath",
"argparse.ArgumentParser",
"os.path.basename",
"os.getcwd",
"os.path.dirname",
"os.system",
"time.time",
"subprocess.call",
"Helpers.build_html_filename",
"Helpers.directory_clean_or_make",
"WriteTestResultsToHTML.write_test_set_results_to_... | [((4376, 4406), 'os.path.dirname', 'os.path.dirname', (['json_filepath'], {}), '(json_filepath)\n', (4391, 4406), False, 'import os\n'), ((4678, 4739), 'os.path.join', 'os.path.join', (['reference_directory', "tests_set_run_data['Name']"], {}), "(reference_directory, tests_set_run_data['Name'])\n", (4690, 4739), False,... |
import requests
from lxml import etree
import time
import os
file_dir = r"D:\A\blog_img"
def crawl(url):
response = requests.get(url=url)
response.encoding = "GBK"
html = etree.HTML(response.text)
urls = html.xpath("//table/tr/td/table/tbody/tr/td/table/tr[1]/td/div/a/@href")
for url in urls:
... | [
"os.path.join",
"lxml.etree.HTML",
"requests.get",
"time.sleep"
] | [((124, 145), 'requests.get', 'requests.get', ([], {'url': 'url'}), '(url=url)\n', (136, 145), False, 'import requests\n'), ((188, 213), 'lxml.etree.HTML', 'etree.HTML', (['response.text'], {}), '(response.text)\n', (198, 213), False, 'from lxml import etree\n'), ((359, 380), 'requests.get', 'requests.get', ([], {'url'... |
import struct
#import toml
def bitness():
return struct.calcsize("P") * 8
#def load_config():
# with open('Config/config.toml') as f:
# return toml.load(f) | [
"struct.calcsize"
] | [((54, 74), 'struct.calcsize', 'struct.calcsize', (['"""P"""'], {}), "('P')\n", (69, 74), False, 'import struct\n')] |
# -*- coding: utf-8 -*-
# @Time : 2018/8/23 22:21
# @Author : zhoujun
import os
import cv2
import numpy as np
import torch
from utils import CTCLabelConverter,AttnLabelConverter
from data_loader import get_transforms
class PytorchNet:
def __init__(self, model_path, gpu_id=None):
"""
初始化模型
... | [
"torch.jit.trace",
"matplotlib.font_manager.FontProperties",
"cv2.cvtColor",
"torch.load",
"data_loader.get_transforms",
"os.path.exists",
"utils.CTCLabelConverter",
"numpy.zeros",
"time.time",
"numpy.column_stack",
"cv2.imread",
"utils.AttnLabelConverter",
"torch.cuda.is_available",
"torc... | [((4020, 4047), 'torch.jit.trace', 'torch.jit.trace', (['net', 'input'], {}), '(net, input)\n', (4035, 4047), False, 'import torch\n'), ((4277, 4318), 'matplotlib.font_manager.FontProperties', 'FontProperties', ([], {'fname': '"""msyh.ttc"""', 'size': '(14)'}), "(fname='msyh.ttc', size=14)\n", (4291, 4318), False, 'fro... |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 24 20:37:03 2020
@author: Shiro
"""
import pandas as pd
import copy
import numpy as np
## put inside listes the csv file representing the prediction of a model
listes = ["model_pl_A-5folds-CV-seed42-bs16-mixup.csv", "model_pl_B-5folds-CV-seed42-bs16-mi... | [
"pandas.read_csv",
"copy.deepcopy",
"numpy.stack"
] | [((460, 480), 'copy.deepcopy', 'copy.deepcopy', (['df[0]'], {}), '(df[0])\n', (473, 480), False, 'import copy\n'), ((337, 351), 'pandas.read_csv', 'pd.read_csv', (['l'], {}), '(l)\n', (348, 351), True, 'import pandas as pd\n'), ((402, 440), 'numpy.stack', 'np.stack', (['[d[cols].values for d in df]'], {}), '([d[cols].v... |
import pygame
import adventure
import adventure.sound
LEFT_BLOCK = [[1, 0]]
RIGHT_BLOCK = [[-1, 0]]
TOP_BLOCK = [[0, 1]]
BOTTOM_BLOCK = [[0, -1]]
ALL_BLOCK = LEFT_BLOCK + RIGHT_BLOCK + TOP_BLOCK + BOTTOM_BLOCK
SPRITE_FALL = "fall"
SPRITE_JUMP = "jump"
SPRITE_DJUMP = "djump"
SPRITE_IDLE = "idle"
SPRITE_RUN = "run"... | [
"adventure.default.draw_blocks",
"adventure.default.texture.get_texture",
"pygame.Rect",
"adventure.default.sound_master.add_rhythm_beat",
"adventure.default.restart",
"adventure.default.get_block_id",
"adventure.default.load_level"
] | [((2976, 2999), 'pygame.Rect', 'pygame.Rect', (['x', 'y', 'w', 'h'], {}), '(x, y, w, h)\n', (2987, 2999), False, 'import pygame\n'), ((3679, 3710), 'adventure.default.draw_blocks', 'adventure.default.draw_blocks', ([], {}), '()\n', (3708, 3710), False, 'import adventure\n'), ((2318, 2371), 'adventure.default.texture.ge... |
from configparser import ConfigParser
import logging
from pathlib import Path
import sys
import config
import helper_functions
from interactive_cli import InvalidConfigFileCommandLineInterface
from conversion_settings import ConversionSettings
def what_module_is_this():
return __name__
class ConfigData(ConfigP... | [
"interactive_cli.InvalidConfigFileCommandLineInterface",
"conversion_settings.ConversionSettings",
"helper_functions.log_traceback",
"pathlib.Path",
"sys.exit"
] | [((1593, 1613), 'conversion_settings.ConversionSettings', 'ConversionSettings', ([], {}), '()\n', (1611, 1613), False, 'from conversion_settings import ConversionSettings\n'), ((3832, 3871), 'interactive_cli.InvalidConfigFileCommandLineInterface', 'InvalidConfigFileCommandLineInterface', ([], {}), '()\n', (3869, 3871),... |
# -*- coding: utf-8 -*-
import argparse
import pdb
import traceback
from itertools import permutations
from typing import List, Tuple
from intcode import Intcode
def solve(program: List[int]) -> Tuple[int, int]:
phases = (0, 1, 2, 3, 4)
signals = [0] * (len(phases) + 1)
results = []
vms = [Intcode(p... | [
"traceback.print_exc",
"pdb.post_mortem",
"argparse.ArgumentParser",
"itertools.permutations",
"intcode.Intcode"
] | [((361, 381), 'itertools.permutations', 'permutations', (['phases'], {}), '(phases)\n', (373, 381), False, 'from itertools import permutations\n'), ((772, 792), 'itertools.permutations', 'permutations', (['phases'], {}), '(phases)\n', (784, 792), False, 'from itertools import permutations\n'), ((1962, 2060), 'argparse.... |
from typing import Optional, Sequence
import pytorch_lightning as pl
from hydra.utils import instantiate
from omegaconf import DictConfig
from torch.utils.data import DataLoader, Dataset
from torchmeta.transforms import ClassSplitter
from torchmeta.utils.data import BatchMetaDataLoader
from torchvision.transforms impo... | [
"hydra.utils.instantiate",
"torchmeta.transforms.ClassSplitter"
] | [((2714, 2771), 'hydra.utils.instantiate', 'instantiate', (['self.target_transform'], {'num_classes': 'self.nway'}), '(self.target_transform, num_classes=self.nway)\n', (2725, 2771), False, 'from hydra.utils import instantiate\n'), ((2855, 2880), 'hydra.utils.instantiate', 'instantiate', (['augmentation'], {}), '(augme... |
import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import json, ast
try:
import RPi.GPIO as GPIO #incase we are in test mode
except:
print('could not import RPi.GPIO')
#from Event_Functions import EventFunctions
from Widget_Styles import *
class RelayWidgets():
d... | [
"RPi.GPIO.setup",
"RPi.GPIO.setmode",
"RPi.GPIO.output"
] | [((3326, 3348), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (3338, 3348), True, 'import RPi.GPIO as GPIO\n'), ((3399, 3434), 'RPi.GPIO.setup', 'GPIO.setup', (['RELAIS_1_GPIO', 'GPIO.OUT'], {}), '(RELAIS_1_GPIO, GPIO.OUT)\n', (3409, 3434), True, 'import RPi.GPIO as GPIO\n'), ((3953, 3989), 'R... |
from __future__ import absolute_import
from sentry.mediators import Mediator, Param
class Destroyer(Mediator):
service_hook = Param('sentry.models.ServiceHook')
def call(self):
self._destroy_service_hook()
return self.service_hook
def _destroy_service_hook(self):
self.service_ho... | [
"sentry.mediators.Param"
] | [((133, 167), 'sentry.mediators.Param', 'Param', (['"""sentry.models.ServiceHook"""'], {}), "('sentry.models.ServiceHook')\n", (138, 167), False, 'from sentry.mediators import Mediator, Param\n')] |
"""
AWS Lambda code base for the weather-api.
"""
import os
import logging
import pymysql
LOGGER = logging.getLogger()
LOGGER.setLevel(logging.INFO)
STATION_SQL = """
INSERT INTO `station`
(`abs_pressure`, `hum_in`, `hum_out`, `rain`, `rain_day`, `tdate`,
`temp_apprt`, `temp_dewpt`, `temp_in`, `temp_out`, `t... | [
"pymysql.connect",
"logging.getLogger"
] | [((101, 120), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (118, 120), False, 'import logging\n'), ((1479, 1666), 'pymysql.connect', 'pymysql.connect', ([], {'host': "os.environ['host']", 'user': "os.environ['user']", 'password': "os.environ['password']", 'db': "os.environ['db']", 'charset': '"""utf8mb4"... |
# -*- coding: utf-8 -*-
"""Youtubedlg module to update youtube-dl binary.
Attributes:
UPDATE_PUB_TOPIC (string): wxPublisher subscription topic of the
UpdateThread thread.
"""
import json
import os.path
from threading import Thread
from urllib.request import urlopen
from urllib.error import URLError, H... | [
"wx.CallAfter",
"json.load",
"urllib.request.urlopen"
] | [((3562, 3638), 'wx.CallAfter', 'CallAfter', (['Publisher.sendMessage', 'UPDATE_PUB_TOPIC'], {'signal': 'signal', 'data': 'data'}), '(Publisher.sendMessage, UPDATE_PUB_TOPIC, signal=signal, data=data)\n', (3571, 3638), False, 'from wx import CallAfter\n'), ((1666, 1732), 'urllib.request.urlopen', 'urlopen', (['self.LAT... |
import csv
class Validator(object):
''' validate csv file data type and str length '''
def validate_data_type(self, file_input, types):
with open(file_input) as csv_file:
csv_reader = csv.reader(csv_file)
header = next(csv_reader)
for line in csv_reader:
... | [
"csv.reader"
] | [((213, 233), 'csv.reader', 'csv.reader', (['csv_file'], {}), '(csv_file)\n', (223, 233), False, 'import csv\n'), ((515, 535), 'csv.reader', 'csv.reader', (['csv_file'], {}), '(csv_file)\n', (525, 535), False, 'import csv\n')] |
from django.core.cache import cache
from django.test import Client, TestCase
from django.urls.base import reverse
from posts.models import Follow, Group, Post, User
SLUG = 'test-slug'
TEXT = 'Тестовый текст'
TEXT_2 = 'Тестовый текст 2'
TEXT_3 = 'Тестовый текст 3'
USER = 'Name'
AUTHOR = 'V'
TITLE = 'Тестовое название'... | [
"django.core.cache.cache.clear",
"django.test.Client",
"posts.models.Follow.objects.create",
"posts.models.User.objects.create_user",
"posts.models.Post.objects.create",
"django.urls.base.reverse",
"posts.models.Group.objects.create"
] | [((389, 411), 'django.urls.base.reverse', 'reverse', (['"""posts:index"""'], {}), "('posts:index')\n", (396, 411), False, 'from django.urls.base import reverse\n'), ((430, 458), 'django.urls.base.reverse', 'reverse', (['"""posts:post_create"""'], {}), "('posts:post_create')\n", (437, 458), False, 'from django.urls.base... |