code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import torch
import torch.nn as nn
def L1_Loss_calc(model, factor=0.0005):
l1_crit = nn.L1Loss(size_average=False)
reg_loss = 0
for param in model.parameters():
# zero_vector = torch.rand_like(param)*0
zero_vector = torch.zeros_like(param)
reg_loss += l1_crit(param, zero_vector)
... | [
"torch.zeros_like",
"torch.nn.L1Loss"
] | [((91, 120), 'torch.nn.L1Loss', 'nn.L1Loss', ([], {'size_average': '(False)'}), '(size_average=False)\n', (100, 120), True, 'import torch.nn as nn\n'), ((246, 269), 'torch.zeros_like', 'torch.zeros_like', (['param'], {}), '(param)\n', (262, 269), False, 'import torch\n')] |
# Generated by Django 2.2.3 on 2019-07-28 20:39
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('favorite_app', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='favoritethings'... | [
"django.db.models.DateTimeField"
] | [((374, 429), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'default': 'django.utils.timezone.now'}), '(default=django.utils.timezone.now)\n', (394, 429), False, 'from django.db import migrations, models\n')] |
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | [
"oslo_utils.timeutils.utcnow",
"cinder.tests.unit.brick.fake_lvm.FakeBrickLVM"
] | [((1164, 1251), 'cinder.tests.unit.brick.fake_lvm.FakeBrickLVM', 'fake_lvm.FakeBrickLVM', (['"""cinder-volumes"""', '(False)', 'None', '"""default"""', 'self.fake_execute'], {}), "('cinder-volumes', False, None, 'default', self.\n fake_execute)\n", (1185, 1251), False, 'from cinder.tests.unit.brick import fake_lvm\n... |
import os
import logging
import shutil
import tempfile
import re
from os.path import join, exists, abspath, isdir, isfile, dirname, basename, relpath
import proto.python.ast_pb2 as ast_pb2
from pm_util import get_pm_proxy_for_language, get_pm_proxy
from util.enum_util import LanguageEnum
from util.compress_files impo... | [
"util.compress_files.get_file_with_meta",
"logging.debug",
"util.job_util.write_proto_to_file",
"util.job_util.exec_command",
"logging.error",
"os.walk",
"os.remove",
"os.path.exists",
"os.listdir",
"proto.python.ast_pb2.AstNode",
"proto.python.ast_pb2.AstLookupConfig",
"os.path.isdir",
"tem... | [((1774, 1799), 'os.path.join', 'join', (['outdir', 'taint_fname'], {}), '(outdir, taint_fname)\n', (1778, 1799), False, 'from os.path import join, exists, abspath, isdir, isfile, dirname, basename, relpath\n'), ((1839, 1857), 'os.path.exists', 'exists', (['taint_file'], {}), '(taint_file)\n', (1845, 1857), False, 'fro... |
import unittest
from server.models import (Hand, HandType, WinnerType, MinHand, MaxHand)
class HandTests(unittest.TestCase):
def test_hand(self):
h = Hand()
t = h.Throw()
self.assertTrue(t >= MinHand and t <= MaxHand)
t = h.Throw()
self.assertTrue(t >= MinHand and t <= MaxH... | [
"server.models.Hand"
] | [((164, 170), 'server.models.Hand', 'Hand', ([], {}), '()\n', (168, 170), False, 'from server.models import Hand, HandType, WinnerType, MinHand, MaxHand\n'), ((749, 755), 'server.models.Hand', 'Hand', ([], {}), '()\n', (753, 755), False, 'from server.models import Hand, HandType, WinnerType, MinHand, MaxHand\n')] |
# The MIT License (MIT)
#
# Copyright (c) 2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... | [
"struct.unpack"
] | [((1560, 1585), 'struct.unpack', 'struct.unpack', (['"""<HH"""', 'buf'], {}), "('<HH', buf)\n", (1573, 1585), False, 'import struct\n')] |
import sys
from pprint import pprint # NOQA
# Third party libraries
from heroku3.models.slug import Slug
# Project libraries
from .dyno import Dyno
from .addon import Addon
from .build import Build
from .buildpack_installation import BuildpackInstallation
from .domain import Domain
from .region import Region
from ..... | [
"urllib.quote"
] | [((7132, 7154), 'urllib.quote', 'quote', (['dyno_id_or_name'], {}), '(dyno_id_or_name)\n', (7137, 7154), False, 'from urllib import quote\n')] |
# Utility functions to be used with flow_from directory
import os
import numpy as np
import shutil
def make_temp_dirs(ts, name):
"""Make temporary dirs to store the training data.
Allows to run multiple scripts on HPC simultaneously
Inputs
-----
names, ts: name and timestamp for the temp folders
... | [
"os.chdir",
"os.listdir",
"os.makedirs",
"os.getcwd"
] | [((1705, 1734), 'os.listdir', 'os.listdir', (['temp_training_dir'], {}), '(temp_training_dir)\n', (1715, 1734), False, 'import os\n'), ((2129, 2160), 'os.listdir', 'os.listdir', (['temp_validation_dir'], {}), '(temp_validation_dir)\n', (2139, 2160), False, 'import os\n'), ((2406, 2417), 'os.getcwd', 'os.getcwd', ([], {... |
import re
from json_converter.json_mapper import JsonMapper
from submission_broker.submission.submission import Submission, Entity, HandleCollision
class HcaSubmission(Submission):
def __init__(self, collider: HandleCollision = None):
self.__uuid_map = {}
self.__regex = re.compile(r'/(?P<entity_t... | [
"json_converter.json_mapper.JsonMapper",
"re.compile"
] | [((294, 351), 're.compile', 're.compile', (['"""/(?P<entity_type>\\\\w+)/(?P<entity_id>\\\\w+)$"""'], {}), "('/(?P<entity_type>\\\\w+)/(?P<entity_id>\\\\w+)$')\n", (304, 351), False, 'import re\n'), ((2809, 2838), 'json_converter.json_mapper.JsonMapper', 'JsonMapper', (['entity.attributes'], {}), '(entity.attributes)\n... |
# -*- coding: utf-8 -*-
# --------------------------
# Copyright © 2014 - Qentinel Group.
#
# 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/LIC... | [
"QWeb.internal.lists.List.from_list_instance",
"QWeb.internal.exceptions.QWebInstanceDoesNotExistError",
"QWeb.internal.exceptions.QWebValueError",
"QWeb.internal.actions.execute_click_and_verify_condition",
"QWeb.internal.util.get_substring",
"QWeb.internal.element.get_element_to_click_from_list"
] | [((2779, 2857), 'QWeb.internal.lists.List.from_list_instance', 'List.from_list_instance', (['locator', 'anchor'], {'parent': 'parent', 'child': 'child'}), '(locator, anchor, parent=parent, child=child, **kwargs)\n', (2802, 2857), False, 'from QWeb.internal.lists import List\n'), ((6472, 6506), 'QWeb.internal.util.get_s... |
import os
import glob
from pathlib import Path
#-----------------------
# Write
#-----------------------
def safe_mkdir(directory):
try:
os.mkdir(directory)
except (FileExistsError, OSError):
pass # folder has been created previously
return os.path.abspath(directory)
#--------------... | [
"os.listdir",
"pathlib.Path",
"os.path.join",
"os.path.basename",
"os.mkdir",
"os.path.abspath"
] | [((276, 302), 'os.path.abspath', 'os.path.abspath', (['directory'], {}), '(directory)\n', (291, 302), False, 'import os\n'), ((154, 173), 'os.mkdir', 'os.mkdir', (['directory'], {}), '(directory)\n', (162, 173), False, 'import os\n'), ((1952, 1978), 'os.path.basename', 'os.path.basename', (['filename'], {}), '(filename... |
###############################################################################
# Copyright (c) 2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory
# Written by <NAME>, <EMAIL>.
#
# LLNL-CODE-734340
# All rights reserved.
# This file is part of MaestroWF, Version: ... | [
"logging.getLogger",
"re.escape",
"six.add_metaclass",
"re.finditer",
"re.search"
] | [((1757, 1784), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1774, 1784), False, 'import logging\n'), ((1788, 1814), 'six.add_metaclass', 'six.add_metaclass', (['ABCMeta'], {}), '(ABCMeta)\n', (1805, 1814), False, 'import six\n'), ((2464, 2487), 're.escape', 're.escape', (['launcher_va... |
"""Javascript error reporting API endpoints."""
import datetime
from flask import Blueprint, request
from inventorymgr.db import db
from inventorymgr.db.models import JavascriptError
bp = Blueprint("errorreports", __name__, url_prefix="/api/v1/errors")
@bp.route("/js", methods=("POST",))
def javascript_error() ->... | [
"datetime.datetime.utcnow",
"flask.request.json.get",
"inventorymgr.db.db.session.commit",
"flask.Blueprint",
"inventorymgr.db.models.JavascriptError"
] | [((192, 256), 'flask.Blueprint', 'Blueprint', (['"""errorreports"""', '__name__'], {'url_prefix': '"""/api/v1/errors"""'}), "('errorreports', __name__, url_prefix='/api/v1/errors')\n", (201, 256), False, 'from flask import Blueprint, request\n'), ((1254, 1273), 'inventorymgr.db.db.session.commit', 'db.session.commit', ... |
# !/user/bin/env python
# -*- coding:utf-8 -*-
import sys
import requests
import time
import ssl
from urllib import parse
import urllib3
urllib3.disable_warnings()
ssl._create_default_https_context = ssl._create_unverified_context
req = requests.Session()
class leftQuery(object):
def __init__(self):
self.... | [
"requests.Session",
"requests.get",
"urllib3.disable_warnings",
"sys.exit",
"time.time"
] | [((138, 164), 'urllib3.disable_warnings', 'urllib3.disable_warnings', ([], {}), '()\n', (162, 164), False, 'import urllib3\n'), ((238, 256), 'requests.Session', 'requests.Session', ([], {}), '()\n', (254, 256), False, 'import requests\n'), ((823, 867), 'requests.get', 'requests.get', (['self.station_url'], {'verify': '... |
#!/usr/bin/env python
# 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
#
# Unle... | [
"tensorflow.reduce_sum",
"nvutils.common.get_num_records",
"tensorflow.GradientTape",
"builtins.range",
"tensorflow.keras.models.load_model",
"horovod.tensorflow.local_rank",
"tensorflow.cast",
"os.path.exists",
"tensorflow.io.gfile.glob",
"tensorflow.python.keras.backend.set_image_data_format",
... | [((3646, 3697), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (3690, 3697), True, 'import tensorflow as tf\n'), ((4732, 4798), 'tensorflow.keras.optimizers.SGD', 'keras.optimizers.SGD', ([], {'learning_rate': 'lr_schedule', 'mom... |
# -*- coding: utf-8 -*-
'''
Created on Sep 2, 2016
@author: Kidane
'''
import requests
import sys
import config
from utils import feed_utils
STORAGE_COPY = 100
STORAGE_MOVE = 101
SBI_PUSH = 106 #norstore: 102
SBI_PULL = 107 #norstore: 103
TSD_PUSH = 104
TSD_PULL = 105
def add_job(job_type_id, nels_id, src_items, ... | [
"requests.post",
"requests.get",
"requests.delete",
"sys.exc_info",
"utils.feed_utils.info",
"config.api_url"
] | [((3503, 3535), 'utils.feed_utils.info', 'feed_utils.info', (['"""job completed"""'], {}), "('job completed')\n", (3518, 3535), False, 'from utils import feed_utils\n'), ((357, 383), 'config.api_url', 'config.api_url', (['"""jobs/add"""'], {}), "('jobs/add')\n", (371, 383), False, 'import config\n'), ((632, 705), 'requ... |
from builtins import min as builtin_min
from typing import List
def min(nums: List[float]) -> float:
return builtin_min(nums)
| [
"builtins.min"
] | [((114, 131), 'builtins.min', 'builtin_min', (['nums'], {}), '(nums)\n', (125, 131), True, 'from builtins import min as builtin_min\n')] |
# ----------------------------------------
# Written by <NAME>
# ----------------------------------------
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# from net.sync_batchnorm import nn.BatchNorm2d
from torch.nn import init
from ptsemseg.models.backbone import build_backbone
... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.init.constant_",
"torch.nn.init.kaiming_normal_",
"torch.nn.Conv2d",
"torch.nn.UpsamplingBilinear2d",
"ptsemseg.models.ASPP.ASPP",
"ptsemseg.models.backbone.build_backbone",
"torch.cat"
] | [((560, 614), 'ptsemseg.models.ASPP.ASPP', 'ASPP', ([], {'dim_in': 'input_channel', 'dim_out': '(256)', 'rate': '(16 // 16)'}), '(dim_in=input_channel, dim_out=256, rate=16 // 16)\n', (564, 614), False, 'from ptsemseg.models.ASPP import ASPP\n'), ((661, 676), 'torch.nn.Dropout', 'nn.Dropout', (['(0.5)'], {}), '(0.5)\n'... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-03-27 15:46
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Grundgeruest', '0008_stufe_unterstuetzung'),
]
operations = [
migrations.RenameFiel... | [
"django.db.migrations.RenameField"
] | [((299, 390), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""unterstuetzung"""', 'old_name': '"""user"""', 'new_name': '"""profil"""'}), "(model_name='unterstuetzung', old_name='user',\n new_name='profil')\n", (321, 390), False, 'from django.db import migrations\n')] |
#!/usr/bin/env python
# Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
from __future__ import print_function
import os
import sys
import zipfile
# Proguard lo... | [
"os.path.dirname",
"zipfile.ZipFile"
] | [((2237, 2277), 'zipfile.ZipFile', 'zipfile.ZipFile', (['sanitized_lib_path', '"""w"""'], {}), "(sanitized_lib_path, 'w')\n", (2252, 2277), False, 'import zipfile\n'), ((2100, 2127), 'zipfile.ZipFile', 'zipfile.ZipFile', (['injar', '"""r"""'], {}), "(injar, 'r')\n", (2115, 2127), False, 'import zipfile\n'), ((968, 991)... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-28 09:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('search', '0002_land_created_date'),
]
operations = [
migrations.RemoveField... | [
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((298, 356), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""land"""', 'name': '"""location"""'}), "(model_name='land', name='location')\n", (320, 356), False, 'from django.db import migrations, models\n'), ((500, 556), 'django.db.models.CharField', 'models.CharField', ([], {'blan... |
#!/usr/bin/env python
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License")... | [
"alerts.base_alert.BaseAlert"
] | [((867, 884), 'alerts.base_alert.BaseAlert', 'BaseAlert', (['{}', '{}'], {}), '({}, {})\n', (876, 884), False, 'from alerts.base_alert import BaseAlert\n'), ((1012, 1052), 'alerts.base_alert.BaseAlert', 'BaseAlert', (['alert_meta', 'alert_source_meta'], {}), '(alert_meta, alert_source_meta)\n', (1021, 1052), False, 'fr... |
import discord, pyfiglet, requests, json
from discord.ext import commands as zeenode
class currency(zeenode.Cog):
def __init__(self, bot):
self.bot = bot
@zeenode.command()
async def btc(self, ctx):
await ctx.message.delete()
r = requests.get(
"https://min-... | [
"discord.ext.commands.command",
"requests.get"
] | [((182, 199), 'discord.ext.commands.command', 'zeenode.command', ([], {}), '()\n', (197, 199), True, 'from discord.ext import commands as zeenode\n'), ((593, 610), 'discord.ext.commands.command', 'zeenode.command', ([], {}), '()\n', (608, 610), True, 'from discord.ext import commands as zeenode\n'), ((1002, 1019), 'dis... |
# Generated by Django 2.0.1 on 2018-01-19 21:02
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('tf2tags', '0003_auto_20160802_0059'),
]
operations = [
migrations.RemoveField(
model_name='user... | [
"django.db.models.GenericIPAddressField",
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((268, 324), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""users"""', 'name': '"""admin"""'}), "(model_name='users', name='admin')\n", (290, 324), False, 'from django.db import migrations, models\n'), ((369, 434), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([]... |
# -*- coding: utf-8 -*-
"""
回测
"""
from futu import *
from talib.abstract import *
import numpy as np
import pandas as pd
import datetime
import time
import os
import json
import copy
import math
import sqlite3
from re import sub
import itertools
class Tools(object):
def cuo_die_0(self, inputs, item, hands):
... | [
"sqlite3.connect",
"numpy.average",
"numpy.std",
"itertools.product",
"math.sqrt",
"time.sleep",
"datetime.datetime.now",
"copy.deepcopy",
"pandas.DataFrame",
"re.sub",
"datetime.date.today",
"pandas.concat"
] | [((4728, 4749), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (4747, 4749), False, 'import datetime\n'), ((4837, 4858), 'copy.deepcopy', 'copy.deepcopy', (['m_list'], {}), '(m_list)\n', (4850, 4858), False, 'import copy\n'), ((5940, 5994), 'itertools.product', 'itertools.product', (['item_cd_day', 'it... |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from .views import ignore, UnsupportedBrowser
urlpatterns = patterns("",
#url(r"^$", UnsupportedBrowser.as_view(), name="django-badbrowser-unsupported"),
url(r"^ignore/$", ignore, name="django-badbrowser-ignore"),
)
| [
"django.conf.urls.url"
] | [((232, 289), 'django.conf.urls.url', 'url', (['"""^ignore/$"""', 'ignore'], {'name': '"""django-badbrowser-ignore"""'}), "('^ignore/$', ignore, name='django-badbrowser-ignore')\n", (235, 289), False, 'from django.conf.urls import patterns, url\n')] |
from uuid import uuid4
from record_keeper import BOT
@BOT.database.update
def update(
server: str,
pokemon_number: str,
pokemon_name: str,
user: str,
notes: str = "",
board: str = "TRADE_BOARD",
) -> str:
"""Updates the database for trade commands.
Args:
server (str): the ser... | [
"uuid.uuid4"
] | [((730, 737), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (735, 737), False, 'from uuid import uuid4\n')] |
from math import erf
from numpy import array as vec
from numpy.linalg import norm as vec_size
from pandas import DataFrame
def approx(a, m, x):
return ((a+x)**m-(a-x)**m)/((a+x)**m+(a-x)**m)
def quadratic_error(a, m, x):
err = approx(a, m, x)-erf(x)
return err**2
def average_quadratic_error(a, m):
s... | [
"pandas.DataFrame",
"numpy.array",
"numpy.linalg.norm",
"math.erf"
] | [((808, 829), 'numpy.array', 'vec', (['(dx / h, dy / h)'], {}), '((dx / h, dy / h))\n', (811, 829), True, 'from numpy import array as vec\n'), ((1634, 1649), 'pandas.DataFrame', 'DataFrame', (['path'], {}), '(path)\n', (1643, 1649), False, 'from pandas import DataFrame\n'), ((254, 260), 'math.erf', 'erf', (['x'], {}), ... |
import time
start = time.time()
chain, max_num, max_chain, num = 0, 0, 0, 0
for i in range(1, 1000000):
num = i
while True:
if num % 2 == 0:
chain = chain + 1
num = num / 2
else:
if num == 1:
if chain > max_chain:
max_nu... | [
"time.time"
] | [((20, 31), 'time.time', 'time.time', ([], {}), '()\n', (29, 31), False, 'import time\n'), ((590, 601), 'time.time', 'time.time', ([], {}), '()\n', (599, 601), False, 'import time\n')] |
# -*- coding: utf-8 -*-
import pytest
from returns.maybe import Nothing, Some, _Nothing
from returns.primitives.container import (
Bindable,
Fixable,
Mappable,
Rescueable,
Unwrapable,
)
from returns.primitives.exceptions import ImmutableStateError
@pytest.mark.parametrize('container', [
Noth... | [
"returns.maybe._Nothing",
"returns.maybe.Some",
"pytest.mark.parametrize",
"returns.maybe.Nothing.bind",
"pytest.raises"
] | [((342, 436), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""protocol"""', '[Bindable, Mappable, Fixable, Rescueable, Unwrapable]'], {}), "('protocol', [Bindable, Mappable, Fixable,\n Rescueable, Unwrapable])\n", (365, 436), False, 'import pytest\n'), ((1268, 1275), 'returns.maybe.Some', 'Some', (['(1)'... |
import datetime
from pathlib import Path
from typing import Any, Callable, Iterable, List, NamedTuple, Optional
import numpy as np
from tqdm import tqdm
from vcap import BaseCapsule, NodeDescription
from vcap.testing.input_output_validation import make_detection_node
from capsules import CapsuleDir
from workers impor... | [
"capsules.CapsuleDir",
"tqdm.tqdm",
"workers.CapsuleThreadPool",
"datetime.datetime.now",
"vcap.testing.input_output_validation.make_detection_node",
"numpy.random.RandomState"
] | [((994, 1017), 'capsules.CapsuleDir', 'CapsuleDir', (['capsule_dir'], {}), '(capsule_dir)\n', (1004, 1017), False, 'from capsules import CapsuleDir\n'), ((1248, 1275), 'numpy.random.RandomState', 'np.random.RandomState', (['(1337)'], {}), '(1337)\n', (1269, 1275), True, 'import numpy as np\n'), ((4023, 4046), 'datetime... |
import pandas as pd
import numpy as np
from .Team import Team
from .FootballModel import FootballModel
from ..utils import array_sum_to_one, exists, to_percent
from .ResultType import ResultType
class Game:
'''
'''
def __init__(self, model: FootballModel, team_1: str, team_2: str, max_goals=20):
... | [
"numpy.ndenumerate",
"numpy.diag",
"numpy.outer",
"numpy.tril",
"pandas.DataFrame",
"numpy.amax",
"numpy.triu"
] | [((549, 625), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': "{'team': team_1.name, 'opponent': team_2.name}", 'index': '[1]'}), "(data={'team': team_1.name, 'opponent': team_2.name}, index=[1])\n", (561, 625), True, 'import pandas as pd\n'), ((3420, 3478), 'numpy.outer', 'np.outer', (['self.team_1.proba_goals', 'se... |
"""API views for the importer models."""
import logging
from bgjobs.models import BackgroundJob
from django.contrib.auth import get_user_model
from django.db import transaction
from projectroles.views import ProjectPermissionMixin
from projectroles.views_api import SODARAPIBaseProjectMixin, SODARAPIGenericProjectMixi... | [
"logging.getLogger",
"django.contrib.auth.get_user_model",
"bgjobs.models.BackgroundJob.objects.create",
"django.db.transaction.atomic"
] | [((808, 835), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (825, 835), False, 'import logging\n'), ((870, 886), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (884, 886), False, 'from django.contrib.auth import get_user_model\n'), ((2261, 2281), 'django.db.tra... |
import json
from .models import *
def check_schedule_structure(parsed_json):
errors = []
success = []
struct = {"Times": [{"Time": "", "Code": "", "TimeFrom": "", "TimeTo": ""}], "Data": [{"Day": "", "DayNumber": "", "Time": {"Time": "", "Code": "", "TimeFrom": "", "TimeTo": ""}, "Class": {"Code": "", "Na... | [
"json.loads"
] | [((1445, 1466), 'json.loads', 'json.loads', (['json_file'], {}), '(json_file)\n', (1455, 1466), False, 'import json\n')] |
#!/usr/bin/env python3
import datetime
def logging_main(message):
now = datetime.datetime.now()
with open ("log/discord/%s.log" % now.strftime('%Y-%m-%d'), 'a') as logfile:
data = "[%s, %s, %s] %s, %s\n" % (now.strftime('%Y-%m-%d %H:%M:%S'), message.guild, message.channel, message.author, message.aut... | [
"datetime.datetime.now"
] | [((79, 102), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (100, 102), False, 'import datetime\n')] |
import logging
from decimal import Decimal as D
import binascii
from math import ceil
import time
import calendar
import dateutil.parser
from counterpartylib.lib import script, config, blocks, exceptions, api, transaction
from counterpartylib.lib.util import make_id, BET_TYPE_NAME, BET_TYPE_ID, dhash, generate_asset_n... | [
"logging.debug",
"counterpartycli.util.value_out",
"counterpartylib.lib.kickstart.utils.ib2h",
"binascii.hexlify",
"counterpartylib.lib.script.is_multisig",
"binascii.unhexlify",
"counterpartycli.wallet.list_unspent",
"counterpartycli.util.api",
"counterpartylib.lib.script.extract_array",
"counter... | [((2040, 2067), 'counterpartycli.wallet.is_valid', 'wallet.is_valid', (['pubkeyhash'], {}), '(pubkeyhash)\n', (2055, 2067), False, 'from counterpartycli import wallet\n'), ((4088, 4115), 'counterpartylib.lib.script.is_multisig', 'script.is_multisig', (['address'], {}), '(address)\n', (4106, 4115), False, 'from counterp... |
import datetime
import pickle
class ami:
def __init__(self,
nnom = "Dupont",
pprenom = "Rémy",
jjnaissance = 1,
mmnaissance = 1,
aanaissance = 1900,
vville = "Paris",
llien = "Ami"):
... | [
"datetime.datetime.now",
"datetime.date.today",
"datetime.date"
] | [((594, 617), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (615, 617), False, 'import datetime\n'), ((993, 1016), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1014, 1016), False, 'import datetime\n'), ((1060, 1081), 'datetime.date.today', 'datetime.date.today', ([], {}), '... |
from math import ceil
a, b = map(int, input().split())
print(ceil((a + b) / 2))
| [
"math.ceil"
] | [((63, 80), 'math.ceil', 'ceil', (['((a + b) / 2)'], {}), '((a + b) / 2)\n', (67, 80), False, 'from math import ceil\n')] |
# coding: utf-8
import json
import os
import uuid
import magic
from stix2.canonicalization.Canonicalize import canonicalize
class ExternalReference:
def __init__(self, opencti, file):
self.opencti = opencti
self.file = file
self.properties = """
id
standard_id
... | [
"stix2.canonicalization.Canonicalize.canonicalize",
"uuid.UUID",
"magic.from_file",
"json.dumps",
"os.path.basename"
] | [((1261, 1291), 'stix2.canonicalization.Canonicalize.canonicalize', 'canonicalize', (['data'], {'utf8': '(False)'}), '(data, utf8=False)\n', (1273, 1291), False, 'from stix2.canonicalization.Canonicalize import canonicalize\n'), ((7457, 7484), 'os.path.basename', 'os.path.basename', (['file_name'], {}), '(file_name)\n'... |
#!/usr/bin/env python
###########################################################################
# svm light based support vector regression
###########################################################################
from numpy import array
from numpy.random import seed, rand
from tools.load import LoadMatrix
lm=LoadM... | [
"shogun.RegressionLabels",
"shogun.RealFeatures",
"shogun.kernel",
"tools.load.LoadMatrix",
"shogun.SVRLight"
] | [((315, 327), 'tools.load.LoadMatrix', 'LoadMatrix', ([], {}), '()\n', (325, 327), False, 'from tools.load import LoadMatrix\n'), ((992, 1014), 'shogun.RealFeatures', 'RealFeatures', (['fm_train'], {}), '(fm_train)\n', (1004, 1014), False, 'from shogun import RegressionLabels, RealFeatures\n'), ((1027, 1048), 'shogun.R... |
import pytest
from easydata import parsers
from easydata.queries import jp, pq
from tests.factory import data_html, data_list
expected_urls = [
"https://demo.com/imgs/1.jpg",
"https://demo.com/imgs/2.jpg",
"https://demo.com/imgs/3.jpg",
]
expected_urls_non_unique = [
"https://demo.com/imgs/1.jpg",
... | [
"easydata.parsers.Url",
"easydata.parsers.Text",
"easydata.queries.pq",
"pytest.mark.parametrize",
"easydata.parsers.UrlList",
"pytest.raises",
"easydata.queries.jp",
"easydata.parsers.List",
"easydata.parsers.TextList"
] | [((2696, 2877), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""max_num, result"""', "[(2, ['one', 'two']), (4, ['one', 'two', 'three', 'four']), (5, ['one',\n 'two', 'three', 'four']), (-1, ['one', 'two', 'three'])]"], {}), "('max_num, result', [(2, ['one', 'two']), (4, ['one',\n 'two', 'three', 'fou... |
import unittest
from tests import app_factory
from config import integration_mode
from datetime import datetime, timezone
class MyKafkaConsumerTest(unittest.TestCase):
my_kafka_p = None
my_kafka_c = None
def setUp(self):
if integration_mode is False:
self.assertTrue(True)
... | [
"unittest.main",
"datetime.datetime.now",
"tests.app_factory.build_kafka_consumer",
"tests.app_factory.build_kafka_producer"
] | [((1838, 1853), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1851, 1853), False, 'import unittest\n'), ((402, 440), 'tests.app_factory.build_kafka_producer', 'app_factory.build_kafka_producer', (['(True)'], {}), '(True)\n', (434, 440), False, 'from tests import app_factory\n'), ((637, 675), 'tests.app_factory.b... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import re
import shutil
import sys
import pytest
from lxml import etree
os.environ["IN_PYTEST"] = "1"
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
while not os.path.exists(os.path.join(PROJECT_ROOT, 'README.md')):
PROJECT_ROOT = os.path.dirname(PR... | [
"sys.path.insert",
"re.compile",
"os.path.join",
"pytest.main",
"os.path.dirname",
"lxml.etree.HTML",
"os.path.abspath",
"lxml.etree.tostring"
] | [((189, 214), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (204, 214), False, 'import os\n'), ((302, 331), 'os.path.dirname', 'os.path.dirname', (['PROJECT_ROOT'], {}), '(PROJECT_ROOT)\n', (317, 331), False, 'import os\n'), ((759, 775), 'lxml.etree.HTML', 'etree.HTML', (['text'], {}), '(tex... |
"""
Tests for dit.utils.misc.
"""
from nose.tools import assert_equal, assert_false, assert_raises, assert_true
from dit.utils.misc import flatten, is_string_like, partitions, partitions2, \
ordered_partitions, require_keys, partition_set, \
abstract_method, digit... | [
"dit.utils.misc.require_keys",
"dit.utils.misc.is_string_like",
"nose.tools.assert_raises",
"dit.utils.misc.digits",
"dit.utils.misc.flatten",
"nose.tools.assert_equal",
"six.u",
"dit.utils.misc.partition_set",
"dit.utils.misc.partitions2"
] | [((1916, 1967), 'nose.tools.assert_raises', 'assert_raises', (['Exception', 'require_keys', 'required', 'd'], {}), '(Exception, require_keys, required, d)\n', (1929, 1967), False, 'from nose.tools import assert_equal, assert_false, assert_raises, assert_true\n'), ((2111, 2135), 'dit.utils.misc.partition_set', 'partitio... |
"""
permutation-flowshop repository
This module has two examples on how to setup and run
the algorithm for Permutation Flowshop scheduling problems.
The first one uses random generated data, while the second
uses one of the instances from the Taillard benchmark set.
"""
import numpy as np
import benchmark
from iterat... | [
"benchmark.import_taillard",
"iterated_greedy.IteratedGreedy",
"numpy.random.randint"
] | [((512, 559), 'numpy.random.randint', 'np.random.randint', ([], {'size': '(20, 5)', 'low': '(5)', 'high': '(80)'}), '(size=(20, 5), low=5, high=80)\n', (529, 559), True, 'import numpy as np\n'), ((589, 613), 'iterated_greedy.IteratedGreedy', 'IteratedGreedy', (['rnd_data'], {}), '(rnd_data)\n', (603, 613), False, 'from... |
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import pandas as pd
import sys
#: By <NAME> @ 2021
#: Take into account the Air
def main():
# Power
df = pd.read_csv("../mods/df_pow.csv")
ax = df.plot.area(y=["vPowCombTurb", "PowHp", "PowIp", "PowLp1", "PowLp2"])
ax.set_title("Power Generation")
... | [
"pandas.read_csv"
] | [((169, 202), 'pandas.read_csv', 'pd.read_csv', (['"""../mods/df_pow.csv"""'], {}), "('../mods/df_pow.csv')\n", (180, 202), True, 'import pandas as pd\n'), ((829, 861), 'pandas.read_csv', 'pd.read_csv', (['"""../mods/df_co.csv"""'], {}), "('../mods/df_co.csv')\n", (840, 861), True, 'import pandas as pd\n')] |
# -*- coding: utf-8 -*-
from .common import *
from ccxt.base.errors import AuthenticationError, ExchangeError, ExchangeNotAvailable, RequestTimeout
from requests.exceptions import ConnectionError, HTTPError, ReadTimeout
from socket import gaierror, timeout
from urllib3.exceptions import MaxRetryError, NewConnectionErr... | [
"numpy.array"
] | [((2572, 2601), 'numpy.array', 'np.array', (['[]'], {'dtype': '"""float64"""'}), "([], dtype='float64')\n", (2580, 2601), True, 'import numpy as np\n'), ((3633, 3645), 'numpy.array', 'np.array', (['hh'], {}), '(hh)\n', (3641, 3645), True, 'import numpy as np\n'), ((3994, 4023), 'numpy.array', 'np.array', (['[]'], {'dty... |
import simpy
from simulation.client import MobileClient
from simulation.node import FogNode
from simulation.celltower import Celltower
from simulation.metrics import Metrics
from simulation.fog_environment import FogEnvironment
import xml.etree.ElementTree as et
import uuid
import geopandas as gpd
import yaml
... | [
"simulation.fog_environment.FogEnvironment",
"xml.etree.ElementTree.parse",
"simulation.celltower.Celltower",
"geopandas.read_file",
"pathlib.Path",
"random.Random",
"math.ceil",
"yaml.load",
"uuid.uuid4",
"simulation.client.MobileClient",
"simulation.metrics.Metrics",
"warnings.warn"
] | [((519, 547), 'random.Random', 'Random', (['"""Fog-Node-Discovery"""'], {}), "('Fog-Node-Discovery')\n", (525, 547), False, 'from random import Random\n'), ((2016, 2038), 'simulation.fog_environment.FogEnvironment', 'FogEnvironment', (['config'], {}), '(config)\n', (2030, 2038), False, 'from simulation.fog_environment ... |
#!/usr/bin/python3
#
# Copyright 2018 Google LLC
#
# 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 a... | [
"io.FileIO",
"argparse.ArgumentParser",
"datetime.datetime.utcnow",
"struct.pack",
"datetime.datetime.now",
"os.path.basename",
"sys.exit",
"os.path.abspath",
"os.stat"
] | [((2122, 2195), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate an initrd image for Puppy"""'}), "(description='Generate an initrd image for Puppy')\n", (2145, 2195), False, 'import argparse\n'), ((2638, 2668), 'io.FileIO', 'io.FileIO', (['args.dest'], {'mode': '"""w"""'}), "(arg... |
"""Provides algorithms with access to most of garage's features."""
import copy
import os
import time
import cloudpickle
from dowel import logger, tabular
# This is avoiding a circular import
from garage.experiment.deterministic import get_seed, set_seed
from garage.experiment.experiment import dump_json
from garage.... | [
"garage.tf.plotter.Plotter",
"garage.experiment.deterministic.get_seed",
"dowel.logger.prefix",
"dowel.tabular.clear",
"dowel.logger.dump_all",
"os.path.join",
"os.environ.get",
"cloudpickle.dumps",
"garage.experiment.experiment.dump_json",
"garage.experiment.snapshotter.Snapshotter",
"garage.ex... | [((2987, 3093), 'garage.experiment.snapshotter.Snapshotter', 'Snapshotter', (['snapshot_config.snapshot_dir', 'snapshot_config.snapshot_mode', 'snapshot_config.snapshot_gap'], {}), '(snapshot_config.snapshot_dir, snapshot_config.snapshot_mode,\n snapshot_config.snapshot_gap)\n', (2998, 3093), False, 'from garage.exp... |
from __future__ import unicode_literals
import sys
import django
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from object_tools import autodiscover
from object_tools.sites import ObjectTools
from object_tools.tests.tools import T... | [
"object_tools.autodiscover",
"sys.modules.keys",
"object_tools.validation.validate",
"object_tools.sites.ObjectTools"
] | [((540, 554), 'object_tools.autodiscover', 'autodiscover', ([], {}), '()\n', (552, 554), False, 'from object_tools import autodiscover\n'), ((2593, 2606), 'object_tools.sites.ObjectTools', 'ObjectTools', ([], {}), '()\n', (2604, 2606), False, 'from object_tools.sites import ObjectTools\n'), ((2936, 2949), 'object_tools... |
"""
MIT License
Copyright (c) 2016-2018 Madcore Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publi... | [
"jinja2.FileSystemLoader"
] | [((1600, 1652), 'jinja2.FileSystemLoader', 'FileSystemLoader', (['self.settings.folder_app_templates'], {}), '(self.settings.folder_app_templates)\n', (1616, 1652), False, 'from jinja2 import Environment, PackageLoader, FileSystemLoader\n'), ((2068, 2120), 'jinja2.FileSystemLoader', 'FileSystemLoader', (['self.settings... |
# -*- coding: utf-8 -*-
import re
import sys
import inspect
import piston3.handler as handler
from types import ModuleType
from resource import CsrfExemptResource
from handlers import ObjectHandlerMetaClass
from django.core.urlresolvers import get_resolver, get_callable, get_script_prefix
from django.utils.translati... | [
"django.utils.translation.ugettext_lazy",
"re.compile",
"inspect.getmodule",
"django.template.RequestContext",
"resource.CsrfExemptResource.callmap.get",
"inspect.getargspec",
"django.core.urlresolvers.get_resolver",
"django.core.urlresolvers.get_script_prefix",
"django.core.urlresolvers.get_callabl... | [((1617, 1648), 'inspect.getargspec', 'inspect.getargspec', (['self.method'], {}), '(self.method)\n', (1635, 1648), False, 'import inspect\n'), ((2451, 2478), 'inspect.getdoc', 'inspect.getdoc', (['self.method'], {}), '(self.method)\n', (2465, 2478), False, 'import inspect\n'), ((3797, 3824), 'inspect.getdoc', 'inspect... |
import unittest
import pexpect
from readchar import key
class ShortcutsTest(unittest.TestCase):
def setUp(self):
self.sut = pexpect.spawn('python examples/shortcuts.py')
def set_username(self, name='foo'):
self.sut.expect("Enter your username", timeout=1)
self.sut.sendline(name)
... | [
"pexpect.spawn"
] | [((138, 183), 'pexpect.spawn', 'pexpect.spawn', (['"""python examples/shortcuts.py"""'], {}), "('python examples/shortcuts.py')\n", (151, 183), False, 'import pexpect\n')] |
from utilities.analisys_parser.analizer.abstract.expression import Expression, TYPE
from utilities.analisys_parser.analizer.abstract import expression
from utilities.analisys_parser.analizer.reports import Nodo
from utilities.analisys_parser.analizer.statement.expressions import primitive
class Relational(Expression)... | [
"utilities.analisys_parser.analizer.reports.Nodo.Nodo",
"utilities.analisys_parser.analizer.statement.expressions.primitive.Primitive"
] | [((2851, 2875), 'utilities.analisys_parser.analizer.reports.Nodo.Nodo', 'Nodo.Nodo', (['self.operator'], {}), '(self.operator)\n', (2860, 2875), False, 'from utilities.analisys_parser.analizer.reports import Nodo\n'), ((2051, 2125), 'utilities.analisys_parser.analizer.statement.expressions.primitive.Primitive', 'primit... |
from Kaspa.modules.abstract_modules.abstractBriefingSubmodule import AbstractBriefingSubmodule
import datetime
class MensaModuleDe(AbstractBriefingSubmodule):
module_name = "Mensa Erlangen Sued"
language = "de"
key_regexes = dict()
def __init__(self):
self.key_regexes = {'(?i).*?(?=was)+.+?... | [
"datetime.datetime.today"
] | [((910, 935), 'datetime.datetime.today', 'datetime.datetime.today', ([], {}), '()\n', (933, 935), False, 'import datetime\n')] |
#!/usr/bin/env python
import imageio
im = imageio.imread('akhead.png')
print(im.shape) # im is a numpy array
imageio.imwrite('akhead-gray.jpg', im[:,:,0])
| [
"imageio.imread",
"imageio.imwrite"
] | [((44, 72), 'imageio.imread', 'imageio.imread', (['"""akhead.png"""'], {}), "('akhead.png')\n", (58, 72), False, 'import imageio\n'), ((111, 158), 'imageio.imwrite', 'imageio.imwrite', (['"""akhead-gray.jpg"""', 'im[:, :, 0]'], {}), "('akhead-gray.jpg', im[:, :, 0])\n", (126, 158), False, 'import imageio\n')] |
import unittest
import common
class Test (unittest.TestCase):
def testBase (self):
b = common.base('hi')
self.assertEqual(b.elt, 'hi')
def testNamespaceInfo (self):
ns = common.Namespace
ns.validateComponentModel()
self.assertEqual(1, len(ns.moduleRecords()))
if '__mai... | [
"unittest.main",
"common.base"
] | [((342, 357), 'unittest.main', 'unittest.main', ([], {}), '()\n', (355, 357), False, 'import unittest\n'), ((100, 117), 'common.base', 'common.base', (['"""hi"""'], {}), "('hi')\n", (111, 117), False, 'import common\n')] |
"""Simulating time series, with aperiodic activity."""
import numpy as np
from scipy.stats import zscore
from scipy.linalg import toeplitz, cholesky
from neurodsp.filt import filter_signal, infer_passtype
from neurodsp.filt.fir import compute_filter_length
from neurodsp.filt.checks import check_filter_definition
from... | [
"numpy.convolve",
"numpy.sqrt",
"numpy.random.rand",
"neurodsp.utils.data.create_times",
"neurodsp.filt.infer_passtype",
"scipy.linalg.cholesky",
"numpy.arange",
"neurodsp.filt.checks.check_filter_definition",
"neurodsp.sim.transients.sim_synaptic_kernel",
"numpy.where",
"numpy.fft.fft",
"nump... | [((4213, 4257), 'neurodsp.sim.transients.sim_synaptic_kernel', 'sim_synaptic_kernel', (['t_ker', 'fs', 'tau_r', 'tau_d'], {}), '(t_ker, fs, tau_r, tau_d)\n', (4232, 4257), False, 'from neurodsp.sim.transients import sim_synaptic_kernel\n'), ((5517, 5544), 'neurodsp.utils.data.create_times', 'create_times', (['n_seconds... |
import os
import re
from collections import namedtuple
from black import FileMode, format_str
from openapi import utils
from openapi.openapi import OpenAPISpec
from openapi.utils import TYPE_MAPPING
TO_EXCLUDE = ["project", "cursor"]
GEN_CLASS_PATTERN = "# GenClass: ([\S ]+)\s+class (\S+)\(.+\):(?:(?!# GenStop)[\s\S... | [
"collections.namedtuple",
"openapi.utils.get_type_hint",
"black.FileMode",
"re.match",
"openapi.openapi.OpenAPISpec",
"os.path.isfile",
"openapi.utils.to_snake_case",
"re.sub",
"re.findall",
"re.search"
] | [((571, 632), 'collections.namedtuple', 'namedtuple', (['"""GenClassSegment"""', "['schema_names', 'class_name']"], {}), "('GenClassSegment', ['schema_names', 'class_name'])\n", (581, 632), False, 'from collections import namedtuple\n'), ((657, 723), 'collections.namedtuple', 'namedtuple', (['"""GenUpdateClassSegment""... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import itertools
import re
from collections import Counter
from typing import Dict, List, NamedTuple
from pytext.common.constants import DatasetFieldName, SpecialTokens, Stage
from pytext.data import CommonMetadata
from pytex... | [
"pytext.utils.data.parse_slot_string",
"collections.Counter",
"pytext.metrics.AllConfusions",
"pytext.metrics.LabelPrediction",
"pytext.metrics.intent_slot_metrics.Span",
"pytext.metrics.compute_multi_label_multi_class_soft_metrics",
"re.sub",
"re.search"
] | [((1029, 1043), 'collections.Counter', 'Counter', (['slots'], {}), '(slots)\n', (1036, 1043), False, 'from collections import Counter\n'), ((5271, 5381), 'pytext.metrics.compute_multi_label_multi_class_soft_metrics', 'compute_multi_label_multi_class_soft_metrics', (['list_score_pred_expect', 'self.label_names', 'self.l... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | [
"flask.render_template",
"google.cloud.bigquery.Client",
"flask.Flask"
] | [((689, 704), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (694, 704), False, 'from flask import Flask, render_template\n'), ((723, 740), 'google.cloud.bigquery.Client', 'bigquery.Client', ([], {}), '()\n', (738, 740), False, 'from google.cloud import bigquery\n'), ((1169, 1222), 'flask.render_template',... |
from setuptools import setup, find_packages
def get_data_files():
data_files = [('share/sysmontask/glade_files', ['glade_files/disk.glade','glade_files/diskSidepane.glade','glade_files/gpu.glade',
'glade_files/gpuSidepane.glade','glade_files/net.glade','glade_files/netSidepane.glade','glade_files/sysmontask.gl... | [
"setuptools.find_packages"
] | [((883, 898), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (896, 898), False, 'from setuptools import setup, find_packages\n')] |
from decimal import Decimal
from remote_works.core.analytics import (
get_task_payloads, get_view_payloads, report_order, report_view)
def test_get_task_payloads(task_with_lines):
task = task_with_lines
generator = get_task_payloads(task)
data = list(generator)
assert len(data) == task.lines.cou... | [
"remote_works.core.analytics.report_view",
"remote_works.core.analytics.get_task_payloads",
"remote_works.core.analytics.report_order",
"remote_works.core.analytics.get_view_payloads",
"decimal.Decimal"
] | [((231, 254), 'remote_works.core.analytics.get_task_payloads', 'get_task_payloads', (['task'], {}), '(task)\n', (248, 254), False, 'from remote_works.core.analytics import get_task_payloads, get_view_payloads, report_order, report_view\n'), ((1071, 1104), 'remote_works.core.analytics.report_order', 'report_order', (['"... |
# ==============================================================================
# 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 re... | [
"torch.manual_seed",
"torch.nn.ReLU",
"torch.nn.Sigmoid",
"torch.nn.Tanh",
"numpy.asarray",
"random.seed",
"torch.cuda.is_available",
"numpy.random.seed",
"torch.cuda.manual_seed",
"torch.device"
] | [((833, 850), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (844, 850), False, 'import random\n'), ((900, 920), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (914, 920), True, 'import numpy as np\n'), ((925, 948), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (94... |
# Copyright 2016 United States Government as represented by the Administrator
# of the National Aeronautics and Space Administration. All Rights Reserved.
#
# Portion of this code is Copyright Geoscience Australia, Licensed under the
# Apache License, Version 2.0 (the "License"); you may not use this file
# except in c... | [
"django.forms.HiddenInput",
"django.forms.DateInput",
"django.forms.Select",
"django.forms.NumberInput",
"datetime.datetime.now"
] | [((1785, 1828), 'django.forms.Select', 'forms.Select', ([], {'attrs': "{'class': 'field-long'}"}), "(attrs={'class': 'field-long'})\n", (1797, 1828), False, 'from django import forms\n'), ((2071, 2125), 'django.forms.Select', 'forms.Select', ([], {'attrs': "{'class': 'field-long tooltipped'}"}), "(attrs={'class': 'fiel... |
import unittest
import sys
class DecordTest(unittest.TestCase):
""" Simple functionality tests. """
def test_import(self):
""" Test that the cv2 module can be imported. """
import decord
def test_video_capture(self):
import decord as dc
cap = dc.VideoReader("SampleVideo_... | [
"decord.VideoReader"
] | [((292, 338), 'decord.VideoReader', 'dc.VideoReader', (['"""SampleVideo_1280x720_1mb.mp4"""'], {}), "('SampleVideo_1280x720_1mb.mp4')\n", (306, 338), True, 'import decord as dc\n')] |
from service import Service
import config
import os
import sys
import re
import log
import time
import select
from subprocess import Popen
from subprocess import PIPE
from service_ovpn import ServiceOvpn
import services
import pathlib
ON_POSIX = 'posix' in sys.builtin_module_names
class ServiceOvpnClient(ServiceOvpn):... | [
"services.SERVICES.sdp.getCertificates",
"services.SERVICES.sleep",
"os.path.exists",
"log.L.error",
"pathlib.Path",
"os.chdir",
"log.L.warning",
"config.CONFIG.isWindows",
"os.mkdir",
"sys.exit"
] | [((1100, 1118), 'os.chdir', 'os.chdir', (['self.dir'], {}), '(self.dir)\n', (1108, 1118), False, 'import os\n'), ((1408, 1447), 'services.SERVICES.sdp.getCertificates', 'services.SERVICES.sdp.getCertificates', ([], {}), '()\n', (1445, 1447), False, 'import services\n'), ((4381, 4406), 'config.CONFIG.isWindows', 'config... |
from flask import request, Response
import json
class Debug_JSON():
endpoints = ["/api/debug"]
endpoint_name = "api_debug"
endpoint_methods = ["GET", "POST"]
def __init__(self, fhdhr):
self.fhdhr = fhdhr
def __call__(self, *args):
return self.handler(*args)
def handler(self,... | [
"json.dumps",
"flask.Response"
] | [((827, 858), 'json.dumps', 'json.dumps', (['debugjson'], {'indent': '(4)'}), '(debugjson, indent=4)\n', (837, 858), False, 'import json\n'), ((875, 945), 'flask.Response', 'Response', ([], {'status': '(200)', 'response': 'debug_json', 'mimetype': '"""application/json"""'}), "(status=200, response=debug_json, mimetype=... |
from Mambo import Mambo
import string
import random
import time
string.numbers = '0123'
bestFit = open("mamboTimes.txt", "r")
bestFitTime = bestFit.read()
print("best fit time", bestFitTime)
bestFit.close()
crashed = False
bestFitTime = float(bestFitTime)
finishTime = 0.0
startTime = 0.0
flightDuration = 1.0 # sec... | [
"Mambo.Mambo",
"random.choice",
"time.time",
"random.randint"
] | [((438, 469), 'Mambo.Mambo', 'Mambo', (['mamboAddr'], {'use_wifi': '(True)'}), '(mamboAddr, use_wifi=True)\n', (443, 469), False, 'from Mambo import Mambo\n'), ((1054, 1074), 'random.randint', 'random.randint', (['(0)', '(5)'], {}), '(0, 5)\n', (1068, 1074), False, 'import random\n'), ((1239, 1268), 'random.choice', 'r... |
import os
def find_files(suffix, path):
"""
Find all files beneath path with file name suffix.
Note that a path may contain further subdirectories
and those subdirectories may also contain further subdirectories.
There are no limit to the depth of the subdirectories can be.
Args:
suffix(str): suffi... | [
"os.listdir",
"os.path.join",
"os.getcwd"
] | [((535, 551), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (545, 551), False, 'import os\n'), ((846, 857), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (855, 857), False, 'import os\n'), ((475, 491), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (485, 491), False, 'import os\n'), ((775, 801), 'os.pa... |
from sqlalchemy import Column, Integer, String, Enum
from vwsfriend.model.base import Base
from vwsfriend.model.datetime_decorator import DatetimeDecorator
from weconnect.weconnect_errors import ErrorEventType
class WeConnectError(Base):
__tablename__ = 'weconnect_errors'
id = Column(Integer, primary_key=Tr... | [
"vwsfriend.model.datetime_decorator.DatetimeDecorator",
"sqlalchemy.Column",
"sqlalchemy.Enum"
] | [((290, 323), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (296, 323), False, 'from sqlalchemy import Column, Integer, String, Enum\n'), ((465, 479), 'sqlalchemy.Column', 'Column', (['String'], {}), '(String)\n', (471, 479), False, 'from sqlalchemy import Col... |
import requests
import sys
import shutil
import re
import os
import pandas as pd
import time
import threading
from bs4 import BeautifulSoup as soup
THREAD_COUNTER = 0
THREAD_MAX = 5
def get_source(link):
r = requests.get(link)
if r.status_code == 200:
return soup(r.text, features="html.parser")
e... | [
"shutil.copyfileobj",
"pandas.read_csv",
"os.path.join",
"re.match",
"requests.get",
"os.getcwd",
"bs4.BeautifulSoup",
"sys.exit",
"threading.Thread"
] | [((215, 233), 'requests.get', 'requests.get', (['link'], {}), '(link)\n', (227, 233), False, 'import requests\n'), ((1203, 1241), 'pandas.read_csv', 'pd.read_csv', (['"""data/movie_metadata.csv"""'], {}), "('data/movie_metadata.csv')\n", (1214, 1241), True, 'import pandas as pd\n'), ((278, 314), 'bs4.BeautifulSoup', 's... |
from __future__ import annotations
from typing import Any, Callable
from textual.app import App as TextualApp # type: ignore
from textual.events import Event # type: ignore
from textual.message import Message # type: ignore
from textual.message_pump import log # type: ignore
from di import Container
from di.depe... | [
"di.dependant.Dependant",
"textual.message_pump.log",
"di.Container"
] | [((524, 535), 'di.Container', 'Container', ([], {}), '()\n', (533, 535), False, 'from di import Container\n'), ((847, 897), 'textual.message_pump.log', 'log', (['event', '""">>>"""', 'self'], {'verbosity': 'event.verbosity'}), "(event, '>>>', self, verbosity=event.verbosity)\n", (850, 897), False, 'from textual.message... |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# inv.reportunknownsummary
# ---------------------------------------------------------------------
# Copyright (C) 2007-2013 The NOC Project
# See LICENSE for details
# -------------------------------------------------------... | [
"noc.lib.app.simplereport.TableColumn",
"noc.core.translation.ugettext",
"noc.inv.models.unknownmodel.UnknownModel._get_collection"
] | [((575, 602), 'noc.core.translation.ugettext', '_', (['"""Unknown Models Summary"""'], {}), "('Unknown Models Summary')\n", (576, 602), True, 'from noc.core.translation import ugettext as _\n'), ((714, 744), 'noc.inv.models.unknownmodel.UnknownModel._get_collection', 'UnknownModel._get_collection', ([], {}), '()\n', (7... |
import pytest
import pemi
from pemi.fields import *
class TestSchema:
def test_create_schema_from_list(self):
'''
Creating a schema from a list of fields
'''
field1 = IntegerField('id')
field2 = StringField('name')
field3 = DateField('sell_at', format='%m/%d/%Y')
... | [
"pytest.raises",
"pemi.Schema"
] | [((338, 373), 'pemi.Schema', 'pemi.Schema', (['field1', 'field2', 'field3'], {}), '(field1, field2, field3)\n', (349, 373), False, 'import pemi\n'), ((791, 842), 'pemi.Schema', 'pemi.Schema', ([], {'id': 'field1', 'name': 'field2', 'sell_at': 'field3'}), '(id=field1, name=field2, sell_at=field3)\n', (802, 842), False, ... |
import peewee
import playhouse.pool
# This is just one example of one of the support databases
# see https://docs.peewee-orm.com/en/latest/peewee/database.html
db = peewee.MySQLDatabase()
conn = db.connection()
cursor = conn.cursor()
cursor.execute("sql") # $ getSql="sql"
cursor = db.cursor()
cursor.execute("sql") ... | [
"peewee.MySQLDatabase"
] | [((166, 188), 'peewee.MySQLDatabase', 'peewee.MySQLDatabase', ([], {}), '()\n', (186, 188), False, 'import peewee\n')] |
import requests
from requests.models import Response
from asyncio.queues import Queue
import asyncio
async def producer(queue: Queue, arg, callback):
result: Response
try:
result = await callback(arg)
await asyncio.sleep(0.2)
await queue.put(result.json())
except Exception as error:
... | [
"asyncio.Queue",
"asyncio.sleep",
"requests.get",
"asyncio.gather"
] | [((765, 780), 'asyncio.Queue', 'asyncio.Queue', ([], {}), '()\n', (778, 780), False, 'import asyncio\n'), ((557, 574), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (569, 574), False, 'import requests\n'), ((1135, 1161), 'asyncio.gather', 'asyncio.gather', (['*producers'], {}), '(*producers)\n', (1149, 1161... |
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someon... | [
"numpy.eye",
"cv2.decomposeProjectionMatrix",
"numpy.sqrt",
"numpy.array",
"numpy.zeros",
"numpy.dot",
"numpy.matmul",
"numpy.linalg.norm"
] | [((5737, 5776), 'cv2.decomposeProjectionMatrix', 'cv2.decomposeProjectionMatrix', (['proj_mat'], {}), '(proj_mat)\n', (5766, 5776), False, 'import cv2\n'), ((6439, 6478), 'cv2.decomposeProjectionMatrix', 'cv2.decomposeProjectionMatrix', (['proj_mat'], {}), '(proj_mat)\n', (6468, 6478), False, 'import cv2\n'), ((6685, 6... |
#!/usr/bin/env python
import json
def main():
out = []
# The input file is generated using the Signal Identification Guide (sigidwiki.com)
# stored as the "db.csv" file from the Artemis 2 offline database (markslab.tk/project-artemis).
with open("db.csv", "r") as f:
for line in f:
... | [
"json.dump"
] | [((1066, 1099), 'json.dump', 'json.dump', (['out', 'f'], {'sort_keys': '(True)'}), '(out, f, sort_keys=True)\n', (1075, 1099), False, 'import json\n')] |
#!/usr/bin/env python3
import requests
def main():
requests.post(
"http://localhost:5601/api/sample_data/flights",
headers={"kbn-xsrf": "reporting"}
)
if __name__ == "__main__":
main()
| [
"requests.post"
] | [((58, 160), 'requests.post', 'requests.post', (['"""http://localhost:5601/api/sample_data/flights"""'], {'headers': "{'kbn-xsrf': 'reporting'}"}), "('http://localhost:5601/api/sample_data/flights', headers={\n 'kbn-xsrf': 'reporting'})\n", (71, 160), False, 'import requests\n')] |
from flask import Blueprint
from flask import flash
from flask import g
from flask import redirect
from flask import render_template
from flask import request
from flask import url_for
from werkzeug.exceptions import abort
from myapp.auth import login_required
from myapp.product import *
from myapp.user import *
from ... | [
"flask.render_template",
"flask.flash",
"myapp.db.get_db",
"flask.url_for",
"flask.request.form.get",
"flask.Blueprint"
] | [((349, 380), 'flask.Blueprint', 'Blueprint', (['"""purchase"""', '__name__'], {}), "('purchase', __name__)\n", (358, 380), False, 'from flask import Blueprint\n'), ((436, 444), 'myapp.db.get_db', 'get_db', ([], {}), '()\n', (442, 444), False, 'from myapp.db import get_db\n'), ((757, 816), 'flask.render_template', 'ren... |
# coding=utf-8
import configparser
import os
from random import randrange
from mysql.connector.errors import IntegrityError
from telegram.error import BadRequest
from telegram import (InlineKeyboardButton, InlineKeyboardMarkup,
ReplyKeyboardRemove, ForceReply,
KeyboardButton... | [
"configparser.ConfigParser",
"query_buffer.QueryBuffer",
"error_handler.handle_bot_not_admin",
"database_functions.update_settings",
"telegram.ReplyKeyboardMarkup",
"database_functions.choose_database",
"telegram.ReplyKeyboardRemove",
"planning_functions.GameNight",
"parse_strings.parse_array_to_csv... | [((2281, 2341), 'calendarkeyboard.telegramcalendar.process_calendar_selection', 'telegramcalendar.process_calendar_selection', (['update', 'context'], {}), '(update, context)\n', (2324, 2341), False, 'from calendarkeyboard import telegramcalendar\n'), ((7217, 7245), 'parse_strings.parse_csv_to_array', 'ps.parse_csv_to_... |
import sys
import time
import argparse
import os
import torch
from GPmodel.kernels.mixeddiffusionkernel import MixedDiffusionKernel
from GPmodel.models.gp_regression import GPRegression
from GPmodel.sampler.sample_mixed_posterior import posterior_sampling
from GPmodel.sampler.tool_partition import group_input
from ... | [
"experiments.test_functions.pressure_vessel_design.Pressure_Vessel_Design",
"GPmodel.kernels.mixeddiffusionkernel.MixedDiffusionKernel",
"torch.min",
"experiments.test_functions.speed_reducer.SpeedReducer",
"config.experiment_directory",
"GPmodel.sampler.sample_mixed_posterior.posterior_sampling",
"argp... | [((7822, 7927), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Hybrid Bayesian optimization using additive diffusion kernels"""'}), "(description=\n 'Hybrid Bayesian optimization using additive diffusion kernels')\n", (7845, 7927), False, 'import argparse\n'), ((1781, 1803), 'config.e... |
# In this example, we'll assume that we already have a trained TensorFlow model (we'll simply load a small existing model)
# and that we have a "test" dataset consisting of NumpyDataWrappers. We'll then produce two small evaluations using the
# metric_evaluation api
from mercury_ml.common.source_reading.disk import re... | [
"mercury_ml.common.CustomLabelMetrics.evaluate_numpy_auc",
"json.dumps",
"mercury_ml.common.CustomMetrics.evaluate_numpy_auc",
"mercury_ml.common.source_reading.disk.read_pandas_data_set",
"mercury_ml.tensorflow.prediction.predict",
"tensorflow.keras.models.load_model"
] | [((915, 952), 'tensorflow.keras.models.load_model', 'load_model', (['"""./example_data/model.h5"""'], {}), "('./example_data/model.h5')\n", (925, 952), False, 'from tensorflow.keras.models import load_model\n'), ((987, 1011), 'mercury_ml.tensorflow.prediction.predict', 'predict', (['data_set', 'model'], {}), '(data_set... |
import datetime
import logging
from typing import Any, Dict, Optional
from django.conf import settings
from django.db import transaction
from django.utils.timezone import now as timezone_now
from django.utils.translation import gettext as _
from zerver.actions.message_send import internal_send_stream_message
from zer... | [
"zerver.models.RealmAuditLog.objects.create",
"zerver.models.Realm",
"zerver.models.Realm.objects.filter",
"zerver.models.RealmUserDefault.objects.create",
"zerver.models.DefaultStream.objects.create",
"datetime.timedelta",
"logging.info",
"zerver.lib.bulk_create.create_users",
"zerver.lib.user_grou... | [((3115, 3171), 'zerver.actions.realm_settings.do_deactivate_realm', 'do_deactivate_realm', (['placeholder_realm'], {'acting_user': 'None'}), '(placeholder_realm, acting_user=None)\n', (3134, 3171), False, 'from zerver.actions.realm_settings import do_add_deactivated_redirect, do_change_realm_plan_type, do_deactivate_r... |
#!/usr/bin/env python3
"""
Author : NowHappy <<EMAIL>>
Date : 2021-10-13
Purpose: Ransom Note
"""
import argparse
import random
import os
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description='Ransom Note'... | [
"argparse.ArgumentParser",
"random.setstate",
"random.seed",
"random.getstate",
"os.path.isfile"
] | [((262, 373), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Ransom Note"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Ransom Note', formatter_class=argparse\n .ArgumentDefaultsHelpFormatter)\n", (285, 373), False, 'import argparse\n'), ((889, 911)... |
from django.http.response import HttpResponseRedirect
from django.shortcuts import get_object_or_404, redirect, render
from django.contrib.auth.decorators import login_required
from .models import *
from hoodapp.forms import *
from hoodapp.models import Profile
def index(request):
hood = NeighborHood.objects.al... | [
"django.shortcuts.render",
"hoodapp.models.Profile.objects.filter",
"django.http.response.HttpResponseRedirect",
"hoodapp.models.Profile.objects.get",
"django.shortcuts.get_object_or_404",
"django.shortcuts.redirect",
"django.contrib.auth.decorators.login_required",
"hoodapp.models.Profile.objects.all... | [((956, 1000), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/accounts/login/"""'}), "(login_url='/accounts/login/')\n", (970, 1000), False, 'from django.contrib.auth.decorators import login_required\n'), ((1441, 1485), 'django.contrib.auth.decorators.login_required', 'login_... |
from django.contrib import admin
from apps.notices.forms import NoticeForm
from apps.notices.models import Notice
class NoticeAdmin(admin.ModelAdmin):
list_display = ('id', 'created', 'updated', 'title',)
list_display_links = ('id', )
readonly_fields = ('id', 'created', 'updated')
fields = ('id', 'cr... | [
"django.contrib.admin.site.register"
] | [((406, 446), 'django.contrib.admin.site.register', 'admin.site.register', (['Notice', 'NoticeAdmin'], {}), '(Notice, NoticeAdmin)\n', (425, 446), False, 'from django.contrib import admin\n')] |
from datetime import datetime
import boto3
import json
import os
sns_client = boto3.client('sns')
###-------Global Var can be defined in Lambda global var and import with os.environ() method
#str_asg_name = 'limliht-asg,limliht2-asg' #simulate global var in lambda
#global_asg_name = str_asg_name.split(',')
#accountp... | [
"datetime.datetime.strptime",
"json.loads",
"json.dumps",
"boto3.client"
] | [((79, 98), 'boto3.client', 'boto3.client', (['"""sns"""'], {}), "('sns')\n", (91, 98), False, 'import boto3\n'), ((1673, 1686), 'json.dumps', 'json.dumps', (['e'], {}), '(e)\n', (1683, 1686), False, 'import json\n'), ((1704, 1721), 'json.loads', 'json.loads', (['str_e'], {}), '(str_e)\n', (1714, 1721), False, 'import ... |
# -*- coding: utf-8 -*-
"""
Author: shifulin
Email: <EMAIL>
"""
import time
import requests
from md import MD
URL = "http://optiontools.cn/option_info/{spot}"
HEADER = ['code', 'year', 'month', 'expiry_date', 'remainder_days', 'underlying', 'strike_price', 'option_type']
CTP_MD_API = MD('option')
def g... | [
"time.sleep",
"md.MD"
] | [((297, 309), 'md.MD', 'MD', (['"""option"""'], {}), "('option')\n", (299, 309), False, 'from md import MD\n'), ((1481, 1494), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (1491, 1494), False, 'import time\n')] |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 OpenStack, LLC.
# 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... | [
"re.match",
"os.path.basename",
"os.environ.copy"
] | [((2885, 2902), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (2900, 2902), False, 'import os\n'), ((1071, 1103), 'os.path.basename', 'os.path.basename', (['self.exec_path'], {}), '(self.exec_path)\n', (1087, 1103), False, 'import os\n'), ((2110, 2138), 're.match', 're.match', (["(pattern + '$')", 'arg'], {})... |
"""An attempt to implement a fishers exact test in numba.
Gave up after a day because some ofthe distributions required
are written in fortran in scipy.special.
Seems like soon numba-scipy may make this effort much easier.
For now will require use of cython"""
from numba import njit
import numpy as np
from scipy.speci... | [
"numpy.abs",
"numpy.log",
"numpy.asarray",
"numpy.iinfo",
"numpy.any",
"numpy.exp",
"numpy.isnan",
"scipy.special.comb",
"numpy.maximum"
] | [((1721, 1754), 'numpy.asarray', 'np.asarray', (['table'], {'dtype': 'np.int64'}), '(table, dtype=np.int64)\n', (1731, 1754), True, 'import numpy as np\n'), ((1905, 1918), 'numpy.any', 'np.any', (['(c < 0)'], {}), '(c < 0)\n', (1911, 1918), True, 'import numpy as np\n'), ((4534, 4551), 'numpy.iinfo', 'np.iinfo', (['np.... |
import numpy as np
from scipy.optimize import minimize
from os import path
import matplotlib.pyplot as plt
import sys
from MCPM import utils
from MCPM.cpmfitsource import CpmFitSource
def fun_3(inputs, cpm_source, t_E):
"""3-parameter function for optimisation; t_E - fixed"""
t_0 = inputs[0]
u_0 = in... | [
"numpy.abs",
"scipy.optimize.minimize",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.array",
"numpy.sum",
"MCPM.cpmfitsource.CpmFitSource",
"matplotlib.pyplot.show"
] | [((1262, 1299), 'numpy.array', 'np.array', (['[7556.0, 0.14, 21.0, 300.0]'], {}), '([7556.0, 0.14, 21.0, 300.0])\n', (1270, 1299), True, 'import numpy as np\n'), ((1311, 1341), 'numpy.array', 'np.array', (['[7556.0, 0.1, 150.0]'], {}), '([7556.0, 0.1, 150.0])\n', (1319, 1341), True, 'import numpy as np\n'), ((1485, 154... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 31 13:54:38 2019
@author: yujijun
"""
from scipy.cluster.hierarchy import dendrogram, linkage,fcluster
def cluster(dist_mat, Distance, Method, n_cluster):
"""
This script is to generate a cluster result by scipy.cluster.hierarchy
P... | [
"scipy.cluster.hierarchy.fcluster",
"scipy.cluster.hierarchy.linkage"
] | [((770, 819), 'scipy.cluster.hierarchy.linkage', 'linkage', (['dist_mat'], {'metric': 'Distance', 'method': 'Method'}), '(dist_mat, metric=Distance, method=Method)\n', (777, 819), False, 'from scipy.cluster.hierarchy import dendrogram, linkage, fcluster\n'), ((837, 896), 'scipy.cluster.hierarchy.fcluster', 'fcluster', ... |
"""
Copyright 2018 Ashar <<EMAIL>>
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... | [
"reader.FilePipeline",
"argparse.ArgumentParser"
] | [((765, 790), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (788, 790), False, 'import argparse\n'), ((3614, 3743), 'reader.FilePipeline', 'FilePipeline', ([], {'file_name': "arg_d['file_name']", 'encoding': "arg_d['encoding']", 'batch_size': "arg_d['batch_size']", 'epoch': "arg_d['epochs']"})... |
import torch
def scal(a, f):
return torch.sum(a * f, dim=1)
def check_cost_consistency(x, y, C):
mask = (
(x.size()[0] == C.size()[0])
& (x.size()[1] == C.size()[1])
& (y.size()[2] == C.size()[2])
)
if not mask:
raise Exception(
"Dimension of cost C incons... | [
"torch.distributions.uniform.Uniform",
"torch.distributions.normal.Normal",
"torch.sum",
"torch.einsum",
"torch.bmm",
"torch.distributions.exponential.Exponential",
"torch.Size",
"torch.ones"
] | [((42, 65), 'torch.sum', 'torch.sum', (['(a * f)'], {'dim': '(1)'}), '(a * f, dim=1)\n', (51, 65), False, 'import torch\n'), ((2505, 2553), 'torch.distributions.exponential.Exponential', 'torch.distributions.exponential.Exponential', (['(1.0)'], {}), '(1.0)\n', (2548, 2553), False, 'import torch\n'), ((2646, 2691), 'to... |
from Sudoku import solveSudoku
from WebHandler import WebHandler, Difficulty
from random import randint, random
from WebSudokuSolver import WebSudokuSolver
if __name__ == '__main__':
solver = WebSudokuSolver()
solver.handler.signIn()
for i in range(253):
try:
solver.solve(Difficulty.Eas... | [
"random.randint",
"WebSudokuSolver.WebSudokuSolver"
] | [((197, 214), 'WebSudokuSolver.WebSudokuSolver', 'WebSudokuSolver', ([], {}), '()\n', (212, 214), False, 'from WebSudokuSolver import WebSudokuSolver\n'), ((337, 352), 'random.randint', 'randint', (['(20)', '(80)'], {}), '(20, 80)\n', (344, 352), False, 'from random import randint, random\n')] |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests for coverage.numbits"""
import json
import sqlite3
from hypothesis import example, given, settings
from hypothesis.strategies import sets, integers
from... | [
"hypothesis.example",
"sqlite3.connect",
"coverage.numbits.num_in_numbits",
"hypothesis.strategies.integers",
"coverage.backward.byte_to_int",
"coverage.numbits.numbits_to_nums",
"coverage.numbits.nums_to_numbits",
"hypothesis.strategies.sets",
"coverage.numbits.register_sqlite_functions",
"hypoth... | [((669, 706), 'hypothesis.strategies.integers', 'integers', ([], {'min_value': '(1)', 'max_value': '(9999)'}), '(min_value=1, max_value=9999)\n', (677, 706), False, 'from hypothesis.strategies import sets, integers\n'), ((726, 744), 'hypothesis.strategies.sets', 'sets', (['line_numbers'], {}), '(line_numbers)\n', (730,... |
# VMC on AWS Python library for PyVMC
################################################################################
### Copyright (C) 2019-2022 VMware, Inc. All rights reserved.
### SPDX-License-Identifier: BSD-2-Clause
################################################################################
import json
i... | [
"requests.get"
] | [((823, 875), 'requests.get', 'requests.get', (['myURL'], {'headers': 'myHeader', 'params': 'params'}), '(myURL, headers=myHeader, params=params)\n', (835, 875), False, 'import requests\n'), ((1451, 1488), 'requests.get', 'requests.get', (['myURL'], {'headers': 'myHeader'}), '(myURL, headers=myHeader)\n', (1463, 1488),... |