code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
"""Test data"""
import os
import pytest
TEST_PATH = os.path.abspath(os.path.dirname(__file__))
TEST_DATA_PATH = os.path.join(TEST_PATH, 'test_data')
def _get_test_data(filename):
file_path = os.path.join(TEST_DATA_PATH, filename)
with open(file_path, encoding='utf-8') as data_file:
... | [
"pytest.fixture",
"os.path.dirname",
"os.path.join"
] | [((137, 173), 'os.path.join', 'os.path.join', (['TEST_PATH', '"""test_data"""'], {}), "(TEST_PATH, 'test_data')\n", (149, 173), False, 'import os\n'), ((369, 406), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""map_empty_conf"""'}), "(name='map_empty_conf')\n", (383, 406), False, 'import pytest\n'), ((476, 507),... |
from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
"""
scenario: test_random_actions
uuid: 460862264
"""
"""
random actions, total chaos
"""
board = gamma_new(5, 5, 2, 16)
assert board i... | [
"part1.gamma_move",
"part1.gamma_board",
"part1.gamma_new",
"part1.gamma_golden_move",
"part1.gamma_delete",
"part1.gamma_busy_fields",
"part1.gamma_golden_possible",
"part1.gamma_free_fields"
] | [((283, 305), 'part1.gamma_new', 'gamma_new', (['(5)', '(5)', '(2)', '(16)'], {}), '(5, 5, 2, 16)\n', (292, 305), False, 'from part1 import gamma_board, gamma_busy_fields, gamma_delete, gamma_free_fields, gamma_golden_move, gamma_golden_possible, gamma_move, gamma_new\n'), ((1126, 1144), 'part1.gamma_board', 'gamma_boa... |
# Generated by Django 3.2.7 on 2021-10-03 15:09
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sellers', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='seller',
old_name='description',
... | [
"django.db.migrations.RenameField"
] | [((216, 305), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""seller"""', 'old_name': '"""description"""', 'new_name': '"""descr"""'}), "(model_name='seller', old_name='description',\n new_name='descr')\n", (238, 305), False, 'from django.db import migrations\n')] |
import sys
from collections import namedtuple, defaultdict
import concrete
from concrete.util import CommunicationReader
import numpy as np
import json
Mention = namedtuple("Mention", "text start end sentence entityType confidence uuid")
def get_entities(comm, entity_tool):
"""
Returns:
list of concrete.Entity o... | [
"concrete.util.CommunicationReader",
"collections.namedtuple",
"json.dumps",
"concrete.util.metadata.get_index_of_tool",
"collections.defaultdict"
] | [((162, 237), 'collections.namedtuple', 'namedtuple', (['"""Mention"""', '"""text start end sentence entityType confidence uuid"""'], {}), "('Mention', 'text start end sentence entityType confidence uuid')\n", (172, 237), False, 'from collections import namedtuple, defaultdict\n'), ((354, 427), 'concrete.util.metadata.... |
# coding=utf-8
import re
import argparse
import codecs
from itertools import *
from nltk import ngrams
import string
import yaml
parser = argparse.ArgumentParser()
parser.add_argument('corpus_kalaba')
args = parser.parse_args()
corpus_kalaba = args.corpus_kalaba
# longueur
# position
# contexte
# lettre
phrase = ... | [
"codecs.open",
"nltk.ngrams",
"argparse.ArgumentParser"
] | [((140, 165), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (163, 165), False, 'import argparse\n'), ((1491, 1540), 'codecs.open', 'codecs.open', (['corpus_kalaba', '"""r"""'], {'encoding': '"""utf-8"""'}), "(corpus_kalaba, 'r', encoding='utf-8')\n", (1502, 1540), False, 'import codecs\n'), ((... |
import os
from koala.server import koala_host
from koala.server.fastapi import *
from sample.fastapi.http_api import *
import sample.player
koala_host.init_server(globals().copy(), f"{os.getcwd()}/sample/app.yaml")
koala_host.use_pd()
koala_host.listen_fastapi()
koala_host.run_server()
| [
"koala.server.koala_host.run_server",
"koala.server.koala_host.use_pd",
"os.getcwd",
"koala.server.koala_host.listen_fastapi"
] | [((225, 244), 'koala.server.koala_host.use_pd', 'koala_host.use_pd', ([], {}), '()\n', (242, 244), False, 'from koala.server import koala_host\n'), ((246, 273), 'koala.server.koala_host.listen_fastapi', 'koala_host.listen_fastapi', ([], {}), '()\n', (271, 273), False, 'from koala.server import koala_host\n'), ((275, 29... |
from app import db
from app.models import Log, User
def test_login(client):
user = User.query.first()
user.my_logs.append(Log(title="Golf"))
db.session.add(user)
db.session.commit()
response = client.post(
"/sms",
data=dict(From="+4915123595397", Body="Einfach den Ball mal besser t... | [
"app.models.Log",
"app.db.session.commit",
"app.models.User.query.first",
"app.db.session.add"
] | [((89, 107), 'app.models.User.query.first', 'User.query.first', ([], {}), '()\n', (105, 107), False, 'from app.models import Log, User\n'), ((155, 175), 'app.db.session.add', 'db.session.add', (['user'], {}), '(user)\n', (169, 175), False, 'from app import db\n'), ((180, 199), 'app.db.session.commit', 'db.session.commi... |
"""Support for tracking Tesla cars."""
import logging
from homeassistant.components.device_tracker import SOURCE_TYPE_GPS
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from . import DOMAIN as TESLA_DOMAIN, TeslaDevice
_LOGGER = logging.getLogger(__name__)
async def async_setup_entr... | [
"logging.getLogger"
] | [((264, 291), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (281, 291), False, 'import logging\n')] |
import unittest
from hangpy.repositories import ServerRepository
class TestServerRepository(unittest.TestCase):
def test_instantiate(self):
server_repository = FakeServerRepository()
self.assertIsNone(server_repository.get_servers())
self.assertIsNone(server_repository.add_server(None))
... | [
"unittest.main",
"hangpy.repositories.ServerRepository.add_server",
"hangpy.repositories.ServerRepository.get_servers",
"hangpy.repositories.ServerRepository.update_server"
] | [((735, 750), 'unittest.main', 'unittest.main', ([], {}), '()\n', (748, 750), False, 'import unittest\n'), ((475, 509), 'hangpy.repositories.ServerRepository.get_servers', 'ServerRepository.get_servers', (['self'], {}), '(self)\n', (503, 509), False, 'from hangpy.repositories import ServerRepository\n'), ((560, 601), '... |
#!/usr/bin/env python3
VERSION = "0.0.1-sig"
import requests, json, time, traceback
from random import random
from bs4 import BeautifulSoup
WEBHOOK_URL = "https://hooks.slack.com/services/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"
TEST_URL = "https://apps.apple.com/cn/app/goodnotes-4/id778658393"
SLEEP_IN = 3
U... | [
"traceback.format_exc",
"argparse.ArgumentParser",
"json.dumps",
"time.sleep",
"requests.get",
"bs4.BeautifulSoup",
"random.random"
] | [((889, 923), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (901, 923), False, 'import requests, json, time, traceback\n'), ((934, 963), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.text', '"""lxml"""'], {}), "(r.text, 'lxml')\n", (947, 963), False, 'from bs4 import Beauti... |
#!/usr/bin/env python
# pylint: disable=invalid-name,ungrouped-imports
import logging
import math
import os
from importlib import import_module
import coloredlogs
import numpy as np
import tensorflow as tf
from scipy.misc import imread
from tensorflow.python.framework import dtypes
from tensorflow.python.ops import ... | [
"logging.getLogger",
"tensorflow.python.ops.array_ops.zeros",
"tensorflow.train.Checkpoint",
"tensorflow.logging.set_verbosity",
"math.log",
"numpy.array",
"tensorflow.python.ops.math_ops.cumsum",
"numpy.sin",
"tensorflow.contrib.memory_stats.BytesInUse",
"tensorflow.python.ops.math_ops.range",
... | [((1988, 2018), 'tensorflow.cast', 'tf.cast', (['(output >= 0)', 'tf.uint8'], {}), '(output >= 0, tf.uint8)\n', (1995, 2018), True, 'import tensorflow as tf\n'), ((2030, 2066), 'tensorflow.cast', 'tf.cast', (['(ground_truth >= 0)', 'tf.uint8'], {}), '(ground_truth >= 0, tf.uint8)\n', (2037, 2066), True, 'import tensorf... |
##@namespace produtil.mpi_impl.srun
# Adds SLURM srun support to produtil.run
#
# This module is part of the mpi_impl package -- see produtil.mpi_impl
# for details. This translates produtil.run directives to SLURM srun
# commands.
import os, logging, re
import produtil.fileop,produtil.prog,produtil.mpiprog,produtil... | [
"logging.getLogger",
"re.sub"
] | [((4136, 4161), 'logging.getLogger', 'logging.getLogger', (['"""srun"""'], {}), "('srun')\n", (4153, 4161), False, 'import os, logging, re\n'), ((6912, 6967), 're.sub', 're.sub', (['"""^(\\\\d+)(?:\\\\(.*\\\\))?"""', '"""\\\\1"""', 'slurm_ppn_string'], {}), "('^(\\\\d+)(?:\\\\(.*\\\\))?', '\\\\1', slurm_ppn_string)\n",... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# PUB_DATAVIZ: Visualization tools for PINNACLE
# Copyright (c) 2020, <NAME>
#
# MIT License:
# https://github.com/IATE-CONICET-UNC/pinnacle/blob/master/LICENSE
from matplotlib import pyplot as plt
from pinnacle.plot_styles import cycling_attrs, aes_attrs
import numpy a... | [
"numpy.histogram",
"pinnacle.plot_styles.cycling_attrs",
"matplotlib.pyplot.close",
"datetime.datetime.now",
"matplotlib.pyplot.figure",
"numpy.array",
"pinnacle.plot_styles.aes_attrs",
"random.random",
"numpy.arange"
] | [((2049, 2075), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 5)'}), '(figsize=(8, 5))\n', (2059, 2075), True, 'from matplotlib import pyplot as plt\n'), ((2733, 2744), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (2742, 2744), True, 'from matplotlib import pyplot as plt\n'), ((3678, 3704... |
import numpy as np
def Topsis(weights, numerical_data, impact):
try:
if(numerical_data.shape[1] != weights.shape[0] or weights.shape != impact.shape or numerical_data.shape[1] != impact.shape[0]):
raise Exception("Given input is not correct")
except Exception as e:
print("Given input is incorrect")
return
... | [
"numpy.argsort",
"numpy.array",
"numpy.argmax"
] | [((1182, 1225), 'numpy.array', 'np.array', (['ideal_best_values'], {'dtype': 'np.float'}), '(ideal_best_values, dtype=np.float)\n', (1190, 1225), True, 'import numpy as np\n'), ((1250, 1294), 'numpy.array', 'np.array', (['ideal_worst_values'], {'dtype': 'np.float'}), '(ideal_worst_values, dtype=np.float)\n', (1258, 129... |
from pyspark.sql.types import (
ArrayType,
IntegerType,
StringType,
StructField,
StructType,
)
from butterfree.extract.pre_processing import explode_json_column
from butterfree.testing.dataframe import (
assert_dataframe_equality,
create_df_from_collection,
)
def test_explode_json_column(... | [
"butterfree.testing.dataframe.create_df_from_collection",
"pyspark.sql.types.IntegerType",
"butterfree.testing.dataframe.assert_dataframe_equality",
"butterfree.extract.pre_processing.explode_json_column",
"pyspark.sql.types.StringType"
] | [((693, 760), 'butterfree.testing.dataframe.create_df_from_collection', 'create_df_from_collection', (['input_data', 'spark_context', 'spark_session'], {}), '(input_data, spark_context, spark_session)\n', (718, 760), False, 'from butterfree.testing.dataframe import assert_dataframe_equality, create_df_from_collection\n... |
'''
runs in python 2.7
This program converts topocentric data to geocentric data.
'''
from PySide.QtGui import QApplication,QWidget,QComboBox,QVBoxLayout,QLabel,QFormLayout
import os
import csv
import sys
topo=[]
sp=[]
wp=[]
geo=[]
i=0
filename1=""
filename2=""
def writeToFile(filename3,geo):
'''
writes the dat... | [
"os.listdir",
"PySide.QtGui.QFormLayout",
"PySide.QtGui.QLabel",
"csv.writer",
"PySide.QtGui.QComboBox",
"os.getcwd",
"PySide.QtGui.QVBoxLayout",
"PySide.QtGui.QApplication",
"csv.reader",
"PySide.QtGui.QWidget.__init__"
] | [((4426, 4448), 'PySide.QtGui.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (4438, 4448), False, 'from PySide.QtGui import QApplication, QWidget, QComboBox, QVBoxLayout, QLabel, QFormLayout\n'), ((595, 617), 'csv.writer', 'csv.writer', (['filewriter'], {}), '(filewriter)\n', (605, 617), False, 'imp... |
#!python3
r""" combobox.py
https://tkdocs.com/tutorial/widgets.html#combobox
"""
from tkinter import *
from tkinter import ttk
root = Tk()
root.title("Combobox")
s = StringVar(value="On") # default value is ''
b = BooleanVar(value=True) # default is False
i = IntVar(value=10) # default is 0
d = DoubleV... | [
"tkinter.ttk.Combobox"
] | [((690, 724), 'tkinter.ttk.Combobox', 'ttk.Combobox', (['root'], {'textvariable': 's'}), '(root, textvariable=s)\n', (702, 724), False, 'from tkinter import ttk\n'), ((820, 854), 'tkinter.ttk.Combobox', 'ttk.Combobox', (['root'], {'textvariable': 'b'}), '(root, textvariable=b)\n', (832, 854), False, 'from tkinter impor... |
#!/usr/bin/env python3
# Copyright (c) 2021 Johns Hopkins University (authors: <NAME>)
# Apache 2.0
import argparse
import os
import subprocess
import sys
from contextlib import contextmanager
from pathlib import Path
import torch
from lhotse import CutSet, Fbank, FbankConfig, LilcomHdf5Writer, combine
from lhotse.... | [
"subprocess.check_output",
"os.path.exists",
"argparse.ArgumentParser",
"pathlib.Path",
"lhotse.recipes.prepare_ami",
"lhotse.recipes.download_ami",
"torch.set_num_threads",
"lhotse.FbankConfig",
"lhotse.CutSet.from_manifests",
"os.cpu_count",
"sys.exit",
"distributed.Client",
"plz.setup_clu... | [((602, 626), 'torch.set_num_threads', 'torch.set_num_threads', (['(1)'], {}), '(1)\n', (623, 626), False, 'import torch\n'), ((627, 659), 'torch.set_num_interop_threads', 'torch.set_num_interop_threads', (['(1)'], {}), '(1)\n', (656, 659), False, 'import torch\n'), ((2155, 2166), 'sys.exit', 'sys.exit', (['(1)'], {}),... |
from setuptools import setup, find_packages
# TBD: use_scm_version = True/ setup_requires=["setuptools_scm"]
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name = "jetconf_mnat",
author = "<NAME>",
author_email="<EMAIL>",
description = "MNAT server jetcon... | [
"setuptools.find_packages"
] | [((498, 513), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (511, 513), False, 'from setuptools import setup, find_packages\n')] |
import torchvision
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
import torchvision.models as models
from torchvision.io import read_image
from torchvision import datasets, models, transforms
import matplotlib
import matpl... | [
"PySimpleGUI.Button",
"PIL.ImageDraw.Draw",
"PySimpleGUI.HorizontalSeparator",
"PySimpleGUI.Image",
"pynput.mouse.Controller",
"threading.Thread.__init__",
"PySimpleGUI.In",
"torchvision.transforms.ToTensor",
"PySimpleGUI.Listbox",
"PySimpleGUI.Column",
"PySimpleGUI.Text",
"torchvision.transfo... | [((827, 858), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {}), '(self)\n', (852, 858), False, 'import threading\n'), ((4520, 4571), 'PySimpleGUI.Window', 'sg.Window', (['"""BlackJack"""', 'self.layout'], {'resizable': '(True)'}), "('BlackJack', self.layout, resizable=True)\n", (4529, 4571), Tru... |
#!/usr/bin/env python3
import os
import shlex
import subprocess
class Program:
def __init__(self, name, requires, location, setup, start):
self.name = name
self.requires = requires
self.location = location
self.setup_commands = setup
self.start = start
self._fetche... | [
"os.chdir",
"subprocess.run",
"shlex.split"
] | [((495, 530), 'subprocess.run', 'subprocess.run', (['command'], {'check': '(True)'}), '(command, check=True)\n', (509, 530), False, 'import subprocess\n'), ((1494, 1519), 'os.chdir', 'os.chdir', (['self._directory'], {}), '(self._directory)\n', (1502, 1519), False, 'import os\n'), ((458, 478), 'shlex.split', 'shlex.spl... |
"""Uses a specified model to predicit missing characters from a file containing texts. """
from greek_char_bert.predict import (
MLMPredicter,
replace_square_brackets,
sentences_to_dicts,
)
from greek_char_bert.run_eval import convert_masking
from greek_data_prep.clean_data import clean_texts, CHARS_TO_REM... | [
"greek_char_bert.predict.MLMPredicter.load",
"greek_data_prep.clean_data.clean_texts",
"greek_char_bert.run_eval.convert_masking",
"argparse.ArgumentParser",
"greek_char_bert.predict.sentences_to_dicts",
"re.findall",
"greek_char_bert.predict.replace_square_brackets"
] | [((746, 799), 'greek_data_prep.clean_data.clean_texts', 'clean_texts', (['texts', 'CHARS_TO_REMOVE', 'CHARS_TO_REPLACE'], {}), '(texts, CHARS_TO_REMOVE, CHARS_TO_REPLACE)\n', (757, 799), False, 'from greek_data_prep.clean_data import clean_texts, CHARS_TO_REMOVE, CHARS_TO_REPLACE\n'), ((2728, 2855), 'argparse.ArgumentP... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# *****************************************************************************/
# * Authors: <NAME>
# *****************************************************************************/
import os, sys
importPath = os.path.abspath(os.getcwd())
sys.path.insert(1, importPath)
... | [
"sys.path.insert",
"os.getcwd"
] | [((289, 319), 'sys.path.insert', 'sys.path.insert', (['(1)', 'importPath'], {}), '(1, importPath)\n', (304, 319), False, 'import os, sys\n'), ((275, 286), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (284, 286), False, 'import os, sys\n')] |
# modules for MT940 ABN-AMRO
import re
from mt940e_v2 import Editor
import pdb # noqa F401
# decode MT940 86 strings and deducts payee and memo
# for MT940 ABN-AMRO output
class ParseMT940:
cutoff = 65
@classmethod
def code86(cls, string86, bank_account, date, amount):
''' determine the code i... | [
"re.sub",
"mt940e_v2.Editor.edit",
"re.search"
] | [((439, 467), 're.search', 're.search', (['"""^.{5}"""', 'string86'], {}), "('^.{5}', string86)\n", (448, 467), False, 'import re\n'), ((585, 632), 're.sub', 're.sub', (['"""(/\\\\D{3}/|/\\\\D{4}/)"""', '"""/\\\\1"""', 'string86'], {}), "('(/\\\\D{3}/|/\\\\D{4}/)', '/\\\\1', string86)\n", (591, 632), False, 'import re\... |
import os
from boggle import ASSET_PATH, DB_PATH
from boggle.board import Board
from boggle.dictionary import Dictionary
from boggle.boggleGame import BoggleGame
from boggle.match import Match
from flask import Flask, jsonify, abort, request, Response, render_template
import redis
app = Flask(__name__)
redisConn = ... | [
"flask.render_template",
"flask.Flask",
"os.path.join",
"boggle.board.Board.load_from_file",
"flask.request.get_json",
"redis.StrictRedis",
"boggle.boggleGame.BoggleGame",
"boggle.dictionary.Dictionary",
"flask.abort",
"flask.jsonify"
] | [((292, 307), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (297, 307), False, 'from flask import Flask, jsonify, abort, request, Response, render_template\n'), ((320, 372), 'redis.StrictRedis', 'redis.StrictRedis', ([], {'host': '"""localhost"""', 'port': '(6379)', 'db': '(0)'}), "(host='localhost', port... |
import sys
from functools import reduce
def gcd(a, b):
while b:
a, b = b, a % b
return abs(a)
def lcm(a, b):
return abs(a // gcd(a, b) * b)
n, *t = map(int, sys.stdin.read().split())
def main():
return reduce(lcm, t)
if __name__ == "__main__":
ans = main()
... | [
"functools.reduce",
"sys.stdin.read"
] | [((252, 266), 'functools.reduce', 'reduce', (['lcm', 't'], {}), '(lcm, t)\n', (258, 266), False, 'from functools import reduce\n'), ((197, 213), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (211, 213), False, 'import sys\n')] |
# -*- coding:utf-8 -*-
import socket
import random
import base64
import hashlib
import re
MAGIC_NUMBER = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
HOST = "localhost"
PORT = 5858
def main():
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST, PORT))
########################... | [
"socket.socket",
"re.compile",
"base64.b64encode",
"random.getrandbits",
"hashlib.sha1"
] | [((199, 248), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (212, 248), False, 'import socket\n'), ((1101, 1146), 're.compile', 're.compile', (["'Sec-WebSocket-Accept: (.+?)\\r\\n'"], {}), "('Sec-WebSocket-Accept: (.+?)\\r\\n')\n", (1111, 114... |
from copy import deepcopy
import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
from apex import amp
from torch.cuda.amp import autocast as autocast
from transformers import BertModel, BertTokenizer
from util import text_processing
from collections import OrderedDict
from . import ops a... | [
"torch.mul",
"util.text_processing.VocabDict",
"torch.sum",
"torch.bmm",
"torch.nn.functional.softmax",
"torch.cuda.amp.GradScaler",
"torch.cuda.amp.autocast",
"torch.nn.parallel.DistributedDataParallel",
"torch.argmax",
"collections.OrderedDict",
"transformers.BertModel.from_pretrained",
"tor... | [((796, 840), 'torch.nn.functional.normalize', 'F.normalize', (['(kb * proj_q[:, None, :])'], {'dim': '(-1)'}), '(kb * proj_q[:, None, :], dim=-1)\n', (807, 840), True, 'import torch.nn.functional as F\n'), ((985, 1011), 'torch.nn.functional.softmax', 'F.softmax', (['raw_att'], {'dim': '(-1)'}), '(raw_att, dim=-1)\n', ... |
from vkapp.bot.models import Income, Payment, Blogger, News
from .usersDAO import get_or_create_blogger
def new_income_proposal(amount, news):
income = Income(amount=amount, news=news, type=Income.PROPOSAL)
blogger = news.blogger
blogger.balance += amount
blogger.save()
income.save()
def re_count_... | [
"vkapp.bot.models.Income.objects.filter",
"vkapp.bot.models.Income",
"vkapp.bot.models.Payment.objects.filter"
] | [((157, 211), 'vkapp.bot.models.Income', 'Income', ([], {'amount': 'amount', 'news': 'news', 'type': 'Income.PROPOSAL'}), '(amount=amount, news=news, type=Income.PROPOSAL)\n', (163, 211), False, 'from vkapp.bot.models import Income, Payment, Blogger, News\n'), ((563, 602), 'vkapp.bot.models.Payment.objects.filter', 'Pa... |
from django.shortcuts import render
from django.http import JsonResponse
from .services import logic
def about(request):
return render(request, 'service/about.html')
def info_pokemon(request, name):
pokemon = logic.get_pokemon(name)
if pokemon:
return JsonResponse(pokemon)
else:
retu... | [
"django.shortcuts.render",
"django.http.JsonResponse"
] | [((134, 171), 'django.shortcuts.render', 'render', (['request', '"""service/about.html"""'], {}), "(request, 'service/about.html')\n", (140, 171), False, 'from django.shortcuts import render\n'), ((276, 297), 'django.http.JsonResponse', 'JsonResponse', (['pokemon'], {}), '(pokemon)\n', (288, 297), False, 'from django.h... |
'''Gets info about the users whose tweets are retrieves'''
import json
import boto3
client = boto3.client("dynamodb")
table_name = 'arduino_twitter_users'
def lambda_handler(event, context):
if 'user_id' in event:
return get_user(event['user_id'])
return get_users()
def get_user(user_id: str) -> dict:
user... | [
"boto3.client"
] | [((94, 118), 'boto3.client', 'boto3.client', (['"""dynamodb"""'], {}), "('dynamodb')\n", (106, 118), False, 'import boto3\n')] |
#Automation
#Specifically used for small subsets with int64 as their astype
import pandas as pd
my_df = pd.read_csv("subset-1-sous-ensemble-1.csv", encoding = "latin-1")
my_df = my_df.loc[my_df['QUESTION'] == 'Q01']
my_df = my_df.loc[my_df['SURVEYR'] == 2020]
my_df = my_df.iloc[0:,[20, 22]]
print (my_df)
count = my... | [
"pandas.read_csv"
] | [((106, 169), 'pandas.read_csv', 'pd.read_csv', (['"""subset-1-sous-ensemble-1.csv"""'], {'encoding': '"""latin-1"""'}), "('subset-1-sous-ensemble-1.csv', encoding='latin-1')\n", (117, 169), True, 'import pandas as pd\n')] |
""" This file is create and managed by <NAME>
----------------------------------------------
It can be use only for education purpose
"""
# Splitting String into List items
import re
language = "Python, Java Script, C#, Kotlin"
language_list = re.split(',',language)
print(language_list)
| [
"re.split"
] | [((257, 280), 're.split', 're.split', (['""","""', 'language'], {}), "(',', language)\n", (265, 280), False, 'import re\n')] |
"""
Class to crawl answers mail.ru
"""
import sqlite3
import requests
import re
from bs4 import BeautifulSoup as bs
class Crawler(object):
def __init__(self, categories='all', timeline = 'all', verbose=True,
schema_name='schema.sql', db_name='q_database.sqlt',
bs_features='lxml'... | [
"bs4.BeautifulSoup",
"sqlite3.connect",
"requests.get",
"re.compile"
] | [((1885, 1905), 're.compile', 're.compile', (['"""[\\\\d]+"""'], {}), "('[\\\\d]+')\n", (1895, 1905), False, 'import re\n'), ((4186, 4212), 'bs4.BeautifulSoup', 'bs', (['page', 'self.bs_features'], {}), '(page, self.bs_features)\n', (4188, 4212), True, 'from bs4 import BeautifulSoup as bs\n'), ((6691, 6708), 'requests.... |
#!/usr/bin/env python
import math
import random
import time
class MinMaxHeap:
@staticmethod
def get_max_nodes_for_height(height):
return 2 ** (height + 1) - 1
def __init__(self, is_max=True):
self._items = []
self._is_max = is_max
def __len__(self):
return len(self._i... | [
"time.time",
"random.randint"
] | [((5373, 5384), 'time.time', 'time.time', ([], {}), '()\n', (5382, 5384), False, 'import time\n'), ((5466, 5512), 'random.randint', 'random.randint', (['(1)', '(2 * 2 ** max_gen_height - 1)'], {}), '(1, 2 * 2 ** max_gen_height - 1)\n', (5480, 5512), False, 'import random\n'), ((5542, 5564), 'random.randint', 'random.ra... |
from django.conf.urls import include, url
urlpatterns = [
url(r'^api/morango/v1/', include('morango.api.urls')),
]
| [
"django.conf.urls.include"
] | [((89, 116), 'django.conf.urls.include', 'include', (['"""morango.api.urls"""'], {}), "('morango.api.urls')\n", (96, 116), False, 'from django.conf.urls import include, url\n')] |
#!/usr/bin/env python
# Copyright (c) 2010 <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 l... | [
"os.path.dirname",
"sys.path.insert",
"os.path.join",
"distutils.core.setup"
] | [((803, 831), 'sys.path.insert', 'sys.path.insert', (['(0)', 'src_path'], {}), '(0, src_path)\n', (818, 831), False, 'import sys\n'), ((857, 909), 'os.path.join', 'os.path.join', (['src_path', '"""DatabaseLibrary"""', '"""VERSION"""'], {}), "(src_path, 'DatabaseLibrary', 'VERSION')\n", (869, 909), False, 'import os\n')... |
from flask_restplus import Resource, marshal, abort
from flask_login import login_required, current_user
from webserver.api import commit_or_abort, profile
from webserver.models import db, Project
from webserver import logger
from .namespace import (
api,
project,
project_base,
project_list
)
@api.r... | [
"flask_login.current_user.projects.append",
"flask_login.current_user.get_or_404",
"webserver.models.Project",
"flask_login.current_user.projects.get_or_404",
"webserver.models.db.session.add",
"webserver.api.commit_or_abort",
"flask_login.current_user.projects.paginate"
] | [((496, 561), 'flask_login.current_user.projects.paginate', 'current_user.projects.paginate', (['(1)'], {'per_page': '(100)', 'max_per_page': '(500)'}), '(1, per_page=100, max_per_page=500)\n', (526, 561), False, 'from flask_login import login_required, current_user\n'), ((1180, 1224), 'flask_login.current_user.project... |
# SPDX-FileCopyrightText: 2020 Efabless 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 o... | [
"gzip.open",
"pathlib.Path",
"logging.fatal",
"sys.exit",
"hashlib.sha1",
"logging.info"
] | [((1609, 1623), 'hashlib.sha1', 'hashlib.sha1', ([], {}), '()\n', (1621, 1623), False, 'import hashlib\n'), ((858, 951), 'logging.info', 'logging.info', (['f"""{{{{EXTRACTING FILES}}}} Extracting compressed files in: {project_path}"""'], {}), "(\n f'{{{{EXTRACTING FILES}}}} Extracting compressed files in: {project_p... |
# mimic_ts.py
# NOTE: will not be used
# Converts raw MIMIC time-series data to the standardized format
# Input: the MIMIC-III database in CSV format (pointed to by INPUT_PATH)
# Output: ts.csv
# TODO: cohort selection
# TODO: urine output
import pandas as pd
# TODO: change to actual (non-demo) data path
INPUT_PAT... | [
"pandas.to_datetime",
"pandas.read_csv"
] | [((1383, 1426), 'pandas.read_csv', 'pd.read_csv', (["(INPUT_PATH + 'CHARTEVENTS.csv')"], {}), "(INPUT_PATH + 'CHARTEVENTS.csv')\n", (1394, 1426), True, 'import pandas as pd\n'), ((1441, 1482), 'pandas.read_csv', 'pd.read_csv', (["(INPUT_PATH + 'LABEVENTS.csv')"], {}), "(INPUT_PATH + 'LABEVENTS.csv')\n", (1452, 1482), T... |
#########################################
############ Kawaii Commands ############
#########################################
import discord
import random
from config import embed_color, embed_color_attention, embed_color_error, embed_color_succes
from discord.ext import commands
from cogs.data.kawaiidata import *
cl... | [
"discord.ext.commands.guild_only",
"discord.Embed",
"discord.ext.commands.command",
"random.choice"
] | [((423, 444), 'discord.ext.commands.guild_only', 'commands.guild_only', ([], {}), '()\n', (442, 444), False, 'from discord.ext import commands\n'), ((450, 468), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (466, 468), False, 'from discord.ext import commands\n'), ((902, 923), 'discord.ext.comma... |
import os
import csv
from configparser import ConfigParser
from rom import ROM
from patch import Patch
__PROJECT_CONFIG_FILE_NAME = 'project.ini'
__CONFIG = None
def build_rom(buf=None):
config = get_config()
patch_list = get_patch_list()
ff6 = ROM.from_file(config['base_rom'])
for n, patch in enume... | [
"csv.DictReader",
"configparser.ConfigParser",
"csv.writer",
"os.path.join",
"rom.ROM.from_file"
] | [((261, 294), 'rom.ROM.from_file', 'ROM.from_file', (["config['base_rom']"], {}), "(config['base_rom'])\n", (274, 294), False, 'from rom import ROM\n'), ((767, 791), 'csv.DictReader', 'csv.DictReader', (['csv_fobj'], {}), '(csv_fobj)\n', (781, 791), False, 'import csv\n'), ((1241, 1261), 'csv.writer', 'csv.writer', (['... |
import sys
import os
sys.path.append(os.path.abspath("./"))
from nnst import downloader as downloader
import pprint
import argparse
import nnst.nnst as nnst
parser=argparse.ArgumentParser()
parser.add_argument('--csv_path', help='csv파일 경로')
parser.add_argument('--date', help='시작할 뉴스 일자')
parser.add_argument('--num', ... | [
"nnst.nnst.load_data",
"argparse.ArgumentParser",
"nnst.downloader.download",
"nnst.nnst.random_batch",
"os.path.abspath",
"pprint.pprint",
"nnst.nnst.div_dataset"
] | [((165, 190), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (188, 190), False, 'import argparse\n'), ((791, 831), 'nnst.downloader.download', 'downloader.download', (['num', 'csv_path', 'date'], {}), '(num, csv_path, date)\n', (810, 831), True, 'from nnst import downloader as downloader\n'), (... |
from openpyxl import load_workbook
from .cell import Cell
wb = load_workbook('test.xlsx')
sheet = wb.active
cell = sheet['H4']
mycell = Cell(cell)
| [
"openpyxl.load_workbook"
] | [((65, 91), 'openpyxl.load_workbook', 'load_workbook', (['"""test.xlsx"""'], {}), "('test.xlsx')\n", (78, 91), False, 'from openpyxl import load_workbook\n')] |
"""Exploratory Data Analysis. This module creates the values for Table 1 (summary statistics)."""
# %%
# Import necessary packages
import os
import numpy as np
from pathlib import Path
# %%
# Set up folder path
code_folder = Path(os.path.abspath(''))
print(code_folder)
project_dir = os.path.dirname(code_folder)
os.c... | [
"os.chdir",
"os.path.dirname",
"os.path.abspath",
"setup_fin_dataset.get_dataset"
] | [((287, 315), 'os.path.dirname', 'os.path.dirname', (['code_folder'], {}), '(code_folder)\n', (302, 315), False, 'import os\n'), ((316, 337), 'os.chdir', 'os.chdir', (['project_dir'], {}), '(project_dir)\n', (324, 337), False, 'import os\n'), ((508, 521), 'setup_fin_dataset.get_dataset', 'get_dataset', ([], {}), '()\n'... |
# encoding: utf-8
from __future__ import unicode_literals
from datetime import timedelta
from bson import ObjectId as oid
from common import FieldExam
from marrow.mongo import Document
from marrow.mongo.field import ObjectId
from marrow.mongo.util import utcnow
from marrow.schema.compat import unicode
class TestO... | [
"bson.ObjectId",
"marrow.mongo.util.utcnow",
"marrow.mongo.field.ObjectId",
"marrow.schema.compat.unicode",
"datetime.timedelta"
] | [((724, 729), 'bson.ObjectId', 'oid', ([], {}), '()\n', (727, 729), True, 'from bson import ObjectId as oid\n'), ((836, 844), 'marrow.mongo.util.utcnow', 'utcnow', ([], {}), '()\n', (842, 844), False, 'from marrow.mongo.util import utcnow\n'), ((431, 446), 'marrow.mongo.field.ObjectId', 'ObjectId', (['"""_id"""'], {}),... |
import pytest
import aos_version
from collections import namedtuple
Package = namedtuple('Package', ['name', 'version'])
expected_pkgs = {
"spam": {
"name": "spam",
"version": "3.2.1",
"check_multi": False,
},
"eggs": {
"name": "eggs",
"version": "3.2.1",
"c... | [
"collections.namedtuple",
"aos_version._check_multi_minor_release",
"aos_version._check_precise_version_found",
"aos_version._check_higher_version_found",
"pytest.raises"
] | [((79, 121), 'collections.namedtuple', 'namedtuple', (['"""Package"""', "['name', 'version']"], {}), "('Package', ['name', 'version'])\n", (89, 121), False, 'from collections import namedtuple\n'), ((1188, 1254), 'aos_version._check_precise_version_found', 'aos_version._check_precise_version_found', (['pkgs', 'expected... |
# Copyright 2013 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 file_verifier
import process_verifier
import registry_verifier
class VerifierRunner:
"""Runs all Verifiers."""
def __init__(self):
"""Const... | [
"registry_verifier.RegistryVerifier",
"process_verifier.ProcessVerifier",
"file_verifier.FileVerifier"
] | [((418, 446), 'file_verifier.FileVerifier', 'file_verifier.FileVerifier', ([], {}), '()\n', (444, 446), False, 'import file_verifier\n'), ((467, 501), 'process_verifier.ProcessVerifier', 'process_verifier.ProcessVerifier', ([], {}), '()\n', (499, 501), False, 'import process_verifier\n'), ((528, 564), 'registry_verifie... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import csv
import sys
import requests
from bs4 import BeautifulSoup
reload(sys)
sys.setdefaultencoding('utf8')
target_classes = [
'wotd-word',
'wotd-pronunciation',
'wotd-function',
'wotd-passage',
'wotd-definition',
'wotd-synonyms',
'wotd-source'... | [
"bs4.BeautifulSoup",
"csv.writer",
"sys.setdefaultencoding",
"requests.get"
] | [((124, 154), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf8"""'], {}), "('utf8')\n", (146, 154), False, 'import sys\n'), ((379, 396), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (391, 396), False, 'import requests\n'), ((460, 502), 'bs4.BeautifulSoup', 'BeautifulSoup', (['resp.content', '... |
import torch
import torch.nn.functional as F
__all__ = ['kl_loss', 'huber_loss']
def kl_loss(x, y):
x = F.softmax(x.detach(), dim=1)
y = F.log_softmax(y, dim=1)
return torch.mean(torch.sum(x * (torch.log(x) - y), dim=1))
def huber_loss(error, delta):
abs_error = torch.abs(error)
quadratic = tor... | [
"torch.abs",
"torch.log",
"torch.mean",
"torch.full_like",
"torch.nn.functional.log_softmax"
] | [((148, 171), 'torch.nn.functional.log_softmax', 'F.log_softmax', (['y'], {'dim': '(1)'}), '(y, dim=1)\n', (161, 171), True, 'import torch.nn.functional as F\n'), ((284, 300), 'torch.abs', 'torch.abs', (['error'], {}), '(error)\n', (293, 300), False, 'import torch\n'), ((465, 483), 'torch.mean', 'torch.mean', (['losses... |
import unittest
from app.main.loc_types import Point, PointWithDistance
from app.main.geohash import encode
class TestPoint(unittest.TestCase):
def test_to_json(self):
point = Point("id1", 50.45466, 30.5238)
expected = {
"point_id": "id1", "latitude": 50.45466, "longitude": 30.5238, "g... | [
"unittest.main",
"app.main.loc_types.Point",
"app.main.loc_types.Point.from_json",
"app.main.geohash.encode"
] | [((1118, 1133), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1131, 1133), False, 'import unittest\n'), ((190, 221), 'app.main.loc_types.Point', 'Point', (['"""id1"""', '(50.45466)', '(30.5238)'], {}), "('id1', 50.45466, 30.5238)\n", (195, 221), False, 'from app.main.loc_types import Point, PointWithDistance\n')... |
"""
3D Agn spin visualisation
"""
import logging
import os
import shutil
import corner
import matplotlib.lines as mlines
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pyvista as pv
import scipy.stats
from bbh_simulator.calculate_kick_vel_from_samples import Samples
from matplotlib impor... | [
"logging.getLogger",
"numpy.arccos",
"numpy.sqrt",
"bilby_report.tools.image_utils.make_gif",
"numpy.arctan2",
"matplotlib.rc",
"numpy.linalg.norm",
"numpy.sin",
"corner.corner",
"matplotlib.lines.Line2D",
"pyvista.Arrow",
"bbh_simulator.calculate_kick_vel_from_samples.Samples",
"pyvista.Pol... | [((452, 475), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (454, 475), False, 'from matplotlib import rc\n'), ((2082, 2113), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(np.pi * 2)'], {}), '(0, np.pi * 2)\n', (2099, 2113), True, 'import numpy as np\n'), ((2492, 25... |
from typing import List, Set
from querio.db import data_accessor as da
from querio.ml import model
from querio.service.save_service import SaveService
from querio.ml.expression.cond import Cond
from querio.ml.expression.expression import Expression
from querio.queryobject import QueryObject
from querio.service.utils i... | [
"logging.getLogger",
"querio.db.data_accessor.DataAccessor",
"querio.service.save_service.SaveService",
"querio.service.utils.get_frequency_count",
"querio.ml.model.query"
] | [((1483, 1519), 'logging.getLogger', 'logging.getLogger', (['"""QuerioInterface"""'], {}), "('QuerioInterface')\n", (1500, 1519), False, 'import logging\n'), ((1544, 1579), 'querio.db.data_accessor.DataAccessor', 'da.DataAccessor', (['dbpath', 'table_name'], {}), '(dbpath, table_name)\n', (1559, 1579), True, 'from quer... |
import json
from requests.models import Response
from types import SimpleNamespace
class ContentType:
def __init__(self, system: dict, elements: dict, api_response: Response):
self.id = system["id"]
self.name = system["name"]
self.codename = system["codename"]
self.last_modified = ... | [
"json.dumps",
"types.SimpleNamespace"
] | [((379, 399), 'json.dumps', 'json.dumps', (['elements'], {}), '(elements)\n', (389, 399), False, 'import json\n'), ((458, 478), 'types.SimpleNamespace', 'SimpleNamespace', ([], {}), '(**d)\n', (473, 478), False, 'from types import SimpleNamespace\n')] |
from ndl_tense.data_preparation import create_sentence_file,annotate_tenses, prepare_data, prepare_ndl_events, extract_infinitive, extract_ngrams, prepare_ngrams, prepare_cues
#below import commented out for now, uncomment if you want to run step 6
from ndl_tense.simulations import ndl_model
#from ndl_tense.post_proce... | [
"logging.basicConfig",
"ndl_tense.data_preparation.annotate_tenses.run",
"ndl_tense.data_preparation.prepare_ndl_events.prepare_files",
"ndl_tense.data_preparation.create_sentence_file.run",
"ndl_tense.data_preparation.prepare_ngrams.run",
"ndl_tense.simulations.ndl_model.run",
"os.chdir",
"ndl_tense.... | [((462, 501), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (481, 501), False, 'import logging\n'), ((597, 657), 'ndl_tense.file_tools.manage_directories', 'file_tools.manage_directories', (['EXTRACT_SENTENCES_DIRS', '(False)'], {}), '(EXTRACT_SENTENCES_DIRS, F... |
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import SocketServer
import json
import cgi
class Server(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'application/json')
self.send_header('Access-Control-Allow-Origin... | [
"json.load",
"json.dumps"
] | [((1067, 1079), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1076, 1079), False, 'import json\n'), ((1105, 1125), 'json.dumps', 'json.dumps', (['cafe_num'], {}), '(cafe_num)\n', (1115, 1125), False, 'import json\n'), ((1623, 1635), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1632, 1635), False, 'import json\n'... |
# Copyright 2018 luozhouyang.
#
# 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,... | [
"tensorflow.logging.info",
"tensorflow.train.SessionRunArgs",
"tensorflow.train.get_global_step",
"tensorflow.Summary.Value",
"tensorflow.summary.FileWriter",
"tensorflow.get_collection"
] | [((849, 899), 'tensorflow.get_collection', 'tf.get_collection', (['tf.GraphKeys.TABLE_INITIALIZERS'], {}), '(tf.GraphKeys.TABLE_INITIALIZERS)\n', (866, 899), True, 'import tensorflow as tf\n'), ((962, 1010), 'tensorflow.get_collection', 'tf.get_collection', (['tf.GraphKeys.GLOBAL_VARIABLES'], {}), '(tf.GraphKeys.GLOBAL... |
import sys
import pytest
from takler.core import Limit, Flow, Task
from takler.visitor import pre_order_travel, PrintVisitor
def test_create_limit():
limit_count = 20
limit_name = "post_limit"
limit = Limit(limit_name, limit_count)
assert limit.name == limit_name
assert limit.limit == limit_coun... | [
"takler.core.Flow",
"takler.core.Limit",
"takler.visitor.PrintVisitor"
] | [((217, 247), 'takler.core.Limit', 'Limit', (['limit_name', 'limit_count'], {}), '(limit_name, limit_count)\n', (222, 247), False, 'from takler.core import Limit, Flow, Task\n'), ((392, 414), 'takler.core.Limit', 'Limit', (['"""post_limit"""', '(2)'], {}), "('post_limit', 2)\n", (397, 414), False, 'from takler.core imp... |
from flask import Flask, jsonify
from frame import FlaskGRPCPool
from sample.company_pb2_grpc import CompanyServerStub
from google.protobuf.empty_pb2 import Empty
app = Flask(__name__)
flask_grpc = FlaskGRPCPool(app)
flask_grpc.register("company_connection", host="localhost", port=9100)
@app.route("/company")
def ... | [
"frame.FlaskGRPCPool",
"google.protobuf.empty_pb2.Empty",
"flask.Flask"
] | [((171, 186), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (176, 186), False, 'from flask import Flask, jsonify\n'), ((200, 218), 'frame.FlaskGRPCPool', 'FlaskGRPCPool', (['app'], {}), '(app)\n', (213, 218), False, 'from frame import FlaskGRPCPool\n'), ((440, 447), 'google.protobuf.empty_pb2.Empty', 'Emp... |
#!/usr/bin/env python3
import logging
import datetime
import sys
from ringConnector import core
logging.getLogger().setLevel(logging.INFO)
devices = core.listAllDevices()
logging.info(f"found devices {devices}")
print ('Argument List:', str(sys.argv))
if len(sys.argv) > 1:
dayToDownloadParam = sys.argv[1]
... | [
"logging.getLogger",
"datetime.datetime.strptime",
"ringConnector.core.listAllDevices",
"ringConnector.core.downloadDaysDingVideos",
"logging.info"
] | [((153, 174), 'ringConnector.core.listAllDevices', 'core.listAllDevices', ([], {}), '()\n', (172, 174), False, 'from ringConnector import core\n'), ((175, 215), 'logging.info', 'logging.info', (['f"""found devices {devices}"""'], {}), "(f'found devices {devices}')\n", (187, 215), False, 'import logging\n'), ((617, 634)... |
import os
from setuptools import setup, find_packages
base_dir = os.path.dirname(os.path.abspath(__file__))
setup(
name='hcipy',
version="0.0.1",
description="A pure python library for Bluetooth LE that has minimal dependencies.",
#long_description="\n\n".join([
# open(os.path.join(base_dir, "R... | [
"os.path.abspath",
"setuptools.find_packages"
] | [((81, 106), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (96, 106), False, 'import os\n'), ((682, 697), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (695, 697), False, 'from setuptools import setup, find_packages\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-15 19:21
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import hoover.contrib.twofactor.models
class Migration(migrations.Migration):
initial = True
... | [
"django.db.models.OneToOneField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((349, 406), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (380, 406), False, 'from django.db import migrations, models\n'), ((541, 634), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
'''
任务调度器
给你一个用字符数组 tasks 表示的 CPU 需要执行的任务列表。其中每个字母表示一种不同种类的任务。任务可以以任意顺序执行,并且每个任务都可以在 1 个单位时间内执行完。
在任何一个单位时间,CPU 可以完成一个任务,或者处于待命状态。
然而,两个 相同种类 的任务之间必须有长度为整数 n 的冷却时间,因此至少有连续 n 个单位时间内 CPU 在执行不同的任务,或者在待命状态。
你需要计算完成所有任务所需要的 最短时间 。
提示:
1 <= task.length <= 10^4
tasks[i] 是大写英文字母
n 的取值范围为 [0, 100]
'''
from typing import Lis... | [
"collections.Counter"
] | [((635, 661), 'collections.Counter', 'collections.Counter', (['tasks'], {}), '(tasks)\n', (654, 661), False, 'import collections\n'), ((678, 699), 'collections.Counter', 'collections.Counter', ([], {}), '()\n', (697, 699), False, 'import collections\n')] |
from chemeco.wrappers.database import sklearn_db
from chemeco.wrappers.database import cheml_db
from chemeco.wrappers.database import pandas_db
import inspect
def tshf():
"""
tshf stands for the combination of task, subtask, host, and function
:return: combination, dictionary of the aforementioned combinat... | [
"inspect.getmembers"
] | [((703, 733), 'inspect.getmembers', 'inspect.getmembers', (['sklearn_db'], {}), '(sklearn_db)\n', (721, 733), False, 'import inspect\n'), ((788, 816), 'inspect.getmembers', 'inspect.getmembers', (['cheml_db'], {}), '(cheml_db)\n', (806, 816), False, 'import inspect\n'), ((872, 901), 'inspect.getmembers', 'inspect.getme... |
import time
from PLS.QuadTree import QuadTree
from PLS.AlgorithmHelper import convertPopulationToFront
from copy import deepcopy
class PLS:
#Problem parameters and functions
def __init__(self, objectsWeights, objectsValues, W, populationGenerator, neighborhoodGenerator, updateFunction):
self.objectsWeights ... | [
"copy.deepcopy",
"time.time",
"PLS.AlgorithmHelper.convertPopulationToFront",
"PLS.QuadTree.QuadTree"
] | [((622, 633), 'time.time', 'time.time', ([], {}), '()\n', (631, 633), False, 'import time\n'), ((752, 777), 'PLS.QuadTree.QuadTree', 'QuadTree', (['self.nbCriteria'], {}), '(self.nbCriteria)\n', (760, 777), False, 'from PLS.QuadTree import QuadTree\n'), ((843, 867), 'copy.deepcopy', 'deepcopy', (['initialPopQuad'], {})... |
"""Test the Discovergy config flow."""
from unittest.mock import AsyncMock, MagicMock, patch
from pydiscovergy.error import HTTPError, InvalidLogin
from pydiscovergy.models import AccessToken, ConsumerToken
from homeassistant import setup
from homeassistant.components.discovergy.config_flow import CannotConnect, Inva... | [
"homeassistant.setup.async_setup_component",
"pydiscovergy.models.ConsumerToken",
"unittest.mock.MagicMock",
"pydiscovergy.models.AccessToken",
"unittest.mock.AsyncMock",
"unittest.mock.patch"
] | [((960, 971), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (969, 971), False, 'from unittest.mock import AsyncMock, MagicMock, patch\n'), ((1215, 1241), 'unittest.mock.AsyncMock', 'AsyncMock', ([], {'return_value': '[]'}), '(return_value=[])\n', (1224, 1241), False, 'from unittest.mock import AsyncMock, Ma... |
import logging
import click
from kfp import dsl
from typing import List, Dict, Callable
import kfp.dsl as dsl
from hypermodel.hml.hml_pipeline import HmlPipeline
from hypermodel.hml.hml_container_op import HmlContainerOp
from hypermodel.platform.abstract.services import PlatformServicesBase
@click.group(name="pipel... | [
"click.group",
"hypermodel.hml.hml_pipeline.HmlPipeline"
] | [((297, 326), 'click.group', 'click.group', ([], {'name': '"""pipelines"""'}), "(name='pipelines')\n", (308, 326), False, 'import click\n'), ((2020, 2239), 'hypermodel.hml.hml_pipeline.HmlPipeline', 'HmlPipeline', ([], {'cli': 'cli_pipeline_group', 'pipeline_func': 'pipeline_func', 'services': 'self.services', 'image_u... |
#encoding=utf8
## 参考https://blog.csdn.net/dengxing1234/article/details/73739836
import xgboost as xgb
from sklearn.datasets import load_svmlight_file
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_curve, auc, roc_auc_score
from sk... | [
"sklearn.datasets.load_svmlight_file",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.roc_auc_score",
"sklearn.linear_model.LogisticRegression",
"sklearn.preprocessing.data.OneHotEncoder",
"scipy.sparse.hstack",
"numpy.concatenate",
"xgboost.XGBClassifier"
] | [((536, 577), 'sklearn.datasets.load_svmlight_file', 'load_svmlight_file', (['libsvmFileNameInitial'], {}), '(libsvmFileNameInitial)\n', (554, 577), False, 'from sklearn.datasets import load_svmlight_file\n'), ((634, 696), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X_all', 'y_all'], {'test_size'... |
# read README.md file on my GitHub. It walks you through the instalation of necessary
# libraries, helps you solve common errors and provides useful references ;)
# https://github.com/scraptechguy/SpeechCheck
# import library to report time in debug printing
import datetime
# import elements from libraries for Mi... | [
"matplotlib.pyplot.imshow",
"nltk.probability.FreqDist",
"kivy.lang.Builder.load_string",
"azure.cognitiveservices.speech.SpeechRecognizer",
"azure.cognitiveservices.speech.SpeechConfig",
"nltk.tokenize.word_tokenize",
"wordcloud.WordCloud",
"datetime.datetime.now",
"azure.core.credentials.AzureKeyC... | [((1675, 1745), 'azure.cognitiveservices.speech.SpeechConfig', 'speechsdk.SpeechConfig', ([], {'subscription': 'speech_key', 'region': 'service_region'}), '(subscription=speech_key, region=service_region)\n', (1697, 1745), True, 'import azure.cognitiveservices.speech as speechsdk\n'), ((1816, 1871), 'azure.cognitiveser... |
from bento_meta.objects import Node
from bento_meta_shim.models.mdbproperty import MDBproperty
class MDBnode():
__node = None
"""give proper life"""
def __init__(self, node):
self.__node = node
self.kind = node.mapspec_['label']
self.name = node.handle
self.handle = node.ha... | [
"bento_meta_shim.models.mdbproperty.MDBproperty"
] | [((666, 708), 'bento_meta_shim.models.mdbproperty.MDBproperty', 'MDBproperty', ([], {'property': '_prop', 'key': 'tuple_key'}), '(property=_prop, key=tuple_key)\n', (677, 708), False, 'from bento_meta_shim.models.mdbproperty import MDBproperty\n')] |
import os
import requests
from urllib.error import URLError
from urllib.parse import urlparse
from urllib.request import urlopen
from luigi import Target, LocalTarget
from hashlib import sha1
from tasks.util import (query_cartodb, underscore_slugify, OBSERVATORY_PREFIX, OBSERVATORY_SCHEMA)
from tasks.meta import (OB... | [
"tasks.util.underscore_slugify",
"urllib.parse.urlparse",
"sqlalchemy.Table",
"lib.logger.get_logger",
"os.path.isfile",
"sqlalchemy.types.Enum",
"sqlalchemy.Column",
"tasks.meta.OBSColumnTable",
"tasks.meta.current_session",
"urllib.request.urlopen"
] | [((532, 552), 'lib.logger.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (542, 552), False, 'from lib.logger import get_logger\n'), ((1518, 1535), 'tasks.meta.current_session', 'current_session', ([], {}), '()\n', (1533, 1535), False, 'from tasks.meta import OBSColumn, OBSTable, metadata, Geometry, Poin... |
import pytest
import docker
import requests
name = "ctomcatapp"
@pytest.fixture
def error_fixture():
assert 0
def test_container():
client = docker.from_env()
container = client.containers.get(name)
assert container.status == "running"
def test_app():
response = requests.get('http://localhost:8... | [
"docker.from_env",
"requests.get"
] | [((153, 170), 'docker.from_env', 'docker.from_env', ([], {}), '()\n', (168, 170), False, 'import docker\n'), ((288, 332), 'requests.get', 'requests.get', (['"""http://localhost:8080/sample"""'], {}), "('http://localhost:8080/sample')\n", (300, 332), False, 'import requests\n')] |
#!/usr/bin/env python
# encoding: utf-8
"""
calc beat score of files
copyright: www.mgtv.com
"""
import os
import sys
import argparse
import numpy as np
import traceback
import beat_evaluation_toolbox as be
def calc_beat_score_of_file(annotation_file, beat_file):
#check input params
if os.pat... | [
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"beat_evaluation_toolbox.evaluate_db",
"os.chdir",
"numpy.expand_dims",
"sys.exit",
"os.path.abspath",
"numpy.loadtxt",
"traceback.print_exc"
] | [((640, 678), 'numpy.loadtxt', 'np.loadtxt', (['annotation_file'], {'usecols': '(0)'}), '(annotation_file, usecols=0)\n', (650, 678), True, 'import numpy as np\n'), ((703, 742), 'numpy.expand_dims', 'np.expand_dims', (['data_annotation'], {'axis': '(0)'}), '(data_annotation, axis=0)\n', (717, 742), True, 'import numpy ... |
from flask_wtf import FlaskForm
from wtforms import HiddenField, FloatField, SelectField, StringField, SubmitField, ValidationError
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.validators import Length, Optional, Required
from .. models import EventFrameAttributeTemplate, Lookup, LookupValue,... | [
"wtforms.SubmitField",
"wtforms.HiddenField",
"wtforms.validators.Required",
"wtforms.validators.Optional",
"wtforms.validators.Length"
] | [((1185, 1198), 'wtforms.HiddenField', 'HiddenField', ([], {}), '()\n', (1196, 1198), False, 'from wtforms import HiddenField, FloatField, SelectField, StringField, SubmitField, ValidationError\n'), ((1223, 1236), 'wtforms.HiddenField', 'HiddenField', ([], {}), '()\n', (1234, 1236), False, 'from wtforms import HiddenFi... |
from django.core.cache import cache
from asgiref.sync import async_to_sync
from celery import shared_task
from channels.layers import get_channel_layer
from cryptocompy import price
@shared_task
def update_cc_prices():
cryptocoins = ['ETH', 'BTC']
currencies = ['EUR', 'USD']
response = price.get_current_... | [
"cryptocompy.price.get_current_price",
"channels.layers.get_channel_layer",
"django.core.cache.cache.set",
"asgiref.sync.async_to_sync",
"django.core.cache.cache.get"
] | [((302, 350), 'cryptocompy.price.get_current_price', 'price.get_current_price', (['cryptocoins', 'currencies'], {}), '(cryptocoins, currencies)\n', (325, 350), False, 'from cryptocompy import price\n'), ((371, 390), 'channels.layers.get_channel_layer', 'get_channel_layer', ([], {}), '()\n', (388, 390), False, 'from cha... |
# Created: 17.02.2019
# Copyright (c) 2019, <NAME>
# License: MIT License
from typing import TYPE_CHECKING
import logging
from ezdxf.lldxf.attributes import DXFAttr, DXFAttributes, DefSubclass
from ezdxf.lldxf.const import DXF12, SUBCLASS_MARKER
from ezdxf.entities.dxfentity import base_class, SubclassProcessor, DXFEnt... | [
"logging.getLogger",
"ezdxf.lldxf.attributes.DXFAttr",
"ezdxf.lldxf.attributes.DXFAttributes"
] | [((429, 455), 'logging.getLogger', 'logging.getLogger', (['"""ezdxf"""'], {}), "('ezdxf')\n", (446, 455), False, 'import logging\n'), ((1296, 1359), 'ezdxf.lldxf.attributes.DXFAttributes', 'DXFAttributes', (['base_class', 'acdb_symbol_table_record', 'acdb_style'], {}), '(base_class, acdb_symbol_table_record, acdb_style... |
#
# Autogenerated by Thrift
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
# @generated
#
from __future__ import absolute_import
import sys
from thrift.util.Recursive import fix_spec
from thrift.Thrift import TType, TMessageType, TPriority, TRequestContext, TProcessorEventHandler, TServerInterfa... | [
"thrift.protocol.fastproto.encode",
"json.loads",
"thrift.protocol.fastproto.decode",
"pprint.pformat",
"thrift.util.Recursive.fix_spec",
"thrift.protocol.TProtocol.TProtocolException"
] | [((13246, 13267), 'thrift.util.Recursive.fix_spec', 'fix_spec', (['all_structs'], {}), '(all_structs)\n', (13254, 13267), False, 'from thrift.util.Recursive import fix_spec\n'), ((1600, 1719), 'thrift.protocol.fastproto.decode', 'fastproto.decode', (['self', 'iprot.trans', '[self.__class__, self.thrift_spec, False]'], ... |
import subprocess
from ripple.runners.base_runner import BaseRunner
from ripple import logger
import os
import time
import fcntl
class SlurmRunner(BaseRunner):
"""
A job runner for slurm jobs.
"""
def non_block_read(self, output):
fd = output.fileno()
fl = fcntl.fcntl(fd, fcntl.F_GETFL... | [
"ripple.logger.info",
"subprocess.Popen",
"time.sleep",
"fcntl.fcntl"
] | [((291, 321), 'fcntl.fcntl', 'fcntl.fcntl', (['fd', 'fcntl.F_GETFL'], {}), '(fd, fcntl.F_GETFL)\n', (302, 321), False, 'import fcntl\n'), ((330, 380), 'fcntl.fcntl', 'fcntl.fcntl', (['fd', 'fcntl.F_SETFL', '(fl | os.O_NONBLOCK)'], {}), '(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)\n', (341, 380), False, 'import fcntl\n'), (... |
from __future__ import print_function
def one(a=123, b='234', c={'3': [4, '5']}):
for i in range(1): # one
a = b = c['side'] = 'effect'
two()
def two(a=123, b='234', c={'3': [4, '5']}):
for i in range(1): # two
a = b = c['side'] = 'effect'
three()
def three(a=123, b='234'... | [
"utils.DebugCallPrinter"
] | [((904, 934), 'utils.DebugCallPrinter', 'DebugCallPrinter', (['""" [backlog]"""'], {}), "(' [backlog]')\n", (920, 934), False, 'from utils import DebugCallPrinter\n')] |
#!/usr/bin/env python
"""Basic operations on dataframes."""
import pandas as pd
# This script isn't for execution, just for notes
# explore the shape and contents of a dataframe
df.describe()
df.info()
df.shape
df.columns
df.index
df.head(10)
df.tail(10)
type(df)
# <class 'pandas.core.frame.DataFrame'>
type(df['a']... | [
"pandas.to_numeric"
] | [((1341, 1385), 'pandas.to_numeric', 'pd.to_numeric', (["df['number']"], {'errors': '"""coerce"""'}), "(df['number'], errors='coerce')\n", (1354, 1385), True, 'import pandas as pd\n')] |
import numpy as np
def permutation_value(num_list, max_num):
return sum([num_list[i]*max_num**(len(num_list)-1-i) for i in range(len(num_list))])
def permutation_update(in_list):
pass
init_array = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
init_array.astype('int64')
#ULØST!
| [
"numpy.array"
] | [((222, 262), 'numpy.array', 'np.array', (['[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]'], {}), '([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])\n', (230, 262), True, 'import numpy as np\n')] |
import sys
from PyQt4 import QtGui, QtCore
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
import numpy
from math import sqrt, sin, cos, pi
from geometry.quaternion import Quaternion
class StripChart(QtGui.QWidget):
""" a class to implement a stripchart using the pyqtgraph plotting
utilities
... | [
"pyqtgraph.PlotCurveItem",
"numpy.isscalar",
"pyqtgraph.ScatterPlotItem",
"numpy.append",
"numpy.array",
"numpy.zeros",
"numpy.isnan"
] | [((4031, 4061), 'numpy.zeros', 'numpy.zeros', (['(len_x, len_y, 3)'], {}), '((len_x, len_y, 3))\n', (4042, 4061), False, 'import numpy\n'), ((1242, 1260), 'numpy.isscalar', 'numpy.isscalar', (['xd'], {}), '(xd)\n', (1256, 1260), False, 'import numpy\n'), ((1392, 1407), 'numpy.array', 'numpy.array', (['yd'], {}), '(yd)\... |
from typing import Tuple, Dict
import h5py
import pandas as pd
import numpy as np
from loguru import logger
from ruamel.yaml import YAML
from joblib import load, dump
from umda import EmbeddingModel
from sklearn.gaussian_process import GaussianProcessRegressor, kernels
from sklearn.neighbors import KNeighborsRegressor... | [
"sklearn.model_selection.GridSearchCV",
"sklearn.metrics.pairwise.cosine_distances",
"numpy.hstack",
"ruamel.yaml.YAML",
"sklearn.model_selection.KFold",
"sklearn.metrics.r2_score",
"pandas.read_pickle",
"loguru.logger.add",
"sklearn.gaussian_process.GaussianProcessRegressor",
"sklearn.ensemble.Ra... | [((2628, 2670), 'sklearn.model_selection.KFold', 'KFold', (['cv'], {'random_state': 'seed', 'shuffle': '(True)'}), '(cv, random_state=seed, shuffle=True)\n', (2633, 2670), False, 'from sklearn.model_selection import KFold, GridSearchCV, ShuffleSplit\n'), ((2689, 2791), 'sklearn.model_selection.GridSearchCV', 'GridSearc... |
"""Module that allows QE to interface with cephadm bootstrap CLI."""
import logging
from typing import Dict
from ceph.ceph import ResourceNotFoundError
from utility.utils import get_cephci_config
from .common import config_dict_to_string
from .typing_ import CephAdmProtocol
logger = logging.getLogger(__name__)
cla... | [
"logging.getLogger",
"utility.utils.get_cephci_config",
"ceph.ceph.ResourceNotFoundError"
] | [((287, 314), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (304, 314), False, 'import logging\n'), ((1266, 1285), 'utility.utils.get_cephci_config', 'get_cephci_config', ([], {}), '()\n', (1283, 1285), False, 'from utility.utils import get_cephci_config\n'), ((2593, 2648), 'ceph.ceph.Re... |
from subprocess import call
from os import path
class Task:
def __init__(self, data, pkg_dir):
self.action = data["action"]
self.source = data["source"]
self.target = data["target"]
self.pkg_dir = pkg_dir
def run(self, command, test_mode=False):
if test_mode:
return False
result = ... | [
"os.path.abspath",
"subprocess.call",
"os.path.expanduser"
] | [((320, 333), 'subprocess.call', 'call', (['command'], {}), '(command)\n', (324, 333), False, 'from subprocess import call\n'), ((539, 567), 'os.path.expanduser', 'path.expanduser', (['self.target'], {}), '(self.target)\n', (554, 567), False, 'from os import path\n'), ((773, 799), 'os.path.abspath', 'path.abspath', (['... |
def resolve():
'''
code here
'''
from sys import stdin
N = int(input())
def lcs(a, b):
num_a = len(a)
num_b = len(b)
dp2 = [0]*(num_b+1)
for i in range(num_a):
dp1 = dp2[:]
for j in range(num_b):
if dp2[j] >= dp1[j+... | [
"sys.stdin.readline"
] | [((613, 629), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (627, 629), False, 'from sys import stdin\n'), ((639, 655), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (653, 655), False, 'from sys import stdin\n')] |
import partitura as pt
def addnote(midipitch, part, voice, start, end, idx):
"""
adds a single note by midiptich to a part
"""
offset = midipitch%12
octave = int(midipitch-offset)/12
name = [("C",0),
("C",1),
("D",0),
("D",1),
("E",0),
... | [
"partitura.score.Part"
] | [((775, 854), 'partitura.score.Part', 'pt.score.Part', (['"""P0"""', '"""part from progression"""'], {'quarter_duration': 'quarter_duration'}), "('P0', 'part from progression', quarter_duration=quarter_duration)\n", (788, 854), True, 'import partitura as pt\n')] |
import re
import textwrap
import discord
import asyncio
import random
import os
client = discord.Client()
token = os.environ['DISCORD_BOT_TOKEN']
@client.event
async def on_ready():
await client.change_presence(activity=discord.Game(name=',help | v1.0β'))
# or, for watching:
activity = discord.Activity(n... | [
"textwrap.dedent",
"discord.Game",
"discord.Activity",
"discord.Client",
"re.sub"
] | [((90, 106), 'discord.Client', 'discord.Client', ([], {}), '()\n', (104, 106), False, 'import discord\n'), ((302, 375), 'discord.Activity', 'discord.Activity', ([], {'name': '""",help | v1.0β"""', 'type': 'discord.ActivityType.playing'}), "(name=',help | v1.0β', type=discord.ActivityType.playing)\n", (318, 375), False,... |
"""
Created on 21 Aug 2013
@author: Anna
"""
import math
import numpy
import random
from .Globals import G
class Allocation:
def __init__(self, itemList, week, altRoutes, excBuffer):
self.week = week
self.altRoutes = altRoutes
self.itemList = itemList
self.excBuffer = excBuffer
... | [
"random.choice",
"math.fabs"
] | [((6488, 6508), 'random.choice', 'random.choice', (['maxID'], {}), '(maxID)\n', (6501, 6508), False, 'import random\n'), ((2776, 2798), 'math.fabs', 'math.fabs', (['excessUnits'], {}), '(excessUnits)\n', (2785, 2798), False, 'import math\n'), ((2853, 2875), 'math.fabs', 'math.fabs', (['excessUnits'], {}), '(excessUnits... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__copyright__ = "Copyright (C) <NAME>"
import csv
import logging
import os
import signal
import socket
import sys
import time
import paho.mqtt.client as mqtt
import protobix
if sys.version_info >= (3, 0):
import configparser
else:
import Co... | [
"logging.basicConfig",
"signal.signal",
"logging.debug",
"ConfigParser.RawConfigParser",
"socket.getfqdn",
"paho.mqtt.client.Client",
"time.sleep",
"protobix.DataContainer",
"csv.reader",
"sys.exit",
"os.getpid",
"logging.info"
] | [((487, 517), 'ConfigParser.RawConfigParser', 'configparser.RawConfigParser', ([], {}), '()\n', (515, 517), True, 'import ConfigParser as configparser\n'), ((1214, 1246), 'paho.mqtt.client.Client', 'mqtt.Client', ([], {'client_id': 'client_id'}), '(client_id=client_id)\n', (1225, 1246), True, 'import paho.mqtt.client a... |
from adminsortable2.admin import SortableInlineAdminMixin
from django.contrib import admin
from .forms import GlobalOptionsInlineForm, ChartOptionsInlineForm, DatasetOptionsInlineForm, AxisOptionsInlineForm, \
ColorInputForm
from .models import GlobalOptionsGroupModel, GlobalOptionsModel, \
ChartOptionsGroupMo... | [
"django.contrib.admin.register"
] | [((1682, 1721), 'django.contrib.admin.register', 'admin.register', (['GlobalOptionsGroupModel'], {}), '(GlobalOptionsGroupModel)\n', (1696, 1721), False, 'from django.contrib import admin\n'), ((1914, 1952), 'django.contrib.admin.register', 'admin.register', (['ChartOptionsGroupModel'], {}), '(ChartOptionsGroupModel)\n... |
# Generated by Django 3.1.7 on 2021-03-02 15:10
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('shop', '0001_initial'),
migrations.swappable_dependency(setting... | [
"django.db.migrations.AlterUniqueTogether",
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey"
] | [((281, 338), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (312, 338), False, 'from django.db import migrations, models\n'), ((867, 963), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', (... |
# Generated by Django 2.2.7 on 2020-04-22 13:16
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("core", "0012_remove_subj... | [
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency"
] | [((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'), ((482, 704), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'h... |
"""
This component provides support for Home Automation Manager (HAM).
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/edgeos/
"""
import logging
import sys
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant... | [
"logging.getLogger",
"sys.exc_info"
] | [((460, 487), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (477, 487), False, 'import logging\n'), ((991, 1005), 'sys.exc_info', 'sys.exc_info', ([], {}), '()\n', (1003, 1005), False, 'import sys\n')] |
# Generated by Django 3.2 on 2021-06-14 21:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Cinema', '0010_merge_0009_auto_20210611_1256_0009_auto_20210611_1549'),
]
operations = [
migrations.RemoveField(
model_name='purch... | [
"django.db.models.ImageField",
"django.db.migrations.RemoveField",
"django.db.models.ManyToManyField",
"django.db.models.BooleanField"
] | [((267, 330), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""purchase"""', 'name': '"""discounts"""'}), "(model_name='purchase', name='discounts')\n", (289, 330), False, 'from django.db import migrations, models\n'), ((476, 535), 'django.db.models.ManyToManyField', 'models.ManyToM... |
from django.contrib import admin
from .models import Post, Draft
from import_export.admin import ImportExportModelAdmin
# Register your models here.
# admin.site.register(Post)
# admin.site.register(Draft)
@admin.register(Draft)
@admin.register(Post)
class ViewAdmin(ImportExportModelAdmin):
pass
| [
"django.contrib.admin.register"
] | [((210, 231), 'django.contrib.admin.register', 'admin.register', (['Draft'], {}), '(Draft)\n', (224, 231), False, 'from django.contrib import admin\n'), ((233, 253), 'django.contrib.admin.register', 'admin.register', (['Post'], {}), '(Post)\n', (247, 253), False, 'from django.contrib import admin\n')] |
#!/usr/bin/env python
# -*- coding: utf-8
import numpy as np
from ibidem.advent_of_code.util import get_input_name
BASE_PATTERN = [0, 1, 0, -1]
def pattern_generator(i):
first = True
while True:
for v in BASE_PATTERN:
for _ in range(i + 1):
if first:
... | [
"numpy.tile",
"numpy.flip",
"numpy.abs",
"numpy.array",
"ibidem.advent_of_code.util.get_input_name"
] | [((873, 901), 'numpy.tile', 'np.tile', (['signal', 'repetitions'], {}), '(signal, repetitions)\n', (880, 901), True, 'import numpy as np\n'), ((1195, 1220), 'numpy.array', 'np.array', (['signal[offset:]'], {}), '(signal[offset:])\n', (1203, 1220), True, 'import numpy as np\n'), ((697, 707), 'numpy.abs', 'np.abs', (['cs... |
import pandas as pd
import os
import numpy as np
import math
import ast
sigma_list = [ math.pow(2,i) for i in range(8)]
for sigma in sigma_list:
test_case = 'mnist'
data_dict={}
data_dict_sum={}
# for key in def_data.keys():
# data_dict[key] = def_data[key].tolist()
file_name=os.path.... | [
"math.pow",
"numpy.sum",
"pandas.DataFrame.from_dict",
"pandas.read_csv"
] | [((88, 102), 'math.pow', 'math.pow', (['(2)', 'i'], {}), '(2, i)\n', (96, 102), False, 'import math\n'), ((423, 455), 'pandas.read_csv', 'pd.read_csv', (['file_name'], {'sep': '"""\t"""'}), "(file_name, sep='\\t')\n", (434, 455), True, 'import pandas as pd\n'), ((468, 504), 'pandas.read_csv', 'pd.read_csv', (['file_nam... |
import argparse
import logging
import sys
import json
from pprint import pprint
from deepdiff import DeepDiff
from mungetout import convert
from mungetout import __version__
__author__ = "<NAME>"
__copyright__ = "<NAME>"
__license__ = "apache"
_logger = logging.getLogger(__name__)
def parse_args(args):
"""Par... | [
"logging.getLogger",
"logging.basicConfig",
"deepdiff.DeepDiff",
"argparse.ArgumentParser",
"json.load",
"pprint.pprint"
] | [((258, 285), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (275, 285), False, 'import logging\n'), ((523, 577), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Basic json diff"""'}), "(description='Basic json diff')\n", (546, 577), False, 'import argparse\... |
import pprint
from pathlib import Path
from typing import Optional
import typer
from embeddings.defaults import RESULTS_PATH
from embeddings.evaluator.sequence_labeling_evaluator import SequenceLabelingEvaluator
from embeddings.pipeline.flair_sequence_labeling import FlairSequenceLabelingPipeline
app = typer.Typer()... | [
"embeddings.defaults.RESULTS_PATH.joinpath",
"pathlib.Path",
"typer.Option",
"typer.Typer",
"pprint.pformat",
"embeddings.pipeline.flair_sequence_labeling.FlairSequenceLabelingPipeline",
"typer.run"
] | [((307, 320), 'typer.Typer', 'typer.Typer', ([], {}), '()\n', (318, 320), False, 'import typer\n'), ((1859, 1873), 'typer.run', 'typer.run', (['run'], {}), '(run)\n', (1868, 1873), False, 'import typer\n'), ((358, 456), 'typer.Option', 'typer.Option', (['"""allegro/herbert-base-cased"""'], {'help': '"""Hugging Face emb... |