code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""Remove dead ads table
Revision ID: <KEY>
Revises: 1307b62614a4
Create Date: 2020-02-27 23:14:41.314000
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '1307b62614a4'
from alembic import op # lgtm[py/unused-import]
import sqlalchemy as sa # lgtm[py/unused-import]
from sqlalchemy... | [
"sqlalchemy.ForeignKeyConstraint",
"alembic.op.drop_table",
"sqlalchemy.VARCHAR",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.TEXT",
"sqlalchemy.INTEGER",
"alembic.op.drop_index",
"sqlalchemy.dialects.postgresql.TIMESTAMP",
"alembic.op.create_index"
] | [((434, 480), 'alembic.op.drop_index', 'op.drop_index', (['"""ind_ads_end"""'], {'table_name': '"""ads"""'}), "('ind_ads_end', table_name='ads')\n", (447, 480), False, 'from alembic import op\n'), ((485, 505), 'alembic.op.drop_table', 'op.drop_table', (['"""ads"""'], {}), "('ads')\n", (498, 505), False, 'from alembic i... |
"""
http://yutori-datascience.hatenablog.com/entry/2014/12/10/123157
"""
from numba import cuda
import numpy as np
from numba import double
from numba.decorators import jit
from numba import guvectorize
import time
import math
@jit
def pairwise_numba(X,D):
M,N=X.shape[0],X.shape[1]
for i in range(M):
for j in ... | [
"numpy.sqrt",
"numpy.random.random",
"numba.decorators.jit",
"numba.cuda.grid",
"math.sqrt",
"numba.cuda.jit",
"numba.guvectorize",
"numpy.empty",
"time.time"
] | [((422, 450), 'numba.decorators.jit', 'jit', (['"""void(f8[:,:],f8[:,:])"""'], {}), "('void(f8[:,:],f8[:,:])')\n", (425, 450), False, 'from numba.decorators import jit\n'), ((647, 706), 'numba.guvectorize', 'guvectorize', (["['void(f8[:, :], f8[:, :])']", '"""(x, y)->(x, x)"""'], {}), "(['void(f8[:, :], f8[:, :])'], '(... |
#!/usr/bin/env python
import itertools
import torch
import mlflow
from selective_gp.utils import (
load_data, get_model, get_ELBO, get_experiment_id, eprint, bold, green,
remove_points, run_exists)
import click
def run_single(device, M, noise, epochs, adaptive, prior_weight, dataset_name,
fo... | [
"click.Choice",
"selective_gp.utils.eprint",
"selective_gp.utils.get_ELBO",
"mlflow.log_metrics",
"click.option",
"selective_gp.utils.run_exists",
"selective_gp.utils.get_model",
"selective_gp.utils.green",
"selective_gp.utils.remove_points",
"mlflow.log_params",
"selective_gp.utils.bold",
"ml... | [((1954, 1969), 'click.command', 'click.command', ([], {}), '()\n', (1967, 1969), False, 'import click\n'), ((1971, 2009), 'click.option', 'click.option', (['"""--epochs"""'], {'default': '(1000)'}), "('--epochs', default=1000)\n", (1983, 2009), False, 'import click\n'), ((2088, 2140), 'click.option', 'click.option', (... |
import pytest
from d1lod.graph import Graph
from d1lod.interface import Interface
@pytest.fixture(scope="module")
def store():
return Graph('localhost', 8890, 'test')
@pytest.fixture(scope="module")
def graph(store):
namespaces = {
'owl': 'http://www.w3.org/2002/07/owl#',
'rdfs': 'http://www.... | [
"pytest.fixture",
"d1lod.interface.Interface",
"d1lod.graph.Graph"
] | [((85, 115), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (99, 115), False, 'import pytest\n'), ((175, 205), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (189, 205), False, 'import pytest\n'), ((1077, 1107), 'pytest.fixture', 'p... |
from setuptools import setup
ENVIRON_VERSION = "0.0.0"
with open("README.md", "r") as f:
README = f.read()
setup(
name="environ",
packages=["environ"],
version=ENVIRON_VERSION,
install_requires=[],
dependency_links=[],
description="easy but incompetent .env loader",
long_description=R... | [
"setuptools.setup"
] | [((114, 370), 'setuptools.setup', 'setup', ([], {'name': '"""environ"""', 'packages': "['environ']", 'version': 'ENVIRON_VERSION', 'install_requires': '[]', 'dependency_links': '[]', 'description': '"""easy but incompetent .env loader"""', 'long_description': 'README', 'license': '"""Apache"""', 'author': '"""<NAME>"""... |
import sublime
import sublime_plugin
import os
from os import path
class LoadtemplateCommand(sublime_plugin.TextCommand):
def run(self, edit, **args):
template_path = os.path.join(
os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates'),
args['module'],
'{}.tpl'.format(args['template'])
)
... | [
"os.path.abspath",
"os.path.exists",
"sublime.error_message"
] | [((326, 352), 'os.path.exists', 'path.exists', (['template_path'], {}), '(template_path)\n', (337, 352), False, 'from os import path\n'), ((667, 697), 'sublime.error_message', 'sublime.error_message', (['message'], {}), '(message)\n', (688, 697), False, 'import sublime\n'), ((218, 243), 'os.path.abspath', 'os.path.absp... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"collections.namedtuple"
] | [((1477, 1517), 'collections.namedtuple', 'collections.namedtuple', (['name', 'fieldnames'], {}), '(name, fieldnames)\n', (1499, 1517), False, 'import collections\n')] |
from linz_logger import get_log
from topo_processor.util import time_in_ms
from .get_fs import get_fs
def transfer_file(source_file: str, checksum: str, content_type, target_file: str):
start_time = time_in_ms()
with get_fs(source_file).open(source_file, "rb") as f1:
data = f1.read()
with ge... | [
"linz_logger.get_log",
"topo_processor.util.time_in_ms"
] | [((207, 219), 'topo_processor.util.time_in_ms', 'time_in_ms', ([], {}), '()\n', (217, 219), False, 'from topo_processor.util import time_in_ms\n'), ((463, 472), 'linz_logger.get_log', 'get_log', ([], {}), '()\n', (470, 472), False, 'from linz_logger import get_log\n'), ((575, 587), 'topo_processor.util.time_in_ms', 'ti... |
import os
import torch
import segmentation_models_pytorch as smp
import argparse
from refer.utils import *
from refer.datasets import *
from refer.model import build_model
# Argument Parsing
parser = argparse.ArgumentParser(description="Train the Model")
parser.add_argument('--base', '--b', help = 'the base addr... | [
"segmentation_models_pytorch.utils.losses.DiceLoss",
"argparse.ArgumentParser",
"os.path.join",
"segmentation_models_pytorch.utils.metrics.IoU",
"segmentation_models_pytorch.utils.train.ValidEpoch",
"segmentation_models_pytorch.utils.train.TrainEpoch",
"torch.save",
"os.path.abspath",
"refer.model.b... | [((207, 261), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train the Model"""'}), "(description='Train the Model')\n", (230, 261), False, 'import argparse\n'), ((720, 742), 'os.path.abspath', 'os.path.abspath', (['Basic'], {}), '(Basic)\n', (735, 742), False, 'import os\n'), ((870, 898... |
# Copyright 2020 (c) Aalto University - All Rights Reserved
# ELEC-E8125 - Reinforcement Learning Course
# AALTO UNIVERSITY
#
#############################################################
import numpy as np
from time import sleep
from sailing import SailingGridworld
epsilon = 10e-4 # TODO: Use this criteria for Tas... | [
"numpy.mean",
"numpy.argmax",
"time.sleep",
"sailing.SailingGridworld",
"numpy.max",
"numpy.zeros",
"numpy.std",
"numpy.save"
] | [((356, 389), 'sailing.SailingGridworld', 'SailingGridworld', ([], {'rock_penalty': '(-2)'}), '(rock_penalty=-2)\n', (372, 389), False, 'from sailing import SailingGridworld\n'), ((402, 426), 'numpy.zeros', 'np.zeros', (['(env.w, env.h)'], {}), '((env.w, env.h))\n', (410, 426), True, 'import numpy as np\n'), ((3714, 37... |
""" Includes two functions which use shortest path policies
1) run_sss_curriculum - trains a PyMARL agent using experiences gathered
while following an epsilon greedy shortest path policy.
2) mean_sss_time - returns the mean time taken to complete a map while following
an epsilon greedy shortest path policy.
... | [
"logging.getLogger",
"yaml.load",
"main.recursive_dict_update",
"rapport_topological.navigation.construct_shortest_path_policy",
"torch.cuda.is_available",
"torch.sum",
"components.transforms.OneHot",
"datetime.timedelta",
"numpy.mean",
"components.episode_buffer.ReplayBuffer",
"numpy.random.nor... | [((2258, 2302), 'main.recursive_dict_update', 'recursive_dict_update', (['config_dict', 'alg_dict'], {}), '(config_dict, alg_dict)\n', (2279, 2302), False, 'from main import recursive_dict_update\n'), ((2321, 2365), 'main.recursive_dict_update', 'recursive_dict_update', (['config_dict', 'env_dict'], {}), '(config_dict,... |
import copy
import pickle
import unittest
from op_hierarchical_chainmap._ext import ChainMap
class TestChainMap(unittest.TestCase):
def test_basics(self):
c = ChainMap()
c['a'] = 1
c['b'] = 2
d = c.new_child()
d['b'] = 20
d['c'] = 30
self.assertEqual(d.maps... | [
"pickle.dumps",
"op_hierarchical_chainmap._ext.ChainMap",
"copy.deepcopy",
"copy.copy"
] | [((174, 184), 'op_hierarchical_chainmap._ext.ChainMap', 'ChainMap', ([], {}), '()\n', (182, 184), False, 'from op_hierarchical_chainmap._ext import ChainMap\n'), ((3143, 3174), 'op_hierarchical_chainmap._ext.ChainMap', 'ChainMap', (['adjustments', 'baseline'], {}), '(adjustments, baseline)\n', (3151, 3174), False, 'fro... |
# Copyright 2018 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
"sphinx.util.logging.getLogger",
"six.moves.configparser.ConfigParser"
] | [((731, 758), 'sphinx.util.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (748, 758), False, 'from sphinx.util import logging\n'), ((1714, 1741), 'six.moves.configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (1739, 1741), False, 'from six.moves import configparser\n... |
# -*- coding: utf-8 -*-
"""
Created on Sun May 21 14:31:32 2017
@author: <NAME>
"""
import random
inf = 0
prime = 2**17-1
order = 131307
# remember to check isSingular(a,b,p) == False
a = 1
b = 6
# Uses the idea of squareAndMultiply to compute c*p quickly in E.
# Based on algorithm on p. 266 in course literatur... | [
"math.sqrt",
"random.randint",
"random.randrange"
] | [((4258, 4282), 'random.randint', 'random.randint', (['(0)', 'prime'], {}), '(0, prime)\n', (4272, 4282), False, 'import random\n'), ((4447, 4471), 'random.randint', 'random.randint', (['(0)', 'prime'], {}), '(0, prime)\n', (4461, 4471), False, 'import random\n'), ((7013, 7035), 'random.randrange', 'random.randrange', ... |
'''
Description: This script calculate the sentiment score for every headline in a dataset of over a million headlines taken from the Australian news source ABC. This is done using the spaCyTextBlob approach. It saves a plot of sentiment over time with a 1-week rolling average and a plot of sentiment over time with a 1... | [
"nltk.sentiment.vader.SentimentIntensityAnalyzer",
"argparse.ArgumentParser",
"pandas.read_csv",
"spacy.load",
"nltk.download",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"spacytextblob.spacytextblob.SpacyTextBlob",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"os.path.join... | [((426, 459), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (449, 459), False, 'import warnings\n'), ((4562, 4630), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""[INFO] calculating sentiments"""'}), "(description='[INFO] calculating sentim... |
from app.api import apiRestful
from flask_restplus import Resource
class Admin:
@apiRestful.route('/admin/anotheradmin')
class AnotherAdminView(Resource):
def get(self):
return {"return" : "Hello World from AnotherMyAdmin!"}, 200
@apiRestful.route('/admin/myadminview')
... | [
"app.api.apiRestful.route"
] | [((89, 128), 'app.api.apiRestful.route', 'apiRestful.route', (['"""/admin/anotheradmin"""'], {}), "('/admin/anotheradmin')\n", (105, 128), False, 'from app.api import apiRestful\n'), ((278, 316), 'app.api.apiRestful.route', 'apiRestful.route', (['"""/admin/myadminview"""'], {}), "('/admin/myadminview')\n", (294, 316), ... |
import json
import time
from typing import Dict
from scrapy.exceptions import NotConfigured
from scrapy.http.response.html import HtmlResponse
from scrapy_cdr import CDRItem
from dd_crawler.utils import get_domain
class RequestLogMiddleware:
def __init__(self, *, jl_logger, relevancy_threshold: float):
... | [
"dd_crawler.utils.get_domain",
"scrapy.exceptions.NotConfigured",
"time.time",
"json.dump"
] | [((1370, 1393), 'dd_crawler.utils.get_domain', 'get_domain', (["item['url']"], {}), "(item['url'])\n", (1380, 1393), False, 'from dd_crawler.utils import get_domain\n'), ((2608, 2644), 'json.dump', 'json.dump', (['log_entry', 'self._log_file'], {}), '(log_entry, self._log_file)\n', (2617, 2644), False, 'import json\n')... |
import pandas as pd
import openpyxl
df = pd.read_excel("Arquivo.xlsx", engine="openpyxl")
print(df.loc[[True, False, False, True, True, True, False], [True, False, False]]) #Mostra apenas linhas e colunas que estão True na lista passada
print()
print(df.Nome == "Jonathan") #Retorna uma lista de True e False com True... | [
"pandas.read_excel"
] | [((42, 90), 'pandas.read_excel', 'pd.read_excel', (['"""Arquivo.xlsx"""'], {'engine': '"""openpyxl"""'}), "('Arquivo.xlsx', engine='openpyxl')\n", (55, 90), True, 'import pandas as pd\n')] |
import pygame, thorpy
from utilidades.texto import Texto, TextArea
from utilidades.button import Button
from utilidades.colores import *
import config as config
"""
CLASE PRINCIPAL: Aplicación
"""
ScreenSize = width, height = 1056, 672
Caption = "CMC v0.11"
if not config.pantalla_completa:
thorpy.Application(siz... | [
"thorpy.get_screen",
"pygame.init",
"pygame.display.init",
"thorpy.Application",
"thorpy.functions.quit_func",
"pygame.key.get_pressed",
"pygame.display.quit"
] | [((298, 374), 'thorpy.Application', 'thorpy.Application', ([], {'size': 'ScreenSize', 'caption': 'Caption', 'flags': 'pygame.DOUBLEBUF'}), '(size=ScreenSize, caption=Caption, flags=pygame.DOUBLEBUF)\n', (316, 374), False, 'import pygame, thorpy\n'), ((417, 517), 'thorpy.Application', 'thorpy.Application', ([], {'size':... |
# Generated by Django 2.0.4 on 2018-04-13 07:47
from django.conf import settings
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('report_builder_scheduled', '0001_initial'),
]
operations = [
migrations.AlterF... | [
"django.db.models.DateTimeField",
"django.db.models.ManyToManyField"
] | [((418, 492), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)', 'default': 'django.utils.timezone.now'}), '(auto_now_add=True, default=django.utils.timezone.now)\n', (438, 492), False, 'from django.db import migrations, models\n'), ((658, 797), 'django.db.models.ManyToManyField',... |
import pandas as pd
def lookup_dates(s):
"""
This is an extremely fast approach to datetime parsing.
For large data, the same dates are often repeated. Rather than
re-parse these, we store all unique dates, parse them, and
use a lookup to convert all dates.
"""
dates_dict = {date:pd.to_date... | [
"pandas.tseries.offsets.QuarterEnd",
"pandas.to_datetime",
"pandas.tseries.offsets.DateOffset"
] | [((310, 347), 'pandas.to_datetime', 'pd.to_datetime', (['date'], {'errors': '"""coerce"""'}), "(date, errors='coerce')\n", (324, 347), True, 'import pandas as pd\n'), ((487, 518), 'pandas.tseries.offsets.QuarterEnd', 'pd.tseries.offsets.QuarterEnd', ([], {}), '()\n', (516, 518), True, 'import pandas as pd\n'), ((447, 4... |
# coding: UTF-8
from unittest import TestCase
from chipy8.chip8 import Chip8
class TestChip8Architecture(TestCase):
def setUp(self):
self.cpu = Chip8()
def test_memory_length(self):
'Chip8 has 4096 bytes of memory.'
self.assertEqual(4096, len(self.cpu.memory))
def test_register_c... | [
"chipy8.chip8.Chip8"
] | [((158, 165), 'chipy8.chip8.Chip8', 'Chip8', ([], {}), '()\n', (163, 165), False, 'from chipy8.chip8 import Chip8\n')] |
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
def test_drawdown_and_returns_series():
index_range = pd.date_range(start=datetime(2000, 1, 1), periods=4, freq='AS-JAN')
wealth_index = pd.Series(data=[0.4, 0.3, 0.2, 0.5], index=index_range)
dd = wealth_index.drawdown
as... | [
"pandas.Series",
"numpy.testing.assert_almost_equal",
"datetime.timedelta",
"datetime.datetime"
] | [((227, 282), 'pandas.Series', 'pd.Series', ([], {'data': '[0.4, 0.3, 0.2, 0.5]', 'index': 'index_range'}), '(data=[0.4, 0.3, 0.2, 0.5], index=index_range)\n', (236, 282), True, 'import pandas as pd\n'), ((536, 598), 'numpy.testing.assert_almost_equal', 'np.testing.assert_almost_equal', (["drawdown_df['2000-01-01']", '... |
# -*- coding: utf-8 -*-
# MinIO Python Library for Amazon S3 Compatible Cloud Storage, (C)
# 2020 MinIO, 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/lic... | [
"datetime.datetime.strptime",
"locale.setlocale",
"datetime.datetime.utcnow"
] | [((1042, 1073), 'locale.setlocale', 'locale.setlocale', (['locale.LC_ALL'], {}), '(locale.LC_ALL)\n', (1058, 1073), False, 'import locale\n'), ((1556, 1605), 'datetime.datetime.strptime', 'datetime.strptime', (['value', '"""%Y-%m-%dT%H:%M:%S.%fZ"""'], {}), "(value, '%Y-%m-%dT%H:%M:%S.%fZ')\n", (1573, 1605), False, 'fro... |
from mongoengine import Document, StringField, BooleanField, IntField, ListField, ReferenceField, EmailField, LongField
from mongoengine import NULLIFY, PULL
class User(Document):
ID = LongField(unique=True, required=True)
Username = StringField(required=True)
Password = StringField()
IsLock = Boolean... | [
"mongoengine.BooleanField",
"mongoengine.StringField",
"mongoengine.LongField"
] | [((191, 228), 'mongoengine.LongField', 'LongField', ([], {'unique': '(True)', 'required': '(True)'}), '(unique=True, required=True)\n', (200, 228), False, 'from mongoengine import Document, StringField, BooleanField, IntField, ListField, ReferenceField, EmailField, LongField\n'), ((244, 270), 'mongoengine.StringField',... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-11-22 15:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('surveys', '0021_surveyresponserule'),
]
operations = [
migrations.AddField(... | [
"django.db.models.BooleanField"
] | [((416, 534), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'help_text': '"""Inserts a page break which puts the next question onto a new page"""'}), "(default=False, help_text=\n 'Inserts a page break which puts the next question onto a new page')\n", (435, 534), False, 'from d... |
# Simple script that uses dataPaser.py to get symbols on Binance
# By default it only shows symbols with the status of 'TRADING'
# You can get all symbols by setting "onlyTrading=False" and
# use "includes='LTC|DAI'" to pull the symbols that include
# LTC and/or DAI. We use getKlines to retrieve the kline data
# of eac... | [
"bapiw.dataParser.DataParser"
] | [((407, 419), 'bapiw.dataParser.DataParser', 'DataParser', ([], {}), '()\n', (417, 419), False, 'from bapiw.dataParser import DataParser\n')] |
"""PFIM: Personal Finance Manager"""
import os
from queue import Queue
import sys
import sqlite3
import logging
import statistics
import functools
from datetime import date, timedelta
from enum import Enum, auto
from collections import namedtuple
from typing import List, Dict, Callable, Generator, Mapping, Union
## ... | [
"logging.getLogger",
"sqlite3.register_converter",
"collections.namedtuple",
"logging.StreamHandler",
"sqlite3.register_adapter",
"enum.auto",
"statistics.stdev",
"sqlite3.connect",
"logging.Formatter",
"statistics.fmean",
"os.path.join",
"functools.wraps",
"statistics.median",
"sys.exit",... | [((368, 395), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (385, 395), False, 'import logging\n'), ((569, 592), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (590, 592), False, 'import logging\n'), ((646, 703), 'logging.Formatter', 'logging.Formatter', (['"""[%(asc... |
import torch
from torch import nn
from torch.nn import functional as F
from .resnet import resnet18, resnet34
from .segmentation import SegmentationHead
from .attention import Attention
from .erfnet import ERFNet
class Normalize(nn.Module):
""" ImageNet normalization """
def __init__(self, mean, std):
... | [
"torch.tensor",
"torch.cat",
"torch.nn.Sigmoid",
"torch.nn.Linear"
] | [((373, 391), 'torch.tensor', 'torch.tensor', (['mean'], {}), '(mean)\n', (385, 391), False, 'import torch\n'), ((446, 463), 'torch.tensor', 'torch.tensor', (['std'], {}), '(std)\n', (458, 463), False, 'import torch\n'), ((1732, 1750), 'torch.nn.Linear', 'nn.Linear', (['(1024)', '(1)'], {}), '(1024, 1)\n', (1741, 1750)... |
"""Implementation of predictive classifiers."""
from abc import ABC, abstractmethod
import pandas as pd
from google_drive_downloader import GoogleDriveDownloader as gdd
from joblib import load as jload
from geniepy.errors import ClassifierError
import geniepy.config as gc
ERROR_SCORE = float(-1)
PCPCLSFR_NAME = "pub_... | [
"geniepy.errors.ClassifierError",
"geniepy.config.get_model",
"geniepy.config.TMP_DIR.joinpath",
"google_drive_downloader.GoogleDriveDownloader.download_file_from_google_drive",
"joblib.load",
"pandas.DataFrame"
] | [((1781, 1827), 'geniepy.config.TMP_DIR.joinpath', 'gc.TMP_DIR.joinpath', (['"""gene_disease_gbc.joblib"""'], {}), "('gene_disease_gbc.joblib')\n", (1800, 1827), True, 'import geniepy.config as gc\n'), ((1847, 1861), 'geniepy.config.get_model', 'gc.get_model', ([], {}), '()\n', (1859, 1861), True, 'import geniepy.confi... |
from keras_metrics import f1, f1b
import keras.backend as K
import tensorflow as tf
def f1_loss(y_true, y_pred):
return 1 - K.mean(f1(y_true, y_pred))
def f1b_loss(y_true, y_pred):
return 1-K.mean(f1b(y_true, y_pred))
def KerasFocalLoss(target, input):
"""
Should be applied without sigmoid activti... | [
"keras.backend.sum",
"keras.backend.exp",
"keras_metrics.f1",
"keras_metrics.f1b",
"tensorflow.cast",
"tensorflow.log_sigmoid",
"keras.backend.relu"
] | [((475, 501), 'tensorflow.cast', 'tf.cast', (['input', 'tf.float32'], {}), '(input, tf.float32)\n', (482, 501), True, 'import tensorflow as tf\n'), ((517, 531), 'keras.backend.relu', 'K.relu', (['(-input)'], {}), '(-input)\n', (523, 531), True, 'import keras.backend as K\n'), ((642, 687), 'tensorflow.log_sigmoid', 'tf.... |
#!/usr/bin/env python3
from setuptools import find_packages, setup
setup(
name="lean_proof_recording",
version="0.0.1",
packages=find_packages(),
package_data={},
install_requires=[
"mpmath",
"pandas",
"jsonlines",
"tqdm",
],
)
| [
"setuptools.find_packages"
] | [((142, 157), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (155, 157), False, 'from setuptools import find_packages, setup\n')] |
from shminspector.api.context import Context
from shminspector.api.reactor import Reactor, ReactorCommand, UserInput
from shminspector.api.tags import macos, interactive, experimental, prerequisites
from shminspector.api.validator import ValidationResult, Status
@macos
@interactive
@experimental
@prerequisites("homeb... | [
"shminspector.api.tags.prerequisites",
"shminspector.api.reactor.ReactorCommand",
"shminspector.api.reactor.UserInput"
] | [((300, 325), 'shminspector.api.tags.prerequisites', 'prerequisites', (['"""homebrew"""'], {}), "('homebrew')\n", (313, 325), False, 'from shminspector.api.tags import macos, interactive, experimental, prerequisites\n'), ((719, 766), 'shminspector.api.tags.prerequisites', 'prerequisites', (['"""gcloud"""', '"""network-... |
import re
from .AssertionException import AssertionException
class _Assert(object):
def __init__(self, log):
if callable(log):
self.__log = log
else:
self.__log = log
#
def isIn(self, value, valueList, message = None):
Assert.l_isIn(self.__log, value, valueList, message)
#
def isNotIn(sel... | [
"re.match"
] | [((9429, 9458), 're.match', 're.match', (['regexPattern', 'value'], {}), '(regexPattern, value)\n', (9437, 9458), False, 'import re\n'), ((10022, 10051), 're.match', 're.match', (['regexPattern', 'value'], {}), '(regexPattern, value)\n', (10030, 10051), False, 'import re\n')] |
import sqlite3
import argparse
from os.path import join
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from keras.models import model_from_json
import preprocessing.config as cfg
import preprocessing.file_utils as futils
from preprocessing.data import LightDataManager
de... | [
"argparse.ArgumentParser",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"seaborn.set_context",
"seaborn.set_style",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"preprocessing.file_utils.HyperparameterSearchReport",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.legend",
"m... | [((447, 481), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(2 * 5, 2 * 2)'}), '(figsize=(2 * 5, 2 * 2))\n', (457, 481), True, 'import matplotlib.pyplot as plt\n'), ((495, 530), 'preprocessing.file_utils.HyperparameterSearchReport', 'futils.HyperparameterSearchReport', ([], {}), '()\n', (528, 530), True, ... |
import json
def get_event():
return json.dumps({
'test': True
})
| [
"json.dumps"
] | [((41, 67), 'json.dumps', 'json.dumps', (["{'test': True}"], {}), "({'test': True})\n", (51, 67), False, 'import json\n')] |
from discord.ext import commands
import discord
import logging
class Log(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_connect(self):
logging.getLogger().addHandler(DiscordLogger(self.bot))
@commands.Cog.listener()
async def on_disco... | [
"discord.ext.commands.Cog.listener",
"logging.getLogger",
"discord.colour.Color.darker_grey",
"discord.colour.Color.green",
"discord.colour.Color.red",
"discord.colour.Color.gold",
"discord.Embed",
"discord.colour.Color.blue"
] | [((148, 171), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (169, 171), False, 'from discord.ext import commands\n'), ((274, 297), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (295, 297), False, 'from discord.ext import commands\n'), ((603, 637), 'dis... |
from classes.database import *
import shutil
import os
if (os.getcwd().endswith('functions')):
os.chdir('..')
def move_known(src, dest=None, rename=False):
src = src.replace('//', '/')
if not dest:
dest = src+'known/'
db = Database()
# db.loadCache()
for root, dirs, files in os.walk(src... | [
"os.path.exists",
"shutil.move",
"os.path.join",
"os.getcwd",
"os.chdir",
"os.path.dirname",
"os.unlink",
"os.walk"
] | [((99, 113), 'os.chdir', 'os.chdir', (['""".."""'], {}), "('..')\n", (107, 113), False, 'import os\n'), ((309, 321), 'os.walk', 'os.walk', (['src'], {}), '(src)\n', (316, 321), False, 'import os\n'), ((59, 70), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (68, 70), False, 'import os\n'), ((953, 978), 'os.path.exists', '... |
import yaml
from makestack import appdir
from makestack.helpers import progress
DEFAULT_CONFIG = {
'BOARD': {
'type': 'str',
'value': 'esp8266'
}
}
def main(args):
appdir.chdir_to_app_dir(args.appdir)
application_yaml = yaml.load(open('application.yaml'))
app_config = {} if appli... | [
"makestack.appdir.chdir_to_app_dir",
"makestack.helpers.progress"
] | [((195, 231), 'makestack.appdir.chdir_to_app_dir', 'appdir.chdir_to_app_dir', (['args.appdir'], {}), '(args.appdir)\n', (218, 231), False, 'from makestack import appdir\n'), ((569, 600), 'makestack.helpers.progress', 'progress', (['"""GEN"""', '""".config.yaml"""'], {}), "('GEN', '.config.yaml')\n", (577, 600), False, ... |
import tkinter
import random
from tkinter import messagebox
colours = ['Red','Blue','Green','Pink','Black',
'Yellow','Orange','White','Purple','Brown']
score = 0
timeleft = 30
def startGame(event):
if timeleft == 30:
timer()
changeColor()
def changeColor():
global score
global t... | [
"tkinter.Entry",
"random.shuffle",
"tkinter.messagebox.askyesno",
"tkinter.Tk",
"tkinter.Label"
] | [((1230, 1242), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (1240, 1242), False, 'import tkinter\n'), ((1310, 1432), 'tkinter.Label', 'tkinter.Label', (['root'], {'text': '"""Type in the colour\nof the words, and not the word text!\n"""', 'font': "('Helvetica', 14)"}), '(root, text=\n """Type in the colour\nof the... |
import os, json, base64, cv2, glob
import numpy as np
import matplotlib.pyplot as plt
from coco import CocoConfig
from Mask.config import Config
import Mask.utils as utils
import Mask.model as modellib
import Mask.visualize as visualize
from convert_file import load_image
def init():
np.set_printoptions(threshold=... | [
"json.loads",
"Mask.model.MaskRCNN",
"convert_file.load_image",
"coco.CocoConfig",
"numpy.set_printoptions"
] | [((290, 327), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (309, 327), True, 'import numpy as np\n'), ((359, 379), 'json.loads', 'json.loads', (['input_df'], {}), '(input_df)\n', (369, 379), False, 'import os, json, base64, cv2, glob\n'), ((389, 413), 'convert_... |
import io
import logging
import re
from datetime import datetime
from typing import List, Optional
from pydantic import BaseModel
from ..types import ChineseOrthography
from omniglot.lexeme import Lexeme
from omniglot.sense import Sense
from omnilingual import LanguageCode, PartOfSpeech
class CcCedictCounter(BaseMo... | [
"omniglot.sense.Sense",
"re.match",
"datetime.datetime.fromisoformat",
"io.StringIO",
"re.search"
] | [((1540, 1557), 'io.StringIO', 'io.StringIO', (['data'], {}), '(data)\n', (1551, 1557), False, 'import io\n'), ((918, 959), 're.search', 're.search', (['CC_CEDICT_created_regexp', 'line'], {}), '(CC_CEDICT_created_regexp, line)\n', (927, 959), False, 'import re\n'), ((1722, 1750), 're.match', 're.match', (['entry_regex... |
# -*- coding: utf-8 -*-
import os
import shutil
import uuid
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase, override_settings
from filebrowser.models import Directory
from filebrowser.utils import to_download_url
from loader.exceptions import FileNotFoun... | [
"filebrowser.models.Directory.objects.create",
"loader.parsers.pl.get_parser",
"filebrowser.utils.to_download_url",
"os.path.join",
"loader.parsers.pl.Parser",
"uuid.uuid4",
"shutil.copytree",
"django.test.override_settings",
"os.path.isdir",
"shutil.rmtree",
"django.contrib.auth.models.User.obj... | [((449, 504), 'os.path.join', 'os.path.join', (['settings.APPS_DIR', '"""loader/tests/fake_pl"""'], {}), "(settings.APPS_DIR, 'loader/tests/fake_pl')\n", (461, 504), False, 'import os\n'), ((509, 557), 'django.test.override_settings', 'override_settings', ([], {'FILEBROWSER_ROOT': 'FAKE_FB_ROOT'}), '(FILEBROWSER_ROOT=F... |
"""
This module implements a Flask-based web application based on the functionality provided by the "flight_model"
package.
The site is not responsive but the Bootstrap customizer has been used to generate a cut-down version of bootstrap
to provide button and form element styling.
"""
import os
from flask import Flas... | [
"flask.redirect",
"os.path.dirname"
] | [((1397, 1422), 'flask.redirect', 'redirect', (['"""/flights/list"""'], {}), "('/flights/list')\n", (1405, 1422), False, 'from flask import Flask, redirect\n'), ((685, 710), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (700, 710), False, 'import os\n'), ((764, 789), 'os.path.dirname', 'os.p... |
import streamlit as st
import pandas as pd
import altair as alt
import pickle
import numpy as np
from map import create_map
from airdata import AirData
from utils import parse_time, parse_time_hms
from vega_datasets import data
#st.set_page_config(layout="wide")
# Getting data ready, Refresh every hour (same data... | [
"pandas.read_csv",
"utils.parse_time_hms",
"altair.Chart",
"numpy.log",
"streamlit.sidebar.expander",
"utils.parse_time",
"numpy.array",
"altair.X",
"altair.Y",
"altair.Legend",
"streamlit.metric",
"map.create_map",
"streamlit.header",
"numpy.arange",
"streamlit.title",
"streamlit.side... | [((358, 405), 'streamlit.cache', 'st.cache', ([], {'ttl': '(60 * 60)', 'suppress_st_warning': '(True)'}), '(ttl=60 * 60, suppress_st_warning=True)\n', (366, 405), True, 'import streamlit as st\n'), ((2654, 2764), 'streamlit.sidebar.radio', 'st.sidebar.radio', (['"""Menu"""', "['Introduction', 'Flight Map', 'Flight Dela... |
import numpy as np
import pandas as pd
def Loader(events,args):
"""
Create a table with the pulses
"""
gb = events.groupby('Pulse',sort=False)
pulses = events.loc[gb.Sigma.idxmax()]
pulses.index = pulses.Pulse
pulses.index.name = None
pulses = pulses.drop('Pulse', axis='columns')
pulses.index... | [
"numpy.abs",
"numpy.sign"
] | [((1990, 2003), 'numpy.sign', 'np.sign', (['diff'], {}), '(diff)\n', (1997, 2003), True, 'import numpy as np\n'), ((2239, 2267), 'numpy.abs', 'np.abs', (['(pulses.Time - p.Time)'], {}), '(pulses.Time - p.Time)\n', (2245, 2267), True, 'import numpy as np\n')] |
from scapy.all import *
import argparse
parser = argparse.ArgumentParser(description="Simple SYN Flood Script")
parser.add_argument("target_ip", help="Target IP address (e.g router's IP)")
parser.add_argument("-p", "--port", help="Destination port (the port of the target's machine service, \
e.g 80 for HTTP, 22 for SS... | [
"argparse.ArgumentParser"
] | [((50, 112), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Simple SYN Flood Script"""'}), "(description='Simple SYN Flood Script')\n", (73, 112), False, 'import argparse\n')] |
from datetime import datetime, timedelta
def ts_current_second_start(ts: int) -> int:
return ts - (ts % 1000)
def ts_current_minute_start(ts: int) -> int:
return ts - (ts % 60000)
def ts_current_hour_start(ts: int) -> int:
return ts - (ts % 3600000)
def ts_last_monday_start(ts: int) -> int:
dt =... | [
"datetime.datetime.fromtimestamp"
] | [((321, 356), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (['(ts / 1000.0)'], {}), '(ts / 1000.0)\n', (343, 356), False, 'from datetime import datetime, timedelta\n'), ((560, 595), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (['(ts / 1000.0)'], {}), '(ts / 1000.0)\n', (582, 595), False... |
import sqlite3
from typing import Union, Any, List
import re
mydb = sqlite3.connect("Routing")
cursor = mydb.cursor()
cursor_2 = mydb.cursor()
route_tables = []
def get_db_tables_with_data() -> list:
"""Gets database tables. If table is empty pass"""
full_dbs = []
get_tables = cursor.execu... | [
"re.findall",
"sqlite3.connect"
] | [((73, 99), 'sqlite3.connect', 'sqlite3.connect', (['"""Routing"""'], {}), "('Routing')\n", (88, 99), False, 'import sqlite3\n'), ((1892, 1965), 're.findall', 're.findall', (["('^' + attributes['query'] + '(?=,)')", "row[attributes['index']]"], {}), "('^' + attributes['query'] + '(?=,)', row[attributes['index']])\n", (... |
# -*- coding: utf-8 -*-
import pytest
from cards.api import Card
def assert_identical(c1: Card, c2: Card):
__tracebackhide__ = True
assert c1 == c2
if c1.id != c2.id:
pytest.fail(f"id's don't math. {c1.id} != {c2.id}")
def test_identical():
c1 = Card("foo", id=123)
c2 = Card("foo", id=1... | [
"pytest.fail",
"cards.api.Card"
] | [((275, 294), 'cards.api.Card', 'Card', (['"""foo"""'], {'id': '(123)'}), "('foo', id=123)\n", (279, 294), False, 'from cards.api import Card\n'), ((304, 323), 'cards.api.Card', 'Card', (['"""foo"""'], {'id': '(123)'}), "('foo', id=123)\n", (308, 323), False, 'from cards.api import Card\n'), ((391, 410), 'cards.api.Car... |
"""flint format command
:copyright: Copyright 2021 <NAME>, see AUTHORS for details.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
import flint
def format_statements(srcdirs, includes=None, excludes=None):
proj = flint.parse(*srcdirs, includes=includes, excludes=excludes)
for src in pro... | [
"flint.parse"
] | [((241, 300), 'flint.parse', 'flint.parse', (['*srcdirs'], {'includes': 'includes', 'excludes': 'excludes'}), '(*srcdirs, includes=includes, excludes=excludes)\n', (252, 300), False, 'import flint\n')] |
import yaml
from googletrans import Translator
class ScopusScienceTopicSearch(object):
"""Mapping russian courses names to scopus classes"""
def __init__(self, topics_map_path: str = 'sources/scopus_science_map.yml'):
"""
Class constructor
Args:
topics_map_path: path to sco... | [
"yaml.safe_load",
"googletrans.Translator"
] | [((698, 710), 'googletrans.Translator', 'Translator', ([], {}), '()\n', (708, 710), False, 'from googletrans import Translator\n'), ((424, 441), 'yaml.safe_load', 'yaml.safe_load', (['f'], {}), '(f)\n', (438, 441), False, 'import yaml\n')] |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.11.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x1d\x16\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
... | [
"PyQt5.QtCore.qVersion",
"PyQt5.QtCore.qUnregisterResourceData",
"PyQt5.QtCore.qRegisterResourceData"
] | [((980271, 980372), 'PyQt5.QtCore.qRegisterResourceData', 'QtCore.qRegisterResourceData', (['rcc_version', 'qt_resource_struct', 'qt_resource_name', 'qt_resource_data'], {}), '(rcc_version, qt_resource_struct,\n qt_resource_name, qt_resource_data)\n', (980299, 980372), False, 'from PyQt5 import QtCore\n'), ((980402,... |
# tests unix socket dothttp apis
from unittest import skipIf
import requests
from dothttp.request_base import RequestCompiler, CurlCompiler
from test import TestBase
from test.core.test_request import dir_path
try:
import requests_unixsocket
except:
requests_unixsocket = None
base_dir = f"{dir_path}/request... | [
"requests.compat.quote_plus",
"unittest.skipIf",
"requests_unixsocket.testutils.UnixSocketServerThread"
] | [((326, 403), 'unittest.skipIf', 'skipIf', (['(requests_unixsocket is None)', '"""in wasm mode, it will not be available"""'], {}), "(requests_unixsocket is None, 'in wasm mode, it will not be available')\n", (332, 403), False, 'from unittest import skipIf\n'), ((762, 786), 'requests_unixsocket.testutils.UnixSocketServ... |
"""add timer activity migration
Revision ID: <KEY>
Revises: <KEY>
Create Date: 2021-04-29 22:31:18.464080
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def upgrade():
# ### commands... | [
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.DateTime",
"alembic.op.drop_table",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Integer",
"sqlalchemy.String"
] | [((977, 1002), 'alembic.op.drop_table', 'op.drop_table', (['"""activity"""'], {}), "('activity')\n", (990, 1002), False, 'from alembic import op\n'), ((759, 809), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['user_id']", "['users.id']"], {}), "(['user_id'], ['users.id'])\n", (782, 809), True, 'impo... |
# -*- coding: utf-8 -*-
"""
Given two strings s and t, determine if they are isomorphic.
Two strings are isomorphic if the characters in s can be replaced to get t.
All occurrences of a character must be replaced with another character while
preserving the order of characters. No two characters may map to the same
c... | [
"doctest.testmod",
"collections.defaultdict"
] | [((1426, 1455), 'doctest.testmod', 'doctest.testmod', ([], {'verbose': '(True)'}), '(verbose=True)\n', (1441, 1455), False, 'import doctest\n'), ((1059, 1076), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1070, 1076), False, 'from collections import defaultdict\n'), ((1091, 1108), 'collections... |
from django.shortcuts import render, redirect
from django.conf import settings
from editor.models import ContentModel
def index(request):
context = {}
template = "viewer/home.html"
try:
a = ContentModel.objects.get(ref_id='1')
except Exception as e:
return redirect('/welcome... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"editor.models.ContentModel.objects.get"
] | [((336, 370), 'django.shortcuts.render', 'render', (['request', 'template', 'context'], {}), '(request, template, context)\n', (342, 370), False, 'from django.shortcuts import render, redirect\n'), ((692, 726), 'django.shortcuts.render', 'render', (['request', 'template', 'context'], {}), '(request, template, context)\... |
"""
Class with nosetests for OptionGroup AbstractBlock in slack_view library
"""
from nose.tools import raises
from slackviews.view import OptionGroup, PlainText, Option
__author__ = '<NAME>'
__email__ = '<EMAIL>'
class TestOptiongroup:
def setup(self):
self.expected_label = 'any label'
self.e... | [
"slackviews.view.OptionGroup.deserialize",
"slackviews.view.OptionGroup.Builder",
"nose.tools.raises",
"slackviews.view.Option.Builder"
] | [((4221, 4243), 'nose.tools.raises', 'raises', (['AttributeError'], {}), '(AttributeError)\n', (4227, 4243), False, 'from nose.tools import raises\n'), ((5114, 5154), 'slackviews.view.OptionGroup.deserialize', 'OptionGroup.deserialize', (['serialized_dict'], {}), '(serialized_dict)\n', (5137, 5154), False, 'from slackv... |
# This script converts excel files to pdf files
# Import Module
from win32com import client
# Open Microsoft Excel
excel = client.Dispatch("Excel.Application")
excel_path = input("Enter the path of the excel file completely: ")
pdf_path = input(
"Enter the path of the folder where you want pdf file to be present... | [
"win32com.client.Dispatch"
] | [((125, 161), 'win32com.client.Dispatch', 'client.Dispatch', (['"""Excel.Application"""'], {}), "('Excel.Application')\n", (140, 161), False, 'from win32com import client\n')] |
from math import sin, cos, sqrt
class Vector():
def __init__(self, x, y, z):
if str in [type(x), type(y), type(z)]:
print('\n', x,y,z)
raise ValueError('Can only be numerical values')
self.x = x
self.y = y
self.z = z
self.texture = Non... | [
"math.cos",
"math.sin"
] | [((1277, 1283), 'math.cos', 'cos', (['a'], {}), '(a)\n', (1280, 1283), False, 'from math import sin, cos, sqrt\n'), ((1378, 1384), 'math.sin', 'sin', (['a'], {}), '(a)\n', (1381, 1384), False, 'from math import sin, cos, sqrt\n'), ((1511, 1517), 'math.cos', 'cos', (['a'], {}), '(a)\n', (1514, 1517), False, 'from math i... |
import os
import pytest
from loguru import logger
@pytest.mark.skipif(os.name == "nt", reason="Windows can't delete file in use")
def test_file_deleted_before_write_without_delay(tmpdir):
file = tmpdir.join("test.log")
logger.add(str(file), format="{message}", watch=True, delay=False)
os.remove(str(file)... | [
"pytest.mark.parametrize",
"loguru.logger.remove",
"loguru.logger.info",
"pytest.mark.skipif"
] | [((54, 132), 'pytest.mark.skipif', 'pytest.mark.skipif', (["(os.name == 'nt')"], {'reason': '"""Windows can\'t delete file in use"""'}), '(os.name == \'nt\', reason="Windows can\'t delete file in use")\n', (72, 132), False, 'import pytest\n'), ((384, 462), 'pytest.mark.skipif', 'pytest.mark.skipif', (["(os.name == 'nt'... |
# Author: <NAME> at 16/08/2021 <<EMAIL>>
# Licence: MIT License
# Copyright: <NAME> (2018) <<EMAIL>>
from functools import partial
import numpy as np
from scipy import linalg
from .utils import (readout_forward, _initialize_readout,
_prepare_inputs_for_learning)
from ..base.node import Node
from ... | [
"numpy.eye",
"functools.partial",
"scipy.linalg.solve"
] | [((401, 449), 'scipy.linalg.solve', 'linalg.solve', (['(XXT + ridge)', 'YXT.T'], {'assume_a': '"""sym"""'}), "(XXT + ridge, YXT.T, assume_a='sym')\n", (413, 449), False, 'from scipy import linalg\n'), ((1328, 1365), 'numpy.eye', 'np.eye', (['input_dim'], {'dtype': 'global_dtype'}), '(input_dim, dtype=global_dtype)\n', ... |
"""
Day 6: Universal Orbit Map
"""
from utils import get_lines
def distance(orbit_map, item):
if item == 'COM':
return 0
else:
return 1 + distance(orbit_map, orbit_map[item])
def orbit_path(orbit_map, item1):
if item1 == 'COM':
return []
else:
return orbit_path(orbit... | [
"utils.get_lines"
] | [((384, 401), 'utils.get_lines', 'get_lines', (['"""day6"""'], {}), "('day6')\n", (393, 401), False, 'from utils import get_lines\n'), ((708, 725), 'utils.get_lines', 'get_lines', (['"""day6"""'], {}), "('day6')\n", (717, 725), False, 'from utils import get_lines\n')] |
import ee
from zipfile import ZipFile
from io import BytesIO
import os
import requests
class S2indexes:
def __init__(self, area, dir, date_from, date_end, scope):
"""
given an area defined by a geoJSON, it returns rasters of
remote sensing indexes at the specified date at granularuity de... | [
"rasterio.open",
"io.BytesIO",
"ee.Date",
"requests.get",
"ee.ImageCollection",
"ee.Initialize"
] | [((1419, 1434), 'ee.Initialize', 'ee.Initialize', ([], {}), '()\n', (1432, 1434), False, 'import ee\n'), ((3548, 3587), 'rasterio.open', 'rasterio.open', (['(self.dir + self.files[0])'], {}), '(self.dir + self.files[0])\n', (3561, 3587), False, 'import rasterio\n'), ((3607, 3646), 'rasterio.open', 'rasterio.open', (['(... |
import argparse
# This program takes as Input the gene reference folder
############ INPUT OF VARIABLES ###################
parser = argparse.ArgumentParser(description='Input program')
parser.add_argument('namefolder', type=str, help='GeneReference folder')
folder = parser.parse_args().namefolder
################... | [
"argparse.ArgumentParser"
] | [((136, 188), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Input program"""'}), "(description='Input program')\n", (159, 188), False, 'import argparse\n')] |
"""
Model architecture of Convolutional Autoencoder for converting grayscale images to RGB images.
"""
import torch
import torch.nn as nn
import torch.nn.functional as functional
class ConvAutoencoder(nn.Module):
def __init__(self, batch_size: int, ip_image_dims: int = 32, filter_count: tuple = (16, 32), kernel_... | [
"torch.nn.Linear",
"torch.nn.Conv2d"
] | [((1032, 1085), 'torch.nn.Conv2d', 'nn.Conv2d', (['(1)', 'filter_count[0]', 'kernel_dims'], {'padding': '(1)'}), '(1, filter_count[0], kernel_dims, padding=1)\n', (1041, 1085), True, 'import torch.nn as nn\n'), ((1140, 1196), 'torch.nn.Conv2d', 'nn.Conv2d', (['filter_count[0]', 'filter_count[1]', 'kernel_dims'], {}), '... |
import pandas as pd
import numpy as np
from numpy import corrcoef
import matplotlib.pyplot as plt
from sklearn.feature_selection import chi2
from sklearn.feature_selection import f_classif
from math import *
plt.style.use('ggplot')
fig = plt.figure()
COUNTER = 1
#Return the category dictionary,categorical variables l... | [
"matplotlib.pyplot.boxplot",
"matplotlib.pyplot.hist",
"numpy.corrcoef",
"matplotlib.pyplot.ylabel",
"sklearn.feature_selection.f_classif",
"matplotlib.pyplot.style.use",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.scatter",
"sklearn.feature_selection.chi2",
"matplotlib.pyplot.... | [((208, 231), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (221, 231), True, 'import matplotlib.pyplot as plt\n'), ((239, 251), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (249, 251), True, 'import matplotlib.pyplot as plt\n'), ((2265, 2279), 'numpy.corrcoef', ... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic.base import TemplateView
urlpatterns = patterns('',
# Examples:
url(r'^$', TemplateView.as_view(template_name="home.html"), name='home'),
url(r'^auth-test', 'nepal.views.auth_test', name='auth-tes... | [
"django.conf.urls.include",
"django.conf.urls.url",
"django.views.generic.base.TemplateView.as_view"
] | [((262, 322), 'django.conf.urls.url', 'url', (['"""^auth-test"""', '"""nepal.views.auth_test"""'], {'name': '"""auth-test"""'}), "('^auth-test', 'nepal.views.auth_test', name='auth-test')\n", (265, 322), False, 'from django.conf.urls import patterns, include, url\n'), ((195, 242), 'django.views.generic.base.TemplateVie... |
from qsearch import Project, solvers, unitaries, utils, multistart_solvers, parallelizers, compiler, options
import scipy as sp
import os
try:
from qsrs import BFGS_Jac_SolverNative, LeastSquares_Jac_SolverNative
except ImportError:
BFGS_Jac_SolverNative = None
LeastSquares_Jac_SolverNative = None
import p... | [
"tempfile.TemporaryDirectory",
"qsrs.LeastSquares_Jac_SolverNative",
"qsearch.multistart_solvers.MultiStart_Solver",
"qsearch.solvers.BFGS_Jac_Solver",
"os.path.join",
"qsearch.compiler.SearchCompiler",
"qsearch.unitaries.qft",
"qsearch.options.Options",
"qsrs.BFGS_Jac_SolverNative",
"qsearch.solv... | [((371, 387), 'qsearch.unitaries.qft', 'unitaries.qft', (['(8)'], {}), '(8)\n', (384, 387), False, 'from qsearch import Project, solvers, unitaries, utils, multistart_solvers, parallelizers, compiler, options\n'), ((952, 1072), 'pytest.mark.skipif', 'pytest.mark.skipif', (["(sys.platform == 'win32')"], {'reason': '"""T... |
import os
import numpy as np
def save_samples_truncted_prob(fname, points, prob):
'''
Save the visualization of sampling to a ply file.
Red points represent positive predictions.
Green points represent negative predictions.
Parameters
fname: File name to save
points: [N, 3] array o... | [
"os.makedirs",
"numpy.zeros",
"os.path.join",
"numpy.concatenate"
] | [((568, 585), 'numpy.zeros', 'np.zeros', (['r.shape'], {}), '(r.shape)\n', (576, 585), True, 'import numpy as np\n'), ((601, 649), 'numpy.concatenate', 'np.concatenate', (['[points, r, g, b, prob]'], {'axis': '(-1)'}), '([points, r, g, b, prob], axis=-1)\n', (615, 649), True, 'import numpy as np\n'), ((1380, 1425), 'os... |
import setuptools
name = "yamlval"
__version__ = "v1.0.2"
with open("README.md", "r") as f:
long_description = f.read()
setuptools.setup(
name=name,
version=__version__,
author="<NAME>",
author_email="<EMAIL>",
description="A YAML type validator",
long_description=long_description,
lo... | [
"setuptools.find_packages"
] | [((502, 528), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (526, 528), False, 'import setuptools\n')] |
import requests
import pprint
def format_open_search_results(results):
formatted_results = []
titles = results[1]
res_length = len(titles)
count = 0
while count < res_length:
formatted_results.append([titles[count], results[3][count]])
count += 1
return formatted_results
'''... | [
"pprint.pprint",
"requests.get"
] | [((3634, 3656), 'pprint.pprint', 'pprint.pprint', (['results'], {}), '(results)\n', (3647, 3656), False, 'import pprint\n'), ((5309, 5331), 'pprint.pprint', 'pprint.pprint', (['results'], {}), '(results)\n', (5322, 5331), False, 'import pprint\n'), ((6463, 6485), 'requests.get', 'requests.get', (['endpoint'], {}), '(en... |
import re
import pytest
from mimesis import config
from mimesis.enums import Gender
from mimesis.exceptions import NonEnumerableError
from mimesis.providers.base import BaseDataProvider, StrMixin
from . import patterns
def test_str_mixin():
mixin = StrMixin()
assert mixin
class TestBase(object):
@py... | [
"pytest.mark.parametrize",
"pytest.raises",
"mimesis.providers.base.BaseDataProvider",
"mimesis.providers.base.StrMixin"
] | [((258, 268), 'mimesis.providers.base.StrMixin', 'StrMixin', ([], {}), '()\n', (266, 268), False, 'from mimesis.providers.base import BaseDataProvider, StrMixin\n'), ((521, 649), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""gender, excepted"""', "[(Gender.MALE, 'male'), (Gender.FEMALE, 'female'), (None, ... |
from collections import OrderedDict
from nnunet.paths import nnUNet_raw_data
from batchgenerators.utilities.file_and_folder_operations import *
import shutil
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-dataset_path", type=str,
default='/home/lwt/... | [
"collections.OrderedDict",
"argparse.ArgumentParser",
"shutil.rmtree"
] | [((200, 225), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (223, 225), False, 'import argparse\n'), ((2248, 2261), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2259, 2261), False, 'from collections import OrderedDict\n'), ((2716, 3052), 'collections.OrderedDict', 'OrderedDict'... |
""" Network wiring """
import tensorflow as tf
import numpy as np
import glob, time, os
import functools
from utils import Utils
class Network(object):
@staticmethod
def _spectral_norm(w):
w_shape = w.shape.as_list()
w = tf.reshape(w, [-1, w_shape[-1]])
with tf.variable_scope("u", r... | [
"tensorflow.transpose",
"tensorflow.reduce_sum",
"tensorflow.nn.moments",
"tensorflow.truncated_normal_initializer",
"tensorflow.ones_like",
"tensorflow.reduce_mean",
"tensorflow.cast",
"tensorflow.log",
"tensorflow.contrib.layers.layer_norm",
"tensorflow.assign",
"tensorflow.concat",
"tensorf... | [((249, 281), 'tensorflow.reshape', 'tf.reshape', (['w', '[-1, w_shape[-1]]'], {}), '(w, [-1, w_shape[-1]])\n', (259, 281), True, 'import tensorflow as tf\n'), ((782, 805), 'tensorflow.stop_gradient', 'tf.stop_gradient', (['u_hat'], {}), '(u_hat)\n', (798, 805), True, 'import tensorflow as tf\n'), ((822, 845), 'tensorf... |
import os
from tkinter import *
from tkinter import messagebox
from pytube import YouTube, exceptions
app = Tk() # Inicia o programa
app.title("Youtube Downloader") # Título do programa.
app.geometry("600x400") # Dimensão do programa.
# app.configure(background="#334") # Configurações de cor.
# <--------------... | [
"tkinter.messagebox.showerror",
"tkinter.messagebox.showinfo",
"pytube.YouTube",
"os.getcwd"
] | [((1372, 1385), 'pytube.YouTube', 'YouTube', (['link'], {}), '(link)\n', (1379, 1385), False, 'from pytube import YouTube, exceptions\n'), ((2108, 2169), 'tkinter.messagebox.showinfo', 'messagebox.showinfo', ([], {'title': '"""Download Concluído!"""', 'message': 'msg'}), "(title='Download Concluído!', message=msg)\n", ... |
from model.group import Group
import random
__author__ = 'Pysarev'
def test_edit_first_group(app, db, check_ui):
if len(db.get_group_list()) == 0:
app.group.create(Group(name="Edit_test"))
old_groups = db.get_group_list()
old_group=random.choice(old_groups)
edit_group = Group(name="edited2", f... | [
"model.group.Group",
"random.choice"
] | [((254, 279), 'random.choice', 'random.choice', (['old_groups'], {}), '(old_groups)\n', (267, 279), False, 'import random\n'), ((297, 336), 'model.group.Group', 'Group', ([], {'name': '"""edited2"""', 'footer': '"""edited2"""'}), "(name='edited2', footer='edited2')\n", (302, 336), False, 'from model.group import Group\... |
# encoding: utf-8
import pyxel
pyxel.init(160, 120, caption="Pong")
# **** Számold a pontokat! ****
# Legyen az app osztálynak egy-egy mezője, ami a jobb ill. bal
# játékos pontját tárolja.
# Legyen az app osztálynak egy-egy metódusa, ami a jobb ill. bal
# játékos pontszerzését kezeli le.
# Egy pont után induljon a la... | [
"pyxel.rect",
"pyxel.circ",
"pyxel.init",
"pyxel.run",
"pyxel.btn",
"pyxel.cls"
] | [((31, 67), 'pyxel.init', 'pyxel.init', (['(160)', '(120)'], {'caption': '"""Pong"""'}), "(160, 120, caption='Pong')\n", (41, 67), False, 'import pyxel\n'), ((1908, 1939), 'pyxel.run', 'pyxel.run', (['app.update', 'app.draw'], {}), '(app.update, app.draw)\n', (1917, 1939), False, 'import pyxel\n'), ((1004, 1036), 'pyxe... |
from vulkan import vk, helpers as hvk
class Renderer(object):
def __init__(self, engine):
self.engine = engine
self.image_ready = None
self.rendering_done = None
self.render_fences = ()
self.render_cache = {}
self.enabled = True
self._setup_sync()
... | [
"vulkan.helpers.create_fence",
"vulkan.helpers.device_wait_idle",
"vulkan.helpers.destroy_semaphore",
"vulkan.helpers.present_info",
"vulkan.helpers.create_semaphore",
"vulkan.helpers.destroy_fence",
"vulkan.helpers.semaphore_create_info",
"vulkan.helpers.fence_create_info",
"vulkan.helpers.submit_i... | [((417, 469), 'vulkan.helpers.destroy_semaphore', 'hvk.destroy_semaphore', (['api', 'device', 'self.image_ready'], {}), '(api, device, self.image_ready)\n', (438, 469), True, 'from vulkan import vk, helpers as hvk\n'), ((478, 533), 'vulkan.helpers.destroy_semaphore', 'hvk.destroy_semaphore', (['api', 'device', 'self.re... |
# Display the ip's from all network interfaces on the display
import time
import Adafruit_Nokia_LCD as LCD
import Adafruit_GPIO.SPI as SPI
import netifaces
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
# Raspberry Pi hardware SPI config:
DC = 23
RST = 24
SPI_PORT = 0
SPI_DEVICE = 0
# Ra... | [
"PIL.ImageFont.load_default",
"PIL.Image.new",
"time.sleep",
"netifaces.ifaddresses",
"PIL.ImageDraw.Draw",
"netifaces.interfaces",
"Adafruit_GPIO.SPI.SpiDev"
] | [((1037, 1082), 'PIL.Image.new', 'Image.new', (['"""1"""', '(LCD.LCDWIDTH, LCD.LCDHEIGHT)'], {}), "('1', (LCD.LCDWIDTH, LCD.LCDHEIGHT))\n", (1046, 1082), False, 'from PIL import Image\n'), ((1130, 1151), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['image'], {}), '(image)\n', (1144, 1151), False, 'from PIL import ImageDra... |
import configparser
from whatcha_readin.paths import WhatchaReadinPaths
VERSION = "0.0.4"
def get_config():
config_path = WhatchaReadinPaths.get_config_path()
config = configparser.ConfigParser()
config.read(config_path)
return config
| [
"configparser.ConfigParser",
"whatcha_readin.paths.WhatchaReadinPaths.get_config_path"
] | [((130, 166), 'whatcha_readin.paths.WhatchaReadinPaths.get_config_path', 'WhatchaReadinPaths.get_config_path', ([], {}), '()\n', (164, 166), False, 'from whatcha_readin.paths import WhatchaReadinPaths\n'), ((180, 207), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (205, 207), False, 'impor... |
from bokeh.application.handlers import FunctionHandler, DirectoryHandler
from bokeh.application import Application
import numpy as np
import holoviews as hv
import boto3
from PIL import Image
import holoviews.plotting.bokeh # important
from bokeh.io import show, curdoc
from bokeh.layouts import layout
import io
from ... | [
"bokeh.layouts.layout",
"PIL.Image.open",
"holoviews.renderer",
"bokeh.application.handlers.FunctionHandler",
"io.BytesIO",
"numpy.asarray",
"boto3.resource",
"marshmallow.fields.String",
"marshmallow.fields.Integer"
] | [((1073, 1093), 'boto3.resource', 'boto3.resource', (['"""s3"""'], {}), "('s3')\n", (1087, 1093), False, 'import boto3\n'), ((1176, 1188), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (1186, 1188), False, 'import io\n'), ((1246, 1269), 'PIL.Image.open', 'Image.open', (['file_stream'], {}), '(file_stream)\n', (1256, 12... |
# coding=utf-8
u"""
User: xulin
Date: 13-6-6
Time: 上午11:08
"""
import datetime
from sqlalchemy import Column, DateTime, text
from sqlalchemy.ext.declarative import declarative_base
class TBase(object):
created_date = Column(DateTime, default=datetime.datetime.now)
modified_date = Column(DateTime, default=date... | [
"sqlalchemy.text",
"sqlalchemy.Column",
"sqlalchemy.ext.declarative.declarative_base"
] | [((384, 411), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {'cls': 'TBase'}), '(cls=TBase)\n', (400, 411), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((223, 270), 'sqlalchemy.Column', 'Column', (['DateTime'], {'default': 'datetime.datetime.now'}), '(DateTime, default... |
#Script to demonstrate overwriting a service.
import arcpy
from sddraft_modifiers import HostedFeatureServiceProperties
print("Imported ArcPy")
# Initialize the variables
mxd = r'E:\UC_demo\Publishing\advanced_publishing\Good_cartography.mxd'
server_con = r'MY_HOSTED_SERVICES'
service_name = "Fortune_500_compa... | [
"arcpy.mapping.CreateMapSDDraft",
"arcpy.StageService_server",
"arcpy.UploadServiceDefinition_server",
"sddraft_modifiers.HostedFeatureServiceProperties"
] | [((553, 628), 'arcpy.mapping.CreateMapSDDraft', 'arcpy.mapping.CreateMapSDDraft', (['mxd', 'sddraft_file', 'service_name', 'server_con'], {}), '(mxd, sddraft_file, service_name, server_con)\n', (583, 628), False, 'import arcpy\n'), ((735, 779), 'sddraft_modifiers.HostedFeatureServiceProperties', 'HostedFeatureServicePr... |
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from quantr.maindash import app
def make_layout():
return html.Div(
[
dcc.Input(id="my-id", value="initial value", type="text"),
html.Div(id="my-div"),
]
... | [
"dash_core_components.Input",
"dash.dependencies.Output",
"dash_html_components.Div",
"dash.dependencies.Input"
] | [((343, 403), 'dash.dependencies.Output', 'Output', ([], {'component_id': '"""my-div"""', 'component_property': '"""children"""'}), "(component_id='my-div', component_property='children')\n", (349, 403), False, 'from dash.dependencies import Input, Output\n'), ((410, 465), 'dash.dependencies.Input', 'Input', ([], {'com... |
#!/usr/bin/env python3
import RPi.GPIO as GPIO
import subprocess
import time
from gpiozero import OutputDevice
SLEEP_INTERVAL = 3 # (seconds) How often we check the core temperature.
GPIO_PIN = 13 # Which GPIO pin you're using to control the fan.
DEBUG_LOGGING = False
def setup():
if DEBUG_LOGGING: print('Set... | [
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"subprocess.run",
"time.sleep",
"RPi.GPIO.PWM",
"RPi.GPIO.setmode"
] | [((357, 379), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (369, 379), True, 'import RPi.GPIO as GPIO\n'), ((384, 414), 'RPi.GPIO.setup', 'GPIO.setup', (['GPIO_PIN', 'GPIO.OUT'], {}), '(GPIO_PIN, GPIO.OUT)\n', (394, 414), True, 'import RPi.GPIO as GPIO\n'), ((419, 450), 'RPi.GPIO.output', 'GP... |
import pytest
import os
import core.utils.csv as csv
def test_csv():
test_headers = ['style','country']
test_dict = dict(style='Porter', country='United Kingdom')
test_file = "beer.csv"
try:
csv.dict_writer(test_file, test_headers, test_dict)
except:
pass
if os.path.exists(test_... | [
"os.path.exists",
"core.utils.csv.dict_writer",
"os.remove"
] | [((300, 325), 'os.path.exists', 'os.path.exists', (['test_file'], {}), '(test_file)\n', (314, 325), False, 'import os\n'), ((216, 267), 'core.utils.csv.dict_writer', 'csv.dict_writer', (['test_file', 'test_headers', 'test_dict'], {}), '(test_file, test_headers, test_dict)\n', (231, 267), True, 'import core.utils.csv as... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import sys
import argparse
import numpy as np
import quantities as pq
import nptdms
import axographio
def tdms2axg(filename, force=False, verbose=True):
"""
Convert a TDMS file to an AxoGraph (AXGX) file
"""
if not os.path.isf... | [
"argparse.ArgumentParser",
"nptdms.TdmsFile.read",
"quantities.Quantity",
"os.path.isfile",
"axographio.file_contents"
] | [((817, 847), 'nptdms.TdmsFile.read', 'nptdms.TdmsFile.read', (['filename'], {}), '(filename)\n', (837, 847), False, 'import nptdms\n'), ((2413, 2453), 'axographio.file_contents', 'axographio.file_contents', (['names', 'columns'], {}), '(names, columns)\n', (2437, 2453), False, 'import axographio\n'), ((2894, 2942), 'a... |
"""
Defines the Repository dictionary, which maps names to Cards
"""
from collections import defaultdict
from mtg_mana_simulator.card import Card
from mtg_mana_simulator.sequence import Sequence
Repository = defaultdict(lambda: Card.filler)
Repository['Arcane Signet'] = Card.untapped_rock(2, 1)
Repository['Azorius ... | [
"mtg_mana_simulator.sequence.Sequence.once",
"collections.defaultdict",
"mtg_mana_simulator.sequence.Sequence.one.prefixed_by",
"mtg_mana_simulator.sequence.Sequence.repeat",
"mtg_mana_simulator.card.Card.untapped_rock",
"mtg_mana_simulator.card.Card.draw_spell"
] | [((210, 243), 'collections.defaultdict', 'defaultdict', (['(lambda : Card.filler)'], {}), '(lambda : Card.filler)\n', (221, 243), False, 'from collections import defaultdict\n'), ((275, 299), 'mtg_mana_simulator.card.Card.untapped_rock', 'Card.untapped_rock', (['(2)', '(1)'], {}), '(2, 1)\n', (293, 299), False, 'from m... |
import random
from enum import Enum
class OrderStatus(Enum):
INITIATED = "INITIATED"
PENDING = "PENDING"
COMPLETE = "COMPLETE"
class Order:
"""Order object class."""
def __init__(self, details):
self.id = random.randint(100000, 999999)
self.details = details
self.status ... | [
"random.randint"
] | [((238, 268), 'random.randint', 'random.randint', (['(100000)', '(999999)'], {}), '(100000, 999999)\n', (252, 268), False, 'import random\n')] |
test_input = r'''..#.#..#####.#.#.#.###.##.....###.##.#..###.####..#####..#....#..#..##..###..######.###...####..#..#####..##..#.#####...##.#.#..#.##..#.#......#.###.######.###.####...#.##.##..#..#..#####.....#.#....###..#.##......#.....#..#..#..##..#...##.######.####.####.#.#...#.......#..#.#.#...####.##.#......#..#..... | [
"operator.itemgetter",
"copy.copy",
"time.time",
"collections.defaultdict"
] | [((3819, 3830), 'time.time', 'time.time', ([], {}), '()\n', (3828, 3830), False, 'import time\n'), ((4000, 4011), 'time.time', 'time.time', ([], {}), '()\n', (4009, 4011), False, 'import time\n'), ((2437, 2458), 'copy.copy', 'copy.copy', (['self.image'], {}), '(self.image)\n', (2446, 2458), False, 'import copy\n'), ((1... |
#import hickle as hkl
import numpy as np
from keras import backend as K
from keras.preprocessing.image import Iterator
import matplotlib.pyplot as plt
# Defines one class: SequenceGenerator. a subclass of Iterator
# ====================================
# Called from kitti_train.py and kitti_evaluate.py.
# Class Seque... | [
"matplotlib.pyplot.imshow",
"numpy.transpose",
"keras.backend.image_data_format",
"numpy.random.permutation",
"numpy.array",
"numpy.zeros",
"numpy.load",
"matplotlib.pyplot.show"
] | [((718, 739), 'keras.backend.image_data_format', 'K.image_data_format', ([], {}), '()\n', (737, 739), True, 'from keras import backend as K\n'), ((928, 946), 'numpy.load', 'np.load', (['data_file'], {}), '(data_file)\n', (935, 946), True, 'import numpy as np\n'), ((1876, 1926), 'numpy.array', 'np.array', (['self.X[0, :... |
import psycopg2
from datetime import datetime
from psycopg2 import sql
from est.fltr import county_return
from est.db.cur import con_cur
import numpy as np
import pandas as pd
def comp_find(est, a, b):
temp1 = est
temp2 = np.array(temp1[0])
county = temp2[0].strip()
state = temp2[1].strip()
cur, c... | [
"numpy.array",
"est.db.cur.con_cur"
] | [((231, 249), 'numpy.array', 'np.array', (['temp1[0]'], {}), '(temp1[0])\n', (239, 249), True, 'import numpy as np\n'), ((325, 334), 'est.db.cur.con_cur', 'con_cur', ([], {}), '()\n', (332, 334), False, 'from est.db.cur import con_cur\n'), ((632, 641), 'est.db.cur.con_cur', 'con_cur', ([], {}), '()\n', (639, 641), Fals... |
#!/usr/bin/python3
import sys
import math
def getDigits(x):
digits = []
while x > 0:
digits.append(x % 10)
x = x // 10
digits.reverse()
return digits
def getInt(digits):
num = 0
digits.reverse()
multiplier = 1
for digit in digits:
num += digit * multiplier
multiplier *= 10
return num
# doesn't work... | [
"math.sqrt"
] | [((1539, 1569), 'math.sqrt', 'math.sqrt', (['palindromeCandidate'], {}), '(palindromeCandidate)\n', (1548, 1569), False, 'import math\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-31 10:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Noun',
... | [
"django.db.models.DateTimeField",
"django.db.models.TextField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((364, 457), '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", (380, 457), False, 'from django.db import migrations, models\... |
from opentsp import helpers
def diamond_prune(instance):
# def list_prune(ls):
# var = True # may not be needed
# while var is True: # may not be needed
# bad_count = 0 # may not be needed
# semi_pruned_ls = [i for i in ls if i.fitness == 'good'] # may not be needed
... | [
"opentsp.helpers.angle"
] | [((10504, 10570), 'opentsp.helpers.angle', 'helpers.angle', (['edge.node_one', 'instance.average_node', 'edge.node_two'], {}), '(edge.node_one, instance.average_node, edge.node_two)\n', (10517, 10570), False, 'from opentsp import helpers\n'), ((8650, 8720), 'opentsp.helpers.angle', 'helpers.angle', (['sp_ls[1].node_one... |
from aiohttp import web
import socketio
import numpy as np
def load_eigenvector(k,d):
vec_path = "eigenvectors/eigen_k=" + str(k) + ",d=" + str(d) + ".npy"
eigenvector_np = np.load(vec_path)
eigenvector_str = ""
for x in np.nditer(eigenvector_np):
eigenvector_str += str(x) + " "
# print()... | [
"aiohttp.web.run_app",
"numpy.nditer",
"aiohttp.web.Application",
"socketio.AsyncServer",
"numpy.load"
] | [((423, 469), 'socketio.AsyncServer', 'socketio.AsyncServer', ([], {'cors_allowed_origins': '"""*"""'}), "(cors_allowed_origins='*')\n", (443, 469), False, 'import socketio\n'), ((516, 533), 'aiohttp.web.Application', 'web.Application', ([], {}), '()\n', (531, 533), False, 'from aiohttp import web\n'), ((182, 199), 'nu... |
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
from typing import Union, Optional
''' IMPORTS '''
import requests
import base64
import os
import binascii
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
""" GLOBALS/PARAMS """
# Global anno... | [
"demistomock.params",
"demistomock.command",
"requests.packages.urllib3.disable_warnings",
"demistomock.args",
"base64.b64decode",
"requests.request",
"os.environ.pop",
"demistomock.getIntegrationContext",
"requests.get",
"demistomock.results"
] | [((238, 282), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', ([], {}), '()\n', (280, 282), False, 'import requests\n'), ((337, 368), 'demistomock.getIntegrationContext', 'demisto.getIntegrationContext', ([], {}), '()\n', (366, 368), True, 'import demistomock as demisto\n'), ... |
from django.conf import settings
from django.template.defaulttags import register
from django.urls import reverse
from accounts.models import User
from supply_chains.models import SupplyChain, SupplyChainUmbrella
@register.simple_tag
def get_feedback_emails_as_string() -> str:
"""Formats emails as comma separate... | [
"supply_chains.models.SupplyChain.objects.get",
"accounts.models.User.objects.filter",
"django.template.defaulttags.register.simple_tag",
"django.urls.reverse"
] | [((850, 889), 'django.template.defaulttags.register.simple_tag', 'register.simple_tag', ([], {'takes_context': '(True)'}), '(takes_context=True)\n', (869, 889), False, 'from django.template.defaulttags import register\n'), ((1329, 1369), 'django.template.defaulttags.register.simple_tag', 'register.simple_tag', ([], {'t... |
from decimal import Decimal,getcontext
getcontext().prec=10**6
a,b = map(Decimal,input().split())
print(format(a * b,'f'))
| [
"decimal.getcontext"
] | [((39, 51), 'decimal.getcontext', 'getcontext', ([], {}), '()\n', (49, 51), False, 'from decimal import Decimal, getcontext\n')] |