code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
import unittest
def find_duplicate(int_list):
# Find a number that appears more than once ... in O(n) time
my_dict = {}
for i in int_list:
if i in my_dict:
my_dict[i] +=1
else:
my_dict[i] = 1
for num, count in my_dict.items():
if count > 1:... | [
"unittest.main"
] | [((986, 1012), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (999, 1012), False, 'import unittest\n')] |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"googlecloudsdk.core.properties.VALUES.core.project.GetOrFail",
"googlecloudsdk.calliope.exceptions.RequiredArgumentException",
"googlecloudsdk.calliope.base.ReleaseTracks"
] | [((858, 901), 'googlecloudsdk.calliope.base.ReleaseTracks', 'base.ReleaseTracks', (['base.ReleaseTrack.ALPHA'], {}), '(base.ReleaseTrack.ALPHA)\n', (876, 901), False, 'from googlecloudsdk.calliope import base\n'), ((3699, 3875), 'googlecloudsdk.calliope.exceptions.RequiredArgumentException', 'exceptions.RequiredArgumen... |
#------------------------------------------------------------------------------
# bind_insert.py (Section 4.3)
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Copyright 2017, 2018, Oracle and/or its affili... | [
"cx_Oracle.connect"
] | [((508, 570), 'cx_Oracle.connect', 'cx_Oracle.connect', (['db_config.user', 'db_config.pw', 'db_config.dsn'], {}), '(db_config.user, db_config.pw, db_config.dsn)\n', (525, 570), False, 'import cx_Oracle\n')] |
# coding: utf-8
"""
Hydrogen Atom API
The Hydrogen Atom API # noqa: E501
OpenAPI spec version: 1.7.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility libr... | [
"six.iteritems",
"nucleus_api.api_client.ApiClient"
] | [((2862, 2893), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (2875, 2893), False, 'import six\n'), ((6908, 6939), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (6921, 6939), False, 'import six\n'), ((11002, 11033), 'six.iteritems', 'six.it... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
created by Halo 2020/11/16 15:32
"""
import torch
from torch import nn
def corr2d(X, K):
h, w = K.shape
Y = torch.zeros((X.shape[0] - h + 1, X.shape[1] - w + 1))
for i in range(Y.shape[0]):
for j in range(Y.shape[1]):
Y[i, j] = (X[i:i ... | [
"torch.zeros",
"torch.ones",
"torch.randn",
"torch.tensor"
] | [((364, 411), 'torch.tensor', 'torch.tensor', (['[[0, 1, 2], [3, 4, 5], [6, 7, 8]]'], {}), '([[0, 1, 2], [3, 4, 5], [6, 7, 8]])\n', (376, 411), False, 'import torch\n'), ((416, 446), 'torch.tensor', 'torch.tensor', (['[[0, 1], [2, 3]]'], {}), '([[0, 1], [2, 3]])\n', (428, 446), False, 'import torch\n'), ((763, 779), 't... |
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
import numpy as np
import os
import re
import subprocess
import sys
if not os.path.exists("./twist"):
print("Error: Please execute `make` to produce the `twist` binary first.")
sys.exit(1)
if len(sys.argv) < 2:
print(... | [
"numpy.std",
"os.path.exists",
"numpy.mean",
"numpy.arange",
"numpy.array",
"matplotlib.ticker.PercentFormatter",
"re.search",
"matplotlib.pyplot.subplots",
"sys.exit"
] | [((1931, 1950), 'numpy.arange', 'np.arange', (['(4)', '(N + 1)'], {}), '(4, N + 1)\n', (1940, 1950), True, 'import numpy as np\n'), ((1968, 2003), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(2)'], {'figsize': '(15, 7)'}), '(1, 2, figsize=(15, 7))\n', (1980, 2003), True, 'import matplotlib.pyplot as plt\n')... |
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Created By : <NAME>
# version ='1.0'
# ---------------------------------------------------------------------------
""" Spatial AI Assignment"""
# -----------------------------------------------------------------... | [
"argparse.ArgumentParser",
"torch.load",
"PIL.Image.open",
"torchvision.models.detection.fasterrcnn_resnet50_fpn",
"torch.cuda.is_available",
"torch.device",
"os.path.join",
"torchvision.transforms.ToTensor"
] | [((775, 844), 'torchvision.models.detection.fasterrcnn_resnet50_fpn', 'torchvision.models.detection.fasterrcnn_resnet50_fpn', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (827, 844), False, 'import torchvision\n'), ((1791, 1816), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1814, 1... |
#!/usr/bin/python3
"""Solution for day 24 of Advent of Code 2016.
Another day, another breadth-first search! I split this problem into two stages: first, computing the distance
between every combination of points in the maze, and, second, finding the shortest route using those paths.
Finding the distances is just a ... | [
"itertools.combinations",
"itertools.permutations",
"itertools.chain"
] | [((3107, 3141), 'itertools.permutations', 'itertools.permutations', (['points[1:]'], {}), '(points[1:])\n', (3129, 3141), False, 'import itertools\n'), ((3054, 3087), 'itertools.combinations', 'itertools.combinations', (['points', '(2)'], {}), '(points, 2)\n', (3076, 3087), False, 'import itertools\n'), ((2944, 2969), ... |
# Copyright(c) 2016, The f-scLVM developers (<NAME>, <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 la... | [
"scipy.outer",
"logging.debug",
"numpy.random.random_sample",
"logging.warn",
"scipy.eye",
"scipy.ones",
"scipy.special.psi",
"time.time",
"scipy.log",
"logging.info",
"scipy.special.digamma",
"numpy.random.standard_normal",
"numpy.random.randint",
"scipy.isnan",
"scipy.zeros",
"scipy.... | [((852, 868), 'scipy.log', 'S.log', (['(x + 1e-10)'], {}), '(x + 1e-10)\n', (857, 868), True, 'import scipy as S\n'), ((1111, 1144), 'logging.warn', 'L.warn', (['"""Entropy not implemented"""'], {}), "('Entropy not implemented')\n", (1117, 1144), True, 'import logging as L\n'), ((1244, 1275), 'logging.warn', 'L.warn', ... |
from django.shortcuts import render
from django.http import HttpResponse
from django.views import View
from .models import Book
class AnotherClass(View):
books = Book.objects.get(id=2)
#for i in books:
output = books.title
def get(self, request):
return HttpResponse(self.output)
def first(re... | [
"django.http.HttpResponse"
] | [((339, 379), 'django.http.HttpResponse', 'HttpResponse', (['"""First message from views"""'], {}), "('First message from views')\n", (351, 379), False, 'from django.http import HttpResponse\n'), ((281, 306), 'django.http.HttpResponse', 'HttpResponse', (['self.output'], {}), '(self.output)\n', (293, 306), False, 'from ... |
"""
Example of how predicted images can be converted into an H5 file. Notice that,
connected components is applied to label different mitochondria to match instance
segmentation problem.
You should modify the following variables:
- pred_dir : path to the directory from which the images will be read
- h5file_n... | [
"h5py.File",
"scipy.ndimage.label",
"os.path.join",
"os.walk"
] | [((1508, 1533), 'scipy.ndimage.label', 'ndimage.label', (['pred_stack'], {}), '(pred_stack)\n', (1521, 1533), False, 'from scipy import ndimage\n'), ((1649, 1676), 'h5py.File', 'h5py.File', (['h5file_name', '"""w"""'], {}), "(h5file_name, 'w')\n", (1658, 1676), False, 'import h5py\n'), ((1266, 1293), 'os.path.join', 'o... |
"""
A simple wrapper for writing tarballs as a stream.
"""
import logging
import os
import tarfile
from galaxy.exceptions import ObjectNotFound
from .path import safe_walk
log = logging.getLogger(__name__)
class StreamBall:
def __init__(self, mode, members=None):
self.members = members
if membe... | [
"os.unlink",
"os.path.basename",
"os.path.isfile",
"os.rmdir",
"os.path.join",
"logging.getLogger"
] | [((181, 208), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (198, 208), False, 'import logging\n'), ((2352, 2374), 'os.path.basename', 'os.path.basename', (['path'], {}), '(path)\n', (2368, 2374), False, 'import os\n'), ((1607, 1628), 'os.unlink', 'os.unlink', (['self._tmpf'], {}), '(sel... |
import numpy as np
import pytest
from skits.feature_extraction import (AutoregressiveTransformer,
SeasonalTransformer,
IntegratedTransformer,
TrendTransformer,
Rolling... | [
"skits.feature_extraction.AutoregressiveTransformer",
"numpy.allclose",
"skits.feature_extraction.FourierTransformer",
"numpy.isnan",
"skits.feature_extraction.SeasonalTransformer",
"numpy.array",
"numpy.arange",
"numpy.linspace",
"skits.feature_extraction.IntegratedTransformer",
"skits.feature_ex... | [((555, 607), 'skits.feature_extraction.AutoregressiveTransformer', 'AutoregressiveTransformer', ([], {'num_lags': '(2)', 'pred_stride': '(1)'}), '(num_lags=2, pred_stride=1)\n', (580, 607), False, 'from skits.feature_extraction import AutoregressiveTransformer, SeasonalTransformer, IntegratedTransformer, TrendTransfor... |
import discord
from discord.ext import commands
from util import add_commands
from datetime import datetime
import os
import random
from keep_alive import keep_alive
TOKEN = os.getenv("token")
bot = commands.Bot(command_prefix=".kento ")
bot2 = commands.Bot(command_prefix=".ronak ")
@bot2.command()
async def congrats... | [
"keep_alive.keep_alive",
"discord.File",
"random.choice",
"datetime.datetime.now",
"datetime.datetime",
"util.add_commands",
"discord.ext.commands.Bot",
"os.getenv",
"os.listdir"
] | [((175, 193), 'os.getenv', 'os.getenv', (['"""token"""'], {}), "('token')\n", (184, 193), False, 'import os\n'), ((200, 238), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': '""".kento """'}), "(command_prefix='.kento ')\n", (212, 238), False, 'from discord.ext import commands\n'), ((246, 284), 'dis... |
""" Defines the User repository """
from models import Notation
from models import db
from sqlalchemy import func
class PredictionRepository:
"""The repository for the notation average truc"""
@staticmethod
def get(user_first_name,user_last_name):
def similarities(user1_first_name,user1_last_nam... | [
"models.db.session.query",
"sqlalchemy.func.avg"
] | [((1764, 1802), 'models.db.session.query', 'db.session.query', (['Notation.movie_title'], {}), '(Notation.movie_title)\n', (1780, 1802), False, 'from models import db\n'), ((1858, 1896), 'models.db.session.query', 'db.session.query', (['Notation.movie_title'], {}), '(Notation.movie_title)\n', (1874, 1896), False, 'from... |
from allauth.socialaccount import providers
from allauth.socialaccount.models import SocialApp
from users.templatetags.user_tags import available
from . import UsersTestBase
class TestAvailableSocialApps(UsersTestBase):
def test_empty(self):
all_providers = providers.registry.get_list()
availabl... | [
"allauth.socialaccount.providers.registry.get_list",
"users.templatetags.user_tags.available",
"allauth.socialaccount.models.SocialApp.objects.create"
] | [((274, 303), 'allauth.socialaccount.providers.registry.get_list', 'providers.registry.get_list', ([], {}), '()\n', (301, 303), False, 'from allauth.socialaccount import providers\n'), ((334, 358), 'users.templatetags.user_tags.available', 'available', (['all_providers'], {}), '(all_providers)\n', (343, 358), False, 'f... |
# SPDX-License-Identifier: MIT
# Copyright (c) 2019-2021 The Pybricks Authors
import asyncio
import hashlib
import io
import json
import logging
import os
import platform
import struct
import sys
import zipfile
from collections import namedtuple
from typing import BinaryIO, Dict, List, Optional, Tuple, Union
import s... | [
"io.BytesIO",
"zipfile.ZipFile",
"struct.unpack",
"semver.compare",
"struct.pack",
"struct.calcsize",
"tqdm.contrib.logging.logging_redirect_tqdm",
"hashlib.sha256",
"tqdm.auto.tqdm",
"collections.namedtuple",
"platform.system",
"logging.getLogger"
] | [((655, 682), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (672, 682), False, 'import logging\n'), ((1365, 1394), 'zipfile.ZipFile', 'zipfile.ZipFile', (['firmware_zip'], {}), '(firmware_zip)\n', (1380, 1394), False, 'import zipfile\n'), ((3672, 3699), 'struct.pack', 'struct.pack', (['"... |
import io
import re
from setuptools import setup
with io.open('amitypes/__init__.py', 'rt', encoding='utf8') as f:
version = re.search(r'__version__ = \'(.*?)\'', f.read()).group(1)
setup(
name="amityping",
version=version,
description='LCLS analysis monitoring type annotations',
long_description=... | [
"setuptools.setup",
"io.open"
] | [((188, 1087), 'setuptools.setup', 'setup', ([], {'name': '"""amityping"""', 'version': 'version', 'description': '"""LCLS analysis monitoring type annotations"""', 'long_description': '"""The package used at LCLS-II for type annotations for online analysis monitoring"""', 'author': '"""<NAME>, <NAME>"""', 'author_emai... |
# Generated by Django 2.2.4 on 2019-09-01 12:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("admin", "0042_auto_20190811_1442")]
operations = [
migrations.AddField(
model_name="application",
name="created_at",
... | [
"django.db.models.DateField"
] | [((326, 364), 'django.db.models.DateField', 'models.DateField', ([], {'default': '"""2019-01-01"""'}), "(default='2019-01-01')\n", (342, 364), False, 'from django.db import migrations, models\n')] |
# -*- coding: utf-8 -*-
# StreamOnDemand Community Edition - Kodi Addon
# ------------------------------------------------------------
# streamondemand.- XBMC Plugin
# Canale cinemasubito
# http://www.mimediacenter.info/foro/viewforum.php?f=36
# ------------------------------------------------------------
import binasc... | [
"core.scrapertools.find_multiple_matches",
"core.scrapertools.find_single_match",
"core.item.Item",
"platformcode.logger.error",
"lib.jscrypto.decode",
"core.httptools.downloadpage",
"urlparse.urljoin",
"platformcode.logger.info",
"binascii.unhexlify",
"sys.exc_info",
"core.scrapertools.get_matc... | [((1084, 1135), 'platformcode.logger.info', 'logger.info', (['"""streamondemand.cinemasubito mainlist"""'], {}), "('streamondemand.cinemasubito mainlist')\n", (1095, 1135), False, 'from platformcode import logger\n'), ((2807, 2882), 'platformcode.logger.info', 'logger.info', (["('streamondemand.cinemasubito ' + item.ur... |
from typing import List, Union
from flask import Blueprint, render_template, make_response, current_app as app
from webapp.forms import MessageForm
from webapp.managers import AppDbContext, TaskStatusEnum
from webapp.models import Group, Task, TaskStatus, Variant
from webapp.utils import handle_errors, use_session
from... | [
"flask.request.headers.getlist",
"io.StringIO",
"flask.Blueprint",
"csv.writer",
"webapp.managers.TaskStatusEnum",
"webapp.utils.use_session",
"flask.render_template",
"flask.make_response",
"webapp.utils.handle_errors",
"webapp.forms.MessageForm",
"webapp.managers.AppDbContext"
] | [((411, 439), 'flask.Blueprint', 'Blueprint', (['"""views"""', '__name__'], {}), "('views', __name__)\n", (420, 439), False, 'from flask import Blueprint, render_template, make_response, current_app as app\n'), ((996, 1011), 'webapp.utils.handle_errors', 'handle_errors', ([], {}), '()\n', (1009, 1011), False, 'from web... |
import pytest
from baserow_premium.views.handler import get_rows_grouped_by_single_select_field
@pytest.mark.django_db
def test_get_rows_grouped_by_single_select_field(
premium_data_fixture, django_assert_num_queries
):
table = premium_data_fixture.create_database_table()
text_field = premium_data_fixtur... | [
"baserow_premium.views.handler.get_rows_grouped_by_single_select_field"
] | [((2670, 2758), 'baserow_premium.views.handler.get_rows_grouped_by_single_select_field', 'get_rows_grouped_by_single_select_field', (['table', 'single_select_field'], {'default_limit': '(1)'}), '(table, single_select_field,\n default_limit=1)\n', (2709, 2758), False, 'from baserow_premium.views.handler import get_ro... |
# Copyright (c) 2017, <NAME>
from html import escape
import io
import os
import yaml
from yaml.scanner import ScannerError
from handroll import signals
from handroll.exceptions import AbortError
from handroll.i18n import _
class FrontmatterComposerMixin(object):
"""Mixin the ability to extract frontmatter from... | [
"yaml.load",
"handroll.signals.frontmatter_loaded.send",
"handroll.i18n._",
"io.open",
"html.escape"
] | [((528, 571), 'io.open', 'io.open', (['source_file', '"""r"""'], {'encoding': '"""utf-8"""'}), "(source_file, 'r', encoding='utf-8')\n", (535, 571), False, 'import io\n'), ((1841, 1875), 'yaml.load', 'yaml.load', (['content[max_splits - 1]'], {}), '(content[max_splits - 1])\n', (1850, 1875), False, 'import yaml\n'), ((... |
#!/usr/bin/env python
"""
Orders the learning of items based on, at each step, assigning a score to each
unknown item and learning the highest scoring item next before recalculating
the scores all over again with the remaining items.
The score is currently the sum of 1 / 2 ** number_of_items_missing_from_target
for e... | [
"collections.defaultdict"
] | [((881, 897), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (892, 897), False, 'from collections import defaultdict\n'), ((1022, 1038), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (1033, 1038), False, 'from collections import defaultdict\n'), ((1318, 1334), 'collections.def... |
from __future__ import absolute_import, division, print_function
def test():
from dials.algorithms.profile_model.modeller import (
MultiExpProfileModeller,
ProfileModellerIface,
)
from dials.array_family import flex
class Modeller(ProfileModellerIface):
def __init__(self, inde... | [
"dials.array_family.flex.int",
"dials.algorithms.profile_model.modeller.MultiExpProfileModeller",
"dials.array_family.flex.reflection_table"
] | [((1017, 1040), 'dials.array_family.flex.reflection_table', 'flex.reflection_table', ([], {}), '()\n', (1038, 1040), False, 'from dials.array_family import flex\n'), ((1065, 1075), 'dials.array_family.flex.int', 'flex.int', ([], {}), '()\n', (1073, 1075), False, 'from dials.array_family import flex\n'), ((1240, 1265), ... |
"""Test Blend modes."""
import unittest
from coloraide import Color
from . import util
# Colors that produce pretty distinct results
REDISH = '#fc3d99'
BLUISH = '#07c7ed'
YELLOWISH = '#f5d311'
class TestBlendModes(util.ColorAsserts, unittest.TestCase):
"""Test blend modes."""
def test_alpha(self):
"... | [
"coloraide.Color"
] | [((464, 477), 'coloraide.Color', 'Color', (['"""blue"""'], {}), "('blue')\n", (469, 477), False, 'from coloraide import Color\n'), ((613, 643), 'coloraide.Color', 'Color', (['"""color(srgb 0.5 0 0.5)"""'], {}), "('color(srgb 0.5 0 0.5)')\n", (618, 643), False, 'from coloraide import Color\n'), ((794, 832), 'coloraide.C... |
import jwt
from fence.resources.google.utils import (
get_linked_google_account_email,
get_linked_google_account_exp,
)
from fence.models import UserGoogleAccount, UserGoogleAccountToProxyGroup
def test_google_id_token_not_linked(oauth_test_client):
"""
Test google email and link expiration are in id... | [
"fence.models.UserGoogleAccount",
"fence.resources.google.utils.get_linked_google_account_exp",
"fence.models.UserGoogleAccountToProxyGroup",
"fence.resources.google.utils.get_linked_google_account_email",
"jwt.decode"
] | [((483, 524), 'jwt.decode', 'jwt.decode', (['tokens.id_token'], {'verify': '(False)'}), '(tokens.id_token, verify=False)\n', (493, 524), False, 'import jwt\n'), ((1016, 1072), 'fence.models.UserGoogleAccount', 'UserGoogleAccount', ([], {'email': 'google_account', 'user_id': 'user_id'}), '(email=google_account, user_id=... |
import os
import pandas as pd
import numpy as np
import xgboost as xgb
import logging, pickle
import joblib
from sklearn.svm import SVR, LinearSVR, NuSVR
from sklearn.neural_network import MLPRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import ElasticNetCV
from Fuzzy_clustering... | [
"pickle.dump",
"numpy.logspace",
"logging.Formatter",
"numpy.mean",
"pickle.load",
"xgboost.XGBRegressor",
"os.path.join",
"sklearn.linear_model.ElasticNetCV",
"Fuzzy_clustering.version3.ClusterCombineManager.GA_param_search.EvolutionaryAlgorithmSearchCV",
"sklearn.svm.NuSVR",
"os.path.exists",
... | [((970, 999), 'os.path.basename', 'os.path.basename', (['cluster_dir'], {}), '(cluster_dir)\n', (986, 999), False, 'import os\n'), ((1017, 1088), 'logging.getLogger', 'logging.getLogger', (["('deap_train_' + '_' + self.model_type + self.cluster)"], {}), "('deap_train_' + '_' + self.model_type + self.cluster)\n", (1034,... |
import random
import time
from os import system, name
def clear():
if name == 'nt':
_ = system('cls')
#initiate score variables
player_score = 0
comp_score = 0
while 1 == 1:
#randomly chooses rock, paper, or scissors for the computer
comp = random.choice([1, 2, 3])
#prompt the user to choos... | [
"os.system",
"random.choice",
"time.sleep"
] | [((266, 290), 'random.choice', 'random.choice', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (279, 290), False, 'import random\n'), ((1743, 1756), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1753, 1756), False, 'import time\n'), ((102, 115), 'os.system', 'system', (['"""cls"""'], {}), "('cls')\n", (108, 115), False, ... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
------------------------------------------... | [
"datahub.access.exceptions.GeogAreaError",
"common.transaction.auto_meta_sync",
"datahub.access.handlers.meta.MetaHandler.query_target_tags_exist_by_id",
"common.meta.common.delete_tag_to_target",
"common.meta.common.create_tag_to_target",
"django.utils.translation.ugettext",
"datahub.access.handlers.me... | [((2795, 2824), 'datahub.access.handlers.meta.MetaHandler.query_geog_tags', 'MetaHandler.query_geog_tags', ([], {}), '()\n', (2822, 2824), False, 'from datahub.access.handlers.meta import MetaHandler\n'), ((4043, 4153), 'datahub.access.handlers.meta.MetaHandler.query_target_tags_exist_by_id', 'MetaHandler.query_target_... |
#!python
# -*- coding: utf-8 -*-
# (C) 2013 <NAME>
import sys
import imp
try:
reload # Python 2.7
except NameError:
try:
from importlib import reload # Python 3.4+
except ImportError:
from imp import reload # Python 3.0 - 3.3
#imp.reload(sys)
#sys.setdefaultencoding('utf-8')
from sys im... | [
"cmd.Cmd.__init__",
"sys.exit"
] | [((668, 686), 'cmd.Cmd.__init__', 'Cmd.__init__', (['self'], {}), '(self)\n', (680, 686), False, 'from cmd import Cmd\n'), ((932, 939), 'sys.exit', 'exit', (['(0)'], {}), '(0)\n', (936, 939), False, 'from sys import argv, exit, stdin\n'), ((1250, 1257), 'sys.exit', 'exit', (['(0)'], {}), '(0)\n', (1254, 1257), False, '... |
from setuptools import setup, find_packages
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name="jondis",
version="0.1",
description="Redis pool for HA redis clusters",
long_description=read('README.md'),
author="<NAME>",
author_em... | [
"os.path.dirname",
"setuptools.find_packages"
] | [((938, 953), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (951, 953), False, 'from setuptools import setup, find_packages\n'), ((101, 126), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (116, 126), False, 'import os\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
sys.path.append('..')
from template import *
datanum = 3
U = []
tf = []
fin = open('./data.txt', 'r')
d = readpart(fin, 1, need=0b100)[0][0]
s = readpart(fin, 1, need=0b100)[0][0]
for i in range(datanum):
U.append(readpart(fin, 1, need=0b100)[0][0])
... | [
"sys.path.append"
] | [((59, 80), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (74, 80), False, 'import sys\n')] |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# written by <NAME>
# 2016-06-01
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
# Load data ===================================================================
# data = np.load("2016-05-31.npz")
# data = np.load("2016-06-02.npz")
# data = np.load... | [
"pandas.DataFrame",
"numpy.load",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((426, 454), 'numpy.load', 'np.load', (['"""2016-07-12_40.npz"""'], {}), "('2016-07-12_40.npz')\n", (433, 454), True, 'import numpy as np\n'), ((501, 531), 'pandas.DataFrame', 'pd.DataFrame', (['T'], {'index': 'sizeset'}), '(T, index=sizeset)\n', (513, 531), True, 'import pandas as pd\n'), ((965, 979), 'matplotlib.pyp... |
#!/usr/bin/env python3
from utilities.make_client import client
hostip = '10.132.0.19'
username = 'admin'
password = '<PASSWORD>'
api = client(hostip,username,password)
inventory = {}
entry = api.arrays.get()
print(entry)
print(entry.attrs.get('id'))
x = api.arrays.get(entry.attrs.get('id')).attrs
print(x)
inve... | [
"utilities.make_client.client"
] | [((140, 174), 'utilities.make_client.client', 'client', (['hostip', 'username', 'password'], {}), '(hostip, username, password)\n', (146, 174), False, 'from utilities.make_client import client\n')] |
# -*- coding: utf-8 -*-
"""HTTP File cache and helpers"""
__author__ = "fraser"
import logging
import sqlite3
import time
from datetime import datetime, timedelta, tzinfo
from os import path
import xbmc
import xbmcaddon
import xbmcvfs
try:
import _pickle as cpickle
except ImportError:
import cPickle as cpi... | [
"time.strptime",
"xbmcaddon.Addon",
"os.path.dirname",
"cPickle.dumps",
"xbmcvfs.exists",
"datetime.datetime.strptime",
"datetime.timedelta",
"sqlite3.connect",
"sqlite3.enable_callback_tracebacks",
"os.path.join",
"logging.getLogger",
"sqlite3.register_converter"
] | [((335, 362), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (352, 362), False, 'import logging\n'), ((418, 435), 'xbmcaddon.Addon', 'xbmcaddon.Addon', ([], {}), '()\n', (433, 435), False, 'import xbmcaddon\n'), ((545, 585), 'os.path.join', 'path.join', (['ADDON_PROFILE', '"""cache.sqlite... |
from rest_framework.serializers import Serializer, CharField
from pss_project.api.serializers.rest.metadata.MetadataSerializer import MetadataSerializer
from pss_project.api.serializers.fields.UnixEpochDatetimeField import UnixEpochDateTimeField
from pss_project.api.serializers.rest.parameters.OLTPBenchParametersSerial... | [
"pss_project.api.models.rest.OLTPBenchRest.OLTPBenchRest",
"pss_project.api.serializers.rest.metrics.OLTPBenchMetricsSerializer.OLTPBenchMetricsSerializer",
"rest_framework.serializers.CharField",
"pss_project.api.serializers.rest.parameters.OLTPBenchParametersSerializer.OLTPBenchParametersSerializer",
"pss... | [((606, 626), 'pss_project.api.serializers.rest.metadata.MetadataSerializer.MetadataSerializer', 'MetadataSerializer', ([], {}), '()\n', (624, 626), False, 'from pss_project.api.serializers.rest.metadata.MetadataSerializer import MetadataSerializer\n'), ((643, 667), 'pss_project.api.serializers.fields.UnixEpochDatetime... |
# Copyright Epic Games, Inc. All Rights Reserved.
import bpy
import importlib
from . import operators
from . import properties
from .dependencies import remote_execution
from .ui import header_menu, addon_preferences, importer
from .functions import export, unreal, validations, utilities,parsejson
# NOTE: The blender... | [
"bpy.app.handlers.save_pre.append",
"bpy.app.handlers.save_pre.remove",
"bpy.app.handlers.load_post.remove",
"importlib.reload",
"bpy.utils.unregister_class",
"bpy.app.timers.register",
"bpy.app.handlers.load_post.append",
"bpy.utils.register_class"
] | [((1785, 1833), 'bpy.app.timers.register', 'bpy.app.timers.register', (['utilities.addon_enabled'], {}), '(utilities.addon_enabled)\n', (1808, 1833), False, 'import bpy\n'), ((1923, 1981), 'bpy.app.handlers.load_post.append', 'bpy.app.handlers.load_post.append', (['utilities.setup_project'], {}), '(utilities.setup_proj... |
from feature_extraction import Fourier
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
data_2 = pd.read_csv('./data/interim/ascan1600.dat', sep="\s+|\s\s",
header=None, error_bad_lines=False, verbose=False, lineterminator='\n')
# data_2 = pd.read_csv('../data/interim/ascan0001.dat... | [
"pandas.read_csv",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"feature_extraction.Fourier"
] | [((121, 259), 'pandas.read_csv', 'pd.read_csv', (['"""./data/interim/ascan1600.dat"""'], {'sep': '"""\\\\s+|\\\\s\\\\s"""', 'header': 'None', 'error_bad_lines': '(False)', 'verbose': '(False)', 'lineterminator': '"""\n"""'}), "('./data/interim/ascan1600.dat', sep='\\\\s+|\\\\s\\\\s', header=None,\n error_bad_lines=F... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2018, <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 re... | [
"py2neo.ogm.Property",
"py2neo.ogm.RelatedTo",
"py2neo.ogm.RelatedFrom"
] | [((766, 776), 'py2neo.ogm.Property', 'Property', ([], {}), '()\n', (774, 776), False, 'from py2neo.ogm import GraphObject, Property, RelatedTo, RelatedFrom\n'), ((791, 801), 'py2neo.ogm.Property', 'Property', ([], {}), '()\n', (799, 801), False, 'from py2neo.ogm import GraphObject, Property, RelatedTo, RelatedFrom\n'),... |
"""
This module will be available in templates as ``u``.
This module is also used to lookup custom template context providers, i.e. functions
following a special naming convention which are called to update the template context
before rendering resource's detail or index views.
"""
from clld.db.meta import DBSession
f... | [
"clld.db.meta.DBSession.query"
] | [((418, 450), 'clld.db.meta.DBSession.query', 'DBSession.query', (['common.Language'], {}), '(common.Language)\n', (433, 450), False, 'from clld.db.meta import DBSession\n'), ((475, 504), 'clld.db.meta.DBSession.query', 'DBSession.query', (['common.Value'], {}), '(common.Value)\n', (490, 504), False, 'from clld.db.meta... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
"""
import numpy as np
from ..transformer import Transformer
class MaxIntensity(Transformer):
def _transform(self, array):
mask = np.logical_not(np.all(np.isclos... | [
"numpy.isclose",
"numpy.zeros",
"numpy.argmax"
] | [((382, 406), 'numpy.argmax', 'np.argmax', (['array'], {'axis': '(0)'}), '(array, axis=0)\n', (391, 406), True, 'import numpy as np\n'), ((452, 487), 'numpy.zeros', 'np.zeros', (['(1, n)'], {'dtype': 'array.dtype'}), '((1, n), dtype=array.dtype)\n', (460, 487), True, 'import numpy as np\n'), ((311, 355), 'numpy.isclose... |
#
# FreeRTOS BLE HAL V2.0.0
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# 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 wit... | [
"bleAdapter.bleAdapter.setDiscoveryFilter",
"bleAdapter.bleAdapter.stopDiscovery",
"testClass.runTest.checkProperties",
"testClass.runTest._simple_connect",
"bleAdapter.bleAdapter.connect",
"bleAdapter.bleAdapter.init",
"testClass.runTest.mainloop.run",
"bleAdapter.bleAdapter.disconnect",
"testClass... | [((2123, 2140), 'bleAdapter.bleAdapter.init', 'bleAdapter.init', ([], {}), '()\n', (2138, 2140), False, 'from bleAdapter import bleAdapter\n'), ((2153, 2199), 'securityAgent.createSecurityAgent', 'securityAgent.createSecurityAgent', ([], {'agent': 'agent'}), '(agent=agent)\n', (2186, 2199), False, 'import securityAgent... |
from meter.datasets.haa500_dataset import Haa500
haa = Haa500('/work/play0000/data/haa500', ['clip'], split='train', image_size=288, nframe=16, crop=1)
d = haa[0]
print(haa.qg.actions)
print(d["text"], d["label"])
print(d["action_labels"])
exit()
for i in range(10):
pass
for i in range(10):
f, w, l = haa.q... | [
"meter.datasets.haa500_dataset.Haa500"
] | [((56, 157), 'meter.datasets.haa500_dataset.Haa500', 'Haa500', (['"""/work/play0000/data/haa500"""', "['clip']"], {'split': '"""train"""', 'image_size': '(288)', 'nframe': '(16)', 'crop': '(1)'}), "('/work/play0000/data/haa500', ['clip'], split='train', image_size=\n 288, nframe=16, crop=1)\n", (62, 157), False, 'fr... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------
# Filename: event.py
# Purpose: plugin for reading and writing GridData object into various format
# Author: microquake development team
# Email: <EMAIL>
#
# Copyright (C) 2016 microquake development team
# --------------... | [
"sqlite3.connect",
"numpy.unique"
] | [((1318, 1351), 'sqlite3.connect', 'sqlite3.connect', (['"""example.sqlite"""'], {}), "('example.sqlite')\n", (1333, 1351), False, 'import sqlite3\n'), ((2791, 2807), 'numpy.unique', 'unique', (['stations'], {}), '(stations)\n', (2797, 2807), False, 'from numpy import unique\n')] |
"""
Generate all cycle-free allocations in a given undirected graph.
Author: <NAME>
Since: 2020-04
"""
import networkx as nx
from typing import *
Edge = Tuple[int]
Bundle = Set[Edge]
Allocation = List[Bundle]
from allocations import *
def no_cycles(bundle:Bundle, new_item:Edge)->bool:
"""
Implements a fe... | [
"networkx.has_path"
] | [((1270, 1321), 'networkx.has_path', 'nx.has_path', (['bundle_graph', 'new_item[0]', 'new_item[1]'], {}), '(bundle_graph, new_item[0], new_item[1])\n', (1281, 1321), True, 'import networkx as nx\n')] |
import argparse
from functools import partial
import document_tokenizer
import text_dataset
import word2vec_trainer
def get_options():
parser = argparse.ArgumentParser()
parser.add_argument("-o", "--output-model-path", default="model/word2vec.gensim.model")
parser.add_argument("--size", type=int, defaul... | [
"text_dataset.MARDDataset",
"functools.partial",
"argparse.ArgumentParser",
"document_tokenizer.NltkDocumentTokenizer",
"word2vec_trainer.train_word2vec_model",
"document_tokenizer.MecabDocumentTokenizer"
] | [((151, 176), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (174, 176), False, 'import argparse\n'), ((1359, 1394), 'text_dataset.MARDDataset', 'text_dataset.MARDDataset', (['tokenizer'], {}), '(tokenizer)\n', (1383, 1394), False, 'import text_dataset\n'), ((1416, 1456), 'functools.partial', '... |
import numpy as np
import os
import shutil
def Rfoil(coord_foil_name,foil_name,alpha,Re,Mach,Ncrit,obj):
#
## for function test
##alpha=7
##Re=1e6
##Mach=0
##Ncrit=9
##savepath='geo'
os.chdir('geo')
with open('rfoil.inp','w') as f:
f.write('load \n')
# f.write('airfoil.dat \n')
... | [
"numpy.size",
"numpy.count_nonzero",
"os.makedirs",
"numpy.sum",
"os.path.exists",
"os.system",
"numpy.isnan",
"numpy.min",
"numpy.max",
"numpy.array",
"os.chdir",
"shutil.move",
"os.listdir"
] | [((200, 215), 'os.chdir', 'os.chdir', (['"""geo"""'], {}), "('geo')\n", (208, 215), False, 'import os\n'), ((1455, 1489), 'os.system', 'os.system', (['"""rfoil.exe < rfoil.inp"""'], {}), "('rfoil.exe < rfoil.inp')\n", (1464, 1489), False, 'import os\n'), ((2903, 2918), 'os.listdir', 'os.listdir', (['"""."""'], {}), "('... |
"""Python Cookbook
Chapter 11, recipe 8, Spike.
Database hosting on orchestrate.io.
This is a technical spike to understand three of the service endpoints.
"""
from ch11_r08_load import log_data_iter
import urllib.request
import base64
service = "https://api.orchestrate.io"
api_key = "REDACTED"
def basic_header(us... | [
"base64.b64encode",
"json.loads",
"json.dumps"
] | [((424, 456), 'base64.b64encode', 'base64.b64encode', (['combined_bytes'], {}), '(combined_bytes)\n', (440, 456), False, 'import base64\n'), ((1081, 1097), 'json.loads', 'json.loads', (['body'], {}), '(body)\n', (1091, 1097), False, 'import json\n'), ((1720, 1736), 'json.loads', 'json.loads', (['body'], {}), '(body)\n'... |
from zookeeper import registry, HParams
import larq as lq
import tensorflow as tf
from larq_zoo import utils
@registry.register_model
def xnornet(hparams, input_shape, num_classes, input_tensor=None, include_top=True):
kwargs = dict(
kernel_quantizer=hparams.kernel_quantizer,
input_quantizer=hpara... | [
"tensorflow.clip_by_value",
"zookeeper.registry.register_hparams",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.MaxPool2D",
"larq_zoo.utils.download_pretrained_model",
"larq.layers.QuantConv2D",
"tensorflow.keras.layers.Flatten",
"tensorflow.keras.regularizers.l2",
"tensorflow.abs",
"... | [((3215, 3240), 'larq.utils.set_precision', 'lq.utils.set_precision', (['(1)'], {}), '(1)\n', (3237, 3240), True, 'import larq as lq\n'), ((3637, 3671), 'zookeeper.registry.register_hparams', 'registry.register_hparams', (['xnornet'], {}), '(xnornet)\n', (3662, 3671), False, 'from zookeeper import registry, HParams\n')... |
import argparse
from pathlib import Path
import tempfile
from allennlp.common.params import Params
from target_extraction.data_types import TargetTextCollection
from tdsa_augmentation.analysis.run_model import run_model
def parse_path(path_string: str) -> Path:
path_string = Path(path_string).resolve()
retur... | [
"tempfile.NamedTemporaryFile",
"argparse.ArgumentParser",
"target_extraction.data_types.TargetTextCollection.load_json",
"allennlp.common.params.Params.from_file",
"pathlib.Path"
] | [((4963, 4988), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4986, 4988), False, 'import argparse\n'), ((6091, 6123), 'allennlp.common.params.Params.from_file', 'Params.from_file', (['args.config_fp'], {}), '(args.config_fp)\n', (6107, 6123), False, 'from allennlp.common.params import Params... |
from parsec import ParseError
from predicates.state import State
from predicates import guards, actions
from model.operation import Transition
from model.model import the_model
from runner import ctrl_random
if __name__ == '__main__':
# run in terminal when venv is sourced: python3 -m model
try:
model ... | [
"runner.ctrl_random.run",
"model.model.the_model"
] | [((322, 333), 'model.model.the_model', 'the_model', ([], {}), '()\n', (331, 333), False, 'from model.model import the_model\n'), ((1116, 1133), 'runner.ctrl_random.run', 'ctrl_random.run', ([], {}), '()\n', (1131, 1133), False, 'from runner import ctrl_random\n')] |
###############################################################################
#
# imports and set up environment
#
###############################################################################
'''Defining the environment for this class'''
import argparse
import pandas as pd
import os
import matplotlib
matplotlib.... | [
"sklearn.preprocessing.StandardScaler",
"os.makedirs",
"argparse.ArgumentParser",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.close",
"datetime.datetime.now",
"matplotlib.pyplot.figure",
"matplotlib.use",
"sklearn.model_selection.StratifiedKFold",
"numpy.exp... | [((309, 330), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (323, 330), False, 'import matplotlib\n'), ((968, 1036), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""recursive feature elimination"""'}), "(description='recursive feature elimination')\n", (991, 1036),... |
__description___ = """
This page loads the data from the protein-data module as is used by both name.py and venus.py
global_settings is initialised in folder setup
"""
import os, json
from michelanglo_protein import ProteinCore, global_settings, Structure
from michelanglo_protein.generate import ProteinGatherer
impor... | [
"os.path.join",
"logging.getLogger"
] | [((336, 363), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (353, 363), False, 'import logging\n'), ((450, 514), 'os.path.join', 'os.path.join', (['global_settings.dictionary_folder', '"""organism.json"""'], {}), "(global_settings.dictionary_folder, 'organism.json')\n", (462, 514), False... |
###############################################################################
# PyDial: Multi-domain Statistical Spoken Dialogue System Software
###############################################################################
#
# Copyright 2015 - 2018
# Cambridge University Engineering Department Dialogue Systems Grou... | [
"utils.ContextLogger.getLogger",
"cedm.utils.DActEntity.DiaActEntity",
"policy.SummaryUtils.actionSpecificInformSummary",
"SummaryActionRel.SummaryActionRel"
] | [((1710, 1737), 'utils.ContextLogger.getLogger', 'ContextLogger.getLogger', (['""""""'], {}), "('')\n", (1733, 1737), False, 'from utils import ContextLogger\n'), ((2276, 2347), 'SummaryActionRel.SummaryActionRel', 'SummaryActionRel.SummaryActionRel', (['domainString', '(False)', 'self.useconfreq'], {}), '(domainString... |
# Generated by Django 2.1.7 on 2019-05-02 09:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('institution', '0025_merge_20190502_1009'),
]
operations = [
migrations.AlterField(
model_name='institution',
name='a... | [
"django.db.models.BooleanField",
"django.db.models.EmailField"
] | [((359, 428), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'verbose_name': '"""Allow RSE requests"""'}), "(default=False, verbose_name='Allow RSE requests')\n", (378, 428), False, 'from django.db import migrations, models\n'), ((565, 653), 'django.db.models.EmailField', 'models.Em... |
from collections import defaultdict
from time import ctime
from typing import Any, Dict, List, Tuple, Union
import emoji
import urwid
from zulipterminal.ui_tools.buttons import MenuButton
class WriteBox(urwid.Pile):
def __init__(self, view: Any) -> None:
super(WriteBox, self).__init__(self.main_view(Tru... | [
"zulipterminal.ui_tools.buttons.MenuButton",
"urwid.Text",
"urwid.connect_signal",
"urwid.Edit",
"time.ctime",
"urwid.LineBox",
"urwid.Columns",
"collections.defaultdict",
"urwid.AttrWrap",
"emoji.demojize"
] | [((452, 486), 'zulipterminal.ui_tools.buttons.MenuButton', 'MenuButton', (['u"""New Private Message"""'], {}), "(u'New Private Message')\n", (462, 486), False, 'from zulipterminal.ui_tools.buttons import MenuButton\n'), ((495, 563), 'urwid.connect_signal', 'urwid.connect_signal', (['private_button', '"""click"""', 'sel... |
import rospy
import sys
sys.path.append('../../')
from evaluation.eval_random_simulation.rand_eval_gpu import RandEvalGpu
from evaluation.eval_random_simulation.utility import *
def evaluate_ddpg(pos_start=0, pos_end=199, model_name='ddpg', save_dir='../saved_model/',
state_num=22, is_scale=True, is... | [
"sys.path.append",
"evaluation.eval_random_simulation.rand_eval_gpu.RandEvalGpu",
"rospy.init_node",
"argparse.ArgumentParser"
] | [((24, 49), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (39, 49), False, 'import sys\n'), ((926, 954), 'rospy.init_node', 'rospy.init_node', (['"""ddpg_eval"""'], {}), "('ddpg_eval')\n", (941, 954), False, 'import rospy\n'), ((1325, 1512), 'evaluation.eval_random_simulation.rand_eval_g... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from itertools import chain
from hwt.math import log2ceil
from hwt.pyUtils.arrayQuery import iter_with_last
from hwt.simulator.simTestCase import SimTestCase
from hwtLib.amba.axi4 import Axi4
from hwtLib.amba.axi_comp.interconnect.matrixCrossbar import AxiInterconnectMat... | [
"hwtLib.amba.axi_comp.interconnect.matrixCrossbar.AxiInterconnectMatrixCrossbar",
"hwt.math.log2ceil",
"unittest.TextTestRunner",
"unittest.TestSuite",
"unittest.makeSuite",
"hwt.pyUtils.arrayQuery.iter_with_last",
"itertools.chain"
] | [((4781, 4801), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (4799, 4801), False, 'import unittest\n'), ((4973, 5009), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {'verbosity': '(3)'}), '(verbosity=3)\n', (4996, 5009), False, 'import unittest\n'), ((557, 598), 'hwtLib.amba.axi_comp.inter... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
import unittest
from nubia.internal import cmdloader
from tests import empty_package, ... | [
"nubia.internal.cmdloader.load_commands"
] | [((664, 703), 'nubia.internal.cmdloader.load_commands', 'cmdloader.load_commands', (['sample_package'], {}), '(sample_package)\n', (687, 703), False, 'from nubia.internal import cmdloader\n'), ((452, 481), 'nubia.internal.cmdloader.load_commands', 'cmdloader.load_commands', (['None'], {}), '(None)\n', (475, 481), False... |
import pymel.core as pm
import logging
log = logging.getLogger("ui")
class BaseTemplate(pm.ui.AETemplate):
def addControl(self, control, label=None, **kwargs):
pm.ui.AETemplate.addControl(self, control, label=label, **kwargs)
def beginLayout(self, name, collapse=True):
pm.ui.AETe... | [
"pymel.core.ui.AETemplate.beginLayout",
"pymel.core.ui.AETemplate.addControl",
"logging.getLogger",
"pymel.core.mel.AEswatchDisplay",
"pymel.core.PyNode"
] | [((46, 69), 'logging.getLogger', 'logging.getLogger', (['"""ui"""'], {}), "('ui')\n", (63, 69), False, 'import logging\n'), ((179, 244), 'pymel.core.ui.AETemplate.addControl', 'pm.ui.AETemplate.addControl', (['self', 'control'], {'label': 'label'}), '(self, control, label=label, **kwargs)\n', (206, 244), True, 'import ... |
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | [
"botocore.handlers.SERVICE_NAME_ALIASES.items"
] | [((877, 905), 'botocore.handlers.SERVICE_NAME_ALIASES.items', 'SERVICE_NAME_ALIASES.items', ([], {}), '()\n', (903, 905), False, 'from botocore.handlers import SERVICE_NAME_ALIASES\n')] |
import argparse
from audiomnist.train import audionet
if __name__=="__main__":
parser=argparse.ArgumentParser(description="Testing script for tensorflow.keras AudioNet model.")
parser.add_argument('-i','--input_dataset', help="path to TFRecord file", required=True)
parser.add_argument('-o','--checkpoint_ou... | [
"audiomnist.train.audionet.test",
"argparse.ArgumentParser"
] | [((91, 186), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Testing script for tensorflow.keras AudioNet model."""'}), "(description=\n 'Testing script for tensorflow.keras AudioNet model.')\n", (114, 186), False, 'import argparse\n'), ((590, 681), 'audiomnist.train.audionet.test', 'a... |
from django import template
from ..forms import CommentForm
register = template.Library()
@register.inclusion_tag('comments/inclusions/_form.html', takes_context=True)
def show_comment_form(context, post, form=None):
if form is None:
form = CommentForm()
return {
'form': form,
'post':... | [
"django.template.Library"
] | [((72, 90), 'django.template.Library', 'template.Library', ([], {}), '()\n', (88, 90), False, 'from django import template\n')] |
import torch
import torch.nn.functional as F
import math
import numpy as np
from scipy import optimize
from functools import reduce
from collections import OrderedDict
import matplotlib.pyplot as plt
class PyTorchObjective(object):
"""PyTorch objective function, wrapped to be called by scipy.optimize.
Modifie... | [
"numpy.abs",
"functools.reduce",
"numpy.array",
"collections.OrderedDict",
"numpy.concatenate",
"torch.from_numpy"
] | [((1210, 1223), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1221, 1223), False, 'from collections import OrderedDict\n'), ((1284, 1332), 'functools.reduce', 'reduce', (['(lambda x, y: x * y)', 'self.param_shapes[n]'], {}), '(lambda x, y: x * y, self.param_shapes[n])\n', (1290, 1332), False, 'from funct... |
from django.shortcuts import render
from .forms import SettingsForm
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.conf import settings
from django.utils import timezone
# Create your views here.
@login_required
def index(request):
if request.me... | [
"django.shortcuts.render",
"django.contrib.auth.models.User.objects.get",
"django.utils.timezone.now"
] | [((628, 682), 'django.shortcuts.render', 'render', (['request', '"""settings_app/settings.html"""', 'context'], {}), "(request, 'settings_app/settings.html', context)\n", (634, 682), False, 'from django.shortcuts import render\n'), ((734, 782), 'django.contrib.auth.models.User.objects.get', 'User.objects.get', ([], {'u... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
""" Plot PDFs of (a) comments per video; (b) CCDF of comments per user.
Usage: python plot_fig3_data_profiling.py
Input data files: data/video_meta.csv, data/user_comment_meta.csv.bz2
Output image file: images/fig3_profiling.pdf
Time: ~1M
"""
import up # go to root fol... | [
"scipy.signal.savgol_filter",
"matplotlib.pyplot.show",
"powerlaw.plot_ccdf",
"utils.plot_conf.aaai_init_plot",
"utils.helper.Timer",
"bz2.BZ2File",
"numpy.histogram",
"matplotlib.ticker.FuncFormatter",
"platform.system",
"utils.plot_conf.hide_spines",
"numpy.log10",
"matplotlib.pyplot.tight_l... | [((669, 676), 'utils.helper.Timer', 'Timer', ([], {}), '()\n', (674, 676), False, 'from utils.helper import Timer\n'), ((2490, 2524), 'utils.plot_conf.aaai_init_plot', 'aaai_init_plot', (['plt'], {'profile': '"""1x2"""'}), "(plt, profile='1x2')\n", (2504, 2524), False, 'from utils.plot_conf import ColorPalette, aaai_in... |
import http.server
import socketserver
import os
def startServer():
os.chdir('./autocolortool')
PORT = 8080
HOST = "0.0.0.0"
Handler = http.server.SimpleHTTPRequestHandler
httpd = socketserver.TCPServer((HOST, PORT), Handler)
print("Serving at port", PORT)
httpd.serve_forever()
if __name__... | [
"socketserver.TCPServer",
"os.chdir"
] | [((73, 100), 'os.chdir', 'os.chdir', (['"""./autocolortool"""'], {}), "('./autocolortool')\n", (81, 100), False, 'import os\n'), ((201, 246), 'socketserver.TCPServer', 'socketserver.TCPServer', (['(HOST, PORT)', 'Handler'], {}), '((HOST, PORT), Handler)\n', (223, 246), False, 'import socketserver\n')] |
# Copyright 2018 Jetperch 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,... | [
"re.compile"
] | [((877, 927), 're.compile', 're.compile', (['"""^\\\\s*([-+]?[0-9]*\\\\.?[0-9]+)\\\\s*(.*)"""'], {}), "('^\\\\s*([-+]?[0-9]*\\\\.?[0-9]+)\\\\s*(.*)')\n", (887, 927), False, 'import re\n')] |
import numpy as np
from PIL import Image
import torch.nn as nn
import torch.nn.functional as F
class Ann(nn.Module):
def __init__(self, node, num_classes=2):
super(Ann, self).__init__()
self.fc = nn.Sequential(
# image 1 x 57 x 114
nn.Linear(1 * 57 * 114, node)... | [
"numpy.shape",
"torch.nn.Linear",
"torch.nn.ReLU",
"PIL.Image.open"
] | [((1365, 1455), 'PIL.Image.open', 'Image.open', (['"""./dataset/EGIS_NEG_Dataset/Clay_Q1_NEG_EGIS/Clay_Q1_NEG_EGIS_000_00.bmp"""'], {}), "(\n './dataset/EGIS_NEG_Dataset/Clay_Q1_NEG_EGIS/Clay_Q1_NEG_EGIS_000_00.bmp')\n", (1375, 1455), False, 'from PIL import Image\n'), ((1462, 1477), 'numpy.shape', 'np.shape', (['im... |
# -*- coding: UTF-8 -*-
# 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 (t... | [
"unittest.main",
"trac.tests.notification.SMTPServerStore.__init__",
"unittest.TestSuite",
"trac.tests.notification.SMTPThreadedServer.__init__",
"unittest.makeSuite",
"trac.tests.notification.SMTPServerStore.helo",
"bhrelations.notification.RelationNotifyEmail",
"trac.tests.notification.SMTPThreadedS... | [((5815, 5835), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (5833, 5835), False, 'import unittest\n'), ((5956, 5971), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5969, 5971), False, 'import unittest\n'), ((2015, 2044), 'bhrelations.notification.RelationNotifyEmail', 'RelationNotifyEmail', (['... |
import random
import nzmath.arith1 as arith1
import nzmath.arygcd as arygcd
def c_root_p(a, p):
"""
Return the cubic root modulo p.
(i.e. a^3 = x (mod p))
"""
if (a % p) == 0:
return [0]
if p == 2 or p == 3 :
return [a % p]
if (p % 3) == 2:
return [pow(a, (((2 * p) -... | [
"nzmath.arith1.legendre",
"nzmath.arith1.floorsqrt",
"nzmath.arygcd._ap_norm_w",
"random.randrange",
"nzmath.arith1.issquare",
"nzmath.arith1.modsqrt"
] | [((2428, 2461), 'nzmath.arygcd._ap_norm_w', 'arygcd._ap_norm_w', (['a1', 'a2', 'b1', 'b2'], {}), '(a1, a2, b1, b2)\n', (2445, 2461), True, 'import nzmath.arygcd as arygcd\n'), ((4751, 4773), 'nzmath.arith1.legendre', 'arith1.legendre', (['(-d)', 'p'], {}), '(-d, p)\n', (4766, 4773), True, 'import nzmath.arith1 as arith... |
import numpy as np
import pandas as pd
from nilearn.datasets import fetch_haxby
from nilearn.input_data import NiftiMasker
# Fetch dataset, extract time-series from ventral temporal (VT) mask
dataset = fetch_haxby(subjects=[2])
masker = NiftiMasker(
dataset.mask_vt[0],
standardize=True, detrend=True, smoothi... | [
"pandas.DataFrame",
"numpy.save",
"pandas.read_csv",
"nilearn.datasets.fetch_haxby",
"nilearn.input_data.NiftiMasker",
"pandas.factorize"
] | [((204, 229), 'nilearn.datasets.fetch_haxby', 'fetch_haxby', ([], {'subjects': '[2]'}), '(subjects=[2])\n', (215, 229), False, 'from nilearn.datasets import fetch_haxby\n'), ((239, 396), 'nilearn.input_data.NiftiMasker', 'NiftiMasker', (['dataset.mask_vt[0]'], {'standardize': '(True)', 'detrend': '(True)', 'smoothing_f... |
import unittest
import solution
class TestQ(unittest.TestCase):
def test_case_0(self):
self.assertEqual(solution.quickestWayUp(
[
[32, 62],
[42, 68],
[12, 98],
],
[
[95, 13],
[97, 25],
... | [
"unittest.main",
"solution.quickestWayUp"
] | [((940, 955), 'unittest.main', 'unittest.main', ([], {}), '()\n', (953, 955), False, 'import unittest\n'), ((119, 249), 'solution.quickestWayUp', 'solution.quickestWayUp', (['[[32, 62], [42, 68], [12, 98]]', '[[95, 13], [97, 25], [93, 37], [79, 27], [75, 19], [49, 47], [67, 17]]'], {}), '([[32, 62], [42, 68], [12, 98]]... |
# coding: utf-8
# In[46]:
import os, sys
sys.path.append(os.getcwd())
import time
import tflib as lib
import tflib.save_images
import tflib.mnist
import tflib.cifar10
import tflib.plot
import tflib.inception_score
import numpy as np
# In[3]:
import torch
import torchvision
from torch import nn
from torch impo... | [
"torch.randn",
"tflib.plot.flush",
"numpy.mean",
"torchvision.transforms.Normalize",
"numpy.multiply",
"torch.FloatTensor",
"tflib.plot.tick",
"tflib.cifar10.load",
"torch.nn.Linear",
"torch.nn.Tanh",
"torch.autograd.Variable",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d",
"torch.cuda.is_avai... | [((2395, 2417), 'torch.FloatTensor', 'torch.FloatTensor', (['[1]'], {}), '([1])\n', (2412, 2417), False, 'import torch\n'), ((2578, 2603), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (2601, 2603), False, 'import torch\n'), ((4520, 4567), 'tflib.cifar10.load', 'lib.cifar10.load', (['BATCH_SIZ... |
"""
2015 Day 3
https://adventofcode.com/2015/day/3
"""
from dataclasses import dataclass
from typing import Dict, Set
import aocd # type: ignore
@dataclass(frozen=True)
class Point:
"""
Two-dimensional point with an x and y coordinate.
"""
x_coord: int
y_coord: int
def __add__(self, other:... | [
"aocd.get_data",
"dataclasses.dataclass"
] | [((150, 172), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (159, 172), False, 'from dataclasses import dataclass\n'), ((1856, 1887), 'aocd.get_data', 'aocd.get_data', ([], {'year': '(2015)', 'day': '(3)'}), '(year=2015, day=3)\n', (1869, 1887), False, 'import aocd\n')] |
from itertools import combinations
def count_combinations(sizes, target):
dp = [1] + [0] * (target)
for cur in sizes:
for next in range(target, cur-1, -1):
dp[next] += dp[next - cur]
return dp[target]
def count_minimal_combinations(sizes, target):
ans = 0
for k in range(1, len... | [
"itertools.combinations"
] | [((351, 373), 'itertools.combinations', 'combinations', (['sizes', 'k'], {}), '(sizes, k)\n', (363, 373), False, 'from itertools import combinations\n')] |
import logging
import random
from typing import Optional
from fastapi import FastAPI, Request
from fastapi_pagination import Page, add_pagination, paginate
from fastapi.middleware.cors import CORSMiddleware
from sigeml.models.dataset import Dataset
from sigeml.services.predictions import predict_load_curve
from sigem... | [
"sigeml.services.training_queue.TrainingQueue",
"sigeml.schemas.TrainingEvent",
"sigeml.services.predictions.predict_load_curve",
"sigeml.models.load_curves.repository.ModelsRepository",
"fastapi_pagination.add_pagination",
"sigeml.models.load_curves.repository.ExperimentsRepository",
"logging.config.fi... | [((587, 660), 'logging.config.fileConfig', 'logging.config.fileConfig', (['"""logging.conf"""'], {'disable_existing_loggers': '(False)'}), "('logging.conf', disable_existing_loggers=False)\n", (612, 660), False, 'import logging\n'), ((670, 697), 'logging.getLogger', 'logging.getLogger', (['"""sigeml"""'], {}), "('sigem... |
#!/usr/bin/env python
# Copyright (c) 2014, <NAME> <<EMAIL>>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list of ... | [
"sys.path.append",
"logging.error",
"logging.debug",
"warnings.simplefilter",
"importlib.import_module",
"logging.basicConfig",
"hashlib.sha1",
"os.popen",
"logging.info",
"subprocess.call",
"warnings.catch_warnings",
"requests.post",
"gc.enable",
"sys.exit"
] | [((1925, 1946), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (1940, 1946), False, 'import sys\n'), ((2130, 2141), 'gc.enable', 'gc.enable', ([], {}), '()\n', (2139, 2141), False, 'import gc\n'), ((2175, 2347), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""./logs/probe.log"... |
# coding=utf-8
import base64
import json
import traceback
import time
import unittest
from poco.drivers.std import StdPoco
from poco.utils.simplerpc.utils import sync_wrapper, RemoteError
from airtest.core.api import connect_device
class TestStandardFunction(unittest.TestCase):
@classmethod
def setUpClass(c... | [
"traceback.print_exc",
"airtest.core.api.connect_device",
"json.dumps",
"time.sleep",
"poco.drivers.std.StdPoco",
"base64.b64decode"
] | [((390, 419), 'airtest.core.api.connect_device', 'connect_device', (['"""Android:///"""'], {}), "('Android:///')\n", (404, 419), False, 'from airtest.core.api import connect_device\n'), ((521, 535), 'poco.drivers.std.StdPoco', 'StdPoco', (['(15004)'], {}), '(15004)\n', (528, 535), False, 'from poco.drivers.std import S... |
from pyexpat import model
import sys
# sys.path.append(".") # Adds the module to path
import unittest
from .. import layers
import tensorflow as tf
import tensorflow.keras.layers as k_layers
import tensorflow.keras.models as k_models
import numpy as np
def makeMinimalModel(
layer, shape=(None, None, 1), inpu... | [
"tensorflow.keras.models.Model",
"unittest.main",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.Input"
] | [((482, 512), 'tensorflow.keras.models.Model', 'k_models.Model', (['input_layer', 'o'], {}), '(input_layer, o)\n', (496, 512), True, 'import tensorflow.keras.models as k_models\n'), ((7981, 7996), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7994, 7996), False, 'import unittest\n'), ((414, 441), 'tensorflow.ker... |
from rest_framework import serializers
class HelloSerializer(serializers.Serializer):
"""Serializa un campo para probar el APIView"""
name = serializers.CharField(max_length=10) | [
"rest_framework.serializers.CharField"
] | [((154, 190), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(10)'}), '(max_length=10)\n', (175, 190), False, 'from rest_framework import serializers\n')] |
"""Implement api to access google vision API
"""
import logging
import json
from pathlib import PosixPath
from typing import Union, Optional, List
import warnings
from google.cloud import vision as gv
from google.cloud.vision_v1.types import AnnotateImageResponse
from google.cloud.vision_v1.types.image_annotator impor... | [
"warnings.warn",
"google.cloud.vision_v1.types.image_annotator.AnnotateImageResponse.to_json",
"pysuite.storage.is_gcs_uri",
"google.cloud.vision_v1.types.image_annotator.BatchAnnotateImagesResponse.to_json"
] | [((5571, 5593), 'pysuite.storage.is_gcs_uri', 'is_gcs_uri', (['image_path'], {}), '(image_path)\n', (5581, 5593), False, 'from pysuite.storage import is_gcs_uri\n'), ((3393, 3447), 'warnings.warn', 'warnings.warn', (['"""No requests was prepared"""', 'UserWarning'], {}), "('No requests was prepared', UserWarning)\n", (... |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`<NAME> <<EMAIL>>`
'''
# Import Python libs
from __future__ import absolute_import, unicode_literals, print_function
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import skipIf, TestCase
from tests.support.m... | [
"tests.support.mock.patch.dict",
"tests.support.unit.skipIf",
"salt.states.portage_config.mod_init",
"salt.states.portage_config.flags",
"tests.support.mock.MagicMock"
] | [((467, 498), 'tests.support.unit.skipIf', 'skipIf', (['NO_MOCK', 'NO_MOCK_REASON'], {}), '(NO_MOCK, NO_MOCK_REASON)\n', (473, 498), False, 'from tests.support.unit import skipIf, TestCase\n'), ((918, 958), 'tests.support.mock.MagicMock', 'MagicMock', ([], {'side_effect': '[True, Exception]'}), '(side_effect=[True, Exc... |
# -*- coding: utf-8 -*-
# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | [
"fuel_upgrade.clients.KeystoneClient",
"logging.getLogger",
"json.dumps"
] | [((721, 748), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (738, 748), False, 'import logging\n'), ((1576, 1614), 'fuel_upgrade.clients.KeystoneClient', 'KeystoneClient', ([], {}), '(**keystone_credentials)\n', (1590, 1614), False, 'from fuel_upgrade.clients import KeystoneClient\n'), (... |
import logging
import azure.functions as func
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
import json
from operator import itemgetter
import os
def main(myblob: func.InputStream):
logging.info(f"Python blob trigger function processed blob \n"
f"Name: {myblob.name}... | [
"json.loads",
"azure.storage.blob.BlobServiceClient.from_connection_string",
"json.dumps",
"logging.info",
"operator.itemgetter"
] | [((219, 347), 'logging.info', 'logging.info', (['f"""Python blob trigger function processed blob \nName: {myblob.name}\nBlob Size: {myblob.length} bytes"""'], {}), '(\n f"""Python blob trigger function processed blob \nName: {myblob.name}\nBlob Size: {myblob.length} bytes"""\n )\n', (231, 347), False, 'import log... |
from __future__ import unicode_literals
import logging
import sys
import traceback
from django.conf import settings
from django.db import OperationalError
from documents.models import DocumentVersion
from lock_manager import Lock, LockError
from mayan.celery import app
from .classes import TextExtractor
from .liter... | [
"documents.models.DocumentVersion.objects.get",
"mayan.celery.app.task",
"traceback.format_tb",
"lock_manager.Lock.acquire_lock",
"sys.exc_info",
"logging.getLogger"
] | [((464, 491), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (481, 491), False, 'import logging\n'), ((495, 574), 'mayan.celery.app.task', 'app.task', ([], {'bind': '(True)', 'default_retry_delay': 'DO_OCR_RETRY_DELAY', 'ignore_result': '(True)'}), '(bind=True, default_retry_delay=DO_OCR_... |
"""
Tests for Discovery.
"""
from __future__ import absolute_import
from builtins import range
from builtins import object
from unittest import TestCase
from json import dumps
from uuid import uuid4
from hypothesis.stateful import GenericStateMachine
from hypothesis import strategies as st
from .common import fake_... | [
"mdk_discovery.ReplaceCluster",
"hypothesis.strategies.lists",
"uuid.uuid4",
"mdk_discovery.StaticRoutes",
"mdk_discovery.Discovery",
"builtins.object",
"mdk._parseEnvironment",
"hypothesis.strategies.tuples",
"hypothesis.strategies.sampled_from",
"json.dumps",
"hypothesis.strategies.just",
"m... | [((21464, 21525), 'hypothesis.strategies.text', 'st.text', ([], {'alphabet': '"""abcdefghijklmnop"""', 'min_size': '(1)', 'max_size': '(10)'}), "(alphabet='abcdefghijklmnop', min_size=1, max_size=10)\n", (21471, 21525), True, 'from hypothesis import strategies as st\n'), ((694, 712), 'mdk_discovery.Discovery', 'Discove... |
#%%
import time
# %%
btime = time.time_ns()
arr = [3,2,4]
target = 6
def twoSum(arr, target):
indeces = []
#Hashing the table
arr_hashed = {}
for indx, entry in enumerate(arr):
if entry not in arr_hashed:
arr_hashed[entry] = indx
else:
pass
for indx, en... | [
"time.time_ns"
] | [((29, 43), 'time.time_ns', 'time.time_ns', ([], {}), '()\n', (41, 43), False, 'import time\n'), ((568, 582), 'time.time_ns', 'time.time_ns', ([], {}), '()\n', (580, 582), False, 'import time\n')] |
# coding: utf-8
from __future__ import absolute_import
import unittest
import datetime
import ks_api_client
from ks_api_client.models.new_sm_order import NewSMOrder # noqa: E501
from ks_api_client.rest import ApiException
class TestNewSMOrder(unittest.TestCase):
"""NewSMOrder unit test stubs"""
def set... | [
"unittest.main",
"ks_api_client.models.new_sm_order.NewSMOrder"
] | [((1395, 1410), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1408, 1410), False, 'import unittest\n'), ((644, 690), 'ks_api_client.models.new_sm_order.NewSMOrder', 'ks_api_client.models.new_sm_order.NewSMOrder', ([], {}), '()\n', (688, 690), False, 'import ks_api_client\n'), ((754, 928), 'ks_api_client.models.n... |
# Generated by Django 2.1.4 on 2018-12-19 00:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0006_cachedaccess'),
]
operations = [
migrations.AlterField(
model_name='groundstation',
name='elevation',
... | [
"django.db.models.FloatField"
] | [((337, 377), 'django.db.models.FloatField', 'models.FloatField', ([], {'help_text': '"""In meters"""'}), "(help_text='In meters')\n", (354, 377), False, 'from django.db import migrations, models\n')] |
import torch
import numpy as np
import torch.nn.functional as F
import cv2
class KeypointEncoder:
def _gaussian_keypoint(self, input_size, mu_x, mu_y, alpha, sigma):
mu_x = mu_x.float()
mu_y = mu_y.float()
h, w = input_size
x = torch.linspace(0, w-1, steps=w)
y = torch.li... | [
"cv2.GaussianBlur",
"numpy.sum",
"numpy.argmax",
"numpy.argsort",
"numpy.arange",
"numpy.exp",
"numpy.meshgrid",
"numpy.copy",
"cv2.imwrite",
"torch.exp",
"numpy.linspace",
"torch.zeros",
"numpy.var",
"bbox_model.kpda_parser.KPDA",
"torch.from_numpy",
"bbox_model.config.Config",
"num... | [((3464, 3479), 'bbox_model.config.Config', 'Config', (['"""whale"""'], {}), "('whale')\n", (3470, 3479), False, 'from bbox_model.config import Config\n'), ((3571, 3583), 'bbox_model.kpda_parser.KPDA', 'KPDA', (['config'], {}), '(config)\n', (3575, 3583), False, 'from bbox_model.kpda_parser import KPDA\n'), ((3666, 368... |
#!/usr/bin/env python3
"""Test the code that prints a basic table of unassigned barcodes from Stats.json"""
import sys, os, re
import unittest
import logging
import json
DATA_DIR = os.path.abspath(os.path.dirname(__file__) + '/stats_json_examples')
VERBOSE = os.environ.get('VERBOSE', '0') != '0'
from unassigned_to_... | [
"unittest.main",
"json.load",
"unassigned_to_table.format_lines",
"os.path.dirname",
"os.environ.get",
"unassigned_to_table.make_revcomp_commentor",
"unassigned_to_table.revcomp",
"logging.getLogger",
"unassigned_to_table.get_samples_list"
] | [((262, 292), 'os.environ.get', 'os.environ.get', (['"""VERBOSE"""', '"""0"""'], {}), "('VERBOSE', '0')\n", (276, 292), False, 'import sys, os, re\n'), ((5706, 5721), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5719, 5721), False, 'import unittest\n'), ((200, 225), 'os.path.dirname', 'os.path.dirname', (['__fi... |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2020, Battelle Memorial Institute.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www... | [
"volttron.platform.get_services_core",
"volttron.platform.get_volttron_root",
"pytest.fixture",
"gevent.sleep"
] | [((3041, 3071), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (3055, 3071), False, 'import pytest\n'), ((4023, 4055), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (4037, 4055), False, 'import pytest\n'), ((5028, 5058), 'pytes... |
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
# Loading in the data
candybar_df = pd.read_csv('data/candybars.csv')
# Define X and y
X = candybar_df.loc[:, 'chocolate':'multi']
y = candybar_df['availability']
# Creating a model
hyper_tree = DecisionTreeClassifier(random_state=1, max_depth=8, mi... | [
"pandas.read_csv",
"sklearn.tree.DecisionTreeClassifier"
] | [((105, 138), 'pandas.read_csv', 'pd.read_csv', (['"""data/candybars.csv"""'], {}), "('data/candybars.csv')\n", (116, 138), True, 'import pandas as pd\n'), ((266, 338), 'sklearn.tree.DecisionTreeClassifier', 'DecisionTreeClassifier', ([], {'random_state': '(1)', 'max_depth': '(8)', 'min_samples_split': '(4)'}), '(rando... |
if __name__ == "__main__":
import application
application.run() | [
"application.run"
] | [((54, 71), 'application.run', 'application.run', ([], {}), '()\n', (69, 71), False, 'import application\n')] |
# coding: utf-8
import math
import os
from typing import List, Optional, Tuple, Union
import cv2
import matplotlib.pyplot as plt
from matplotlib.figure import Figure
from tqdm import tqdm
from ._colorings import toGREEN
from .generic_utils import now_str
def createVideoWritor(
H: int, W: int, fps: float, codec:... | [
"cv2.VideoWriter_fourcc",
"math.ceil",
"cv2.cvtColor",
"cv2.VideoCapture",
"cv2.VideoWriter"
] | [((1055, 1101), 'cv2.VideoWriter', 'cv2.VideoWriter', (['out_path', 'fourcc', 'fps', '(W, H)'], {}), '(out_path, fourcc, fps, (W, H))\n', (1070, 1101), False, 'import cv2\n'), ((4592, 4627), 'math.ceil', 'math.ceil', (['((end - start + 1) / step)'], {}), '((end - start + 1) / step)\n', (4601, 4627), False, 'import math... |
from pathlib import Path
import mne
import numpy as np
from mne.datasets import testing
from mne.io import RawArray
from pycrostates.preprocessing import extract_gfp_peaks, resample
dir_ = Path(testing.data_path()) / "MEG" / "sample"
fname_raw_testing = dir_ / "sample_audvis_trunc_raw.fif"
raw = mne.io.read_raw_fif(... | [
"mne.io.read_raw_fif",
"mne.make_fixed_length_events",
"mne.make_fixed_length_epochs",
"mne.datasets.testing.data_path",
"pycrostates.preprocessing.resample",
"pycrostates.preprocessing.extract_gfp_peaks",
"mne.epochs.Epochs"
] | [((300, 352), 'mne.io.read_raw_fif', 'mne.io.read_raw_fif', (['fname_raw_testing'], {'preload': '(True)'}), '(fname_raw_testing, preload=True)\n', (319, 352), False, 'import mne\n'), ((384, 443), 'mne.make_fixed_length_epochs', 'mne.make_fixed_length_epochs', (['raw'], {'duration': '(2)', 'preload': '(True)'}), '(raw, ... |
"""4 Migration
Revision ID: 8dbcd4e548c5
Revises: 0ede6955afb0
Create Date: 2019-07-10 15:27:55.087809
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '0ede6955afb0'
branch_labels = None
depends_on = None
def upgrade():
# ### comma... | [
"alembic.op.drop_table",
"alembic.op.create_foreign_key",
"alembic.op.create_unique_constraint",
"sqlalchemy.PrimaryKeyConstraint",
"alembic.op.drop_constraint",
"alembic.op.drop_column",
"sqlalchemy.Boolean",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.String",
"sqlalchemy.Integer"
] | [((977, 1029), 'alembic.op.create_unique_constraint', 'op.create_unique_constraint', (['None', '"""booking"""', "['id']"], {}), "(None, 'booking', ['id'])\n", (1004, 1029), False, 'from alembic import op\n'), ((1034, 1100), 'alembic.op.create_foreign_key', 'op.create_foreign_key', (['None', '"""booking"""', '"""room"""... |
from twisted.trial import unittest
from formal import util
class TestUtil(unittest.TestCase):
def test_validIdentifier(self):
self.assertEquals(util.validIdentifier('foo'), True)
self.assertEquals(util.validIdentifier('_foo'), True)
self.assertEquals(util.validIdentifier('_foo_'), True)
... | [
"formal.util.validIdentifier"
] | [((159, 186), 'formal.util.validIdentifier', 'util.validIdentifier', (['"""foo"""'], {}), "('foo')\n", (179, 186), False, 'from formal import util\n'), ((220, 248), 'formal.util.validIdentifier', 'util.validIdentifier', (['"""_foo"""'], {}), "('_foo')\n", (240, 248), False, 'from formal import util\n'), ((282, 311), 'f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.