code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import multiprocessing
import time
import queue
import threading
from common import game
from common.command import AttackCommand
from common.user import User
from common.visualizer import Visualizer
import logging
logger = logging.getLogger("sys." + __name__.split(".")[-1])
class Engine(multiprocessing.Process):
... | [
"common.visualizer.Visualizer",
"common.game.Game",
"multiprocessing.Process.__init__",
"common.user.User",
"time.sleep",
"threading.Thread",
"time.time"
] | [((599, 637), 'multiprocessing.Process.__init__', 'multiprocessing.Process.__init__', (['self'], {}), '(self)\n', (631, 637), False, 'import multiprocessing\n'), ((854, 865), 'common.game.Game', 'game.Game', ([], {}), '()\n', (863, 865), False, 'from common import game\n'), ((2083, 2094), 'time.time', 'time.time', ([],... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pandas as pd
import sklearn.metrics as mr
from sklearn.utils.class_weight import compute_sample_weight
def get_eval_metrics(y_test, y_probs, split="test", threshold=0.5, beta=2):
y_pred_test_selected_threshold = (y_probs >= threshold).astype("int")
d = {... | [
"sklearn.metrics.auc",
"sklearn.metrics.precision_recall_curve",
"sklearn.utils.class_weight.compute_sample_weight",
"pandas.DataFrame.from_dict",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.confusion_matrix"
] | [((2857, 2905), 'sklearn.metrics.precision_recall_curve', 'mr.precision_recall_curve', (['ground_truth', 'y_probs'], {}), '(ground_truth, y_probs)\n', (2882, 2905), True, 'import sklearn.metrics as mr\n'), ((2925, 2950), 'sklearn.metrics.auc', 'mr.auc', (['recall', 'precision'], {}), '(recall, precision)\n', (2931, 295... |
#!/usr/bin/env python3
"""
Symbol Prepare
Takes the Etterna.sym file, and creates a google breakpad directory structure.
Creates to simplify use when uploading to action artifacts.
"""
import os
import sys
import shutil
from pathlib import Path
def get_metadata(filename: str):
"""Read first line to get relevant f... | [
"shutil.copyfile",
"pathlib.Path",
"os.makedirs",
"sys.exit"
] | [((821, 832), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (829, 832), False, 'import sys\n'), ((626, 698), 'pathlib.Path', 'Path', (['"""EtternaSymbolsUploadDir"""', '"""EtternaSymbols"""', 'module_id', 'build_uuid'], {}), "('EtternaSymbolsUploadDir', 'EtternaSymbols', module_id, build_uuid)\n", (630, 698), False, ... |
"""
********************************************************************************
base
********************************************************************************
.. deprecated:: 1.5
Use `compas.data` instead
.. currentmodule:: compas.base
Classes
=======
.. autosummary::
:toctree: generated/
:n... | [
"warnings.warn"
] | [((545, 658), 'warnings.warn', 'warnings.warn', (['"""The base module is deprecated. Use the data module instead"""', 'DeprecationWarning'], {'stacklevel': '(2)'}), "('The base module is deprecated. Use the data module instead',\n DeprecationWarning, stacklevel=2)\n", (558, 658), False, 'import warnings\n')] |
import re
from models.call import Call
class Parser:
def __init__(self):
self.calls_db = Call()
self.emp_flag = None
self.sub_dept_flag = None
self.email_flag = False
def parse_text(self, file):
with open(file, 'r+', encoding="utf-16") as f:
for line in f.re... | [
"models.call.Call",
"re.match",
"re.search"
] | [((102, 108), 'models.call.Call', 'Call', ([], {}), '()\n', (106, 108), False, 'from models.call import Call\n'), ((350, 385), 're.search', 're.search', (['"""(^\\\\s|^[0-9]{8})"""', 'line'], {}), "('(^\\\\s|^[0-9]{8})', line)\n", (359, 385), False, 'import re\n'), ((1536, 1567), 're.match', 're.match', (['"""^[0-9]{3}... |
from apps.a_common.constants import UserIdentity
from apps.a_common.scheme import PageInfo
from apps.crud.role import get_users_by_role_id
from apps.model.user import UserDB
from apps.model.user2role import User2RoleDB
from apps.model.role import RoleDB
from apps.test import assert_response_fail, assert_response_... | [
"apps.test.get_client",
"apps.test.assert_response_fail",
"apps.test.clean_all",
"apps.a_common.scheme.PageInfo",
"apps.test.generate_user2role",
"apps.test.generate_user",
"utils.encode.uuid",
"apps.test.generate_role",
"apps.test.assert_response_success",
"apps.test.override_get_user",
"apps.m... | [((777, 788), 'apps.test.clean_all', 'clean_all', ([], {}), '()\n', (786, 788), False, 'from apps.test import assert_response_fail, assert_response_success, clean_all, generate_user, generate_user2role, generate_role, get_client, get_session_local, override_get_user\n'), ((12407, 12419), 'apps.test.get_client', 'get_cl... |
"""CS 61A Presents The Game of Hog."""
from email import message
from unittest import result
from dice import six_sided, four_sided, make_test_dice
from ucb import main, trace, interact
GOAL_SCORE = 100 # The goal of Hog is to score 100 points.
######################
# Phase 1: Simulator #
######################
... | [
"argparse.ArgumentParser"
] | [((13343, 13390), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Play Hog"""'}), "(description='Play Hog')\n", (13366, 13390), False, 'import argparse\n')] |
"""
Bing (Videos)
@website https://www.bing.com/videos
@provide-api yes (http://datamarket.azure.com/dataset/bing/search)
@using-api no
@results HTML
@stable no
@parse url, title, content, thumbnail
"""
from json import loads
from lxml import html
from searx.engines.bing_images import _fe... | [
"searx.utils.match_language",
"lxml.html.fromstring",
"searx.url_utils.urlencode"
] | [((2006, 2032), 'lxml.html.fromstring', 'html.fromstring', (['resp.text'], {}), '(resp.text)\n', (2021, 2032), False, 'from lxml import html\n'), ((1373, 1446), 'searx.utils.match_language', 'match_language', (["params['language']", 'supported_languages', 'language_aliases'], {}), "(params['language'], supported_langua... |
from CustomClass import CustomClass
Dummy = CustomClass(1,2,"Name")
print(Dummy.__getter__())
| [
"CustomClass.CustomClass"
] | [((45, 70), 'CustomClass.CustomClass', 'CustomClass', (['(1)', '(2)', '"""Name"""'], {}), "(1, 2, 'Name')\n", (56, 70), False, 'from CustomClass import CustomClass\n')] |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import argparse
from misc import *
import pandas as pd
DEFPATH = "/home/bakirillov/HDD/weights/fasttext/aligned/wiki.en.align.vec"
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"-v", "--vectors",
dest="vec... | [
"pandas.DataFrame",
"argparse.ArgumentParser",
"pandas.read_csv"
] | [((225, 250), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (248, 250), False, 'import argparse\n'), ((1539, 1577), 'pandas.read_csv', 'pd.read_csv', (['args.vectors'], {'index_col': '(0)'}), '(args.vectors, index_col=0)\n', (1550, 1577), True, 'import pandas as pd\n'), ((1810, 1828), 'pandas.... |
from pyramid.security import unauthenticated_userid
from .models import User
def get_user(request):
user_id = unauthenticated_userid(request)
if user_id is not None:
return User.fetch_by_id(user_id)
def group_finder(user_id, request):
user = request.user
if user:
return ['admin'] if ... | [
"pyramid.security.unauthenticated_userid"
] | [((116, 147), 'pyramid.security.unauthenticated_userid', 'unauthenticated_userid', (['request'], {}), '(request)\n', (138, 147), False, 'from pyramid.security import unauthenticated_userid\n')] |
# -*- coding:utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# Copyright 2012 Red Hat, Inc.
# Copyright (c) 2012 Samsung SDS Co., LTD... | [
"synaps.utils.parse_groupnotification_action",
"synaps.log.getLogger",
"synaps.db.Cassandra",
"synaps.exception.InvalidRequest",
"synaps.utils.utcnow",
"pandas.datetools.Minute",
"json.dumps",
"synaps.exception.AdminRequired",
"pandas.DataFrame",
"synaps.exception.MetricAlarmQuotaExceeded",
"syn... | [((1499, 1526), 'synaps.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1516, 1526), True, 'from synaps import log as logging\n'), ((1796, 1807), 'synaps.db.Cassandra', 'Cassandra', ([], {}), '()\n', (1805, 1807), False, 'from synaps.db import Cassandra\n'), ((1827, 1852), 'synaps.rpc.RemotePr... |
from client_app import views as client_views
from django.urls import include, path
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(
r'client',
client_views.ClientViewSet,
basename='client'
)
urlpatterns = [
path(r'', include(router.urls)),
]
| [
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((142, 157), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (155, 157), False, 'from rest_framework.routers import DefaultRouter\n'), ((277, 297), 'django.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (284, 297), False, 'from django.urls import include, path\n')] |
#!/usr/bin/env python
from distutils.core import setup
from fs import __version__ as VERSION
COMMANDS = ['fscat',
'fscp',
'fsinfo',
'fsls',
'fsmv',
'fscp',
'fsrm',
'fsserve',
'fstree',
'fsmkdir',
'f... | [
"distutils.core.setup"
] | [((1076, 1700), 'distutils.core.setup', 'setup', ([], {'name': '"""fs"""', 'version': 'VERSION', 'description': '"""Filesystem abstraction"""', 'long_description': 'long_desc', 'license': '"""BSD"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""http://code.google.com/p/pyfilesystem/"""', 'down... |
from discord.ext import commands
from xml.etree import ElementTree
import discord, os, requests, time, re, random
from azure.cognitiveservices.language.textanalytics import TextAnalyticsClient
from msrest.authentication import CognitiveServicesCredentials
tts_subscription_key = '<KEY>'
text_analytics_subscription_key ... | [
"discord.ext.commands.Cog.listener",
"os.listdir",
"requests.post",
"random.choice",
"discord.utils.get",
"xml.etree.ElementTree.tostring",
"discord.FFmpegPCMAudio",
"os.path.splitext",
"azure.cognitiveservices.language.textanalytics.TextAnalyticsClient",
"xml.etree.ElementTree.Element",
"msrest... | [((478, 501), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (499, 501), False, 'from discord.ext import commands\n'), ((2171, 2197), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""來"""'}), "(name='來')\n", (2187, 2197), False, 'from discord.ext import commands\n')... |
import orca
import pandas as pd
from urbansim_templates import modelmanager, shared, utils, __version__
from urbansim_templates.shared import CoreTemplateSettings, OutputColumnSettings
class ExpressionSettings():
"""
Stores custom parameters used by the
:mod:`~urbansim_templates.data.ColumnFromExpressio... | [
"urbansim_templates.shared.CoreTemplateSettings",
"urbansim_templates.shared.CoreTemplateSettings.from_dict",
"urbansim_templates.shared.OutputColumnSettings",
"urbansim_templates.utils.cols_in_expression",
"urbansim_templates.shared.OutputColumnSettings.from_dict",
"urbansim_templates.utils.get_df",
"u... | [((4881, 4927), 'urbansim_templates.utils.cols_in_expression', 'utils.cols_in_expression', (['self.data.expression'], {}), '(self.data.expression)\n', (4905, 4927), False, 'from urbansim_templates import modelmanager, shared, utils, __version__\n'), ((5112, 5158), 'urbansim_templates.shared.register_column', 'shared.re... |
"""A wrapper around some ctypes object, providing direct array-like access to the bits."""
import ctypes
class BitView:
def __init__(self, value=ctypes.c_uint(0), begin=0, end=None):
"""A wrapper around some ctypes object, providing direct array-like access to the bits.
Constructor assigns `value`... | [
"ctypes.c_uint",
"ctypes.sizeof"
] | [((151, 167), 'ctypes.c_uint', 'ctypes.c_uint', (['(0)'], {}), '(0)\n', (164, 167), False, 'import ctypes\n'), ((863, 883), 'ctypes.sizeof', 'ctypes.sizeof', (['value'], {}), '(value)\n', (876, 883), False, 'import ctypes\n'), ((932, 952), 'ctypes.sizeof', 'ctypes.sizeof', (['value'], {}), '(value)\n', (945, 952), Fals... |
# Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"synthtool.metadata.add_git_source",
"json.loads",
"synthtool.metadata.add_generator_source",
"synthtool.metadata.get",
"synthtool.metadata.reset"
] | [((653, 669), 'synthtool.metadata.reset', 'metadata.reset', ([], {}), '()\n', (667, 669), False, 'from synthtool import metadata\n'), ((675, 739), 'synthtool.metadata.add_git_source', 'metadata.add_git_source', ([], {'sha': '"""sha"""', 'name': '"""name"""', 'remote': '"""remote"""'}), "(sha='sha', name='name', remote=... |
import pytest
from essentials.exceptions import AcceptedException, ObjectNotFound
def test_object_not_found_default_message():
assert "Object not found" == str(ObjectNotFound())
@pytest.mark.parametrize("message", [
"Product",
"Product not found",
"Cat not found"
])
def test_object_not_found_messag... | [
"essentials.exceptions.AcceptedException",
"pytest.mark.parametrize",
"essentials.exceptions.ObjectNotFound"
] | [((188, 277), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""message"""', "['Product', 'Product not found', 'Cat not found']"], {}), "('message', ['Product', 'Product not found',\n 'Cat not found'])\n", (211, 277), False, 'import pytest\n'), ((594, 714), 'pytest.mark.parametrize', 'pytest.mark.parametri... |
from data.vispapers import read_all, DATA_FOLDER
import json
import gzip
def preprocess():
with gzip.open(DATA_FOLDER / 'vispapers.jsonl.gz', 'wt', encoding='utf-8') as file:
for document in read_all():
file.write(json.dumps(document)+'\n')
if __name__ == '__main__':
preprocess() | [
"json.dumps",
"data.vispapers.read_all",
"gzip.open"
] | [((102, 171), 'gzip.open', 'gzip.open', (["(DATA_FOLDER / 'vispapers.jsonl.gz')", '"""wt"""'], {'encoding': '"""utf-8"""'}), "(DATA_FOLDER / 'vispapers.jsonl.gz', 'wt', encoding='utf-8')\n", (111, 171), False, 'import gzip\n'), ((205, 215), 'data.vispapers.read_all', 'read_all', ([], {}), '()\n', (213, 215), False, 'fr... |
import os
import json
from pathlib import Path
import pem
from Crypto.PublicKey import RSA
from jupyterhub.handlers import BaseHandler
from illumidesk.authenticators.utils import LTIUtils
from illumidesk.lti13.auth import get_jwk
from tornado import web
from urllib.parse import urlencode
from urllib.parse import ... | [
"illumidesk.lti13.auth.get_jwk",
"pathlib.Path",
"pem.parse_file",
"json.dumps",
"os.environ.get",
"os.access",
"urllib.parse.quote",
"illumidesk.authenticators.utils.LTIUtils",
"urllib.parse.urlencode"
] | [((1237, 1247), 'illumidesk.authenticators.utils.LTIUtils', 'LTIUtils', ([], {}), '()\n', (1245, 1247), False, 'from illumidesk.authenticators.utils import LTIUtils\n'), ((5011, 5046), 'os.environ.get', 'os.environ.get', (['"""LTI13_PRIVATE_KEY"""'], {}), "('LTI13_PRIVATE_KEY')\n", (5025, 5046), False, 'import os\n'), ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import client as clt
import time
#from struct import *
primes = [32, 66, 77, 152, 8447,6311,941027,909631,49022843,59366651,470202691643,722082735347]
key = []
for i in range(len(primes)):
key.append(clt.sendRequest(44,primes[i],8))
time.sleep(1)
for i in rang... | [
"client.getReply",
"time.sleep",
"client.sendRequest"
] | [((293, 306), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (303, 306), False, 'import time\n'), ((359, 385), 'client.getReply', 'clt.getReply', (['key[i]', '(True)'], {}), '(key[i], True)\n', (371, 385), True, 'import client as clt\n'), ((256, 289), 'client.sendRequest', 'clt.sendRequest', (['(44)', 'primes[i]',... |
from nose.tools import *
import os
import pysam
from collections import OrderedDict
try:
from index_bam_by_read_id.index_bam_by_read_id import IndexByReadId,UnsortedBamError
except ImportError:
from index_bam_by_read_id import IndexByReadId,UnsortedBamError
_f = 'test_data/test.bam'
_s = "test_data/test_rid_... | [
"os.path.exists",
"index_bam_by_read_id.IndexByReadId",
"os.remove"
] | [((711, 728), 'index_bam_by_read_id.IndexByReadId', 'IndexByReadId', (['_f'], {}), '(_f)\n', (724, 728), False, 'from index_bam_by_read_id import IndexByReadId, UnsortedBamError\n'), ((787, 805), 'index_bam_by_read_id.IndexByReadId', 'IndexByReadId', (['_f2'], {}), '(_f2)\n', (800, 805), False, 'from index_bam_by_read_... |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from json_schema import CachedLoad
from idl_schema import Load
from model import Platforms
import model
import unittest
class Mode... | [
"json_schema.CachedLoad",
"model.Model",
"model.CamelName",
"model.UnixName",
"unittest.main",
"idl_schema.Load"
] | [((8176, 8191), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8189, 8191), False, 'import unittest\n'), ((382, 395), 'model.Model', 'model.Model', ([], {}), '()\n', (393, 395), False, 'import model\n'), ((424, 459), 'json_schema.CachedLoad', 'CachedLoad', (['"""test/permissions.json"""'], {}), "('test/permission... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Created on 18/10/11 16:32:52
@author: <NAME>
"""
from collections import Counter
from typing import List
import numpy as np
from antNRE.lib.k_means import KMeans
class DataLoader:
def __init__(self,
datasets: List,
n_bkts: int) -> None:
len_counter = Co... | [
"collections.Counter",
"antNRE.lib.k_means.KMeans",
"numpy.random.shuffle"
] | [((318, 327), 'collections.Counter', 'Counter', ([], {}), '()\n', (325, 327), False, 'from collections import Counter\n'), ((443, 470), 'antNRE.lib.k_means.KMeans', 'KMeans', (['n_bkts', 'len_counter'], {}), '(n_bkts, len_counter)\n', (449, 470), False, 'from antNRE.lib.k_means import KMeans\n'), ((1603, 1629), 'numpy.... |
# -*- coding: utf-8 -*-
# @File : google_im2txt/get_uni_caption.py
# @Info : @ TSMC-SIGGRAPH, 2018/7/9
# @Desc :
# -.-.. - ... -- -.-. .-.. .- -... .---. -.-- ..- .-.. --- -. --. ..-. .- -.
import re
from utils.emb_json import load_json_file, store_json_file
data = load_json_file("google_im2txt_cap.js... | [
"utils.emb_json.store_json_file",
"utils.emb_json.load_json_file",
"re.compile"
] | [((284, 324), 'utils.emb_json.load_json_file', 'load_json_file', (['"""google_im2txt_cap.json"""'], {}), "('google_im2txt_cap.json')\n", (298, 324), False, 'from utils.emb_json import load_json_file, store_json_file\n'), ((336, 373), 're.compile', 're.compile', (['"""COCO_val2014_(\\\\d+).jpg"""'], {}), "('COCO_val2014... |
import re
from tex_printable import board_size
def build_01_board(crosswords_lines):
row_num, col_num = board_size(crosswords_lines)
# print(crosswords_lines)
# with open("crosswords_out.txt", "rt") as f:
# crosswords = f.read()
#
# crosswords = "\n".join([line for line in crosswords.splitlines() if line... | [
"tex_printable.board_size",
"re.compile"
] | [((110, 138), 'tex_printable.board_size', 'board_size', (['crosswords_lines'], {}), '(crosswords_lines)\n', (120, 138), False, 'from tex_printable import board_size\n'), ((353, 372), 're.compile', 're.compile', (['"""[A-Z]"""'], {}), "('[A-Z]')\n", (363, 372), False, 'import re\n')] |
# coding:utf-8
import cPickle
import time
import urlparse
from functools import wraps
from flask import request
import settings
from services import redis
from utils import get_func_name
from utils.log import app_logger
def _generate_key(namespace, tag, **kwargs):
prefix = 'cached_call'
if namespace == 'fun... | [
"utils.get_func_name",
"cPickle.loads",
"functools.wraps",
"utils.log.app_logger.debug",
"cPickle.dumps",
"services.redis.lock",
"urlparse.urlsplit",
"time.time",
"utils.log.app_logger.exception",
"services.redis.get"
] | [((3252, 3324), 'services.redis.lock', 'redis.lock', ([], {'name': 'key', 'timeout': 'timeout', 'blocking_timeout': 'blocking_timeout'}), '(name=key, timeout=timeout, blocking_timeout=blocking_timeout)\n', (3262, 3324), False, 'from services import redis\n'), ((927, 938), 'functools.wraps', 'wraps', (['func'], {}), '(f... |
#!/usr/bin/env python
# coding: utf-8
# In[3]:
from sklearn import svm, datasets
from sklearn.model_selection import train_test_split
import numpy as np
import pandas as pd
url = "C:/Users/USUARIO/Desktop/Tesis/centroides-Apriori4.csv"
datos = pd.read_csv(url, sep=",")
# In[5]:
iris = datos
# Add noisy featur... | [
"sklearn.preprocessing.label_binarize",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"numpy.random.RandomState",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.linspace",
"matplotlib.pyplot.ylim",
"itertools.cycle",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.ave... | [((248, 273), 'pandas.read_csv', 'pd.read_csv', (['url'], {'sep': '""","""'}), "(url, sep=',')\n", (259, 273), True, 'import pandas as pd\n'), ((338, 362), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (359, 362), True, 'import numpy as np\n'), ((560, 638), 'sklearn.model_selection.train_... |
import machine
tcounter = 0
p1 = machine.Pin(18)
p1.init(p1.OUT)
p1.value(1)
def tcb(timer):
global tcounter
if tcounter & 1:
p1.value(0)
else:
p1.value(1)
tcounter += 1
if (tcounter % 100) == 0:
print("[tcb] timer: {} counter: {}".format(timer.timernum(), tcounter))
# t1... | [
"machine.Timer",
"machine.Pin"
] | [((35, 50), 'machine.Pin', 'machine.Pin', (['(18)'], {}), '(18)\n', (46, 50), False, 'import machine\n'), ((352, 368), 'machine.Timer', 'machine.Timer', (['(2)'], {}), '(2)\n', (365, 368), False, 'import machine\n')] |
# Copyright (C) 2018-2020 JCT
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribut... | [
"PyQt5.QtWidgets.QTableWidget",
"PyQt5.QtWidgets.QDialogButtonBox",
"PyQt5.QtWidgets.QDialog.accept",
"PyQt5.QtWidgets.QComboBox",
"PyQt5.QtWidgets.QDialog.reject",
"PyQt5.QtWidgets.QDialog.__init__",
"salome.smesh.smeshBuilder.GetName",
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtWidgets.QLabel",
"Py... | [((1742, 1779), 'PyQt5.QtWidgets.QDialog.__init__', 'QtWGui.QDialog.__init__', (['self', 'parent'], {}), '(self, parent)\n', (1765, 1779), True, 'from PyQt5 import QtWidgets as QtWGui\n'), ((2608, 2632), 'PyQt5.QtWidgets.QGridLayout', 'QtWGui.QGridLayout', (['self'], {}), '(self)\n', (2626, 2632), True, 'from PyQt5 imp... |
from copy import deepcopy
from re import finditer
from operation import *
from pieces import *
from position import Pos
from pprint import pprint
white, black = 0, 1
class Board:
def __init__(self, board: list, turn: int=0, castling: list=[True for i in range(4)]):
"""A Board object containing chess pieces and ot... | [
"position.Pos",
"re.finditer",
"copy.deepcopy"
] | [((3920, 3941), 'copy.deepcopy', 'deepcopy', (['piece.color'], {}), '(piece.color)\n', (3928, 3941), False, 'from copy import deepcopy\n'), ((3955, 3982), 'copy.deepcopy', 'deepcopy', (['operation.new_pos'], {}), '(operation.new_pos)\n', (3963, 3982), False, 'from copy import deepcopy\n'), ((2008, 2055), 're.finditer',... |
# -*- coding: utf-8 -*-
# -*- python 3 -*-
# -*- hongzhong Lu -*-
import os
os.chdir('/Users/luho/PycharmProjects/model/model_correction/code')
exec(open("./find_subsystem_Yeast8_using_code.py").read())
#it can be found that the reaction in different software is different in some formats
#thus the reaction list will be... | [
"os.chdir"
] | [((76, 143), 'os.chdir', 'os.chdir', (['"""/Users/luho/PycharmProjects/model/model_correction/code"""'], {}), "('/Users/luho/PycharmProjects/model/model_correction/code')\n", (84, 143), False, 'import os\n')] |
"""
Copyright (c) 2016-17 <NAME> http://www.keithsterling.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, mer... | [
"logging.getLogger",
"os.path.exists",
"os.listdir",
"logging.debug",
"os.path.join",
"logging.exception",
"logging.info",
"logging.error",
"os.remove"
] | [((7822, 7867), 'logging.debug', 'logging.debug', (['"""Emptying Conversation Folder"""'], {}), "('Emptying Conversation Folder')\n", (7835, 7867), False, 'import logging\n'), ((8771, 8807), 'logging.debug', 'logging.debug', (['"""Saving conversation"""'], {}), "('Saving conversation')\n", (8784, 8807), False, 'import ... |
import argparse
import os
from typing import List
from scraper import EMAIL, PASSWORD, extract
def orchestrate_youtube_dl(path: str, links: List[str]):
for link in links:
os.system(
f'{path} --verbose --ignore-errors --id --username {EMAIL} --password {PASSWORD} {link}'
)
if __name_... | [
"os.system",
"argparse.ArgumentParser"
] | [((350, 427), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Download All Videos From Facebook Page"""'}), "(description='Download All Videos From Facebook Page')\n", (373, 427), False, 'import argparse\n'), ((186, 295), 'os.system', 'os.system', (['f"""{path} --verbose --ignore-errors -... |
from random import randint
import requests
from lxml import html
import datetime
import time
def reviews(in_product_id, *arg):
product_id = str(in_product_id)
try:
if str(arg[0]).lower() == 'log':
log = 1
else:
log = 0
except:
log = 0
gen_headers = st... | [
"datetime.datetime.fromtimestamp",
"lxml.html.fromstring",
"requests.get",
"time.time",
"random.randint"
] | [((866, 887), 'lxml.html.fromstring', 'html.fromstring', (['page'], {}), '(page)\n', (881, 887), False, 'from lxml import html\n'), ((7497, 7508), 'time.time', 'time.time', ([], {}), '()\n', (7506, 7508), False, 'import time\n'), ((739, 784), 'requests.get', 'requests.get', (['walmart_url'], {'headers': 'in_headers'}),... |
# Generated by Django 2.0.8 on 2019-01-02 20:12
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0011_auto_20181117_0029'),
]
operations = [
migrations.AlterUniqueTogether(
n... | [
"django.db.models.NullBooleanField",
"django.db.migrations.DeleteModel",
"django.db.migrations.RemoveField"
] | [((390, 449), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""usertags"""', 'name': '"""image"""'}), "(model_name='usertags', name='image')\n", (412, 449), False, 'from django.db import migrations, models\n'), ((494, 551), 'django.db.migrations.RemoveField', 'migrations.RemoveField... |
# Hacktoberfest 2021
# Problem: House Prices
#
# You are given an array that represents house prices.
# Calculate and output the percentage of houses that are within one standard deviation from the mean.
# To calculate the percentage, divide the number of houses that satisfy the condition by the total number of h... | [
"numpy.array",
"numpy.mean",
"numpy.std"
] | [((391, 534), 'numpy.array', 'np.array', (['[150000, 125000, 320000, 540000, 200000, 120000, 160000, 230000, 280000, \n 290000, 300000, 500000, 420000, 100000, 150000, 280000]'], {}), '([150000, 125000, 320000, 540000, 200000, 120000, 160000, 230000, \n 280000, 290000, 300000, 500000, 420000, 100000, 150000, 2800... |
#xyz Sep 2017
'''
Data preparation for datsets: stanford_indoor, scannet, ETH_semantic3D
Core idea: store all the information in hdf5 file itself
# The workflow to use this tool:
Raw_H5f -> Sorted_H5f -> merge block to get new block size -> randomnly select n points
-> Normed_H5f -> Net_Provider
## Raw_H5f store ... | [
"datasets_meta.DatasetsMeta",
"numpy.hstack",
"numpy.array2string",
"numpy.array",
"sys.path.append",
"numpy.arange",
"os.path.exists",
"numpy.searchsorted",
"numpy.sort",
"numpy.fix",
"numpy.max",
"numpy.rint",
"numpy.concatenate",
"numpy.min",
"numpy.maximum",
"glob.glob",
"numpy.c... | [((1444, 1469), 'os.path.dirname', 'os.path.dirname', (['BASE_DIR'], {}), '(BASE_DIR)\n', (1459, 1469), False, 'import os\n'), ((1470, 1495), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (1485, 1495), False, 'import sys\n'), ((1789, 1835), 'sys.path.append', 'sys.path.append', (["(BASE_DIR ... |
from flask import render_template,request,redirect,url_for,abort,flash
from . import main
from .. import db,photos
from ..requests import get_quotes
from flask_login import login_required,current_user
# from ..requests import get_movies,get_movie,search_movie
from .forms import BlogForm,CommentForm,UpdateProfile
from .... | [
"flask.render_template",
"flask.abort",
"flask.flash",
"flask.url_for"
] | [((496, 600), 'flask.render_template', 'render_template', (['"""index.html"""'], {'current_user': 'current_user', 'blog': 'blog', 'comment': 'comment', 'quotes': 'quotes'}), "('index.html', current_user=current_user, blog=blog, comment\n =comment, quotes=quotes)\n", (511, 600), False, 'from flask import render_templ... |
from django.contrib import admin
from server.apps import Text, Sentence
admin.site.register(Text)
admin.site.register(Sentence)
| [
"django.contrib.admin.site.register"
] | [((74, 99), 'django.contrib.admin.site.register', 'admin.site.register', (['Text'], {}), '(Text)\n', (93, 99), False, 'from django.contrib import admin\n'), ((100, 129), 'django.contrib.admin.site.register', 'admin.site.register', (['Sentence'], {}), '(Sentence)\n', (119, 129), False, 'from django.contrib import admin\... |
import logging
from django.urls import reverse
from core.tests.base import ( SetUpBrandsCategoriesModelsTestPlus,
BaseUserWebTestCase, setup_view_for_tests )
from core.utils import getExceptionMessageFromResponse
from ..forms import CreateSearchForm, Upd... | [
"core.utils.getExceptionMessageFromResponse",
"logging.disable",
"django.urls.reverse"
] | [((4102, 4135), 'logging.disable', 'logging.disable', (['logging.CRITICAL'], {}), '(logging.CRITICAL)\n', (4117, 4135), False, 'import logging\n'), ((6251, 6282), 'logging.disable', 'logging.disable', (['logging.NOTSET'], {}), '(logging.NOTSET)\n', (6266, 6282), False, 'import logging\n'), ((889, 913), 'django.urls.rev... |
from django.db.models import ForeignKey
from .base import ProxyField
class ProxyForeignKey(ProxyField):
def __init__(self, *args, **kwargs):
super(ProxyForeignKey, self).__init__(ForeignKey(*args, **kwargs))
| [
"django.db.models.ForeignKey"
] | [((193, 220), 'django.db.models.ForeignKey', 'ForeignKey', (['*args'], {}), '(*args, **kwargs)\n', (203, 220), False, 'from django.db.models import ForeignKey\n')] |
from django.db import models
from django.utils.six import python_2_unicode_compatible
# from channels import Group
from .settings import MSG_TYPE_MESSAGE
from django.contrib.auth import get_user_model
User = get_user_model()
@python_2_unicode_compatible
class AlphaChannel(models.Model):
"""
A channel for people to ... | [
"django.contrib.auth.get_user_model",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((209, 225), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (223, 225), False, 'from django.contrib.auth import get_user_model\n'), ((359, 391), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (375, 391), False, 'from django.db import mo... |
# -*- coding: utf-8 -*-
"""Supports Kp index values. Downloads data from ftp.gfz-potsdam.de or SWPC.
Parameters
----------
platform
'sw'
name
'kp'
tag
- '' : Standard Kp data
- 'forecast' : Grab forecast data from SWPC (next 3 days)
- 'recent' : Grab last 30 days of Kp data from SWPC
Note
----
Sta... | [
"logging.getLogger",
"pandas.read_csv",
"pysat.Files.from_os",
"numpy.array",
"numpy.isfinite",
"pysat.datetime.now",
"pandas.date_range",
"numpy.arange",
"os.remove",
"ftplib.FTP",
"pysat.datetime.strptime",
"numpy.where",
"pandas.DataFrame",
"sys.stdout.flush",
"pandas.read_fwf",
"py... | [((2093, 2120), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2110, 2120), False, 'import logging\n'), ((2384, 2404), 'pysat.datetime.now', 'pysat.datetime.now', ([], {}), '()\n', (2402, 2404), False, 'import pysat\n'), ((2413, 2457), 'pysat.datetime', 'pysat.datetime', (['now.year', 'n... |
from posts.models import Post
from profiles.models import Profile
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from rest_framework_simplejwt.authentication import JWTAuthentication
from rest_framework.decorators import (
api_view,
permission_classes,
au... | [
"follows.models.Follow.objects.get",
"profiles.models.Profile.objects.get",
"rest_framework.decorators.permission_classes",
"follows.models.Follow",
"rest_framework.decorators.authentication_classes",
"rest_framework.response.Response",
"rest_framework.decorators.api_view"
] | [((568, 586), 'rest_framework.decorators.api_view', 'api_view', (["['POST']"], {}), "(['POST'])\n", (576, 586), False, 'from rest_framework.decorators import api_view, permission_classes, authentication_classes\n'), ((588, 625), 'rest_framework.decorators.permission_classes', 'permission_classes', (['[IsAuthenticated]'... |
from sklearn.preprocessing import MinMaxScaler, StandardScaler
import numpy as np
import pandas as pd
import torch
from torch import nn
import matplotlib.pyplot as plt
import pickle
from IPython import display
from .useful import ts as src
from .useful import iterators
from .models import lstm as models... | [
"matplotlib.pyplot.ylabel",
"numpy.array",
"torch.nn.MSELoss",
"torch.cuda.is_available",
"numpy.arange",
"numpy.mean",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.datetime64",
"pandas.DataFrame",
"sklearn.preprocessing.MinMaxScaler",
"matplotlib.pyplot.axvspan",
"pickle.loa... | [((27389, 27416), 'numpy.datetime64', 'np.datetime64', (['df.index[-1]'], {}), '(df.index[-1])\n', (27402, 27416), True, 'import numpy as np\n'), ((27439, 27482), 'numpy.timedelta64', 'np.timedelta64', (['(df.index[-1] - df.index[-2])'], {}), '(df.index[-1] - df.index[-2])\n', (27453, 27482), True, 'import numpy as np\... |
"""Models for Geodataset"""
from django.db import models
from django.utils.functional import cached_property
from branding.mixins import OrganizationMixin
from everyvoter_common.utils.models import TimestampModel, UUIDModel
from everyvoter_common.utils.soft_delete import SoftDeleteModel, ActiveManager
class GeoDatas... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"everyvoter_common.utils.soft_delete.ActiveManager",
"django.db.models.CharField"
] | [((456, 495), 'django.db.models.CharField', 'models.CharField', (['"""Name"""'], {'max_length': '(50)'}), "('Name', max_length=50)\n", (472, 495), False, 'from django.db import models\n'), ((513, 580), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['"""geodataset.GeoDatasetCategory"""'], {'blank': '(Tr... |
from django.db import models
# Create your models here.
class Book(models.Model):
title = models.CharField('书名', max_length=50)
def __str__(self):
return self.title
class Author(models.Model):
name = models.CharField('作者', max_length=50)
books = models.ManyToManyField(Book)
def __str_... | [
"django.db.models.ManyToManyField",
"django.db.models.CharField"
] | [((97, 134), 'django.db.models.CharField', 'models.CharField', (['"""书名"""'], {'max_length': '(50)'}), "('书名', max_length=50)\n", (113, 134), False, 'from django.db import models\n'), ((226, 263), 'django.db.models.CharField', 'models.CharField', (['"""作者"""'], {'max_length': '(50)'}), "('作者', max_length=50)\n", (242, ... |
## Linear Regression Channel
## Ref https://medium.com/coinmonks/trading-bitcoin-with-linear-regression-channels-b84e7e43d984
from google.protobuf import symbol_database
from st_stock.stocky import get_assets
from typing import List
from datetime import datetime
import seaborn as sns
from matplotlib import pyplot a... | [
"seaborn.set",
"seaborn.regplot",
"numpy.log",
"streamlit.write",
"st_stock.misc.load_config",
"st_stock.misc.load_cypto_symbols",
"streamlit.dataframe",
"st_stock.stocky.get_assets",
"streamlit.sidebar.selectbox",
"numpy.std",
"streamlit.header",
"matplotlib.pyplot.subplots"
] | [((931, 976), 'st_stock.stocky.get_assets', 'get_assets', (['symbol', 'period'], {'interval': 'interval'}), '(symbol, period, interval=interval)\n', (941, 976), False, 'from st_stock.stocky import get_assets\n'), ((1113, 1129), 'numpy.log', 'np.log', (['df.Close'], {}), '(df.Close)\n', (1119, 1129), True, 'import numpy... |
# -*- coding: utf-8 -*-
import math
from ._utils import compose
from .chakravala import chakravala_terno
def sqrt_approx(n, eps):
"""
Este método devolve um valor aproximado para a raíz quadrada de n usando
os valores do Python para os quadrados perfeitos e o método Chakravala
para os não-q... | [
"math.sqrt"
] | [((1221, 1233), 'math.sqrt', 'math.sqrt', (['n'], {}), '(n)\n', (1230, 1233), False, 'import math\n'), ((1051, 1063), 'math.sqrt', 'math.sqrt', (['n'], {}), '(n)\n', (1060, 1063), False, 'import math\n'), ((1354, 1366), 'math.sqrt', 'math.sqrt', (['n'], {}), '(n)\n', (1363, 1366), False, 'import math\n'), ((1410, 1422)... |
###################################
# --- Day 22: Sporifica Virus --- #
###################################
import AOCUtils
###################################
grid = AOCUtils.loadInput(22)
directions = [(-1, 0), (0, 1), (1, 0), (0, -1)] # U, R, D, L
h, w = len(grid), len(grid[0])
infected = set()
for x in range(... | [
"AOCUtils.printTimeTaken",
"AOCUtils.loadInput"
] | [((170, 192), 'AOCUtils.loadInput', 'AOCUtils.loadInput', (['(22)'], {}), '(22)\n', (188, 192), False, 'import AOCUtils\n'), ((1436, 1461), 'AOCUtils.printTimeTaken', 'AOCUtils.printTimeTaken', ([], {}), '()\n', (1459, 1461), False, 'import AOCUtils\n')] |
import base64
from backend.errors.bad_foramt_error import BadFormatError
from functools import wraps
from flask import request, redirect, url_for
def extract_username():
username = request.headers.get("Authorization")
if "Basic" == username[:5]:
username = username[6:]
username = base64.b64de... | [
"base64.b64decode",
"backend.errors.bad_foramt_error.BadFormatError",
"flask.request.headers.get",
"functools.wraps"
] | [((188, 224), 'flask.request.headers.get', 'request.headers.get', (['"""Authorization"""'], {}), "('Authorization')\n", (207, 224), False, 'from flask import request, redirect, url_for\n'), ((509, 524), 'functools.wraps', 'wraps', (['api_func'], {}), '(api_func)\n', (514, 524), False, 'from functools import wraps\n'), ... |
#!/usr/bin/env python
"""
ROS node: OptiTrack
This node takes position data from OptiTrack system,
performs necessary axis adjustments
and distributes that information to other nodes.
"""
#Import necessary dependencies
import rospy
from geometry_msgs.msg import PoseStamped, Pose2D
from tic_tac_drone.msg import Cu... | [
"tf.transformations.euler_from_quaternion",
"geometry_msgs.msg.Pose2D",
"rospy.Subscriber",
"rospy.is_shutdown",
"rospy.init_node",
"math.degrees",
"tic_tac_drone.msg.CustomPose",
"rospy.Rate",
"rospy.Publisher"
] | [((3064, 3092), 'rospy.init_node', 'rospy.init_node', (['"""Optitrack"""'], {}), "('Optitrack')\n", (3079, 3092), False, 'import rospy\n'), ((801, 834), 'tf.transformations.euler_from_quaternion', 'euler_from_quaternion', (['quaternion'], {}), '(quaternion)\n', (822, 834), False, 'from tf.transformations import euler_f... |
#!/usr/bin/python3
import inquirer
import logging
import json
import pickle
from pyfiglet import Figlet
from tabulate import tabulate
from os import system, path
clear = lambda: system("clear")
def title():
f = Figlet(font='smslant')
print(f.renderText('HostGen'), "v1.0.0\n")
def intro():
questions = [
... | [
"logging.basicConfig",
"os.path.exists",
"tabulate.tabulate",
"pickle.dump",
"inquirer.prompt",
"pyfiglet.Figlet",
"logging.warning",
"pickle.load",
"inquirer.List",
"inquirer.Text",
"json.load",
"os.system"
] | [((180, 195), 'os.system', 'system', (['"""clear"""'], {}), "('clear')\n", (186, 195), False, 'from os import system, path\n'), ((218, 240), 'pyfiglet.Figlet', 'Figlet', ([], {'font': '"""smslant"""'}), "(font='smslant')\n", (224, 240), False, 'from pyfiglet import Figlet\n'), ((529, 555), 'inquirer.prompt', 'inquirer.... |
import matplotlib.pyplot as plt
from matplotlib.collections import PatchCollection
from matplotlib.patches import Rectangle
from busca.classes import ALTURAS, COLUNAS
def plot_patio(patio, nome_pilha='0001'):
fig = plt.figure(figsize=(15, 5))
ax = plt.subplot(111)
passo_x = 1 / len(COLUNAS)
passo_y =... | [
"matplotlib.pyplot.figure",
"matplotlib.patches.Rectangle",
"matplotlib.pyplot.subplot",
"matplotlib.collections.PatchCollection"
] | [((222, 249), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 5)'}), '(figsize=(15, 5))\n', (232, 249), True, 'import matplotlib.pyplot as plt\n'), ((259, 275), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (270, 275), True, 'import matplotlib.pyplot as plt\n'), ((1168, 1205),... |
"""
Solo Roam Text Adventure Game main python script
by <NAME>
"""
# library imports - stdlib
from time import sleep
from random import randint
import logging
import argparse
# library imports - external
# import requests
# local imports
from ships import Atron
# from soloroam.ships import Rat
import words
import ... | [
"logging.basicConfig",
"system.movement_options",
"words.starting_text",
"argparse.ArgumentParser",
"system.rat_fight",
"system.parse_input",
"system.npc_swarm_spawn",
"time.sleep",
"system.status_message",
"system.encounter_chance",
"system.route_control",
"ships.Atron",
"system.clear_scree... | [((4484, 4520), 'system.route_control', 'system.route_control', (['args.s', 'args.d'], {}), '(args.s, args.d)\n', (4504, 4520), False, 'import system\n'), ((4561, 4586), 'ships.Atron', 'Atron', (['(100)', 'route_list[0]'], {}), '(100, route_list[0])\n', (4566, 4586), False, 'from ships import Atron\n'), ((4591, 4612), ... |
import sys
from ctypes import *
import platform
from .types import *
from ._platform import DLL_PATH, is_windows
def load_libtiepie():
"""Load libtiepie library and import all functions."""
if is_windows:
from ctypes.wintypes import HANDLE, HWND, LPARAM, WPARAM
api = CDLL(DLL_PATH)
api.LibI... | [
"platform.system"
] | [((5547, 5564), 'platform.system', 'platform.system', ([], {}), '()\n', (5562, 5564), False, 'import platform\n'), ((5918, 5935), 'platform.system', 'platform.system', ([], {}), '()\n', (5933, 5935), False, 'import platform\n'), ((7415, 7432), 'platform.system', 'platform.system', ([], {}), '()\n', (7430, 7432), False,... |
import sys
sys.path.append('./')
import numpy as np
import torch
import glob
import cv2
from skimage import img_as_float32 as img_as_float
from skimage import img_as_ubyte
import time
import os
from codes.models.modules.VDN import VDN as DN
from codes.data.util import imresize_np
def denoise(noisy_path, pretrained_pat... | [
"os.path.exists",
"codes.data.util.imresize_np",
"torch.load",
"time.time",
"os.path.join",
"torch.nn.DataParallel",
"torch.autograd.set_grad_enabled",
"os.mkdir",
"codes.models.modules.VDN.VDN",
"cv2.cvtColor",
"sys.path.append",
"cv2.imread"
] | [((11, 32), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (26, 32), False, 'import sys\n'), ((482, 509), 'torch.load', 'torch.load', (['pretrained_path'], {}), '(pretrained_path)\n', (492, 509), False, 'import torch\n'), ((520, 545), 'codes.models.modules.VDN.VDN', 'DN', (['C'], {'dep_U': 'dep_U... |
'''
Author <NAME>
Date 5/21/2021
utility functions for train and predict data generators
'''
import cv2
import numpy as np
import re
from joblib import Parallel, delayed
def sort_frame_crop_filenames(filenames):
def find_frame_crop_number(filename):
filename = filename.split('/')[-1]
... | [
"re.compile",
"joblib.Parallel",
"numpy.sum",
"numpy.zeros",
"joblib.delayed"
] | [((2277, 2305), 'numpy.zeros', 'np.zeros', (['mask_list.shape[0]'], {}), '(mask_list.shape[0])\n', (2285, 2305), True, 'import numpy as np\n'), ((2582, 2610), 'numpy.zeros', 'np.zeros', (['mask_list.shape[0]'], {}), '(mask_list.shape[0])\n', (2590, 2610), True, 'import numpy as np\n'), ((4390, 4411), 're.compile', 're.... |
import glob, os, pickle, datetime, time, re, pprint
import matplotlib.pyplot as plt
import numpy as np
from src import plotter, graphs
from src.mltoolbox.metrics import METRICS
from src.utils import *
from shutil import copyfile, rmtree
from src.plotter import Plotter
def main():
# SETUP BEGIN
test_folder_pat... | [
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"matplotlib.pyplot.yscale",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.supt... | [((1867, 1888), 'numpy.array', 'np.array', (['pred_ratios'], {}), '(pred_ratios)\n', (1875, 1888), True, 'import numpy as np\n'), ((1917, 1947), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {'figsize': '(12, 6)'}), '(1, figsize=(12, 6))\n', (1927, 1947), True, 'import matplotlib.pyplot as plt\n'), ((1952, 1982),... |
#!/usr/bin/env python
import clg
import json
import os
from collections import OrderedDict
#import yaml
#import yamlordereddictloader
CMD_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), 'simple.json'))
# CMD_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__), 'simple.yml'))
def main():
... | [
"clg.CommandLine",
"os.path.dirname"
] | [((481, 506), 'clg.CommandLine', 'clg.CommandLine', (['cmd_conf'], {}), '(cmd_conf)\n', (496, 506), False, 'import clg\n'), ((176, 201), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (191, 201), False, 'import os\n')] |
import matplotlib.pyplot as plt
import numpy as np
from rich.prompt import Confirm
from loguru import logger
from fcutils.progress import track
from slam import Environment, Agent
# create env
env = Environment()
# create agent
agent = Agent(env, x=20, y=10, angle=np.random.uniform(10, 80))
agent.update_map_every ... | [
"rich.prompt.Confirm.ask",
"slam.Environment",
"loguru.logger.warning",
"numpy.random.uniform",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((203, 216), 'slam.Environment', 'Environment', ([], {}), '()\n', (214, 216), False, 'from slam import Environment, Agent\n'), ((362, 392), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(10, 10)'}), '(figsize=(10, 10))\n', (374, 392), True, 'import matplotlib.pyplot as plt\n'), ((464, 474), 'matplotl... |
from db import get_connection, get_from_datamaster
from db.tables import traits
requirements = [traits]
def build():
datamaster = get_from_datamaster("EquipTraits.csv")
trait_rows_with_stats_by_text = {
row["Text"]: row
for row in datamaster
if row["TraitPropertyName"] == "Stat"}
... | [
"db.get_connection",
"db.tables.traits.read",
"db.get_from_datamaster"
] | [((137, 175), 'db.get_from_datamaster', 'get_from_datamaster', (['"""EquipTraits.csv"""'], {}), "('EquipTraits.csv')\n", (156, 175), False, 'from db import get_connection, get_from_datamaster\n'), ((326, 342), 'db.get_connection', 'get_connection', ([], {}), '()\n', (340, 342), False, 'from db import get_connection, ge... |
from discord.ext import commands
import discord
class MyHelpCommand(commands.MinimalHelpCommand):
async def send_pages(self):
destination = self.get_destination()
e = discord.Embed(title="Commands List", color=discord.Color.gold(), description='')
e.set_author(name="Birthday Bot", icon_url... | [
"discord.Color.gold"
] | [((232, 252), 'discord.Color.gold', 'discord.Color.gold', ([], {}), '()\n', (250, 252), False, 'import discord\n')] |
from exp.experiment import Experiment
from exp.auctions import Auction
def test_experiment_generates_auctions():
experiment = Experiment()
assert experiment.auctions is not None
assert len(experiment.auctions) > 0
for aid, auction in experiment.auctions.items():
assert type(auction) is Auction... | [
"exp.experiment.Experiment"
] | [((132, 144), 'exp.experiment.Experiment', 'Experiment', ([], {}), '()\n', (142, 144), False, 'from exp.experiment import Experiment\n')] |
import pandas as pd
import houghtest
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
from sklearn.metrics import confusion_matrix
import cv2
import numpy as np
import pickle
from multiprocessing import Process
import tim... | [
"cv2.imwrite",
"multiprocessing.Process",
"houghtest.main",
"numpy.array",
"numpy.zeros",
"time.time",
"cv2.imread"
] | [((7165, 7176), 'time.time', 'time.time', ([], {}), '()\n', (7174, 7176), False, 'import time\n'), ((7299, 7322), 'cv2.imread', 'cv2.imread', (['img_path_or'], {}), '(img_path_or)\n', (7309, 7322), False, 'import cv2\n'), ((7518, 7541), 'multiprocessing.Process', 'Process', ([], {'target': 'thread1'}), '(target=thread1... |
from typing import List
from test_framework import generic_test
def buy_and_sell_stock_twice(prices: List[float]) -> float:
# TODO - you fill in here.
return 0.0
if __name__ == '__main__':
exit(
generic_test.generic_test_main('buy_and_sell_stock_twice.py',
... | [
"test_framework.generic_test.generic_test_main"
] | [((220, 343), 'test_framework.generic_test.generic_test_main', 'generic_test.generic_test_main', (['"""buy_and_sell_stock_twice.py"""', '"""buy_and_sell_stock_twice.tsv"""', 'buy_and_sell_stock_twice'], {}), "('buy_and_sell_stock_twice.py',\n 'buy_and_sell_stock_twice.tsv', buy_and_sell_stock_twice)\n", (250, 343), ... |
from typing import List
from datetime import datetime
from fastapi import Depends, APIRouter, HTTPException
from sqlalchemy.orm import Session
from app.db import get_db
from app import models, schemas
from app.api.crud_devices import obtain_device_type_id, get_device_type, obtain_device_id, get_device
router = APIRo... | [
"app.api.crud_devices.get_device_type",
"datetime.datetime.fromtimestamp",
"fastapi.HTTPException",
"datetime.datetime.now",
"fastapi.APIRouter",
"app.api.crud_devices.get_device",
"app.api.crud_devices.obtain_device_id",
"fastapi.Depends",
"app.api.crud_devices.obtain_device_type_id"
] | [((315, 326), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (324, 326), False, 'from fastapi import Depends, APIRouter, HTTPException\n'), ((2197, 2212), 'fastapi.Depends', 'Depends', (['get_db'], {}), '(get_db)\n', (2204, 2212), False, 'from fastapi import Depends, APIRouter, HTTPException\n'), ((2229, 2277), 'a... |
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
import time
class livePlotter:
"""
Class for plotting methods.
"""
def __init__(self, rocket, final_time, plot_real_time):
# store some inputs
self.plot_real_time = plot_real_time
self.tf = final_ti... | [
"time.sleep",
"pyqtgraph.setConfigOptions",
"pyqtgraph.Qt.QtGui.QApplication",
"pyqtgraph.mkPen",
"pyqtgraph.GraphicsWindow",
"time.time"
] | [((396, 418), 'pyqtgraph.Qt.QtGui.QApplication', 'QtGui.QApplication', (['[]'], {}), '([])\n', (414, 418), False, 'from pyqtgraph.Qt import QtGui, QtCore\n'), ((508, 548), 'pyqtgraph.GraphicsWindow', 'pg.GraphicsWindow', ([], {'title': '"""Live Plotting"""'}), "(title='Live Plotting')\n", (525, 548), True, 'import pyqt... |
# Generated by Django 3.0.4 on 2022-01-11 12:58
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('flashcards', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name... | [
"django.db.models.ForeignKey",
"django.db.migrations.AlterModelOptions",
"django.db.models.AutoField",
"django.db.models.PositiveIntegerField",
"django.db.models.DateTimeField"
] | [((273, 346), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""card"""', 'options': "{'ordering': ('cid',)}"}), "(name='card', options={'ordering': ('cid',)})\n", (301, 346), False, 'from django.db import migrations, models\n'), ((497, 590), 'django.db.models.AutoField', 'mode... |
# -*- coding: utf-8 -*-
"""
Created Nov 2018
@author: henss
"""
# import built in libarys
import os
from urllib.request import urlretrieve, urlopen
# import 3rd party libarys
from bs4 import BeautifulSoup
# import local libarys
# define classes and functions
class Weblink():
"""
Class ... | [
"bs4.BeautifulSoup",
"os.chdir",
"urllib.request.urlopen",
"urllib.request.urlretrieve"
] | [((1734, 1768), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (1747, 1768), False, 'from bs4 import BeautifulSoup\n'), ((2278, 2297), 'os.chdir', 'os.chdir', (['localpath'], {}), '(localpath)\n', (2286, 2297), False, 'import os\n'), ((2467, 2500), 'urllib.request.... |
import sys, re
import PyQt5
from PyQt5.QtWidgets import QApplication, QLineEdit, QMainWindow, QMessageBox, QDialog, QPushButton, QLabel, QTableWidget, QTableWidgetItem, QVBoxLayout, QHeaderView, QSpinBox, QDoubleSpinBox, QGraphicsView, QTableWidgetItem
from PyQt5 import uic
from PyQt5.QtCore import pyqtSlot, QDate,... | [
"PyQt5.QtWidgets.QSpinBox",
"matplotlib.pyplot.ylabel",
"PyQt5.uic.loadUi",
"PyQt5.QtGui.QPixmap.fromImage",
"PyQt5.QtGui.QImage",
"numpy.array",
"PyQt5.QtWidgets.QMessageBox.question",
"os.remove",
"os.path.exists",
"os.listdir",
"PyQt5.QtCore.QDate.currentDate",
"matplotlib.pyplot.plot",
"... | [((742, 765), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (763, 765), False, 'import datetime\n'), ((1192, 1203), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1201, 1203), False, 'import shutil, os\n'), ((1156, 1172), 'os.system', 'os.system', (['"""cls"""'], {}), "('cls')\n", (1165, 1172), Fals... |
import numpy as np
import torch
from mmhuman3d.core.filter.builder import build_filter
# test different data type
def test_data_type_torch():
noisy_input = torch.randn((100, 17, 3))
cfg = dict(type='OneEuroFilter', min_cutoff=0.004, beta=0.7)
oneeuro = build_filter(cfg)
out_g = oneeuro(noisy_input)
... | [
"torch.abs",
"numpy.random.rand",
"torch.mean",
"torch.cuda.is_available",
"mmhuman3d.core.filter.builder.build_filter",
"torch.zeros",
"torch.randn"
] | [((164, 189), 'torch.randn', 'torch.randn', (['(100, 17, 3)'], {}), '((100, 17, 3))\n', (175, 189), False, 'import torch\n'), ((269, 286), 'mmhuman3d.core.filter.builder.build_filter', 'build_filter', (['cfg'], {}), '(cfg)\n', (281, 286), False, 'from mmhuman3d.core.filter.builder import build_filter\n'), ((394, 411), ... |
import numpy as np
from matplotlib import pyplot as plt
import pandas as pd
df = pd.read_csv("C:/Users/Elton/Downloads/temperature.csv")
print(df.head())
#Extração de X e Y
x,y = df[['temperatura']].values, df[['classification']].values
print('x:\n',x)
print('y:\n',y)
#Prós processamento
from sklearn.preprocessing ... | [
"sklearn.preprocessing.LabelEncoder",
"pandas.read_csv",
"sklearn.linear_model.LogisticRegression",
"numpy.linspace",
"pandas.DataFrame",
"matplotlib.pyplot.show"
] | [((83, 138), 'pandas.read_csv', 'pd.read_csv', (['"""C:/Users/Elton/Downloads/temperature.csv"""'], {}), "('C:/Users/Elton/Downloads/temperature.csv')\n", (94, 138), True, 'import pandas as pd\n'), ((451, 465), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (463, 465), False, 'from sklearn.prep... |
"""字幕処理関係"""
from ariblib.aribgaiji import GAIJI_MAP
from ariblib.drcs import DRCSImage, mapping
from ariblib.packet import SynchronizedPacketizedElementaryStream
from ariblib.sections import TimeOffsetSection
def captions(ts, color=False):
"""トランスポートストリームから字幕オブジェクトを返すジェネレータ"""
SynchronizedPacketizedElement... | [
"ariblib.drcs.DRCSImage"
] | [((1066, 1100), 'ariblib.drcs.DRCSImage', 'DRCSImage', (['font.width', 'font.height'], {}), '(font.width, font.height)\n', (1075, 1100), False, 'from ariblib.drcs import DRCSImage, mapping\n')] |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'telas/tela_editar_livro.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Tela_Editar_Livro(object):
def setupUi(self, Tela... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QTextBrowser",
"PyQt5.QtGui.QIcon",
"PyQt5.QtGui.QFont",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtWidgets.QAction",
"PyQt5.QtCore.QRect",
"PyQt5.QtGui.QPixmap",
"PyQt5.QtWidgets.QStatusBar",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QPu... | [((517, 553), 'PyQt5.QtWidgets.QWidget', 'QtWidgets.QWidget', (['Tela_Editar_Livro'], {}), '(Tela_Editar_Livro)\n', (534, 553), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((633, 669), 'PyQt5.QtWidgets.QLabel', 'QtWidgets.QLabel', (['self.centralwidget'], {}), '(self.centralwidget)\n', (649, 669), False, 'f... |
# Generated by Django 2.0b1 on 2017-10-30 13:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="DataCenter",
fields=[
... | [
"django.db.migrations.AlterUniqueTogether",
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((4003, 4093), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""repository"""', 'unique_together': "{('owner', 'name')}"}), "(name='repository', unique_together={('owner',\n 'name')})\n", (4033, 4093), False, 'from django.db import migrations, models\n'), ((4121, 4217)... |
"""
Copyright (c) 2017, <NAME>.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on May 20, 2017
@author: jrm
"""
from atom.api import Typed, ForwardTyped, Bool, observe
from enaml.core.declarative import d_
from enaml.core.conditional ... | [
"atom.api.Typed",
"enaml.core.conditional.new_scope",
"atom.api.Bool",
"atom.api.observe",
"atom.api.ForwardTyped"
] | [((600, 631), 'atom.api.ForwardTyped', 'ForwardTyped', (['(lambda : Fragment)'], {}), '(lambda : Fragment)\n', (612, 631), False, 'from atom.api import Typed, ForwardTyped, Bool, observe\n'), ((1120, 1140), 'atom.api.Typed', 'Typed', (['ProxyFragment'], {}), '(ProxyFragment)\n', (1125, 1140), False, 'from atom.api impo... |
# serialize data for ramp experiment
import json
import sqlite3
import patch_clamp.database as db
def get_groups_per_sweep(sweep, db_path):
con = db.persistent_connection_to_db(db_path)
con.row_factory = sqlite3.Row
data = con.execute(
"""SELECT
ramp.first_peak_stim_intensity,
ram... | [
"patch_clamp.database.persistent_connection_to_db"
] | [((153, 192), 'patch_clamp.database.persistent_connection_to_db', 'db.persistent_connection_to_db', (['db_path'], {}), '(db_path)\n', (183, 192), True, 'import patch_clamp.database as db\n')] |
import matplotlib.pyplot as plt
import torch
from torch.optim.lr_scheduler import _LRScheduler
class GradualWarmupScheduler(_LRScheduler):
def __init__(self, optimizer, multiplier, total_epoch, after_scheduler=None):
self.multiplier = multiplier
self.total_epoch = total_epoch
self.after_sc... | [
"torch.optim.Adam",
"torch.optim.lr_scheduler.CosineAnnealingLR",
"matplotlib.pyplot.plot",
"torch.zeros",
"matplotlib.pyplot.show"
] | [((1453, 1468), 'torch.zeros', 'torch.zeros', (['(10)'], {}), '(10)\n', (1464, 1468), False, 'import torch\n'), ((1481, 1512), 'torch.optim.Adam', 'torch.optim.Adam', (['[v]'], {'lr': '(0.002)'}), '([v], lr=0.002)\n', (1497, 1512), False, 'import torch\n'), ((1535, 1627), 'torch.optim.lr_scheduler.CosineAnnealingLR', '... |
from linebot import LineBotApi
from linebot.models import TextSendMessage
def send_message(message):
CHANNEL_ACCESS_TOKEN = 'Line Access Token'
line_bot_api = LineBotApi(CHANNEL_ACCESS_TOKEN)
messages = TextSendMessage(text=message)
line_bot_api.broadcast(messages=messages)
return m... | [
"linebot.LineBotApi",
"linebot.models.TextSendMessage"
] | [((181, 213), 'linebot.LineBotApi', 'LineBotApi', (['CHANNEL_ACCESS_TOKEN'], {}), '(CHANNEL_ACCESS_TOKEN)\n', (191, 213), False, 'from linebot import LineBotApi\n'), ((230, 259), 'linebot.models.TextSendMessage', 'TextSendMessage', ([], {'text': 'message'}), '(text=message)\n', (245, 259), False, 'from linebot.models i... |
# test_gates.py
from MAXENT3D_PID import pid, MAXENT3D_PID_Exception
# AND gate
andgate = dict()
andgate[ (0,0,0,0) ] = .125
andgate[ (0,0,0,1) ] = .125
andgate[ (0,0,1,0) ] = .125
andgate[ (0,1,0,0) ] = .125
andgate[ (0,0,1,1) ] = .125
andgate[ (0,1,0,1) ] = .125
andgate[ (0,1,1,0) ] = .125
andgate[ (1,1,1,1) ] = .1... | [
"MAXENT3D_PID.pid"
] | [((1586, 1608), 'MAXENT3D_PID.pid', 'pid', (['andgate'], {'output': '(0)'}), '(andgate, output=0)\n', (1589, 1608), False, 'from MAXENT3D_PID import pid, MAXENT3D_PID_Exception\n'), ((1657, 1680), 'MAXENT3D_PID.pid', 'pid', (['andDgate'], {'output': '(0)'}), '(andDgate, output=0)\n', (1660, 1680), False, 'from MAXENT3D... |
import cv2
import os
import json
import numpy as np
import editdistance
from spellchecker import SpellChecker
from linesegm2.LineSegmentation import LineSegmentation
from Model import Model
from SamplePreprocessor import preprocess
from DataLoader import Batch
from WordSegmentation import wordSegmentation, prepareImg
... | [
"cv2.rectangle",
"os.path.exists",
"WordSegmentation.prepareImg",
"cv2.imwrite",
"numpy.ones",
"cv2.threshold",
"cv2.erode",
"spellchecker.SpellChecker",
"os.path.join",
"WordSegmentation.wordSegmentation",
"os.mkdir",
"linesegm2.LineSegmentation.LineSegmentation",
"json.load",
"DataLoader... | [((477, 495), 'DataLoader.Batch', 'Batch', (['None', '[img]'], {}), '(None, [img])\n', (482, 495), False, 'from DataLoader import Batch\n'), ((564, 578), 'spellchecker.SpellChecker', 'SpellChecker', ([], {}), '()\n', (576, 578), False, 'from spellchecker import SpellChecker\n'), ((988, 1029), 'os.path.exists', 'os.path... |
from django.shortcuts import render, get_object_or_404
# Create your views here.
from blog.models import BlogArticles
def blog_title(request):
blogs = BlogArticles.objects.all()
return render(request, "blog/title.html", {"blogs": blogs})
def blog_article(request, article_id):
# article = BlogArticles.o... | [
"django.shortcuts.render",
"django.shortcuts.get_object_or_404",
"blog.models.BlogArticles.objects.all"
] | [((158, 184), 'blog.models.BlogArticles.objects.all', 'BlogArticles.objects.all', ([], {}), '()\n', (182, 184), False, 'from blog.models import BlogArticles\n'), ((196, 248), 'django.shortcuts.render', 'render', (['request', '"""blog/title.html"""', "{'blogs': blogs}"], {}), "(request, 'blog/title.html', {'blogs': blog... |
import os
import traceback
import cv2
import numpy as np
from keras.models import load_model
from flask import flash, request, redirect, url_for, render_template
from werkzeug.utils import secure_filename
from app import app
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif', 'jfif'}
model = load_model(... | [
"flask.render_template",
"app.app.run",
"keras.models.load_model",
"numpy.reshape",
"flask.flash",
"os.path.join",
"numpy.argmax",
"flask.url_for",
"flask.redirect",
"app.app.route",
"werkzeug.utils.secure_filename",
"cv2.resize",
"traceback.print_exc",
"cv2.imread"
] | [((309, 354), 'keras.models.load_model', 'load_model', (["('model' + os.sep + 'inception_v3')"], {}), "('model' + os.sep + 'inception_v3')\n", (319, 354), False, 'from keras.models import load_model\n'), ((483, 497), 'app.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (492, 497), False, 'from app import app\n')... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_parse_time
Tests for `parse_time` module.
"""
import unittest
import nose
import arrow
import json
import os
from functools import wraps
import re
from mock import patch
import parsley
from xlseries.strategies.clean.parse_time import ParseComposedYear1
from xlse... | [
"xlseries.utils.case_loaders.load_parameters_case",
"re.compile",
"functools.wraps",
"xlseries.utils.path_finders.abs_path",
"mock.patch.object",
"xlseries.strategies.clean.parse_time.ParseComposedQuarter3",
"arrow.get",
"json.load",
"xlseries.strategies.clean.parse_time.ParseSimpleTime",
"nose.ru... | [((13383, 13413), 'nose.run', 'nose.run', ([], {'defaultTest': '__name__'}), '(defaultTest=__name__)\n', (13391, 13413), False, 'import nose\n'), ((1497, 1506), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (1502, 1506), False, 'from functools import wraps\n'), ((2370, 2393), 'xlseries.utils.case_loaders.load_par... |
import biconfigs
import json
class TestMemoryStorage(object):
def setup_class(self):
self.change_count = 0
def onchanged(config):
self.change_count += 1
self.config = biconfigs.Biconfigs(
default_value={'default':'value'},
onchanged=onchanged
)
... | [
"json.dumps",
"biconfigs.Biconfigs"
] | [((210, 286), 'biconfigs.Biconfigs', 'biconfigs.Biconfigs', ([], {'default_value': "{'default': 'value'}", 'onchanged': 'onchanged'}), "(default_value={'default': 'value'}, onchanged=onchanged)\n", (229, 286), False, 'import biconfigs\n'), ((432, 455), 'json.dumps', 'json.dumps', (['self.config'], {}), '(self.config)\n... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Author : lisztomania
# @Date : 2021/1/16
# @Software : Pycharm
# @Version : Python 3.8.5
# @File : Driver_Manage.py
# @Function : 驱动管理
import os
from selenium.webdriver.chrome.webdriver import WebDriver
from inside.Config.Api import API
from inside.Config.Pa... | [
"inside.Driver.Driver_Check.DRIVER_CHECK",
"inside.Config.System.SYSTEM",
"inside.Config.Api.API",
"inside.Config.Path.PATH",
"inside.Driver.Driver_Download.DRIVER_DOWNLOAD",
"inside.Driver.Driver_Init.DRIVER_INIT"
] | [((2284, 2297), 'inside.Driver.Driver_Init.DRIVER_INIT', 'DRIVER_INIT', ([], {}), '()\n', (2295, 2297), False, 'from inside.Driver.Driver_Init import DRIVER_INIT\n'), ((2462, 2475), 'inside.Driver.Driver_Init.DRIVER_INIT', 'DRIVER_INIT', ([], {}), '()\n', (2473, 2475), False, 'from inside.Driver.Driver_Init import DRIV... |
import asyncio
import aiohttp
from .props import wrap
class Client:
def __init__(self, *, headers=None, loop=None):
if not loop:
loop = asyncio.get_event_loop()
self._loop = loop
self._session = aiohttp.ClientSession(headers=headers, loop=self._loop)
def __del__(self):
... | [
"aiohttp.ClientSession",
"asyncio.get_event_loop"
] | [((239, 294), 'aiohttp.ClientSession', 'aiohttp.ClientSession', ([], {'headers': 'headers', 'loop': 'self._loop'}), '(headers=headers, loop=self._loop)\n', (260, 294), False, 'import aiohttp\n'), ((164, 188), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (186, 188), False, 'import asyncio\n')] |
import os
from dotenv import load_dotenv
load_dotenv()
allowed_origins: dict[str, list[str]] = dict(
development=["http://localhost:8000"],
staging=["https://staging.url"],
production=["https://production.url"],
)
cors_options: dict[str, list[str]] = dict(
allow_origins=allowed_origins[os.getenv("WHI... | [
"os.getenv",
"dotenv.load_dotenv"
] | [((42, 55), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (53, 55), False, 'from dotenv import load_dotenv\n'), ((306, 328), 'os.getenv', 'os.getenv', (['"""WHICH_ENV"""'], {}), "('WHICH_ENV')\n", (315, 328), False, 'import os\n')] |
from abc import abstractmethod
import torch
from torch.autograd import Variable
from torch import nn
from torchtrainer.utils.mixins import CudaMixin
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1 or classname.find('Conv') != -1:
# print("Initializing Linear")
... | [
"torch.nn.Sigmoid",
"torch.autograd.Variable",
"torch.randn"
] | [((1144, 1192), 'torch.randn', 'torch.randn', (['batchs', '*self.generator.input_shape'], {}), '(batchs, *self.generator.input_shape)\n', (1155, 1192), False, 'import torch\n'), ((1453, 1465), 'torch.nn.Sigmoid', 'nn.Sigmoid', ([], {}), '()\n', (1463, 1465), False, 'from torch import nn\n'), ((1851, 1862), 'torch.autog... |
import boto3
def send_email(sender_email, sender_name, message, phone):
client = boto3.client('ses', region_name='us-west-2')
response = client.send_email(
Source='<EMAIL>',
Destination={
'ToAddresses': ['<EMAIL>'],
'CcAddresses': [],
'BccAddresses': []
... | [
"boto3.client"
] | [((87, 131), 'boto3.client', 'boto3.client', (['"""ses"""'], {'region_name': '"""us-west-2"""'}), "('ses', region_name='us-west-2')\n", (99, 131), False, 'import boto3\n')] |
#! /opt/conda/bin/python3
""" File containing keras callback class to collect runstats of the training process """
# Copyright 2018 FAU-iPAT (http://ipat.uni-erlangen.de/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ob... | [
"keras.backend.variable",
"time.time",
"keras.backend.set_value",
"keras.backend.get_value"
] | [((1625, 1693), 'keras.backend.variable', 'backend.variable', (['(0.0)'], {'dtype': '"""float32"""', 'name': '"""RunStatsCallbackEpoch"""'}), "(0.0, dtype='float32', name='RunStatsCallbackEpoch')\n", (1641, 1693), True, 'import keras.backend as backend\n'), ((1721, 1793), 'keras.backend.variable', 'backend.variable', (... |
#!/usr/bin/python3
import base64
import binascii
import sys
import argparse
from typing import BinaryIO
from io import BytesIO
import io
def open_key(file_path: str, stream: bool) -> BinaryIO:
file_handler = open(file_path, 'rb')
if stream:
return file_handler
key = file_handler.read()
ret... | [
"base64.decodebytes",
"io.BytesIO",
"argparse.ArgumentParser"
] | [((324, 336), 'io.BytesIO', 'BytesIO', (['key'], {}), '(key)\n', (331, 336), False, 'from io import BytesIO\n'), ((702, 763), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Cipher file using xor."""'}), "(description='Cipher file using xor.')\n", (725, 763), False, 'import argparse\n'), ... |
import pytest
pytestmark = [
pytest.mark.requires_salt_states("echo.text"),
]
def test_echoed(salt_call_cli):
echo_str = "Echoed!"
ret = salt_call_cli.run("state.single", "echo.echoed", echo_str)
assert ret.exitcode == 0
assert ret.json
assert ret.json == echo_str
def test_reversed(salt_cal... | [
"pytest.mark.requires_salt_states"
] | [((34, 79), 'pytest.mark.requires_salt_states', 'pytest.mark.requires_salt_states', (['"""echo.text"""'], {}), "('echo.text')\n", (66, 79), False, 'import pytest\n')] |
import numpy as np
import re
from utils import get_input
class Board:
def __init__(self, grid):
self.array = np.array(grid).astype('int')
self.drawn = np.zeros((5,5))
self.bingo = False
def update(self, draw):
hits = self.array == draw
self.drawn[hits] = 1
... | [
"numpy.array",
"re.split",
"numpy.zeros",
"utils.get_input"
] | [((2241, 2263), 'utils.get_input', 'get_input', (['"""day04.txt"""'], {}), "('day04.txt')\n", (2250, 2263), False, 'from utils import get_input\n'), ((173, 189), 'numpy.zeros', 'np.zeros', (['(5, 5)'], {}), '((5, 5))\n', (181, 189), True, 'import numpy as np\n'), ((725, 746), 're.split', 're.split', (['"""\\\\D+"""', '... |
# Generated by Django 3.0.5 on 2020-04-27 14:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('socialaccount', '0003_extra_data_default_dict'),
('workspaces', '0006_workspaceuserconnect'),
]
operations ... | [
"django.db.migrations.DeleteModel",
"django.db.models.ForeignKey"
] | [((582, 633), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""WorkSpaceUserConnect"""'}), "(name='WorkSpaceUserConnect')\n", (604, 633), False, 'from django.db import migrations, models\n'), ((442, 566), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null':... |
#!/usr/bin/env python3
# encoding: utf-8
from collections import defaultdict
from copy import deepcopy
from typing import Dict, List
import numpy as np
from mlagents_envs.environment import UnityEnvironment
from mlagents_envs.side_channel.engine_configuration_channel import \
EngineConfigurationChannel
... | [
"rls.utils.np_utils.get_discrete_action_list",
"mlagents_envs.side_channel.engine_configuration_channel.EngineConfigurationChannel",
"mlagents_envs.side_channel.environment_parameters_channel.EnvironmentParametersChannel",
"numpy.asarray",
"numpy.logical_or",
"rls.common.specs.SensorSpec",
"numpy.array"... | [((2280, 2310), 'mlagents_envs.environment.UnityEnvironment', 'UnityEnvironment', ([], {}), '(**env_kwargs)\n', (2296, 2310), False, 'from mlagents_envs.environment import UnityEnvironment\n'), ((2543, 2571), 'mlagents_envs.side_channel.engine_configuration_channel.EngineConfigurationChannel', 'EngineConfigurationChann... |
"""
`myplotlib.tests`
commands to help preview the custom styles (function names are self-descriptive). available functions are:
* testColormaps
* testColors
* testScatter
* testPlot
* testErrorbar
* testPlot2d
* testVectorPlot2d
* testAll
"""
import myplotlib.plots as myplt
import myplotlib
import matplotlib
impor... | [
"myplotlib.plots.plot2d",
"numpy.arange",
"numpy.random.random",
"numpy.exp",
"numpy.array",
"numpy.linspace",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.cos",
"matplotlib.pyplot.tight_layout",
"numpy.sin",
"numpy.meshgrid",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.subplots",... | [((2689, 2717), 'matplotlib.pyplot.legend', 'plt.legend', ([], {'loc': '"""lower left"""'}), "(loc='lower left')\n", (2699, 2717), True, 'import matplotlib.pyplot as plt\n'), ((3286, 3310), 'numpy.linspace', 'np.linspace', (['(0)', '(1000)', '(10)'], {}), '(0, 1000, 10)\n', (3297, 3310), True, 'import numpy as np\n'), ... |