code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: vizfilter.py
# Author: <NAME> <<EMAIL>>
import os
import scipy
import argparse
import tensorflow as tf
import config_path as config
import sys
sys.path.append('../')
from lib.nets.googlenet import BaseGoogLeNet
import lib.utils.viz as viz
import lib.utils.normali... | [
"sys.path.append",
"argparse.ArgumentParser",
"tensorflow.global_variables_initializer",
"tensorflow.Session",
"lib.nets.googlenet.BaseGoogLeNet",
"os.path.isfile",
"tensorflow.get_default_graph",
"os.path.join",
"scipy.misc.imread"
] | [((200, 222), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (215, 222), False, 'import sys\n'), ((368, 393), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (391, 393), False, 'import argparse\n'), ((992, 1028), 'lib.nets.googlenet.BaseGoogLeNet', 'BaseGoogLeNet', (['co... |
from datetime import datetime
from alertaclient.utils import DateTime
class Alert:
def __init__(self, resource, event, **kwargs):
if not resource:
raise ValueError('Missing mandatory value for "resource"')
if not event:
raise ValueError('Missing mandatory value for "even... | [
"alertaclient.utils.DateTime.localtime",
"datetime.datetime.utcnow"
] | [((1563, 1580), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (1578, 1580), False, 'from datetime import datetime\n'), ((2059, 2076), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (2074, 2076), False, 'from datetime import datetime\n'), ((4844, 4896), 'alertaclient.utils.DateTime.l... |
# -*- Python -*-
# license
# license.
"""
Files opening and reading/writing functions.
"""
import sys, os, bz2, lzma, json
import logging; module_logger = logging.getLogger(__name__)
# ======================================================================
def open_for_reading_binary(filename):
"""Opens binary fi... | [
"lzma.LZMAFile",
"lzma.open",
"os.path.basename",
"os.rename",
"os.path.dirname",
"bz2.BZ2File",
"json.dumps",
"lzma.decompress",
"bz2.decompress",
"os.access",
"logging.getLogger"
] | [((156, 183), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (173, 183), False, 'import logging\n'), ((5681, 5708), 'os.access', 'os.access', (['newname', 'os.F_OK'], {}), '(newname, os.F_OK)\n', (5690, 5708), False, 'import sys, os, bz2, lzma, json\n'), ((1412, 1433), 'lzma.decompress', ... |
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O... | [
"numpy.random.seed",
"numpy.sum",
"numpy.abs",
"pandas.read_csv",
"numpy.clip",
"numpy.mean",
"numpy.linalg.norm",
"numpy.arange",
"numpy.exp",
"numpy.diag",
"pandas.DataFrame",
"numpy.random.randn",
"numpy.power",
"numpy.max",
"numpy.reshape",
"numpy.linspace",
"numpy.tanh",
"pand... | [((804, 837), 'pandas.read_csv', 'pd.read_csv', (['"""../input/train.csv"""'], {}), "('../input/train.csv')\n", (815, 837), True, 'import pandas as pd\n'), ((849, 881), 'pandas.read_csv', 'pd.read_csv', (['"""../input/test.csv"""'], {}), "('../input/test.csv')\n", (860, 881), True, 'import pandas as pd\n'), ((11335, 11... |
# Copyright (c) 2019, Adobe Inc. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike
# 4.0 International Public License. To view a copy of this license, visit
# https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.
import paddle
import numpy as n... | [
"paddle.sum",
"numpy.ceil",
"paddle.nn.functional.pad",
"numpy.array",
"paddle.to_tensor"
] | [((1549, 1607), 'paddle.to_tensor', 'paddle.to_tensor', (['(a[:, None] * a[None, :])'], {'dtype': '"""float32"""'}), "(a[:, None] * a[None, :], dtype='float32')\n", (1565, 1607), False, 'import paddle\n'), ((1014, 1029), 'numpy.array', 'np.array', (['[1.0]'], {}), '([1.0])\n', (1022, 1029), True, 'import numpy as np\n'... |
import openpyxl
from selenium import webdriver
# Excelファイル名
file_name = './URL.xlsx'
# シート名
sheet_name = 'URL'
# URLの開始行
row_start = 2
# URLの最終行
row_end = 6
if __name__ == '__main__':
# Excelファイルをロードする
workbook = openpyxl.load_workbook(file_name)
worksheet = workbook[sheet_name]
# Chromeブラウザを初期化... | [
"openpyxl.load_workbook",
"selenium.webdriver.Chrome"
] | [((228, 261), 'openpyxl.load_workbook', 'openpyxl.load_workbook', (['file_name'], {}), '(file_name)\n', (250, 261), False, 'import openpyxl\n'), ((336, 354), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (352, 354), False, 'from selenium import webdriver\n')] |
import click
import subprocess
import os
import webbrowser
import asyncio
from flask import Flask, render_template, redirect, url_for, request, session
app = Flask(__name__)
app.secret_key = "<KEY>"
@app.route('/')
def index():
filename = os.environ["JQ_FILENAME"]
jq_filter = session.get("filter", ".")
pr... | [
"webbrowser.open",
"asyncio.sleep",
"subprocess.check_output",
"flask.Flask",
"click.option",
"flask.session.get",
"click.command",
"flask.request.environ.get",
"flask.url_for",
"flask.render_template",
"click.Path",
"asyncio.create_subprocess_shell"
] | [((159, 174), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (164, 174), False, 'from flask import Flask, render_template, redirect, url_for, request, session\n'), ((1593, 1608), 'click.command', 'click.command', ([], {}), '()\n', (1606, 1608), False, 'import click\n'), ((1668, 1755), 'click.option', 'clic... |
from dal import autocomplete
from .models import TestModel
class TestForm(autocomplete.FutureModelForm):
test = autocomplete.TaggitField(
required=False,
widget=autocomplete.TagSelect2(url='select2_taggit'),
)
class Meta:
model = TestModel
fields = ('name', 'test')
| [
"dal.autocomplete.TagSelect2"
] | [((184, 229), 'dal.autocomplete.TagSelect2', 'autocomplete.TagSelect2', ([], {'url': '"""select2_taggit"""'}), "(url='select2_taggit')\n", (207, 229), False, 'from dal import autocomplete\n')] |
import os
import pandas as pd
from base import BaseFeature
from encoding_func import target_encoding
from google.cloud import storage, bigquery
from google.cloud import bigquery_storage_v1beta1
class TargetEncodingHashtags(BaseFeature):
def import_columns(self):
return [
"tweet_id",
... | [
"pandas.DataFrame",
"pandas.merge",
"google.cloud.bigquery.Client",
"google.cloud.bigquery_storage_v1beta1.BigQueryStorageClient",
"encoding_func.target_encoding"
] | [((2980, 3020), 'google.cloud.bigquery.Client', 'bigquery.Client', ([], {'project': 'self.PROJECT_ID'}), '(project=self.PROJECT_ID)\n', (2995, 3020), False, 'from google.cloud import storage, bigquery\n'), ((3047, 3095), 'google.cloud.bigquery_storage_v1beta1.BigQueryStorageClient', 'bigquery_storage_v1beta1.BigQuerySt... |
from ifree import processing
from ifree import dicom
import os
import pickle
import pandas as pd
import numpy as np
import itk
def readNII(dcm_path):
ImageType = itk.Image[itk.F, 3]
reader = itk.ImageSeriesReader[ImageType].New()
reader.SetFileName(dcm_path)
reader.Update()
image3d = reader.GetOutpu... | [
"ifree.dicom.get_dvh_of_key",
"ifree.processing.FeatureExtractor",
"pandas.DataFrame.from_dict",
"ifree.dicom.cropDose",
"itk.GetArrayFromImage",
"ifree.dicom.cropROI",
"ifree.dicom.archiveFiles",
"os.listdir"
] | [((335, 365), 'itk.GetArrayFromImage', 'itk.GetArrayFromImage', (['image3d'], {}), '(image3d)\n', (356, 365), False, 'import itk\n'), ((567, 594), 'ifree.dicom.archiveFiles', 'dicom.archiveFiles', (['old_Dir'], {}), '(old_Dir)\n', (585, 594), False, 'from ifree import dicom\n'), ((953, 1005), 'ifree.dicom.cropROI', 'di... |
import json, itertools
with open("scanners.json", "r") as fh:
scanners = json.load(fh)
absolutescanners = [i["offset"] for i in scanners]
max_val = 0
for a, b in itertools.combinations(absolutescanners, 2):
(x, y, z) = [ abs(a[i] - b[i]) for i in range(3)]
manhattan_distance = sum([x, y, z])
max_val... | [
"itertools.combinations",
"json.load"
] | [((170, 213), 'itertools.combinations', 'itertools.combinations', (['absolutescanners', '(2)'], {}), '(absolutescanners, 2)\n', (192, 213), False, 'import json, itertools\n'), ((78, 91), 'json.load', 'json.load', (['fh'], {}), '(fh)\n', (87, 91), False, 'import json, itertools\n')] |
# Generated by Django 2.2.7 on 2019-12-03 09:33
from django.db import migrations
class Migration(migrations.Migration):
atomic = False
dependencies = [
('goods', '0005_auto_20191203_0913'),
]
operations = [
migrations.RenameModel(
old_name='Peaple',
new_n... | [
"django.db.migrations.RenameModel"
] | [((248, 308), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""Peaple"""', 'new_name': '"""People"""'}), "(old_name='Peaple', new_name='People')\n", (270, 308), False, 'from django.db import migrations\n')] |
from pyspark import SparkContext, SparkConf
from pyspark.streaming import StreamingContext
from pyspark.streaming.kafka import KafkaUtils
import os
from sentinel_common.mentions import Mention
import json
from textblob import TextBlob
sc = SparkContext.getOrCreate()
sc.setLogLevel("WARN")
ssc = StreamingContext(sc, 3)... | [
"json.loads",
"pyspark.SparkContext.getOrCreate",
"pyspark.streaming.kafka.KafkaUtils.createDirectStream",
"pyspark.streaming.StreamingContext",
"textblob.TextBlob"
] | [((241, 267), 'pyspark.SparkContext.getOrCreate', 'SparkContext.getOrCreate', ([], {}), '()\n', (265, 267), False, 'from pyspark import SparkContext, SparkConf\n'), ((297, 320), 'pyspark.streaming.StreamingContext', 'StreamingContext', (['sc', '(3)'], {}), '(sc, 3)\n', (313, 320), False, 'from pyspark.streaming import ... |
import json
import os
import urllib.parse
import jsonschema
import requests
import inject
from abc import ABC, abstractmethod
from datetime import datetime
from urllib.parse import urlparse
from pysnmp.entity.engine import SnmpEngine
from pysnmp.smi.rfc1902 import ObjectIdentity, ObjectType
from agent import source
fr... | [
"jsonschema.validate",
"agent.modules.validator.validate_url_format",
"pysnmp.hlapi.CommunityData",
"pysnmp.hlapi.UdpTransportTarget",
"os.path.isfile",
"agent.modules.http.Session",
"urllib.parse.urlparse",
"agent.modules.validator.file_exists",
"pysnmp.entity.engine.SnmpEngine",
"requests.Sessio... | [((804, 837), 'inject.attr', 'inject.attr', (['IConnectionValidator'], {}), '(IConnectionValidator)\n', (815, 837), False, 'import inject\n'), ((1267, 1319), 'jsonschema.validate', 'jsonschema.validate', (['self.source.config', 'json_schema'], {}), '(self.source.config, json_schema)\n', (1286, 1319), False, 'import jso... |
from argparse import ArgumentParser
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import pytorch_lightning as pl
from project.datamodules.nmnist import NMNISTDataModule
from project.lenet5_module import Lenet5Module
def main():
# seeds the random from n... | [
"pytorch_lightning.callbacks.ModelCheckpoint",
"pytorch_lightning.seed_everything",
"argparse.ArgumentParser",
"pytorch_lightning.Trainer.add_argparse_args",
"project.lenet5_module.Lenet5Module.add_model_specific_args",
"project.lenet5_module.Lenet5Module",
"project.datamodules.nmnist.NMNISTDataModule",... | [((364, 388), 'pytorch_lightning.seed_everything', 'pl.seed_everything', (['(1234)'], {}), '(1234)\n', (382, 388), True, 'import pytorch_lightning as pl\n'), ((1672, 1697), 'project.lenet5_module.Lenet5Module', 'Lenet5Module', ([], {}), '(**dict_args)\n', (1684, 1697), False, 'from project.lenet5_module import Lenet5Mo... |
#!/usr/bin/env python3
#
# Copyright 2022 Graviti. Licensed under MIT License.
#
"""Graviti file related class."""
from typing import Union
from _io import BufferedReader
from graviti.utility.common import shorten
from graviti.utility.repr import ReprMixin
from graviti.utility.requests import UserResponse, config, ... | [
"graviti.utility.common.shorten",
"graviti.utility.requests.get_session"
] | [((845, 858), 'graviti.utility.requests.get_session', 'get_session', ([], {}), '()\n', (856, 858), False, 'from graviti.utility.requests import UserResponse, config, get_session\n'), ((758, 781), 'graviti.utility.common.shorten', 'shorten', (['self._checksum'], {}), '(self._checksum)\n', (765, 781), False, 'from gravit... |
#!/usr/bin/env python3
import sys
if '-h' in sys.argv:
print('''
usage:
HMMER.tbl.parser.py < input.tbl > output.tbl
keeps best hit, within e-value threshold. Default 1e-5
''', file=sys.stderr)
sys.exit()
def update_dct(line, dct={}, key_field=1, value_field=3, evalue_field=5, score_field=6, evalue_cuto... | [
"sys.exit"
] | [((209, 219), 'sys.exit', 'sys.exit', ([], {}), '()\n', (217, 219), False, 'import sys\n')] |
from flask import redirect, render_template, request, url_for
from flask.views import View
from flask_login import login_user, logout_user
from laserpony import app
from laserpony.views.scaffold import BaseView
from laserpony.models.post import Post
from laserpony.models.user import User
#Views
class IndexView(BaseVie... | [
"flask_login.login_user",
"flask_login.logout_user",
"flask.url_for",
"laserpony.models.user.User.create_user",
"flask.render_template",
"laserpony.models.post.Post.objects.order_by",
"laserpony.models.user.User.objects"
] | [((485, 543), 'flask.render_template', 'render_template', (['"""index.html"""'], {'posts': 'posts'}), "('index.html', posts=posts, **self.context)\n", (500, 543), False, 'from flask import redirect, render_template, request, url_for\n'), ((1447, 1460), 'flask_login.logout_user', 'logout_user', ([], {}), '()\n', (1458, ... |
#!/usr/bin/env python
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name = "Polynomial", # Replace with your own username
version = "0.1.0",
author = "<NAME>",
author_email = "<EMAIL>",
description = "This repository includes code to solv... | [
"setuptools.setup"
] | [((112, 644), 'setuptools.setup', 'setuptools.setup', ([], {'name': '"""Polynomial"""', 'version': '"""0.1.0"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""This repository includes code to solve and graph large numbers of polynomial roots."""', 'long_description': 'long_description',... |
from django.utils.datastructures import MultiValueDictKeyError
from couchforms.const import MAGIC_PROPERTY
import logging
from datetime import datetime
from django.conf import settings
from couchforms.exceptions import (
EmptyPayload,
MultipartEmptyPayload,
MultipartFilenameError,
InvalidSubmissionFile... | [
"datetime.datetime.strftime",
"logging.error",
"couchforms.exceptions.MultipartEmptyPayload",
"datetime.datetime.strptime",
"dimagi.utils.web.get_site_domain",
"dimagi.utils.parsing.string_to_utc_datetime",
"couchforms.exceptions.MultipartFilenameError",
"couchforms.exceptions.EmptyPayload",
"couchf... | [((3516, 3531), 'dimagi.utils.web.get_ip', 'get_ip', (['request'], {}), '(request)\n', (3522, 3531), False, 'from dimagi.utils.web import get_ip, get_site_domain\n'), ((2729, 2764), 'dimagi.utils.parsing.string_to_utc_datetime', 'string_to_utc_datetime', (['received_on'], {}), '(received_on)\n', (2751, 2764), False, 'f... |
"""
Short docstring description of dataset.
"""
import os
import logging
import deepchem
from deepchem.feat import Featurizer
from deepchem.trans import Transformer
from deepchem.splits.splitters import Splitter
from deepchem.molnet.defaults import get_defaults
from typing import List, Tuple, Dict, Optional
logger = ... | [
"deepchem.molnet.defaults.get_defaults",
"deepchem.data.DataLoader",
"os.path.exists",
"deepchem.utils.data_utils.load_dataset_from_disk",
"deepchem.utils.data_utils.get_data_dir",
"deepchem.data.CSVLoader",
"deepchem.utils.data_utils.save_dataset_to_disk",
"os.path.join",
"logging.getLogger",
"de... | [((320, 347), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (337, 347), False, 'import logging\n'), ((363, 403), 'deepchem.utils.data_utils.get_data_dir', 'deepchem.utils.data_utils.get_data_dir', ([], {}), '()\n', (401, 403), False, 'import deepchem\n'), ((705, 725), 'deepchem.molnet.de... |
# Copyright 2020 IBM 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 agreed to in writing, ... | [
"kubesat.base_service.BaseService"
] | [((1063, 1136), 'kubesat.base_service.BaseService', 'BaseService', (['SERVICE_TYPE', 'SharedStorageSchemas.STORAGE', '"""./service.json"""'], {}), "(SERVICE_TYPE, SharedStorageSchemas.STORAGE, './service.json')\n", (1074, 1136), False, 'from kubesat.base_service import BaseService\n')] |
"""This module contains some auxiliary functions shared across the utility scripts."""
import argparse
import difflib
import glob
import os
NOTEBOOKS_ROOT = os.environ["PROJECT_ROOT"] + "/notebooks"
def parse_arguments(description):
"""This function parses the arguments for the scripts."""
parser = argparse.... | [
"os.getcwd",
"argparse.ArgumentParser",
"os.chdir",
"glob.glob"
] | [((311, 359), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'description'}), '(description=description)\n', (334, 359), False, 'import argparse\n'), ((975, 986), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (984, 986), False, 'import os\n'), ((992, 1016), 'os.chdir', 'os.chdir', (['NOTEBOOKS... |
from flask import render_template, Flask, request, url_for, redirect, Response
from application import app, db
import requests
import random
from flask_sqlalchemy import SQLAlchemy
from application.models import Weapon
@app.route('/', methods=['GET', 'POST'])
def weapon():
rand = random.randint(1,6)
getWeapo... | [
"application.app.route",
"random.randint",
"application.models.Weapon.query.filter_by"
] | [((223, 262), 'application.app.route', 'app.route', (['"""/"""'], {'methods': "['GET', 'POST']"}), "('/', methods=['GET', 'POST'])\n", (232, 262), False, 'from application import app, db\n'), ((288, 308), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (302, 308), False, 'import random\n'), ((324,... |
import pickle
import numpy as np
import pandas as pd
from sklearn.exceptions import ConvergenceWarning
from sklearn.mixture import BayesianGaussianMixture
from sklearn.preprocessing import OneHotEncoder
from sklearn.utils.testing import ignore_warnings
class DataTransformer(object):
"""Data Transformer.
Mod... | [
"pandas.DataFrame",
"pickle.dump",
"numpy.zeros_like",
"sklearn.utils.testing.ignore_warnings",
"numpy.argmax",
"sklearn.preprocessing.OneHotEncoder",
"numpy.clip",
"pickle.load",
"sklearn.mixture.BayesianGaussianMixture",
"numpy.arange",
"numpy.random.normal",
"numpy.column_stack",
"numpy.c... | [((736, 780), 'sklearn.utils.testing.ignore_warnings', 'ignore_warnings', ([], {'category': 'ConvergenceWarning'}), '(category=ConvergenceWarning)\n', (751, 780), False, 'from sklearn.utils.testing import ignore_warnings\n'), ((839, 981), 'sklearn.mixture.BayesianGaussianMixture', 'BayesianGaussianMixture', (['self.n_c... |
from numbers import Number
import numpy as np
import numpy.testing as npt
from quaternion import Quaternion
class DualQuaternion(object):
""" Clifford dual quaternion denoted as dq = q_rot + epsilon * q_dual.
Can be instantiated by:
>>> dq = DualQuaternion(q_rot, q_dual)
>>> dq = DualQuaternion.from_vector... | [
"quaternion.Quaternion.from_rotation_matrix",
"quaternion.Quaternion",
"numpy.power",
"numpy.allclose",
"numpy.zeros",
"numpy.identity",
"numpy.mod",
"numpy.arccos",
"numpy.sin",
"numpy.array",
"numpy.dot",
"numpy.float64",
"numpy.str"
] | [((659, 709), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0]'], {}), '([0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0])\n', (667, 709), True, 'import numpy as np\n'), ((4758, 4784), 'quaternion.Quaternion', 'Quaternion', (['rx', 'ry', 'rz', 'rw'], {}), '(rx, ry, rz, rw)\n', (4768, 4784), False, 'from q... |
import inspect
from collections import OrderedDict
from django.db import models
from rest_framework.serializers import ValidationError
from landscapesim.common import config
from landscapesim.common.types import default_num_to_empty_or_int, bool_to_empty_or_yes
from landscapesim.serializers import scenarios as serial... | [
"collections.OrderedDict",
"landscapesim.common.types.default_num_to_empty_or_int",
"landscapesim.common.types.bool_to_empty_or_yes",
"rest_framework.serializers.ValidationError"
] | [((1094, 1107), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1105, 1107), False, 'from collections import OrderedDict\n'), ((3464, 3518), 'rest_framework.serializers.ValidationError', 'ValidationError', (['"""Error deserializing drf_serializer."""'], {}), "('Error deserializing drf_serializer.')\n", (34... |
from flask_wtf import Form
from wtforms import StringField, TextAreaField, SubmitField, TextField, validators, ValidationError
class ContactForm(Form):
#Di seguito viene indicato come è costruito il form che poi verra richiamato nel nostro HTML.
name = TextField("Nome", [validators.Required("Inserire il nome.")])
... | [
"wtforms.SubmitField",
"wtforms.validators.Email",
"wtforms.validators.Required"
] | [((573, 593), 'wtforms.SubmitField', 'SubmitField', (['"""Invia"""'], {}), "('Invia')\n", (584, 593), False, 'from wtforms import StringField, TextAreaField, SubmitField, TextField, validators, ValidationError\n'), ((275, 315), 'wtforms.validators.Required', 'validators.Required', (['"""Inserire il nome."""'], {}), "('... |
"""Test cases for Vorze scripts."""
import io
from pathlib import Path
from typing import List
from typing import Type
import pytest
from a10sa_script.command.vorze import VorzeLinearCommand
from a10sa_script.command.vorze import VorzeRotateCommand
from a10sa_script.command.vorze import VorzeVibrateCommand
from a10sa... | [
"a10sa_script.command.vorze.VorzeLinearCommand",
"io.BytesIO",
"a10sa_script.command.vorze.VorzeRotateCommand",
"pytest.raises",
"pytest.mark.parametrize",
"a10sa_script.command.vorze.VorzeVibrateCommand"
] | [((1968, 2183), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""script_cls, csv, commands"""', '[(VorzeVibrateScript, VIBRATE_CSV, VIBRATE_COMMANDS), (VorzeLinearScript,\n LINEAR_CSV, LINEAR_COMMANDS), (VorzeRotateScript, ROTATE_CSV,\n ROTATE_COMMANDS)]'], {}), "('script_cls, csv, commands', [(VorzeVi... |
"""
Primary module for Alien Invaders
This module contains the main controller class for the Alien Invaders
application. There is no need for any additional classes in this module.
If you need more classes, 99% of the time they belong in either the wave module
or the models module. If you are unsure about where a new ... | [
"sys.exit"
] | [((12716, 12726), 'sys.exit', 'sys.exit', ([], {}), '()\n', (12724, 12726), False, 'import sys\n'), ((13557, 13567), 'sys.exit', 'sys.exit', ([], {}), '()\n', (13565, 13567), False, 'import sys\n'), ((14698, 14708), 'sys.exit', 'sys.exit', ([], {}), '()\n', (14706, 14708), False, 'import sys\n'), ((16768, 16778), 'sys.... |
#! /usr/local/bin/python3
class BubbleSort:
def sort(self, original_list):
arr = original_list.copy()
if len(arr) <= 1:
return arr
for i in range(len(arr) - 1):
for j in range(len(arr) - 1 - i):
if arr[j] > arr[j + 1]:
arr[j], a... | [
"time.process_time"
] | [((429, 448), 'time.process_time', 'time.process_time', ([], {}), '()\n', (446, 448), False, 'import time\n'), ((544, 563), 'time.process_time', 'time.process_time', ([], {}), '()\n', (561, 563), False, 'import time\n')] |
import os
import _aes
import qwq5
import random
p='./example/1.jpg'
q='./example/2.data'
_aes.encrypt(b'1234567890123456',p,q)
_aes.decrypt(b'1234567890123456',q,'./example/2.jpg')
n=8
m=4
key=os.urandom(32)
info=b'qwq'
uinfo=[os.urandom(n) for i in range(n)]
pth_l='./example/random.'
pth_r='.key'
pr... | [
"random.randint",
"random.shuffle",
"qwq5.qwq5AESencrypt",
"qwq5.qwq5encode",
"qwq5.qwq5AESdecrypt",
"qwq5.qwq5decode",
"_aes.encrypt",
"_aes.decrypt",
"os.urandom"
] | [((97, 136), '_aes.encrypt', '_aes.encrypt', (["b'1234567890123456'", 'p', 'q'], {}), "(b'1234567890123456', p, q)\n", (109, 136), False, 'import _aes\n'), ((136, 191), '_aes.decrypt', '_aes.decrypt', (["b'1234567890123456'", 'q', '"""./example/2.jpg"""'], {}), "(b'1234567890123456', q, './example/2.jpg')\n", (148, 191... |
"""
frequencies.py
Psi4 frequencies visualization tool
"""
import numpy as np
import psi4
import blobs
import plotly.graph_objects as go
import plotly.express as px
class Freq():
def __init__(self, wfn):
self.wfn = wfn
self.mol = wfn.molecule()
self.geo = self.mol.to_arrays()[0]
... | [
"blobs.get_colors",
"plotly.graph_objects.Frame",
"plotly.graph_objects.Scatter3d",
"numpy.linalg.norm",
"numpy.array",
"numpy.sqrt"
] | [((11789, 11813), 'numpy.linalg.norm', 'np.linalg.norm', (['dist_vec'], {}), '(dist_vec)\n', (11803, 11813), True, 'import numpy as np\n'), ((12071, 12091), 'numpy.sqrt', 'np.sqrt', (['squared_sum'], {}), '(squared_sum)\n', (12078, 12091), True, 'import numpy as np\n'), ((656, 674), 'blobs.get_colors', 'blobs.get_color... |
from django.db import models
from Common.models import BaseModel
class Tag(BaseModel):
name = models.CharField('name', max_length=100)
class Meta:
verbose_name = 'Tag'
verbose_name_plural = 'Tags'
def __str__(self):
return self.name
| [
"django.db.models.CharField"
] | [((101, 141), 'django.db.models.CharField', 'models.CharField', (['"""name"""'], {'max_length': '(100)'}), "('name', max_length=100)\n", (117, 141), False, 'from django.db import models\n')] |
# -*- coding: utf-8 -*-
"""
Notes:
when profiling ensure CUDA_LAUNCH_BLOCKING=1
Notes:
to use, your training session must have the concept of:
* epochs
* batch_size
* xpu
* train / validation datasets
or better yet:
* a model
* a criterion
* an optim... | [
"sys.stdout.write",
"sys.platform.startswith",
"torch.cuda.synchronize",
"ubelt.map_vals",
"ubelt.timestamp",
"ubelt.oset",
"netharn.exceptions.CannotResume",
"time.strftime",
"logging.Formatter",
"numpy.isclose",
"xdoctest.doctest_module",
"netharn.util.CumMovingAve",
"os.path.join",
"cv2... | [((56261, 56294), 'xdoctest.doctest_module', 'xdoctest.doctest_module', (['__file__'], {}), '(__file__)\n', (56284, 56294), False, 'import xdoctest\n'), ((13247, 13284), 'netharn.util.number_of_parameters', 'util.number_of_parameters', (['harn.model'], {}), '(harn.model)\n', (13272, 13284), False, 'from netharn import ... |
# Copyright (c) 2016 <NAME> <<EMAIL>>
#
# This module is free software. You can redistribute it and/or modify it under
# the terms of the MIT License, see the file COPYING included with this
# distribution.
""" Module for motif activity prediction """
def warn(*args, **kwargs):
pass
import warnings
warnings.wa... | [
"sklearn.preprocessing.StandardScaler",
"sklearn.preprocessing.scale",
"xgboost.XGBRegressor",
"pandas.read_table",
"gimmemotifs.scanner.scan_regionfile_to_table",
"gimmemotifs.config.MotifConfig",
"pandas.DataFrame",
"sklearn.linear_model.MultiTaskLassoCV",
"scipy.stats.mannwhitneyu",
"os.path.ex... | [((330, 418), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'message': '"""sklearn.externals.joblib is deprecated"""'}), "('ignore', message=\n 'sklearn.externals.joblib is deprecated')\n", (353, 418), False, 'import warnings\n'), ((1364, 1426), 'warnings.filterwarnings', 'warnings.filter... |
#!/usr/bin/env python
# Copyright (C) 2021 Swift Navigation Inc.
# Contact: Swift Navigation <<EMAIL>>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WAR... | [
"argparse.ArgumentParser",
"sys.exit"
] | [((1056, 1185), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Log sum of the maximal used stack for all active threads reported by Stackusage."""'}), "(description=\n 'Log sum of the maximal used stack for all active threads reported by Stackusage.'\n )\n", (1079, 1185), False, 'i... |
#!/usr/bin/env python
import csv
import datetime
import numpy as np
import os
import re
# ros
import rospy
import shutil
# Python
import sys
# Plotting
from matplotlib import pyplot as plt
from std_srvs.srv import Empty
class EvalPlotting:
"""
This is the main evaluation node. It expects the data folders and... | [
"rospy.logerr",
"numpy.sum",
"csv.reader",
"matplotlib.pyplot.suptitle",
"matplotlib.pyplot.subplot2grid",
"rospy.ServiceProxy",
"numpy.ones",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy.mean",
"os.path.isfile",
"matplotlib.pyplot.tight_layout",
"os.path.join",
"rospy.logwarn",
"nu... | [((30983, 31036), 'rospy.init_node', 'rospy.init_node', (['"""eval_plotting_node"""'], {'anonymous': '(True)'}), "('eval_plotting_node', anonymous=True)\n", (30998, 31036), False, 'import rospy\n'), ((605, 641), 'rospy.get_param', 'rospy.get_param', (['"""~target_directory"""'], {}), "('~target_directory')\n", (620, 64... |
# Copyright 2019 <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, softw... | [
"django.db.models.FileField",
"django.db.models.URLField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.Q",
"django.db.models.SlugField",
"django.db.models.BooleanField",
"django.db.models.IntegerField",
"django.db.models.DateField"
] | [((712, 743), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(55)'}), '(max_length=55)\n', (728, 743), False, 'from django.db import models\n'), ((763, 794), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(12)'}), '(max_length=12)\n', (779, 794), False, 'from django.db im... |
#-*- coding:utf-8 -*-
u"""
Created on 21/01/14
by fccoelho
license: GPL V3 or Later
"""
__docformat__ = 'restructuredtext en'
from estrategias.jogadores import Jogador
import random
class MeuJogador(Jogador):
"""
Caca com probabilidade `p_caca`
"""
def __init__(self, p_caca=0.8):
assert p_ca... | [
"random.random"
] | [((537, 552), 'random.random', 'random.random', ([], {}), '()\n', (550, 552), False, 'import random\n')] |
#!/usr/bin/env python3
import subprocess
import os
import tempfile
import shutil
import codecs
import sys
import time
import json
def makeDirs(path) :
os.makedirs(path, exist_ok = True)
def writeFile(fileName, content) :
file = codecs.open(fileName, "w", "utf-8")
file.write(str(content))
file.close()
def execu... | [
"subprocess.Popen",
"codecs.open",
"os.makedirs",
"json.loads",
"os.path.exists",
"time.sleep",
"time.time",
"tempfile.mkdtemp",
"shutil.rmtree",
"os.path.join",
"os.getenv",
"sys.exit"
] | [((155, 187), 'os.makedirs', 'os.makedirs', (['path'], {'exist_ok': '(True)'}), '(path, exist_ok=True)\n', (166, 187), False, 'import os\n'), ((234, 269), 'codecs.open', 'codecs.open', (['fileName', '"""w"""', '"""utf-8"""'], {}), "(fileName, 'w', 'utf-8')\n", (245, 269), False, 'import codecs\n'), ((350, 472), 'subpro... |
"""SDLRPCV2 XML parser unit test."""
import os
import unittest
import generator.Model
import generator.parsers.SDLRPCV2
class TestSDLRPCV2Parser(unittest.TestCase):
"""Test for SDLRPCV2 xml parser."""
class _Issue:
def __init__(self, creator, value):
self.creator = creator
s... | [
"unittest.main",
"os.path.realpath"
] | [((17459, 17474), 'unittest.main', 'unittest.main', ([], {}), '()\n', (17472, 17474), False, 'import unittest\n'), ((554, 580), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (570, 580), False, 'import os\n')] |
from data.blender import Blender
from data.opendr import OpenDR
data1 = Blender('/home/ubuntu/anthro-efs/anthro-backup-virginia/data/HMR_baby/datasets/singleview_blender_100k_visibility', remap_labels=False)
print(len(data1))
print(data1[0][0])
print(data1[0][1])
data2 = OpenDR('/home/ubuntu/anthro-efs/anthro-backup-... | [
"data.opendr.OpenDR",
"data.blender.Blender"
] | [((73, 218), 'data.blender.Blender', 'Blender', (['"""/home/ubuntu/anthro-efs/anthro-backup-virginia/data/HMR_baby/datasets/singleview_blender_100k_visibility"""'], {'remap_labels': '(False)'}), "(\n '/home/ubuntu/anthro-efs/anthro-backup-virginia/data/HMR_baby/datasets/singleview_blender_100k_visibility'\n , rem... |
import itertools
from collections import defaultdict
lines = open("input").read().strip().splitlines()
print("--- Day21 ---")
def parse(lines):
INGs = defaultdict(int)
foods = []
for line in lines:
ingr, alergens = line.split("(contains ")
ingr = ingr.split()
alergens = alergens... | [
"collections.defaultdict"
] | [((159, 175), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (170, 175), False, 'from collections import defaultdict\n')] |
import sys
import argparse
import pyperclip
from diceware_module import diceware_class
def main():
password_generator = diceware_class()
pyperclip.copy(password_generator.create_password())
print(password_generator.create_password())
if __name__ == '__main__':
main()
| [
"diceware_module.diceware_class"
] | [((125, 141), 'diceware_module.diceware_class', 'diceware_class', ([], {}), '()\n', (139, 141), False, 'from diceware_module import diceware_class\n')] |
import os
from azure.ai.textanalytics import TextAnalyticsClient
from azure.core.credentials import AzureKeyCredential
'''
Microsoft Azure Cognitive Services Text Analytics - Get sentiment
Install the Text Analytics SDK from a command prompt or IDE terminal:
python -m pip install --upgrade azure.ai.textanalytics
'''... | [
"azure.core.credentials.AzureKeyCredential",
"azure.ai.textanalytics.TextAnalyticsClient"
] | [((511, 547), 'azure.core.credentials.AzureKeyCredential', 'AzureKeyCredential', (['subscription_key'], {}), '(subscription_key)\n', (529, 547), False, 'from azure.core.credentials import AzureKeyCredential\n'), ((573, 634), 'azure.ai.textanalytics.TextAnalyticsClient', 'TextAnalyticsClient', ([], {'endpoint': 'endpoin... |
import math
from maya import cmds
from maya.api import OpenMaya
class Mesh(object):
def __init__(self):
active_sel = OpenMaya.MGlobal.getActiveSelectionList()
self.mesh_count = active_sel.length()
if self.mesh_count == 0:
raise RuntimeError("Nothing Selected!")
sel... | [
"math.sqrt",
"maya.api.OpenMaya.MGlobal.getActiveSelectionList",
"maya.api.OpenMaya.MItMeshPolygon"
] | [((133, 174), 'maya.api.OpenMaya.MGlobal.getActiveSelectionList', 'OpenMaya.MGlobal.getActiveSelectionList', ([], {}), '()\n', (172, 174), False, 'from maya.api import OpenMaya\n'), ((2656, 2695), 'maya.api.OpenMaya.MItMeshPolygon', 'OpenMaya.MItMeshPolygon', (['dag', 'component'], {}), '(dag, component)\n', (2679, 269... |
# -*- coding: utf-8 -*-
"""
Created on Thu May 3 18:18:36 2018
@author: malopez
"""
import numpy as np
class KickGenerator():
def __init__(self, n_particles, baseKickIntensity):
self.n_particles = n_particles
self.baseKickIntensity = baseKickIntensity
# Time of last kick
self.t_la... | [
"numpy.random.normal"
] | [((878, 928), 'numpy.random.normal', 'np.random.normal', (['(0)', 'self.kickIntensity', 'vel.shape'], {}), '(0, self.kickIntensity, vel.shape)\n', (894, 928), True, 'import numpy as np\n')] |
#
# (C) Copyright 2003-2010 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License Version
# 2.1 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOU... | [
"random.random",
"binascii.b2a_base64",
"logging.getLogger"
] | [((10137, 10189), 'logging.getLogger', 'logging.getLogger', (['"""pyxmpp.sasl.ClientAuthenticator"""'], {}), "('pyxmpp.sasl.ClientAuthenticator')\n", (10154, 10189), False, 'import logging\n'), ((12127, 12179), 'logging.getLogger', 'logging.getLogger', (['"""pyxmpp.sasl.ServerAuthenticator"""'], {}), "('pyxmpp.sasl.Ser... |
# Copyright 2019 <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, softw... | [
"PIL.Image.composite",
"pilgram.util.fill",
"numpy.tile",
"numpy.linspace",
"PIL.Image.fromarray",
"PIL.Image.linear_gradient"
] | [((2307, 2328), 'PIL.Image.fromarray', 'Image.fromarray', (['mask'], {}), '(mask)\n', (2322, 2328), False, 'from PIL import Image\n'), ((3188, 3205), 'pilgram.util.fill', 'fill', (['size', 'start'], {}), '(size, start)\n', (3192, 3205), False, 'from pilgram.util import fill, invert\n'), ((3219, 3234), 'pilgram.util.fil... |
import numpy as np
from src.ray import Ray
from src.util import vec_where
from src.vec3 import Vec3
from abc import ABC, abstractmethod
from dataclasses import dataclass
@dataclass
class HitRecord:
p: Vec3
t: np.array
normal: Vec3 = Vec3(data=(0., 0., 0.))
front_face: np.array = None
def set_fac... | [
"src.util.vec_where",
"src.vec3.Vec3"
] | [((248, 274), 'src.vec3.Vec3', 'Vec3', ([], {'data': '(0.0, 0.0, 0.0)'}), '(data=(0.0, 0.0, 0.0))\n', (252, 274), False, 'from src.vec3 import Vec3\n'), ((441, 506), 'src.util.vec_where', 'vec_where', (['self.front_face', 'outward_normal', '(outward_normal * -1.0)'], {}), '(self.front_face, outward_normal, outward_norm... |
"""
CEST Quantiphyse plugin
Author: <NAME> <<EMAIL>>
Copyright (c) 2016-2017 University of Oxford, <NAME>
"""
import os
from .widgets import FabberT1Widget, T10Widget
from .process import T10Process
from .tests import T10WidgetTest
QP_MANIFEST = {
"widgets" : [T10Widget, FabberT1Widget],
"widget-tests" : [T1... | [
"os.path.dirname"
] | [((388, 413), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (403, 413), False, 'import os\n')] |
from unittest import TestCase
import zeeguu.core
from sqlalchemy.orm.exc import NoResultFound
from zeeguu.core.model import Topic, LocalizedTopic, Article, Url
from zeeguu.core.test.model_test_mixin import ModelTestMixIn
from zeeguu.core.test.rules.article_rule import ArticleRule
from zeeguu.core.test.rules.language_... | [
"zeeguu.core.model.Url.find_or_create",
"zeeguu.core.test.rules.article_rule.ArticleRule",
"zeeguu.core.test.rules.user_rule.UserRule",
"zeeguu.core.model.Topic",
"zeeguu.core.model.LocalizedTopic"
] | [((1267, 1279), 'zeeguu.core.model.Topic', 'Topic', (['topic'], {}), '(topic)\n', (1272, 1279), False, 'from zeeguu.core.model import Topic, LocalizedTopic, Article, Url\n'), ((1306, 1366), 'zeeguu.core.model.LocalizedTopic', 'LocalizedTopic', (['topic', 'self.user.learned_language', 'localized'], {}), '(topic, self.us... |
from django.urls import path
from . import views
urlpatterns = [
path('create_user/', views.create_user, name='create_user'),
path('auth_student/', views.auth_student, name='auth_student'),
path('add_section/', views.add_section, name='add_section'),
path('leave_section/', views.leave_section, name='l... | [
"django.urls.path"
] | [((71, 130), 'django.urls.path', 'path', (['"""create_user/"""', 'views.create_user'], {'name': '"""create_user"""'}), "('create_user/', views.create_user, name='create_user')\n", (75, 130), False, 'from django.urls import path\n'), ((136, 198), 'django.urls.path', 'path', (['"""auth_student/"""', 'views.auth_student']... |
import logging
__version__ = '0.2.2'
class NullHandler(logging.Handler):
#For python versions <= 2.6; same as `logging.NullHandler` in 2.7.
def emit(self, record):
pass
logger = logging.getLogger('tmlib')
if len(logger.handlers) == 0: # To ensure reload() doesn't add another one
logger.addHandler... | [
"logging.getLogger"
] | [((197, 223), 'logging.getLogger', 'logging.getLogger', (['"""tmlib"""'], {}), "('tmlib')\n", (214, 223), False, 'import logging\n')] |
# -*- coding: utf-8 -*-
# !/usr/bin/env python
import os
import time
from bottle import route, run, static_file, request
from obstacleSearch import ObstacleSearcher
templateUrl = "img-template/template.png"
searcher = ObstacleSearcher(templateUrl)
localPath = '/Users/zhangjianchuang/develop/code/source/avoid-obstacl... | [
"obstacleSearch.ObstacleSearcher",
"bottle.static_file",
"bottle.run",
"bottle.route",
"bottle.request.files.get",
"os.listdir"
] | [((221, 250), 'obstacleSearch.ObstacleSearcher', 'ObstacleSearcher', (['templateUrl'], {}), '(templateUrl)\n', (237, 250), False, 'from obstacleSearch import ObstacleSearcher\n'), ((355, 379), 'bottle.route', 'route', (['"""/search/<image>"""'], {}), "('/search/<image>')\n", (360, 379), False, 'from bottle import route... |
# coding=utf-8
# ----------------
# author: weiyu
# create_time : 5/29/2021
# description :
# 请你判断一个 9x9 的数独是否有效。只需要 根据以下规则 ,验证已经填入的数字是否有效即可。
#
#
# 数字 1-9 在每一行只能出现一次。
# 数字 1-9 在每一列只能出现一次。
# 数字 1-9 在每一个以粗实线分隔的 3x3 宫内只能出现一次。(请参考示例图)
#
#
# 数独部分空格内已填入了数字,空白格用 '.' 表示。
#
# 注意:
#
#
# 一个有效的数独(部分已被填充)不一定是可解的。
# 只需要根据以... | [
"math.ceil"
] | [((2135, 2157), 'math.ceil', 'math.ceil', (['((i + 1) / 3)'], {}), '((i + 1) / 3)\n', (2144, 2157), False, 'import math\n'), ((2192, 2214), 'math.ceil', 'math.ceil', (['((j + 1) / 3)'], {}), '((j + 1) / 3)\n', (2201, 2214), False, 'import math\n')] |
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 27 21:21:21 2015
@author: cmarr
"""
# ad click prediction : a view from the trenches
# __author__ : <NAME>
# __credits__ : tinrtgu
from math import sqrt, exp, log
from csv import DictReader
import pandas as pd
import numpy as np
class ftrl(object):
def __init__(self, ... | [
"pandas.read_csv",
"math.log",
"math.sqrt"
] | [((2460, 2504), 'pandas.read_csv', 'pd.read_csv', (['"""../input/sampleSubmission.csv"""'], {}), "('../input/sampleSubmission.csv')\n", (2471, 2504), True, 'import pandas as pd\n'), ((2523, 2559), 'pandas.read_csv', 'pd.read_csv', (['"""temp.csv"""'], {'header': 'None'}), "('temp.csv', header=None)\n", (2534, 2559), Tr... |
import sys
from collections import Counter
def maximum_points(table, buttons_count):
"""
На клавише написана либо точка, либо цифра от 1 до 9.
В момент времени t игрок должен одновременно нажать на все клавиши,
на которых написана цифра t.
Игроки могут нажать в один момент времени на k клавиш кажд... | [
"sys.stdin.readline"
] | [((689, 709), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (707, 709), False, 'import sys\n')] |
from pda.channel import Channel
from slicedpy.appliance import Appliance
from slicedpy.disaggregator import DTDisaggregator
import matplotlib.pyplot as plt
import os.path as path
DATA_DIR = '/data/mine/domesticPowerData/BellendenRd/wattsUp'
######### WASHING MACHINE
wm_app = Appliance('wm')
wm1 = Channel()
wm1.load_... | [
"matplotlib.pyplot.show",
"os.path.join",
"slicedpy.appliance.Appliance",
"pda.channel.Channel",
"slicedpy.disaggregator.DTDisaggregator",
"matplotlib.pyplot.subplots"
] | [((278, 293), 'slicedpy.appliance.Appliance', 'Appliance', (['"""wm"""'], {}), "('wm')\n", (287, 293), False, 'from slicedpy.appliance import Appliance\n'), ((301, 310), 'pda.channel.Channel', 'Channel', ([], {}), '()\n', (308, 310), False, 'from pda.channel import Channel\n'), ((415, 424), 'pda.channel.Channel', 'Chan... |
# Generated by Django 2.2.5 on 2019-10-06 08:53
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('app', '0013_auto_2019100... | [
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.IntegerField"
] | [((227, 284), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (258, 284), False, 'from django.db import migrations, models\n'), ((459, 552), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
import bitstring
import numpy as np
from PIL import Image, ImageEnhance
from PIL import ImageOps, ImageMath
from matplotlib import pyplot as plt
import cv2
import struct
from PIL import Image
import torch
import torchvision
from sklearn import preprocessing
from sklearn.preprocessing import OneHotEncoder
from torch... | [
"torch.utils.data.sampler.SubsetRandomSampler",
"numpy.random.seed",
"numpy.random.shuffle",
"torch.utils.data.DataLoader",
"numpy.floor",
"numpy.zeros",
"sklearn.preprocessing.LabelEncoder",
"torch.Tensor",
"numpy.array",
"torchvision.transforms.Grayscale",
"numpy.chararray",
"torchvision.tra... | [((1106, 1149), 'PIL.Image.frombytes', 'Image.frombytes', (['"""1"""', '(64, 63)', 'r[3]', '"""raw"""'], {}), "('1', (64, 63), r[3], 'raw')\n", (1121, 1149), False, 'from PIL import Image\n'), ((1206, 1240), 'PIL.Image.eval', 'Image.eval', (['r[-1]', '(lambda x: not x)'], {}), '(r[-1], lambda x: not x)\n', (1216, 1240)... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from server.models import *
from django.db import migrations, models
def clean_model_names(apps, schema_editor):
"""
Non-macos devices will have been given an incorrrect friendly
name. Let's get those and clean up
"""
Machine = apps... | [
"django.db.migrations.RunPython"
] | [((709, 748), 'django.db.migrations.RunPython', 'migrations.RunPython', (['clean_model_names'], {}), '(clean_model_names)\n', (729, 748), False, 'from django.db import migrations, models\n')] |
# 封装celery任务函数
from celery_tasks.main import celery_app
from celery_tasks.sms.yuntongxun.sms import CCP
# 短信发送模板id
SEND_SMS_TEMP_ID = 1
# 获取日志器
import logging
logger = logging.getLogger('django')
@celery_app.task(name='send_sms_code')
def send_sms_code(mobile, sms_code, expires):
"""短信验证码发送的函数"""
try:
... | [
"celery_tasks.main.celery_app.task",
"celery_tasks.sms.yuntongxun.sms.CCP",
"logging.getLogger"
] | [((170, 197), 'logging.getLogger', 'logging.getLogger', (['"""django"""'], {}), "('django')\n", (187, 197), False, 'import logging\n'), ((201, 238), 'celery_tasks.main.celery_app.task', 'celery_app.task', ([], {'name': '"""send_sms_code"""'}), "(name='send_sms_code')\n", (216, 238), False, 'from celery_tasks.main impor... |
# Copyright 2021 VMware, Inc.
# SPDX-License-Identifier: BSD-2
import datetime
import json
import logging
import os
import resource
import sys
from typing import Dict
from typing import List
from typing import Union
def ms_to_datetime(milliseconds: int) -> datetime.datetime:
"""
Convert a given amount of mill... | [
"json.dump",
"os.getpid",
"logging.root.addHandler",
"logging.StreamHandler",
"datetime.datetime.utcfromtimestamp",
"datetime.datetime.fromtimestamp",
"resource.getrusage",
"logging.root.setLevel"
] | [((486, 538), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['(milliseconds / 1000)'], {}), '(milliseconds / 1000)\n', (517, 538), False, 'import datetime\n'), ((1343, 1405), 'json.dump', 'json.dump', (['obj', 'f'], {'indent': "(2 * ' ')", 'sort_keys': '(True)', 'default': 'str'}), "(obj, f, in... |
import typing
typing.NewType('Char4') | [
"typing.NewType"
] | [((15, 38), 'typing.NewType', 'typing.NewType', (['"""Char4"""'], {}), "('Char4')\n", (29, 38), False, 'import typing\n')] |
#!/usr/bin/python3
# -*- coding:utf-8 -*-
import yaml
import os
current_path = os.path.abspath(".")
yaml_path = os.path.join(current_path, "config.yaml")
def read_config():
with open(yaml_path,'r') as stream:
cfg =yaml.load(stream,Loader=yaml.FullLoader)
return cfg
cfg = read_config()
| [
"os.path.abspath",
"yaml.load",
"os.path.join"
] | [((81, 101), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (96, 101), False, 'import os\n'), ((114, 155), 'os.path.join', 'os.path.join', (['current_path', '"""config.yaml"""'], {}), "(current_path, 'config.yaml')\n", (126, 155), False, 'import os\n'), ((230, 271), 'yaml.load', 'yaml.load', (['str... |
"""
Author: <NAME>
Github: sanidhyamangal
"""
import os # for os related ops
import time # for time related ops
import matplotlib.pyplot as plt # for plotting
import PIL # for image related ops
import tensorflow as tf # for deep learning related steps
from IPython import display
from models import (
Wasserst... | [
"models.WasserstienDiscriminative",
"tensorflow.random.normal",
"tensorflow.train.Checkpoint",
"matplotlib.pyplot.imshow",
"tensorflow.reduce_mean",
"time.time",
"tensorflow.keras.datasets.cifar10.load_data",
"models.WasserstienGenerative",
"tensorflow.cast",
"tensorflow.keras.optimizers.Adam",
... | [((515, 552), 'tensorflow.keras.datasets.cifar10.load_data', 'tf.keras.datasets.cifar10.load_data', ([], {}), '()\n', (550, 552), True, 'import tensorflow as tf\n'), ((743, 766), 'models.WasserstienGenerative', 'WasserstienGenerative', ([], {}), '()\n', (764, 766), False, 'from models import WasserstienDiscriminative, ... |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | [
"os.path.abspath",
"argparse.ArgumentParser",
"pip._vendor.packaging.version.parse",
"os.environ.get",
"pathlib.Path",
"subprocess.check_call"
] | [((849, 870), 'os.path.abspath', 'os.path.abspath', (['name'], {}), '(name)\n', (864, 870), False, 'import os\n'), ((875, 964), 'subprocess.check_call', 'check_call', (["['python', 'setup.py', 'bdist_wheel', '-d', dest_folder]"], {'cwd': 'absdirpath'}), "(['python', 'setup.py', 'bdist_wheel', '-d', dest_folder], cwd=\n... |
'''
Spacecraft and planet trajectories in numpy incl. Bepi Colombo, PSP, Solar Orbiter
https://github.com/cmoestl/heliocats
Author: <NAME>, IWF Graz, Austria
twitter @chrisoutofspace, https://github.com/cmoestl
last update: January 2020
needs python 3.7 with the conda helio environment (see README.md)
uses heliopy f... | [
"matplotlib.pyplot.title",
"os.mkdir",
"matplotlib.pyplot.subplot2grid",
"numpy.rec.array",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.dates.date2num",
"matplotlib.pyplot.tick_params",
"multiprocessing.cpu_count",
"matplotlib.pyplot.close",
"heliopy.spice.Trajectory",
"matplotlib.... | [((2169, 2202), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (2192, 2202), False, 'import warnings\n'), ((2216, 2237), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (2230, 2237), False, 'import matplotlib\n'), ((2281, 2301), 'importlib.reload', 'i... |
from app import db
from flask.ext.security import Security, SQLAlchemyUserDatastore, UserMixin, RoleMixin, login_required
roles_users = db.Table('roles_users',
db.Column('user_id', db.Integer(), db.ForeignKey('user.id')),
db.Column('role_id', db.Integer(), db.ForeignKey('role.id')))
class Role(db.Model, RoleM... | [
"app.db.create_all",
"app.db.backref",
"app.db.Boolean",
"app.db.DateTime",
"app.db.Integer",
"app.db.Column",
"app.db.String",
"app.db.ForeignKey"
] | [((1149, 1164), 'app.db.create_all', 'db.create_all', ([], {}), '()\n', (1162, 1164), False, 'from app import db\n'), ((514, 553), 'app.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (523, 553), False, 'from app import db\n'), ((931, 952), 'app.db.Column', 'db.... |
from os import listdir, makedirs
from os.path import join, isdir
import imageio
import cv2
DATA_DIR = 'path/to/daisdataset'
N_MACHINES = 38
N_TRAIN_MACHINES = 32
PATTERNS = {
'0_0_0': 'no corrosion',
'1_0_0': 'soft corrosion',
'1_1_0': 'medium corossion',
'1_1_1': 'hard corossion',
'2_0_0': 'soft ... | [
"os.path.join",
"imageio.imread",
"imageio.imsave",
"os.listdir",
"cv2.resize"
] | [((528, 545), 'os.listdir', 'listdir', (['DATA_DIR'], {}), '(DATA_DIR)\n', (535, 545), False, 'from os import listdir, makedirs\n'), ((662, 688), 'os.path.join', 'join', (['DATA_DIR', 'inspection'], {}), '(DATA_DIR, inspection)\n', (666, 688), False, 'from os.path import join, isdir\n'), ((1999, 2016), 'os.listdir', 'l... |
from pymongo import MongoClient
import disease_label_table
import config
if __name__ == '__main__':
client = MongoClient(config.mongo_url)
db = client.girder
db.drop_collection('diseaseNames')
for label in disease_label_table.get_labels():
db['diseaseNames'].insert({'_id': label})
| [
"pymongo.MongoClient",
"disease_label_table.get_labels"
] | [((114, 143), 'pymongo.MongoClient', 'MongoClient', (['config.mongo_url'], {}), '(config.mongo_url)\n', (125, 143), False, 'from pymongo import MongoClient\n'), ((223, 255), 'disease_label_table.get_labels', 'disease_label_table.get_labels', ([], {}), '()\n', (253, 255), False, 'import disease_label_table\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""A module that implements the BasicOptimizer class, a base class for
optimizers.
"""
from abc import abstractmethod, ABCMeta
import numpy
import theano
import theano.tensor as tensor
from theanolm.backend import IncompatibleStateError
from theanolm.backend import test... | [
"theano.tensor.clip",
"theano.tensor.eq",
"numpy.int8",
"theano.tensor.cast",
"theanolm.backend.IncompatibleStateError",
"numpy.dtype",
"theanolm.backend.test_value",
"theano.tensor.gt",
"numpy.int64",
"theano.tensor.scalar",
"theano.tensor.matrix"
] | [((3486, 3542), 'theano.tensor.matrix', 'tensor.matrix', (['"""optimizer/batch_word_ids"""'], {'dtype': '"""int64"""'}), "('optimizer/batch_word_ids', dtype='int64')\n", (3499, 3542), True, 'import theano.tensor as tensor\n'), ((3740, 3797), 'theano.tensor.matrix', 'tensor.matrix', (['"""optimizer/batch_class_ids"""'],... |
# -*- coding: utf-8 -*-
"""
@author:XuMing(<EMAIL>)
@description:
"""
import json
import os
import pickle
def load_pkl(pkl_path):
"""
加载词典文件
:param pkl_path:
:return:
"""
with open(pkl_path, 'rb') as f:
result = pickle.load(f)
return result
def save_pkl(vocab, pkl_path, overwrit... | [
"os.path.abspath",
"pickle.dump",
"json.load",
"os.makedirs",
"os.path.exists",
"json.dumps",
"pickle.load"
] | [((247, 261), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (258, 261), False, 'import pickle\n'), ((417, 441), 'os.path.exists', 'os.path.exists', (['pkl_path'], {}), '(pkl_path)\n', (431, 441), False, 'import os\n'), ((586, 619), 'pickle.dump', 'pickle.dump', (['vocab', 'f'], {'protocol': '(0)'}), '(vocab, f, p... |
# -*- coding: utf-8 -*-
# copyright:
# <NAME> <holger [AT] holgis [DOT] net>
# <NAME> <ps_ml [AT] gmx [DOT] de>
# <NAME> <ralf.habacker [AT] freenet [DOT] de>
# Copyright <NAME> <<EMAIL>>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following con... | [
"CraftOS.osutils.OsUtils.isWin",
"os.mkdir",
"CraftCore.CraftCore.log.debug",
"os.remove",
"CraftCore.CraftCore.cache.findApplication",
"pathlib.Path",
"os.path.isfile",
"os.path.islink",
"CraftCore.CraftCore.standardDirs.craftBin",
"os.link",
"CraftCore.CraftCore.debug.logEnv",
"sys.stderr.fi... | [((25044, 25066), 'CraftDebug.deprecated', 'deprecated', (['"""moveFile"""'], {}), "('moveFile')\n", (25054, 25066), False, 'from CraftDebug import deprecated\n'), ((2494, 2549), 'CraftCore.CraftCore.log.debug', 'CraftCore.log.debug', (['f"""unpacking this file: {filename}"""'], {}), "(f'unpacking this file: {filename}... |
import yaml
import numpy as np
import os
import sys
import itertools
from pprint import pprint
import copy
import importlib
from typing import Union, Any, List, Callable, Dict, Iterable
def load_yaml_config(
filename: str,
path: str,
walk: bool = False,
verbose: bool = True,
post_process: Callabl... | [
"numpy.stack",
"copy.deepcopy",
"numpy.set_printoptions",
"yaml.load",
"yaml.add_constructor",
"importlib.import_module",
"os.walk",
"numpy.shape",
"numpy.array",
"pprint.pprint",
"itertools.product",
"sys.exit",
"os.path.join",
"numpy.concatenate"
] | [((2528, 2566), 'os.path.join', 'os.path.join', (['path', "(filename + '.yaml')"], {}), "(path, filename + '.yaml')\n", (2540, 2566), False, 'import os\n'), ((3773, 3808), 'yaml.add_constructor', 'yaml.add_constructor', (['"""!join"""', 'join'], {}), "('!join', join)\n", (3793, 3808), False, 'import yaml\n'), ((3829, 3... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 7 12:00:10 2022
@author: sampasmann
"""
import h5py
import numpy as np
def SaveData(init_data, SI, fname = "default", path = "../saved_data/"):
if (fname == "default"):
fname = "{}-{}-{}-{}".format(init_data.material_code,
... | [
"h5py.File"
] | [((481, 509), 'h5py.File', 'h5py.File', (['(path + fname)', '"""w"""'], {}), "(path + fname, 'w')\n", (490, 509), False, 'import h5py\n')] |
"""Show how to add a custom raw data filter for the TraceView and Waveform View
Use Alt+R in the GUI to toggle the filter.
"""
from scipy.signal import butter, filtfilt
from phy import IPlugin
class RawDataFilterPlugin(IPlugin):
def attach_to_controller(self, controller):
b, a = butter(3, 150.0 / cont... | [
"scipy.signal.butter",
"scipy.signal.filtfilt"
] | [((298, 359), 'scipy.signal.butter', 'butter', (['(3)', '(150.0 / controller.model.sample_rate * 2.0)', '"""high"""'], {}), "(3, 150.0 / controller.model.sample_rate * 2.0, 'high')\n", (304, 359), False, 'from scipy.signal import butter, filtfilt\n'), ((463, 493), 'scipy.signal.filtfilt', 'filtfilt', (['b', 'a', 'arr']... |
#!/usr/bin/python2
import nltk
import os
import codecs
import argparse
import numpy as np
import sys
reload(sys)
sys.setdefaultencoding("ISO-8859-1")
import gensim # In case you have difficulties installing gensim, you need to consider installing conda.
model = gensim.models.KeyedVectors.load_word2vec_format('/home/... | [
"sys.setdefaultencoding",
"gensim.models.KeyedVectors.load_word2vec_format"
] | [((114, 150), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""ISO-8859-1"""'], {}), "('ISO-8859-1')\n", (136, 150), False, 'import sys\n'), ((265, 391), 'gensim.models.KeyedVectors.load_word2vec_format', 'gensim.models.KeyedVectors.load_word2vec_format', (['"""/home/karim/wordvectors/data/bangla_word2vec_mode... |
import numpy as np
import random
from sklearn import mixture
from sklearn import svm
def createSyntheticDataSet(nbClasses, nbInst, dictionnary, dictionnaryProbability):
varNorm = 0.1
listClass = []
for i in range(0, nbClasses):
arr = np.zeros((1, nbClasses))
arr[0][i] = 1
listClass.append(arr)
... | [
"random.uniform",
"numpy.zeros",
"numpy.append",
"random.randrange",
"numpy.random.normal"
] | [((341, 365), 'numpy.zeros', 'np.zeros', (['(0, nbClasses)'], {}), '((0, nbClasses))\n', (349, 365), True, 'import numpy as np\n'), ((388, 399), 'numpy.zeros', 'np.zeros', (['(0)'], {}), '(0)\n', (396, 399), True, 'import numpy as np\n'), ((748, 772), 'numpy.zeros', 'np.zeros', (['(0, nbClasses)'], {}), '((0, nbClasses... |
import numpy as np
def compose_soln(x, n, V):
A = np.zeros((n, n))
A[0, :] = V * np.ones(n)
A[-1, :] = -V * np.ones(n)
A[1 : -1, 1 : -1] = x.reshape((n - 2, n - 2))
return A | [
"numpy.zeros",
"numpy.ones"
] | [((55, 71), 'numpy.zeros', 'np.zeros', (['(n, n)'], {}), '((n, n))\n', (63, 71), True, 'import numpy as np\n'), ((90, 100), 'numpy.ones', 'np.ones', (['n'], {}), '(n)\n', (97, 100), True, 'import numpy as np\n'), ((121, 131), 'numpy.ones', 'np.ones', (['n'], {}), '(n)\n', (128, 131), True, 'import numpy as np\n')] |
from hooman import Hooman
import pygame
window_width, window_height = 500, 500
hapi = Hooman(window_width, window_height)
def handle_events(event):
if event.type == pygame.QUIT:
hapi.is_running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
hapi.is_runn... | [
"pygame.quit",
"pygame.time.Clock",
"hooman.Hooman"
] | [((88, 123), 'hooman.Hooman', 'Hooman', (['window_width', 'window_height'], {}), '(window_width, window_height)\n', (94, 123), False, 'from hooman import Hooman\n'), ((378, 397), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (395, 397), False, 'import pygame\n'), ((670, 683), 'pygame.quit', 'pygame.quit',... |
import inspect
import click
from zookeeper.core.cli import ConfigParam, cli
from zookeeper.core.component import component, configure
from zookeeper.core.utils import convert_to_snake_case
def task(cls):
"""
A decorator which turns a class into a Zookeeper task, which is a Zookeeper
method with an argum... | [
"zookeeper.core.utils.convert_to_snake_case",
"zookeeper.core.cli.cli.command",
"zookeeper.core.cli.ConfigParam",
"zookeeper.core.component.component",
"click.option",
"inspect.signature",
"zookeeper.core.component.configure"
] | [((615, 629), 'zookeeper.core.component.component', 'component', (['cls'], {}), '(cls)\n', (624, 629), False, 'from zookeeper.core.component import component, configure\n'), ((1238, 1273), 'zookeeper.core.utils.convert_to_snake_case', 'convert_to_snake_case', (['cls.__name__'], {}), '(cls.__name__)\n', (1259, 1273), Fa... |
""" Composite Provider for UTFGrid layers
https://github.com/mapbox/utfgrid-spec/blob/master/1.2/utfgrid.md
Combines multiple UTFGrid layers to create a single result.
The given layers will be added to the result in the order they are given.
Therefore the last one will have the highest priority.
Sample configuration:... | [
"TileStache.getTile",
"json.loads",
"json.dumps",
"TileStache.Core.KnownUnknown"
] | [((1931, 2008), 'TileStache.Core.KnownUnknown', 'KnownUnknown', (['(\'UtfGridComposite only makes .json tiles, not "%s"\' % extension)'], {}), '(\'UtfGridComposite only makes .json tiles, not "%s"\' % extension)\n', (1943, 2008), False, 'from TileStache.Core import KnownUnknown\n'), ((2101, 2177), 'TileStache.getTile',... |
import os
import logging
import sqlite3
logger = logging.getLogger('root')
class DataBase:
def __init__(self, ls_db_init_str=[], dir_db =''):
'''Initilizes DataBase object with attributes:
Args:
ls_db_init_str (List): List of init strings (Optional)
dir_db (str): Directory t... | [
"os.path.join",
"logging.getLogger"
] | [((49, 74), 'logging.getLogger', 'logging.getLogger', (['"""root"""'], {}), "('root')\n", (66, 74), False, 'import logging\n'), ((482, 511), 'os.path.join', 'os.path.join', (['dir_db', '"""db.db"""'], {}), "(dir_db, 'db.db')\n", (494, 511), False, 'import os\n')] |
#Pour des informations plus détaillées, aller voir sur https://www.tensorflow.org/
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras import layers
class make_dataset:
'''
Définition des paramètres des datasets. Pour créer un dataset :
make_dataset(directory, batc... | [
"tensorflow.keras.preprocessing.image_dataset_from_directory",
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.Input",
"tensorflow.ke... | [((870, 1113), 'tensorflow.keras.preprocessing.image_dataset_from_directory', 'tf.keras.preprocessing.image_dataset_from_directory', (['self.directory'], {'labels': '"""inferred"""', 'label_mode': '"""int"""', 'validation_split': '(0.2)', 'subset': '"""training"""', 'seed': '(123)', 'image_size': '(self.img_height, sel... |
import numpy as np
import sqlite3
import pandas as pd
import warnings
import copy
warnings.filterwarnings('error')
def fuzzyVIKOR_fuzzydm(num_val_sublv2,ave_dmqualitative_list,c_optimise_setdata_list):
strategy_coefficient=0.5
con=sqlite3.connect("materialdatabase.db")
if num_val_subl... | [
"numpy.sum",
"numpy.copy",
"warnings.filterwarnings",
"numpy.zeros",
"numpy.argsort",
"numpy.max",
"numpy.min",
"sqlite3.connect",
"numpy.reshape",
"pandas.read_sql"
] | [((90, 122), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""error"""'], {}), "('error')\n", (113, 122), False, 'import warnings\n'), ((258, 296), 'sqlite3.connect', 'sqlite3.connect', (['"""materialdatabase.db"""'], {}), "('materialdatabase.db')\n", (273, 296), False, 'import sqlite3\n'), ((342, 454), 'pan... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Implement configuration class."""
import json
import os
class Config:
"""Configuration class."""
def __init__(self, path: str):
self.main_window_geometry: str = '1024x600'
self.main_window_zoomed: bool = False
self.theme_fontfamily: ... | [
"os.path.dirname",
"os.path.exists",
"json.loads",
"json.dumps"
] | [((780, 808), 'json.dumps', 'json.dumps', (['values'], {'indent': '(2)'}), '(values, indent=2)\n', (790, 808), False, 'import json\n'), ((1243, 1265), 'json.loads', 'json.loads', (['values_str'], {}), '(values_str)\n', (1253, 1265), False, 'import json\n'), ((824, 850), 'os.path.exists', 'os.path.exists', (['self._path... |
from __future__ import annotations
from enum import Enum, auto
from typing import Generic, NamedTuple, TypeVar, cast, overload
import torch
from torch import Tensor
import torch.distributions as td
import torch.nn.functional as F
from ranzen.misc import str_to_enum
from ranzen.torch.sampling import batched_randint
_... | [
"torch.distributions.Bernoulli",
"ranzen.torch.sampling.batched_randint",
"torch.randint",
"torch.distributions.Beta",
"torch.any",
"torch.nn.functional.one_hot",
"ranzen.misc.str_to_enum",
"torch.distributions.Uniform",
"torch.arange",
"torch.Size",
"torch.rand",
"enum.auto",
"typing.TypeVa... | [((613, 661), 'typing.TypeVar', 'TypeVar', (['"""LS"""', 'td.Beta', 'td.Bernoulli', 'td.Uniform'], {}), "('LS', td.Beta, td.Bernoulli, td.Uniform)\n", (620, 661), False, 'from typing import Generic, NamedTuple, TypeVar, cast, overload\n'), ((447, 453), 'enum.auto', 'auto', ([], {}), '()\n', (451, 453), False, 'from enu... |
from rest_framework import status
from rest_framework.response import Response
from rest_framework.generics import ListCreateAPIView
from rest_framework.permissions import AllowAny
from authors.apps.authentication.renderers import UserJSONRenderer
from authors.apps.social_auth.serializers import (FacebookAuthSerializer... | [
"rest_framework.response.Response"
] | [((882, 934), 'rest_framework.response.Response', 'Response', (['serializer.data'], {'status': 'status.HTTP_200_OK'}), '(serializer.data, status=status.HTTP_200_OK)\n', (890, 934), False, 'from rest_framework.response import Response\n'), ((1344, 1396), 'rest_framework.response.Response', 'Response', (['serializer.data... |
import os
import numpy
import matplotlib.pyplot as plt
from matplotlib.pyplot import MultipleLocator
# pylint: disable=redefined-outer-name
# pylint: disable=exec-used
def normalize_arr(normalize_lambda, arr):
return list(map(normalize_lambda, arr))
def fetch_log_files(directory):
log_files = []
files ... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.plot",
"numpy.std",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"numpy.mean",
"os.path.splitext",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
... | [((322, 343), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (332, 343), False, 'import os\n'), ((1882, 1913), 'numpy.std', 'numpy.std', (['res_func_arr'], {'ddof': '(1)'}), '(res_func_arr, ddof=1)\n', (1891, 1913), False, 'import numpy\n'), ((2635, 2662), 'matplotlib.pyplot.figure', 'plt.figure', ([... |
import pytest
import dotenv
import os
from blab.sentinel import Ftp
dotenv.load_dotenv(os.path.join(os.path.dirname(__file__), '../.env'))
o = Ftp()
def test_ftp_uid():
assert os.environ.get('ftp_uid') is not None, "FTP UID not found"
def test_ftp_pwd():
assert os.environ.get('ftp_pwd') is not None, "FTP PW... | [
"os.environ.get",
"blab.sentinel.Ftp",
"os.path.dirname"
] | [((143, 148), 'blab.sentinel.Ftp', 'Ftp', ([], {}), '()\n', (146, 148), False, 'from blab.sentinel import Ftp\n'), ((100, 125), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (115, 125), False, 'import os\n'), ((182, 207), 'os.environ.get', 'os.environ.get', (['"""ftp_uid"""'], {}), "('ftp_ui... |
import lib.collection as collection
from collections import OrderedDict
class iperf3m_chain_ns_tcp(collection.Collection):
constants = {
'iperf_name': 'iperf3m',
'protocol': 'tcp',
'packet_size': 'default',
'topology': 'ns_chain',
'disable_offloading': False,
'affin... | [
"collections.OrderedDict"
] | [((355, 539), 'collections.OrderedDict', 'OrderedDict', (["[('chain_len', (2, 3, 5, 10, 20)), ('parallelism', (1, 4, 6, 8, 12)), (\n 'zerocopy', (False, True)), ('use_ovs', (False, True)), ('ovs_ns_links',\n ('port', 'veth'))]"], {}), "([('chain_len', (2, 3, 5, 10, 20)), ('parallelism', (1, 4, 6, 8,\n 12)), ('... |
from flask import Flask
from app.mover import mover
from pkg.config import Config
from pkg.sftp import SFTPConfig
from util.service_logging import log
app = Flask(__name__)
def load_config(app: Flask) -> None:
sftp_config = SFTPConfig.from_env()
config = Config.from_env()
if sftp_config.survey_source_pa... | [
"pkg.config.Config.from_env",
"flask.Flask",
"util.service_logging.log.error",
"pkg.sftp.SFTPConfig.from_env",
"util.service_logging.log.info"
] | [((159, 174), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (164, 174), False, 'from flask import Flask\n'), ((571, 602), 'util.service_logging.log.info', 'log.info', (['"""Application started"""'], {}), "('Application started')\n", (579, 602), False, 'from util.service_logging import log\n'), ((232, 253)... |
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 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 app... | [
"mlt.commands.build.BuildCommand",
"test_utils.io.catch_stdout",
"mock.patch",
"pytest.raises",
"mock.MagicMock"
] | [((2942, 2980), 'mock.patch', 'patch', (['"""mlt.commands.build.time.sleep"""'], {}), "('mlt.commands.build.time.sleep')\n", (2947, 2980), False, 'from mock import patch, MagicMock\n'), ((2982, 3018), 'mock.patch', 'patch', (['"""mlt.commands.build.Observer"""'], {}), "('mlt.commands.build.Observer')\n", (2987, 3018), ... |
# Reference: https://github.com/pytorch/vision/blob/master/torchvision/models/densenet.py
from collections import OrderedDict
import math
import torch
import torch.nn as nn
from selective_convolution import SelectiveConv2d
from models import BRC
class _DenseLayer(nn.Module):
def __init__(self, n_channels, growt... | [
"models.BRC",
"torch.nn.ReLU",
"math.sqrt",
"torch.nn.MaxPool2d",
"torch.nn.Conv2d",
"torch.cat",
"selective_convolution.SelectiveConv2d",
"torch.nn.BatchNorm2d",
"torch.nn.Linear",
"collections.OrderedDict",
"torch.nn.AvgPool2d"
] | [((1144, 1165), 'torch.cat', 'torch.cat', (['[x, x_]', '(1)'], {}), '([x, x_], 1)\n', (1153, 1165), False, 'import torch\n'), ((2076, 2113), 'torch.nn.AvgPool2d', 'nn.AvgPool2d', ([], {'kernel_size': '(2)', 'stride': '(2)'}), '(kernel_size=2, stride=2)\n', (2088, 2113), True, 'import torch.nn as nn\n'), ((4794, 4831), ... |
# ------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# -------------------------------------------------------------------... | [
"numpy.allclose",
"os.path.realpath",
"PIL.Image.open",
"numpy.array",
"torch.allclose"
] | [((2624, 2647), 'PIL.Image.open', 'Image.open', (['actual_file'], {}), '(actual_file)\n', (2634, 2647), False, 'from PIL import Image\n'), ((2673, 2698), 'PIL.Image.open', 'Image.open', (['expected_file'], {}), '(expected_file)\n', (2683, 2698), False, 'from PIL import Image\n'), ((1533, 1603), 'torch.allclose', 'torch... |
import sqlite3, uuid, sys, logging, time, os, json, zlib, hashlib, tempfile
from util import mbtiles_connect, execute_commands_on_tile, flip_y, prettify_connect_string
logger = logging.getLogger(__name__)
def mbtiles_to_disk(mbtiles_file, directory_path, **kwargs):
delete_after_export = kwargs.get('delete_afte... | [
"sys.stdout.write",
"os.mkdir",
"util.mbtiles_connect",
"os.makedirs",
"util.execute_commands_on_tile",
"os.path.isdir",
"util.prettify_connect_string",
"time.time",
"util.flip_y",
"sys.stdout.flush",
"sys.exit",
"sys.stderr.write",
"os.path.join",
"logging.getLogger"
] | [((179, 206), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (196, 206), False, 'import sqlite3, uuid, sys, logging, time, os, json, zlib, hashlib, tempfile\n'), ((1064, 1155), 'util.mbtiles_connect', 'mbtiles_connect', (['mbtiles_file', 'auto_commit', 'journal_mode', 'synchronous_off', '... |
from ..kernel import core
from ..kernel.core import VSkillModifier as V
from ..character import characterKernel as ck
from functools import partial
from ..status.ability import Ability_tool
from ..execution.rules import RuleSet, ConcurrentRunRule
from . import globalSkill
from .jobbranch import warriors
from math impor... | [
"math.ceil"
] | [((1374, 1404), 'math.ceil', 'ceil', (['((32 + passive_level) / 2)'], {}), '((32 + passive_level) / 2)\n', (1378, 1404), False, 'from math import ceil\n'), ((1921, 1944), 'math.ceil', 'ceil', (['(passive_level / 2)'], {}), '(passive_level / 2)\n', (1925, 1944), False, 'from math import ceil\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.