code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
import numpy as np
import json
import random
import jieba
import collections
from tqdm import tqdm
import config.args as args
from util.Logginger import init_logger
from pytorch_pretrained_bert.tokenization import BertTokenizer
logger = init_logger("QA", logging_path=args.log_path)
with open('TC/pybert/io/P... | [
"jieba.lcut",
"collections.namedtuple",
"random.shuffle",
"tqdm.tqdm",
"os.path.join",
"json.dumps",
"random.seed",
"util.Logginger.init_logger",
"os.path.isfile",
"pytorch_pretrained_bert.tokenization.BertTokenizer",
"numpy.zeros",
"json.load",
"numpy.load",
"numpy.save"
] | [((248, 293), 'util.Logginger.init_logger', 'init_logger', (['"""QA"""'], {'logging_path': 'args.log_path'}), "('QA', logging_path=args.log_path)\n", (259, 293), False, 'from util.Logginger import init_logger\n'), ((377, 389), 'json.load', 'json.load', (['f'], {}), '(f)\n', (386, 389), False, 'import json\n'), ((3120, ... |
import configparser
import os
import subprocess
import sys
import time
import boto3
import requests
from botocore.config import Config
def convert_dev(dev):
# Translate the device name as provided by the OS to the one used by EC2
# FIXME This approach could be broken in some OS variants, see
# https://do... | [
"subprocess.check_output",
"boto3.client",
"botocore.config.Config",
"requests.get",
"time.sleep",
"os.popen",
"requests.put",
"sys.exit",
"configparser.RawConfigParser"
] | [((1664, 1781), 'requests.put', 'requests.put', (['"""http://169.254.169.254/latest/api/token"""'], {'headers': "{'X-aws-ec2-metadata-token-ttl-seconds': '300'}"}), "('http://169.254.169.254/latest/api/token', headers={\n 'X-aws-ec2-metadata-token-ttl-seconds': '300'})\n", (1676, 1781), False, 'import requests\n'), ... |
# Generated by Django 3.2.4 on 2021-07-21 13:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registration', '0018_child_category'),
]
operations = [
migrations.AddConstraint(
model_name='child',
constraint=mod... | [
"django.db.models.UniqueConstraint"
] | [((317, 410), 'django.db.models.UniqueConstraint', 'models.UniqueConstraint', ([], {'fields': "('family', 'firstname', 'lastname')", 'name': '"""unique_child"""'}), "(fields=('family', 'firstname', 'lastname'), name=\n 'unique_child')\n", (340, 410), False, 'from django.db import migrations, models\n')] |
import optuna
import json
import numpy as np
import argparse
import os
from optuna.visualization import plot_optimization_history, plot_param_importances
parser = argparse.ArgumentParser()
parser.add_argument("--study-name", help="Study name used during hyperparameter optimization", type=str, default=None)
parser.add... | [
"os.makedirs",
"argparse.ArgumentParser",
"optuna.visualization.plot_param_importances",
"json.dumps",
"numpy.argsort",
"optuna.visualization.plot_optimization_history",
"optuna.create_study"
] | [((165, 190), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (188, 190), False, 'import argparse\n'), ((786, 824), 'os.makedirs', 'os.makedirs', (['output_dir'], {'exist_ok': '(True)'}), '(output_dir, exist_ok=True)\n', (797, 824), False, 'import os\n'), ((834, 950), 'optuna.create_study', 'opt... |
import base64
import http.client
import json
import requests
# url used to get the code that's used to get OAuth access token
# zoom.us/oauth/token?response_type=code&client_id=3inmm7aUQ1uy_zyuKMp3w&redirect_uri=http://localhost:8080
# redirect_uri must be whitelisted when you create the app
# use case: Transcript(me... | [
"json.loads",
"requests.get"
] | [((2270, 2318), 'requests.get', 'requests.get', (['download_url'], {'allow_redirects': '(True)'}), '(download_url, allow_redirects=True)\n', (2282, 2318), False, 'import requests\n'), ((4162, 4178), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (4172, 4178), False, 'import json\n')] |
import pytest
from typing import List
from tests.globals.constants import NUMBER_OF_DOCUMENTS
from tests.globals.document import complex_nested_document, simple_nested_document
@pytest.fixture(scope="session")
def assorted_nested_documents() -> List:
return [complex_nested_document() for _ in range(NUMBER_OF_D... | [
"pytest.fixture",
"tests.globals.document.simple_nested_document",
"tests.globals.document.complex_nested_document"
] | [((183, 214), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (197, 214), False, 'import pytest\n'), ((334, 365), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (348, 365), False, 'import pytest\n'), ((268, 293), 'tests.globals.d... |
# get_nhif_price_package
from __future__ import unicode_literals
from codecs import ignore_errors
from time import perf_counter
import frappe
from frappe import _
from hms_tz.nhif.api.token import get_claimsservice_token
import json
import requests
from frappe.utils.background_jobs import enqueue
from hms_tz.nhif.doct... | [
"json.loads",
"frappe.get_value",
"frappe.db.exists",
"hms_tz.nhif.api.token.get_claimsservice_token",
"frappe.whitelist",
"hms_tz.nhif.doctype.nhif_response_log.nhif_response_log.add_log",
"frappe._",
"requests.get",
"json.dumps",
"frappe.utils.now",
"frappe.db.commit",
"frappe.db.sql",
"fr... | [((600, 618), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (616, 618), False, 'import frappe\n'), ((5770, 5788), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (5786, 5788), False, 'import frappe\n'), ((668, 773), 'frappe.utils.background_jobs.enqueue', 'enqueue', ([], {'method': 'get_nhif_price... |
from django.contrib.auth.models import User
from rest_framework import serializers
from .models import Project
class ProjectSerializer(serializers.ModelSerializer):
createdBy = serializers.HiddenField(
default=serializers.CurrentUserDefault())
class Meta:
model = Project
fields = ('i... | [
"rest_framework.serializers.CurrentUserDefault"
] | [((225, 257), 'rest_framework.serializers.CurrentUserDefault', 'serializers.CurrentUserDefault', ([], {}), '()\n', (255, 257), False, 'from rest_framework import serializers\n')] |
import base64
from flask import request
from functools import wraps
from flask_restful import Resource, reqparse, abort
from data.users import User, DuplicateUserError, login
class UsersApi(Resource):
def post(self):
parser = reqparse.RequestParser()
parser.add_argument('username', type=str, req... | [
"data.users.User.create",
"flask_restful.reqparse.RequestParser",
"functools.wraps",
"data.users.login",
"flask_restful.abort",
"data.users.User.from_token"
] | [((1956, 1964), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (1961, 1964), False, 'from functools import wraps\n'), ((242, 266), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ([], {}), '()\n', (264, 266), False, 'from flask_restful import Resource, reqparse, abort\n'), ((1472, 1496), 'flask_res... |
import json
import random
from argparse import ArgumentParser
from numpy.random import default_rng
parser = ArgumentParser()
parser.add_argument("--in_file", type=str, default="data/NewsQA.train.json",)
parser.add_argument("--out_file_dev", type=str, default="dataNewsQA.sample.dev.json")
parser.add_argument("... | [
"numpy.random.default_rng",
"argparse.ArgumentParser",
"random.seed"
] | [((114, 130), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (128, 130), False, 'from argparse import ArgumentParser\n'), ((994, 1011), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1005, 1011), False, 'import random\n'), ((1023, 1036), 'numpy.random.default_rng', 'default_rng', ([], {}), '... |
from django import template
from django.utils.html import format_html, mark_safe
from django.urls import reverse
register = template.Library()
ADDR_TAGS = {
'wanted': (
'addr:housenumber', 'addr:city', 'addr:country', 'addr:postcode'
),
'anyof': (
('addr:street', 'addr:place'),
)
}
CON... | [
"django.utils.html.mark_safe",
"django.utils.html.format_html",
"django.template.Library",
"django.urls.reverse"
] | [((125, 143), 'django.template.Library', 'template.Library', ([], {}), '()\n', (141, 143), False, 'from django import template\n'), ((1885, 2110), 'django.utils.html.format_html', 'format_html', (['"""{street} {number}, {postcode} {city}"""'], {'street': "(item.street or item.place or '<street unknown>')", 'number': "(... |
import webbrowser
webbrowser.open('https://tobiaspontes.github.io/Viagens/') | [
"webbrowser.open"
] | [((19, 77), 'webbrowser.open', 'webbrowser.open', (['"""https://tobiaspontes.github.io/Viagens/"""'], {}), "('https://tobiaspontes.github.io/Viagens/')\n", (34, 77), False, 'import webbrowser\n')] |
"""
ZiGate cover platform that implements covers.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/cover.zigate/
"""
import logging
from homeassistant.components.cover import (
CoverDevice, ENTITY_ID_FORMAT)
try:
from homeassistant.components.zigate ... | [
"logging.getLogger",
"homeassistant.components.cover.ENTITY_ID_FORMAT.format",
"zigate.dispatcher.connect"
] | [((608, 635), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (625, 635), False, 'import logging\n'), ((1989, 2078), 'zigate.dispatcher.connect', 'zigate.dispatcher.connect', (['sync_attributes', 'zigate.ZIGATE_ATTRIBUTE_ADDED'], {'weak': '(False)'}), '(sync_attributes, zigate.ZIGATE_ATTRI... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 26 14:57:45 2020
@author: tech
"""
import pytest
from scicopia_tools.components.ChemTagger import ChemTagger
from scicopia_tools.components.TaxonTagger import TaxonTagger
@pytest.fixture
def pipeline():
import spacy
nlp = spacy.load("en... | [
"spacy.load"
] | [((306, 376), 'spacy.load', 'spacy.load', (['"""en_core_web_sm"""'], {'exclude': "['ner', 'lemmatizer', 'textcat']"}), "('en_core_web_sm', exclude=['ner', 'lemmatizer', 'textcat'])\n", (316, 376), False, 'import spacy\n')] |
"""
.. todo::
WRITEME
"""
from theano import tensor
import theano.sparse
from pylearn2.costs.cost import Cost, DefaultDataSpecsMixin
from theano.tensor.shared_randomstreams import RandomStreams
class GSNFriendlyCost(DefaultDataSpecsMixin, Cost):
"""
.. todo::
WRITEME
"""
@staticmethod
... | [
"theano.tensor.exp",
"theano.tensor.cast",
"theano.tensor.nnet.binary_crossentropy",
"theano.tensor.shared_randomstreams.RandomStreams",
"theano.tensor.log"
] | [((1707, 1728), 'theano.tensor.shared_randomstreams.RandomStreams', 'RandomStreams', ([], {'seed': '(1)'}), '(seed=1)\n', (1720, 1728), False, 'from theano.tensor.shared_randomstreams import RandomStreams\n'), ((2375, 2411), 'theano.tensor.cast', 'tensor.cast', (['P', 'theano.config.floatX'], {}), '(P, theano.config.fl... |
# This caused an error in py2 because cupy expect non-unicode str
# from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() ... | [
"future.standard_library.install_aliases",
"chainer.cuda.elementwise",
"chainer.cuda.get_device_from_array"
] | [((284, 318), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (316, 318), False, 'from future import standard_library\n'), ((1095, 1124), 'chainer.cuda.get_device_from_array', 'cuda.get_device_from_array', (['p'], {}), '(p)\n', (1121, 1124), False, 'from chainer import c... |
import sys
import copy
import logging
import warnings
import collections
from typing import Callable, Union, Any, Type, Dict, Tuple, Iterable
import torch
from torch import nn
from torch.optim.optimizer import Optimizer
from torch.nn.parallel import DataParallel, DistributedDataParallel
import argus
from argus import... | [
"argus.utils.check_pickleble",
"logging.StreamHandler",
"logging.Formatter",
"argus.utils.device_to_str",
"argus.utils.get_device_indices",
"copy.deepcopy",
"warnings.warn",
"torch.nn.parallel.DataParallel",
"torch.device"
] | [((969, 988), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (981, 988), False, 'import torch\n'), ((5227, 5248), 'copy.deepcopy', 'copy.deepcopy', (['params'], {}), '(params)\n', (5240, 5248), False, 'import copy\n'), ((5257, 5280), 'argus.utils.check_pickleble', 'check_pickleble', (['params'], {}),... |
# This file is part of GridCal.
#
# GridCal is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GridCal is distributed in the hope that... | [
"scipy.sparse.linalg.spsolve",
"numpy.eye",
"numpy.linalg.solve",
"numpy.abs",
"numpy.ones",
"matplotlib.pyplot.show",
"numpy.conj",
"numpy.where",
"GridCal.Engine.FileOpen",
"numpy.ix_",
"pandas.set_option",
"numpy.zeros",
"numpy.dot",
"matplotlib.pyplot.figure",
"scipy.sparse.hstack",
... | [((2526, 2544), 'numpy.zeros', 'np.zeros', (['(npq, n)'], {}), '((npq, n))\n', (2534, 2544), True, 'import numpy as np\n'), ((2653, 2667), 'scipy.sparse.linalg.spsolve', 'spsolve', (['J', 'dS'], {}), '(J, dS)\n', (2660, 2667), False, 'from scipy.sparse.linalg import factorized, spsolve, inv\n'), ((2752, 2763), 'scipy.s... |
import datetime
from flask import jsonify, request
from flask_login import current_user
from helpers import token_or_session_authenticated
from models import Feed, Token, db
@token_or_session_authenticated(user_scope=True)
def get_tokens():
"""Get Tokens
Return all Tokens belonging to user
---
tags:... | [
"models.Token.query.filter_by",
"datetime.datetime.utcnow",
"flask.jsonify",
"models.Feed.query.filter_by",
"models.db.session.add",
"flask.request.json.get",
"helpers.token_or_session_authenticated",
"models.db.session.commit"
] | [((179, 226), 'helpers.token_or_session_authenticated', 'token_or_session_authenticated', ([], {'user_scope': '(True)'}), '(user_scope=True)\n', (209, 226), False, 'from helpers import token_or_session_authenticated\n'), ((709, 756), 'helpers.token_or_session_authenticated', 'token_or_session_authenticated', ([], {'use... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Networking/Requests/Messages/UseItemReviveMessage.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message a... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor"
] | [((545, 571), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (569, 571), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((1594, 1946), 'google.protobuf.descriptor.FieldDescriptor', '_descriptor.FieldDescriptor', ([], {'name': '"""item_id"""', 'full_... |
import os.path
import re
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def fpath(name):
return os.path.join(os.path.dirname(__file__), name)
def read(fname):
return open(fpath(fname)).read()
def grep(attrname):
pattern = r"{0}\W*=\W*'([^']+)'".format(... | [
"re.findall"
] | [((344, 374), 're.findall', 're.findall', (['pattern', 'file_text'], {}), '(pattern, file_text)\n', (354, 374), False, 'import re\n')] |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics import roc_auc_score, roc_curve, classification_report
from xgboost import XGBClassifier
from time import time
idx = pd.IndexSlice
# COMMAND ----------
# MAGIC %md General
# COMMAND ----------
def coun... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"sklearn.metrics.classification_report",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.roc_curve",
"numpy.row_stack",
"numpy.random.RandomState",
"numpy.arange",
"pandas.to_datetime",
"pandas.MultiIndex.from_product",
"seaborn.color_palet... | [((10980, 10999), 'seaborn.color_palette', 'sns.color_palette', ([], {}), '()\n', (10997, 10999), True, 'import seaborn as sns\n'), ((1231, 1266), 'numpy.random.RandomState', 'np.random.RandomState', (['random_state'], {}), '(random_state)\n', (1252, 1266), True, 'import numpy as np\n'), ((5035, 5053), 'numpy.arange', ... |
import os
from PyQt5.QtWidgets import QApplication
import sys
app = QApplication(sys.argv)
f = os.readlink(__file__) if os.path.islink(__file__) else __file__
path = os.path.realpath(os.path.join(f, ".."))
def get_path_for_data_file(filename):
return os.path.join(path, "data", filename) | [
"os.path.join",
"os.path.islink",
"os.readlink",
"PyQt5.QtWidgets.QApplication"
] | [((70, 92), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (82, 92), False, 'from PyQt5.QtWidgets import QApplication\n'), ((122, 146), 'os.path.islink', 'os.path.islink', (['__file__'], {}), '(__file__)\n', (136, 146), False, 'import os\n'), ((97, 118), 'os.readlink', 'os.readlink'... |
from locust import HttpLocust, TaskSet, task
from random import randint
import random
import json
import time
from datetime import datetime
import resource
#import dateutil.parser
application_id = "myApphaha123"
master_key = "myKeyhaha123"
class DateTimeEncoder(json.JSONEncoder):
def default(self, o):
if ... | [
"datetime.datetime.fromtimestamp",
"locust.task",
"json.JSONEncoder.default",
"random.choice",
"json.dumps",
"resource.setrlimit",
"random.randint"
] | [((463, 470), 'locust.task', 'task', (['(2)'], {}), '(2)\n', (467, 470), False, 'from locust import HttpLocust, TaskSet, task\n'), ((674, 681), 'locust.task', 'task', (['(1)'], {}), '(1)\n', (678, 681), False, 'from locust import HttpLocust, TaskSet, task\n'), ((2019, 2094), 'resource.setrlimit', 'resource.setrlimit', ... |
#!/usr/bin/env python
# Python
import unittest
from unittest.mock import Mock
# Genie
from genie.tests.conf import TestCase
from genie.conf import Genie
from genie.conf.base import Testbed, Device, Link, Interface
from genie.conf.base.attributes import UnsupportedAttributeWarning
# Mcast
from genie.libs.conf.mcast.m... | [
"genie.libs.conf.vrf.Vrf",
"genie.conf.base.Testbed",
"genie.conf.base.Device",
"genie.libs.conf.mcast.mroute.Mroute",
"unittest.main",
"genie.libs.conf.mcast.Mcast"
] | [((4590, 4605), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4603, 4605), False, 'import unittest\n'), ((525, 534), 'genie.conf.base.Testbed', 'Testbed', ([], {}), '()\n', (532, 534), False, 'from genie.conf.base import Testbed, Device, Link, Interface\n'), ((613, 660), 'genie.conf.base.Device', 'Device', ([], ... |
import logging
import sys
import time
from obsei.workflow.store import WorkflowStore
from obsei.source.twitter_source import TwitterSource, TwitterSourceConfig
from obsei.workflow.workflow import Workflow, WorkflowConfig
logger = logging.getLogger(__name__)
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
... | [
"logging.getLogger",
"logging.basicConfig",
"time.sleep",
"obsei.workflow.workflow.WorkflowConfig",
"obsei.workflow.store.WorkflowStore",
"obsei.source.twitter_source.TwitterSourceConfig"
] | [((232, 259), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (249, 259), False, 'import logging\n'), ((260, 318), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.INFO'}), '(stream=sys.stdout, level=logging.INFO)\n', (279, 318), False, 'import ... |
from raamatukogu import app
import raamatukogu.ui
import raamatukogu.api
import raamatukogu.healthcheck
__all__ = ['app']
app.register_blueprint(raamatukogu.ui.blueprint)
app.register_blueprint(raamatukogu.api.blueprint, url_prefix="/api/v1")
app.register_blueprint(raamatukogu.healthcheck.blueprint, url_prefix="/api"... | [
"raamatukogu.app.run",
"raamatukogu.app.register_blueprint",
"logging.StreamHandler"
] | [((124, 172), 'raamatukogu.app.register_blueprint', 'app.register_blueprint', (['raamatukogu.ui.blueprint'], {}), '(raamatukogu.ui.blueprint)\n', (146, 172), False, 'from raamatukogu import app\n'), ((173, 244), 'raamatukogu.app.register_blueprint', 'app.register_blueprint', (['raamatukogu.api.blueprint'], {'url_prefix... |
import discord
import requests
import csv
from asyncio.events import TimerHandle
from asyncio.tasks import wait_for
from discord import user
from discord import channel
from discord.ext import commands
import json
class Investment:
def __init__(self, id, invests):
self.id = id
self.invests = invest... | [
"discord.ext.commands.Bot",
"csv.writer",
"requests.get",
"discord.Client",
"csv.reader"
] | [((749, 789), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': 'commandSign'}), '(command_prefix=commandSign)\n', (761, 789), False, 'from discord.ext import commands\n'), ((799, 815), 'discord.Client', 'discord.Client', ([], {}), '()\n', (813, 815), False, 'import discord\n'), ((3506, 3523), 'reques... |
import tensorflow.keras as tfk
class InstanceNorm(tfk.layers.Layer):
"""Instance normalization layer.
Normalizes the activations of the previous layer at each step,
i.e. applies a transformation that maintains the mean activation
of each feature map for each instance in batch close to 0 and the stand... | [
"tensorflow.keras.backend.int_shape",
"tensorflow.keras.layers.InputSpec",
"tensorflow.keras.backend.mean",
"tensorflow.keras.backend.std"
] | [((1927, 1958), 'tensorflow.keras.layers.InputSpec', 'tfk.layers.InputSpec', ([], {'ndim': 'ndim'}), '(ndim=ndim)\n', (1947, 1958), True, 'import tensorflow.keras as tfk\n'), ((2063, 2092), 'tensorflow.keras.backend.int_shape', 'tfk.backend.int_shape', (['inputs'], {}), '(inputs)\n', (2084, 2092), True, 'import tensorf... |
from django.db import models
from students.models import Subject, Teacher, Class
class Material(models.Model):
title = models.CharField(max_length=150, blank=True)
section = models.CharField(max_length=150, blank=True)
content = models.TextField(blank=False)
class_number = models.IntegerField(
... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((126, 170), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)', 'blank': '(True)'}), '(max_length=150, blank=True)\n', (142, 170), False, 'from django.db import models\n'), ((185, 229), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)', 'blank': '(True)'}), '(max... |
import flask, json
from flask import request
from flask_cors import CORS
import pyttsx3
'''
flask: web框架,通过flask提供的装饰器@server.route()将普通函数转换为服务
登录接口,需要传url、username、passwd
http://127.0.0.1:8888/login?name=xiaoming&pwd=<PASSWORD>
'''
# 创建一个服务,把当前这个python文件当做一个服务
server = flask.Flask(__name__)
# CORS(server, resources=... | [
"flask_cors.CORS",
"flask.Flask",
"pyttsx3.init",
"json.dumps",
"flask.request.values.get"
] | [((273, 294), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (284, 294), False, 'import flask, json\n'), ((373, 412), 'flask_cors.CORS', 'CORS', (['server'], {'supports_credentials': '(True)'}), '(server, supports_credentials=True)\n', (377, 412), False, 'from flask_cors import CORS\n'), ((663, 689),... |
import torch
from torch.nn import Linear, ReLU, LeakyReLU
from torch import nn
from torch.utils.data import Dataset, DataLoader
import os
from .utils import cal_num_bins
from torch.optim import lr_scheduler
import sys
class Semi_encoding_multiple(torch.nn.Module):
"""
Model for combined features
"""
de... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"pandas.read_csv",
"torch.square",
"torch.nn.MSELoss",
"torch.nn.BatchNorm1d",
"sys.exit",
"torch.nn.Sigmoid",
"torch.mean",
"torch.set_num_threads",
"os.path.getsize",
"torch.nn.LeakyReLU",
"sys.stderr.write",
"torch.norm",
"torch.nn.Softmax",
"os.... | [((2585, 2600), 'torch.nn.ReLU', 'torch.nn.ReLU', ([], {}), '()\n', (2598, 2600), False, 'import torch\n'), ((2616, 2634), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {}), '()\n', (2632, 2634), False, 'import torch\n'), ((2643, 2690), 'torch.norm', 'torch.norm', (['(embedding1 - embedding2)'], {'p': '(2)', 'dim': '(1)... |
from app.data.item_components import ItemComponent
from app.data.components import Type
from app.engine import action
class Uses(ItemComponent):
nid = 'uses'
desc = "Number of uses of item"
tag = 'uses'
expose = Type.Int
value = 1
def init(self, item):
item.data['uses']... | [
"app.engine.action.UpdateRecords",
"app.engine.action.GiveItem",
"app.engine.action.RemoveItemFromConvoy",
"app.engine.action.ChangeHP",
"app.engine.action.SetObjData",
"app.engine.action.RemoveItem",
"app.engine.action.UnequipItem",
"app.engine.action.ReverseRecords",
"app.engine.action.ChangeMana"... | [((662, 716), 'app.engine.action.SetObjData', 'action.SetObjData', (['item', '"""uses"""', "(item.data['uses'] - 1)"], {}), "(item, 'uses', item.data['uses'] - 1)\n", (679, 716), False, 'from app.engine import action\n'), ((742, 796), 'app.engine.action.UpdateRecords', 'action.UpdateRecords', (['"""item_use"""', '(unit... |
import numpy as np
import unittest
from monte_carlo_tree_search import Node, MCTS, ucb_score
from game import Connect2Game
class MCTSTests(unittest.TestCase):
def test_mcts_from_root_with_equal_priors(self):
class MockModel:
def predict(self, board):
# starting board is:
... | [
"game.Connect2Game",
"numpy.array",
"unittest.main",
"monte_carlo_tree_search.MCTS",
"monte_carlo_tree_search.Node",
"monte_carlo_tree_search.ucb_score"
] | [((8109, 8124), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8122, 8124), False, 'import unittest\n'), ((429, 443), 'game.Connect2Game', 'Connect2Game', ([], {}), '()\n', (441, 443), False, 'from game import Connect2Game\n'), ((527, 550), 'monte_carlo_tree_search.MCTS', 'MCTS', (['game', 'model', 'args'], {}), ... |
# 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.
import os
import unittest
from chrome_remote_control import browser_finder
from chrome_remote_control import options_for_unittests
class TemporaryHTTPSe... | [
"os.path.dirname",
"chrome_remote_control.options_for_unittests.Get",
"chrome_remote_control.browser_finder.FindBrowser"
] | [((517, 544), 'chrome_remote_control.options_for_unittests.Get', 'options_for_unittests.Get', ([], {}), '()\n', (542, 544), False, 'from chrome_remote_control import options_for_unittests\n'), ((569, 604), 'chrome_remote_control.browser_finder.FindBrowser', 'browser_finder.FindBrowser', (['options'], {}), '(options)\n'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""First simple sklearn classifier"""
from __future__ import division # 1/2 == 0.5, as in Py3
from __future__ import absolute_import # avoid hiding global modules with locals
from __future__ import print_function # force use of print("hello")
from __future__ import unico... | [
"matplotlib.pyplot.ylabel",
"sklearn.naive_bayes.BernoulliNB",
"copy.copy",
"sql_convenience.update_class",
"nltk.corpus.stopwords.words",
"argparse.ArgumentParser",
"sklearn.feature_extraction.text.CountVectorizer",
"numpy.where",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotli... | [((1507, 1575), 'sql_convenience.extract_classifications_and_tweets', 'sql_convenience.extract_classifications_and_tweets', (['validation_table'], {}), '(validation_table)\n', (1557, 1575), False, 'import sql_convenience\n'), ((2904, 3075), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""... |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/05a_conda.ipynb (unless otherwise specified).
__all__ = ['pypi_json', 'latest_pypi', 'write_pip_conda_meta', 'write_conda_meta']
# Cell
from .imports import *
from .export import *
import yaml
from copy import deepcopy
try: from packaging.version import parse
except Im... | [
"pip._vendor.packaging.version.parse",
"yaml.safe_dump"
] | [((1785, 1806), 'yaml.safe_dump', 'yaml.safe_dump', (['d1', 'f'], {}), '(d1, f)\n', (1799, 1806), False, 'import yaml\n'), ((1815, 1836), 'yaml.safe_dump', 'yaml.safe_dump', (['d2', 'f'], {}), '(d2, f)\n', (1829, 1836), False, 'import yaml\n'), ((619, 627), 'pip._vendor.packaging.version.parse', 'parse', (['r'], {}), '... |
import embedded_media as emb
from django.forms import Form, CharField, TextInput, Media
from django.test import TestCase
class EmbeddedMediaTest(TestCase):
def test_css(self):
## CSS rendering
css = emb.CSS('.mywidget { display: none; }')
self.assertHTMLEqual(css.render('all'),
... | [
"embedded_media.JS",
"embedded_media.CSS",
"django.forms.CharField"
] | [((221, 260), 'embedded_media.CSS', 'emb.CSS', (['""".mywidget { display: none; }"""'], {}), "('.mywidget { display: none; }')\n", (228, 260), True, 'import embedded_media as emb\n'), ((457, 483), 'embedded_media.JS', 'emb.JS', (['"""init_mywidget();"""'], {}), "('init_mywidget();')\n", (463, 483), True, 'import embedd... |
from unittest import mock
from django.contrib.auth.models import Permission
from django.http import HttpRequest, HttpResponse
from django.test import TestCase
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from wagtail.core.models import Page
from wagtail.core.signals import pa... | [
"django.contrib.auth.models.Permission.objects.get",
"wagtail.tests.testapp.models.SimplePage.objects.get",
"wagtail.tests.testapp.models.SimplePage",
"django.http.HttpResponse",
"unittest.mock.MagicMock",
"django.utils.translation.gettext_lazy",
"wagtail.core.signals.page_unpublished.connect",
"wagta... | [((608, 630), 'wagtail.core.models.Page.objects.get', 'Page.objects.get', ([], {'id': '(2)'}), '(id=2)\n', (624, 630), False, 'from wagtail.core.models import Page\n'), ((651, 736), 'wagtail.tests.testapp.models.SimplePage', 'SimplePage', ([], {'title': '"""Hello world!"""', 'slug': '"""hello-world"""', 'content': '"""... |
from __future__ import unicode_literals
from django.test import TestCase
from django_rdkit.models import *
from rdkit.Chem import AllChem as Chem
from .models import *
from .molecules import SMILES_SAMPLE
from .reactions import REACTION_SMILES_SAMPLE, REACTION_SMARTS_SAMPLE
class MolFieldTest(TestCase):
def s... | [
"rdkit.Chem.AllChem.MolFromSmiles",
"rdkit.Chem.AllChem.MolToMolBlock",
"rdkit.Chem.AllChem.GetMorganFingerprintAsBitVect"
] | [((12956, 12985), 'rdkit.Chem.AllChem.MolFromSmiles', 'Chem.MolFromSmiles', (['"""c1cocc1"""'], {}), "('c1cocc1')\n", (12974, 12985), True, 'from rdkit.Chem import AllChem as Chem\n'), ((10703, 10729), 'rdkit.Chem.AllChem.MolFromSmiles', 'Chem.MolFromSmiles', (['smiles'], {}), '(smiles)\n', (10721, 10729), True, 'from ... |
import os
import time
import cv2
import matplotlib.pyplot as plt
import numpy as np
import png
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision
from colormap.colors import Color, hex2rgb
from sklearn.metrics import average_precision_score as ap_score
from torch.utils.data import DataLo... | [
"torch.nn.ReLU",
"torch.nn.CrossEntropyLoss",
"sklearn.metrics.average_precision_score",
"tqdm.tqdm",
"dataset.FacadeDataset",
"numpy.max",
"torch.nn.Conv2d",
"numpy.zeros",
"torch.cuda.is_available",
"colormap.colors.hex2rgb",
"numpy.concatenate",
"torch.utils.data.DataLoader",
"torch.no_gr... | [((1243, 1313), 'png.Writer', 'png.Writer', (['label.shape[1]', 'label.shape[0]'], {'palette': 'colors', 'bitdepth': '(4)'}), '(label.shape[1], label.shape[0], palette=colors, bitdepth=4)\n', (1253, 1313), False, 'import png\n'), ((1494, 1505), 'time.time', 'time.time', ([], {}), '()\n', (1503, 1505), False, 'import ti... |
from v2sub import utils
V2RAY_CONFIG_FILE = "/usr/local/etc/v2ray/config.json"
def _get_config(addr: str, port: int, id_: str, alterId=0, network="tcp", type="none", tls="",client_port=1080) -> dict:
return {
"inbounds": [
{
"listen": "127.0.0.1",
"protocol": "socks",
... | [
"v2sub.utils.write_to_json"
] | [((2757, 2809), 'v2sub.utils.write_to_json', 'utils.write_to_json', (['v2ray_config', 'V2RAY_CONFIG_FILE'], {}), '(v2ray_config, V2RAY_CONFIG_FILE)\n', (2776, 2809), False, 'from v2sub import utils\n')] |
import fiona
import xarray as xr
import numpy as np
from rasterio.features import geometry_mask
import shapely
from shapely.ops import transform
from shapely.geometry import shape
from functools import partial
import pyproj
def get_y_x_bounds_shapefile(shapefile):
"""
Returns the y/x bounds of a shapefile.
... | [
"shapely.ops.transform",
"fiona.open",
"pyproj.Proj",
"shapely.geometry.shape",
"rasterio.features.geometry_mask"
] | [((507, 533), 'fiona.open', 'fiona.open', (['shapefile', '"""r"""'], {}), "(shapefile, 'r')\n", (517, 533), False, 'import fiona\n'), ((670, 695), 'shapely.geometry.shape', 'shape', (["src[0]['geometry']"], {}), "(src[0]['geometry'])\n", (675, 695), False, 'from shapely.geometry import shape\n'), ((1263, 1289), 'fiona.... |
import importlib.util
import logging
import os
import re
import signal
import sys
class FrameworkError(Exception):
pass
def load_module(name, path):
spec = importlib.util.spec_from_file_location(name, path)
module = importlib.util.module_from_spec(spec)
sys.modules[name] = module
spec.loader.exe... | [
"logging.getLogger",
"logging.basicConfig",
"logging.StreamHandler",
"amlb.utils.Namespace.walk",
"re.compile",
"amlb.utils.touch",
"os.environ.get",
"amlb.utils.Namespace.dict",
"os.path.join",
"numpy.save",
"amlb.utils.json_dump",
"sys.stdin.read",
"numpy.load",
"amlb.utils.kill_proc_tre... | [((369, 396), 'os.environ.get', 'os.environ.get', (['"""AMLB_PATH"""'], {}), "('AMLB_PATH')\n", (383, 396), False, 'import os\n'), ((795, 822), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (812, 822), False, 'import logging\n'), ((1511, 1543), 're.compile', 're.compile', (['"""^(X|y|dat... |
from typing import Tuple, Optional
import torch
from torch import nn, Tensor
from parseridge.parser.modules.attention.soft_attention import Attention
from parseridge.parser.modules.utils import initialize_xavier_dynet_, mask_
class UniversalAttention(Attention):
def __init__(
self,
query_dim: in... | [
"torch.nn.Tanh",
"torch.sum",
"torch.nn.Linear",
"parseridge.parser.modules.utils.initialize_xavier_dynet_",
"torch.rand",
"parseridge.parser.modules.utils.mask_"
] | [((1598, 1646), 'torch.nn.Linear', 'nn.Linear', ([], {'in_features': 'query_dim', 'out_features': '(1)'}), '(in_features=query_dim, out_features=1)\n', (1607, 1646), False, 'from torch import nn, Tensor\n'), ((1656, 1686), 'parseridge.parser.modules.utils.initialize_xavier_dynet_', 'initialize_xavier_dynet_', (['self']... |
#!/usr/bin/env python3
import os
import boto3
from aws_cdk import core as cdk
# For consistency with TypeScript code, `cdk` is the preferred import name for
# the CDK's core module. The following line also imports it as `core` for use
# with examples from the CDK Developer's Guide, which are in the process of
# being... | [
"flink_sql_demo.download_connector.download_connector",
"aws_cdk.core.App",
"flink_sql_demo.utils.get_public_cidr",
"flink_sql_demo.utils.check_glue_database",
"flink_sql_demo.utils.check_es_service_policy"
] | [((686, 936), 'flink_sql_demo.download_connector.download_connector', 'download_connector', ([], {'url': '"""https://repo.maven.apache.org/maven2/org/apache/flink/flink-sql-connector-elasticsearch7_2.11/1.11.2/flink-sql-connector-elasticsearch7_2.11-1.11.2.jar"""', 'filename': '"""flink-sql-connector-elasticsearch7_2.1... |
from django import template
import datetime
from django.utils import timezone
register = template.Library()
def print_timestamp(timestamp):
try:
# assume, that timestamp is given in seconds with decimal point
ts = float(timestamp)
except ValueError:
return None
return datetime.dat... | [
"datetime.datetime.fromtimestamp",
"django.template.Library"
] | [((90, 108), 'django.template.Library', 'template.Library', ([], {}), '()\n', (106, 108), False, 'from django import template\n'), ((308, 343), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['ts'], {}), '(ts)\n', (339, 343), False, 'import datetime\n')] |
#!/usr/bin/env python3
import datetime
import sqlite3
from random import randint
# con = sqlite3.connect('database.db', check_same_thread=False)
# cur = con.cursor()
def create_tables(con, cur):
cur.execute('''CREATE TABLE IF NOT EXISTS users(
username TEXT NOT NULL UNIQUE, password TEXT NOT NULL)''')
... | [
"datetime.datetime.strptime",
"datetime.datetime.now",
"datetime.timedelta",
"random.randint"
] | [((1677, 1700), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1698, 1700), False, 'import datetime\n'), ((1703, 1765), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['session[2]', '"""%Y-%m-%d %H:%M:%S.%f"""'], {}), "(session[2], '%Y-%m-%d %H:%M:%S.%f')\n", (1729, 1765), False, 'im... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import torch
import numpy as np
import pandas as pd
def to_one_hot(y, n_class=2):
oh = np.zeros((y.shape[0], n_class), np.float32)
oh[np.arange(y.shape[0]), y] = ... | [
"numpy.unique",
"torch.from_numpy",
"numpy.sum",
"torch.is_tensor",
"numpy.zeros",
"numpy.arange"
] | [((241, 284), 'numpy.zeros', 'np.zeros', (['(y.shape[0], n_class)', 'np.float32'], {}), '((y.shape[0], n_class), np.float32)\n', (249, 284), True, 'import numpy as np\n'), ((848, 860), 'numpy.unique', 'np.unique', (['y'], {}), '(y)\n', (857, 860), True, 'import numpy as np\n'), ((465, 485), 'torch.is_tensor', 'torch.is... |
from django.test import TestCase, Client
from django.contrib.auth import get_user_model
from django.urls import reverse
class AdminSiteTests(TestCase):
def setUp(self):
"""
Set up function that creates a test client,
with a new user and a regular user that will
be list... | [
"django.urls.reverse",
"django.contrib.auth.get_user_model",
"django.test.Client"
] | [((401, 409), 'django.test.Client', 'Client', ([], {}), '()\n', (407, 409), False, 'from django.test import TestCase, Client\n'), ((1057, 1094), 'django.urls.reverse', 'reverse', (['"""admin:core_user_changelist"""'], {}), "('admin:core_user_changelist')\n", (1064, 1094), False, 'from django.urls import reverse\n'), ((... |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | [
"logging.getLogger",
"rnacentral_pipeline.databases.helpers.embl.gene",
"Bio.Seq.Seq",
"rnacentral_pipeline.databases.helpers.embl.xref_data",
"rnacentral_pipeline.databases.helpers.embl.seq_version",
"rnacentral_pipeline.databases.helpers.embl.locus_tag",
"rnacentral_pipeline.databases.helpers.embl.qua... | [((1086, 1113), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1103, 1113), False, 'import logging\n'), ((1794, 1821), 'rnacentral_pipeline.databases.helpers.embl.source_feature', 'embl.source_feature', (['record'], {}), '(record)\n', (1813, 1821), True, 'import rnacentral_pipeline.datab... |
# coding:utf-8
"""
结束死循环式的攻击
反正就是结束攻击
"""
import redis
class SHUTDOWN:
def attackover(self):
r = redis.Redis(host="localhost", port=6379)
r.hset('attack', 'statu', 0)
return
if __name__ == '__main__':
shuwdown = SHUTDOWN()
shuwdown.attackover()
| [
"redis.Redis"
] | [((113, 153), 'redis.Redis', 'redis.Redis', ([], {'host': '"""localhost"""', 'port': '(6379)'}), "(host='localhost', port=6379)\n", (124, 153), False, 'import redis\n')] |
#
# Copyright (c) 2019 Intel Corporation
#
# 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 ... | [
"unittest.mock.mock_open",
"commands.model.common.get_list_of_workflows",
"commands.model.common.format_workflow_description",
"unittest.mock.patch"
] | [((1667, 1706), 'unittest.mock.mock_open', 'mock_open', ([], {'read_data': 'FULL_WORKFLOW_FILE'}), '(read_data=FULL_WORKFLOW_FILE)\n', (1676, 1706), False, 'from unittest.mock import patch, mock_open\n'), ((1936, 1983), 'unittest.mock.mock_open', 'mock_open', ([], {'read_data': 'LACK_OF_ARGS_WORKFLOW_FILE'}), '(read_da... |
# -*- coding: utf-8 -*-
####################################################
# 作者: 刘朝阳
# 时间: 2020.05.01
# 更新时间: 2021.11.25
# 功能: 在计算PERCLOS时, 需要知道驾驶在正常情况下的眼睛开度, 来作为基准计算
# 使用说明: 自动调用, 无需操作
####################################################
import os
import numpy as np
import cv2
import dlib
fro... | [
"numpy.mean",
"os.listdir",
"head_posture_estimation.head_posture_estimation",
"dlib.shape_predictor",
"os.path.join",
"dlib.get_frontal_face_detector",
"os.path.isdir",
"cv2.cvtColor",
"numpy.min",
"imutils.face_utils.shape_to_np",
"aspect_ratio_estimation.aspect_ratio_estimation",
"cv2.imrea... | [((479, 504), 'head_posture_estimation.head_posture_estimation', 'head_posture_estimation', ([], {}), '()\n', (502, 504), False, 'from head_posture_estimation import head_posture_estimation\n'), ((512, 537), 'aspect_ratio_estimation.aspect_ratio_estimation', 'aspect_ratio_estimation', ([], {}), '()\n', (535, 537), Fals... |
# 创建了新的tags标签文件后必须重启服务器
from django import template
from ..models import Ouser
from comment.models import CommentUser
register = template.Library()
@register.simple_tag()
def get_user_data(uid):
"""返回用户的信息"""
user = Ouser.objects.filter(id=uid)
if user:
return user[0]
else:
return ''... | [
"comment.models.CommentUser.objects.filter",
"django.template.Library"
] | [((131, 149), 'django.template.Library', 'template.Library', ([], {}), '()\n', (147, 149), False, 'from django import template\n'), ((403, 437), 'comment.models.CommentUser.objects.filter', 'CommentUser.objects.filter', ([], {'id': 'uid'}), '(id=uid)\n', (429, 437), False, 'from comment.models import CommentUser\n')] |
# Copyright (c) 2012-2016 Seafile Ltd.
# encoding: utf-8
import os
import logging
import json
from django.core.cache import cache
from django.http import HttpResponse, HttpResponseRedirect, Http404, \
HttpResponseBadRequest
from django.utils.translation import ugettext as _, activate
from django.contrib import mes... | [
"logging.getLogger",
"seahub.utils.is_org_context",
"seahub.share.forms.UploadLinkShareForm",
"seahub.utils.normalize_cache_key",
"seaserv.seafile_api.get_group_repoids",
"seaserv.seafserv_threaded_rpc.get_org_repo_owner",
"seaserv.seafserv_threaded_rpc.org_add_share",
"seaserv.seafile_api.get_repo",
... | [((1394, 1421), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1411, 1421), False, 'import logging\n'), ((1492, 1549), 'seaserv.seafserv_threaded_rpc.get_org_repo_owner', 'seaserv.seafserv_threaded_rpc.get_org_repo_owner', (['repo_id'], {}), '(repo_id)\n', (1540, 1549), False, 'import se... |
"""Calculations to automatically select Tonnetz.
This is a script to provide all functions in order to automatically select
Tonnetz System and modify chords.
"""
import ast
from itertools import product
from Data_and_Dicts import dictOfTonnetze
import music21 as ms
def parsedFile(file):
"""Take a parsed file an... | [
"ast.literal_eval",
"itertools.product",
"music21.converter.parse"
] | [((1099, 1127), 'music21.converter.parse', 'ms.converter.parse', (['midifile'], {}), '(midifile)\n', (1117, 1127), True, 'import music21 as ms\n'), ((4079, 4100), 'itertools.product', 'product', (['chord', 'chord'], {}), '(chord, chord)\n', (4086, 4100), False, 'from itertools import product\n'), ((3632, 3655), 'ast.li... |
"""
Copyright 2017 <NAME>
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 in writing, software
distrib... | [
"cvxpy.expressions.cvxtypes.problem"
] | [((1362, 1380), 'cvxpy.expressions.cvxtypes.problem', 'cvxtypes.problem', ([], {}), '()\n', (1378, 1380), False, 'from cvxpy.expressions import cvxtypes\n')] |
"""
Provides Response to encapsulate API responses.
"""
from builtins import next
from builtins import str
from builtins import object
from housecanary.object import Property
from housecanary.object import Block
from housecanary.object import ZipCode
from housecanary.object import Msa
from . import utilities
class R... | [
"builtins.str"
] | [((3054, 3060), 'builtins.str', 'str', (['o'], {}), '(o)\n', (3057, 3060), False, 'from builtins import str\n')] |
"""
Creates a theano based gradient descent optimiser for finding good choices of
weights to combine model predictions.
"""
import theano as th
import theano.tensor as tt
import numpy as np
def compile_model_combination_weight_optimiser(lr_adjuster = lambda h, t: h):
model_weights = tt.vector('w') # indexed over ... | [
"theano.tensor.exp",
"theano.tensor.iscalar",
"theano.function",
"theano.gradient.jacobian",
"theano.tensor.matrix",
"theano.tensor.tensor3",
"theano.tensor.vector",
"theano.tensor.arange",
"numpy.zeros",
"theano.tensor.scalar",
"theano.tensor.log",
"numpy.random.RandomState"
] | [((290, 304), 'theano.tensor.vector', 'tt.vector', (['"""w"""'], {}), "('w')\n", (299, 304), True, 'import theano.tensor as tt\n'), ((347, 362), 'theano.tensor.tensor3', 'tt.tensor3', (['"""P"""'], {}), "('P')\n", (357, 362), True, 'import theano.tensor as tt\n'), ((428, 442), 'theano.tensor.matrix', 'tt.matrix', (['""... |
#!/usr/bin/env python3
#
# Este arquivo é parte do programa multi_agenda
#
# Esta obra está licenciada com uma
# Licença Creative Commons Atribuição 4.0 Internacional.
# (CC BY 4.0 Internacional)
#
# Para ver uma cópia da licença, visite
# https://creativecommons.org/licenses/by/4.0/legalcode
#
# <NAME> - <EMAIL>
... | [
"objetos.financeiro.TipoContaDAO.TipoContaDAO",
"cgi.FieldStorage",
"objetos.financeiro.PagadorDAO.PagadorDAO",
"datetime.date.today",
"os.path.realpath",
"objetos.financeiro.ContaDAO.ContaDAO",
"objetos.financeiro.Receita.Receita",
"objetos.financeiro.Pagador.Pagador",
"cgitb.enable",
"datetime.t... | [((532, 546), 'cgitb.enable', 'cgitb.enable', ([], {}), '()\n', (544, 546), False, 'import cgitb\n'), ((1010, 1017), 'objetos.financeiro.Conta.Conta', 'Conta', ([], {}), '()\n', (1015, 1017), False, 'from objetos.financeiro.Conta import Conta\n'), ((1029, 1039), 'objetos.financeiro.ContaDAO.ContaDAO', 'ContaDAO', ([], ... |
# ===============================================================================
'''
Project:Lecture - Structural Wind Engineering WS18-19
Chair of Structural Analysis @ TUM - <NAME>, <NAME>
Author: <EMAIL>, <EMAIL>
Description: Script for plotting aerodynamic forces and moments
Created on: 05.12.... | [
"json.load"
] | [((594, 619), 'json.load', 'json.load', (['parameter_file'], {}), '(parameter_file)\n', (603, 619), False, 'import json\n')] |
import os
from django.conf import settings
from django.core.management import call_command
from django.test import TestCase
from frontend.models import RegionalTeam
class TestImportRegionalTeams(TestCase):
def test_import_stps(self):
path = os.path.join(settings.APPS_ROOT, "pipeline", "test-data", "eauth.... | [
"frontend.models.RegionalTeam.objects.count",
"os.path.join",
"frontend.models.RegionalTeam.objects.get",
"django.core.management.call_command"
] | [((255, 325), 'os.path.join', 'os.path.join', (['settings.APPS_ROOT', '"""pipeline"""', '"""test-data"""', '"""eauth.csv"""'], {}), "(settings.APPS_ROOT, 'pipeline', 'test-data', 'eauth.csv')\n", (267, 325), False, 'import os\n'), ((334, 391), 'django.core.management.call_command', 'call_command', (['"""import_regional... |
import inspect
from itertools import islice
from functools import partial
from types import BuiltinFunctionType
def _get_name(func):
"""get a function's name"""
if hasattr(func, '__name__'):
if func.__name__ == '<lambda>':
# this is pretty sketchy
return inspect.getsource(func)... | [
"inspect.isclass",
"inspect.signature",
"inspect.getsource"
] | [((943, 964), 'inspect.isclass', 'inspect.isclass', (['func'], {}), '(func)\n', (958, 964), False, 'import inspect\n'), ((985, 1017), 'inspect.signature', 'inspect.signature', (['func.__call__'], {}), '(func.__call__)\n', (1002, 1017), False, 'import inspect\n'), ((297, 320), 'inspect.getsource', 'inspect.getsource', (... |
from ext.ftp.manager import FTPManager
from tests.main import MainTestClass
from zeex.core.ctrls.ftp import FtpReply, FtpManager, Downloader
import pytest
import os
class TestFTPManager(MainTestClass):
@pytest.fixture
def manager(self):
sample_connection = ['speedtest.tele2.net', 'anonymous', 'guest'... | [
"ext.ftp.manager.FTPManager",
"os.path.exists",
"os.path.join",
"os.path.dirname",
"pytest.skip",
"os.remove"
] | [((337, 349), 'ext.ftp.manager.FTPManager', 'FTPManager', ([], {}), '()\n', (347, 349), False, 'from ext.ftp.manager import FTPManager\n'), ((502, 561), 'pytest.skip', 'pytest.skip', (['"""Takes too darn long to test this...no point."""'], {}), "('Takes too darn long to test this...no point.')\n", (513, 561), False, 'i... |
import logging
import synapse.tests.utils as s_t_utils
logger = logging.getLogger(__name__)
class MediaModelTest(s_t_utils.SynTest):
async def test_news(self):
formname = 'media:news'
async with self.getTestCore() as core:
async with await core.snap() as snap:
valu =... | [
"logging.getLogger"
] | [((66, 93), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (83, 93), False, 'import logging\n')] |
"""
@purpose: Feature extraction from Geotiff images
@author: <NAME>
@contact: <EMAIL>
"""
import os
from glob import glob
import cv2
def ostuFilter(inpath, outpath):
"""Extract features using Ostu-filter of CV2 module.
Parameters
----------
inpath : string
The path to the director... | [
"cv2.imwrite",
"cv2.threshold",
"os.path.join",
"cv2.GaussianBlur",
"cv2.imread"
] | [((613, 638), 'os.path.join', 'os.path.join', (['inpath', '"""*"""'], {}), "(inpath, '*')\n", (625, 638), False, 'import os\n'), ((738, 761), 'cv2.imread', 'cv2.imread', (['tiles[i]', '(0)'], {}), '(tiles[i], 0)\n', (748, 761), False, 'import cv2\n'), ((840, 872), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['img', '(5, 5... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.EGL import _types as _cs
# End users want this...
from OpenGL.raw.EGL._types import *
from OpenGL.raw.EGL import _errors
from OpenGL.constant import Constant as _C
imp... | [
"OpenGL.platform.types",
"OpenGL.constant.Constant",
"OpenGL.platform.createFunction"
] | [((549, 594), 'OpenGL.constant.Constant', '_C', (['"""EGL_POST_SUB_BUFFER_SUPPORTED_NV"""', '(12478)'], {}), "('EGL_POST_SUB_BUFFER_SUPPORTED_NV', 12478)\n", (551, 594), True, 'from OpenGL.constant import Constant as _C\n'), ((602, 711), 'OpenGL.platform.types', '_p.types', (['_cs.EGLBoolean', '_cs.EGLDisplay', '_cs.EG... |
"""
The tasks in this module can be used to represent builtin operations, including math,
indexing, and logical comparisons.
In general, users will not instantiate these tasks by hand; they will automatically be
applied when users apply inline Python operators to a task and another value.
"""
from operator import attr... | [
"operator.attrgetter"
] | [((1674, 1690), 'operator.attrgetter', 'attrgetter', (['attr'], {}), '(attr)\n', (1684, 1690), False, 'from operator import attrgetter\n')] |
import torch
from mmdet3d.ops import SparseBasicBlock
from mmdet3d.ops import spconv as spconv
def test_SparseUNet():
from mmdet3d.models.middle_encoders.sparse_unet import SparseUNet
self = SparseUNet(in_channels=4, sparse_shape=[41, 1600, 1408])
# test encoder layers
assert len(self.encoder_layers... | [
"mmdet3d.ops.spconv.SparseConvTensor",
"torch.tensor",
"torch.Size",
"mmdet3d.models.middle_encoders.sparse_unet.SparseUNet"
] | [((202, 258), 'mmdet3d.models.middle_encoders.sparse_unet.SparseUNet', 'SparseUNet', ([], {'in_channels': '(4)', 'sparse_shape': '[41, 1600, 1408]'}), '(in_channels=4, sparse_shape=[41, 1600, 1408])\n', (212, 258), False, 'from mmdet3d.models.middle_encoders.sparse_unet import SparseUNet\n'), ((1516, 1726), 'torch.tens... |
# The MIT License (MIT)
#
# Copyright (c) 2019 <NAME> for <NAME>
#
# 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,... | [
"digitalio.DigitalInOut",
"busio.UART",
"time.sleep"
] | [((1835, 1867), 'digitalio.DigitalInOut', 'digitalio.DigitalInOut', (['board.A1'], {}), '(board.A1)\n', (1857, 1867), False, 'import digitalio\n'), ((1918, 1965), 'busio.UART', 'busio.UART', (['board.TX', 'board.RX'], {'baudrate': '(115200)'}), '(board.TX, board.RX, baudrate=115200)\n', (1928, 1965), False, 'import bus... |
"""
Some basic inference functions adapted from my inferno module which should be available
here soon:
https://github.com/nealegibson/inferno
Really they are just rewritten versions of https://github.com/nealegibson/Infer
But there are many other options for optimisers/MCMCs/etc, and they should (in principle)
all do m... | [
"numpy.sqrt",
"numpy.random.rand",
"numpy.array",
"scipy.optimize.fmin",
"numpy.where",
"numpy.exp",
"numpy.empty",
"numpy.ones",
"numpy.any",
"numpy.std",
"time.time",
"matplotlib.pyplot.subplots_adjust",
"numpy.copy",
"numpy.diag",
"numpy.sum",
"numpy.random.randint",
"matplotlib.p... | [((1305, 1316), 'numpy.copy', 'np.copy', (['x0'], {}), '(x0)\n', (1312, 1316), True, 'import numpy as np\n'), ((1684, 1731), 'scipy.optimize.fmin', 'fmin', (['wrapper', 'x0[var_ind]'], {'args': 'args'}), '(wrapper, x0[var_ind], args=args, **kwargs)\n', (1688, 1731), False, 'from scipy.optimize import fmin\n'), ((2403, ... |
#!/usr/bin/env python
from setuptools import setup, find_packages
version = None
exec(open('dagr_revamped/version.py').read())
with open('README.md', 'r') as fh:
long_description = fh.read()
setup(
name='dagr_revamped',
version=version,
description='A deviantArt Ripper script written in Python',
a... | [
"setuptools.find_packages"
] | [((402, 417), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (415, 417), False, 'from setuptools import setup, find_packages\n')] |
# Generated by Django 3.2.5 on 2021-07-08 13:20
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
("schools", "0001_initial"),
migrations.swappable_dependency(sett... | [
"django.db.models.EmailField",
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.BigAutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
... | [((284, 341), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (315, 341), False, 'from django.db import migrations, models\n'), ((558, 654), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '... |
from bfxhfindicators.indicator import Indicator
from bfxhfindicators.ema import EMA
from bfxhfindicators.accumulation_distribution import AccumulationDistribution
from math import isfinite
class ChaikinOsc(Indicator):
def __init__(self, short, long, cache_size=None):
self._shortEMA = EMA(short, cache_size... | [
"bfxhfindicators.ema.EMA",
"math.isfinite",
"bfxhfindicators.accumulation_distribution.AccumulationDistribution"
] | [((299, 321), 'bfxhfindicators.ema.EMA', 'EMA', (['short', 'cache_size'], {}), '(short, cache_size)\n', (302, 321), False, 'from bfxhfindicators.ema import EMA\n'), ((346, 367), 'bfxhfindicators.ema.EMA', 'EMA', (['long', 'cache_size'], {}), '(long, cache_size)\n', (349, 367), False, 'from bfxhfindicators.ema import EM... |
from pyomo.opt import SolverFactory, SolverStatus, TerminationCondition
import pyomo.environ as en
import os
import numpy as np
import logging
logger = logging.getLogger(__name__)
####################################################################
# Define some useful container objects to define the optimisation ob... | [
"logging.getLogger",
"pyomo.environ.Objective",
"os.environ.get",
"pyomo.environ.Param",
"logging.warning",
"numpy.zeros",
"pyomo.environ.Var",
"pyomo.opt.SolverFactory",
"pyomo.environ.RangeSet",
"pyomo.environ.Constraint",
"pyomo.environ.ConcreteModel"
] | [((153, 180), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (170, 180), False, 'import logging\n'), ((4342, 4360), 'pyomo.environ.ConcreteModel', 'en.ConcreteModel', ([], {}), '()\n', (4358, 4360), True, 'import pyomo.environ as en\n'), ((4501, 4545), 'pyomo.environ.RangeSet', 'en.RangeS... |
from __future__ import print_function
import httplib2
import os
import pprint
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
try:
import argparse
flags = tools.argparser.parse_args([])
except ImportError:
flags = None
# ... | [
"os.path.exists",
"os.makedirs",
"os.path.join",
"oauth2client.client.flow_from_clientsecrets",
"oauth2client.tools.run",
"oauth2client.tools.argparser.parse_args",
"oauth2client.file.Storage",
"httplib2.Http",
"oauth2client.tools.run_flow",
"apiclient.discovery.build",
"os.path.expanduser"
] | [((249, 279), 'oauth2client.tools.argparser.parse_args', 'tools.argparser.parse_args', (['[]'], {}), '([])\n', (275, 279), False, 'from oauth2client import tools\n'), ((870, 893), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (888, 893), False, 'import os\n'), ((915, 953), 'os.path.join', 'o... |
#!/usr/bin/env python3
import subprocess
import tempfile
from pathlib import Path
class ChromiumEC:
def __init__(self, uart, ftdi_serial=None):
self.uart = uart
self.ftdi_serial = ftdi_serial
self.prompt = '>'
def _stop_spam(self):
self.uart.sendline('chan 0')
self.ua... | [
"subprocess.run",
"pathlib.Path",
"tempfile.NamedTemporaryFile"
] | [((4424, 4453), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {}), '()\n', (4451, 4453), False, 'import tempfile\n'), ((4538, 4591), 'subprocess.run', 'subprocess.run', (["['openocd', '-f', f.name]"], {'check': '(True)'}), "(['openocd', '-f', f.name], check=True)\n", (4552, 4591), False, 'import su... |
"""Visualize convergence"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from .test_functions import simple_nonconvex_function, ackley
from .visualisation import FIGSIZE
def max_distances(history, f):
data = {'max_distance': max_distances}
stats = pd.DataFrame(... | [
"seaborn.lmplot",
"seaborn.set",
"matplotlib.pyplot.gcf",
"numpy.log",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"numpy.concatenate",
"pandas.DataFrame",
"numpy.all",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((307, 325), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (319, 325), True, 'import pandas as pd\n'), ((401, 411), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (409, 411), True, 'import matplotlib.pyplot as plt\n'), ((472, 498), 'numpy.arange', 'np.arange', (['(-10)', '(10)', '(0.0001)'],... |
import asyncio, asyncssh, crypt, sys
passwords = {'guest': '', # guest account with no password
'user123': '<PASSWORD>' # password of '<PASSWORD>'
}
def handle_client(process):
process.stdout.write('Welcome to my SSH server, %s!\n' %
process.get_... | [
"asyncssh.create_server",
"asyncio.get_event_loop",
"crypt.crypt"
] | [((1311, 1335), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (1333, 1335), False, 'import asyncio, asyncssh, crypt, sys\n'), ((1125, 1241), 'asyncssh.create_server', 'asyncssh.create_server', (['MySSHServer', '""""""', '(8023)'], {'server_host_keys': "['ssh_host_key']", 'process_factory': 'hand... |
# Copyright (c) 2017 Sony 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 required by applicabl... | [
"os.path.dirname",
"nnabla.logger.warn",
"os.listdir",
"importlib.import_module"
] | [((2059, 2075), 'os.listdir', 'listdir', (['ext_dir'], {}), '(ext_dir)\n', (2066, 2075), False, 'from os import listdir\n'), ((1385, 1438), 'importlib.import_module', 'importlib.import_module', (["('.' + ext_name)", '"""nnabla_ext"""'], {}), "('.' + ext_name, 'nnabla_ext')\n", (1408, 1438), False, 'import importlib\n')... |
from __future__ import with_statement
from rpython.jit.backend.arm import conditions as c
from rpython.jit.backend.arm import registers as r
from rpython.jit.backend.arm.codebuilder import AbstractARMv7Builder
from rpython.jit.metainterp.history import ConstInt, BoxInt, FLOAT
from rpython.rlib.rarithmetic import r_uint... | [
"rpython.jit.backend.arm.conditions.get_opposite_of"
] | [((456, 484), 'rpython.jit.backend.arm.conditions.get_opposite_of', 'c.get_opposite_of', (['true_cond'], {}), '(true_cond)\n', (473, 484), True, 'from rpython.jit.backend.arm import conditions as c\n'), ((862, 890), 'rpython.jit.backend.arm.conditions.get_opposite_of', 'c.get_opposite_of', (['true_cond'], {}), '(true_c... |
"""
Send attackers IP to GreyNoise
"""
from __future__ import annotations
import treq
from twisted.internet import defer, error
from twisted.python import log
import cowrie.core.output
from cowrie.core.config import CowrieConfig
COWRIE_USER_AGENT = "Cowrie Honeypot"
GNAPI_URL = "https://api.greynoise.io/v3/communit... | [
"treq.get",
"twisted.python.log.err",
"twisted.python.log.msg",
"cowrie.core.config.CowrieConfig.get",
"cowrie.core.config.CowrieConfig.getboolean"
] | [((500, 562), 'cowrie.core.config.CowrieConfig.get', 'CowrieConfig.get', (['"""output_greynoise"""', '"""api_key"""'], {'fallback': 'None'}), "('output_greynoise', 'api_key', fallback=None)\n", (516, 562), False, 'from cowrie.core.config import CowrieConfig\n'), ((584, 652), 'cowrie.core.config.CowrieConfig.getboolean'... |
import random
from django.test import TestCase, Client
from django.conf import settings
from django.urls import reverse
from bag_transfer.lib.bag_checker import bagChecker
from bag_transfer.models import (
BagItProfile,
ManifestsAllowed,
ManifestsRequired,
AcceptSerialization,
AcceptBagItVersion,
... | [
"bag_transfer.test.helpers.create_test_orgs",
"bag_transfer.models.BagItProfile.objects.last",
"bag_transfer.test.helpers.create_test_tagfilesrequired",
"bag_transfer.test.helpers.create_target_bags",
"bag_transfer.test.helpers.create_test_acceptbagitversion",
"django.urls.reverse",
"bag_transfer.test.h... | [((574, 582), 'django.test.Client', 'Client', ([], {}), '()\n', (580, 582), False, 'from django.test import TestCase, Client\n'), ((603, 640), 'bag_transfer.test.helpers.create_test_orgs', 'helpers.create_test_orgs', ([], {'org_count': '(1)'}), '(org_count=1)\n', (627, 640), False, 'from bag_transfer.test import helper... |
import io
import socket
import ssl
import sys
if sys.version_info.major == 3:
text_stream_types = io.TextIOBase
bytes_stream_types = io.BufferedIOBase
else:
text_stream_types = io.TextIOBase
bytes_stream_types = io.BufferedIOBase, file # noqa: F821
SYSLOG_PORT = 514
# RFC6587 framing
FRAMING_OCTET_C... | [
"ssl.create_default_context",
"socket.getaddrinfo",
"socket.socket"
] | [((674, 727), 'socket.getaddrinfo', 'socket.getaddrinfo', (['host', 'port', '(0)', 'socket.SOCK_STREAM'], {}), '(host, port, 0, socket.SOCK_STREAM)\n', (692, 727), False, 'import socket\n'), ((2608, 2699), 'ssl.create_default_context', 'ssl.create_default_context', ([], {'purpose': 'ssl.Purpose.SERVER_AUTH', 'cafile': ... |
import sys
import subprocess
PY2 = sys.version_info < (3,)
try:
check_output = subprocess.check_output
except AttributeError:
def check_output(*args, **kwargs):
proc = subprocess.Popen(*args, stdout=subprocess.PIPE, **kwargs)
stdout, stderr = proc.communicate()
if proc.returncode:
... | [
"subprocess.Popen"
] | [((185, 242), 'subprocess.Popen', 'subprocess.Popen', (['*args'], {'stdout': 'subprocess.PIPE'}), '(*args, stdout=subprocess.PIPE, **kwargs)\n', (201, 242), False, 'import subprocess\n')] |
'''
pass_flatten_basic02.py
Copyright (c) Seoul National University
Licensed under the MIT license.
Author: <NAME>
Basic functionality check for torch.flatten.
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
a = torch.rand(2, 3, 4, 5, 6, 7)
b = torch.flatten(a)
# shape assertion
b + torch.ran... | [
"torch.rand",
"torch.flatten"
] | [((238, 266), 'torch.rand', 'torch.rand', (['(2)', '(3)', '(4)', '(5)', '(6)', '(7)'], {}), '(2, 3, 4, 5, 6, 7)\n', (248, 266), False, 'import torch\n'), ((271, 287), 'torch.flatten', 'torch.flatten', (['a'], {}), '(a)\n', (284, 287), False, 'import torch\n'), ((311, 348), 'torch.rand', 'torch.rand', (['(7 * 6 * 5 * 4 ... |
import os
from pathlib import Path
import typer
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
app_dir = Path(typer.get_app_dir('pacu'))
profile_path = app_dir/'profile'
| [
"os.path.abspath",
"typer.get_app_dir"
] | [((77, 102), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (92, 102), False, 'import os\n'), ((120, 145), 'typer.get_app_dir', 'typer.get_app_dir', (['"""pacu"""'], {}), "('pacu')\n", (137, 145), False, 'import typer\n')] |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
---------------------------------------------... | [
"functools.wraps",
"common.local.get_local_param"
] | [((3161, 3177), 'functools.wraps', 'wraps', (['view_func'], {}), '(view_func)\n', (3166, 3177), False, 'from functools import wraps\n'), ((3931, 3947), 'functools.wraps', 'wraps', (['view_func'], {}), '(view_func)\n', (3936, 3947), False, 'from functools import wraps\n'), ((4022, 4049), 'common.local.get_local_param', ... |
from django.http import JsonResponse
from .models import Lottery
from django.urls import reverse
from django.shortcuts import redirect
from django.core.management import call_command
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def index(request):
"""
Example:
// GET https://two.fake... | [
"django.urls.reverse",
"django.core.management.call_command",
"django.http.JsonResponse"
] | [((1975, 1996), 'django.http.JsonResponse', 'JsonResponse', (['results'], {}), '(results)\n', (1987, 1996), False, 'from django.http import JsonResponse\n'), ((1035, 1064), 'django.core.management.call_command', 'call_command', (['"""createlottery"""'], {}), "('createlottery')\n", (1047, 1064), False, 'from django.core... |
from funciones import *
import folium
import os
import webbrowser
opciones = ["Top 10 de las estaciones mas visitas",
"Analisis horario", "Consulta tipo pase",
"Mostrar top veinte de las estaciones en el mapa",
"Salir"]
opcion = 0
nombre_archivo = "prestamos_bici"
estac... | [
"webbrowser.open_new",
"os.getcwd",
"folium.Map"
] | [((2031, 2075), 'folium.Map', 'folium.Map', ([], {'location': 'centro', 'zoom_start': 'zoom'}), '(location=centro, zoom_start=zoom)\n', (2041, 2075), False, 'import folium\n'), ((2448, 2459), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2457, 2459), False, 'import os\n'), ((2602, 2655), 'webbrowser.open_new', 'webbrows... |
from pprint import pprint
import sys
import os
import requests
# === 여기 (work 함수) 에만 작업하면 됩니다 ===
def work(args):
# 구구단을 처리 할 수 있는 샘플 작업입니다.
number_a = args["number_a"]
number_b_list = args["number_b_list"]
note = [number_a * number_b for number_b in number_b_list]
return note
# === 여기부터는 무... | [
"requests.post"
] | [((693, 772), 'requests.post', 'requests.post', (['f"""{self.master_uri}/fetch"""'], {'json': "{'table_name': self.table_name}"}), "(f'{self.master_uri}/fetch', json={'table_name': self.table_name})\n", (706, 772), False, 'import requests\n'), ((951, 1096), 'requests.post', 'requests.post', (['f"""{self.master_uri}/rep... |
#!/usr/bin/python
import rekurencja
import rekurencja as rek
from rekurencja import factorial
from rekurencja import fibonacci as fib
print(rekurencja.factorial(6))
print(fib(5))
| [
"rekurencja.fibonacci",
"rekurencja.factorial"
] | [((142, 165), 'rekurencja.factorial', 'rekurencja.factorial', (['(6)'], {}), '(6)\n', (162, 165), False, 'import rekurencja\n'), ((173, 179), 'rekurencja.fibonacci', 'fib', (['(5)'], {}), '(5)\n', (176, 179), True, 'from rekurencja import fibonacci as fib\n')] |
from rlpyt.utils.launching.affinity import encode_affinity
from rlpyt.utils.launching.exp_launcher import run_experiments
from rlpyt.utils.launching.variant import make_variants, VariantLevel
script = "rlpyt/experiments/scripts/dm_control/qpg/sac/train/dm_control_sac_autoreg.py"
affinity_code = encode_affinity(
n... | [
"rlpyt.utils.launching.exp_launcher.run_experiments",
"rlpyt.utils.launching.variant.make_variants",
"rlpyt.utils.launching.affinity.encode_affinity",
"rlpyt.utils.launching.variant.VariantLevel"
] | [((298, 357), 'rlpyt.utils.launching.affinity.encode_affinity', 'encode_affinity', ([], {'n_cpu_core': '(16)', 'n_gpu': '(4)', 'contexts_per_gpu': '(2)'}), '(n_cpu_core=16, n_gpu=4, contexts_per_gpu=2)\n', (313, 357), False, 'from rlpyt.utils.launching.affinity import encode_affinity\n'), ((1018, 1048), 'rlpyt.utils.la... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# import os
# import warnings
# os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
# warnings.filterwarnings("ignore")
import os
import re
import datetime
from absl import app
import sys
from absl import flags
from absl... | [
"open_spiel.python.algorithms.psro_variations.generalized_egta.GenEGTASolver",
"os.path.exists",
"os.listdir",
"pyspiel.load_game",
"tensorboardX.SummaryWriter",
"os.makedirs",
"absl.flags.DEFINE_integer",
"absl.flags.DEFINE_boolean",
"absl.app.run",
"os.getcwd",
"datetime.datetime.now",
"absl... | [((582, 620), 'absl.logging.set_verbosity', 'logging.set_verbosity', (['logging.WARNING'], {}), '(logging.WARNING)\n', (603, 620), False, 'from absl import logging\n'), ((642, 704), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""game"""', '"""kuhn_poker"""', '"""Name of the game."""'], {}), "('game', 'kuhn_po... |
"""
"""
import pprint
import ipaddress
try:
from stage_check import gql_helper
except ImportError:
import gql_helper
try:
from stage_check import Output
except ImportError:
import Output
try:
from stage_check import AbstractTest
except ImportError:
import AbstractTest
def create_instance(te... | [
"ipaddress.ip_address",
"gql_helper.NodeGQL",
"pprint.pprint"
] | [((2231, 2268), 'gql_helper.NodeGQL', 'gql_helper.NodeGQL', (['"""nodes"""', "['name']"], {}), "('nodes', ['name'])\n", (2249, 2268), False, 'import gql_helper\n'), ((2280, 2384), 'gql_helper.NodeGQL', 'gql_helper.NodeGQL', (['"""deviceInterfaces"""', "['name', 'sharedPhysAddress', 'state { operationalStatus }']"], {})... |
# Standard Library
import os
import re
from abc import ABC, abstractmethod
# Local
from .logger import get_logger
from .utils import get_immediate_subdirectories
logger = get_logger()
class TensorLocation:
def __init__(self, tname, mode, mode_step, event_file_name, start_idx, length, worker):
self.tenso... | [
"re.compile",
"os.path.join",
"re.match",
"os.path.basename",
"re.search"
] | [((1779, 1798), 'os.path.basename', 'os.path.basename', (['s'], {}), '(s)\n', (1795, 1798), False, 'import os\n'), ((1811, 1860), 're.search', 're.search', (['"""(.*)_(.*).tfevents$"""', 'event_file_name'], {}), "('(.*)_(.*).tfevents$', event_file_name)\n", (1820, 1860), False, 'import re\n'), ((2440, 2473), 'os.path.j... |
import numpy as np
from numpy import linalg as LA
from sklearn.decomposition import PCA
from utils import pulse_helper
np.set_printoptions(suppress=True)
if __name__ == '__main__':
TEN_BITS_ADC_VALUE = 1023
pedestal = 0
dimension = 7
number_of_data = 20
qtd_for_training = 10
qtd_for_testing =... | [
"numpy.linalg.eig",
"sklearn.decomposition.PCA",
"numpy.random.random",
"numpy.asmatrix",
"utils.pulse_helper.get_jitter_pulse",
"numpy.diag",
"numpy.zeros",
"numpy.matrix",
"numpy.transpose",
"numpy.random.randn",
"numpy.var",
"numpy.set_printoptions"
] | [((121, 155), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)'}), '(suppress=True)\n', (140, 155), True, 'import numpy as np\n'), ((574, 1451), 'numpy.matrix', 'np.matrix', (['[[-0.8756796, -0.9904594, 0.0763564, 0.2866689, -0.8491597, -2.6331943, \n 0.4875299], [0.5691059, 1.0500695, 0.20... |
# coding=utf-8
"""根据搜索词下载百度图片"""
import re
import urllib
import requests
def getPage(keyWord, page, n):
page = page * n
keyWord = urllib.parse.quote(keyWord, safe='/')
url_begin = "http://image.baidu.com/search/flip?tn=baiduimage&ie=utf-8&word="
url = url_begin + keyWord + "&pn=" + str(page) + "&gsm="... | [
"re.findall",
"urllib.parse.quote",
"requests.get"
] | [((140, 177), 'urllib.parse.quote', 'urllib.parse.quote', (['keyWord'], {'safe': '"""/"""'}), "(keyWord, safe='/')\n", (158, 177), False, 'import urllib\n'), ((585, 628), 're.findall', 're.findall', (['""""objURL":"(.*?)","""', 'html', 're.S'], {}), '(\'"objURL":"(.*?)",\', html, re.S)\n', (595, 628), False, 'import re... |
"""
Code for working with Celeb+ dataset
"""
import os
import shutil
import subprocess
import glob
import face.download
import face.utilities
import face.geometry
class DatasetBuilder:
"""
Class for downloading Celeb+ data and preparing datasets from it.
"""
def __init__(self, data_directory):
... | [
"os.makedirs",
"os.path.join",
"subprocess.call",
"os.path.basename",
"shutil.rmtree",
"os.path.abspath",
"os.remove"
] | [((397, 456), 'os.path.join', 'os.path.join', (['self.data_directory', '"""all_bounding_boxes.txt"""'], {}), "(self.data_directory, 'all_bounding_boxes.txt')\n", (409, 456), False, 'import os\n'), ((497, 551), 'shutil.rmtree', 'shutil.rmtree', (['self.data_directory'], {'ignore_errors': '(True)'}), '(self.data_director... |