code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
cv2.imshow('frame', frame)
cap.release()
cv2.destroyAllWindows() | [
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.imshow"
] | [((40, 59), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (56, 59), False, 'import cv2\n'), ((154, 177), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (175, 177), False, 'import cv2\n'), ((109, 135), 'cv2.imshow', 'cv2.imshow', (['"""frame"""', 'frame'], {}), "('frame', frame)\n"... |
# import key libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from wordcloud import WordCloud, STOPWORDS
import nltk
import re
from nltk.stem import PorterStemmer, WordNetLemmatizer
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize,... | [
"pandas.read_csv",
"nltk.download",
"tensorflow.keras.preprocessing.sequence.pad_sequences",
"tensorflow.keras.layers.Dense",
"gensim.utils.simple_preprocess",
"matplotlib.pyplot.imshow",
"nltk.corpus.stopwords.words",
"tensorflow.keras.models.Sequential",
"sklearn.metrics.confusion_matrix",
"tens... | [((925, 959), 'pandas.read_csv', 'pd.read_csv', (['"""stock_sentiment.csv"""'], {}), "('stock_sentiment.csv')\n", (936, 959), True, 'import pandas as pd\n'), ((2040, 2066), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (2053, 2066), False, 'import nltk\n'), ((2068, 2094), 'nltk.corpus.... |
import sys
import math
positions = [int(x) for x in sys.stdin.readline().strip().split(",")]
mean = sum(positions) / len(positions)
mUpper = math.ceil(mean)
mLower = math.floor(mean)
cost = {mUpper: 0, mLower: 0}
for pos in positions:
for m in [mUpper, mLower]:
diff = abs(pos - m)
cost[m] += (dif... | [
"sys.stdin.readline",
"math.ceil",
"math.floor"
] | [((143, 158), 'math.ceil', 'math.ceil', (['mean'], {}), '(mean)\n', (152, 158), False, 'import math\n'), ((168, 184), 'math.floor', 'math.floor', (['mean'], {}), '(mean)\n', (178, 184), False, 'import math\n'), ((53, 73), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (71, 73), False, 'import sys\n')] |
from django import template
register = template.Library()
@register.filter
def can_view(obj, user):
return obj.can_view(user)
@register.filter
def can_change(obj, user):
return obj.can_change(user)
@register.filter
def can_execute(obj, user):
return obj.can_execute(user)
@register.filter
def can_delete... | [
"django.template.Library"
] | [((40, 58), 'django.template.Library', 'template.Library', ([], {}), '()\n', (56, 58), False, 'from django import template\n')] |
from aiohttp import web
from aiohttp.web_response import ContentCoding
from functools import wraps
COMPRESS_FASTEST = 1
BASE_STRING_SIZE = 49
MTU_TCP_PACKET_SIZE = 1500
COMPRESS_THRESHOLD = MTU_TCP_PACKET_SIZE + BASE_STRING_SIZE
def json_response(func):
""" @json_response decorator adds header and dumps response objec... | [
"functools.wraps",
"aiohttp.web.json_response"
] | [((328, 339), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (333, 339), False, 'from functools import wraps\n'), ((456, 483), 'aiohttp.web.json_response', 'web.json_response', ([], {'data': 'res'}), '(data=res)\n', (473, 483), False, 'from aiohttp import web\n')] |
# modified from utils/models/segmentation/erfnet.py
# load pretrained weights during initialization of encoder
import torch
import torch.nn as nn
import torch.nn.functional as F
from .common_models import non_bottleneck_1d
from .builder import MODELS
class DownsamplerBlock(nn.Module):
def __init__(self, ninput,... | [
"torch.nn.BatchNorm2d",
"torch.nn.ModuleList",
"torch.load",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.functional.relu"
] | [((378, 453), 'torch.nn.Conv2d', 'nn.Conv2d', (['ninput', '(noutput - ninput)', '(3, 3)'], {'stride': '(2)', 'padding': '(1)', 'bias': '(True)'}), '(ninput, noutput - ninput, (3, 3), stride=2, padding=1, bias=True)\n', (387, 453), True, 'import torch.nn as nn\n'), ((472, 497), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', (['(... |
# -*- coding: utf-8 -*-
# @Author: xiaodong
# @Date : 2021/5/27
from elasticsearch import Elasticsearch
from .question import ElasticSearchQuestion
from ...setting import ELASTICSEARCH_HOST
ElasticSearchQuestion.es = Elasticsearch(ELASTICSEARCH_HOST)
esq = ElasticSearchQuestion("mm_question")
| [
"elasticsearch.Elasticsearch"
] | [((222, 255), 'elasticsearch.Elasticsearch', 'Elasticsearch', (['ELASTICSEARCH_HOST'], {}), '(ELASTICSEARCH_HOST)\n', (235, 255), False, 'from elasticsearch import Elasticsearch\n')] |
"""Jednostavni SQL parser, samo za nizove CREATE i SELECT naredbi.
Ovaj fragment SQLa je zapravo regularan -- nigdje nema ugnježđivanja!
Semantički analizator u obliku name resolvera:
provjerava jesu li svi selektirani stupci prisutni, te broji pristupe.
Na dnu je lista ideja za dalji razvoj.
"""
from pj import ... | [
"backend.PristupLog"
] | [((3570, 3592), 'backend.PristupLog', 'PristupLog', (['stupac.tip'], {}), '(stupac.tip)\n', (3580, 3592), False, 'from backend import PristupLog\n')] |
# MIT License
# Copyright (c) 2018 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish... | [
"pytest.fixture",
"pyTD.cache.MemCache"
] | [((1188, 1234), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""', 'autouse': '(True)'}), "(scope='function', autouse=True)\n", (1202, 1234), False, 'import pytest\n'), ((1359, 1369), 'pyTD.cache.MemCache', 'MemCache', ([], {}), '()\n', (1367, 1369), False, 'from pyTD.cache import MemCache\n'), ((1544... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11a1 on 2017-05-11 08:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='allBoo... | [
"django.db.models.EmailField",
"django.db.models.DateField",
"django.db.models.TimeField",
"django.db.models.IntegerField",
"django.db.models.AutoField",
"django.db.models.BigIntegerField",
"django.db.models.CharField"
] | [((368, 461), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (384, 461), False, 'from django.db import migrations, models\... |
import os
import sys
sys.path.append('../')
import fire
import pickle
import json
def run_command(command):
if os.system(command) != 0:
raise RuntimeError()
def work_with_one_model(cleared_corpus_path, ling_data, output_dir):
if not os.path.exists(output_dir):
os.mkdir(output_dir)
... | [
"os.path.exists",
"fire.Fire",
"os.path.join",
"pickle.load",
"os.mkdir",
"json.load",
"os.system",
"sys.path.append",
"json.dump"
] | [((21, 43), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (36, 43), False, 'import sys\n'), ((763, 804), 'os.path.join', 'os.path.join', (['output_dir', '"""features.pckl"""'], {}), "(output_dir, 'features.pckl')\n", (775, 804), False, 'import os\n'), ((3814, 3859), 'os.path.join', 'os.path.jo... |
from ...isa.inst import *
import numpy as np
class Vwmacc_vv(Inst):
name = 'vwmacc.vv'
# vwmacc.vv vd, vs1, vs2, vm
def golden(self):
if self['vl']==0:
return self['ori']
result = self['ori'].copy()
maskflag = 1 if 'mask' in self else 0
vstart = self['v... | [
"numpy.unpackbits"
] | [((455, 501), 'numpy.unpackbits', 'np.unpackbits', (["self['mask']"], {'bitorder': '"""little"""'}), "(self['mask'], bitorder='little')\n", (468, 501), True, 'import numpy as np\n')] |
# Generated by Django 2.0.9 on 2018-12-08 12:25
from django.db import migrations, models
import django_reactive.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='TestModel',
fields=[
... | [
"django.db.models.AutoField"
] | [((334, 427), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (350, 427), False, 'from django.db import migrations, models\... |
from jinfo.tables import (
DNA_VOCAB,
RNA_VOCAB,
AA_VOCAB,
CODON_TABLE,
RC_TABLE,
NT_MW_TABLE,
AA_MW_TABLE,
)
class SeqVocabError(Exception):
pass
class SeqLengthError(Exception):
pass
class UnknownBaseError(Exception):
pass
class BaseSeq:
"""
Parent class for DNA... | [
"jinfo.one_hot_dna",
"jinfo.utils.percentage_identity.percentage_identity",
"textwrap.fill",
"jinfo.utils.multialign.multialign",
"primer3.calcTm"
] | [((1724, 1767), 'jinfo.utils.multialign.multialign', 'multialign', (['[self, seq2]'], {'maxiters': 'maxiters'}), '([self, seq2], maxiters=maxiters)\n', (1734, 1767), False, 'from jinfo.utils.multialign import multialign\n'), ((2008, 2039), 'jinfo.utils.percentage_identity.percentage_identity', 'percentage_identity', ([... |
# coding: utf-8
import pygame
from engine.flappy_engine import FlappyEngine
from entities.bird import Bird
class ManualFlappyEngine(FlappyEngine):
def __init__(self):
self.birds = [Bird(name="Manual")]
def get_birds(self):
return self.birds
def on_update(self, next_pipe_x, next_pipe_y)... | [
"scenes.home_scene.HomeScene",
"entities.bird.Bird"
] | [((197, 216), 'entities.bird.Bird', 'Bird', ([], {'name': '"""Manual"""'}), "(name='Manual')\n", (201, 216), False, 'from entities.bird import Bird\n'), ((1156, 1171), 'scenes.home_scene.HomeScene', 'HomeScene', (['game'], {}), '(game)\n', (1165, 1171), False, 'from scenes.home_scene import HomeScene\n')] |
from .todo_item_repository_interface import TodoItemRepositoryInterface
from ..models import TodoItem
from asyncpg.connection import Connection
from holobot.sdk.database import DatabaseManagerInterface
from holobot.sdk.database.queries import Query
from holobot.sdk.database.queries.enums import Equality
from holobot.sd... | [
"holobot.sdk.ioc.decorators.injectable",
"holobot.sdk.database.queries.Query.select",
"holobot.sdk.database.queries.Query.insert"
] | [((392, 431), 'holobot.sdk.ioc.decorators.injectable', 'injectable', (['TodoItemRepositoryInterface'], {}), '(TodoItemRepositoryInterface)\n', (402, 431), False, 'from holobot.sdk.ioc.decorators import injectable\n'), ((2596, 2610), 'holobot.sdk.database.queries.Query.insert', 'Query.insert', ([], {}), '()\n', (2608, 2... |
import collections
import re
import numpy
import pytest
import random
import time
import nidaqmx
from nidaqmx.constants import (
AcquisitionType, BusType, RegenerationMode)
from nidaqmx.error_codes import DAQmxErrors
from nidaqmx.utils import flatten_channel_string
from nidaqmx.tests.fixtures import x_series_devi... | [
"nidaqmx.Task",
"nidaqmx.stream_writers.AnalogUnscaledWriter",
"numpy.zeros",
"pytest.raises",
"pytest.skip"
] | [((859, 899), 'pytest.skip', 'pytest.skip', (['"""Requires a plugin device."""'], {}), "('Requires a plugin device.')\n", (870, 899), False, 'import pytest\n'), ((1031, 1045), 'nidaqmx.Task', 'nidaqmx.Task', ([], {}), '()\n', (1043, 1045), False, 'import nidaqmx\n'), ((1842, 1930), 'nidaqmx.stream_writers.AnalogUnscale... |
import argparse
import json
import os
import re
import shutil
import subprocess
from pathlib import Path
"""
See https://wphelp365.com/blog/ultimate-guide-downloading-converting-aax-mp3/
on how to use.
Step 3 + 4 will get activation bytes.
Example:
python convert.py -i "The Tower of the Swallow.aax" -a xxxxxx
where... | [
"subprocess.check_output",
"json.loads",
"argparse.ArgumentParser",
"pathlib.Path",
"shutil.which"
] | [((392, 415), 'shutil.which', 'shutil.which', (['"""ffprobe"""'], {}), "('ffprobe')\n", (404, 415), False, 'import shutil\n'), ((606, 659), 'subprocess.check_output', 'subprocess.check_output', (['cmd'], {'universal_newlines': '(True)'}), '(cmd, universal_newlines=True)\n', (629, 659), False, 'import subprocess\n'), ((... |
import logging
import discord
from redbot.core import Config, bank, commands
from redbot.core.utils.chat_formatting import escape, humanize_list, humanize_number, inline
log = logging.getLogger("red.flare.gamenotify")
class Gamenotify(commands.Cog):
"""Sub to game pings"""
__version__ = "0.0.1"
def fo... | [
"logging.getLogger",
"redbot.core.commands.mod",
"redbot.core.commands.cooldown",
"redbot.core.Config.get_conf",
"redbot.core.commands.guild_only",
"redbot.core.commands.command",
"redbot.core.utils.chat_formatting.escape"
] | [((178, 219), 'logging.getLogger', 'logging.getLogger', (['"""red.flare.gamenotify"""'], {}), "('red.flare.gamenotify')\n", (195, 219), False, 'import logging\n'), ((674, 725), 'redbot.core.commands.cooldown', 'commands.cooldown', (['(1)', '(300)', 'commands.BucketType.user'], {}), '(1, 300, commands.BucketType.user)\n... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import edtf.fields
class Migration(migrations.Migration):
dependencies = [
('gk_collections_work_creator', '0029_auto_20170523_1149'),
]
operations = [
migrations.AddField(
... | [
"django.db.models.TextField"
] | [((393, 496), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'help_text': "b'A document brief describing the purpose of this content'"}), "(blank=True, help_text=\n b'A document brief describing the purpose of this content')\n", (409, 496), False, 'from django.db import migrations, models... |
import re
import six
import datetime
from urllib import urlencode
from django.conf import settings
from django.http import HttpResponse
from django.core.exceptions import ObjectDoesNotExist
from django.urls import reverse
from django.utils.encoding import force_text
import debug # pyflakes:... | [
"django.utils.module_loading.module_has_submodule",
"importlib.import_module",
"tastypie.utils.is_valid_jsonp_callback_value",
"re.compile",
"tastypie.bundle.Bundle",
"tastypie.api.Api",
"tastypie.exceptions.ApiFieldError",
"django.utils.encoding.force_text",
"urllib.urlencode",
"django.urls.rever... | [((5887, 5996), 're.compile', 're.compile', (['"""^(?P<days>\\\\d+d)?\\\\s?(?P<hours>\\\\d+h)?\\\\s?(?P<minutes>\\\\d+m)?\\\\s?(?P<seconds>\\\\d+s?)$"""'], {}), "(\n '^(?P<days>\\\\d+d)?\\\\s?(?P<hours>\\\\d+h)?\\\\s?(?P<minutes>\\\\d+m)?\\\\s?(?P<seconds>\\\\d+s?)$'\n )\n", (5897, 5996), False, 'import re\n'), (... |
from kubernetes import client
from kubernetes.watch import Watch
from loguru import logger
from .consts import CONTAINER_NAME, DEPLOYMENT_PREFIX, NAMESPACE
def create_deployment(v1, image, num_replicas):
container = client.V1Container(name=CONTAINER_NAME, image=image)
container_spec = client.V1PodSpec(contai... | [
"kubernetes.client.V1ObjectMeta",
"kubernetes.watch.Watch",
"loguru.logger.info",
"kubernetes.client.V1PodSpec",
"kubernetes.client.V1ScaleSpec",
"loguru.logger.trace",
"kubernetes.client.V1Deployment",
"kubernetes.client.V1PodTemplateSpec",
"kubernetes.client.V1Container",
"kubernetes.client.V1De... | [((223, 275), 'kubernetes.client.V1Container', 'client.V1Container', ([], {'name': 'CONTAINER_NAME', 'image': 'image'}), '(name=CONTAINER_NAME, image=image)\n', (241, 275), False, 'from kubernetes import client\n'), ((297, 337), 'kubernetes.client.V1PodSpec', 'client.V1PodSpec', ([], {'containers': '[container]'}), '(c... |
import magma as m
from magma import DefineCircuit, EndCircuit, In, Out, Bit, Clock, wire
from magma.backend.verilog import compile
from mantle.xilinx.spartan6 import FDCE
def test_fdce():
main = DefineCircuit('main', 'I', In(Bit), "O", Out(Bit), "CLK", In(Clock))
dff = FDCE()
wire(m.enable(1), dff.CE)
... | [
"magma.EndCircuit",
"magma.backend.verilog.compile",
"magma.In",
"mantle.xilinx.spartan6.FDCE",
"magma.enable",
"magma.Out",
"magma.wire"
] | [((280, 286), 'mantle.xilinx.spartan6.FDCE', 'FDCE', ([], {}), '()\n', (284, 286), False, 'from mantle.xilinx.spartan6 import FDCE\n'), ((321, 337), 'magma.wire', 'wire', (['(0)', 'dff.CLR'], {}), '(0, dff.CLR)\n', (325, 337), False, 'from magma import DefineCircuit, EndCircuit, In, Out, Bit, Clock, wire\n'), ((342, 36... |
from bandit.containers.container import Container
import torch as torch
from collections import OrderedDict
from bandit.functional import estimator_sample,estimator_ledoit_wolf
class Portfolio(Container):
"""
portfolio class
"""
def __init__(self, container_id=-1, module={"file": "eg", "name": "EG"}, ... | [
"collections.OrderedDict",
"torch.topk",
"torch.sum",
"bandit.functional.estimator_ledoit_wolf",
"torch.dot"
] | [((856, 869), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (867, 869), False, 'from collections import OrderedDict\n'), ((2511, 2524), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2522, 2524), False, 'from collections import OrderedDict\n'), ((1307, 1343), 'torch.dot', 'torch.dot', (['las... |
'''
Created on Mar 1, 2022
@author: mballance
'''
import importlib
import sys
from tblink_rpc_core.endpoint import Endpoint
from tblink_rpc_gw.rt.cocotb.mgr import Mgr
def run_cocotb(ep : Endpoint):
# cocotb has a native module for interfacing with the
# simulator. We need to provide our own cocotb 'simula... | [
"cocotb._initialise_testbench",
"tblink_rpc_gw.rt.cocotb.mgr.Mgr.inst",
"importlib.import_module",
"tblink_rpc.cocotb_compat._set_ep"
] | [((449, 506), 'importlib.import_module', 'importlib.import_module', (['"""tblink_rpc.rt.cocotb.simulator"""'], {}), "('tblink_rpc.rt.cocotb.simulator')\n", (472, 506), False, 'import importlib\n'), ((742, 767), 'tblink_rpc.cocotb_compat._set_ep', 'cocotb_compat._set_ep', (['ep'], {}), '(ep)\n', (763, 767), False, 'from... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*- ########################################################
# ____ _ __ #
# ___ __ __/ / /__ ___ ______ ______(_) /___ __ #
# / _ \/ // / / (_-</ -_) __/ // / __/ / __/ // / ... | [
"modules.libs.base.Base.__init__",
"concurrent.futures.ThreadPoolExecutor"
] | [((1606, 1639), 'modules.libs.base.Base.__init__', 'Base.__init__', (['self', 'target', 'opts'], {}), '(self, target, opts)\n', (1619, 1639), False, 'from modules.libs.base import Base, tool, timeout\n'), ((2197, 2227), 'concurrent.futures.ThreadPoolExecutor', 'cf.ThreadPoolExecutor', (['threads'], {}), '(threads)\n', ... |
"""
Dynamic Connection Creation from a Variable
This file contains one ongoing DAG that executes every 15 minutes.
This DAG makes use of one custom operator:
- CreateConnectionsFromVariable
https://github.com/airflow-plugins/variable_connection_plugin/blob/master/operator/variable_connection_operator.py#L36
... | [
"datetime.datetime",
"airflow.operators.CreateConnectionsFromVariable",
"airflow.DAG"
] | [((890, 1001), 'airflow.DAG', 'DAG', (['"""__VARIABLE_CONNECTION_CREATION__"""'], {'schedule_interval': '"""*/15 * * * *"""', 'default_args': 'args', 'catchup': '(False)'}), "('__VARIABLE_CONNECTION_CREATION__', schedule_interval='*/15 * * * *',\n default_args=args, catchup=False)\n", (893, 1001), False, 'from airfl... |
from __future__ import annotations
import json
from collections.abc import Callable, Sequence
from typing import Any
import pytest
import websockets
from asgiref.typing import ASGI3Application, HTTPScope, WebSocketScope
from asphalt.core import Component, Context, inject, require_resource, resource
from fastapi impor... | [
"asphalt.core.require_resource",
"fastapi.FastAPI",
"asphalt.web.fastapi.AsphaltDepends",
"starlette.responses.Response",
"asphalt.web.fastapi.FastAPIComponent",
"starlette.responses.JSONResponse",
"pytest.mark.parametrize",
"websockets.connect",
"pytest.raises",
"asphalt.core.Context",
"httpx.A... | [((633, 689), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""method"""', "['static', 'dynamic']"], {}), "('method', ['static', 'dynamic'])\n", (656, 689), False, 'import pytest\n'), ((2421, 2477), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""method"""', "['static', 'dynamic']"], {}), "('meth... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 7 17:56:07 2020
Author: <NAME>"""
import regex as re
import pandas as pd
import time;
from random import randint
import os
import os.path
import errno
from datetime import datetime
from tika import parser
import zipfile
import csv
class PdfParser:
"""A simple pyth... | [
"os.path.exists",
"zipfile.ZipFile",
"os.makedirs",
"os.path.realpath",
"tika.parser.from_file",
"datetime.datetime.now",
"os.mkdir"
] | [((2115, 2157), 'tika.parser.from_file', 'parser.from_file', (['"""tmp_cvs/cvs/resume.pdf"""'], {}), "('tmp_cvs/cvs/resume.pdf')\n", (2131, 2157), False, 'from tika import parser\n'), ((1247, 1270), 'os.makedirs', 'os.makedirs', (['directory1'], {}), '(directory1)\n', (1258, 1270), False, 'import os\n'), ((1473, 1498),... |
import math
def pythagorean(a, b):
return math.sqrt(a ** 2 + b ** 2)
| [
"math.sqrt"
] | [((48, 74), 'math.sqrt', 'math.sqrt', (['(a ** 2 + b ** 2)'], {}), '(a ** 2 + b ** 2)\n', (57, 74), False, 'import math\n')] |
"""add root_cause table
Revision ID: 7ddd008bcaaa
Revises: <PASSWORD>
Create Date: 2021-11-06 19:20:07.167512
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7ddd008bcaaa'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
... | [
"sqlalchemy.ForeignKeyConstraint",
"alembic.op.drop_table",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Integer",
"sqlalchemy.String"
] | [((1232, 1256), 'alembic.op.drop_table', 'op.drop_table', (['"""drivers"""'], {}), "('drivers')\n", (1245, 1256), False, 'from alembic import op\n'), ((1261, 1286), 'alembic.op.drop_table', 'op.drop_table', (['"""managers"""'], {}), "('managers')\n", (1274, 1286), False, 'from alembic import op\n'), ((1291, 1317), 'ale... |
__source__ = 'https://leetcode.com/problems/mirror-reflection/'
# Time: O(logP)
# Space: O(1)
#
# Description: Leetcode # 858. Mirror Reflection
#
# There is a special square room with mirrors on each of the four walls.
# Except for the southwest corner, there are receptors on each of the remaining corners, numbered 0... | [
"unittest.main",
"fractions.gcd"
] | [((1268, 1283), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1281, 1283), False, 'import unittest\n'), ((1034, 1043), 'fractions.gcd', 'gcd', (['p', 'q'], {}), '(p, q)\n', (1037, 1043), False, 'from fractions import gcd\n')] |
#!/usr/bin/env python3
"""
#------------------------------------------------------------------------------
#
# SCRIPT: forecast_task_05.py
#
# PURPOSE: Computes the bias correction for the NMME dataset. Based on
# FORECAST_TASK_03.sh.
#
# REVISION HISTORY:
# 24 Oct 2021: <NAME>, first version
#
#-----------------------... | [
"os.path.exists",
"configparser.ConfigParser",
"os.makedirs",
"subprocess.call",
"sys.exit"
] | [((5174, 5201), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (5199, 5201), False, 'import configparser\n'), ((1706, 1717), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1714, 1717), False, 'import sys\n'), ((2045, 2056), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (2053, 2056), Fal... |
import io
import os
import time
import urllib.request
import zipfile
import numpy as np
from scipy.io.wavfile import read as wav_read
from tqdm import tqdm
class dclde:
"""
The high-frequency dataset consists of marked encounters with echolocation
clicks of species commonly found along the US Atlantic Co... | [
"os.path.exists",
"zipfile.ZipFile",
"tqdm.tqdm",
"numpy.asarray",
"io.BytesIO",
"os.path.isdir",
"scipy.io.wavfile.read",
"os.mkdir",
"time.time"
] | [((1646, 1657), 'time.time', 'time.time', ([], {}), '()\n', (1655, 1657), False, 'import time\n'), ((2348, 2396), 'zipfile.ZipFile', 'zipfile.ZipFile', (["(path + 'DCLDE/DCLDE_LF_Dev.zip')"], {}), "(path + 'DCLDE/DCLDE_LF_Dev.zip')\n", (2363, 2396), False, 'import zipfile\n'), ((2469, 2497), 'tqdm.tqdm', 'tqdm', (['f.f... |
import ecdsa
import hashlib
sk = ecdsa.SigningKey.generate(curve=ecdsa.NIST256p)
vk = sk.get_verifying_key()
a = b"Hello World!"
sig = sk.sign(a,hashfunc=hashlib.sha256)
result = vk.verify(sig,a,hashfunc=hashlib.sha256)
strsk = sk.to_string()
strvk = vk.to_string()
sk2 = ecdsa.SigningKey.from_string(strsk,curve=ec... | [
"ecdsa.SigningKey.generate",
"ecdsa.SigningKey.from_string"
] | [((34, 81), 'ecdsa.SigningKey.generate', 'ecdsa.SigningKey.generate', ([], {'curve': 'ecdsa.NIST256p'}), '(curve=ecdsa.NIST256p)\n', (59, 81), False, 'import ecdsa\n'), ((277, 334), 'ecdsa.SigningKey.from_string', 'ecdsa.SigningKey.from_string', (['strsk'], {'curve': 'ecdsa.NIST256p'}), '(strsk, curve=ecdsa.NIST256p)\n... |
import subprocess
import cifrado
import enviocorreos
import puertos
import metadata
import webscraping
import argparse
import os, time
import logging
logging.basicConfig(filename='app.log', level=logging.INFO)
if __name__ == "__main__":
description= ("Este script realiza una gran diversa cantidad de tareas " +
"... | [
"webscraping.find_mails",
"cifrado.cifrar_txt",
"metadata.printAllMetaPDf",
"metadata.printAllMetaImg",
"cifrado.descifrar_txt",
"metadata.printOneMetaDocx",
"logging.info",
"logging.error",
"metadata.printOneMetaImg",
"argparse.ArgumentParser",
"cifrado.descifrar_mensaje",
"webscraping.descar... | [((152, 211), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""app.log"""', 'level': 'logging.INFO'}), "(filename='app.log', level=logging.INFO)\n", (171, 211), False, 'import logging\n'), ((459, 579), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PIA"""', 'epilog': '... |
#import requests
import json
import os
import mariadb
import logging
from dotenv import load_dotenv
class status(object):
def __init__(self):
load_dotenv()
self.logger = logging.getLogger('prometeo.status.status_webapp')
self.logger.debug('creating an instance of status')
def get_all... | [
"logging.getLogger",
"os.getenv",
"dotenv.load_dotenv"
] | [((157, 170), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (168, 170), False, 'from dotenv import load_dotenv\n'), ((193, 243), 'logging.getLogger', 'logging.getLogger', (['"""prometeo.status.status_webapp"""'], {}), "('prometeo.status.status_webapp')\n", (210, 243), False, 'import logging\n'), ((460, 489), '... |
from apscheduler.schedulers.blocking import BlockingScheduler
from Todoist import TodoIstAPI
from Notion import NotionAPI
from Gcal import GCalAPI
import json
import os
from Main import run_sync
def create_notion_api():
notion_config = json.loads(os.environ['notion_config'])
notion = NotionAPI(os.environ['tz'... | [
"Gcal.GCalAPI",
"json.loads",
"Todoist.TodoIstAPI",
"apscheduler.schedulers.blocking.BlockingScheduler",
"Notion.NotionAPI"
] | [((242, 281), 'json.loads', 'json.loads', (["os.environ['notion_config']"], {}), "(os.environ['notion_config'])\n", (252, 281), False, 'import json\n'), ((295, 337), 'Notion.NotionAPI', 'NotionAPI', (["os.environ['tz']", 'notion_config'], {}), "(os.environ['tz'], notion_config)\n", (304, 337), False, 'from Notion impor... |
# 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 law or agreed to in writing, s... | [
"pyjamas.ui.Widget.Widget.__init__",
"pyjamas.ui.DropHandler.DropHandler.__init__",
"pyjamas.DOM.createElement",
"pyjamas.Factory.registerClass",
"pyjamas.dnd.DNDHelper.dndHelper.registerTarget"
] | [((1615, 1687), 'pyjamas.Factory.registerClass', 'Factory.registerClass', (['"""pyjamas.ui.DropWidget"""', '"""DropWidget"""', 'DropWidget'], {}), "('pyjamas.ui.DropWidget', 'DropWidget', DropWidget)\n", (1636, 1687), False, 'from pyjamas import Factory\n'), ((1036, 1062), 'pyjamas.ui.DropHandler.DropHandler.__init__',... |
import sys
from kivy.app import App
from kivy.support import install_gobject_iteration
from kivy.lang import Builder
from kivy.core.window import Window
from kivy.config import Config
from gi.repository import LightDM
kv = '''
FloatLayout:
username_spinner: username_spinner
session_spinner: session_spinner
... | [
"kivy.config.Config.set",
"kivy.config.Config.write",
"gi.repository.LightDM.Session.get_key",
"kivy.support.install_gobject_iteration",
"gi.repository.LightDM.UserList.get_users",
"kivy.lang.Builder.load_string",
"gi.repository.LightDM.Greeter",
"gi.repository.LightDM.UserList.get_instance",
"gi.re... | [((4841, 4894), 'kivy.config.Config.set', 'Config.set', (['"""kivy"""', '"""keyboard_mode"""', '"""systemandmulti"""'], {}), "('kivy', 'keyboard_mode', 'systemandmulti')\n", (4851, 4894), False, 'from kivy.config import Config\n'), ((4899, 4913), 'kivy.config.Config.write', 'Config.write', ([], {}), '()\n', (4911, 4913... |
import pytest
import os
@pytest.mark.examples
@pytest.mark.cli_snippets
def test_cli_versioning_snippets(cli_validator):
cli_validator(r'''
.. EXAMPLE-BLOCK-1-START
.. code-block:: bash
$ datafs create my_archive \
> --my_metadata_field 'useful metadata'
created versioned archive <DataArchive l... | [
"os.remove"
] | [((1679, 1716), 'os.remove', 'os.remove', (['"""my_archive_versioned.txt"""'], {}), "('my_archive_versioned.txt')\n", (1688, 1716), False, 'import os\n')] |
import unittest
import pandas as pd
import random as rd
from silk_ml.features import split_classes
class TestFeatures(unittest.TestCase):
def test_split(self):
x = {
'label1': [rd.random() + 5 for _ in range(100)],
'label2': [rd.random() * 3 - 1 for _ in range(100)],
... | [
"unittest.main",
"random.random",
"silk_ml.features.split_classes",
"pandas.DataFrame"
] | [((788, 803), 'unittest.main', 'unittest.main', ([], {}), '()\n', (801, 803), False, 'import unittest\n'), ((394, 409), 'pandas.DataFrame', 'pd.DataFrame', (['x'], {}), '(x)\n', (406, 409), True, 'import pandas as pd\n'), ((495, 524), 'silk_ml.features.split_classes', 'split_classes', (['X', 'Y', '"""label1"""'], {}), ... |
#This file will generate functions in polynomials
import numpy as np
import random
import matplotlib.pyplot as plt
class generateFunctions():
#the initial function taking 4 inputs
def __init__(self, x_vector, high_degree_vector, rangeLow, rangeHigh):
#the input processing
self.x_vector = x_vector
self.hi... | [
"numpy.random.randint",
"random.choice"
] | [((710, 788), 'numpy.random.randint', 'np.random.randint', ([], {'low': 'self.rangeLow', 'high': 'self.rangeHigh', 'size': '(highestVar + 1)'}), '(low=self.rangeLow, high=self.rangeHigh, size=highestVar + 1)\n', (727, 788), True, 'import numpy as np\n'), ((872, 901), 'random.choice', 'random.choice', (['allowed_values'... |
from corehq.apps.commtrack.helpers import make_supply_point
from corehq.apps.commtrack.tests.util import CommTrackTest, make_loc
from corehq.apps.commtrack.const import DAYS_IN_MONTH
from corehq.apps.locations.models import Location
from corehq.apps.locations.bulk import import_location
from mock import patch
from core... | [
"mock.patch",
"corehq.apps.locations.models.Location.get",
"corehq.apps.locations.bulk.import_location",
"corehq.apps.commtrack.models.Product.get_by_code",
"corehq.apps.locations.models.Location.by_domain",
"corehq.apps.commtrack.tests.util.make_loc",
"corehq.apps.commtrack.helpers.make_supply_point"
] | [((590, 632), 'corehq.apps.commtrack.tests.util.make_loc', 'make_loc', (['"""sillyparentstate"""'], {'type': '"""state"""'}), "('sillyparentstate', type='state')\n", (598, 632), False, 'from corehq.apps.commtrack.tests.util import CommTrackTest, make_loc\n'), ((661, 707), 'corehq.apps.commtrack.tests.util.make_loc', 'm... |
import asyncio
import pytest
from supriya.synthdefs import SynthDefFactory
from tloen.domain import Application, AudioEffect
@pytest.fixture
def synthdef_factory():
return (
SynthDefFactory()
.with_channel_count(2)
.with_input()
.with_signal_block(lambda builder, source, state: (... | [
"supriya.synthdefs.SynthDefFactory",
"tloen.domain.Application",
"asyncio.sleep"
] | [((530, 543), 'tloen.domain.Application', 'Application', ([], {}), '()\n', (541, 543), False, 'from tloen.domain import Application, AudioEffect\n'), ((1038, 1051), 'tloen.domain.Application', 'Application', ([], {}), '()\n', (1049, 1051), False, 'from tloen.domain import Application, AudioEffect\n'), ((1847, 1860), 't... |
#!/usr/bin/env python3
"""Create CESAR joblist.
According to predicted orthologous chains create CESAR jobs.
Merge them into joblists.
"""
import argparse
import os
import sys
import math
from collections import defaultdict
from datetime import datetime as dt
from re import finditer, IGNORECASE
import ctypes
from twob... | [
"modules.common.split_in_n_lists",
"sys.exit",
"ctypes.CDLL",
"argparse.ArgumentParser",
"modules.common.parts",
"os.path.isdir",
"re.finditer",
"ctypes.c_int",
"os.mkdir",
"modules.common.make_cds_track",
"os.path.isfile",
"os.path.dirname",
"ctypes.c_char_p",
"modules.common.die",
"cty... | [((782, 807), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (797, 807), False, 'import os\n'), ((1773, 1840), 'os.path.join', 'os.path.join', (['LOCATION', '"""modules"""', '"""chain_coords_converter_slib.so"""'], {}), "(LOCATION, 'modules', 'chain_coords_converter_slib.so')\n", (1785, 1840)... |
from django.db import models
from django.utils import timezone
from user.models import User
class GuestBook(models.Model):
username = models.ForeignKey(User, models.DO_NOTHING, verbose_name='username')
title = models.CharField(verbose_name='Title', max_length=64, blank=False)
content = models.TextField(verbose_nam... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.DateTimeField",
"django.db.models.ImageField",
"django.db.models.CharField"
] | [((137, 204), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User', 'models.DO_NOTHING'], {'verbose_name': '"""username"""'}), "(User, models.DO_NOTHING, verbose_name='username')\n", (154, 204), False, 'from django.db import models\n'), ((214, 280), 'django.db.models.CharField', 'models.CharField', ([], {'verbo... |
import gzip
import zlib
import io
from ssxtd import parsers
import time
my_file = io.StringIO('''<doc farm = "456">
<i species = "lapin" sex = "male" >John</i>
<i species = "chien"><sub subspec = "Kooikerhondje">Tristan</sub></i>
<i species = "cheval">
<count>1.1</count>
</i>
<i>
<mo... | [
"io.StringIO",
"ssxtd.parsers.lxml_parse"
] | [((84, 412), 'io.StringIO', 'io.StringIO', (['"""<doc farm = "456"> \n <i species = "lapin" sex = "male" >John</i>\n <i species = "chien"><sub subspec = "Kooikerhondje">Tristan</sub></i>\n <i species = "cheval">\n <count>1.1</count>\n </i>\n\t<i>\n <month>11</month>\n <year>2011</year>\... |
import discord
from discord.ext import commands
from typing import Any, Iterator, List, NoReturn, Optional, Sequence
class Paginator:
def __init__(self):
self.pages: List[discord.Embed] = []
def insert_page_at(self, index: int, page: discord.Embed):
"""Inserts a new page at a particular posit... | [
"discord.Color.dark_theme"
] | [((8413, 8439), 'discord.Color.dark_theme', 'discord.Color.dark_theme', ([], {}), '()\n', (8437, 8439), False, 'import discord\n')] |
import tensorflow as tf
#initialize data
X = [2, 5, 7]
Y = [3, 4, 6]
W = tf.Variable(tf.random_normal([1]), name='weight')
b = tf.Variable(tf.random_normal([1]), name='bias')
#hypothesis H = WX+b
H = W * X + b
#cost/loss function
cost = tf.reduce_mean(tf.square(H - Y))
#minimize
optimizer = tf.trai... | [
"tensorflow.random_normal",
"tensorflow.Session",
"tensorflow.train.GradientDescentOptimizer",
"tensorflow.global_variables_initializer",
"tensorflow.square"
] | [((313, 366), 'tensorflow.train.GradientDescentOptimizer', 'tf.train.GradientDescentOptimizer', ([], {'learning_rate': '(0.01)'}), '(learning_rate=0.01)\n', (346, 366), True, 'import tensorflow as tf\n'), ((443, 455), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (453, 455), True, 'import tensorflow as tf\n'), ... |
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 15 17:22:01 2020
@author: Kamil
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import morse_decoder
import iir_filter
class RealtimeWindow:
def __init__(self, channel: str):
# create a plot window
se... | [
"matplotlib.animation.FuncAnimation",
"iir_filter.GenerateHighPassCoeff",
"numpy.append",
"numpy.zeros",
"iir_filter.IIRFilter",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplots",
"morse_decoder.MorseCodeDecoder"
] | [((349, 364), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {}), '(2)\n', (361, 364), True, 'import matplotlib.pyplot as plt\n'), ((373, 405), 'matplotlib.pyplot.title', 'plt.title', (['f"""Channel: {channel}"""'], {}), "(f'Channel: {channel}')\n", (382, 405), True, 'import matplotlib.pyplot as plt\n'), ((517... |
from library.utilities.misc import parse_link, get_resource_type
from library.utilities.logger import get_logger
from google.auth.transport.requests import AuthorizedSession
from google.auth import default
from requests import codes, exceptions
import time
import re
from json import JSONDecodeError
class GcloudRestL... | [
"google.auth.default",
"time.sleep",
"library.utilities.logger.get_logger",
"google.auth.transport.requests.AuthorizedSession",
"time.time",
"re.search"
] | [((747, 813), 'google.auth.default', 'default', ([], {'scopes': "['https://www.googleapis.com/auth/cloud-platform']"}), "(scopes=['https://www.googleapis.com/auth/cloud-platform'])\n", (754, 813), False, 'from google.auth import default\n'), ((837, 872), 'google.auth.transport.requests.AuthorizedSession', 'AuthorizedSe... |
#!/usr/bin/env python3
# This is a script for using circuitpython's repo to make pyi files for each board type.
# These need to be bundled with the extension, which means that adding new boards is still
# a new release of the extension.
# import mypy
import json
import pathlib
import re
def main():
repo_root = p... | [
"pathlib.Path",
"json.dump",
"re.compile"
] | [((1834, 1954), 're.compile', 're.compile', (['"""\\\\s*{\\\\s*MP_ROM_QSTR\\\\(MP_QSTR_(?P<name>[^\\\\)]*)\\\\)\\\\s*,\\\\s*MP_ROM_PTR\\\\((?P<value>[^\\\\)]*)\\\\).*"""'], {}), "(\n '\\\\s*{\\\\s*MP_ROM_QSTR\\\\(MP_QSTR_(?P<name>[^\\\\)]*)\\\\)\\\\s*,\\\\s*MP_ROM_PTR\\\\((?P<value>[^\\\\)]*)\\\\).*'\n )\n", (184... |
"""
It takes to peleffy's molecule representations, aligns them and calculates
the RMSD using RDKit.
"""
from multiprocessing import Pool
from copy import deepcopy
from rdkit.Chem import AllChem
from rdkit import Chem
class Aligner(object):
"""
It aligns two molecule representations as much as possible and... | [
"rdkit.Chem.AllChem.EmbedMultipleConfs",
"multiprocessing.Pool",
"rdkit.Chem.rdmolfiles.MolToPDBFile",
"copy.deepcopy",
"rdkit.Chem.rdMolAlign.AlignMol"
] | [((1607, 1630), 'copy.deepcopy', 'deepcopy', (['self._prb_mol'], {}), '(self._prb_mol)\n', (1615, 1630), False, 'from copy import deepcopy\n'), ((1643, 1699), 'rdkit.Chem.AllChem.EmbedMultipleConfs', 'AllChem.EmbedMultipleConfs', (['prb_mol', '(15)'], {'randomSeed': 'seed'}), '(prb_mol, 15, randomSeed=seed)\n', (1669, ... |
from data_structures.node import Node
class LinkedList:
def __init__(self):
self.head = None
self.list_size = 0
def is_empty(self):
return self.list_size == 0
def is_full(self):
return False
def __len__(self):
return self.list_size
def size(self):
return self.list_size
def _get_node(self, index... | [
"data_structures.node.Node"
] | [((618, 639), 'data_structures.node.Node', 'Node', (['item', 'self.head'], {}), '(item, self.head)\n', (622, 639), False, 'from data_structures.node import Node\n'), ((719, 740), 'data_structures.node.Node', 'Node', (['item', 'node.link'], {}), '(item, node.link)\n', (723, 740), False, 'from data_structures.node import... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import numpy as np
MAXLINE = 10000
MAXFRAME = 10000
def read_xyz(xyz,natoms):
#
fopen = open(xyz,'r')
frames = []
for i in range(MAXLINE):
line = fopen.readline()
if line.strip():
assert int(line.strip().split()[0... | [
"os.listdir",
"os.path.join",
"numpy.array",
"numpy.sum",
"os.path.abspath"
] | [((2693, 2726), 'numpy.array', 'np.array', (['lines[2:5]'], {'dtype': 'float'}), '(lines[2:5], dtype=float)\n', (2701, 2726), True, 'import numpy as np\n'), ((2804, 2819), 'numpy.sum', 'np.sum', (['numbers'], {}), '(numbers)\n', (2810, 2819), True, 'import numpy as np\n'), ((3051, 3079), 'numpy.array', 'np.array', (['p... |
import os
def get_path(path):
return os.path.split(path)[0]
def get_filename(path):
return os.path.splitext(os.path.basename(path))[0]
def extract_turns(input):
"""
Génère automatiquement un fichier contenant le nombre de tours par locuteur à partir du fichier de tours
:param input:
:retu... | [
"os.path.basename",
"os.path.split"
] | [((42, 61), 'os.path.split', 'os.path.split', (['path'], {}), '(path)\n', (55, 61), False, 'import os\n'), ((119, 141), 'os.path.basename', 'os.path.basename', (['path'], {}), '(path)\n', (135, 141), False, 'import os\n')] |
# (C) <EMAIL> released under the MIT license (see LICENSE)
import os
import requests
import threading
import time
import sys
import win32con
import win32gui
import common
def threaded_function(thread_data, thread_static, env, addons, hWnd, log):
while not thread_data.stop:
time.sleep(0.01)
will_update_ca_b... | [
"win32gui.SendMessage",
"common.locate_ca_bundle",
"threading.Lock",
"common.get_node",
"time.sleep",
"sys.exc_info",
"common.list_addons",
"common.update_addons"
] | [((2006, 2022), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (2020, 2022), False, 'import threading\n'), ((283, 299), 'time.sleep', 'time.sleep', (['(0.01)'], {}), '(0.01)\n', (293, 299), False, 'import time\n'), ((1596, 1671), 'common.update_addons', 'common.update_addons', (['env', 'addons', 'log', 'force_up... |
import pytest
@pytest.mark.describe("`var` tag")
class TestGetVarTag:
tag_name = "var"
@pytest.mark.it("Only with variable name")
def test_only_var_name(self, template_factory, context_factory, variable_factory):
variable_factory(5, "V_INT")
t_int = template_factory("V_INT", tag_name=self... | [
"pytest.mark.describe",
"pytest.mark.it"
] | [((17, 50), 'pytest.mark.describe', 'pytest.mark.describe', (['"""`var` tag"""'], {}), "('`var` tag')\n", (37, 50), False, 'import pytest\n'), ((99, 140), 'pytest.mark.it', 'pytest.mark.it', (['"""Only with variable name"""'], {}), "('Only with variable name')\n", (113, 140), False, 'import pytest\n'), ((1213, 1245), '... |
from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(OneshirtUser)
admin.site.register(Item)
admin.site.register(Trade)
admin.site.register(PasswordResetRequest)
| [
"django.contrib.admin.site.register"
] | [((86, 119), 'django.contrib.admin.site.register', 'admin.site.register', (['OneshirtUser'], {}), '(OneshirtUser)\n', (105, 119), False, 'from django.contrib import admin\n'), ((120, 145), 'django.contrib.admin.site.register', 'admin.site.register', (['Item'], {}), '(Item)\n', (139, 145), False, 'from django.contrib im... |
from sabueso.tools.string_pdb_text import is_pdb_text
from sabueso.tools.string_pdb_id import is_pdb_id
from sabueso.tools.string_uniprot_id import is_uniprot_id
def guess_form(string):
output = None
if is_pdb_text(string):
output = 'string:pdb_text'
elif is_pdb_id(string):
output = 'stri... | [
"sabueso.tools.string_pdb_id.is_pdb_id",
"sabueso.tools.string_pdb_text.is_pdb_text",
"sabueso.tools.string_uniprot_id.is_uniprot_id"
] | [((214, 233), 'sabueso.tools.string_pdb_text.is_pdb_text', 'is_pdb_text', (['string'], {}), '(string)\n', (225, 233), False, 'from sabueso.tools.string_pdb_text import is_pdb_text\n'), ((279, 296), 'sabueso.tools.string_pdb_id.is_pdb_id', 'is_pdb_id', (['string'], {}), '(string)\n', (288, 296), False, 'from sabueso.too... |
"""
Parser class definition
"""
from exprail.node import NodeType
from exprail import router
from exprail.state import State
class Parser(object):
"""The base class for other parsers"""
def __init__(self, grammar, source):
"""
Initialize the parser.
:param grammar: a grammar object
... | [
"exprail.state.State",
"exprail.router.find_next_state"
] | [((906, 948), 'exprail.router.find_next_state', 'router.find_next_state', (['self._state', 'token'], {}), '(self._state, token)\n', (928, 948), False, 'from exprail import router\n'), ((3791, 3856), 'exprail.state.State', 'State', (['self._state.grammar', 'expression_name', 'node_id', 'self._state'], {}), '(self._state... |
from Bio import SeqIO
import pandas as pd
def subset_unmasked_csv(blast_csv, unmasked_fasta, output):
# blast hits
hits = pd.read_csv(blast_csv)
# keep query id until first whitespace
queryid_with_hits = hits["query"].str.extract("(^[^\\s]+)", expand=False)
# convert to list
queryid_with_hits ... | [
"Bio.SeqIO.write",
"Bio.SeqIO.parse",
"pandas.read_csv"
] | [((132, 154), 'pandas.read_csv', 'pd.read_csv', (['blast_csv'], {}), '(blast_csv)\n', (143, 154), True, 'import pandas as pd\n'), ((700, 746), 'Bio.SeqIO.write', 'SeqIO.write', (['filtered_records', 'output', '"""fasta"""'], {}), "(filtered_records, output, 'fasta')\n", (711, 746), False, 'from Bio import SeqIO\n'), ((... |
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from Platforms.Web.index import WebIndex
import json
from aiohttp.web import Response, Request
async def apiDiscordGuildUnknown(cls:"WebIndex", WebRequest:Request, **kwargs:dict) -> Response:
"""
Takes from kwargs:
msg:str
guild_id:str
guild_name:str
""... | [
"json.dumps"
] | [((948, 963), 'json.dumps', 'json.dumps', (['res'], {}), '(res)\n', (958, 963), False, 'import json\n'), ((2182, 2197), 'json.dumps', 'json.dumps', (['res'], {}), '(res)\n', (2192, 2197), False, 'import json\n'), ((3389, 3404), 'json.dumps', 'json.dumps', (['res'], {}), '(res)\n', (3399, 3404), False, 'import json\n'),... |
import sqlite3
import matplotlib as mpl
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import networkx as nx
from sqlitedict import SqliteDict
gene = "phpt1"
transcript = "ENST00000463215"
sqlite_path_organism = "homo_sapiens.v2.sqlite"
sqlite_path_reads = ["SRR2433794.sqlite"]
def get_gene_i... | [
"sqlite3.connect",
"matplotlib.pyplot.figtext",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.gcf",
"networkx.DiGraph",
"networkx.all_simple_paths",
"sqlitedict.SqliteDict",
"matplotlib.cm.ScalarMappable",
"networkx.weakly_connected_components",
"matplotlib.colors.Normalize",
"networkx.kamada_kawa... | [((516, 553), 'sqlite3.connect', 'sqlite3.connect', (['sqlite_path_organism'], {}), '(sqlite_path_organism)\n', (531, 553), False, 'import sqlite3\n'), ((947, 984), 'sqlite3.connect', 'sqlite3.connect', (['sqlite_path_organism'], {}), '(sqlite_path_organism)\n', (962, 984), False, 'import sqlite3\n'), ((2117, 2154), 's... |
import pytest
from lunchroulette.app import app as _app
from lunchroulette.app import db as _db
from sqlalchemy import event
from sqlalchemy.orm import sessionmaker
@pytest.fixture(scope="session")
def app(request):
return _app
@pytest.fixture(scope="function")
def db(app, request):
with app.app_context():
... | [
"lunchroulette.app.db.create_all",
"lunchroulette.app.db.engine.connect",
"lunchroulette.app.db.drop_all",
"pytest.fixture",
"lunchroulette.app.db.create_scoped_session"
] | [((168, 199), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (182, 199), False, 'import pytest\n'), ((236, 268), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (250, 268), False, 'import pytest\n'), ((369, 415), 'pytest.fixtur... |
import argparse
import configparser
import json
import logging.config
import time
import urllib.parse
import urllib.request
import yaml
######################################################################################################
# Parse command line.
##########################################################... | [
"json.load",
"time.time",
"configparser.ConfigParser",
"argparse.ArgumentParser"
] | [((380, 405), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (403, 405), False, 'import argparse\n'), ((1301, 1328), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (1326, 1328), False, 'import configparser\n'), ((4134, 4161), 'configparser.ConfigParser', 'configpars... |
# ------------------------------------------------------------------------------
# _dc.py
#
# Parser for the jam 'c' debug flag output - which contains the names of files
# that cause rebuilds - ie new sources, missing targets
#
# November 2015, <NAME>
# -----------------------------------------------------------------... | [
"collections.deque",
"re.compile"
] | [((4433, 4465), 're.compile', 're.compile', (['"""[^"]+\\\\s+"([^"]+)\\""""'], {}), '(\'[^"]+\\\\s+"([^"]+)"\')\n', (4443, 4465), False, 'import re\n'), ((4497, 4531), 're.compile', 're.compile', (['"""([^"]+)\\\\s+"([^"]+)\\""""'], {}), '(\'([^"]+)\\\\s+"([^"]+)"\')\n', (4507, 4531), False, 'import re\n'), ((7715, 777... |
import socket
import xmlrpc.client
""" referemce: https://stackoverflow.com/a/14397619 """
class ServerProxy:
def __init__(self, url, timeout=10):
self.__url = url
self.__timeout = timeout
self.__prevDefaultTimeout = None
def __enter__(self):
try:
if self.__timeou... | [
"socket.getdefaulttimeout",
"socket.setdefaulttimeout"
] | [((780, 831), 'socket.setdefaulttimeout', 'socket.setdefaulttimeout', (['self.__prevDefaultTimeout'], {}), '(self.__prevDefaultTimeout)\n', (804, 831), False, 'import socket\n'), ((367, 393), 'socket.getdefaulttimeout', 'socket.getdefaulttimeout', ([], {}), '()\n', (391, 393), False, 'import socket\n'), ((410, 450), 's... |
import torch
from torchvision import ops
from Fcos_seg.utils.box_list import BoxList
from Fcos_seg.utils.boxlist_ops import cat_boxlist
from Fcos_seg.utils.boxlist_ops import boxlist_ml_nms
from Fcos_seg.utils.boxlist_ops import remove_small_boxes
class FcosPost(torch.nn.Module):
def __init__(self, cfg):
... | [
"Fcos_seg.utils.box_list.BoxList",
"torch.full",
"Fcos_seg.utils.boxlist_ops.cat_boxlist",
"torch.stack",
"torch.sqrt",
"torchvision.ops.nms",
"torch.nonzero",
"Fcos_seg.utils.boxlist_ops.remove_small_boxes",
"torch.cat"
] | [((2533, 2726), 'torch.stack', 'torch.stack', (['[per_locations[:, 0] - per_box_reg[:, 0], per_locations[:, 1] - per_box_reg\n [:, 1], per_locations[:, 0] + per_box_reg[:, 2], per_locations[:, 1] +\n per_box_reg[:, 3]]'], {'dim': '(1)'}), '([per_locations[:, 0] - per_box_reg[:, 0], per_locations[:, 1] -\n per_... |
from tqdm import tqdm
from nic import (
captioning as cptn,
datapreparation as dp,
metrics as mcs,
)
from nic.datapreparation import utils
def bleu_score_of(model,
*,
is_decoder_only=True,
path_to_data,
batch_size=32,
... | [
"nic.datapreparation.utils.batches_count_for",
"nic.datapreparation.load_images",
"nic.metrics.bleu_score_of",
"tqdm.tqdm",
"nic.datapreparation.MetaTokens",
"nic.captioning.CaptionGenerator",
"nic.datapreparation.load_captions",
"nic.datapreparation.load_tokenizer"
] | [((371, 386), 'nic.datapreparation.MetaTokens', 'dp.MetaTokens', ([], {}), '()\n', (384, 386), True, 'from nic import captioning as cptn, datapreparation as dp, metrics as mcs\n'), ((1553, 1609), 'nic.datapreparation.load_images', 'dp.load_images', (['path_to_data', 'data_type', 'is_decoder_only'], {}), '(path_to_data,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/9/13 13:58
# @Author : <NAME>
# @Site :
# @File : file
# @Software: PyCharm
from os import path
from application import app
from common.utils.format_time import stamp_to_date
class File(object):
@staticmethod
def get_upload_file_path():
... | [
"common.utils.format_time.stamp_to_date",
"application.app.config.get"
] | [((417, 444), 'application.app.config.get', 'app.config.get', (['"""FILE_PATH"""'], {}), "('FILE_PATH')\n", (431, 444), False, 'from application import app\n'), ((454, 469), 'common.utils.format_time.stamp_to_date', 'stamp_to_date', ([], {}), '()\n', (467, 469), False, 'from common.utils.format_time import stamp_to_dat... |
import RPi.GPIO as GPIO
import time
import socket
def init():
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.OUT)
GPIO.setup(11,GPIO.OUT)
GPIO.setup(13,GPIO.OUT)
GPIO.setup(29,GPIO.OUT)
GPIO.setup(31,GPIO.OUT)
GPIO.setup(33,GPIO.OUT)
GPIO.setup(12,GPIO.IN,pull_up_down=GPIO.PUD_UP)
def star... | [
"RPi.GPIO.cleanup",
"socket.socket",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"time.sleep",
"RPi.GPIO.input",
"RPi.GPIO.setmode"
] | [((2436, 2450), 'RPi.GPIO.cleanup', 'GPIO.cleanup', ([], {}), '()\n', (2448, 2450), True, 'import RPi.GPIO as GPIO\n'), ((67, 91), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BOARD'], {}), '(GPIO.BOARD)\n', (79, 91), True, 'import RPi.GPIO as GPIO\n'), ((96, 119), 'RPi.GPIO.setup', 'GPIO.setup', (['(7)', 'GPIO.OUT'], {... |
"""A module for anything color/animation related."""
from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass
from math import ceil, cos, pi
from time import time
from typing import *
Numeric = Union[int, float]
def linear_interpolation(a: Numeric, b: Numeric, x: Nume... | [
"math.ceil",
"math.cos",
"tkinter.Canvas",
"tkinter.Tk",
"time.time"
] | [((6830, 6842), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (6840, 6842), False, 'import tkinter\n'), ((6917, 6988), 'tkinter.Canvas', 'tkinter.Canvas', (['top'], {'bg': '"""blue"""', 'height': 'r', 'width': '(r * animation.led_count)'}), "(top, bg='blue', height=r, width=r * animation.led_count)\n", (6931, 6988), Fa... |
import util
import io
class SolutionParser(object):
def __init__(self, sln_path):
# Initialize SolutionParser Object
assert util.test_path(sln_path, 'f'), sln_path
self.path = sln_path
self.raw_content = []
self.data = {
"version": None,
"vsversion":... | [
"util.listdirpaths",
"util.test_path",
"io.open",
"util.join_path"
] | [((146, 175), 'util.test_path', 'util.test_path', (['sln_path', '"""f"""'], {}), "(sln_path, 'f')\n", (160, 175), False, 'import util\n'), ((1237, 1265), 'util.listdirpaths', 'util.listdirpaths', (['directory'], {}), '(directory)\n', (1254, 1265), False, 'import util\n'), ((1502, 1530), 'util.listdirpaths', 'util.listd... |
#!/usr/bin/env python3
from evdev import UInput, UInputError, ecodes, AbsInfo
from evdev import util
from fport import FportParser, FportMessageControl
import serial
from time import sleep
if __name__ == '__main__':
device = None
def handler(message):
if type(message) is FportMessageControl:
... | [
"fport.FportParser",
"evdev.UInput",
"evdev.AbsInfo",
"serial.Serial"
] | [((572, 635), 'evdev.AbsInfo', 'AbsInfo', ([], {'value': '(0)', 'min': '(0)', 'max': '(2048)', 'fuzz': '(0)', 'flat': '(0)', 'resolution': '(0)'}), '(value=0, min=0, max=2048, fuzz=0, flat=0, resolution=0)\n', (579, 635), False, 'from evdev import UInput, UInputError, ecodes, AbsInfo\n'), ((909, 930), 'evdev.UInput', '... |
"""
This module contains all of the server selection logic.
It supplies one function:
get_server() which returns the name of a server to mine.
It has two external dependencies.
1) btcnet_info via btcnet_wrapper
2) a way to pull getworks for checking if we should delag pools
"""
import ServerLogic
import bitHopper.... | [
"bitHopper.Configuration.Workers.get_worker_from",
"ServerLogic.get_server"
] | [((734, 765), 'bitHopper.Configuration.Workers.get_worker_from', 'Workers.get_worker_from', (['server'], {}), '(server)\n', (757, 765), True, 'import bitHopper.Configuration.Workers as Workers\n'), ((569, 593), 'ServerLogic.get_server', 'ServerLogic.get_server', ([], {}), '()\n', (591, 593), False, 'import ServerLogic\... |
import re
class solve_day(object):
with open('inputs/day08.txt', 'r') as f:
data = f.readlines()
def part1(self):
# try 1: 5979 (too high)
# try 2: 2043 (too high)
# try 3: 1376 (too high)
count_lit = 0
count_mem = 0
# self.data = ['""', '"abc"', r'"... | [
"re.finditer"
] | [((972, 995), 're.finditer', 're.finditer', (['"""\\\\\\\\x"""', 'd'], {}), "('\\\\\\\\x', d)\n", (983, 995), False, 'import re\n'), ((1283, 1306), 're.finditer', 're.finditer', (['"""\\\\\\\\\\""""', 'd'], {}), '(\'\\\\\\\\"\', d)\n', (1294, 1306), False, 'import re\n'), ((1601, 1627), 're.finditer', 're.finditer', ([... |
# coding: utf-8
"""
Consolidate Services
Description of all APIs # noqa: E501
The version of the OpenAPI document: version not set
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from argocd_client.configuration import Configuration
class V1alp... | [
"six.iteritems",
"argocd_client.configuration.Configuration"
] | [((7453, 7486), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (7466, 7486), False, 'import six\n'), ((1757, 1772), 'argocd_client.configuration.Configuration', 'Configuration', ([], {}), '()\n', (1770, 1772), False, 'from argocd_client.configuration import Configuration\n')] |
import os
import requests
import tweepy
import random
from .littlebirdy import LittleBirdy
class TwitterPost(LittleBirdy):
_TWEET = '''{account} I am experiencing issues with my internet. My speed is at {down} MB/s Down & {up} MB/s Up.
This is {percent}% below what I am paying for.
'''
def post(self, d... | [
"tweepy.API",
"tweepy.OAuthHandler"
] | [((366, 467), 'tweepy.OAuthHandler', 'tweepy.OAuthHandler', (["self.config['twitter_consumer_key']", "self.config['twitter_consumer_secret']"], {}), "(self.config['twitter_consumer_key'], self.config[\n 'twitter_consumer_secret'])\n", (385, 467), False, 'import tweepy\n'), ((661, 677), 'tweepy.API', 'tweepy.API', ([... |
# -*- coding: utf-8 -*-
# Copyright (c) 2012, <NAME>
# All rights reserved.
# This file is part of PyDSM.
# PyDSM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at yo... | [
"numpy.testing.assert_equal",
"numpy.arange",
"numpy.array",
"pydsm.delsig.simulateDSM",
"numpy.testing.run_module_suite",
"numpy.load",
"pkg_resources.resource_stream"
] | [((1841, 1859), 'numpy.testing.run_module_suite', 'run_module_suite', ([], {}), '()\n', (1857, 1859), False, 'from numpy.testing import TestCase, run_module_suite\n'), ((1063, 1131), 'pkg_resources.resource_stream', 'resource_stream', (['"""pydsm.delsig"""', '"""tests/Data/test_simulateDSM_0.npz"""'], {}), "('pydsm.del... |
import socket
from unittest import TestCase
from tmq import define as td
class TestHash(TestCase):
def test_short(self):
result = td.tmq_hash("short hash")
self.assertEqual(result, 0x20dc540e)
def test_long(self):
result = td.tmq_hash("this is a pretty long hash string")
self... | [
"tmq.define.tmq_hash",
"tmq.define.tmq_unpack_addresses",
"tmq.define.tmq_unpack_address_t",
"tmq.define.tmq_pack_addresses",
"tmq.define.tmq_unpack",
"tmq.define.tmq_pack",
"tmq.define.tmq_pack_address_t"
] | [((145, 170), 'tmq.define.tmq_hash', 'td.tmq_hash', (['"""short hash"""'], {}), "('short hash')\n", (156, 170), True, 'from tmq import define as td\n'), ((259, 307), 'tmq.define.tmq_hash', 'td.tmq_hash', (['"""this is a pretty long hash string"""'], {}), "('this is a pretty long hash string')\n", (270, 307), True, 'fro... |
from uio import Uio
from argsort_axi import ArgSort_AXI
if __name__ == '__main__':
uio = Uio('uio_argsort')
argsort_axi = ArgSort_AXI(uio.regs())
argsort_axi.print_info()
argsort_axi.print_debug()
| [
"uio.Uio"
] | [((110, 128), 'uio.Uio', 'Uio', (['"""uio_argsort"""'], {}), "('uio_argsort')\n", (113, 128), False, 'from uio import Uio\n')] |
# This Python file uses the following encoding: utf-8
'''
Author: <NAME>
Linkedin: https://www.linkedin.com/in/lucasalves-ast/
'''
# TODO #4 Atualizar python 3.9.5 -> 3.9.9
# Importar bibliotecas internas
import __conectdb__
import __query__
import __check__
import __check_semana__
import __list__
# Importar bibli... | [
"logging.getLogger",
"logging.basicConfig",
"__conectdb__.bk",
"__conectdb__.in_dados",
"tqdm.tqdm",
"requests.get",
"backoff.on_exception",
"datetime.timedelta",
"bs4.BeautifulSoup",
"__conectdb__.se_dados",
"pandas.DataFrame",
"datetime.date.today",
"time.time",
"__conectdb__.verifica_co... | [((719, 746), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (736, 746), False, 'import logging\n'), ((747, 786), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (766, 786), False, 'import logging\n'), ((789, 841), 'backoff.on_excep... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(name="urwid_picker_widgets",
version="0.4",
description="Specialized picker widgets for urwid "
"that extend its features.",
lon... | [
"setuptools.setup"
] | [((150, 916), 'setuptools.setup', 'setup', ([], {'name': '"""urwid_picker_widgets"""', 'version': '"""0.4"""', 'description': '"""Specialized picker widgets for urwid that extend its features."""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', 'url': '"""https://github.... |
##Clustering script for CaM_Trials##
#clusters using HDBSCAN the last 1 microsecond of simulation
#uses rmsd to native of backbone (excluding flexible tails but including peptide) as distance metric
import mdtraj as md
import numpy as np
import matplotlib.pyplot as plt
import hdbscan
MIN_SAMPLES = 200 #determined fr... | [
"numpy.mean",
"numpy.median",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"numpy.where",
"numpy.sort",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.xlabel",
"numpy.std",
"numpy.max",
"mdtraj.load_dcd",
"numpy.empty",
"numpy.min",
"mdtraj.rmsd",
"mdtraj.load",
"hdbscan.HDBS... | [((2359, 2382), 'mdtraj.load', 'md.load', (['"""cam_fill.pdb"""'], {}), "('cam_fill.pdb')\n", (2366, 2382), True, 'import mdtraj as md\n'), ((418, 458), 'numpy.empty', 'np.empty', (['(traj.n_frames, traj.n_frames)'], {}), '((traj.n_frames, traj.n_frames))\n', (426, 458), True, 'import numpy as np\n'), ((729, 755), 'num... |
import re
from dataclasses import dataclass
from itertools import combinations
from aoc.util import load_input, load_example
def part1(lines):
r""" ¯\_(ツ)_/¯ """
return next(index for index, line in enumerate(lines) if "a=<0,0,0>" in line)
@dataclass
class Particle:
position: tuple
velocity: tuple
... | [
"itertools.combinations",
"aoc.util.load_input",
"re.compile"
] | [((458, 500), 're.compile', 're.compile', (['"""p=<(.*)>, v=<(.*)>, a=<(.*)>"""'], {}), "('p=<(.*)>, v=<(.*)>, a=<(.*)>')\n", (468, 500), False, 'import re\n'), ((1501, 1533), 'aoc.util.load_input', 'load_input', (['__file__', '(2017)', '"""20"""'], {}), "(__file__, 2017, '20')\n", (1511, 1533), False, 'from aoc.util i... |
# Copyright (c) 2015 Xilinx Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... | [
"os.path.exists",
"os.path.join",
"threading.RLock",
"os.path.isdir",
"re.search"
] | [((2070, 2087), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (2085, 2087), False, 'import threading\n'), ((2262, 2307), 're.search', 're.search', (['"""(NOTE|WARNING|ERROR): (.*)"""', 'line'], {}), "('(NOTE|WARNING|ERROR): (.*)', line)\n", (2271, 2307), False, 'import re\n'), ((5789, 5815), 'os.path.exists',... |
import openmc
class FusionRingSource(openmc.Source):
"""An openmc.Source object with some presets to make it more convenient
for fusion simulations using a ring source. All attributes can be changed
after initialization if required. Default isotropic ring source with a Muir
energy distribution.
... | [
"openmc.stats.Uniform",
"openmc.stats.CylindricalIndependent",
"openmc.stats.Muir",
"openmc.stats.Isotropic",
"openmc.stats.Discrete"
] | [((884, 920), 'openmc.stats.Discrete', 'openmc.stats.Discrete', (['[radius]', '[1]'], {}), '([radius], [1])\n', (905, 920), False, 'import openmc\n'), ((940, 971), 'openmc.stats.Discrete', 'openmc.stats.Discrete', (['[0]', '[1]'], {}), '([0], [1])\n', (961, 971), False, 'import openmc\n'), ((988, 1037), 'openmc.stats.U... |
from allauth.socialaccount.providers.oauth2_provider.urls import default_urlpatterns
from .provider import EveOnlineProvider
urlpatterns = default_urlpatterns(EveOnlineProvider)
| [
"allauth.socialaccount.providers.oauth2_provider.urls.default_urlpatterns"
] | [((142, 180), 'allauth.socialaccount.providers.oauth2_provider.urls.default_urlpatterns', 'default_urlpatterns', (['EveOnlineProvider'], {}), '(EveOnlineProvider)\n', (161, 180), False, 'from allauth.socialaccount.providers.oauth2_provider.urls import default_urlpatterns\n')] |
from .errors import DownloaderFinished, NotAcceptedFormat, StreamNotFound
from moviepy.audio.io.AudioFileClip import AudioFileClip
from typing import Any, BinaryIO, Optional
from pytube import Stream, YouTube
class Downloader(YouTube):
def __init__(self, url: str, format: str):
super().__init__(
... | [
"moviepy.audio.io.AudioFileClip.AudioFileClip"
] | [((982, 1006), 'moviepy.audio.io.AudioFileClip.AudioFileClip', 'AudioFileClip', (['file_path'], {}), '(file_path)\n', (995, 1006), False, 'from moviepy.audio.io.AudioFileClip import AudioFileClip\n')] |
import typing as t
import numpy as np
import pandas as pd
from house_prices_regression_model import __version__ as VERSION
from house_prices_regression_model.processing.data_manager import load_pipeline
from house_prices_regression_model.config.core import load_config_file, SETTINGS_PATH
from house_prices_regression_m... | [
"house_prices_regression_model.config.core.load_config_file",
"house_prices_regression_model.processing.data_manager.load_pipeline",
"numpy.exp",
"house_prices_regression_model.processing.data_validation.validate_inputs",
"pandas.DataFrame"
] | [((400, 431), 'house_prices_regression_model.config.core.load_config_file', 'load_config_file', (['SETTINGS_PATH'], {}), '(SETTINGS_PATH)\n', (416, 431), False, 'from house_prices_regression_model.config.core import load_config_file, SETTINGS_PATH\n'), ((564, 607), 'house_prices_regression_model.processing.data_manager... |
# Copyright 2018 D-Wave Systems Inc.
#
# 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 wri... | [
"logging.getLogger",
"dwave.system.samplers.DWaveSampler",
"hybrid.utils.random_sample",
"dwave.system.composites.FixedEmbeddingComposite",
"threading.Event",
"neal.SimulatedAnnealingSampler",
"dwave.system.composites.EmbeddingComposite",
"tabu.TabuSampler"
] | [((1598, 1625), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1615, 1625), False, 'import logging\n'), ((2719, 2783), 'dwave.system.composites.FixedEmbeddingComposite', 'FixedEmbeddingComposite', (['self.sampler'], {'embedding': 'state.embedding'}), '(self.sampler, embedding=state.embed... |
# Generated by Django 3.1.11 on 2021-07-01 20:18
from django.db import migrations, models
import grandchallenge.core.storage
class Migration(migrations.Migration):
dependencies = [
("products", "0006_product_ce_under"),
]
operations = [
migrations.CreateModel(
name="Project... | [
"django.db.models.FileField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((416, 509), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (432, 509), False, 'from django.db import migrations, models\... |
from django.core.exceptions import ValidationError
def is_alpha_or_space_validator(value):
result = all(c.isalpha() or c.isspace() for c in value)
if not result:
raise ValidationError("Write a valid name.")
| [
"django.core.exceptions.ValidationError"
] | [((186, 224), 'django.core.exceptions.ValidationError', 'ValidationError', (['"""Write a valid name."""'], {}), "('Write a valid name.')\n", (201, 224), False, 'from django.core.exceptions import ValidationError\n')] |
import numpy as np
from amlearn.utils.basetest import AmLearnTest
from amlearn.utils.data import get_isometric_lists
class test_data(AmLearnTest):
def setUp(self):
pass
def test_get_isometric_lists(self):
test_lists= [[1, 2, 3], [4], [5, 6], [1, 2, 3]]
isometric_lists = \
... | [
"numpy.array",
"amlearn.utils.data.get_isometric_lists"
] | [((320, 381), 'amlearn.utils.data.get_isometric_lists', 'get_isometric_lists', (['test_lists'], {'limit_width': '(80)', 'fill_value': '(0)'}), '(test_lists, limit_width=80, fill_value=0)\n', (339, 381), False, 'from amlearn.utils.data import get_isometric_lists\n'), ((630, 692), 'amlearn.utils.data.get_isometric_lists'... |
from django import forms
class UserForm(forms.Form):
name = forms.CharField(max_length=30)
email = forms.CharField(max_length=30, widget = forms.EmailInput)
password = forms.CharField(widget = forms.PasswordInput)
class Meta:
fields = ['name', 'email', 'password']
# class HandlerForm(forms.... | [
"django.forms.CharField"
] | [((66, 96), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (81, 96), False, 'from django import forms\n'), ((109, 164), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(30)', 'widget': 'forms.EmailInput'}), '(max_length=30, widget=forms.EmailInput)\n', ... |
import json
import torch
import numpy as np
import os
#from pytorch_pretrained_bert import BertTokenizer
from transformers import BertTokenizer
class BertWordFormatter:
def __init__(self, config, mode):
self.max_question_len = config.getint("data", "max_question_len")
self.max_option_len = config.g... | [
"torch.tensor",
"numpy.array"
] | [((2646, 2691), 'torch.tensor', 'torch.tensor', (['all_input_ids'], {'dtype': 'torch.long'}), '(all_input_ids, dtype=torch.long)\n', (2658, 2691), False, 'import torch\n'), ((2717, 2763), 'torch.tensor', 'torch.tensor', (['all_input_mask'], {'dtype': 'torch.long'}), '(all_input_mask, dtype=torch.long)\n', (2729, 2763),... |
from django.db import models
from datetime import datetime
from django.contrib import messages
from django.dispatch import receiver
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from polymorphic.models import PolymorphicModel
from Blog.models import Comment, Article, Announc... | [
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.db.models.BooleanField",
"django.dispatch.receiver",
"django.contrib.auth.models.User.objects.all",
"django.db.models.CharField"
] | [((1374, 1414), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'Announcement'}), '(post_save, sender=Announcement)\n', (1382, 1414), False, 'from django.dispatch import receiver\n'), ((1753, 1788), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'Article'}), '(post_save, sender=Ar... |
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Camptocamp SA
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# l... | [
"c2cgeoportal.lib.wfsparsing.limit_featurecollection",
"c2cgeoportal.lib.wfsparsing.is_get_feature"
] | [((1818, 1844), 'c2cgeoportal.lib.wfsparsing.is_get_feature', 'is_get_feature', (['getfeature'], {}), '(getfeature)\n', (1832, 1844), False, 'from c2cgeoportal.lib.wfsparsing import is_get_feature\n'), ((2276, 2327), 'c2cgeoportal.lib.wfsparsing.limit_featurecollection', 'limit_featurecollection', (['featurecollection_... |