code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-18 05:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('cmdb', '0001_initial'),
('appc... | [
"django.db.models.EmailField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((2316, 2430), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""accounts.RoleList"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.CASCADE, to='accounts.RoleList')\n", (2333, 2430), False,... |
import http
import logging
from typing import List, Tuple, MutableMapping
from datetime import datetime
import re
from requests.packages.urllib3 import Retry
import autoscaler.utils as utils
from autoscaler.autoscaling_groups import AutoScalingGroup
from autoscaler.azure_api import AzureApi, AzureScaleSet, AzureScale... | [
"logging.getLogger",
"autoscaler.utils.AllCompletedFuture",
"re.compile",
"datetime.datetime.now",
"autoscaler.utils.selectors_to_hash",
"autoscaler.utils.CompletedFuture"
] | [((427, 454), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (444, 454), False, 'import logging\n'), ((3351, 3389), 're.compile', 're.compile', (['"""\\\\w+_(?P<class>[A-Z]+).+"""'], {}), "('\\\\w+_(?P<class>[A-Z]+).+')\n", (3361, 3389), False, 'import re\n'), ((9475, 9502), 'autoscaler.u... |
import unittest
import datetime
from parameterized import parameterized
from activity_merger import Interval
from aw_core.models import Event
from typing import List, Tuple
def _build_datetime(seed: int) -> datetime.datetime:
return datetime.datetime(2000, 1, seed, seed, 0, 0).astimezone(datetime.timezone.utc)
... | [
"unittest.main",
"datetime.datetime",
"datetime.timedelta"
] | [((6290, 6305), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6303, 6305), False, 'import unittest\n'), ((239, 283), 'datetime.datetime', 'datetime.datetime', (['(2000)', '(1)', 'seed', 'seed', '(0)', '(0)'], {}), '(2000, 1, seed, seed, 0, 0)\n', (256, 283), False, 'import datetime\n'), ((2894, 2915), 'datetime.... |
"""
NOTE:
There are a few minor complications to fluid human control which make this
code a little more involved than trivial.
1. Key press-release cycles can be, and often are, faster than one tick of
the game/simulation, but the player still wants that cycle to count, i.e.
to lay a bomb!
2. When holding down ... | [
"time.time"
] | [((1575, 1581), 'time.time', 'time', ([], {}), '()\n', (1579, 1581), False, 'from time import time\n'), ((2098, 2104), 'time.time', 'time', ([], {}), '()\n', (2102, 2104), False, 'from time import time\n'), ((1767, 1773), 'time.time', 'time', ([], {}), '()\n', (1771, 1773), False, 'from time import time\n'), ((1911, 19... |
import datetime as dt
from os.path import dirname, join
import numpy as np
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
from bokeh.io import curdoc
from bokeh.layouts import column, gridplot, row
from bokeh.models import ColumnDataSource, DataRange1d, Select, HoverTool, Panel, Tabs, LinearC... | [
"datetime.datetime",
"bokeh.layouts.column",
"bokeh.models.Div",
"pyarrow.parquet.read_table",
"bokeh.plotting.figure",
"bokeh.io.curdoc",
"bokeh.models.Select",
"numpy.array",
"bokeh.models.NumeralTickFormatter",
"pandas.DataFrame",
"pandas.date_range",
"bokeh.models.HoverTool"
] | [((902, 925), 'datetime.datetime', 'dt.datetime', (['(2017)', '(7)', '(1)'], {}), '(2017, 7, 1)\n', (913, 925), True, 'import datetime as dt\n'), ((935, 958), 'datetime.datetime', 'dt.datetime', (['(2022)', '(1)', '(1)'], {}), '(2022, 1, 1)\n', (946, 958), True, 'import datetime as dt\n'), ((7986, 8121), 'bokeh.models.... |
import pandas_datareader.data as pdr
import yfinance as fix
import numpy as np
fix.pdr_override()
def back_test(strategy, seq_len, ticker, start_date, end_date, dim):
"""
A simple back test for a given date period
:param strategy: the chosen strategy. Note to have already formed the model, and fitted with... | [
"yfinance.pdr_override",
"numpy.array",
"pandas_datareader.data.get_data_yahoo"
] | [((79, 97), 'yfinance.pdr_override', 'fix.pdr_override', ([], {}), '()\n', (95, 97), True, 'import yfinance as fix\n'), ((785, 833), 'pandas_datareader.data.get_data_yahoo', 'pdr.get_data_yahoo', (['ticker', 'start_date', 'end_date'], {}), '(ticker, start_date, end_date)\n', (803, 833), True, 'import pandas_datareader.... |
# -*- coding: utf-8
"""Module for custom component groups.
It is possible to create subsystems of component groups in tespy. The subsystem
class is the base class for custom subsystems.
This file is part of project TESPy (github.com/oemof/tespy). It's copyrighted
by the contributors recorded in the version control ... | [
"logging.error"
] | [((1158, 1176), 'logging.error', 'logging.error', (['msg'], {}), '(msg)\n', (1171, 1176), False, 'import logging\n'), ((2040, 2058), 'logging.error', 'logging.error', (['msg'], {}), '(msg)\n', (2053, 2058), False, 'import logging\n'), ((1362, 1380), 'logging.error', 'logging.error', (['msg'], {}), '(msg)\n', (1375, 138... |
from setuptools import setup, find_packages
setup(
name="raytracing-one-weekend",
version="0.0.0",
author="<NAME>",
author_email="<EMAIL>",
description="A raytracer achievable in a weekend.",
url="https://github.com/ninezerozeronine/raytracing-one-weekend",
install_requires=[
"Pillo... | [
"setuptools.find_packages"
] | [((361, 381), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (374, 381), False, 'from setuptools import setup, find_packages\n')] |
"""
Notification email machinery, for tasks to send credentials and instructions to users.
Email templates placed inside the `templates` directory of this module should:
- extend from `layout`
- provide `subject` and `body` blocks
"""
from enum import Enum
import os.path
from jinja2 import Environment, FileSystemLo... | [
"srcf.mail.send_mail"
] | [((2983, 3057), 'srcf.mail.send_mail', 'send_mail', (['recipient', 'subject', 'body'], {'copy_sysadmins': '(False)', 'session': 'session'}), '(recipient, subject, body, copy_sysadmins=False, session=session)\n', (2992, 3057), False, 'from srcf.mail import send_mail\n')] |
import unittest
from players import Player, Quarterback
from possible_values import *
from game import Game
from random import randint, uniform, sample
from season import *
# TODO - some things you can add...
class FootballGameTest(unittest.TestCase):
'''test the class'''
def test_field_goal_made(self):
... | [
"random.sample",
"players.Player",
"players.Quarterback",
"game.Game",
"unittest.main"
] | [((1843, 1858), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1856, 1858), False, 'import unittest\n'), ((332, 355), 'random.sample', 'sample', (['team_names'], {'k': '(2)'}), '(team_names, k=2)\n', (338, 355), False, 'from random import randint, uniform, sample\n'), ((371, 388), 'game.Game', 'Game', ([], {'team... |
from django.contrib.auth import update_session_auth_hash
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User
from django.contrib.auth.views import (LoginView, PasswordResetConfirmView,
PasswordResetView)
from django.http import Htt... | [
"django.contrib.auth.update_session_auth_hash",
"django.http.HttpResponseNotAllowed",
"django.http.HttpResponse",
"users.models.Lock.objects.filter",
"users.models.UserSession.objects.create",
"django.urls.reverse_lazy"
] | [((857, 892), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""dashboard:dashboard"""'], {}), "('dashboard:dashboard')\n", (869, 892), False, 'from django.urls import reverse_lazy\n'), ((1134, 1163), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""users:profile"""'], {}), "('users:profile')\n", (1146, 1163), False, ... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
df = pd.read_csv('transcount.csv')
df = df.groupby('year').aggregate(np.mean)
gpu = pd.read_csv('gpu_transcount.csv')
gpu = gpu.groupby('year').aggregate(np.mean)
df = pd.merge(df, gpu, how='outer', left_index=True, right_index=True)
df = df.rep... | [
"pandas.merge",
"pandas.read_csv",
"matplotlib.pyplot.show"
] | [((78, 107), 'pandas.read_csv', 'pd.read_csv', (['"""transcount.csv"""'], {}), "('transcount.csv')\n", (89, 107), True, 'import pandas as pd\n'), ((158, 191), 'pandas.read_csv', 'pd.read_csv', (['"""gpu_transcount.csv"""'], {}), "('gpu_transcount.csv')\n", (169, 191), True, 'import pandas as pd\n'), ((243, 308), 'panda... |
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n = int(readline())
h = int(readline())
w = int(readline())
print((n - h + 1) * (n - w + 1))
| [
"sys.setrecursionlimit"
] | [((116, 146), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10 ** 7)'], {}), '(10 ** 7)\n', (137, 146), False, 'import sys\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import logging
import os.path
import subprocess
from collections import OrderedDict
from itertools import izip
import numpy as np
import pandas as pd
from django.conf import settings
from django.core.cache import cache
from django.db impo... | [
"logging.getLogger",
"django.db.connection.commit",
"pandas.read_sql_query",
"ontask.fix_pctg_in_name",
"django.db.connection.introspection.table_names",
"pandas.read_csv",
"subprocess.Popen",
"sqlalchemy.create_engine",
"django.db.connection.cursor",
"itertools.izip",
"django.db.connection.intr... | [((777, 804), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (794, 804), False, 'import logging\n'), ((2261, 2321), 'sqlalchemy.create_engine', 'create_engine', (['database_url'], {'echo': '(False)', 'paramstyle': '"""format"""'}), "(database_url, echo=False, paramstyle='format')\n", (227... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import ast
import rhinoscriptsyntax as rs
__all__ = [
'mesh_select_vertex',
'mesh_select_vertices',
'mesh_select_face',
'mesh_select_faces',
'mesh_select_edge',
'mesh_select_edges',
... | [
"rhinoscriptsyntax.GetObject",
"ast.literal_eval",
"rhinoscriptsyntax.GetObjects",
"rhinoscriptsyntax.ObjectName"
] | [((695, 781), 'rhinoscriptsyntax.GetObject', 'rs.GetObject', (['message'], {'preselect': '(True)', 'filter': '(rs.filter.point | rs.filter.textdot)'}), '(message, preselect=True, filter=rs.filter.point | rs.filter.\n textdot)\n', (707, 781), True, 'import rhinoscriptsyntax as rs\n'), ((1327, 1414), 'rhinoscriptsynta... |
from telegram import Update
from telegram.ext import Updater, CallbackContext, ConversationHandler, CommandHandler, MessageHandler, Filters
from db import DBConnector
import re
str_matcher = r"\"(?P<name>.+)\"\s*(?P<fat>\d+)\s*/\s*(?P<protein>\d+)\s*/\s*(?P<carbohydrates>\d+)\s*(?P<kcal>\d+)"
ADD_1 = 0
def add_0(... | [
"telegram.ext.MessageHandler",
"re.match",
"telegram.ext.CommandHandler"
] | [((636, 678), 're.match', 're.match', (['str_matcher', 'update.message.text'], {}), '(str_matcher, update.message.text)\n', (644, 678), False, 'import re\n'), ((1087, 1123), 'telegram.ext.CommandHandler', 'CommandHandler', (['"""product_add"""', 'add_0'], {}), "('product_add', add_0)\n", (1101, 1123), False, 'from tele... |
import os
from flask import Blueprint, render_template
def create_bp():
bp_red = Blueprint('red', __name__, url_prefix='/red')
@bp_red.route('/index/')
@bp_red.route('/')
def index():
return render_template('red/index.html')
return bp_red | [
"flask.render_template",
"flask.Blueprint"
] | [((86, 131), 'flask.Blueprint', 'Blueprint', (['"""red"""', '__name__'], {'url_prefix': '"""/red"""'}), "('red', __name__, url_prefix='/red')\n", (95, 131), False, 'from flask import Blueprint, render_template\n'), ((217, 250), 'flask.render_template', 'render_template', (['"""red/index.html"""'], {}), "('red/index.htm... |
# SQL output is imported as a pandas dataframe variable called "df"
# Source: https://stackoverflow.com/questions/19441730/trimmed-mean-with-percentage-limit-in-python
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import tmean, scoreatpercentile
import numpy as np
def trimmean(arr, percent):
... | [
"scipy.stats.tmean",
"scipy.stats.scoreatpercentile"
] | [((337, 368), 'scipy.stats.scoreatpercentile', 'scoreatpercentile', (['arr', 'percent'], {}), '(arr, percent)\n', (354, 368), False, 'from scipy.stats import tmean, scoreatpercentile\n'), ((387, 424), 'scipy.stats.scoreatpercentile', 'scoreatpercentile', (['arr', '(100 - percent)'], {}), '(arr, 100 - percent)\n', (404,... |
import os
import cv2
import random
import numpy as np
from tensorflow.keras.utils import to_categorical
from scripts.consts import class_dict
def get_data(path, split=0.2):
X, y = [], []
for directory in os.listdir(path):
dirpath = os.path.join(path, directory)
print(directory, len(os.listd... | [
"tensorflow.keras.utils.to_categorical",
"os.listdir",
"random.shuffle",
"os.path.join",
"numpy.array",
"cv2.resize",
"cv2.imread"
] | [((216, 232), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (226, 232), False, 'import os\n'), ((716, 736), 'random.shuffle', 'random.shuffle', (['data'], {}), '(data)\n', (730, 736), False, 'import random\n'), ((253, 282), 'os.path.join', 'os.path.join', (['path', 'directory'], {}), '(path, directory)\n', (2... |
import setuptools
long_description = """
# Coldtype
### Programmatic display typography
More info available at: [coldtype.goodhertz.com](https://coldtype.goodhertz.com)
"""
setuptools.setup(
name="coldtype",
version="0.6.6",
author="<NAME> / Goodhertz",
author_email="<EMAIL>",
description="Funct... | [
"setuptools.setup"
] | [((177, 2154), 'setuptools.setup', 'setuptools.setup', ([], {'name': '"""coldtype"""', 'version': '"""0.6.6"""', 'author': '"""<NAME> / Goodhertz"""', 'author_email': '"""<EMAIL>"""', 'description': '"""Functions for manual vectorized typesetting"""', 'long_description': 'long_description', 'long_description_content_ty... |
# -*- coding: utf-8 -*-
# GFOLD_static_p3p4
min_=min
from cvxpy import *
import cvxpy_codegen as cpg
from time import time
import numpy as np
import sys
import GFOLD_params
''' As defined in the paper...
PROBLEM 3: Minimum Landing Error (tf roughly solved)
MINIMIZE : norm of landing error vector
SUBJ TO :
... | [
"numpy.array",
"GFOLD_params.SuperParams",
"cvxpy_codegen.codegen"
] | [((1050, 1076), 'GFOLD_params.SuperParams', 'GFOLD_params.SuperParams', ([], {}), '()\n', (1074, 1076), False, 'import GFOLD_params\n'), ((4489, 4523), 'cvxpy_codegen.codegen', 'cpg.codegen', (['problem', 'codegen_path'], {}), '(problem, codegen_path)\n', (4500, 4523), True, 'import cvxpy_codegen as cpg\n'), ((2230, 23... |
import io
import hashlib
import logging
import os
import struct
import random
from HintList import getHint, getHintGroup, Hint
from Utils import local_path
#builds out general hints based on location and whether an item is required or not
def buildGossipHints(world, rom):
stoneAddresses = [0x938e4c, 0... | [
"HintList.getHint",
"random.shuffle",
"HintList.getHintGroup"
] | [((780, 810), 'HintList.getHintGroup', 'getHintGroup', (['"""alwaysLocation"""'], {}), "('alwaysLocation')\n", (792, 810), False, 'from HintList import getHint, getHintGroup, Hint\n'), ((984, 1008), 'HintList.getHintGroup', 'getHintGroup', (['"""location"""'], {}), "('location')\n", (996, 1008), False, 'from HintList i... |
# BSD 3-Clause License; see https://github.com/jpivarski/awkward-1.0/blob/master/LICENSE
from __future__ import absolute_import
import sys
import pytest
import numpy
import awkward1
class Dummy(awkward1.Record):
@property
def broken(self):
raise AttributeError("I'm broken!")
def test():
behavi... | [
"pytest.raises",
"awkward1.Array"
] | [((371, 436), 'awkward1.Array', 'awkward1.Array', (["[{'x': 1}, {'x': 2}, {'x': 3}]"], {'behavior': 'behavior'}), "([{'x': 1}, {'x': 2}, {'x': 3}], behavior=behavior)\n", (385, 436), False, 'import awkward1\n'), ((500, 529), 'pytest.raises', 'pytest.raises', (['AttributeError'], {}), '(AttributeError)\n', (513, 529), F... |
from django.apps import AppConfig
from ievv_opensource import ievv_batchframework
from ievv_opensource.ievv_batchframework import batchregistry
class HelloWorldAction(ievv_batchframework.Action):
def execute(self):
self.logger.info('Hello world! %r', self.kwargs)
class HelloWorldAsyncAction(ievv_batchf... | [
"ievv_opensource.ievv_batchframework.batchregistry.ActionGroup",
"ievv_opensource.ievv_batchframework.batchregistry.Registry.get_instance"
] | [((695, 840), 'ievv_opensource.ievv_batchframework.batchregistry.ActionGroup', 'batchregistry.ActionGroup', ([], {'name': '"""batchframeworkdemo_helloworld"""', 'mode': 'batchregistry.ActionGroup.MODE_SYNCHRONOUS', 'actions': '[HelloWorldAction]'}), "(name='batchframeworkdemo_helloworld', mode=\n batchregistry.Actio... |
# Author: <NAME>
# <EMAIL>
#
# Command line to run program:
# python3 pyfrechet_visualize.py
import sys, os, unittest
sys.path.insert(0, "../")
from pyfrechet.distance import StrongDistance
from pyfrechet.visualize import FreeSpaceDiagram, Trajectories
TEST_DATA = "sp500"
if TEST_DATA == "sp500":
REACHABLE_EPSIL... | [
"sys.path.insert",
"pyfrechet.visualize.Trajectories",
"pyfrechet.visualize.FreeSpaceDiagram",
"unittest.main",
"pyfrechet.distance.StrongDistance.setCurves"
] | [((119, 144), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../"""'], {}), "(0, '../')\n", (134, 144), False, 'import sys, os, unittest\n'), ((2058, 2073), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2071, 2073), False, 'import sys, os, unittest\n'), ((1001, 1058), 'pyfrechet.distance.StrongDistance.setCu... |
#!/usr/bin/env python3
# vim:fileencoding=UTF-8
# -*- coding: UTF-8 -*-
"""
Created on 15 juny 2019 y.
@author: <NAME> <EMAIL>
"""
import sys
import struct
import numpy as np
from progress.bar import Bar
import logging
logging.basicConfig(format = u'%(filename)s:%(lineno)d: %(levelname)-8s [%(asctime)s] %(message)s... | [
"logging.basicConfig",
"numpy.zeros",
"struct.unpack",
"progress.bar.Bar",
"logging.info"
] | [((223, 369), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': 'u"""%(filename)s:%(lineno)d: %(levelname)-8s [%(asctime)s] %(message)s"""', 'level': 'logging.DEBUG', 'stream': 'sys.stdout'}), "(format=\n u'%(filename)s:%(lineno)d: %(levelname)-8s [%(asctime)s] %(message)s',\n level=logging.DEBUG, str... |
#!/usr/bin/env python
# encoding: utf-8
"""
process.py
Copyright (c) 2011 <NAME>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to us... | [
"utils.asciidammit"
] | [((2115, 2135), 'utils.asciidammit', 'utils.asciidammit', (['x'], {}), '(x)\n', (2132, 2135), False, 'import utils\n')] |
"""Monthly HDD/CDD Totals."""
import datetime
from pandas.io.sql import read_sql
from pyiem.plot.use_agg import plt
from pyiem.util import get_dbconn, get_autoplot_context
from pyiem.exceptions import NoDataFound
PDICT = {'cdd': 'Cooling Degree Days',
'hdd': 'Heating Degree Days'}
def get_description():
... | [
"pandas.io.sql.read_sql",
"seaborn.heatmap",
"pyiem.util.get_dbconn",
"datetime.date",
"datetime.date.today",
"pyiem.exceptions.NoDataFound",
"pyiem.plot.use_agg.plt.subplots"
] | [((1275, 1293), 'pyiem.util.get_dbconn', 'get_dbconn', (['"""coop"""'], {}), "('coop')\n", (1285, 1293), False, 'from pyiem.util import get_dbconn, get_autoplot_context\n'), ((1403, 1960), 'pandas.io.sql.read_sql', 'read_sql', (['(\n """\n SELECT year, month, sum(precip) as sum_precip,\n avg(high) as a... |
import os
import pickle
import time
import timeit
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import torch
import tempfile
import horovod.torch as hvd
from horovod.ray import RayExecutor
from ray_shuffling_data_loader.torch_dataset import (TorchShufflingDatase... | [
"horovod.torch.broadcast_optimizer_state",
"horovod.torch.local_rank",
"ray_shuffling_data_loader.data_generation.DATA_SPEC.values",
"time.sleep",
"horovod.torch.local_size",
"torch.cuda.is_available",
"horovod.torch.size",
"ray.init",
"numpy.mean",
"os.path.exists",
"horovod.torch.rank",
"arg... | [((922, 982), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch MNIST Example"""'}), "(description='PyTorch MNIST Example')\n", (945, 982), False, 'import argparse\n'), ((4215, 4225), 'horovod.torch.init', 'hvd.init', ([], {}), '()\n', (4223, 4225), True, 'import horovod.torch as hv... |
import pytest
import numpy as np
import eqtk
def test_promiscuous_binding_failure():
A = np.array(
[
[
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
1.0,
0.0,
... | [
"eqtk.solve",
"eqtk.eqcheck",
"numpy.exp",
"numpy.array",
"numpy.dot",
"pytest.raises"
] | [((96, 687), 'numpy.array', 'np.array', (['[[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0,\n 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0,\n 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0,\n 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilitie... | [
"pulumi.getter",
"warnings.warn",
"pulumi.ResourceOptions",
"pulumi.get"
] | [((10406, 10450), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""allocatedOutboundPorts"""'}), "(name='allocatedOutboundPorts')\n", (10419, 10450), False, 'import pulumi\n'), ((10684, 10726), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""backendAddressPoolId"""'}), "(name='backendAddressPoolId')\n", (10697, ... |
import numpy as np
import torch
import torch.nn as nn
from mmcv.runner import obj_from_dict
from mmcv.utils.config import Config
from mmedit.models import build_model
from mmedit.models.losses import L1Loss
from mmedit.models.registry import COMPONENTS
@COMPONENTS.register_module()
class BP(nn.Module):
"""A simp... | [
"mmedit.models.registry.COMPONENTS.register_module",
"mmedit.models.build_model",
"torch.is_tensor",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.rand"
] | [((257, 285), 'mmedit.models.registry.COMPONENTS.register_module', 'COMPONENTS.register_module', ([], {}), '()\n', (283, 285), False, 'from mmedit.models.registry import COMPONENTS\n'), ((1389, 1451), 'mmedit.models.build_model', 'build_model', (['model_cfg'], {'train_cfg': 'train_cfg', 'test_cfg': 'test_cfg'}), '(mode... |
# -*- coding: utf-8 -*-
"""Implementation of MiniGoogLeNet architecture.
This implementation is based on the original implemetation of GoogLeNet.
The authors of the net used BN before Activation layer.
This should be switched.
"""
from keras.layers.normalization import BatchNormalization
from keras.layers.convolutiona... | [
"keras.backend.image_data_format",
"keras.layers.core.Activation",
"keras.layers.Flatten",
"keras.layers.normalization.BatchNormalization",
"keras.layers.convolutional.AveragePooling2D",
"keras.layers.convolutional.Conv2D",
"keras.layers.Input",
"keras.layers.concatenate",
"keras.models.Model",
"k... | [((2664, 2714), 'keras.layers.concatenate', 'concatenate', (['[conv_1x1, conv_3x3]'], {'axis': 'chanel_dim'}), '([conv_1x1, conv_3x3], axis=chanel_dim)\n', (2675, 2714), False, 'from keras.layers import concatenate\n'), ((3439, 3485), 'keras.layers.concatenate', 'concatenate', (['[conv_3x3, pool]'], {'axis': 'chanel_di... |
import os
SERVER_NAME = os.getenv('DOMAIN_SUPERSET')
PUBLIC_ROLE_LIKE_GAMMA = True
SESSION_COOKIE_SAMESITE = None # One of [None, 'Lax', 'Strict']
SESSION_COOKIE_HTTPONLY = False
MAPBOX_API_KEY = os.getenv('MAPBOX_API_KEY', '')
POSTGRES_DB=os.getenv('POSTGRES_DB')
POSTGRES_PASSWORD=os.getenv('POSTGRES_PASSWORD')
POSTG... | [
"os.getenv"
] | [((25, 53), 'os.getenv', 'os.getenv', (['"""DOMAIN_SUPERSET"""'], {}), "('DOMAIN_SUPERSET')\n", (34, 53), False, 'import os\n'), ((197, 228), 'os.getenv', 'os.getenv', (['"""MAPBOX_API_KEY"""', '""""""'], {}), "('MAPBOX_API_KEY', '')\n", (206, 228), False, 'import os\n'), ((241, 265), 'os.getenv', 'os.getenv', (['"""PO... |
import database as d
import numpy as np
import random
from transitions import Machine
#Conversations are markov chains. Works as follows: a column vector for each CURRENT state j, a row vector for each TARGET state i.
#Each entry i,j = the probability of moving to state i from state j.
#target state D = end of convers... | [
"random.random",
"numpy.dot",
"transitions.Machine"
] | [((2827, 2933), 'transitions.Machine', 'Machine', ([], {'model': 'self', 'states': 'Conversation.states', 'transitions': 'Conversation.transitions', 'initial': '"""exit"""'}), "(model=self, states=Conversation.states, transitions=Conversation.\n transitions, initial='exit')\n", (2834, 2933), False, 'from transitions... |
from __init__ import ExtractUnlabeledData, SampleUnlabeledData, ExtractLabeledData
E = ExtractLabeledData(data_dir='../labeldata/')
E.get_pathways()
E.get_pathway_names()
E.get_classes_dict()
E.create_df_all_labels()
| [
"__init__.ExtractLabeledData"
] | [((88, 132), '__init__.ExtractLabeledData', 'ExtractLabeledData', ([], {'data_dir': '"""../labeldata/"""'}), "(data_dir='../labeldata/')\n", (106, 132), False, 'from __init__ import ExtractUnlabeledData, SampleUnlabeledData, ExtractLabeledData\n')] |
from django.shortcuts import render, redirect
from .forms import AuthorForm, BlogForm, NewUserForm
from .models import Author, Blog
from django.contrib.auth import login, authenticate, logout
from django.contrib import messages
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.decorator... | [
"django.shortcuts.render",
"django.contrib.auth.authenticate",
"django.contrib.messages.error",
"django.contrib.auth.login",
"django.contrib.messages.info",
"django.contrib.auth.forms.AuthenticationForm",
"django.shortcuts.redirect",
"django.contrib.messages.success",
"django.contrib.auth.logout"
] | [((457, 506), 'django.shortcuts.render', 'render', (['request', '"""blog/get_authors.html"""', 'context'], {}), "(request, 'blog/get_authors.html', context)\n", (463, 506), False, 'from django.shortcuts import render, redirect\n'), ((700, 748), 'django.shortcuts.render', 'render', (['request', '"""blog/get_author.html"... |
import tensorflow as tf
import os
import pickle
import numpy as np
from constant_params import input_feature_dim, window_size
def build_dataset(input_tfrecord_files, batch_size):
drop_remainder = False
feature_description = {
'label': tf.io.FixedLenFeature([], tf.int64),
'ref_aa': tf.io.Fixe... | [
"tensorflow.data.TFRecordDataset",
"os.path.exists",
"numpy.ones",
"tensorflow.io.parse_single_example",
"tensorflow.data.Options",
"pickle.load",
"numpy.int32",
"numpy.zeros",
"tensorflow.io.FixedLenFeature",
"tensorflow.io.decode_raw",
"tensorflow.reshape",
"tensorflow.cast",
"numpy.float3... | [((1795, 1840), 'tensorflow.data.TFRecordDataset', 'tf.data.TFRecordDataset', (['input_tfrecord_files'], {}), '(input_tfrecord_files)\n', (1818, 1840), True, 'import tensorflow as tf\n'), ((1856, 1873), 'tensorflow.data.Options', 'tf.data.Options', ([], {}), '()\n', (1871, 1873), True, 'import tensorflow as tf\n'), ((3... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake, tools
import shutil
class ClapackConan(ConanFile):
name = "clapack"
version = "3.2.1"
license = "BSD 3-Clause"
# BSD-3-Clause-Clear
url = "https://github.com/sintef-ocean/conan-clapack"
author = "<NAME>"
ho... | [
"conans.tools.get",
"conans.tools.patch",
"conans.CMake",
"shutil.move"
] | [((1052, 1116), 'conans.tools.get', 'tools.get', (['link'], {'sha1': '"""5ea1bcc4314e392bca8b9e5f61d44355cf9f4cc1"""'}), "(link, sha1='5ea1bcc4314e392bca8b9e5f61d44355cf9f4cc1')\n", (1061, 1116), False, 'from conans import ConanFile, CMake, tools\n'), ((1126, 1216), 'conans.tools.patch', 'tools.patch', ([], {'patch_fil... |
"""
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 agreed to in writing, software
distribute... | [
"yacos.essential.Sequence.name_pass_to_string",
"pygmo.sga",
"pygmo.problem",
"os.path.join",
"yacos.essential.Sequence.index_pass_to_list",
"yacos.essential.Sequence.sanitize",
"pygmo.population",
"pygmo.algorithm",
"pygmo.pso",
"yacos.essential.IO.load_passes"
] | [((6387, 6418), 'yacos.essential.IO.load_passes', 'IO.load_passes', (['passes_filename'], {}), '(passes_filename)\n', (6401, 6418), False, 'from yacos.essential import IO\n'), ((7595, 7618), 'pygmo.algorithm', 'pg.algorithm', (['algorithm'], {}), '(algorithm)\n', (7607, 7618), True, 'import pygmo as pg\n'), ((7791, 788... |
import tkinter as tk
from scipy.stats import chi2, chisquare
COLOR = '#dddddd'
COLUMNS_COLOR = '#ffffff'
MAX_SIZE = 10
WIDGET_WIDTH = 25
class LinearCongruent:
m = 2**32
a = 1664525
c = 1013904223
_cur = 1
def next(self):
self._cur = (self.a * self._cur + self.c) % self.m
return s... | [
"scipy.stats.chi2.cdf",
"tkinter.LabelFrame",
"tkinter.Entry",
"tkinter.Button",
"tkinter.Tk",
"tkinter.Label",
"tkinter.Listbox"
] | [((8804, 8811), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (8809, 8811), True, 'import tkinter as tk\n'), ((1698, 1772), 'tkinter.LabelFrame', 'tk.LabelFrame', (['master'], {'bg': 'COLOR', 'text': '"""Ввод данных"""', 'width': '(480)', 'height': '(110)'}), "(master, bg=COLOR, text='Ввод данных', width=480, height=110)\n"... |
"""Tests joulia.unit_conversions.
"""
from django.test import TestCase
from joulia import unit_conversions
class GramsToPoundsTest(TestCase):
def test_grams_to_pounds(self):
self.assertEquals(unit_conversions.grams_to_pounds(1000.0), 2.20462)
class GramsToOuncesTest(TestCase):
def test_grams_to_ou... | [
"joulia.unit_conversions.grams_to_ounces",
"joulia.unit_conversions.grams_to_pounds"
] | [((208, 248), 'joulia.unit_conversions.grams_to_pounds', 'unit_conversions.grams_to_pounds', (['(1000.0)'], {}), '(1000.0)\n', (240, 248), False, 'from joulia import unit_conversions\n'), ((358, 398), 'joulia.unit_conversions.grams_to_ounces', 'unit_conversions.grams_to_ounces', (['(1000.0)'], {}), '(1000.0)\n', (390, ... |
from pathlib import Path
from hylfm.hylfm_types import (
CriterionChoice,
DatasetChoice,
LRSchedThresMode,
LRSchedulerChoice,
MetricChoice,
OptimizerChoice,
PeriodUnit,
)
from hylfm.model import HyLFM_Net
from hylfm.train import train
if __name__ == "__main__":
train(
dataset=... | [
"hylfm.train.train"
] | [((297, 1857), 'hylfm.train.train', 'train', ([], {'dataset': 'DatasetChoice.beads_highc_b', 'batch_multiplier': '(2)', 'batch_size': '(1)', 'crit_apply_weight_above_threshold': '(False)', 'crit_beta': '(1.0)', 'crit_decay_weight_by': '(0.8)', 'crit_decay_weight_every_unit': 'PeriodUnit.epoch', 'crit_decay_weight_every... |
import os
import pickle
from PIL import Image
class PatientToImageFolder:
def __init__(self, sourceFolder):
self.sourceFolder = sourceFolder
# How many patient with contrast SA for each pathology (used for classification)
self.contrastSApathologyDict = {}
# How many patient with c... | [
"PIL.Image.fromarray",
"os.listdir",
"os.makedirs",
"os.path.join",
"os.path.dirname"
] | [((1237, 1266), 'os.listdir', 'os.listdir', (['self.sourceFolder'], {}), '(self.sourceFolder)\n', (1247, 1266), False, 'import os\n'), ((3888, 3913), 'PIL.Image.fromarray', 'Image.fromarray', (['image_2d'], {}), '(image_2d)\n', (3903, 3913), False, 'from PIL import Image\n'), ((4176, 4212), 'os.path.join', 'os.path.joi... |
import pandas as pd
import numpy as np
import pickle
from sklearn.cross_validation import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
from math import sqrt
from sklearn.svm import SVR
from sklearn.svm import LinearSVR
from sklearn.preprocessing imp... | [
"pandas.read_pickle",
"pandas.read_csv",
"pickle.load",
"numpy.array",
"pandas.DataFrame"
] | [((697, 754), 'pandas.read_pickle', 'pd.read_pickle', (['"""../../dataset/score_df_final_tst.pickle"""'], {}), "('../../dataset/score_df_final_tst.pickle')\n", (711, 754), True, 'import pandas as pd\n'), ((848, 870), 'numpy.array', 'np.array', (['score_df_tst'], {}), '(score_df_tst)\n', (856, 870), True, 'import numpy ... |
import numpy as np
import serial
import time
import matplotlib.pyplot as plt
def getData():
ser = serial.Serial('/dev/ttyACM7', 9600)
sensorReadings = []
start = time.time()
current = time.time()
while current - start < 10:
data =ser.readline()
sensorReadings.append(floa... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.plot",
"serial.Serial",
"time.time",
"matplotlib.pyplot.show"
] | [((109, 144), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyACM7"""', '(9600)'], {}), "('/dev/ttyACM7', 9600)\n", (122, 144), False, 'import serial\n'), ((183, 194), 'time.time', 'time.time', ([], {}), '()\n', (192, 194), False, 'import time\n'), ((210, 221), 'time.time', 'time.time', ([], {}), '()\n', (219, 221), Fa... |
from CMText.TextClient import TextClient
# Message to be send
message = 'Examples message to be send'
# Media to be send
media = {
"mediaName": "conversational-commerce",
"mediaUri": "https://www.cm.com/cdn/cm/cm.png",
"mimeType": "image/png"
}
# AllowedChannels in this ca... | [
"CMText.TextClient.TextClient"
] | [((468, 501), 'CMText.TextClient.TextClient', 'TextClient', ([], {'apikey': 'UNIQUE_API_KEY'}), '(apikey=UNIQUE_API_KEY)\n', (478, 501), False, 'from CMText.TextClient import TextClient\n')] |
# Copyright 2021 <NAME> <<EMAIL>>.
# SPDX-License-Identifier: MIT
# Telegram API framework core imports
from collections import namedtuple
from functools import partial
from ganjoor.ganjoor import Ganjoor
from telegram.ext import Dispatcher, CallbackContext
from telegram import Update
# Helper methods import
from util... | [
"collections.namedtuple",
"functools.partial",
"utils.logger.get_logger",
"utils.telegram.keyboards.category_keyboard"
] | [((514, 534), 'utils.logger.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (524, 534), False, 'from utils.logger import get_logger\n'), ((550, 594), 'collections.namedtuple', 'namedtuple', (['"""CallbackData"""', '"""menu_name doto"""'], {}), "('CallbackData', 'menu_name doto')\n", (560, 594), False, 'f... |
import uos as os
import time
def countdown():
for i in range(5, 0, -1):
print("start stubbing in {}...".format(i))
time.sleep(1)
import createstubs
# import stub_lvgl
try:
# only run import if no stubs yet
os.listdir("stubs")
print("stub folder was found, stubbing is not aut... | [
"uos.listdir",
"time.sleep"
] | [((247, 266), 'uos.listdir', 'os.listdir', (['"""stubs"""'], {}), "('stubs')\n", (257, 266), True, 'import uos as os\n'), ((137, 150), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (147, 150), False, 'import time\n')] |
# Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | [
"blinkpy.common.host_mock.MockHost",
"blinkpy.web_tests.breakpad.dump_reader_multipart.DumpReaderMultipart",
"blinkpy.common.host.Host"
] | [((2307, 2313), 'blinkpy.common.host.Host', 'Host', ([], {}), '()\n', (2311, 2313), False, 'from blinkpy.common.host import Host\n'), ((2336, 2377), 'blinkpy.web_tests.breakpad.dump_reader_multipart.DumpReaderMultipart', 'DumpReaderMultipart', (['host'], {'build_dir': 'None'}), '(host, build_dir=None)\n', (2355, 2377),... |
#!/usr/bin/env python
""" ngc - n-grams count
License: 3-clause BSD (see https://opensource.org/licenses/BSD-3-Clause)
Author: <NAME>
"""
import getopt
import logging
import os
import re
import string
import sys
import unicode2ascii
# Version string used by the what(1) and ident(1) commands:
ID = "@(#) $Id: ngc - n-... | [
"logging.basicConfig",
"os.environ.keys",
"getopt.getopt",
"logging.debug",
"unicode2ascii.unicode_to_ascii_string",
"os.path.isfile",
"unicode2ascii.is_unicode_mark",
"unicode2ascii.is_unicode_punctuation",
"unicode2ascii.is_unicode_symbol",
"os.path.basename",
"logging.critical",
"sys.exit",... | [((2086, 2153), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': 'console_log_format', 'level': 'logging.DEBUG'}), '(format=console_log_format, level=logging.DEBUG)\n', (2105, 2153), False, 'import logging\n'), ((2158, 2187), 'logging.disable', 'logging.disable', (['logging.INFO'], {}), '(logging.INFO)\n',... |
"""
"""
from rest_framework import routers
from safemasks.resources.rest.serializers import SupplierViewSet, TrustedSupplierViewSet
# Routers provide an easy way of automatically determining the URL conf.
ROUTER = routers.DefaultRouter()
ROUTER.register(r"suppliers", SupplierViewSet, "suppliers")
ROUTER.register(r"s... | [
"rest_framework.routers.DefaultRouter"
] | [((217, 240), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (238, 240), False, 'from rest_framework import routers\n')] |
from django.core.management import BaseCommand
import logging
# These two lines enable debugging at httplib level (requests->urllib3->http.client)
# You will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but without DATA.
# The only thing missing will be the response.body which is not logged.
... | [
"logging.basicConfig",
"exporter.tasks.GenerateModelExportTask",
"logging.getLogger"
] | [((545, 566), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (564, 566), False, 'import logging\n'), ((626, 672), 'logging.getLogger', 'logging.getLogger', (['"""requests.packages.urllib3"""'], {}), "('requests.packages.urllib3')\n", (643, 672), False, 'import logging\n'), ((567, 586), 'logging.getLogg... |
from functools import partial
import os
import pytest
import dask
import dask.array as da
from dask.utils_test import inc
from dask.highlevelgraph import HighLevelGraph, BasicLayer, Layer
from dask.blockwise import Blockwise
from dask.array.utils import assert_eq
def test_visualize(tmpdir):
pytest.importorskip(... | [
"os.path.exists",
"dask.annotate",
"dask.highlevelgraph.HighLevelGraph",
"dask.array.utils.assert_eq",
"pytest.mark.parametrize",
"pytest.importorskip",
"functools.partial",
"dask.highlevelgraph.BasicLayer",
"dask.array.ones",
"dask.config.get"
] | [((1597, 1650), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""inject_dict"""', '[True, False]'], {}), "('inject_dict', [True, False])\n", (1620, 1650), False, 'import pytest\n'), ((2361, 2421), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""use_layer_map_task"""', '[True, False]'], {}), "('us... |
# Requires pip install bitarray
from bitarray import bitarray
import argparse, math
def derive_transfer_function(pTransferFunctionString: str) -> list:
lTransferFunction = list(map(int, pTransferFunctionString.split(',')))
lTransferFunctionValid = True
lLengthTransferFunction = len(lTransferFunction)
... | [
"math.floor",
"argparse.ArgumentParser",
"math.log"
] | [((683, 719), 'math.log', 'math.log', (['lLengthTransferFunction', '(2)'], {}), '(lLengthTransferFunction, 2)\n', (691, 719), False, 'import argparse, math\n'), ((3259, 3397), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Transference: A tool to help visualize s-boxes (substitution boxe... |
import pytest
from aiospamc.client import Client
from aiospamc.exceptions import (
BadResponse,
UsageException,
DataErrorException,
NoInputException,
NoUserException,
NoHostException,
UnavailableException,
InternalSoftwareException,
OSErrorException,
OSFileException,
CantCre... | [
"aiospamc.responses.Response",
"pytest.raises"
] | [((1673, 1705), 'aiospamc.responses.Response', 'Response', ([], {}), '(**parse_spy.spy_return)\n', (1681, 1705), False, 'from aiospamc.responses import Response\n'), ((1885, 1914), 'pytest.raises', 'pytest.raises', (['UsageException'], {}), '(UsageException)\n', (1898, 1914), False, 'import pytest\n'), ((2148, 2181), '... |
'''
Models for QtWidgets
'''
from collections import deque
from math import ceil
import datetime as dt
import calendar
class EventInCalendar__Model:
class Text:
@staticmethod
def getDefault():
return EventInCalendar__Model.Text()
def __init__(self, event=None, overflow=Fal... | [
"datetime.datetime",
"math.ceil",
"collections.deque",
"datetime.time",
"datetime.date.today",
"datetime.date",
"calendar.weekday",
"datetime.timedelta"
] | [((4929, 4940), 'collections.deque', 'deque', (['days'], {}), '(days)\n', (4934, 4940), False, 'from collections import deque\n'), ((6677, 6719), 'datetime.date', 'dt.date', (['self._month[0]', 'self._month[1]', '(1)'], {}), '(self._month[0], self._month[1], 1)\n', (6684, 6719), True, 'import datetime as dt\n'), ((6889... |
#
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"tensorflow.data.Dataset.from_tensor_slices",
"bigdl.dllib.utils.nest.flatten",
"tensorflow.tables_initializer",
"tensorflow.python.distribute.coordinator.values.serialize_dataset_to_graph",
"bigdl.dllib.utils.nest.pack_sequence_as",
"bigdl.friesian.feature.utils.featuretable_to_xshards"
] | [((4548, 4576), 'bigdl.friesian.feature.utils.featuretable_to_xshards', 'featuretable_to_xshards', (['tbl'], {}), '(tbl)\n', (4571, 4576), False, 'from bigdl.friesian.feature.utils import featuretable_to_xshards\n'), ((2163, 2198), 'bigdl.dllib.utils.nest.flatten', 'nest.flatten', (['dataset.output_shapes'], {}), '(dat... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File : Ampel-core/ampel/cli/AbsStockCommand.py
# License : BSD-3-Clause
# Author : vb <<EMAIL>>
# Date : 25.03.2021
# Last Modified Date: 25.03.2021
# Last Modified By : vb <<EMAIL>>
from typing import Dict, Any, Optional, ... | [
"ampel.model.time.UnixTimeModel.UnixTimeModel",
"ampel.model.time.TimeStringModel.TimeStringModel",
"ampel.model.time.TimeLastRunModel.TimeLastRunModel",
"ampel.mongo.utils.maybe_match_array",
"ampel.model.time.TimeConstraintModel.TimeConstraintModel",
"ampel.model.UnitModel.UnitModel",
"ampel.model.tim... | [((4814, 4860), 'ampel.model.UnitModel.UnitModel', 'UnitModel', ([], {'unit': '"""T3StockSelector"""', 'config': 'conf'}), "(unit='T3StockSelector', config=conf)\n", (4823, 4860), False, 'from ampel.model.UnitModel import UnitModel\n'), ((5562, 5586), 'ampel.model.time.TimeConstraintModel.TimeConstraintModel', 'TimeCon... |
# -*- coding: utf-8 -*-
from pytest import raises
from astral import Astral, AstralError, Location
import datetime
import pytz
def datetime_almost_equal(datetime1, datetime2, seconds=60):
dd = datetime1 - datetime2
sd = (dd.days * 24 * 60 * 60) + dd.seconds
return abs(sd) <= seconds
def test_Location_N... | [
"datetime.datetime",
"pytz.timezone",
"astral.Location",
"astral.Astral",
"pytest.raises",
"datetime.date"
] | [((335, 345), 'astral.Location', 'Location', ([], {}), '()\n', (343, 345), False, 'from astral import Astral, AstralError, Location\n'), ((518, 528), 'astral.Location', 'Location', ([], {}), '()\n', (526, 528), False, 'from astral import Astral, AstralError, Location\n'), ((666, 674), 'astral.Astral', 'Astral', ([], {}... |
import gym
from gym import spaces, error, utils
from gym.utils import seeding
import numpy as np
import configparser
from os import path
import matplotlib.pyplot as plt
from matplotlib.pyplot import gca
font = {'family': 'sans-serif',
'weight': 'bold',
'size': 14}
class MappingEnv(gym.Env):
def ... | [
"numpy.clip",
"numpy.hstack",
"numpy.logical_not",
"numpy.argsort",
"numpy.linalg.norm",
"gym.utils.seeding.np_random",
"numpy.mean",
"numpy.multiply",
"numpy.stack",
"numpy.linspace",
"numpy.meshgrid",
"matplotlib.pyplot.ylim",
"numpy.ones",
"matplotlib.pyplot.gca",
"numpy.fill_diagonal... | [((2106, 2165), 'numpy.linspace', 'np.linspace', (['(-1.0 * self.px_max)', 'self.px_max', 'self.n_agents'], {}), '(-1.0 * self.px_max, self.px_max, self.n_agents)\n', (2117, 2165), True, 'import numpy as np\n'), ((2178, 2237), 'numpy.linspace', 'np.linspace', (['(-1.0 * self.py_max)', 'self.py_max', 'self.n_agents'], {... |
# 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... | [
"tensorflow.python.ops.map_fn.map_fn",
"numpy.random.rand",
"tensorflow.python.ops.variables.global_variables_initializer",
"numpy.array",
"tensorflow.python.ops.array_ops.matrix_set_diag",
"tensorflow.python.ops.math_ops.range",
"tensorflow.python.ops.array_ops.reshape",
"tensorflow.python.ops.array_... | [((8201, 8237), 'tensorflow.python.framework.test_util.run_v1_only', 'test_util.run_v1_only', (['"""b/120545219"""'], {}), "('b/120545219')\n", (8222, 8237), False, 'from tensorflow.python.framework import test_util\n'), ((10466, 10477), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (10475, 104... |
import multiprocessing as mp
import subprocess
import shutil
import os
from ..helper import make_path_safe, thirdparty_binary, filter_scp
from ..exceptions import CorpusError
def mfcc_func(directory, job_name, mfcc_config_path): # pragma: no cover
log_directory = os.path.join(directory, 'log')
raw_mfcc_path... | [
"os.path.exists",
"os.path.join",
"multiprocessing.Pool",
"os.environ.copy"
] | [((272, 302), 'os.path.join', 'os.path.join', (['directory', '"""log"""'], {}), "(directory, 'log')\n", (284, 302), False, 'import os\n'), ((3022, 3039), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (3037, 3039), False, 'import os\n'), ((5060, 5077), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (5... |
# -*- coding: utf-8 -*-
"""sb-fastapi CLI root."""
import logging
import click
from sb_backend.cli.commands.serve import serve
@click.group()
@click.option(
"-v",
"--verbose",
help="Enable verbose logging.",
is_flag=True,
default=False,
)
def cli(**options):
"""sb-fastapi CLI root."""
if ... | [
"click.group",
"click.option",
"logging.basicConfig"
] | [((131, 144), 'click.group', 'click.group', ([], {}), '()\n', (142, 144), False, 'import click\n'), ((146, 243), 'click.option', 'click.option', (['"""-v"""', '"""--verbose"""'], {'help': '"""Enable verbose logging."""', 'is_flag': '(True)', 'default': '(False)'}), "('-v', '--verbose', help='Enable verbose logging.', i... |
import dash
from dash import html
app = dash.Dash(__name__)
app.layout = html.Div(children=[html.H1('Data Science',
style = {'textAlign': 'center',
'color': '#0FD08D',
'font-size': '... | [
"dash.html.H2",
"dash.html.Li",
"dash.html.H1",
"dash.html.P",
"dash.html.A",
"dash.Dash"
] | [((41, 60), 'dash.Dash', 'dash.Dash', (['__name__'], {}), '(__name__)\n', (50, 60), False, 'import dash\n'), ((94, 193), 'dash.html.H1', 'html.H1', (['"""Data Science"""'], {'style': "{'textAlign': 'center', 'color': '#0FD08D', 'font-size': '50px'}"}), "('Data Science', style={'textAlign': 'center', 'color': '#0FD08D',... |
#Main Program
from Class import Barang
import Menu
histori = list()
listBarang = [
Barang('Rinso', 5000, 20),
Barang('Sabun', 3000, 20),
Barang('Pulpen', 2500, 20),
Barang('Tisu', 10000, 20),
Barang('Penggaris', 1000, 20)
]
while True:
print('''
Menu
1. Tampilkan Barang
2. Tambahkan Barang
3. Ta... | [
"Menu.menu7",
"Menu.menu2",
"Menu.menu4",
"Class.Barang",
"Menu.menu3",
"Menu.menu1",
"Menu.menu5",
"Menu.menu6"
] | [((90, 115), 'Class.Barang', 'Barang', (['"""Rinso"""', '(5000)', '(20)'], {}), "('Rinso', 5000, 20)\n", (96, 115), False, 'from Class import Barang\n'), ((118, 143), 'Class.Barang', 'Barang', (['"""Sabun"""', '(3000)', '(20)'], {}), "('Sabun', 3000, 20)\n", (124, 143), False, 'from Class import Barang\n'), ((146, 172)... |
#!/usr/bin/env python3
"""get tag from http://demo.illustration2vec.net/."""
# note:
# - error 'ERROR: Request Entity Too Large' for file 1.1 mb
# <span style="color:red;">ERROR: Request Entity Too Large</span>
from collections import OrderedDict
from pathlib import Path
from pprint import pformat
import imghdr
import ... | [
"click.Choice",
"i2vec_cli.requests_session.Session",
"i2vec_cli.models.init_all_tables",
"time.sleep",
"i2vec_cli.models.database.init",
"i2vec_cli.sha256.sha256_checksum",
"click.BadParameter",
"shutil.move",
"click.option",
"pathlib.Path",
"i2vec_cli.requests_session.convert_raw_to_hydrus",
... | [((5265, 5280), 'click.command', 'click.command', ([], {}), '()\n', (5278, 5280), False, 'import click\n'), ((5361, 5426), 'click.option', 'click.option', (['"""-d"""', '"""--debug"""'], {'is_flag': '(True)', 'help': '"""Enable debug."""'}), "('-d', '--debug', is_flag=True, help='Enable debug.')\n", (5373, 5426), False... |
"""Functions for builtin CherryPy tools."""
import logging
import re
from hashlib import md5
import six
from six.moves import urllib
import cherrypy
from cherrypy._cpcompat import text_or_bytes
from cherrypy.lib import httputil as _httputil
from cherrypy.lib import is_iterator
# Conditional HTT... | [
"cherrypy.InternalRedirect",
"cherrypy.log",
"hashlib.md5",
"six.moves.urllib.parse.urlparse",
"re.match",
"cherrypy.url",
"cherrypy.HTTPError.handle",
"cherrypy.lib.is_iterator",
"six.text_type",
"cherrypy.lib.httputil.valid_status",
"cherrypy.HTTPError",
"cherrypy.HTTPRedirect"
] | [((1355, 1394), 'cherrypy.lib.httputil.valid_status', '_httputil.valid_status', (['response.status'], {}), '(response.status)\n', (1377, 1394), True, 'from cherrypy.lib import httputil as _httputil\n'), ((10356, 10390), 'cherrypy.HTTPError', 'cherrypy.HTTPError', (['error', 'message'], {}), '(error, message)\n', (10374... |
'''Utility functions'''
import multiprocessing
from .globalVariables import *
def readMathIOmicaData(fileName):
'''Read text files exported by MathIOmica and convert to Python data
Parameters:
fileName: str
Path of directories and name of the file containing data
... | [
"multiprocessing.Pool"
] | [((1738, 1791), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {'processes': 'NumberOfAvailableCPUs'}), '(processes=NumberOfAvailableCPUs)\n', (1758, 1791), False, 'import multiprocessing\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest import skipIf
try:
from django.core.urlresolvers import reverse
except ModuleNotFoundError:
from django.urls import reverse
from django.db import transaction
from aldryn_reversion.core import create_revision as aldryn_create_revisio... | [
"aldryn_reversion.core.create_revision",
"django.db.transaction.atomic",
"reversion.revisions.default_revision_manager.get_for_object",
"unittest.skipIf",
"parler.utils.context.switch_language",
"aldryn_newsblog.cms_appconfig.NewsBlogConfig",
"six.iteritems",
"aldryn_newsblog.cms_appconfig.NewsBlogCon... | [((791, 851), 'unittest.skipIf', 'skipIf', (['(not ENABLE_REVERSION)', '"""django-reversion not enabled"""'], {}), "(not ENABLE_REVERSION, 'django-reversion not enabled')\n", (797, 851), False, 'from unittest import skipIf\n'), ((984, 1004), 'django.db.transaction.atomic', 'transaction.atomic', ([], {}), '()\n', (1002,... |
# Library for the dynamics of a lumen network
# The lumen are 2 dimensional and symmetric and connected with 1 dimensional tubes
#
# Created by <NAME>, 2018
# Modified by <NAME>--Serandour on 8/04/2019
"""
network.py conf.init
Defines the class network and associated functions
Imports
-------... | [
"numpy.abs",
"os.path.getsize",
"numpy.linalg.solve",
"numpy.sqrt",
"numpy.arccos",
"os.path.join",
"numpy.column_stack",
"numpy.sum",
"numpy.zeros",
"numpy.sin",
"numpy.loadtxt"
] | [((8944, 8983), 'numpy.zeros', 'np.zeros', (['self.num_bridges'], {'dtype': 'float'}), '(self.num_bridges, dtype=float)\n', (8952, 8983), True, 'import numpy as np\n'), ((9052, 9091), 'numpy.zeros', 'np.zeros', (['self.num_bridges'], {'dtype': 'float'}), '(self.num_bridges, dtype=float)\n', (9060, 9091), True, 'import ... |
# Illustrate upsampling in 2d
# Code from <NAME>
# https://machinelearningmastery.com/generative_adversarial_networks/
import tensorflow as tf
from tensorflow import keras
from numpy import asarray
#from keras.models import Sequential
from tensorflow.keras.models import Sequential
#from keras.layers import UpSampl... | [
"tensorflow.keras.layers.UpSampling2D",
"numpy.asarray",
"tensorflow.keras.models.Sequential"
] | [((380, 405), 'numpy.asarray', 'asarray', (['[[1, 2], [3, 4]]'], {}), '([[1, 2], [3, 4]])\n', (387, 405), False, 'from numpy import asarray\n'), ((415, 457), 'numpy.asarray', 'asarray', (['[[1, 2, 3], [4, 5, 6], [7, 8, 9]]'], {}), '([[1, 2, 3], [4, 5, 6], [7, 8, 9]])\n', (422, 457), False, 'from numpy import asarray\n'... |
from flask import Flask, Response
from flask_basicauth import BasicAuth
from flask_cors import CORS, cross_origin
import os
#from flask_admin import Admin,AdminIndexView
#from flask_admin.contrib.sqla import ModelView
from flask_sqlalchemy import SQLAlchemy as _BaseSQLAlchemy
from flask_migrate import Migrate, Migr... | [
"flask_cors.CORS",
"flask.Flask",
"itsdangerous.URLSafeSerializer",
"flask_script.Manager",
"flask_migrate.Migrate"
] | [((631, 646), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (636, 646), False, 'from flask import Flask, Response\n'), ((781, 790), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (785, 790), False, 'from flask_cors import CORS, cross_origin\n'), ((1685, 1723), 'flask_migrate.Migrate', 'Migrate', (['... |
# Python
import unittest
from copy import deepcopy
from unittest.mock import Mock
# ATS
from pyats.topology import Device
# Genie
from genie.libs.ops.dot1x.ios.dot1x import Dot1X
from genie.libs.ops.dot1x.ios.tests.dot1x_output import Dot1xOutput
# Parser
from genie.libs.parser.ios.show_dot1x import ShowDot1xAllDeta... | [
"unittest.main",
"genie.libs.ops.dot1x.ios.dot1x.Dot1X",
"pyats.topology.Device",
"copy.deepcopy"
] | [((3479, 3494), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3492, 3494), False, 'import unittest\n'), ((611, 633), 'pyats.topology.Device', 'Device', ([], {'name': '"""aDevice"""'}), "(name='aDevice')\n", (617, 633), False, 'from pyats.topology import Device\n'), ((1067, 1092), 'genie.libs.ops.dot1x.ios.dot1x.... |
# ======================================================================
# copyright 2020. Triad National Security, LLC. All rights
# reserved. This program was produced under U.S. Government contract
# 89233218CNA000001 for Los Alamos National Laboratory (LANL), which
# is operated by Triad National Security, LLC for ... | [
"numpy.array",
"numpy.zeros"
] | [((3787, 3803), 'numpy.zeros', 'np.zeros', (['[4, 4]'], {}), '([4, 4])\n', (3795, 3803), True, 'import numpy as np\n'), ((4682, 4796), 'numpy.array', 'np.array', (['[[g_tt, g_tr, 0.0, g_tf], [g_tr, g_rr, 0.0, g_rf], [0.0, 0.0, g_thth, 0.0],\n [g_tf, g_rf, 0.0, g_ff]]'], {}), '([[g_tt, g_tr, 0.0, g_tf], [g_tr, g_rr, ... |
import io
import os
import numpy as np
import pandas
import json
import logging #<== Optional. Log to console, file, kafka
from pipeline_monitor import prometheus_monitor as monitor #<== Optional. Monitor runtime metrics
from pipeline_logger import log
import tenso... | [
"logging.getLogger",
"json.loads",
"logging.StreamHandler",
"keras.preprocessing.text.Tokenizer",
"keras.models.load_model",
"json.dumps",
"io.StringIO",
"pipeline_monitor.prometheus_monitor",
"keras.preprocessing.sequence.pad_sequences"
] | [((556, 592), 'logging.getLogger', 'logging.getLogger', (['"""pipeline-logger"""'], {}), "('pipeline-logger')\n", (573, 592), False, 'import logging\n'), ((649, 672), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (670, 672), False, 'import logging\n'), ((1310, 1347), 'keras.models.load_model', 'lo... |
from datetime import timedelta
from typing import Union, List, Optional
import click
import pandas as pd
from flask import current_app as app
from flask.cli import with_appcontext
from flexmeasures import Sensor
from flexmeasures.data import db
from flexmeasures.data.schemas.generic_assets import GenericAssetIdField
... | [
"pandas.isnull",
"click.group",
"click.option",
"pandas.Timestamp",
"flexmeasures.data.schemas.generic_assets.GenericAssetIdField",
"flexmeasures.Sensor.query.get",
"flexmeasures.data.schemas.sensors.SensorIdField",
"flexmeasures.data.models.time_series.TimedBelief.query.filter",
"flexmeasures.data.... | [((556, 575), 'click.group', 'click.group', (['"""edit"""'], {}), "('edit')\n", (567, 575), False, 'import click\n'), ((1078, 1217), 'click.option', 'click.option', (['"""--attribute"""', '"""attribute_key"""'], {'required': '(True)', 'help': '"""Add/edit this attribute. Follow up with the name of the attribute."""'}),... |
#!/usr/bin/env python3.6
# -*- encoding=utf8 -*-
import pyquery
"""
需求字段:
標題、發表日期、分類、標籤、內容、圖片
需要的字段信息
1. 网站根URL
2. 解析器名字
3. 解析器类型
1. PARSER_PASSAGE_URL 文章URL
2. PARSER_PASSAGE_TITLE 文章标题
3. PARSER_PASSAGE_DATE ... | [
"pyquery.PyQuery"
] | [((1374, 1394), 'pyquery.PyQuery', 'pyquery.PyQuery', (['doc'], {}), '(doc)\n', (1389, 1394), False, 'import pyquery\n')] |
import os
import json
import gzip
from copy import deepcopy, copy
import numpy as np
import csv
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader, RandomSampler
from transformers.tokenization_utils import trim_batch
class LabelSmoothingLoss(nn.Module)... | [
"transformers.tokenization_utils.trim_batch",
"torch.full",
"gzip.open",
"torch.LongTensor",
"torch.nn.KLDivLoss",
"os.path.join",
"torch.tensor",
"torch.sum",
"torch.nn.functional.log_softmax",
"copy.copy"
] | [((607, 653), 'torch.full', 'torch.full', (['(tgt_vocab_size,)', 'smoothing_value'], {}), '((tgt_vocab_size,), smoothing_value)\n', (617, 653), False, 'import torch\n'), ((837, 873), 'torch.nn.KLDivLoss', 'torch.nn.KLDivLoss', ([], {'reduction': '"""none"""'}), "(reduction='none')\n", (855, 873), False, 'import torch\n... |
from bench import bench
print(bench(100, '''
def fib(n):
return n if n < 2 else fib(n-1) + fib(n-2)
''', '''
fib(20)
'''))
| [
"bench.bench"
] | [((31, 128), 'bench.bench', 'bench', (['(100)', '"""\ndef fib(n):\n return n if n < 2 else fib(n-1) + fib(n-2)\n"""', '"""\n fib(20)\n"""'], {}), '(100, """\ndef fib(n):\n return n if n < 2 else fib(n-1) + fib(n-2)\n""",\n \'\\n fib(20)\\n\')\n', (36, 128), False, 'from bench import bench\n')] |
# coding=utf-8
from nlpir.native.nlpir_base import NLPIRBase
from ctypes import c_bool, c_char_p, c_int, POINTER, Structure, c_float
class StDoc(Structure):
__fields__ = [
("sTitle", c_char_p),
("sContent", c_char_p),
("sAuthor", c_char_p),
("sBoard", c_char_p),
("sDatatype... | [
"ctypes.POINTER"
] | [((1655, 1669), 'ctypes.POINTER', 'POINTER', (['StDoc'], {}), '(StDoc)\n', (1662, 1669), False, 'from ctypes import c_bool, c_char_p, c_int, POINTER, Structure, c_float\n')] |
# -*- coding: utf-8 -*-
import pytest
from mock import Mock
from bravado_core.exception import SwaggerMappingError
from bravado_core.operation import Operation
from bravado_core.param import get_param_type_spec
from bravado_core.param import Param
from bravado_core.spec import Spec
@pytest.fixture
def body_param_spe... | [
"bravado_core.spec.Spec",
"bravado_core.param.get_param_type_spec",
"pytest.raises",
"mock.Mock"
] | [((1718, 1744), 'bravado_core.spec.Spec', 'Spec', (['minimal_swagger_dict'], {}), '(minimal_swagger_dict)\n', (1722, 1744), False, 'from bravado_core.spec import Spec\n'), ((614, 634), 'mock.Mock', 'Mock', ([], {'spec': 'Operation'}), '(spec=Operation)\n', (618, 634), False, 'from mock import Mock\n'), ((693, 719), 'br... |
# Copyright (c) 2019 Princeton University
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from markdown import markdown
import base64
import json
import base64
def main(params):
try:
md = json.loads(base64.decodebytes(params["__... | [
"markdown.markdown",
"base64.decodebytes"
] | [((593, 610), 'markdown.markdown', 'markdown', (['md_text'], {}), '(md_text)\n', (601, 610), False, 'from markdown import markdown\n'), ((394, 416), 'base64.decodebytes', 'base64.decodebytes', (['md'], {}), '(md)\n', (412, 416), False, 'import base64\n')] |
from pydub import AudioSegment
import os
import math
from pathlib import Path
'''
Splice wav files into multiple segments.
'''
LENGTH = 3 # Set splice length in seconds
def splice(audioPath, outputPath):
# try:
# os.mkdir('Spliced Spectrogram training') # Need to figure out where to put this
# excep... | [
"math.ceil",
"pydub.AudioSegment.from_wav",
"pathlib.Path"
] | [((396, 428), 'pydub.AudioSegment.from_wav', 'AudioSegment.from_wav', (['audioPath'], {}), '(audioPath)\n', (417, 428), False, 'from pydub import AudioSegment\n'), ((441, 483), 'math.ceil', 'math.ceil', (['(audio.duration_seconds / LENGTH)'], {}), '(audio.duration_seconds / LENGTH)\n', (450, 483), False, 'import math\n... |
from typing import Dict, List
from arango.cursor import Cursor
from django.http.response import Http404
from django.shortcuts import get_object_or_404
from rest_framework.pagination import LimitOffsetPagination
from rest_framework.request import Request
from rest_framework_extensions.mixins import NestedViewSetMixin
... | [
"multinet.api.models.Workspace.objects.select_related",
"multinet.api.models.WorkspaceRole.objects.filter"
] | [((1961, 2002), 'multinet.api.models.Workspace.objects.select_related', 'Workspace.objects.select_related', (['"""owner"""'], {}), "('owner')\n", (1993, 2002), False, 'from multinet.api.models import Workspace, WorkspaceRole\n'), ((2373, 2441), 'multinet.api.models.WorkspaceRole.objects.filter', 'WorkspaceRole.objects.... |
# Copyright 2018 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 logging
import os
import sys
def ParseArgs():
parser = argparse.ArgumentParser(
description='Host file generator for CELab E... | [
"logging.basicConfig",
"os.path.exists",
"argparse.ArgumentParser",
"os.path.join",
"sys.exit",
"logging.info"
] | [((245, 323), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Host file generator for CELab E2E tests"""'}), "(description='Host file generator for CELab E2E tests')\n", (268, 323), False, 'import argparse\n'), ((1577, 1648), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'l... |
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from django.urls import reverse
from django_extensions.db.models import TimeStampedModel
from mptt.models import MPTTModel, TreeForeignKey
... | [
"django.db.models.Q",
"django.utils.translation.ugettext_lazy",
"django.urls.reverse"
] | [((560, 569), 'django.utils.translation.ugettext_lazy', '_', (['"""Name"""'], {}), "('Name')\n", (561, 569), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((622, 638), 'django.utils.translation.ugettext_lazy', '_', (['"""Description"""'], {}), "('Description')\n", (623, 638), True, 'from django.ut... |
import unittest
from gamesopt.train import train, TrainConfig
class TestOptimizer(unittest.TestCase):
def test_sgda(self):
config = TrainConfig(num_iter=2)
train(config) | [
"gamesopt.train.train",
"gamesopt.train.TrainConfig"
] | [((145, 168), 'gamesopt.train.TrainConfig', 'TrainConfig', ([], {'num_iter': '(2)'}), '(num_iter=2)\n', (156, 168), False, 'from gamesopt.train import train, TrainConfig\n'), ((177, 190), 'gamesopt.train.train', 'train', (['config'], {}), '(config)\n', (182, 190), False, 'from gamesopt.train import train, TrainConfig\n... |
import bpy
from bpy.props import *
from ...nodes.BASE.node_base import RenderNodeBase
class RenderNodeGetListIndex(RenderNodeBase):
"""A simple input node"""
bl_idname = 'RenderNodeGetListIndex'
bl_label = 'Get List Index'
def init(self, context):
self.create_output('RenderNodeSocketInt', "i... | [
"bpy.utils.unregister_class",
"bpy.utils.register_class"
] | [((614, 662), 'bpy.utils.register_class', 'bpy.utils.register_class', (['RenderNodeGetListIndex'], {}), '(RenderNodeGetListIndex)\n', (638, 662), False, 'import bpy\n'), ((687, 737), 'bpy.utils.unregister_class', 'bpy.utils.unregister_class', (['RenderNodeGetListIndex'], {}), '(RenderNodeGetListIndex)\n', (713, 737), F... |
from keras.models import load_model
import cv2
import pickle
import keras.backend as K
import numpy as np
from src.model_path import MODEL_PATH
'''def predict(self, cell):
model = load_model('./model/Model.h5')
f = K.function([model.layers[0].input, K.learning_phase()],[model.layers[-1].output])
rescaled_cell = ... | [
"cv2.resize",
"keras.models.load_model"
] | [((839, 861), 'keras.models.load_model', 'load_model', (['MODEL_PATH'], {}), '(MODEL_PATH)\n', (849, 861), False, 'from keras.models import load_model\n'), ((1013, 1039), 'cv2.resize', 'cv2.resize', (['cell', '(28, 28)'], {}), '(cell, (28, 28))\n', (1023, 1039), False, 'import cv2\n')] |
# -*- coding: utf-8 -*-
"""A module for plotting penguins data for modelling with scikit-learn."""
# Imports ---------------------------------------------------------------------
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# Constants -----------------------------... | [
"numpy.random.normal",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.close",
"numpy.linspace",
"matplotlib.pyplot.style.reload_library",
"matplotlib.ticker.FormatStrFormatter",
"pandas.DataFrame",
"numpy.meshgrid",
"matplotlib.pyplot.subplots"
] | [((608, 645), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""./style/eda.mplstyle"""'], {}), "('./style/eda.mplstyle')\n", (621, 645), True, 'import matplotlib.pyplot as plt\n'), ((977, 1020), 'numpy.linspace', 'np.linspace', (['X_AXIS[0]', 'X_AXIS[1]', 'n_points'], {}), '(X_AXIS[0], X_AXIS[1], n_points)\n', (98... |
import unittest
from forestgame.game.world import World
class WorldTest(unittest.TestCase):
def test_world_inits_to_empty_data(self):
world = World(None, "1", "0", 0, 0, [], [])
self.assertEqual(0, world.get_size_x())
self.assertEqual(0, world.get_size_y())
self.assertEqual([], world.get_tile_data(... | [
"forestgame.game.world.World"
] | [((150, 185), 'forestgame.game.world.World', 'World', (['None', '"""1"""', '"""0"""', '(0)', '(0)', '[]', '[]'], {}), "(None, '1', '0', 0, 0, [], [])\n", (155, 185), False, 'from forestgame.game.world import World\n'), ((403, 447), 'forestgame.game.world.World', 'World', (['None', '"""1"""', '"""0"""', '(3)', '(3)', '[... |
# Copyright 2021 <NAME> <<EMAIL>>
# SPDX-license-identifier: 0BSD
import string
from loguru import logger
try:
import cell_pos
from exceptions import InvconvMissingHeaders
import ftype
import msg_handler
except ModuleNotFoundError:
import invconv.cell_pos as cell_pos
from invconv.exceptions i... | [
"invconv.msg_handler.get_id",
"invconv.msg_handler.does_continue",
"string.Template",
"loguru.logger.log",
"loguru.logger.info",
"openpyxl.load_workbook",
"invconv.cell_pos.row_iter",
"invconv.cell_pos.get_col_letter",
"invconv.ftype.FtypeDataList",
"invconv.cell_pos.col_iter",
"invconv.ftype.ad... | [((2927, 2948), 'invconv.ftype.FtypeDataList', 'ftype.FtypeDataList', ([], {}), '()\n', (2946, 2948), True, 'import invconv.ftype as ftype\n'), ((6258, 6302), 'invconv.msg_handler.get_id', 'msg_handler.get_id', (['(filename, wsname)', '"""WS"""'], {}), "((filename, wsname), 'WS')\n", (6276, 6302), True, 'import invconv... |
import os
from tkinter import *
import tkinter.filedialog as tkfd
from PIL import Image
import numpy as np
import solvers.generation_solver.image_seperation as IS
def layer_interface(img_num):
layer_names = []
layer_nums = []
for k in range(img_num):
master = Toplevel()
master.title(f"Imag... | [
"PIL.Image.open",
"os.path.dirname",
"solvers.generation_solver.image_seperation.seperate_color",
"os.path.basename",
"tkinter.filedialog.askopenfilename"
] | [((2350, 2477), 'tkinter.filedialog.askopenfilename', 'tkfd.askopenfilename', ([], {'initialdir': 'graph_path', 'title': '"""Select file"""', 'filetypes': "(('pkl files', '*.pkl'), ('all files', '*.*'))"}), "(initialdir=graph_path, title='Select file', filetypes=\n (('pkl files', '*.pkl'), ('all files', '*.*')))\n",... |
# coding=utf-8
# Copyright 2020 TF.Text Authors.
#
# 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 ag... | [
"tensorflow.python.ops.string_ops.regex_replace",
"tensorflow.python.ops.array_ops.squeeze",
"tensorflow.python.ops.lookup_ops.StaticVocabularyTableV1",
"tensorflow.python.ops.ragged.ragged_tensor.is_ragged",
"tensorflow.python.framework.constant_op.constant",
"tensorflow.python.ops.ragged.ragged_tensor.R... | [((1633, 1668), 'tensorflow.python.ops.ragged.ragged_tensor.is_ragged', 'ragged_tensor.is_ragged', (['text_input'], {}), '(text_input)\n', (1656, 1668), False, 'from tensorflow.python.ops.ragged import ragged_tensor\n'), ((4382, 4468), 'tensorflow.python.ops.lookup_ops.StaticVocabularyTableV1', 'lookup_ops.StaticVocabu... |
import funcvote as vote
votes = input("투표내용 >>>")
# print(votes)
# print(type(votes))
result = vote.str2int(votes)
print(vote.countvotes(result))
result = vote.countvotes(result)
vote.printvote(result)
# 투표 초안 | [
"funcvote.str2int",
"funcvote.printvote",
"funcvote.countvotes"
] | [((97, 116), 'funcvote.str2int', 'vote.str2int', (['votes'], {}), '(votes)\n', (109, 116), True, 'import funcvote as vote\n'), ((158, 181), 'funcvote.countvotes', 'vote.countvotes', (['result'], {}), '(result)\n', (173, 181), True, 'import funcvote as vote\n'), ((183, 205), 'funcvote.printvote', 'vote.printvote', (['re... |
"""
libs.strings
By default, uses `en-gb.json` file inside the `strings` top-level folder.
If language changes, set `libs.strings.default_locale` and run `libs.strings.refresh()`.
"""
import json
default_locale = "en-us"
cached_strings = {}
def refresh():
global cached_strings
with open(f"strings/{default_... | [
"json.load"
] | [((366, 378), 'json.load', 'json.load', (['f'], {}), '(f)\n', (375, 378), False, 'import json\n')] |
# Copyright 2013-2021 The Salish Sea MEOPAR Contributors
# and The University of British Columbia
# 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... | [
"logging.getLogger",
"shlex.split",
"multiprocessing.cpu_count",
"time.sleep",
"attr.ib"
] | [((924, 951), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (941, 951), False, 'import logging\n'), ((2661, 2670), 'attr.ib', 'attr.ib', ([], {}), '()\n', (2668, 2670), False, 'import attr\n'), ((2729, 2747), 'attr.ib', 'attr.ib', ([], {'default': '(4)'}), '(default=4)\n', (2736, 2747), ... |
import unittest
from flask_monitoringdashboard.core.profiler.util.stringHash import StringHash
class TestStringHash(unittest.TestCase):
def test_stringhash(self):
string_hash = StringHash()
self.assertEqual(string_hash.hash('abc'), 0)
self.assertEqual(string_hash.hash('def'), 1)
... | [
"flask_monitoringdashboard.core.profiler.util.stringHash.StringHash"
] | [((192, 204), 'flask_monitoringdashboard.core.profiler.util.stringHash.StringHash', 'StringHash', ([], {}), '()\n', (202, 204), False, 'from flask_monitoringdashboard.core.profiler.util.stringHash import StringHash\n'), ((415, 427), 'flask_monitoringdashboard.core.profiler.util.stringHash.StringHash', 'StringHash', ([]... |
from django.shortcuts import render, get_object_or_404
from .models import News
# Create your views here.
def index(request):
latest_news_list = News.objects.order_by('-pub_date')[:10]
context = {'latest_news_list': latest_news_list}
return render(request, 'news/index.html', context)
def detail(request, ... | [
"django.shortcuts.render",
"django.shortcuts.get_object_or_404"
] | [((254, 297), 'django.shortcuts.render', 'render', (['request', '"""news/index.html"""', 'context'], {}), "(request, 'news/index.html', context)\n", (260, 297), False, 'from django.shortcuts import render, get_object_or_404\n'), ((340, 375), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['News'], {'pk': '... |