code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import socket
import sys
def create_socket():
try:
global host
global port
global s
host = '127.0.0.1'
port = 9999
s = socket.socket() # actual conversation between server and client
except socket.error as msg:
print("... | [
"socket.socket",
"sys.exit"
] | [((218, 233), 'socket.socket', 'socket.socket', ([], {}), '()\n', (231, 233), False, 'import socket\n'), ((1688, 1698), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1696, 1698), False, 'import sys\n')] |
# Generated by Django 2.2.7 on 2020-01-06 17:15
from django.db import migrations, models
class Migration(migrations.Migration):
atomic = False
dependencies = [
("mds", "0002_pre_compliance_extra"),
]
operations = [
migrations.SeparateDatabaseAndState(
database_operations... | [
"django.db.models.Q",
"django.db.migrations.RunSQL"
] | [((339, 513), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""CREATE INDEX CONCURRENTLY IF NOT EXISTS "device_mds_events_partial" ON "mds_eventrecord" ("device_id") WHERE NOT ("event_type" = \'telemetry\')"""'], {}), '(\n \'CREATE INDEX CONCURRENTLY IF NOT EXISTS "device_mds_events_partial" ON "mds_eventre... |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright SAS Institute
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | [
"sasoptpy.Constraint",
"sasoptpy.Variable",
"sasoptpy.reset"
] | [((895, 916), 'sasoptpy.Variable', 'so.Variable', ([], {'name': '"""x"""'}), "(name='x')\n", (906, 916), True, 'import sasoptpy as so\n'), ((964, 996), 'sasoptpy.Constraint', 'so.Constraint', ([], {'exp': 'c2', 'name': '"""c3"""'}), "(exp=c2, name='c3')\n", (977, 996), True, 'import sasoptpy as so\n'), ((1208, 1236), '... |
import json
import os
import matplotlib.pyplot as plt
import networkx as nx
import pandas as pd
import redis
from bs4 import BeautifulSoup
from stellargraph import StellarGraph
from dataprep.alexa_scrapper import ScrapeAlexa
from dataprep.scrape_all_alexa_information import main
from dataprep.load_annotated_data impo... | [
"os.path.exists",
"json.dumps",
"os.path.join",
"redis.Redis",
"bs4.BeautifulSoup",
"json.load",
"matplotlib.pyplot.figure",
"dataprep.alexa_scrapper.ScrapeAlexa",
"dataprep.scrape_all_alexa_information.main",
"dataprep.load_annotated_data.load_corpus",
"stellargraph.StellarGraph",
"pandas.Dat... | [((425, 460), 'os.path.join', 'os.path.join', (['_PROJECT_PATH', '"""data"""'], {}), "(_PROJECT_PATH, 'data')\n", (437, 460), False, 'import os\n'), ((473, 523), 'os.path.join', 'os.path.join', (['_PROJECT_PATH', '"""dataset"""', '"""all_data"""'], {}), "(_PROJECT_PATH, 'dataset', 'all_data')\n", (485, 523), False, 'im... |
import os
import sys
import json
import requests
folder = '../../data/Episodes/'
downloaded = os.listdir(folder)
download_links = {}
with open('download_links.json', 'r') as f:
download_links = json.load(f)
f.close()
for episode in download_links:
filename = episode + '.mp4'
if filename in downloaded... | [
"os.listdir",
"requests.get",
"json.load",
"sys.stdout.flush",
"sys.stdout.write"
] | [((95, 113), 'os.listdir', 'os.listdir', (['folder'], {}), '(folder)\n', (105, 113), False, 'import os\n'), ((200, 212), 'json.load', 'json.load', (['f'], {}), '(f)\n', (209, 212), False, 'import json\n'), ((403, 455), 'requests.get', 'requests.get', (['url'], {'allow_redirects': '(True)', 'stream': '(True)'}), '(url, ... |
import re
import os
import sys
import random
import argparse
from datetime import datetime
import spacy
import msgpack, time
import numpy as np
import multiprocessing
import unicodedata
import collections
import torch
from torch.autograd import Variable
from apip import utils
from apip.model import DocReaderModel
p... | [
"apip.model.DocReaderModel",
"multiprocessing.cpu_count",
"argparse.ArgumentParser",
"torch.set_printoptions",
"spacy.load",
"apip.utils.add_arguments",
"apip.utils.score",
"numpy.take",
"random.random",
"unicodedata.normalize",
"msgpack.load",
"torch.Tensor",
"re.sub",
"torch.manual_seed"... | [((328, 397), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train a Document Reader model."""'}), "(description='Train a Document Reader model.')\n", (351, 397), False, 'import argparse\n'), ((413, 440), 'apip.utils.add_arguments', 'utils.add_arguments', (['parser'], {}), '(parser)\n', ... |
from abc import ABC, abstractmethod
import numpy as np
class Correlation(ABC):
"""
Abstract base class of all Correlations. Serves as a template for creating new Kriging correlation
functions.
"""
@abstractmethod
def c(self, x, s, params, dt=False, dx=False):
"""
Abstract meth... | [
"numpy.atleast_2d",
"numpy.minimum",
"numpy.size",
"numpy.sign",
"numpy.atleast_3d"
] | [((1213, 1252), 'numpy.minimum', 'np.minimum', (['after_parameters', 'comp_ones'], {}), '(after_parameters, comp_ones)\n', (1223, 1252), True, 'import numpy as np\n'), ((513, 529), 'numpy.atleast_2d', 'np.atleast_2d', (['x'], {}), '(x)\n', (526, 529), True, 'import numpy as np\n'), ((531, 547), 'numpy.atleast_2d', 'np.... |
"""Constants for the Axis component."""
import logging
from openpeerpower.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from openpeerpower.components.camera import DOMAIN as CAMERA_DOMAIN
from openpeerpower.components.light import DOMAIN as LIGHT_DOMAIN
from openpeerpower.components.switch import DOMA... | [
"logging.getLogger"
] | [((350, 380), 'logging.getLogger', 'logging.getLogger', (['__package__'], {}), '(__package__)\n', (367, 380), False, 'import logging\n')] |
# -*- coding: utf-8 -*-
"""jira_lex.py: Django datatableview_advanced_search"""
from __future__ import unicode_literals
from __future__ import print_function
import sys
import logging
from datetime import date
__author__ = '<NAME>'
__date__ = '2/28/18 9:20 AM'
__copyright__ = 'Copyright 2018 IC Manage. All rights r... | [
"logging.getLogger",
"logging.basicConfig",
"argparse.ArgumentParser",
"ply.lex.lex",
"datetime.date"
] | [((364, 391), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (381, 391), False, 'import logging\n'), ((2836, 2999), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'datefmt': '"""%H:%M:%S"""', 'stream': 'sys.stdout', 'format': '"""%(asctime)s %(levelname)s [%... |
# coding:utf-8
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import qtawesome
from time import sleep, ctime
import numpy as np
import sys
import cv2
from Camera.in_GUI_init_layout import Initor_for_event
from func.facenet import FaceDet
... | [
"qtawesome.icon",
"func.facenet.FaceDet",
"time.sleep",
"cv2.VideoCapture",
"cv2.cvtColor",
"PyQt5.QtCore.QCoreApplication.setAttribute"
] | [((2029, 2100), 'PyQt5.QtCore.QCoreApplication.setAttribute', 'QtCore.QCoreApplication.setAttribute', (['QtCore.Qt.AA_EnableHighDpiScaling'], {}), '(QtCore.Qt.AA_EnableHighDpiScaling)\n', (2065, 2100), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((2164, 2187), 'cv2.VideoCapture', 'cv2.VideoCapture', (['inde... |
import os
class Config:
SECRET_KEY = os.getenv('SECRET_KEY', 'kaharakey')
DEBUG = False
class DevelopmentConfig(Config):
DATABASE_URL = os.environ['DATABASE_URL']
DEBUG = True
class TestingConfig(Config):
DEBUG = True
TESTING = True
DATABASE_URL = os.getenv('DATABASE_TEST_URI')
... | [
"os.getenv"
] | [((43, 79), 'os.getenv', 'os.getenv', (['"""SECRET_KEY"""', '"""kaharakey"""'], {}), "('SECRET_KEY', 'kaharakey')\n", (52, 79), False, 'import os\n'), ((288, 318), 'os.getenv', 'os.getenv', (['"""DATABASE_TEST_URI"""'], {}), "('DATABASE_TEST_URI')\n", (297, 318), False, 'import os\n')] |
import nose.tools as nt
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
from treeano.sandbox.nodes import resnet
fX = theano.config.floatX
def test_zero_last_axis_partition_node():
network = tn.SequentialNode(
"s",
[tn.InputNode("i", shape=(No... | [
"treeano.sandbox.nodes.resnet._ZeroLastAxisPartitionNode",
"treeano.nodes.InputNode",
"numpy.arange"
] | [((464, 477), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (473, 477), True, 'import numpy as np\n'), ((293, 325), 'treeano.nodes.InputNode', 'tn.InputNode', (['"""i"""'], {'shape': '(None,)'}), "('i', shape=(None,))\n", (305, 325), True, 'import treeano.nodes as tn\n'), ((336, 398), 'treeano.sandbox.nodes.re... |
import struct
import json
import socket
from .. import const
from ..Remote import Remote
from ..Node import Node
class TCPRPC(object):
def __init__(self, service, loop):
self.service = service
self.loop = loop
def pack_ping(self, local, remote, echo):
"""Pack Ping Message
Ar... | [
"socket.inet_aton",
"struct.pack"
] | [((7577, 7606), 'socket.inet_aton', 'socket.inet_aton', (['remote.host'], {}), '(remote.host)\n', (7593, 7606), False, 'import socket\n'), ((524, 564), 'struct.pack', 'struct.pack', (['"""B"""', 'const.kad.command.PING'], {}), "('B', const.kad.command.PING)\n", (535, 564), False, 'import struct\n'), ((947, 987), 'struc... |
"""
@Project : DuReader
@Module : word2vec_evaluation.py
@Author : Deco [<EMAIL>]
@Created : 5/4/18 11:07 AM
@Desc :
Analogy task for word2vec evaluation
Word2vec training is an unsupervised task, there’s no good way to objectively
evaluate the result. Evaluation depends on your end application.
Google... | [
"logging.basicConfig",
"gensim.models.Word2Vec.load",
"os.path.join",
"os.path.abspath"
] | [((746, 812), 'os.path.join', 'os.path.join', (['base_dir', '"""gensim2/data/word2vec_text8_google.model"""'], {}), "(base_dir, 'gensim2/data/word2vec_text8_google.model')\n", (758, 812), False, 'import os\n'), ((814, 909), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s : %(levelname)s : ... |
import os
import cv2
import numpy as np
if __name__ == "__main__":
img_file = "./sample.jpeg"
img1 = cv2.imread(img_file)
img = cv2.resize(img1,(640,400))
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
retval, bin_img = cv2.threshold(gray_img, 120, 255, cv2.THRESH_BINARY )
img_median = cv2.... | [
"cv2.drawContours",
"cv2.dilate",
"cv2.threshold",
"cv2.erode",
"cv2.medianBlur",
"cv2.imshow",
"cv2.contourArea",
"cv2.isContourConvex",
"cv2.getStructuringElement",
"cv2.waitKey",
"cv2.cvtColor",
"cv2.findContours",
"cv2.resize",
"cv2.imread"
] | [((111, 131), 'cv2.imread', 'cv2.imread', (['img_file'], {}), '(img_file)\n', (121, 131), False, 'import cv2\n'), ((143, 171), 'cv2.resize', 'cv2.resize', (['img1', '(640, 400)'], {}), '(img1, (640, 400))\n', (153, 171), False, 'import cv2\n'), ((185, 222), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY']... |
# coding=utf-8
# All code, with the only exception being formalities and formatting, is made by community member b-morgan,
# because of the issue discussed in this thread;
# https://community.octoprint.org/t/temperature-reporting-now-working-with-new-ender-3-v2/21053
# Distributed with his accept, due to testing limi... | [
"re.compile"
] | [((729, 772), 're.compile', 're.compile', (["('(T\\\\d*)\\\\1::' + double_pattern)"], {}), "('(T\\\\d*)\\\\1::' + double_pattern)\n", (739, 772), False, 'import re\n'), ((793, 832), 're.compile', 're.compile', (["('(B)\\\\1::' + double_pattern)"], {}), "('(B)\\\\1::' + double_pattern)\n", (803, 832), False, 'import re\... |
from datetime import date
atual = date.today().year
nascimento = int(input('Informe o ano de seu nascimento: '))
idade = atual - nascimento
if idade==18:
print('Você tem {}. É hora de se alistar no serviço militar'.format(idade))
elif idade<18:
saldo = 18-idade
print('Você tem {}. Ainda faltam {} anos par s... | [
"datetime.date.today"
] | [((34, 46), 'datetime.date.today', 'date.today', ([], {}), '()\n', (44, 46), False, 'from datetime import date\n')] |
# -*- coding: utf-8 -*-
# Copyright 2021 <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 agr... | [
"pytest.mark.parametrize",
"astroid.extract_node"
] | [((1755, 1830), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""platform"""', "('Linux', 'Darwin', 'Java', 'Windows')"], {}), "('platform', ('Linux', 'Darwin', 'Java', 'Windows'))\n", (1778, 1830), False, 'import pytest\n'), ((1859, 1924), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""function... |
from model.contact import ContactMainInfo
from selenium.webdriver.support.select import Select
import re
import random
class ContactHelper:
def __init__(self, app):
self.app = app
def open_contact_page(self):
wd = self.app.wd
if not (wd.current_url.endswith("/addressbook/") and len(wd... | [
"model.contact.ContactMainInfo",
"re.sub",
"re.search"
] | [((10061, 10087), 're.sub', 're.sub', (['"""[() - \n]"""', '""""""', 's'], {}), "('[() - \\n]', '', s)\n", (10067, 10087), False, 'import re\n'), ((9311, 9528), 'model.contact.ContactMainInfo', 'ContactMainInfo', ([], {'id': 'id', 'firstname': 'firstname', 'lastname': 'lastname', 'homephone': 'homephone', 'mobilephone'... |
from django.db import models
from NCPWD.apps.topics.models import Topic
from datetime import datetime
from NCPWD.apps.authentication.models import User
class Comments(models.Model):
author = models.ForeignKey(User, on_delete=models.CASCADE)
topic = models.ForeignKey(Topic, on_delete=models.CASCADE)
body =... | [
"django.db.models.DateTimeField",
"django.db.models.TextField",
"django.db.models.ForeignKey"
] | [((197, 246), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'on_delete': 'models.CASCADE'}), '(User, on_delete=models.CASCADE)\n', (214, 246), False, 'from django.db import models\n'), ((259, 309), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Topic'], {'on_delete': 'models.CASCADE'}), '(Topi... |
from pkg_resources import get_distribution
from signaling.signal import Signal
def version():
return get_distribution(__name__).version
__version__ = version()
__all__ = ['Signal']
| [
"pkg_resources.get_distribution"
] | [((108, 134), 'pkg_resources.get_distribution', 'get_distribution', (['__name__'], {}), '(__name__)\n', (124, 134), False, 'from pkg_resources import get_distribution\n')] |
#!/usr/bin/env python
import click
import pathlib
import re
import pyhf
import json
from functools import wraps
from time import time
pattern = re.compile("(\d+(?:p[05])?)_(\d+(?:p[05])?)")
total_time = []
def timeit(f):
@wraps(f)
def wrapper(*args, **kwargs):
start = time()
result = f(*arg... | [
"click.Choice",
"re.compile",
"click.option",
"pathlib.Path",
"functools.wraps",
"click.echo",
"pyhf.set_backend",
"click.command",
"time.time"
] | [((146, 193), 're.compile', 're.compile', (['"""(\\\\d+(?:p[05])?)_(\\\\d+(?:p[05])?)"""'], {}), "('(\\\\d+(?:p[05])?)_(\\\\d+(?:p[05])?)')\n", (156, 193), False, 'import re\n'), ((1246, 1261), 'click.command', 'click.command', ([], {}), '()\n', (1259, 1261), False, 'import click\n'), ((1384, 1443), 'click.option', 'cl... |
"""Random select substitution; save substituted structure and JSON info"""
import warnings
warnings.simplefilter('ignore')
import errno
import functools
import glob
import math
import os
import random
import re
import signal
import sys
import numpy as np
import pandas as pd
import pymatgen
import shry
from ase import... | [
"re.compile",
"shry.main.LabeledStructure.from_file",
"shry.core.Substitutor",
"signal.alarm",
"os.strerror",
"os.remove",
"pymatgen.core.composition.Composition",
"numpy.where",
"pymatgen.io.cif.CifParser",
"functools.wraps",
"os.path.isdir",
"pandas.DataFrame",
"warnings.simplefilter",
"... | [((91, 122), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (112, 122), False, 'import warnings\n'), ((2390, 2435), 're.compile', 're.compile', (['"""[A-z][a-z]*[0-9.\\\\+\\\\-]*[0-9.]*"""'], {}), "('[A-z][a-z]*[0-9.\\\\+\\\\-]*[0-9.]*')\n", (2400, 2435), False, 'import re\n')... |
import pytest
import torch
from pearl.common import NodeValueType
from pearl.data import BayesianNetworkDataset, VariableData
@pytest.fixture
def model_1_dataset():
N = 1000
a = (
torch.distributions.Categorical(probs=torch.tensor([0.25, 0.75]))
.sample((N,))
.float()
)
b = to... | [
"pearl.data.VariableData",
"torch.stack",
"pearl.data.BayesianNetworkDataset",
"torch.eq",
"torch.tensor",
"torch.empty"
] | [((407, 423), 'torch.eq', 'torch.eq', (['a', '(0.0)'], {}), '(a, 0.0)\n', (415, 423), False, 'import torch\n'), ((432, 449), 'torch.empty', 'torch.empty', (['(N,)'], {}), '((N,))\n', (443, 449), False, 'import torch\n'), ((1713, 1750), 'pearl.data.BayesianNetworkDataset', 'BayesianNetworkDataset', (['variable_dict'], {... |
from __future__ import print_function
from stompy.grid import unstructured_grid
import numpy as np
import logging
log=logging.getLogger(__name__)
from shapely import geometry
import xarray as xr
# TODO: migrate to xarray
from ...io import qnc
from ... import utils
# for now, only supports 2D/3D grid - no mix with 1D... | [
"logging.getLogger",
"numpy.diff",
"numpy.any",
"numpy.asanyarray",
"numpy.issubdtype",
"numpy.array",
"shapely.geometry.LineString",
"numpy.isnan",
"xarray.open_dataset"
] | [((118, 145), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (135, 145), False, 'import logging\n'), ((13680, 13705), 'numpy.asanyarray', 'np.asanyarray', (['linestring'], {}), '(linestring)\n', (13693, 13705), True, 'import numpy as np\n'), ((14564, 14595), 'shapely.geometry.LineString',... |
import os
from dataloaders.visual_genome import VG, vg_collate
from lib.utils import define_model, load_ckpt, do_test
from config import cfg
from torch.utils.data import DataLoader
test_data = VG(cfg.test_data_name, num_val_im=5000, filter_duplicate_rels=True,
use_proposals=cfg.use_proposals, filter_no... | [
"os.path.exists",
"lib.utils.define_model",
"lib.utils.do_test",
"dataloaders.visual_genome.vg_collate",
"lib.utils.load_ckpt",
"dataloaders.visual_genome.VG"
] | [((195, 362), 'dataloaders.visual_genome.VG', 'VG', (['cfg.test_data_name'], {'num_val_im': '(5000)', 'filter_duplicate_rels': '(True)', 'use_proposals': 'cfg.use_proposals', 'filter_non_overlap': "(cfg.mode == 'sgdet')", 'num_im': 'cfg.num_im'}), "(cfg.test_data_name, num_val_im=5000, filter_duplicate_rels=True,\n ... |
import torch
import torch.nn.functional as F
import numpy as np
import math
import random
import sys
sys.path.append("../")
from causal_graphs.variable_distributions import _random_categ
from causal_discovery.datasets import InterventionalDataset
class GraphFitting(object):
def __init__(self, model, graph, num_... | [
"torch.bernoulli",
"math.ceil",
"random.shuffle",
"torch.eye",
"torch.sigmoid",
"numpy.argmax",
"torch.from_numpy",
"causal_graphs.variable_distributions._random_categ",
"numpy.random.multinomial",
"torch.arange",
"torch.nn.functional.cross_entropy",
"torch.no_grad",
"torch.zeros_like",
"c... | [((101, 123), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (116, 123), False, 'import sys\n'), ((4683, 4698), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (4696, 4698), False, 'import torch\n'), ((9744, 9759), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (9757, 9759), False, 'im... |
#this code is the workbench for q-learning
#it consists on a lifting particle that must reach a certain height
#it is only subjected to gravity
#Force applied to the particle might be fixed 9.9 or 9.7N
import numpy as np
import math
import random
import matplotlib.pyplot as plt
#INITIALIZE VARIABLES
####... | [
"numpy.ones",
"numpy.where",
"numpy.linspace",
"numpy.zeros",
"numpy.random.uniform",
"random.randint",
"numpy.random.permutation"
] | [((533, 589), 'numpy.linspace', 'np.linspace', (['(0)', '(Final_height + 10)', '(Final_height + 10 + 1)'], {}), '(0, Final_height + 10, Final_height + 10 + 1)\n', (544, 589), True, 'import numpy as np\n'), ((661, 691), 'numpy.linspace', 'np.linspace', (['(-10)', '(50)', 'n_speeds'], {}), '(-10, 50, n_speeds)\n', (672, ... |
from yarl import URL
from platform_registry_api.config import (
AuthConfig,
Config,
EnvironConfigFactory,
SentryConfig,
ServerConfig,
UpstreamRegistryConfig,
UpstreamType,
ZipkinConfig,
)
class TestEnvironConfigFactory:
def test_defaults_oauth(self) -> None:
environ = {
... | [
"platform_registry_api.config.ServerConfig",
"platform_registry_api.config.EnvironConfigFactory",
"yarl.URL",
"platform_registry_api.config.AuthConfig"
] | [((886, 923), 'platform_registry_api.config.EnvironConfigFactory', 'EnvironConfigFactory', ([], {'environ': 'environ'}), '(environ=environ)\n', (906, 923), False, 'from platform_registry_api.config import AuthConfig, Config, EnvironConfigFactory, SentryConfig, ServerConfig, UpstreamRegistryConfig, UpstreamType, ZipkinC... |
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the OpenTimelineIO project
"""Algorithms for timeline objects."""
import copy
from . import (
track_algo
)
def timeline_trimmed_to_range(in_timeline, trim_range):
"""Returns a new timeline that is a copy of the in_timeline, but with items
... | [
"copy.deepcopy"
] | [((713, 739), 'copy.deepcopy', 'copy.deepcopy', (['in_timeline'], {}), '(in_timeline)\n', (726, 739), False, 'import copy\n')] |
import importlib.resources as resources
import json
import fastjsonschema
from .. import formats
# noinspection PyTypeChecker
with resources.open_text(formats, 'enrichment_tables_v5.json') as f:
# Use this method to validate the content of an enrichment table
validate_enrichment_table = fastjsonschema.compil... | [
"importlib.resources.open_text",
"json.load"
] | [((134, 191), 'importlib.resources.open_text', 'resources.open_text', (['formats', '"""enrichment_tables_v5.json"""'], {}), "(formats, 'enrichment_tables_v5.json')\n", (153, 191), True, 'import importlib.resources as resources\n'), ((322, 334), 'json.load', 'json.load', (['f'], {}), '(f)\n', (331, 334), False, 'import ... |
from __future__ import print_function
import numpy as np
def IsPowerOfTwo(i):
"""Returns true if all entries of i are powers of two, False otherwise.
"""
return (i & (i - 1)) == 0 and i != 0
def Log2ofPowerof2(shape):
""" Returns powers of two exponent for each element of shape
"""
res = ... | [
"numpy.fft.irfft2",
"numpy.fft.rfft2",
"numpy.array",
"numpy.zeros",
"numpy.all"
] | [((320, 335), 'numpy.array', 'np.array', (['shape'], {}), '(shape)\n', (328, 335), True, 'import numpy as np\n'), ((923, 941), 'numpy.all', 'np.all', (['(N % 2 == 0)'], {}), '(N % 2 == 0)\n', (929, 941), True, 'import numpy as np\n'), ((1709, 1733), 'numpy.all', 'np.all', (['(LD_res == HD_res)'], {}), '(LD_res == HD_re... |
# Generated by Django 2.0.4 on 2019-02-22 14:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('carPooling', '0010_auto_20190222_1358'),
]
operations = [
migrations.AddField(
model_name='carpoolingrecdetail',
nam... | [
"django.db.models.CharField"
] | [((348, 450), 'django.db.models.CharField', 'models.CharField', ([], {'db_index': '(True)', 'default': '"""aaa"""', 'max_length': '(128)', 'unique': '(True)', 'verbose_name': '"""行程唯一id"""'}), "(db_index=True, default='aaa', max_length=128, unique=True,\n verbose_name='行程唯一id')\n", (364, 450), False, 'from django.db... |
import sqlite3
from pprint import pprint
import json
from pathlib import Path
from time import perf_counter, sleep
import multiprocessing as mp
#from multiprocessing import Pipe, Process
#from multiprocessing.connection import Connection
from multiprocessing.connection import Connection
from enum import Enum
from colle... | [
"collections.namedtuple",
"sqlite3.connect",
"matplotlib.use",
"multiprocessing.Process",
"time.perf_counter",
"time.sleep",
"api.get_aggregate_trades",
"multiprocessing.Pipe"
] | [((364, 415), 'matplotlib.use', 'matplotlib.use', (['"""module://matplotlib-backend-kitty"""'], {}), "('module://matplotlib-backend-kitty')\n", (378, 415), False, 'import matplotlib\n'), ((713, 747), 'collections.namedtuple', 'namedtuple', (['"""Message"""', '"""type args"""'], {}), "('Message', 'type args')\n", (723, ... |
import numpy as np
import pytest # noqa: F401
from pandas_datareader._utils import RemoteDataError
from epymetheus.datasets import fetch_usstocks
# --------------------------------------------------------------------------------
def test_toomanyasset():
"""
Test if fetch_usstocks raises ValueError
when... | [
"epymetheus.datasets.fetch_usstocks",
"pytest.raises",
"numpy.isnan"
] | [((359, 384), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueError)\n', (372, 384), False, 'import pytest\n'), ((394, 423), 'epymetheus.datasets.fetch_usstocks', 'fetch_usstocks', ([], {'n_assets': '(1000)'}), '(n_assets=1000)\n', (408, 423), False, 'from epymetheus.datasets import fetch_usstocks\n'), (... |
import math
import numpy as np
import cv2
import sys
# # Implement the functions below.
def extract_red(image):
""" Returns the red channel of the input image. It is highly recommended to make a copy of the
input image in order to avoid modifying the original array. You can do this by calling:
temp_image... | [
"numpy.copy",
"numpy.mean",
"cv2.normalize",
"cv2.copyMakeBorder",
"numpy.std",
"numpy.floor",
"numpy.max",
"numpy.zeros",
"numpy.min",
"numpy.random.randn"
] | [((589, 612), 'numpy.copy', 'np.copy', (['image[:, :, 2]'], {}), '(image[:, :, 2])\n', (596, 612), True, 'import numpy as np\n'), ((1085, 1108), 'numpy.copy', 'np.copy', (['image[:, :, 1]'], {}), '(image[:, :, 1])\n', (1092, 1108), True, 'import numpy as np\n'), ((1588, 1611), 'numpy.copy', 'np.copy', (['image[:, :, 0]... |
#env 3.7
from PIL import Image,ImageFont
import textwrap
from pathlib import Path
def find_text_in_image(imgPath):
image = Image.open(imgPath)
red_band = image.split()[0]
xSize = image.size[0]
ySize = image.size[1]
newImage = Image.new("RGB", image.size)
imagePixels = newImage.load()
for ... | [
"PIL.Image.new",
"PIL.Image.open",
"pathlib.Path"
] | [((136, 155), 'PIL.Image.open', 'Image.open', (['imgPath'], {}), '(imgPath)\n', (146, 155), False, 'from PIL import Image, ImageFont\n'), ((251, 279), 'PIL.Image.new', 'Image.new', (['"""RGB"""', 'image.size'], {}), "('RGB', image.size)\n", (260, 279), False, 'from PIL import Image, ImageFont\n'), ((522, 535), 'pathlib... |
#!python
# -*- coding: utf-8 -*-
"""Hello World in Python with database integration.
Python version used: 3.6.8
SQLite version used: 3.21.0
Styling guide: PEP 8 -- Style Guide for Python Code
(https://www.python.org/dev/peps/pep-0008/) and
PEP 257 -- Docstring Conventions
(https://www.python.org/dev/peps... | [
"Python.hello.models.database_functions.update_user",
"Python.hello.models.database_functions.get_all_users",
"Python.hello.models.database_functions.create_user",
"Python.hello.models.database_functions.user_exists",
"Python.hello.models.database_functions.database_exists",
"Python.hello.models.user_clas... | [((929, 949), 'Python.hello.models.database_functions.database_exists', 'db.database_exists', ([], {}), '()\n', (947, 949), True, 'from Python.hello.models import database_functions as db\n'), ((1092, 1110), 'Python.hello.models.database_functions.get_all_users', 'db.get_all_users', ([], {}), '()\n', (1108, 1110), True... |
from franka_interface_msgs.msg import SensorData, SensorDataGroup
def sensor_proto2ros_msg(sensor_proto_msg, sensor_data_type, info=''):
sensor_ros_msg = SensorData()
sensor_ros_msg.type = sensor_data_type
sensor_ros_msg.info = info
sensor_data_bytes = sensor_proto_msg.SerializeToString()
sensor... | [
"franka_interface_msgs.msg.SensorData",
"franka_interface_msgs.msg.SensorDataGroup"
] | [((160, 172), 'franka_interface_msgs.msg.SensorData', 'SensorData', ([], {}), '()\n', (170, 172), False, 'from franka_interface_msgs.msg import SensorData, SensorDataGroup\n'), ((600, 617), 'franka_interface_msgs.msg.SensorDataGroup', 'SensorDataGroup', ([], {}), '()\n', (615, 617), False, 'from franka_interface_msgs.m... |
from datetime import datetime
from Myna import db
from werkzeug.security import generate_password_hash, check_password_hash, new_hash
from Myna import login
from flask_login import UserMixin
from .Hornbill import IMGresizer
from Myna.config import Config
import os
from Myna import photos
followers = db.Table('follower... | [
"Myna.db.relationship",
"Myna.db.Column",
"os.path.join",
"Myna.db.ForeignKey",
"Myna.db.backref",
"werkzeug.security.generate_password_hash",
"Myna.db.String",
"werkzeug.security.check_password_hash"
] | [((504, 563), 'Myna.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)', 'autoincrement': '(True)'}), '(db.Integer, primary_key=True, autoincrement=True)\n', (513, 563), False, 'from Myna import db\n'), ((797, 856), 'Myna.db.Column', 'db.Column', (['db.DateTime'], {'index': '(True)', 'default': 'datetime... |
import logging
import queue
from logging import LogRecord
from typing import Any, List, Optional, Set, Sized
from puma.context import Exit_1, Exit_2, Exit_3
from puma.logging import LogLevel, Logging, ManagedProcessLogQueue
class CapturedRecords(Sized):
"""Represents the log records captured by CaptureLogContext... | [
"puma.logging.Logging.pause_memory_log_handler",
"puma.logging.Logging.add_memory_log_handler",
"puma.logging.ManagedProcessLogQueue",
"logging.getLevelName",
"puma.logging.Logging.resume_memory_log_handler",
"puma.logging.Logging.remove_memory_log_handler"
] | [((4105, 4147), 'puma.logging.ManagedProcessLogQueue', 'ManagedProcessLogQueue', ([], {'name': '"""log capture"""'}), "(name='log capture')\n", (4127, 4147), False, 'from puma.logging import LogLevel, Logging, ManagedProcessLogQueue\n'), ((4322, 4380), 'puma.logging.Logging.add_memory_log_handler', 'Logging.add_memory_... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
name = 'weibo_2_album'
import cached_url
import yaml
from bs4 import BeautifulSoup
from telegram_util import AlbumResult as Result
from telegram_util import getWid, matchKey
import sys
import os
import hashlib
from PIL import Image
prefix = 'https://m.weibo.cn/statuses/... | [
"PIL.Image.open",
"cached_url.getFilePath",
"os.path.splitext",
"telegram_util.AlbumResult",
"bs4.BeautifulSoup",
"telegram_util.getWid",
"telegram_util.matchKey",
"cached_url.get",
"cached_url.getFileName"
] | [((365, 494), 'telegram_util.matchKey', 'matchKey', (['url', "['video.weibo.com', '/openapp', 'feature/applink', 'weibo.com/tv',\n 'miaopai.', 'm.weibo.cn/p/index?extparam=']"], {}), "(url, ['video.weibo.com', '/openapp', 'feature/applink',\n 'weibo.com/tv', 'miaopai.', 'm.weibo.cn/p/index?extparam='])\n", (373, ... |
from conans import ConanFile, CMake, tools
class Stm32Conan(ConanFile):
name = "stm32"
version = "0.1"
license = "MIT"
author = "<NAME>"
url = "https://github.com/matt1795/stm32"
description = "Example program for an STM32"
topics = ("embedded", "mcu", "stm32")
generators = "cmake_find_... | [
"conans.CMake"
] | [((626, 637), 'conans.CMake', 'CMake', (['self'], {}), '(self)\n', (631, 637), False, 'from conans import ConanFile, CMake, tools\n')] |
import numpy as np
class IBM:
def __init__(self, config):
self.D = config["ibm"].get('vertical_mixing', 0) # Vertical mixing [m*2/s]
self.dt = config['dt']
self.x = np.array([])
self.y = np.array([])
self.pid = np.array([])
self.land_collision = config["ibm"].get('... | [
"numpy.intersect1d",
"numpy.random.rand",
"numpy.count_nonzero",
"numpy.array",
"numpy.round"
] | [((196, 208), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (204, 208), True, 'import numpy as np\n'), ((226, 238), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (234, 238), True, 'import numpy as np\n'), ((258, 270), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (266, 270), True, 'import numpy as np\n')... |
from django.shortcuts import render
from rest_framework.decorators import api_view
from rest_framework.views import APIView
from .trash_detection_service import TrashDetectionService
from asgiref.sync import sync_to_async
import asyncio
"""class TrashDetection(APIView):
def post(self, request, format=None):
... | [
"rest_framework.decorators.api_view"
] | [((522, 540), 'rest_framework.decorators.api_view', 'api_view', (["['POST']"], {}), "(['POST'])\n", (530, 540), False, 'from rest_framework.decorators import api_view\n')] |
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 5 00:24:23 2021
@author: 34123
"""
import matplotlib.pyplot as plt
import numpy as np
import random
from scipy.stats import multivariate_normal
def plot_random_init_iris_sepal(df_full):
sepal_df = df_full.iloc[:,0:2]
sepal_df = np.array(sepal_df)
m1 = ... | [
"random.choice",
"matplotlib.pyplot.title",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"numpy.where",
"scipy.stats.multivariate_normal",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.axis",
"numpy.array",
"numpy.linspace",
"matplotlib.pyplot.figure",
"numpy.empty",
"matplotlib.py... | [((287, 305), 'numpy.array', 'np.array', (['sepal_df'], {}), '(sepal_df)\n', (295, 305), True, 'import numpy as np\n'), ((320, 343), 'random.choice', 'random.choice', (['sepal_df'], {}), '(sepal_df)\n', (333, 343), False, 'import random\n'), ((353, 376), 'random.choice', 'random.choice', (['sepal_df'], {}), '(sepal_df)... |
""" Feature Extraction Bert"""
from os.path import join
from torch import nn
from transformers import BertModel
from torch.nn import functional
class BertForFeatureExtraction(nn.Module):
""" Extract Features
Arguments:
nn {[token.tensor,token.tensor]} -- [token ids , attention mask]
Returns:
... | [
"torch.nn.functional.normalize",
"torch.nn.AdaptiveAvgPool2d",
"transformers.BertModel.from_pretrained"
] | [((715, 788), 'transformers.BertModel.from_pretrained', 'BertModel.from_pretrained', (['"""bert-base-uncased"""'], {'output_hidden_states': '(True)'}), "('bert-base-uncased', output_hidden_states=True)\n", (740, 788), False, 'from transformers import BertModel\n'), ((827, 857), 'torch.nn.AdaptiveAvgPool2d', 'nn.Adaptiv... |
# (c) 2020, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import daemon
try:
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
def write_to_outp... | [
"http.server.HTTPServer",
"daemon.DaemonContext"
] | [((853, 900), 'http.server.HTTPServer', 'HTTPServer', (['(hostname, server_port)', 'EchoServer'], {}), '((hostname, server_port), EchoServer)\n', (863, 900), False, 'from http.server import BaseHTTPRequestHandler, HTTPServer\n'), ((1157, 1179), 'daemon.DaemonContext', 'daemon.DaemonContext', ([], {}), '()\n', (1177, 11... |
#python3.8.3
import itertools
import os
import pathlib
import shutil
#IO
from pptx import Presentation
from PIL import Image
from pdf2image import convert_from_path
import json
from io import BytesIO
import subprocess
from glob import glob
#GUI
import tkinter as tk
import tkinter.filedialog as dialog
from tkinter.mes... | [
"tkinter.filedialog.askdirectory",
"io.BytesIO",
"tkinter.Button",
"pptx.Presentation",
"pathlib.Path",
"os.path.isdir",
"tkinter.messagebox.askretrycancel",
"os.mkdir",
"subprocess.call",
"tkinter.filedialog.askopenfilenames",
"tkinter.messagebox.showinfo",
"glob.glob",
"tkinter.filedialog.... | [((805, 830), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (820, 830), False, 'import os\n'), ((9975, 9982), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (9980, 9982), True, 'import tkinter as tk\n'), ((1224, 1242), 'pathlib.Path', 'pathlib.Path', (['iDir'], {}), '(iDir)\n', (1236, 1242), False... |
# -*- coding: utf-8 -*-
"""
Group Routes
List Groups
Count Groups
State of Group
Create Group
Get Group
Add User to Group
Remove User to Group
"""
import asyncio
import uuid
from datetime import datetime
from fastapi import APIRouter, Query, status
from fastapi.responses import JSONResponse, ORJSONResponse
from loguru... | [
"loguru.logger.warning",
"endpoints.groups.validation.check_unique_name",
"com_lib.crud_ops.execute_one_db",
"fastapi.responses.JSONResponse",
"endpoints.groups.validation.check_user_id_exists",
"com_lib.db_setup.groups.update",
"com_lib.db_setup.groups.insert",
"com_lib.crud_ops.fetch_one_db",
"end... | [((726, 737), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (735, 737), False, 'from fastapi import APIRouter, Query, status\n'), ((845, 945), 'fastapi.Query', 'Query', (['None'], {'title': 'title', 'description': '"""Seconds to delay (max 121)"""', 'ge': '(1)', 'le': '(121)', 'alias': '"""delay"""'}), "(None, ti... |
from django.core.management.base import BaseCommand
from dc18.dates import nights, meals
from register.models import AccommNight, Meal
class Command(BaseCommand):
help = 'Create Meal and Night objects in the DB'
def handle(self, *args, **options):
for night in nights(orga=True):
AccommNi... | [
"register.models.AccommNight.objects.get_or_create",
"dc18.dates.meals",
"dc18.dates.nights",
"register.models.Meal.objects.get_or_create"
] | [((281, 298), 'dc18.dates.nights', 'nights', ([], {'orga': '(True)'}), '(orga=True)\n', (287, 298), False, 'from dc18.dates import nights, meals\n'), ((384, 400), 'dc18.dates.meals', 'meals', ([], {'orga': '(True)'}), '(orga=True)\n', (389, 400), False, 'from dc18.dates import nights, meals\n'), ((312, 357), 'register.... |
import copy
from typing import Tuple
from hypothesis import given
from tests.bind_tests.hints import BoundPoint
from tests.integration_tests.utils import are_bound_ported_points_equal
from tests.port_tests.hints import PortedPoint
from . import strategies
@given(strategies.points_pairs)
def test_shallow(points_pair... | [
"hypothesis.given",
"copy.copy",
"copy.deepcopy"
] | [((261, 291), 'hypothesis.given', 'given', (['strategies.points_pairs'], {}), '(strategies.points_pairs)\n', (266, 291), False, 'from hypothesis import given\n'), ((477, 507), 'hypothesis.given', 'given', (['strategies.points_pairs'], {}), '(strategies.points_pairs)\n', (482, 507), False, 'from hypothesis import given\... |
# Generated by Django 2.1.13 on 2020-10-08 20:34
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('clubs', '0006_club_slug_unique'),
migrations.swappable_depende... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((292, 349), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (323, 349), False, 'from django.db import migrations, models\n'), ((1678, 1791), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'djang... |
from unittest import TestCase, main
from preconditions import PreconditionError, preconditions
class PreconditionTestBase (TestCase):
def assertPreconditionFails(self, target, *args, **kw):
self.assertRaises(PreconditionError, target, *args, **kw)
def assertPreconditionFailsRegexp(self, rgx, target,... | [
"unittest.main",
"preconditions.preconditions"
] | [((7005, 7011), 'unittest.main', 'main', ([], {}), '()\n', (7009, 7011), False, 'from unittest import TestCase, main\n'), ((1050, 1079), 'preconditions.preconditions', 'preconditions', (['(lambda x: True)'], {}), '(lambda x: True)\n', (1063, 1079), False, 'from preconditions import PreconditionError, preconditions\n'),... |
# ----------------------------------------------------------------------
# |
# | __init___UnitTest.py
# |
# | <NAME> <<EMAIL>>
# | 2018-04-20 19:31:28
# |
# ----------------------------------------------------------------------
# |
# | Copyright <NAME> 2018-22.
# | Distributed under the Boost Softwar... | [
"CommonEnvironment.Nonlocals",
"collections.OrderedDict",
"textwrap.dedent",
"CommonEnvironment.ObjectReprImplBase.__init__",
"os.path.split",
"six.moves.StringIO",
"unittest.main",
"CommonEnvironment.Describe",
"CommonEnvironment.ThisFullpath"
] | [((814, 846), 'CommonEnvironment.ThisFullpath', 'CommonEnvironment.ThisFullpath', ([], {}), '()\n', (844, 846), False, 'import CommonEnvironment\n'), ((876, 907), 'os.path.split', 'os.path.split', (['_script_fullpath'], {}), '(_script_fullpath)\n', (889, 907), False, 'import os\n'), ((1151, 1196), 'CommonEnvironment.No... |
import asyncio
import time
from telegram import main
import json
from sql_util import get_phone, change_status
from message_util import get_phone_test, cancel_all_recv
from config import message_token
from check_util import check_main
from myLogger import log_main
def run(phone, category):
loop = asyncio.get_eve... | [
"message_util.get_phone_test",
"time.sleep",
"telegram.main",
"message_util.cancel_all_recv",
"asyncio.get_event_loop"
] | [((305, 329), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (327, 329), False, 'import asyncio\n'), ((358, 379), 'telegram.main', 'main', (['phone', 'category'], {}), '(phone, category)\n', (362, 379), False, 'from telegram import main\n'), ((581, 594), 'time.sleep', 'time.sleep', (['(5)'], {}),... |
from typing import TYPE_CHECKING
from beanie.odm.utils.encoder import bson_encoder
if TYPE_CHECKING:
from beanie.odm.documents import Document
def get_dict(document: "Document"):
exclude = set()
if document.id is None:
exclude.add("id")
if not document.get_settings().model_settings.use_revis... | [
"beanie.odm.utils.encoder.bson_encoder.encode"
] | [((371, 432), 'beanie.odm.utils.encoder.bson_encoder.encode', 'bson_encoder.encode', (['document'], {'by_alias': '(True)', 'exclude': 'exclude'}), '(document, by_alias=True, exclude=exclude)\n', (390, 432), False, 'from beanie.odm.utils.encoder import bson_encoder\n')] |
# Copyright (c) 2018, <NAME>. All rights reserved.
# ISC License (ISCL) - see LICENSE file for details.
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="rmchars",
version="0.0.5",
author="<NAME>",
author_email="<EMAIL>",
description="Re... | [
"setuptools.find_packages"
] | [((555, 581), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (579, 581), False, 'import setuptools\n')] |
import logging
import flask
import bhamon_orchestra_website.helpers as helpers
import bhamon_orchestra_website.service_client as service_client
logger = logging.getLogger("ProjectController")
def show_collection():
item_total = service_client.get("/project_count")
pagination = helpers.get_pagination(item_total,... | [
"logging.getLogger",
"flask.render_template",
"flask.request.args.get",
"bhamon_orchestra_website.helpers.add_display_names",
"bhamon_orchestra_website.service_client.get",
"bhamon_orchestra_website.helpers.get_pagination"
] | [((157, 195), 'logging.getLogger', 'logging.getLogger', (['"""ProjectController"""'], {}), "('ProjectController')\n", (174, 195), False, 'import logging\n'), ((235, 271), 'bhamon_orchestra_website.service_client.get', 'service_client.get', (['"""/project_count"""'], {}), "('/project_count')\n", (253, 271), True, 'impor... |
from pygame import mixer
from PySimpleGUI import PySimpleGUI as sg
sg.theme('DarkPurple1') # Definição do tema da interface do programa
layout = [
[sg.Text('MP3 PLAYER'.center(50), font='Consolas')], # Título do programa
[sg.Text('NOME DA MÚSICA:', font='Consolas'), sg.Input(key='music', size=(42, 1))]... | [
"PySimpleGUI.PySimpleGUI.Input",
"PySimpleGUI.PySimpleGUI.theme",
"PySimpleGUI.PySimpleGUI.Window",
"PySimpleGUI.PySimpleGUI.Text",
"pygame.mixer.music.load",
"pygame.mixer.music.play",
"pygame.mixer.init",
"PySimpleGUI.PySimpleGUI.Button"
] | [((71, 94), 'PySimpleGUI.PySimpleGUI.theme', 'sg.theme', (['"""DarkPurple1"""'], {}), "('DarkPurple1')\n", (79, 94), True, 'from PySimpleGUI import PySimpleGUI as sg\n'), ((442, 473), 'PySimpleGUI.PySimpleGUI.Window', 'sg.Window', (['"""Mp3 player"""', 'layout'], {}), "('Mp3 player', layout)\n", (451, 473), True, 'from... |
# -----------------------------------------------------------------------------------------------------------
# Funções auxiliares para predições
# -----------------------------------------------------------------------------------------------------------
import numpy as np
import pandas as pd
import matplotlib.pyplot... | [
"numpy.log2",
"pandas.concat",
"numpy.concatenate"
] | [((1084, 1122), 'pandas.concat', 'pd.concat', (['[train_coords, test_coords]'], {}), '([train_coords, test_coords])\n', (1093, 1122), True, 'import pandas as pd\n'), ((3661, 3699), 'pandas.concat', 'pd.concat', (['[train_coords, test_coords]'], {}), '([train_coords, test_coords])\n', (3670, 3699), True, 'import pandas ... |
# internal
from powerbi_toolkit.classes import PowerbiApp
from powerbi_toolkit.classes import PowerbiWorkspace
from powerbi_toolkit.classes import PowerbiWorkspaceDashboard
from powerbi_toolkit.classes import PowerbiWorkspaceReport
from powerbi_toolkit.classes import PowerbiWorkspaceReportTab
from powerbi_toolkit.class... | [
"logging.getLogger",
"selenium.webdriver.chrome.options.Options",
"powerbi_toolkit.classes.PowerbiWorkspace",
"powerbi_toolkit.classes.PowerbiApp",
"time.sleep",
"powerbi_toolkit.classes.PowerbiWorkspaceReport",
"datetime.datetime.today",
"powerbi_toolkit.classes.PowerbiWorkspaceDashboard",
"logging... | [((981, 1036), 'os.path.abspath', 'os.path.abspath', (["(__file__ + '/../../config/config.json')"], {}), "(__file__ + '/../../config/config.json')\n", (996, 1036), False, 'import os\n'), ((2600, 2609), 'selenium.webdriver.chrome.options.Options', 'Options', ([], {}), '()\n', (2607, 2609), False, 'from selenium.webdrive... |
import pytest
from eth.exceptions import HeaderNotFound
import ape
from ape.api import (
AccountContainerAPI,
EcosystemAPI,
NetworkAPI,
PluginConfig,
ProviderAPI,
ReceiptAPI,
TransactionAPI,
TransactionStatusEnum,
)
from ape.exceptions import ChainError, ContractLogicError
TEST_ADDRESS... | [
"ape.networks.parse_network_choice",
"ape.chain.restore",
"pytest.hookimpl",
"ape.chain.snapshot"
] | [((1435, 1482), 'pytest.hookimpl', 'pytest.hookimpl', ([], {'trylast': '(True)', 'hookwrapper': '(True)'}), '(trylast=True, hookwrapper=True)\n', (1450, 1482), False, 'import pytest\n'), ((1628, 1661), 'pytest.hookimpl', 'pytest.hookimpl', ([], {'hookwrapper': '(True)'}), '(hookwrapper=True)\n', (1643, 1661), False, 'i... |
import numpy as np
import torch
import torch.nn as nn
from habitat_baselines.common.utils import Flatten
from habitat_baselines.rl.models.simple_cnn import SimpleCNN
class Contiguous(nn.Module):
r"""Converts a tensor to be stored contiguously if it is not already so.
"""
def __init__(self):
super... | [
"habitat_baselines.common.utils.Flatten",
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"numpy.array",
"torch.nn.Linear",
"torch.nn.Module.__init__"
] | [((845, 869), 'torch.nn.Module.__init__', 'nn.Module.__init__', (['self'], {}), '(self)\n', (863, 869), True, 'import torch.nn as nn\n'), ((3679, 3703), 'torch.nn.Module.__init__', 'nn.Module.__init__', (['self'], {}), '(self)\n', (3697, 3703), True, 'import torch.nn as nn\n'), ((3948, 4019), 'numpy.array', 'np.array',... |
""" Test listener module """
import mock
from smserver import event
from smserver import server
from smserver.listener import app
from smserver.smutils import smconn
from test import utils
class ListenerTest(utils.DBTest):
""" Test listener module """
def setUp(self):
super().setUp()
self... | [
"mock.patch",
"smserver.smutils.smconn.StepmaniaConn",
"smserver.server.StepmaniaServer",
"smserver.listener.app.Listener",
"smserver.event.Event",
"mock.MagicMock"
] | [((480, 529), 'mock.patch', 'mock.patch', (['"""smserver.messaging.Messaging.listen"""'], {}), "('smserver.messaging.Messaging.listen')\n", (490, 529), False, 'import mock\n'), ((1659, 1723), 'mock.patch', 'mock.patch', (['"""smserver.smutils.smthread.StepmaniaServer.has_room"""'], {}), "('smserver.smutils.smthread.Ste... |
import json
import os
import platform
import random
import sys
from discord.ext.commands.core import command
import requests
from lxml import html
from ast import literal_eval
# uWu quote libraries
from owoify import owoify
import discord
from discord.ext import commands, tasks
from discord.ext.commands import Bot
i... | [
"random.choice",
"random.randrange",
"discord.ext.commands.Bot",
"lxml.html.fromstring",
"json.dumps",
"requests.get",
"owoify.owoify",
"os.path.isfile",
"ast.literal_eval",
"platform.system",
"platform.release",
"discord.ext.commands.core.command.split",
"sys.exit",
"json.load",
"discor... | [((1259, 1284), 'discord.Intents.default', 'discord.Intents.default', ([], {}), '()\n', (1282, 1284), False, 'import discord\n'), ((1292, 1349), 'discord.ext.commands.Bot', 'Bot', ([], {'command_prefix': "config['bot_prefix']", 'intents': 'intents'}), "(command_prefix=config['bot_prefix'], intents=intents)\n", (1295, 1... |
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from wtforms import (StringField, IntegerField, SubmitField, SelectField, TextAreaField, DecimalField)
from wtforms.validators import DataRequired, Length, ValidationError
from WebApp.api.sqlite_tool import sqlite_api
db = "./app/WebApp/... | [
"wtforms.validators.ValidationError",
"flask_wtf.file.FileAllowed",
"wtforms.SubmitField",
"wtforms.StringField",
"WebApp.api.sqlite_tool.sqlite_api",
"wtforms.validators.DataRequired"
] | [((661, 684), 'wtforms.SubmitField', 'SubmitField', (['"""Continue"""'], {}), "('Continue')\n", (672, 684), False, 'from wtforms import StringField, IntegerField, SubmitField, SelectField, TextAreaField, DecimalField\n'), ((1045, 1072), 'wtforms.StringField', 'StringField', (['"""Manufacturer"""'], {}), "('Manufacturer... |
"""
Programa 104
Área de estudos.
data 05.12.2020 (Indefinida) Hs
@Autor: <NAME>
"""
# Usamos o modulo matemático, para truncar valores flutuantes.
import math # utilizando o método "trunc".
# Minha variável de armazenamento de dados.
notas = list()
soma = 0
while True: # Corpo principal, usado para realizar ... | [
"math.trunc"
] | [((1100, 1144), 'math.trunc', 'math.trunc', (['notas[cont + 1 - (cont + 1) * 2]'], {}), '(notas[cont + 1 - (cont + 1) * 2])\n', (1110, 1144), False, 'import math\n')] |
#!/usr/bin/env python
queries={}
queries["list_databases"] = """
SELECT
datname
FROM
pg_database
WHERE
datistemplate = false"""
queries["list_tables"] = """
SELECT
table_catalog,
table_name
FROM
information_schema.tables
WHERE
table_schema='public'
AND
table_type='BASE TABLE'
order by... | [
"json.dump"
] | [((3111, 3143), 'json.dump', 'json.dump', (['queries', 'fh'], {'indent': '(4)'}), '(queries, fh, indent=4)\n', (3120, 3143), False, 'import json\n')] |
"""Citizens URLs."""
# Django
from django.urls import include, path
# Django REST Framework
from rest_framework.routers import DefaultRouter
# Views
from .views import citizens as citizens_views
router = DefaultRouter()
router.register(r'citizens', citizens_views.CitizenViewSet, basename='citizen')
urlpatterns = [p... | [
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((208, 223), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (221, 223), False, 'from rest_framework.routers import DefaultRouter\n'), ((328, 348), 'django.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (335, 348), False, 'from django.urls import include, path\n')] |
#!/usr/bin/python
# Copyright (c) 2015 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 argparse
import errno
import os
import re
import subprocess
import sys
import time
IOS_SIM_PATH = [
'/Applications/iOS Simula... | [
"subprocess.check_output",
"argparse.ArgumentParser",
"subprocess.check_call",
"subprocess.Popen",
"time.sleep",
"os.path.dirname",
"re.search"
] | [((539, 645), 'subprocess.check_output', 'subprocess.check_output', (["(PLIST_BUDDY_PATH + ['-c', 'Print CFBundleIdentifier', '%s/Info.plist' % path])"], {}), "(PLIST_BUDDY_PATH + ['-c',\n 'Print CFBundleIdentifier', '%s/Info.plist' % path])\n", (562, 645), False, 'import subprocess\n'), ((1467, 1536), 'subprocess.c... |
import time
import cv2
import pyscreenshot as ImageGrab
import numpy as np
class Screenshot(object):
def get_frame(self):
img = np.array(ImageGrab.grab().convert('RGB'), dtype=np.uint8)
img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
ret2, jpeg = cv2.imencode('.jpg', img)
return jpeg.tos... | [
"pyscreenshot.grab",
"cv2.imencode",
"cv2.cvtColor"
] | [((213, 249), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_RGB2BGR'], {}), '(img, cv2.COLOR_RGB2BGR)\n', (225, 249), False, 'import cv2\n'), ((271, 296), 'cv2.imencode', 'cv2.imencode', (['""".jpg"""', 'img'], {}), "('.jpg', img)\n", (283, 296), False, 'import cv2\n'), ((150, 166), 'pyscreenshot.grab', 'ImageGra... |
from nextsong.sequence import FiniteSequence as S
import random
assert list(S()) == []
assert list(S(10, 20, 30, 40, 50, 60)) == [10, 20, 30, 40, 50, 60]
for seed in [42, 43, 44, 45]:
print(f"testing seed {seed}")
random.seed(seed)
assert list(S(10, 20, 30, 40, portion=0)) == []
assert len(list(S(10, ... | [
"nextsong.sequence.FiniteSequence",
"random.seed"
] | [((224, 241), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (235, 241), False, 'import random\n'), ((77, 80), 'nextsong.sequence.FiniteSequence', 'S', ([], {}), '()\n', (78, 80), True, 'from nextsong.sequence import FiniteSequence as S\n'), ((100, 125), 'nextsong.sequence.FiniteSequence', 'S', (['(10)', '(2... |
from __future__ import print_function
from boto3.session import Session
import boto3
import json
import os.path
import botocore
import tempfile
import zipfile
import traceback
from jinja2 import Environment, FileSystemLoader
code_pipeline = boto3.client('codepipeline')
class Template:
def __init__(self, name):
... | [
"boto3.session.Session",
"boto3.client",
"zipfile.ZipFile",
"jinja2.Environment",
"botocore.client.Config",
"tempfile.NamedTemporaryFile",
"jinja2.FileSystemLoader",
"traceback.print_exc"
] | [((243, 271), 'boto3.client', 'boto3.client', (['"""codepipeline"""'], {}), "('codepipeline')\n", (255, 271), False, 'import boto3\n'), ((3022, 3063), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)'}), '(delete=False)\n', (3049, 3063), False, 'import tempfile\n'), ((3073, 3113), ... |
from collections import defaultdict
import csv as csv
import codecs
import random
import pandas as pd
get_answers = pd.read_csv('F:/answers.csv', encoding='gb18030') # 读取answers的CSV的表格数据
# get_questions = pd.read_csv('F:/questions.csv', encoding='gb18030') # 读取questions的CSV的表格数据
ans_content1 = get_answers['ans_conte... | [
"codecs.open",
"csv.reader",
"pandas.read_csv"
] | [((117, 166), 'pandas.read_csv', 'pd.read_csv', (['"""F:/answers.csv"""'], {'encoding': '"""gb18030"""'}), "('F:/answers.csv', encoding='gb18030')\n", (128, 166), True, 'import pandas as pd\n'), ((1258, 1309), 'codecs.open', 'codecs.open', (['filename'], {'mode': '"""r"""', 'encoding': '"""gb18030"""'}), "(filename, mo... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""password_recovery.py: A CGI endpoint for handling password recovery"""
import json
import os
import sys
import sqlite3
import auth
import groups
import sendemail
from httperror import HTTPError
RETURN_HEADERS = []
def __do_get():
raise HTTPError("This script i... | [
"sendemail.send_email",
"json.loads",
"sqlite3.connect",
"httperror.HTTPError",
"auth.hash_password",
"json.dumps",
"groups.find_group_by_email",
"sys.stdin.read",
"auth.login",
"auth.generate_random"
] | [((296, 341), 'httperror.HTTPError', 'HTTPError', (['"""This script is NOT GET-able"""', '(403)'], {}), "('This script is NOT GET-able', 403)\n", (305, 341), False, 'from httperror import HTTPError\n'), ((375, 391), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (389, 391), False, 'import sys\n'), ((779, 812), '... |
# Standard Libary
import csv
# First-Party
import reversion
# Local
from .forms import BrotherForm
from .models import User
def import_contacts(path, username):
user = User.objects.get(username=username)
with open(path, 'r') as f:
next(f)
reader = csv.reader(f)
rows = [row for row in... | [
"reversion.create_revision",
"csv.reader",
"reversion.set_comment",
"reversion.set_user"
] | [((276, 289), 'csv.reader', 'csv.reader', (['f'], {}), '(f)\n', (286, 289), False, 'import csv\n'), ((824, 851), 'reversion.create_revision', 'reversion.create_revision', ([], {}), '()\n', (849, 851), False, 'import reversion\n'), ((905, 929), 'reversion.set_user', 'reversion.set_user', (['user'], {}), '(user)\n', (923... |
import unittest
import os, csv, json
import matplotlib.image as mpimg
import numpy as np
from numpy.testing import assert_array_equal
from skimage.measure import compare_ssim as ssim
from src.ea import evolutionary_algorithm
from src.ea.chromosome import Chromosome
class TestEA(unittest.TestCase):
def setUp(sel... | [
"src.ea.evolutionary_algorithm.EvolutionaryAlgorithm",
"skimage.measure.compare_ssim",
"matplotlib.image.imread",
"os.path.join",
"numpy.squeeze",
"os.path.dirname",
"src.ea.chromosome.Chromosome",
"json.load",
"csv.reader",
"numpy.testing.assert_array_equal"
] | [((343, 368), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (358, 368), False, 'import os, csv, json\n'), ((390, 437), 'os.path.join', 'os.path.join', (['rel_path', '"""test_images/00000.png"""'], {}), "(rel_path, 'test_images/00000.png')\n", (402, 437), False, 'import os, csv, json\n'), ((4... |
import logging
from datetime import date
from typing import List
from botocore.client import ClientError
from fastapi import APIRouter, Depends, Path, Query, status
from okdata.aws.logging import log_add
from resources.authorizer import authorize, version_exists
from resources.errors import ErrorResponse, error_messa... | [
"logging.getLogger",
"resources.errors.ErrorResponse",
"services.EventService",
"fastapi.APIRouter",
"resources.authorizer.authorize",
"okdata.aws.logging.log_add",
"services.ElasticsearchDataService",
"fastapi.Query",
"resources.errors.error_message_models",
"fastapi.Path",
"fastapi.Depends"
] | [((468, 487), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (485, 487), False, 'import logging\n'), ((497, 508), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (506, 508), False, 'from fastapi import APIRouter, Depends, Path, Query, status\n'), ((544, 567), 'fastapi.Depends', 'Depends', (['dataset_cl... |
from django.shortcuts import render
from django.template import loader
from django.http import HttpResponse, HttpResponseForbidden, HttpResponseNotAllowed, HttpResponseRedirect, HttpResponseBadRequest, HttpRequest
from django.core.exceptions import PermissionDenied
from django.contrib.auth import authenticate, login, l... | [
"django.http.HttpResponseRedirect",
"django.shortcuts.render",
"django.contrib.auth.authenticate",
"secrets.token_hex",
"django.http.HttpResponseBadRequest",
"django.http.HttpResponseNotAllowed",
"django.http.HttpResponse",
"django.contrib.auth.login",
"activityAPI.models.Activity.objects.filter",
... | [((609, 658), 'django.http.HttpResponse', 'HttpResponse', (['"""Hello world, dashboard_index page"""'], {}), "('Hello world, dashboard_index page')\n", (621, 658), False, 'from django.http import HttpResponse, HttpResponseForbidden, HttpResponseNotAllowed, HttpResponseRedirect, HttpResponseBadRequest, HttpRequest\n'), ... |
import os
from lark import Lark, Transformer, Token
from lark.indenter import Indenter
from ..tree import Node, Composite, Decorator
from .. import actions
class TreeIndenter(Indenter):
NL_type = '_NL'
OPEN_PAREN_types = []
CLOSE_PAREN_types = []
INDENT_type = '_INDENT'
DEDENT_type = '_DEDENT'
... | [
"os.path.dirname"
] | [((3356, 3381), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (3371, 3381), False, 'import os\n')] |
import yaml
import json
def create_yaml_json_files():
dict1 = {'Name': 'chris', 'Country': 'Australia'}
list1 = [range(4), dict1, 'some string', 104]
with open('yaml_file.yml', 'w') as f:
f.write(yaml.dump(list1, default_flow_style=False))
with open('json_file.json', 'w') as f:
... | [
"json.dump",
"yaml.dump"
] | [((324, 343), 'json.dump', 'json.dump', (['list1', 'f'], {}), '(list1, f)\n', (333, 343), False, 'import json\n'), ((228, 270), 'yaml.dump', 'yaml.dump', (['list1'], {'default_flow_style': '(False)'}), '(list1, default_flow_style=False)\n', (237, 270), False, 'import yaml\n')] |
#!/usr/bin/python
"""
Utility script with functions used in lr classifier and cnn classifier.
For data preparation:
- get_train_test(): from dataframe, and specified columns, get train and test data and labels
- tokenize_text(): tokenize a list of texts, and return tokenized texts
- pad_texts(): add padding t... | [
"tensorflow.keras.preprocessing.sequence.pad_sequences",
"matplotlib.pyplot.ylabel",
"tensorflow.keras.utils.plot_model",
"numpy.array",
"numpy.arange",
"sklearn.preprocessing.LabelBinarizer",
"os.path.exists",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.style.use",
"contextlib.redirect_stdout"... | [((2120, 2180), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': 'test_size', 'random_state': '(42)'}), '(X, y, test_size=test_size, random_state=42)\n', (2136, 2180), False, 'from sklearn.model_selection import train_test_split\n'), ((2552, 2568), 'sklearn.preprocessing.LabelB... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 11 15:52:17 2022
@author: sylvain
"""
import numpy as np
from calendar import monthrange
import pandas as pd
# Hypotheses
eta_pp = 0.7 # Average efficiency of the plunger pumps
eta_surpr = 0.4 # average efficiency of the "surpresseur" pum... | [
"numpy.zeros",
"calendar.monthrange",
"pandas.read_csv",
"pandas.date_range"
] | [((1467, 1528), 'pandas.read_csv', 'pd.read_csv', (['"""PV_casamance - daily profiles.csv"""'], {'index_col': '(0)'}), "('PV_casamance - daily profiles.csv', index_col=0)\n", (1478, 1528), True, 'import pandas as pd\n'), ((2437, 2449), 'numpy.zeros', 'np.zeros', (['(24)'], {}), '(24)\n', (2445, 2449), True, 'import num... |
'''
스크린샷 찍는 코드 -- 전체화면 캡쳐 됨
'''
import d3dshot
import time
import cv2
# 결과물을 저장할 디렉토리
output_path = './screenshot_output/'
i=0
last_time = time.strftime('%Y-%m-%d_%H-%M-%S', time.localtime(time.time()))
while True:
i += 1
filename = last_time + "_" + str(i)+".jpg"
d= d3dshot.create()
d.screensh... | [
"d3dshot.create",
"cv2.waitKey",
"time.time",
"cv2.destroyAllWindows"
] | [((289, 305), 'd3dshot.create', 'd3dshot.create', ([], {}), '()\n', (303, 305), False, 'import d3dshot\n'), ((196, 207), 'time.time', 'time.time', ([], {}), '()\n', (205, 207), False, 'import time\n'), ((406, 429), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (427, 429), False, 'import cv2\n'), (... |
#!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name="Markdown-Video",
version="0.1",
url="http://github.com/Holzhaus/Python-Markdown-Video",
license="GPL",
author="<NAME>",
author_email="<EMAIL>",
description="Video Extension for Markdown",
classifiers=[
... | [
"setuptools.setup"
] | [((68, 612), 'setuptools.setup', 'setup', ([], {'name': '"""Markdown-Video"""', 'version': '"""0.1"""', 'url': '"""http://github.com/Holzhaus/Python-Markdown-Video"""', 'license': '"""GPL"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""Video Extension for Markdown"""', 'classifiers': ... |
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import GraphConv
class DominantModel(nn.Module):
def __init__(self, A_norm, dim_in, dim_out=16):
super(DominantModel, self).__init__()
self.gcn1 = GraphConv.GCN(A_norm, dim_in, 64)
self.gcn2 = GraphConv.GC... | [
"GraphConv.GCN"
] | [((254, 287), 'GraphConv.GCN', 'GraphConv.GCN', (['A_norm', 'dim_in', '(64)'], {}), '(A_norm, dim_in, 64)\n', (267, 287), False, 'import GraphConv\n'), ((308, 337), 'GraphConv.GCN', 'GraphConv.GCN', (['A_norm', '(64)', '(32)'], {}), '(A_norm, 64, 32)\n', (321, 337), False, 'import GraphConv\n'), ((358, 392), 'GraphConv... |
from setuptools import setup
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='kohokoho',
version='0.0.1',
py_modules=['kohokoho'],
author='<NAME>',
author... | [
"os.path.join",
"os.path.dirname",
"setuptools.setup"
] | [((211, 844), 'setuptools.setup', 'setup', ([], {'name': '"""kohokoho"""', 'version': '"""0.0.1"""', 'py_modules': "['kohokoho']", 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""A CLI tool to obfuscate/anonymize a dataset."""', 'long_description': 'long_description', 'long_description_con... |
from qgis.core import *
from osgeo import gdal
import math
import numpy as np
import os
MARGIN = 0.01
def weightedFunction(x, y, x0, y0, weight):
# the current weighted Function is a simple sqrt((x-x0)^1 + (y-y0)^2)/w
return math.sqrt((x - x0) ** 2 + (y - y0) ** 2) / weight
#Get the points vector layer
pointsVecto... | [
"osgeo.gdal.Open",
"math.sqrt",
"numpy.zeros",
"os.system",
"osgeo.gdal.GetDriverByName"
] | [((806, 922), 'os.system', 'os.system', (['(\'gdal_rasterize -a z -ts 1000 1000 \' + extent_args + \' -l points "\' + sys.\n argv + \'" "./rasterPoints"\')'], {}), '(\'gdal_rasterize -a z -ts 1000 1000 \' + extent_args +\n \' -l points "\' + sys.argv + \'" "./rasterPoints"\')\n', (815, 922), False, 'import os\n')... |
from flask import Flask
from flask_restful import Api, Resource
from flask_cors import CORS
from model.galleryModel import getGalleryById
from model.ArticleModel import getArticleById
from resources.GallerysApi import GallerysApi
from resources.GameApi import GameApi
from resources.images import Image
from resources.Lo... | [
"flask_cors.CORS",
"flask_restful.Api",
"flask.Flask",
"model.ArticleModel.getArticleById",
"model.galleryModel.getGalleryById"
] | [((395, 410), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (400, 410), False, 'from flask import Flask\n'), ((417, 425), 'flask_restful.Api', 'Api', (['app'], {}), '(app)\n', (420, 425), False, 'from flask_restful import Api, Resource\n'), ((426, 435), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n',... |
import pytest
from api import create_app
from api.config import TestConfig
def make_auth_header(role: str) -> str:
assert role in {'customer', 'restaurant'}
tokens = {
'customer': TestConfig.CUSTOMER_TOKEN,
'restaurant': TestConfig.RESTAURANT_TOKEN
}
return {'Authorization': f'Bearer {t... | [
"pytest.fixture",
"api.create_app"
] | [((338, 354), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (352, 354), False, 'import pytest\n'), ((552, 568), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (566, 568), False, 'import pytest\n'), ((618, 634), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (632, 634), False, 'import pytest\n'), (... |
# pylint: disable=missing-docstring
import pytest
from logic import is_in_border, is_in_trace, direction, point_to_map, moves_count
@pytest.mark.parametrize("move,expected", [
(200, False),
(30, False),
(610, True),
(915, True),
(0, True),
(10, True),
])
def test_is_in_border(move, expected):
... | [
"logic.point_to_map",
"logic.moves_count",
"logic.direction",
"pytest.mark.parametrize",
"logic.is_in_border",
"logic.is_in_trace"
] | [((135, 258), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""move,expected"""', '[(200, False), (30, False), (610, True), (915, True), (0, True), (10, True)]'], {}), "('move,expected', [(200, False), (30, False), (610, \n True), (915, True), (0, True), (10, True)])\n", (158, 258), False, 'import pytest\... |
import math
from typing import Union
def sub(a: Union[int, float], b: Union[int, float]) -> int:
return math.floor(a - b)
def word_count(sentence: str, word: str) -> int:
sentence_split = sentence.lower().split()
if word in sentence_split:
return sum([1 for x in sentence_split if x == word])
... | [
"math.floor"
] | [((110, 127), 'math.floor', 'math.floor', (['(a - b)'], {}), '(a - b)\n', (120, 127), False, 'import math\n')] |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from scipy.stats import probplot, pearsonr
class PreparedData:
def __init__(self, inn):
self.original_data = inn
self.prepared_data = None
self.feature_labels = None
self.t... | [
"pandas.read_csv",
"numpy.max",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"numpy.around",
"numpy.min",
"matplotlib.pyplot.subplot",
"pandas.to_datetime"
] | [((2381, 2411), 'pandas.read_csv', 'pd.read_csv', (['RAW_DATA'], {'sep': '""","""'}), "(RAW_DATA, sep=',')\n", (2392, 2411), True, 'import pandas as pd\n'), ((2709, 2721), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2719, 2721), True, 'import matplotlib.pyplot as plt\n'), ((2733, 2756), 'matplotlib.gri... |
print('From where to start count?')
try:
DIGIT=int(input())
except Exception as e:
print(f'Error >> {e}')
exit()
try:
import sys,time,random
except Exception as e:
print(f'error message >> {e}')
exit()
def main():
try:
bottles_count=DIGIT
while True:
print(str(bo... | [
"random.randint",
"time.sleep",
"sys.exit"
] | [((984, 1004), 'random.randint', 'random.randint', (['(0)', '(3)'], {}), '(0, 3)\n', (998, 1004), False, 'import sys, time, random\n'), ((1635, 1658), 'time.sleep', 'time.sleep', (['print_speed'], {}), '(print_speed)\n', (1645, 1658), False, 'import sys, time, random\n'), ((863, 873), 'sys.exit', 'sys.exit', ([], {}), ... |
import pkg_resources
import pathlib
import random
import numpy
import pandas
import json
import yaml
from collections import defaultdict
def define_amplicon(tmp, amplicons, reference_genome):
chosen_amplicon = tmp['name']
row = amplicons[amplicons.name == chosen_amplicon]
# PWF: this used to be >= but end... | [
"pandas.read_csv",
"pathlib.Path",
"numpy.logical_not",
"pkg_resources.resource_filename",
"numpy.sum",
"numpy.array",
"yaml.safe_load",
"collections.defaultdict",
"json.load"
] | [((2890, 2980), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""gpas_covid_synthetic_reads"""', '"""data/cov-lineages.csv"""'], {}), "('gpas_covid_synthetic_reads',\n 'data/cov-lineages.csv')\n", (2921, 2980), False, 'import pkg_resources\n'), ((3002, 3031), 'pandas.read_csv', 'pandas.rea... |
import warnings
from math import ceil
import numpy as np
import openmdao.api as om
from wisdem.landbosse.model.Manager import Manager
from wisdem.landbosse.model.DefaultMasterInputDict import DefaultMasterInputDict
from wisdem.landbosse.landbosse_omdao.OpenMDAODataframeCache import OpenMDAODataframeCache
from wisdem.l... | [
"wisdem.landbosse.landbosse_omdao.OpenMDAODataframeCache.OpenMDAODataframeCache.read_all_sheets_from_xlsx",
"wisdem.landbosse.landbosse_omdao.WeatherWindowCSVReader.read_weather_window",
"math.ceil",
"wisdem.landbosse.model.Manager.Manager",
"warnings.catch_warnings",
"wisdem.landbosse.model.DefaultMaster... | [((401, 426), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (424, 426), False, 'import warnings\n'), ((432, 501), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'message': '"""numpy.ufunc size changed"""'}), "('ignore', message='numpy.ufunc size changed')\n", (455, 5... |
#
# file: migrations/0001.create.py
#
from yoyo import step
step(
"""CREATE TABLE tweets (
id serial PRIMARY KEY,
tweet varchar (300) NOT NULL,
created_at timestamptz NOT NULL,
label_s boolean,
pred_s boolean,
pred_p real
)
""",
"DROP TABLE tweets",
)
| [
"yoyo.step"
] | [((60, 318), 'yoyo.step', 'step', (['"""CREATE TABLE tweets (\n id serial PRIMARY KEY,\n tweet varchar (300) NOT NULL,\n created_at timestamptz NOT NULL,\n label_s boolean,\n pred_s boolean,\n pred_p real\n )\n """', '"""DROP TABLE tweets"""'], {}), '(\n """CREATE ... |
from setuptools import setup, Extension
import os
SRC_PATH = os.path.relpath(os.path.join(os.path.dirname(__file__), "."))
pytrapmodule = Extension('pytrap',
sources = ['src/pytrapmodule.c', 'src/unirecmodule.c', 'src/unirecipaddr.c', 'src/unirecmacaddr.c', 'src/fields.c'],
lib... | [
"setuptools.Extension",
"os.path.dirname",
"setuptools.setup"
] | [((140, 313), 'setuptools.Extension', 'Extension', (['"""pytrap"""'], {'sources': "['src/pytrapmodule.c', 'src/unirecmodule.c', 'src/unirecipaddr.c',\n 'src/unirecmacaddr.c', 'src/fields.c']", 'libraries': "['trap', 'unirec']"}), "('pytrap', sources=['src/pytrapmodule.c', 'src/unirecmodule.c',\n 'src/unirecipaddr... |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
from logger import setup_logger
from model import BiSeNet
from face_dataset import FaceMask
from loss import OhemCELoss
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
import torch.nn.functional as F
import torch.distributed as dist
import os
imp... | [
"loss.OhemCELoss",
"logger.setup_logger",
"numpy.array",
"torch.squeeze",
"os.path.exists",
"model.BiSeNet",
"os.listdir",
"numpy.where",
"torch.unsqueeze",
"numpy.max",
"torchvision.transforms.ToTensor",
"cv2.cvtColor",
"torchvision.transforms.Normalize",
"cv2.resize",
"face_dataset.Fac... | [((1175, 1187), 'numpy.array', 'np.array', (['im'], {}), '(im)\n', (1183, 1187), True, 'import numpy as np\n'), ((1311, 1405), 'cv2.resize', 'cv2.resize', (['vis_parsing_anno', 'None'], {'fx': 'stride', 'fy': 'stride', 'interpolation': 'cv2.INTER_NEAREST'}), '(vis_parsing_anno, None, fx=stride, fy=stride, interpolation... |