code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import abc
import tkinter
from functools import partial
from typing import Tuple
class CategoriesUI(abc.ABC):
def __init__(self, classifier):
self._classifier = classifier
def get_user_category_to(self, business: str) -> Tuple[str, bool]:
pass
class CmdCategoryUI(CategoriesUI):
def __in... | [
"tkinter.IntVar",
"tkinter.Checkbutton",
"tkinter.Tk",
"functools.partial",
"tkinter.Label"
] | [((1804, 1816), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (1814, 1816), False, 'import tkinter\n'), ((1963, 1979), 'tkinter.IntVar', 'tkinter.IntVar', ([], {}), '()\n', (1977, 1979), False, 'import tkinter\n'), ((1865, 1901), 'tkinter.Label', 'tkinter.Label', (['window'], {'text': 'business'}), '(window, text=busin... |
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
param_ = tf.compat.v1.placeholder(dtype=tf.float32, shape=(1, 2, 3, 4), name="Hole")
indices_ = tf.constant([1, 2])
op_ = tf.gather(param_, indices_, axis=2)
| [
"tensorflow.compat.v1.placeholder",
"tensorflow.compat.v1.disable_eager_execution",
"tensorflow.gather",
"tensorflow.constant"
] | [((25, 63), 'tensorflow.compat.v1.disable_eager_execution', 'tf.compat.v1.disable_eager_execution', ([], {}), '()\n', (61, 63), True, 'import tensorflow as tf\n'), ((74, 149), 'tensorflow.compat.v1.placeholder', 'tf.compat.v1.placeholder', ([], {'dtype': 'tf.float32', 'shape': '(1, 2, 3, 4)', 'name': '"""Hole"""'}), "(... |
#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#
from unittest.mock import MagicMock
import responses
from source_retently.source import SourceRetently
def setup_responses():
responses.add(
responses.GET,
"https://app.retently.com/api/v2/companies",
json={"data": {"companies"... | [
"source_retently.source.SourceRetently",
"unittest.mock.MagicMock",
"responses.add"
] | [((195, 308), 'responses.add', 'responses.add', (['responses.GET', '"""https://app.retently.com/api/v2/companies"""'], {'json': "{'data': {'companies': [{}]}}"}), "(responses.GET, 'https://app.retently.com/api/v2/companies',\n json={'data': {'companies': [{}]}})\n", (208, 308), False, 'import responses\n'), ((428, 4... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ===========================================================
# File Name: test_W1BS_Bench.py
# Author: <NAME>, Columbia University
# Creation Date: 01-25-2019
# Last Modified: Sun Mar 3 22:43:21 2019
#
# Usage: python test_W1BS_Bench.py
# Description: Test baseline matc... | [
"os.getcwd"
] | [((576, 587), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (585, 587), False, 'import os\n')] |
import json
from datetime import timedelta
from enum import Enum, unique
from insomniac.database_engine import *
from insomniac.utils import *
FILENAME_INTERACTED_USERS = "interacted_users.json" # deprecated
FILENAME_SCRAPPED_USERS = "scrapped_users.json" # deprecated
FILENAME_FILTERED_USERS = "filtered_users.json"... | [
"datetime.timedelta",
"json.dump"
] | [((8891, 8913), 'datetime.timedelta', 'timedelta', ([], {'hours': 'hours'}), '(hours=hours)\n', (8900, 8913), False, 'from datetime import timedelta\n'), ((9649, 9671), 'datetime.timedelta', 'timedelta', ([], {'hours': 'hours'}), '(hours=hours)\n', (9658, 9671), False, 'from datetime import timedelta\n'), ((10407, 1045... |
from django.db import models
# Create your models here.
class Restaurant(models.Model):
name = models.CharField(max_length=200)
def __str__(self):
return f'{self.name}'
class MenuItem(models.Model):
name = models.CharField(max_length=70)
description = models.CharField(max_length=300)
p... | [
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((102, 134), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (118, 134), False, 'from django.db import models\n'), ((232, 263), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(70)'}), '(max_length=70)\n', (248, 263), False, 'from django.db ... |
from django import forms
from .models import *
class manufactureDetailsForm(forms.ModelForm):
class Meta:
model = Manufacture
fields = '__all__'
widgets = {
'name': forms.TextInput(attrs={'class':'form-control'}),
} | [
"django.forms.TextInput"
] | [((215, 263), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'class': 'form-control'}"}), "(attrs={'class': 'form-control'})\n", (230, 263), False, 'from django import forms\n')] |
"""Unit tests for reviewboard.reviews.views.NewReviewRequestView."""
from django.contrib.auth.models import User
from djblets.siteconfig.models import SiteConfiguration
from djblets.testing.decorators import add_fixtures
from reviewboard.testing import TestCase
class NewReviewRequestViewTests(TestCase):
"""Uni... | [
"django.contrib.auth.models.User.objects.get",
"djblets.siteconfig.models.SiteConfiguration.objects.get_current",
"djblets.testing.decorators.add_fixtures"
] | [((3061, 3105), 'djblets.testing.decorators.add_fixtures', 'add_fixtures', (["['test_scmtools', 'test_site']"], {}), "(['test_scmtools', 'test_site'])\n", (3073, 3105), False, 'from djblets.testing.decorators import add_fixtures\n'), ((5731, 5775), 'djblets.testing.decorators.add_fixtures', 'add_fixtures', (["['test_sc... |
from cipher_description import CipherDescription
def generate_speck_version(n,a,b):
speck = CipherDescription(2*n)
s = ['s{}'.format(i) for i in range(2*n)]
'''
if n == 16:
a = 7
b = 2
else:
a = 8
b = 3
'''
x = s[n:]
y = s[:n]
if n%a==0:
... | [
"cipher_description.CipherDescription"
] | [((97, 121), 'cipher_description.CipherDescription', 'CipherDescription', (['(2 * n)'], {}), '(2 * n)\n', (114, 121), False, 'from cipher_description import CipherDescription\n')] |
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
url(r'^admin/', admin.site.urls),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
| [
"django.conf.urls.static.static",
"django.conf.urls.url",
"django.contrib.admin.autodiscover"
] | [((152, 172), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (170, 172), False, 'from django.contrib import admin\n'), ((232, 295), 'django.conf.urls.static.static', 'static', (['settings.STATIC_URL'], {'document_root': 'settings.STATIC_ROOT'}), '(settings.STATIC_URL, document_root=setting... |
import argparse
import json
from pathlib import Path
from discoverindefinitely.spotify import SpotifyClient
def get_playlist(target_playlist, playlists):
"""
Searches for a playlist named `target_playlist` in the list `playlists`.
:param target_playlist:
:param playlists:
:return:
"""
fo... | [
"json.load",
"discoverindefinitely.spotify.SpotifyClient",
"argparse.ArgumentParser",
"pathlib.Path"
] | [((1597, 1685), 'discoverindefinitely.spotify.SpotifyClient', 'SpotifyClient', (["application_config['client_id']", "application_config['client_secret']"], {}), "(application_config['client_id'], application_config[\n 'client_secret'])\n", (1610, 1685), False, 'from discoverindefinitely.spotify import SpotifyClient\... |
#!/usr/bin/env python3
import logging
import os
import subprocess
import time
import yaml
# Common utils
def run_check_process(cmd: str, **kwargs) -> None:
env = os.environ.copy()
env = {**env, **kwargs}
subprocess.run(
cmd.split(),
check=True,
stdout=subprocess.DEVNULL,
... | [
"os.path.exists",
"yaml.dump",
"subprocess.run",
"logging.warning",
"os.environ.copy",
"time.sleep",
"yaml.unsafe_load",
"logging.info",
"logging.error"
] | [((171, 188), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (186, 188), False, 'import os\n'), ((434, 468), 'logging.info', 'logging.info', (['"""Installing helm..."""'], {}), "('Installing helm...')\n", (446, 468), False, 'import logging\n'), ((902, 941), 'logging.info', 'logging.info', (['"""Helm has been i... |
'''
Extensions to Numpy, including finding array elements and smoothing data.
Highlights:
- ``sc.findinds()``: find indices of an array matching a condition
- ``sc.findnearest()``: find nearest matching value
- ``sc.smooth()``: simple smoothing of 1D or 2D arrays
- ``sc.smoothinterp()``: linear interpo... | [
"numpy.convolve",
"numpy.random.rand",
"numpy.argsort",
"numpy.array",
"numpy.isfinite",
"numpy.arange",
"numpy.random.random",
"numpy.exp",
"numpy.linspace",
"numpy.concatenate",
"pandas.DataFrame",
"warnings.warn",
"numpy.ones",
"numpy.isnan",
"numpy.nonzero",
"numpy.interp",
"nump... | [((1438, 1474), 'numpy.isclose', 'np.isclose', ([], {'a': 'val1', 'b': 'val2'}), '(a=val1, b=val2, **kwargs)\n', (1448, 1474), True, 'import numpy as np\n'), ((7550, 7565), 'numpy.zeros', 'np.zeros', (['nrows'], {}), '(nrows)\n', (7558, 7565), True, 'import numpy as np\n'), ((8681, 8723), 'numpy.intersect1d', 'np.inter... |
import os
import numpy as np
from stompy.spatial import field
datadir=os.path.join( os.path.dirname(__file__), 'data')
#depth_bin_file = '/home/rusty/classes/research/spatialdata/us/ca/suntans/bathymetry/compiled2/final.bin'
def test_xyz():
depth_bin_file = os.path.join(datadir,'depth.xyz')
f = field.XYZT... | [
"stompy.spatial.field.XYZText",
"numpy.allclose",
"os.path.join",
"os.path.dirname",
"numpy.array",
"stompy.spatial.field.XYZField"
] | [((87, 112), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (102, 112), False, 'import os\n'), ((267, 301), 'os.path.join', 'os.path.join', (['datadir', '"""depth.xyz"""'], {}), "(datadir, 'depth.xyz')\n", (279, 301), False, 'import os\n'), ((310, 345), 'stompy.spatial.field.XYZText', 'field.... |
import glob
def list_spliter_by_batch_size(my_list, batch_size):
return [my_list[i * batch_size:(i + 1) * batch_size] for i in range((len(my_list) + batch_size - 1) // batch_size)]
def list_spliter_by_num_of_batches(my_list, num_of_batches):
k, m = divmod(len(my_list), num_of_batches)
return list(my_lis... | [
"glob.glob",
"argparse.ArgumentParser"
] | [((1916, 1941), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1939, 1941), False, 'import argparse\n'), ((896, 926), 'glob.glob', 'glob.glob', (['unix_style_pathname'], {}), '(unix_style_pathname)\n', (905, 926), False, 'import glob\n')] |
import cv2
import numpy as np
import copy
def add_label(img, text, org, color, thickness):
return cv2.putText(img=img,
text=text,
org=org,
fontFace=cv2.FONT_HERSHEY_SIMPLEX,
fontScale=0.5,
color=colo... | [
"copy.deepcopy",
"cv2.rectangle",
"cv2.imshow",
"cv2.putText"
] | [((104, 232), 'cv2.putText', 'cv2.putText', ([], {'img': 'img', 'text': 'text', 'org': 'org', 'fontFace': 'cv2.FONT_HERSHEY_SIMPLEX', 'fontScale': '(0.5)', 'color': 'color', 'thickness': 'thickness'}), '(img=img, text=text, org=org, fontFace=cv2.FONT_HERSHEY_SIMPLEX,\n fontScale=0.5, color=color, thickness=thickness... |
# coding=utf-8
"""
Ingest data from the command-line.
"""
from __future__ import absolute_import, division
import uuid
import logging
from pathlib import Path
import yaml
import click
import rasterio
from datetime import datetime
from osgeo import osr
def get_projection(img):
left, bottom, right, top = img.bound... | [
"logging.basicConfig",
"pathlib.Path",
"osgeo.osr.SpatialReference",
"rasterio.open",
"yaml.dump_all",
"uuid.uuid4",
"click.Path",
"click.command",
"logging.info"
] | [((2629, 2707), 'click.command', 'click.command', ([], {'help': '"""Prepare DEM-S datasets for ingestion into the Data Cube."""'}), "(help='Prepare DEM-S datasets for ingestion into the Data Cube.')\n", (2642, 2707), False, 'import click\n'), ((667, 700), 'osgeo.osr.SpatialReference', 'osr.SpatialReference', (['spatial... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
class LayerSelect(nn.Module):
"""Compute samples (from a Gumbel-Sigmoid distribution) which... | [
"torch.zeros_like",
"torch.Tensor",
"torch.empty_like"
] | [((644, 680), 'torch.Tensor', 'torch.Tensor', (['num_logits', 'num_layers'], {}), '(num_logits, num_layers)\n', (656, 680), False, 'import torch\n'), ((2385, 2455), 'torch.zeros_like', 'torch.zeros_like', (['logits'], {'memory_format': 'torch.legacy_contiguous_format'}), '(logits, memory_format=torch.legacy_contiguous_... |
import discord
import re
import re_YuniBot
# チャンネル情報
CHANNEL_ID = tomobot.get_channel_id("開発用")
# デバッグ用
# 個人鯖に飛ぶ
#CHANNEL_ID = tomobot.get_channel_id("tomobot")
TOKEN = re_YuniBot.get_token("<PASSWORD>")
client = discord.Client()
mochikoshi_list = {}
'''
持ち越し時間の判定について、
以下のパターンに一致するものを時刻の情報と... | [
"re.compile",
"re_YuniBot.get_token",
"re.match",
"discord.Client",
"re.findall"
] | [((183, 217), 're_YuniBot.get_token', 're_YuniBot.get_token', (['"""<PASSWORD>"""'], {}), "('<PASSWORD>')\n", (203, 217), False, 'import re_YuniBot\n'), ((228, 244), 'discord.Client', 'discord.Client', ([], {}), '()\n', (242, 244), False, 'import discord\n'), ((917, 964), 're.compile', 're.compile', (['"""(\\\\d:\\\\d\... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import enum
import re
__all__ = (
"NodeType",
"NodeToken",
"NODE_PATTERN",
"JOIN_TOKENS",
)
class NodeType(str, enum.Enum):
"""An enumeration of the different types of nodes in a script."""
ACT = "act"
SCENE = "scene"
PROL = "prologue"
... | [
"re.compile"
] | [((850, 2231), 're.compile', 're.compile', (['"""\n (\n # Locales: Act, Scene, Prologue, Epilogue, Intermission\n (\n ^\\\\#+\\\\s\n (\n (?P<act>(ACT)\\\\s([IVX]+|\\\\d+)) |\n (?P<scene>SCENE\\\\s([IVX]+|\\\\d+)) |\n ... |
from app.api import User, Role
from uuid import UUID
def test_create_models(client):
assert client.db is not None
def test_create_role(app, client):
db = client.db
with app.app_context():
role = Role(name='admin', description='Administrator')
db.session.add(role)
db.session.commi... | [
"uuid.UUID",
"app.api.Role.query.all",
"app.api.Role",
"app.api.User.query.filter_by",
"app.api.User",
"app.api.Role.query.filter_by"
] | [((219, 266), 'app.api.Role', 'Role', ([], {'name': '"""admin"""', 'description': '"""Administrator"""'}), "(name='admin', description='Administrator')\n", (223, 266), False, 'from app.api import User, Role\n'), ((637, 684), 'app.api.Role', 'Role', ([], {'name': '"""admin"""', 'description': '"""Administrator"""'}), "(... |
#!/usr/bin/env python
from optparse import OptionParser
from icecube.simprod.jcorsika import Corsika
parser = OptionParser()
corsika = Corsika(parser)
corsika.Execute()
| [
"optparse.OptionParser",
"icecube.simprod.jcorsika.Corsika"
] | [((112, 126), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (124, 126), False, 'from optparse import OptionParser\n'), ((137, 152), 'icecube.simprod.jcorsika.Corsika', 'Corsika', (['parser'], {}), '(parser)\n', (144, 152), False, 'from icecube.simprod.jcorsika import Corsika\n')] |
import unittest
from cred import Credential
class TestUser(unittest.TestCase):
'''
Test class that defines tes cases for the Credential class behaviours.
Args:
unittest.TestCase: TestCase class that helps in creating test cases
'''
def setUp(self):
'''
Set up method to run before each t... | [
"unittest.main",
"cred.Credential.credential_list.remove",
"cred.Credential.find_by_username",
"cred.Credential"
] | [((2180, 2195), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2193, 2195), False, 'import unittest\n'), ((363, 412), 'cred.Credential', 'Credential', (['"""Rehema"""', '"""0708212463"""', '"""shalomneema"""'], {}), "('Rehema', '0708212463', 'shalomneema')\n", (373, 412), False, 'from cred import Credential\n'), ... |
import time
from makinreusable.winfunction import *
import ImageGrab
while True:
pos = mouse_pos_get()
col = ImageGrab.grab().getpixel((int(pos[0]),int(pos[1])))
print("mouse pos:",pos,"color:",col)
time.sleep(1)
| [
"ImageGrab.grab",
"time.sleep"
] | [((216, 229), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (226, 229), False, 'import time\n'), ((118, 134), 'ImageGrab.grab', 'ImageGrab.grab', ([], {}), '()\n', (132, 134), False, 'import ImageGrab\n')] |
"""iKnUG URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | [
"django.conf.urls.url",
"django.contrib.admin.autodiscover"
] | [((705, 725), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (723, 725), False, 'from django.contrib import admin\n'), ((830, 861), 'django.conf.urls.url', 'url', (['"""^admin/"""', 'admin.site.urls'], {}), "('^admin/', admin.site.urls)\n", (833, 861), False, 'from django.conf.urls import ... |
import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import kornia
from codes.models.resnet import resnet18
import matplotlib
from codes.models.region_proposal_network import RegionProposalNetwork
import cv2
from codes.EX_CONST import Const
import matplotlib.pyplot as plt
mat... | [
"codes.models.region_proposal_network.RegionProposalNetwork",
"torch.from_numpy",
"torch.pow",
"numpy.array",
"torch.nn.functional.interpolate",
"numpy.arange",
"numpy.delete",
"numpy.exp",
"numpy.round",
"kornia.vflip",
"numpy.ones",
"matplotlib.use",
"torch.norm",
"torch.cuda.empty_cache... | [((317, 338), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (331, 338), False, 'import matplotlib\n'), ((5343, 5387), 'cv2.applyColorMap', 'cv2.applyColorMap', (['feature', 'cv2.COLORMAP_JET'], {}), '(feature, cv2.COLORMAP_JET)\n', (5360, 5387), False, 'import cv2\n'), ((5455, 5489), 'cv2.imwrit... |
from ..core import CommandSuite
from ..args import Arg
from ..utils import DBView, sanitize, getname
import discord
import asyncio
import time
import os
import json
def sanitize_channel(name):
return sanitize(name, '~!@#$%^*-<>', '_').rstrip()
PARTY_DURATION = 86400 # 24 hours
Parties = CommandSuite('Parties')
... | [
"os.path.exists",
"discord.PermissionOverwrite",
"discord.utils.get",
"json.load",
"time.time",
"os.remove"
] | [((588, 613), 'os.remove', 'os.remove', (['"""parties.json"""'], {}), "('parties.json')\n", (597, 613), False, 'import os\n'), ((398, 428), 'os.path.exists', 'os.path.exists', (['"""parties.json"""'], {}), "('parties.json')\n", (412, 428), False, 'import os\n'), ((499, 511), 'json.load', 'json.load', (['r'], {}), '(r)\... |
from contextlib import suppress
from django.conf import settings
from django.http import Http404
from django.urls import resolve
from pretalx.event.models import Event
from pretalx.orga.utils.i18n import get_javascript_format, get_moment_locale
def add_events(request):
if request.resolver_match and request.reso... | [
"subprocess.check_output",
"pretalx.orga.utils.i18n.get_javascript_format",
"pretalx.event.models.Event.objects.filter",
"contextlib.suppress",
"pretalx.orga.utils.i18n.get_moment_locale",
"django.urls.resolve"
] | [((922, 969), 'pretalx.orga.utils.i18n.get_javascript_format', 'get_javascript_format', (['"""DATETIME_INPUT_FORMATS"""'], {}), "('DATETIME_INPUT_FORMATS')\n", (943, 969), False, 'from pretalx.orga.utils.i18n import get_javascript_format, get_moment_locale\n'), ((998, 1041), 'pretalx.orga.utils.i18n.get_javascript_form... |
__author__ = '<NAME>'
import os
import logging
import platform
from pypet.tests.testutils.ioutils import unittest
from pypet.trajectory import Trajectory
from pypet.environment import Environment
from pypet.parameter import Parameter
from pypet.tests.testutils.ioutils import run_suite, make_temp_dir, \
get_root_... | [
"pypet.environment.Environment",
"pypet.tests.testutils.ioutils.get_log_config",
"pypet.tests.testutils.ioutils.run_suite",
"pypet.tests.testutils.ioutils.parse_args",
"os.path.join",
"time.sleep",
"platform.system",
"pypet.tests.testutils.ioutils.get_root_logger",
"pypet.trajectory.Trajectory",
"... | [((10237, 10249), 'pypet.tests.testutils.ioutils.parse_args', 'parse_args', ([], {}), '()\n', (10247, 10249), False, 'from pypet.tests.testutils.ioutils import run_suite, make_temp_dir, get_root_logger, parse_args, get_log_config\n'), ((10254, 10275), 'pypet.tests.testutils.ioutils.run_suite', 'run_suite', ([], {}), '(... |
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
config = {
'description' : 'Lightweight data management and analysis '
'tools for single-molecule microscopy.',
'author' : '<NAME>',
'url' : 'https:... | [
"setuptools.find_packages",
"distutils.core.setup"
] | [((606, 621), 'distutils.core.setup', 'setup', ([], {}), '(**config)\n', (611, 621), False, 'from distutils.core import setup\n'), ((513, 528), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (526, 528), False, 'from setuptools import setup, find_packages\n')] |
# 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"); you may not u... | [
"setuptools.find_packages"
] | [((1461, 1501), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['test', 'tests']"}), "(exclude=['test', 'tests'])\n", (1474, 1501), False, 'from setuptools import setup, find_packages\n')] |
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django_mako_plus.controller import view_function
import homepage.models as hmod
from django_mako_plus.controller.router import get_renderer
from django import forms
from django.forms.extras import widgets
from django.utils import timezone
from dja... | [
"django.http.HttpResponseRedirect",
"django_mako_plus.controller.router.get_renderer",
"homepage.models.PublicEvent.objects.get",
"homepage.models.Area.objects.get"
] | [((431, 454), 'django_mako_plus.controller.router.get_renderer', 'get_renderer', (['"""catalog"""'], {}), "('catalog')\n", (443, 454), False, 'from django_mako_plus.controller.router import get_renderer\n'), ((651, 714), 'homepage.models.PublicEvent.objects.get', 'hmod.PublicEvent.objects.get', ([], {'name': '"""Coloni... |
#printfrom PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
#import numpy as np
import sys, os
nowPath = str(os.getcwd())
os.chdir(nowPath)
font = 'Arial'
class MyApp(QWidget):... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.Figure",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.plot",
"os.getcwd",
"os.chdir",
"matplotlib.pyplot.scatter",
"matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg",
"matplotlib.pyplot.legend"
] | [((265, 282), 'os.chdir', 'os.chdir', (['nowPath'], {}), '(nowPath)\n', (273, 282), False, 'import sys, os\n'), ((252, 263), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (261, 263), False, 'import sys, os\n'), ((1016, 1028), 'matplotlib.pyplot.Figure', 'plt.Figure', ([], {}), '()\n', (1026, 1028), True, 'import matplotl... |
from rest_framework import status
from rest_framework.response import Response
from ..models import Currency
from ..test import TestCurrency
from .CurrencyController import CurrencyController
class ChangeCurrencyController:
def exchange(request):
change_currency_data = request.data
bas... | [
"rest_framework.response.Response"
] | [((2907, 3000), 'rest_framework.response.Response', 'Response', (["{'result': 'we couldn’t found the currency'}"], {'status': 'status.HTTP_404_NOT_FOUND'}), "({'result': 'we couldn’t found the currency'}, status=status.\n HTTP_404_NOT_FOUND)\n", (2915, 3000), False, 'from rest_framework.response import Response\n'),... |
import sys
from recommenders.script.main.top_pop_p import Top_pop_p
import scipy.sparse as sps
from utils.definitions import ROOT_DIR
arg = sys.argv[1:]
mode = arg[0]
t = Top_pop_p()
eurm = t.get_top_pop_track(mode)
sps.save_npz(ROOT_DIR+"/recommenders/script/creative/"+mode+"_npz/top_pop_2_track_"+mode+".npz", eur... | [
"scipy.sparse.save_npz",
"recommenders.script.main.top_pop_p.Top_pop_p"
] | [((174, 185), 'recommenders.script.main.top_pop_p.Top_pop_p', 'Top_pop_p', ([], {}), '()\n', (183, 185), False, 'from recommenders.script.main.top_pop_p import Top_pop_p\n'), ((220, 336), 'scipy.sparse.save_npz', 'sps.save_npz', (["(ROOT_DIR + '/recommenders/script/creative/' + mode +\n '_npz/top_pop_2_track_' + mod... |
from logging import debug, info, warning, error
from datetime import datetime, timedelta
import sys
import os
from services import mangaplus
from data.models import Manga
from ruamel.yaml import YAML
'''
Add new mangas to database easily
Limitations:
Can't update manga in database. (Lazy to do that yet ==ll)
To upd... | [
"os.path.join",
"logging.warning",
"ruamel.yaml.YAML",
"services.mangaplus.MangaplusService",
"logging.info",
"logging.error"
] | [((1022, 1028), 'ruamel.yaml.YAML', 'YAML', ([], {}), '()\n', (1026, 1028), False, 'from ruamel.yaml import YAML\n'), ((1033, 1078), 'logging.info', 'info', (['f"""Parsing manga edit file: {edit_file}"""'], {}), "(f'Parsing manga edit file: {edit_file}')\n", (1037, 1078), False, 'from logging import debug, info, warnin... |
import torch
import torch.nn as nn
from distributions_tor import GaussianDistributionNetwork
from utils_tor import init_param_openaibaselines
class ActorCriticNetwork(nn.Module):
def __init__(self, input_dim, hidden_dim, actor_output_dim, critic_output_dim):
super(ActorCriticNetwork, self).__init__()
... | [
"distributions_tor.GaussianDistributionNetwork",
"torch.nn.Tanh",
"torch.nn.Linear"
] | [((422, 479), 'distributions_tor.GaussianDistributionNetwork', 'GaussianDistributionNetwork', (['hidden_dim', 'actor_output_dim'], {}), '(hidden_dim, actor_output_dim)\n', (449, 479), False, 'from distributions_tor import GaussianDistributionNetwork\n'), ((540, 580), 'torch.nn.Linear', 'nn.Linear', (['hidden_dim', 'cri... |
from pyvarco import CombinationCollector
import argparse, os, errno
from util_funcs import *
#### BEGIN CONFIGURATION ####
parser = argparse.ArgumentParser(description='Job generation for timing distributions', prefix_chars='@')
parser.add_argument('@@executable_path', type=str, help='Path to SpatialRestraint executa... | [
"pyvarco.CombinationCollector",
"argparse.ArgumentParser"
] | [((134, 235), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Job generation for timing distributions"""', 'prefix_chars': '"""@"""'}), "(description=\n 'Job generation for timing distributions', prefix_chars='@')\n", (157, 235), False, 'import argparse, os, errno\n'), ((5102, 5124), '... |
import os
from random import Random
from docker.client import DockerClient
from .common import (
CommandLineOptions,
)
from .conftest import testing_context
from .rnode import docker_network_with_started_bootstrap
from .wait import (
wait_for_approved_block_received_handler_state,
)
def test_propose(command... | [
"os.path.join"
] | [((886, 937), 'os.path.join', 'os.path.join', (['"""/opt/docker/examples"""', 'relative_path'], {}), "('/opt/docker/examples', relative_path)\n", (898, 937), False, 'import os\n')] |
import unittest
from itcc import ITCC
import pandas as pd
class TestITCC(unittest.TestCase):
def test_itcc_ingest(self):
i = ITCC()
df = i.get_path_matrix()
self.assertEqual(type(df), pd.DataFrame)
print(df.describe())
print("=" * 80)
def test_getCXY(self):
i =... | [
"unittest.main",
"itcc.ITCC",
"pandas.read_csv"
] | [((1145, 1160), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1158, 1160), False, 'import unittest\n'), ((139, 145), 'itcc.ITCC', 'ITCC', ([], {}), '()\n', (143, 145), False, 'from itcc import ITCC\n'), ((321, 327), 'itcc.ITCC', 'ITCC', ([], {}), '()\n', (325, 327), False, 'from itcc import ITCC\n'), ((488, 494)... |
#!/usr/bin/python3
#
#Thames - A software to scrape the internet to identify the themes of websites built on WordPress.
#Author - <NAME> (Twitter - badbit0)
from threading import Thread
from os import path
import requests
import json
import re
import time
import sys
import os
import argparse
#tic = tim... | [
"re.search",
"json.loads",
"argparse.ArgumentParser",
"sys.platform.startswith",
"requests.get",
"os.getcwd",
"os.chdir",
"os.path.isfile",
"os.remove"
] | [((392, 734), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""A software to scrape the web for WordPress websites and to identify their themes."""', 'prog': '"""thames.py"""', 'usage': '"""%(prog)s --help <for help> -k <Serpstack API key> -d <comma seperated Google Dorks in double quotes>... |
from collections import deque
from hwt.hdl.constants import Time
from hwt.simulator.agentBase import AgentBase, SyncAgentBase
from hwt.synthesizer.exceptions import IntfLvlConfErr
# 100 MHz
DEFAULT_CLOCK = 10 * Time.ns
class SignalAgent(SyncAgentBase):
"""
Agent for signal interface, it can use clock and r... | [
"hwt.simulator.agentBase.SyncAgentBase.getDrivers",
"hwt.simulator.agentBase.AgentBase.__init__",
"collections.deque"
] | [((518, 548), 'hwt.simulator.agentBase.AgentBase.__init__', 'AgentBase.__init__', (['self', 'intf'], {}), '(self, intf)\n', (536, 548), False, 'from hwt.simulator.agentBase import AgentBase, SyncAgentBase\n'), ((815, 822), 'collections.deque', 'deque', ([], {}), '()\n', (820, 822), False, 'from collections import deque... |
from ..transformers.series_to_tabular import RandomIntervalSegmenter
from ..utils.testing import generate_df_from_array
from ..utils.transformations import tabularize
import pytest
import pandas as pd
import numpy as np
N_ITER = 10
# Test output format and dimensions.
def test_output_format_dim():
for n_cols in ... | [
"numpy.random.normal",
"pytest.raises",
"numpy.ones"
] | [((1155, 1180), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(10)'}), '(size=10)\n', (1171, 1180), True, 'import numpy as np\n'), ((967, 992), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueError)\n', (980, 992), False, 'import pytest\n'), ((503, 517), 'numpy.ones', 'np.ones', (['n_obs'], {... |
from functools import wraps
def no_cache():
def wrapper(coroutine):
@wraps(coroutine)
async def wrapped(*args):
response = await coroutine(*args)
response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate' # NOQA
return response
return w... | [
"functools.wraps"
] | [((83, 99), 'functools.wraps', 'wraps', (['coroutine'], {}), '(coroutine)\n', (88, 99), False, 'from functools import wraps\n')] |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import glob
import os
from matplotlib import rcParams
rcParams['font.family'] = 'sans-serif'
rcParams['font.sans-serif'] = ['Hiragino Maru Gothic Pro', 'Yu Gothic', 'Meirio', 'Takao', 'IPAexGothic',... | [
"matplotlib.pyplot.grid",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.fill_between",
"numpy.argsort",
"pandas.to_datetime",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.ylim",
"glob.glob",
"numpy.eye",
"matplotlib.pyplot.savefig",
"numpy.ones"... | [((764, 794), 'glob.glob', 'glob.glob', (['"""data_hospital/x_*"""'], {}), "('data_hospital/x_*')\n", (773, 794), False, 'import glob\n'), ((1050, 1104), 'pandas.read_csv', 'pd.read_csv', (['"""data_Kokudo/w_distance.csv"""'], {'index_col': '(0)'}), "('data_Kokudo/w_distance.csv', index_col=0)\n", (1061, 1104), True, '... |
from setuptools import setup, find_packages
from visual_perception import __version__
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='visual_perception',
version = __version__,
description='A High Level Python Library for Visual Recognition ',
url="https://github.com/S... | [
"setuptools.find_packages"
] | [((568, 583), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (581, 583), False, 'from setuptools import setup, find_packages\n')] |
# coding: utf-8
from payu.experiment import Experiment
from payu.laboratory import Laboratory
import payu.subcommands.args as args
title = 'sweep'
parameters = {'description': 'Delete any temporary files from prior runs'}
arguments = [args.model, args.config, args.hard_sweep, args.laboratory]
def runcmd(model_type... | [
"payu.laboratory.Laboratory",
"payu.experiment.Experiment"
] | [((369, 414), 'payu.laboratory.Laboratory', 'Laboratory', (['model_type', 'config_path', 'lab_path'], {}), '(model_type, config_path, lab_path)\n', (379, 414), False, 'from payu.laboratory import Laboratory\n'), ((426, 441), 'payu.experiment.Experiment', 'Experiment', (['lab'], {}), '(lab)\n', (436, 441), False, 'from ... |
"""AMI lookup."""
# pylint: disable=unused-argument,line-too-long,arguments-differ
import operator
import re
from runway.lookups.handlers.base import LookupHandler
from ...session_cache import get_session
from ...util import read_value_from_path
TYPE_NAME = "ami"
class ImageNotFound(Exception):
"""Image not fo... | [
"operator.itemgetter",
"re.findall"
] | [((2435, 2481), 're.findall', 're.findall', (['"""([0-9a-zA-z_-]+:[^\\\\s$]+)"""', 'value'], {}), "('([0-9a-zA-z_-]+:[^\\\\s$]+)', value)\n", (2445, 2481), False, 'import re\n'), ((3409, 3444), 'operator.itemgetter', 'operator.itemgetter', (['"""CreationDate"""'], {}), "('CreationDate')\n", (3428, 3444), False, 'import... |
import sqlite3
conn = sqlite3.connect("employer_names.db")
c = conn.cursor()
c.execute("SELECT distinct RAW_NAME, clean_name from employer_pairs where CLEAN_NAME like '%Broad%' order by CLEAN_NAME")
c.fetchall()
| [
"sqlite3.connect"
] | [((22, 58), 'sqlite3.connect', 'sqlite3.connect', (['"""employer_names.db"""'], {}), "('employer_names.db')\n", (37, 58), False, 'import sqlite3\n')] |
import argparse
def p(*args, **kwargs):
if 'formatter_class' not in kwargs:
kwargs['formatter_class'] = argparse.ArgumentDefaultsHelpFormatter
return argparse.ArgumentParser(*args, **kwargs)
| [
"argparse.ArgumentParser"
] | [((167, 207), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['*args'], {}), '(*args, **kwargs)\n', (190, 207), False, 'import argparse\n')] |
import tensorflow as tf
import numpy as np
import tools.processing as pre
text = pre.get_text("data/ref_text2.txt")
sentences = text.replace("\n", ";")
vocab = pre.Vocabulary(sentences)
embedding_dimension = 3
word2index_map = {}
index = 0
# for sent in sentences:
# for word in sent.lower().split():
# i... | [
"tools.processing.Vocabulary",
"tensorflow.reset_default_graph",
"tensorflow.get_variable",
"tensorflow.Session",
"tensorflow.train.Saver",
"tools.processing.get_text",
"numpy.argsort",
"numpy.dot",
"tensorflow.name_scope",
"tensorflow.square"
] | [((82, 116), 'tools.processing.get_text', 'pre.get_text', (['"""data/ref_text2.txt"""'], {}), "('data/ref_text2.txt')\n", (94, 116), True, 'import tools.processing as pre\n'), ((161, 186), 'tools.processing.Vocabulary', 'pre.Vocabulary', (['sentences'], {}), '(sentences)\n', (175, 186), True, 'import tools.processing a... |
import logging
import logging.handlers
import multiprocessing as mp
from .gpio import Gpio
from .sound import Sound
from .Communicator import Communicator
from .Workers import Workers
from .StateMachine import StateMachine
from .events.ErrorEvent import ErrorEvent
from .events.Event import Event
from .dis... | [
"logging.basicConfig",
"logging.StreamHandler",
"logging.debug",
"logging.Formatter",
"logging.handlers.TimedRotatingFileHandler",
"logging.info"
] | [((476, 532), 'logging.info', 'logging.info', (['"""Exiting with status code %d"""', 'status_code'], {}), "('Exiting with status code %d', status_code)\n", (488, 532), False, 'import logging\n'), ((636, 709), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'], {}),... |
import re
import random
from errbot import BotPlugin, botcmd, re_botcmd
CONFIG_TEMPLATE = {
'HERO_NAMES_GROUP_1': ['Beat',
'Big',
'Blast',
'Bold',
'Bolt',
'Brick',
'Buck',... | [
"errbot.botcmd",
"errbot.re_botcmd",
"random.choice",
"random.randrange"
] | [((6702, 6710), 'errbot.botcmd', 'botcmd', ([], {}), '()\n', (6708, 6710), False, 'from errbot import BotPlugin, botcmd, re_botcmd\n'), ((6966, 7070), 'errbot.re_botcmd', 're_botcmd', ([], {'pattern': '"""(^| )(hero|heros|heroes)($| |\\\\.|\\\\!|\\\\?)"""', 'prefixed': '(False)', 'flags': 're.IGNORECASE'}), "(pattern='... |
from unittest import TestCase
from tmtccmd.core.object_id_manager import insert_object_id, get_object_id_info
TEST_ID_0 = bytes([0x00, 0x01, 0x02, 0x03])
class TestObjIdManager(TestCase):
def test_obj_id_manager(self):
insert_object_id(object_id=TEST_ID_0, object_id_info=["TEST_ID_0"])
info_list ... | [
"tmtccmd.core.object_id_manager.insert_object_id",
"tmtccmd.core.object_id_manager.get_object_id_info"
] | [((234, 301), 'tmtccmd.core.object_id_manager.insert_object_id', 'insert_object_id', ([], {'object_id': 'TEST_ID_0', 'object_id_info': "['TEST_ID_0']"}), "(object_id=TEST_ID_0, object_id_info=['TEST_ID_0'])\n", (250, 301), False, 'from tmtccmd.core.object_id_manager import insert_object_id, get_object_id_info\n'), ((32... |
# YOUR CODE SHOULD START HERE
import numpy as np
# YOUR CODE SHOULD END HERE
import tensorflow as tf
mnist = tf.keras.datasets.mnist
(x_train, y_train),(x_test, y_test) = mnist.load_data()
# YOUR CODE SHOULD START HERE
x_train = x_train / 255.0
x_test = x_test / 255.0
class myCallback(tf.keras.callbacks.Callback):
... | [
"tensorflow.keras.layers.Flatten",
"tensorflow.keras.layers.Dense"
] | [((585, 610), 'tensorflow.keras.layers.Flatten', 'tf.keras.layers.Flatten', ([], {}), '()\n', (608, 610), True, 'import tensorflow as tf\n'), ((616, 671), 'tensorflow.keras.layers.Dense', 'tf.keras.layers.Dense', ([], {'units': '(512)', 'activation': 'tf.nn.relu'}), '(units=512, activation=tf.nn.relu)\n', (637, 671), T... |
# -*- coding: utf-8 -*-
from tempfile import NamedTemporaryFile
from pkg_resources import DistributionNotFound, get_distribution
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
__version__ = 'unknown'
def make_temp_file(content):
'''helper function to make small config... | [
"pkg_resources.get_distribution",
"tempfile.NamedTemporaryFile"
] | [((154, 180), 'pkg_resources.get_distribution', 'get_distribution', (['__name__'], {}), '(__name__)\n', (170, 180), False, 'from pkg_resources import DistributionNotFound, get_distribution\n'), ((351, 389), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', (['"""r+"""'], {'delete': '(False)'}), "('r+', delete=False)... |
"""
@ Author : <NAME>, <NAME>, <NAME>
@ Date : 04/29/2018, 11/01/2018, 04/29/2019
@ Description : Youless Sensor - Monitor power consumption.
"""
VERSION = '2.0.1'
import json
import logging
from datetime import timedelta
from urllib.request import urlopen
import voluptuous as vol
import homeassistant.he... | [
"logging.getLogger",
"voluptuous.Required",
"voluptuous.Length",
"datetime.timedelta",
"voluptuous.Optional",
"urllib.request.urlopen",
"voluptuous.In"
] | [((572, 599), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (589, 599), False, 'import logging\n'), ((2492, 2510), 'urllib.request.urlopen', 'urlopen', (['self._url'], {}), '(self._url)\n', (2499, 2510), False, 'from urllib.request import urlopen\n'), ((2430, 2450), 'datetime.timedelta',... |
from whispers.plugins.uri import Uri
from whispers.rules import WhisperRules
class StructuredDocument:
def __init__(self, rules: WhisperRules):
self.breadcrumbs = []
self.rules = rules
def traverse(self, code, key=None):
"""Recursively traverse YAML/JSON document"""
if isinsta... | [
"whispers.plugins.uri.Uri"
] | [((1256, 1261), 'whispers.plugins.uri.Uri', 'Uri', ([], {}), '()\n', (1259, 1261), False, 'from whispers.plugins.uri import Uri\n')] |
import numpy as np
from specklepy.utils.box import Box
class SubWindow(Box):
@classmethod
def from_str(cls, s=None, full=None, order='yx'):
# Create full box window if no string provided
if s is None:
return cls(indexes=None)
# Unravel coordinates from string
in... | [
"numpy.where",
"numpy.array"
] | [((565, 602), 'numpy.where', 'np.where', (['(indexes == 0)', 'None', 'indexes'], {}), '(indexes == 0, None, indexes)\n', (573, 602), True, 'import numpy as np\n'), ((1194, 1232), 'numpy.array', 'np.array', (['[x_min, x_max, y_min, y_max]'], {}), '([x_min, x_max, y_min, y_max])\n', (1202, 1232), True, 'import numpy as n... |
# coding: utf-8
from django.conf import settings
from django.contrib import messages
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth import load_backend, login
from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404
from django.shortcuts im... | [
"django.contrib.auth.get_user_model",
"django.contrib.auth.load_backend",
"django.utils.translation.gettext_lazy",
"django.contrib.auth.login",
"grappelli.settings.SWITCH_USER_ORIGINAL",
"grappelli.settings.SWITCH_USER_TARGET",
"django.shortcuts.redirect",
"django.utils.html.escape",
"django.contrib... | [((629, 645), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (643, 645), False, 'from django.contrib.auth import get_user_model\n'), ((2964, 2986), 'django.shortcuts.redirect', 'redirect', (['redirect_url'], {}), '(redirect_url)\n', (2972, 2986), False, 'from django.shortcuts import redirect\... |
from django.urls import include, path
from rest_framework import routers
from rest_framework.authtoken.views import obtain_auth_token # <-- Here
from rest_framework_simplejwt import views as jwt_views
from rest_framework.settings import api_settings
from django.contrib import admin
from service.views import HelloV... | [
"rest_framework_simplejwt.views.TokenObtainPairView.as_view",
"rest_framework_simplejwt.views.TokenRefreshView.as_view",
"service.views.HelloView.as_view",
"django.urls.include",
"django.urls.path",
"rest_framework.routers.DefaultRouter"
] | [((359, 382), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (380, 382), False, 'from rest_framework import routers\n'), ((652, 683), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (656, 683), False, 'from django.urls import in... |
import serial
ser = serial.Serial('/dev/ttyACM0') | [
"serial.Serial"
] | [((20, 49), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyACM0"""'], {}), "('/dev/ttyACM0')\n", (33, 49), False, 'import serial\n')] |
import requests
from astroquery.simbad import Simbad
import numpy as np
import pandas as pd
from astropy.table import QTable, Table, Column
from astropy import units as u
import urllib
import re
import bs4
import math
import matplotlib.pyplot as plt
def plot(star_name):
# Convert the names of stars to HIP numbers... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"bs4.BeautifulSoup",
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.errorbar",
"astroquery.simbad.Simbad.query_objectids",
"matplotlib.pyplot.title",
"urllib.request.urlopen"
] | [((457, 490), 'astroquery.simbad.Simbad.query_objectids', 'Simbad.query_objectids', (['star_name'], {}), '(star_name)\n', (479, 490), False, 'from astroquery.simbad import Simbad\n'), ((789, 830), 'bs4.BeautifulSoup', 'bs4.BeautifulSoup', (['webpage', '"""html.parser"""'], {}), "(webpage, 'html.parser')\n", (806, 830),... |
import numpy as np
import cv2
import math
import itertools
jpeg_quantiz_matrix = np.array([[16, 11, 10, 16, 24, 40, 51, 61],
[12, 12, 14, 19, 26, 58, 60, 55],
[14, 13, 16, 24, 40, 57, 69, 56],
[14, 17, 22, 29, 51, ... | [
"numpy.uint8",
"cv2.imwrite",
"cv2.dct",
"math.ceil",
"cv2.VideoWriter",
"numpy.array",
"numpy.zeros",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.VideoWriter_fourcc",
"cv2.idct",
"cv2.cvtColor",
"numpy.zeros_like",
"numpy.float32",
"numpy.round"
] | [((88, 394), 'numpy.array', 'np.array', (['[[16, 11, 10, 16, 24, 40, 51, 61], [12, 12, 14, 19, 26, 58, 60, 55], [14, \n 13, 16, 24, 40, 57, 69, 56], [14, 17, 22, 29, 51, 87, 80, 62], [18, 22,\n 37, 56, 68, 109, 103, 77], [24, 35, 55, 64, 81, 104, 113, 92], [49, 64,\n 78, 87, 103, 121, 120, 101], [72, 92, 95, 9... |
'''
Test file for the dce_models sub-module
'''
import pytest
import os
import sys
import numpy as np
from tempfile import TemporaryDirectory
sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'src')))
#---------------------------------------------------------------------------... | [
"QbiPy.dce_models.dibem.concentration_from_model",
"pytest.approx",
"QbiPy.dce_models.two_cxm_model.params_to_DIBEM",
"QbiPy.dce_models.two_cxm_model.params_from_DIBEM",
"QbiPy.dce_models.active_uptake_model.params_to_DIBEM",
"QbiPy.dce_models.active_uptake_model.params_from_DIBEM",
"numpy.linspace",
... | [((697, 762), 'QbiPy.dce_models.active_uptake_model.params_to_DIBEM', 'active_uptake_model.params_to_DIBEM', (['F_p', 'v_ecs', 'k_i', 'k_ef', '(False)'], {}), '(F_p, v_ecs, k_i, k_ef, False)\n', (732, 762), False, 'from QbiPy.dce_models import dibem, two_cxm_model, active_uptake_model\n'), ((795, 854), 'QbiPy.dce_model... |
# Copyright 2021 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, ... | [
"pyspark.sql.functions.explode_outer",
"pyspark.sql.functions.regexp_replace",
"pyspark.sql.functions.max",
"pyspark.SparkConf",
"pyspark.sql.functions.explode",
"pyspark.sql.functions.col",
"pyspark.sql.SparkSession.builder.config",
"pyspark.sql.functions.min",
"pyspark.sql.types.StringType",
"py... | [((17505, 17551), 'pyspark.sql.functions.regexp_replace', 'F.regexp_replace', (['"""id"""', 'base_encounter_url', '""""""'], {}), "('id', base_encounter_url, '')\n", (17521, 17551), True, 'import pyspark.sql.functions as F\n'), ((17581, 17601), 'pyspark.sql.functions.col', 'F.col', (['"""encounterId"""'], {}), "('encou... |
from pschitt import analysis as ana
import numpy as np
def test_triggered_telescopes():
from pschitt import geometry as geo
tel1 = geo.Telescope([10, 0, 0], [-1. / 3., 0, 2. / 3.])
tel2 = geo.Telescope([0, 10, 0], [-1. / 3., 0, 2. / 3.])
tel1.signal_hist = np.ones(len(tel1.pixel_tab))
tel2.sign... | [
"pschitt.geometry.Telescope",
"pschitt.analysis.multiplicity",
"pschitt.analysis.triggered_telescopes"
] | [((144, 197), 'pschitt.geometry.Telescope', 'geo.Telescope', (['[10, 0, 0]', '[-1.0 / 3.0, 0, 2.0 / 3.0]'], {}), '([10, 0, 0], [-1.0 / 3.0, 0, 2.0 / 3.0])\n', (157, 197), True, 'from pschitt import geometry as geo\n'), ((205, 258), 'pschitt.geometry.Telescope', 'geo.Telescope', (['[0, 10, 0]', '[-1.0 / 3.0, 0, 2.0 / 3.... |
"""
Currently I only have support for Cora dataset - feel free to add your own graph data.
You can find the details on how Cora was constructed here: http://eliassi.org/papers/ai-mag-tr08.pdf
TL;DR:
The feature vectors are 1433 features long. The authors found the most frequent words across every paper... | [
"networkx.from_dict_of_lists",
"numpy.identity",
"pickle.dump",
"numpy.power",
"networkx.adjacency_matrix",
"numpy.arange",
"pickle.load",
"scipy.sparse.issparse",
"utils.visualizations.plot_in_out_degree_distributions",
"torch.tensor",
"numpy.row_stack",
"utils.visualizations.visualize_graph"... | [((6174, 6207), 'scipy.sparse.issparse', 'sp.issparse', (['node_features_sparse'], {}), '(node_features_sparse)\n', (6185, 6207), True, 'import scipy.sparse as sp\n'), ((7169, 7200), 'scipy.sparse.diags', 'sp.diags', (['node_features_inv_sum'], {}), '(node_features_inv_sum)\n', (7177, 7200), True, 'import scipy.sparse ... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"keras.testing_infra.test_combinations.combine",
"tensorflow.compat.v2.test.main",
"keras.testing_infra.test_utils.layer_test"
] | [((936, 986), 'keras.testing_infra.test_combinations.combine', 'test_combinations.combine', ([], {'mode': "['graph', 'eager']"}), "(mode=['graph', 'eager'])\n", (961, 986), False, 'from keras.testing_infra import test_combinations\n'), ((2570, 2584), 'tensorflow.compat.v2.test.main', 'tf.test.main', ([], {}), '()\n', (... |
import tensorflow as tf
import time
import numpy as np
from tensorflow import keras
from lpot.data import DATASETS, DataLoader
tf.compat.v1.disable_eager_execution()
def main():
import lpot
quantizer = lpot.Quantization('./conf.yaml')
dataset = quantizer.dataset('dummy', shape=(100, 100, 100, 3), label=T... | [
"lpot.data.DataLoader",
"tensorflow.compat.v1.disable_eager_execution",
"lpot.Quantization"
] | [((128, 166), 'tensorflow.compat.v1.disable_eager_execution', 'tf.compat.v1.disable_eager_execution', ([], {}), '()\n', (164, 166), True, 'import tensorflow as tf\n'), ((213, 245), 'lpot.Quantization', 'lpot.Quantization', (['"""./conf.yaml"""'], {}), "('./conf.yaml')\n", (230, 245), False, 'import lpot\n'), ((343, 376... |
import subprocess
from behave import *
use_step_matcher("re")
@when("the user run klickbrick 'hello'")
def step_impl(context):
"""
:type context: behave.runner.Context
"""
args = "poetry run klickbrick hello".split()
context.response = subprocess.run(args, capture_output=True, text=True).stdout... | [
"subprocess.run"
] | [((261, 313), 'subprocess.run', 'subprocess.run', (['args'], {'capture_output': '(True)', 'text': '(True)'}), '(args, capture_output=True, text=True)\n', (275, 313), False, 'import subprocess\n')] |
from django.conf.urls import url
from . import views
from django.contrib.auth import views as auth_views
urlpatterns = [
url(r'^$', auth_views.login, {'template_name': 'index.html'}),
url(r'^automark/twitter', views.twitter, name='twitter'),
url(r'^automark/facebook', views.facebook, name='facebook'),
... | [
"django.conf.urls.url"
] | [((126, 186), 'django.conf.urls.url', 'url', (['"""^$"""', 'auth_views.login', "{'template_name': 'index.html'}"], {}), "('^$', auth_views.login, {'template_name': 'index.html'})\n", (129, 186), False, 'from django.conf.urls import url\n'), ((193, 248), 'django.conf.urls.url', 'url', (['"""^automark/twitter"""', 'views... |
import unittest
import re
import pytest
import numpy as np
from scipy.optimize import check_grad
from six.moves import xrange
from sklearn.metrics import pairwise_distances
from sklearn.datasets import load_iris, make_classification, make_regression
from numpy.testing import assert_array_almost_equal, assert_array_equa... | [
"numpy.array",
"metric_learn.MMC",
"unittest.main",
"metric_learn.MMC_Supervised",
"numpy.random.RandomState",
"re.search",
"re.split",
"metric_learn.MLKR",
"metric_learn.NCA",
"sklearn.datasets.make_regression",
"numpy.where",
"numpy.testing.assert_almost_equal",
"numpy.random.seed",
"met... | [((825, 863), 'numpy.unique', 'np.unique', (['labels'], {'return_inverse': '(True)'}), '(labels, return_inverse=True)\n', (834, 863), True, 'import numpy as np\n'), ((4410, 4445), 'sklearn.datasets.make_classification', 'make_classification', ([], {'random_state': '(0)'}), '(random_state=0)\n', (4429, 4445), False, 'fr... |
import numpy as np
from core.polymer_chain import Polymer
from core.polymer_chain import RandomChargePolymer
from pymatgen import Molecule
from utils import dihedral_tools
import unittest
__author__ = "<NAME>"
class TestPolymer(unittest.TestCase):
@classmethod
def setUpClass(cls):
# setup for polymer... | [
"numpy.mean",
"numpy.trace",
"numpy.arccos",
"core.polymer_chain.RandomChargePolymer",
"core.polymer_chain.Polymer",
"numpy.cross",
"pymatgen.Molecule",
"numpy.testing.assert_allclose",
"numpy.linalg.norm",
"numpy.array",
"numpy.testing.assert_almost_equal",
"numpy.zeros",
"numpy.random.unif... | [((13949, 13964), 'unittest.main', 'unittest.main', ([], {}), '()\n', (13962, 13964), False, 'import unittest\n'), ((498, 608), 'numpy.array', 'np.array', (['[[0.0, -180.0], [0.2, -90.0], [0.3, -45.0], [0.4, 0.0], [0.5, 45.0], [0.6, \n 90.0], [0.8, 180.0]]'], {}), '([[0.0, -180.0], [0.2, -90.0], [0.3, -45.0], [0.4, ... |
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.views.generic.base import TemplateView
from movie_rating.views import MovieDescriptionView
from movie_rating.views import MyRatingsView
from . import views
urlpatterns = [
url(r'^$', views.sort, name='home'),
url(... | [
"movie_rating.views.MyRatingsView.as_view",
"django.conf.urls.url",
"movie_rating.views.MovieDescriptionView.as_view"
] | [((275, 309), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.sort'], {'name': '"""home"""'}), "('^$', views.sort, name='home')\n", (278, 309), False, 'from django.conf.urls import url\n'), ((316, 366), 'django.conf.urls.url', 'url', (['"""^register/"""', 'views.register'], {'name': '"""register"""'}), "('^register... |
import numpy as np
# ResNet-18, 5 classes, 100 linear probing epochs, classical, 8 width, variable epoch size
def results():
accs = np.array([
[(37.94, 9), (40.4, 19), (45.72, 49), (48.2, 99), (53.68, 199), (56.1, 299)],
[(43.32, 9), (47.64, 19), (48.98, 49), (51.96, 99), (53.82, 199), (54.48, 299... | [
"numpy.array"
] | [((138, 566), 'numpy.array', 'np.array', (['[[(37.94, 9), (40.4, 19), (45.72, 49), (48.2, 99), (53.68, 199), (56.1, 299\n )], [(43.32, 9), (47.64, 19), (48.98, 49), (51.96, 99), (53.82, 199), (\n 54.48, 299)], [(43.04, 9), (48.34, 19), (51.9, 49), (56.1, 99), (60.3, \n 199), (62.62, 299)], [(44.86, 9), (47.86,... |
import smtplib, ssl
from email import encoders
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
# port = 465 # For SSL
# password = input("Type your password and press enter: ")
# # Create a secure SSL context
# context = ssl.create_default_cont... | [
"yagmail.SMTP"
] | [((3811, 3834), 'yagmail.SMTP', 'yagmail.SMTP', (['"""<EMAIL>"""'], {}), "('<EMAIL>')\n", (3823, 3834), False, 'import yagmail\n')] |
"""dodo file. test + management stuff"""
import glob
import os
import subprocess
import pytest
from doitpy.pyflakes import Pyflakes
from doitpy.coverage import Config, Coverage, PythonPackage
from doitpy import docs
from doitpy.package import Package
from doit.tools import create_folder
DOIT_CONFIG = {
'minver... | [
"doitpy.docs.sphinx",
"os.path.join",
"doitpy.package.Package",
"pytest.main",
"doitpy.coverage.Config",
"doitpy.pyflakes.Pyflakes",
"doitpy.docs.spell",
"doitpy.coverage.PythonPackage",
"glob.glob"
] | [((425, 447), 'glob.glob', 'glob.glob', (['"""doit/*.py"""'], {}), "('doit/*.py')\n", (434, 447), False, 'import glob\n'), ((461, 489), 'glob.glob', 'glob.glob', (['"""tests/test_*.py"""'], {}), "('tests/test_*.py')\n", (470, 489), False, 'import glob\n'), ((506, 529), 'glob.glob', 'glob.glob', (['"""tests/*.py"""'], {... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2020 shmilee
from distutils.spawn import find_executable
from PyInstaller.depend.bindepend import findSystemLibrary
from PyInstaller.utils.hooks import collect_submodules, exec_statement
hiddenimports = collect_submodules('gdpy3')
data_dir = exec_statement(
"import g... | [
"distutils.spawn.find_executable",
"PyInstaller.utils.hooks.exec_statement",
"PyInstaller.depend.bindepend.findSystemLibrary",
"PyInstaller.utils.hooks.collect_submodules"
] | [((251, 278), 'PyInstaller.utils.hooks.collect_submodules', 'collect_submodules', (['"""gdpy3"""'], {}), "('gdpy3')\n", (269, 278), False, 'from PyInstaller.utils.hooks import collect_submodules, exec_statement\n'), ((291, 369), 'PyInstaller.utils.hooks.exec_statement', 'exec_statement', (['"""import gdpy3.__about__; p... |
"""
Module for manipulating and listing Docker named volumes. For function docs, see engine interface specifications.
"""
from typing import List
from docker import DockerClient
from docker.errors import NotFound, ContainerError
from riptide.engine.abstract import ExecError
from riptide_engine_docker.container_builde... | [
"riptide_engine_docker.container_builder.ContainerBuilder",
"riptide.engine.abstract.ExecError"
] | [((1665, 1731), 'riptide_engine_docker.container_builder.ContainerBuilder', 'ContainerBuilder', (['PATH_UTILS_IMAGE', '"""cp -a /copy_from/. /copy_to/"""'], {}), "(PATH_UTILS_IMAGE, 'cp -a /copy_from/. /copy_to/')\n", (1681, 1731), False, 'from riptide_engine_docker.container_builder import RIPTIDE_DOCKER_LABEL_IS_RIPT... |
# -*- coding: utf-8 -*-
__author__ = "苦叶子"
"""
modified: use DB not json.
"""
from flask import current_app, url_for, session
from flask_restful import Resource, reqparse
from werkzeug.security import check_password_hash
from utils.mylogger import getlogger
class Auth(Resource):
def __init__(self):
sel... | [
"flask.current_app._get_current_object",
"flask_restful.reqparse.RequestParser",
"flask.url_for",
"flask.session.pop",
"utils.mylogger.getlogger",
"werkzeug.security.check_password_hash"
] | [((331, 355), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ([], {}), '()\n', (353, 355), False, 'from flask_restful import Resource, reqparse\n'), ((485, 504), 'utils.mylogger.getlogger', 'getlogger', (['__name__'], {}), '(__name__)\n', (494, 504), False, 'from utils.mylogger import getlogger\n'), ... |
# app/auth/views.py
from flask import flash, redirect, render_template, url_for
from flask_login import login_required, login_user, logout_user
from app.auth import auth
from app.auth.forms import LoginForm
from .. import db
from app.models import Employee
@auth.route('/login', methods=['GET', 'POST'])
def login():... | [
"flask.render_template",
"flask.flash",
"flask_login.login_user",
"flask_login.logout_user",
"app.models.Employee.query.filter_by",
"app.auth.forms.LoginForm",
"flask.url_for",
"app.auth.auth.route"
] | [((262, 307), 'app.auth.auth.route', 'auth.route', (['"""/login"""'], {'methods': "['GET', 'POST']"}), "('/login', methods=['GET', 'POST'])\n", (272, 307), False, 'from app.auth import auth\n'), ((1195, 1216), 'app.auth.auth.route', 'auth.route', (['"""/logout"""'], {}), "('/logout')\n", (1205, 1216), False, 'from app.... |
"""a rewrite of cnn.py
this version is mostly inspired by
NIPS2017 (mask cnn).
see https://github.com/leelabcnbc/thesis-proposal-yimeng/blob/master/thesis_proposal/population_neuron_fitting/maskcnn/cnn.py
"""
import torch
from torch import nn, optim
from torch.nn import functional as F
from torch.nn import init as nn... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"math.sqrt",
"numpy.isfinite",
"torch.sum",
"copy.deepcopy",
"torch.nn.AvgPool2d",
"torch.nn.BatchNorm2d",
"numpy.exp",
"collections.OrderedDict",
"torch.abs",
"torch.nn.functional.mse_loss",
"torch.Tensor",
"torch.nn.functional.relu",
"torch.nn.init.... | [((5324, 5337), 'numpy.all', 'np.all', (['(x > 0)'], {}), '(x > 0)\n', (5330, 5337), True, 'import numpy as np\n'), ((18915, 18935), 'copy.deepcopy', 'deepcopy', (['opt_config'], {}), '(opt_config)\n', (18923, 18935), False, 'from copy import deepcopy\n'), ((1065, 1081), 'torch.abs', 'torch.abs', (['input'], {}), '(inp... |
from django.contrib import admin
from .models import Item, OrderItem, Order, Payment, Coupon, Refund, Address, UserProfile
def make_refund_accepted(modeladmin, request, queryset):
queryset.update(refund_requested=False, refund_granted=True)
make_refund_accepted.short_description = 'Update orders to refund gran... | [
"django.contrib.admin.site.register"
] | [((1505, 1530), 'django.contrib.admin.site.register', 'admin.site.register', (['Item'], {}), '(Item)\n', (1524, 1530), False, 'from django.contrib import admin\n'), ((1531, 1561), 'django.contrib.admin.site.register', 'admin.site.register', (['OrderItem'], {}), '(OrderItem)\n', (1550, 1561), False, 'from django.contrib... |
import unittest
from dcp.problems.linkedlist.single import build_list
from dcp.problems.linkedlist.partition import partition1
class Test_Partition1(unittest.TestCase):
def setUp(self):
pass
def test_case1(self):
assert partition1(None, 0) == None
def test_case2(self):
... | [
"dcp.problems.linkedlist.single.build_list",
"dcp.problems.linkedlist.partition.partition1"
] | [((399, 426), 'dcp.problems.linkedlist.partition.partition1', 'partition1', (['head', 'partition'], {}), '(head, partition)\n', (409, 426), False, 'from dcp.problems.linkedlist.partition import partition1\n'), ((447, 481), 'dcp.problems.linkedlist.single.build_list', 'build_list', (['[2, 1, 3, 5, 8, 5, 10]'], {}), '([2... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^ussd/$', views.index, name='index'),
url(r'^ussdrelief/$', views.ussdrelief, name='ussdrelief'),
url(r'^sms/$',views.sms, name='sms'),
url(r'^location/$',views.location, name='location'),
url(r'^locationv/$',views.locationv... | [
"django.conf.urls.url"
] | [((74, 115), 'django.conf.urls.url', 'url', (['"""^ussd/$"""', 'views.index'], {'name': '"""index"""'}), "('^ussd/$', views.index, name='index')\n", (77, 115), False, 'from django.conf.urls import url\n'), ((122, 179), 'django.conf.urls.url', 'url', (['"""^ussdrelief/$"""', 'views.ussdrelief'], {'name': '"""ussdrelief"... |
import cv2
import glob, os
import numpy as np
import re
import fnmatch
import pickle
import random
from shutil import copy, copyfile
import json
def saveAnnotation(jointCamPath, positions):
fOut = open(jointCamPath, 'w')
fOut.write("F4_KNU1_A " + str(positions[0][0]) + " " + str(positions[0][1]) + "\n")
f... | [
"re.split",
"os.listdir",
"cv2.projectPoints",
"json.dump",
"os.path.join",
"numpy.array",
"shutil.copyfile",
"fnmatch.filter",
"os.walk"
] | [((2438, 2454), 'os.walk', 'os.walk', (['rootdir'], {}), '(rootdir)\n', (2445, 2454), False, 'import glob, os\n'), ((2768, 2793), 'numpy.array', 'np.array', (['an'], {'dtype': 'float'}), '(an, dtype=float)\n', (2776, 2793), True, 'import numpy as np\n'), ((2906, 2953), 'numpy.array', 'np.array', (['[[Fx, 0, Cx], [0, Fy... |
## Copyright 2015-2019 <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 law or agreed to i... | [
"PyFlow.Core.NodeBase.NodePinsSuggestionsHelper",
"PyFlow.Core.structs.splineRamp"
] | [((1306, 1318), 'PyFlow.Core.structs.splineRamp', 'splineRamp', ([], {}), '()\n', (1316, 1318), False, 'from PyFlow.Core.structs import splineRamp\n'), ((1455, 1482), 'PyFlow.Core.NodeBase.NodePinsSuggestionsHelper', 'NodePinsSuggestionsHelper', ([], {}), '()\n', (1480, 1482), False, 'from PyFlow.Core.NodeBase import N... |
import logging
from collections import namedtuple
from typing import Optional, Dict, Callable, Any
from auth.authorization import Authorizer, is_same_user
from auth.user import User
from execution.executor import ScriptExecutor
from model import script_config
from model.model_helper import is_empty, AccessProhibitedEx... | [
"logging.getLogger",
"collections.namedtuple",
"auth.authorization.is_same_user",
"model.model_helper.AccessProhibitedException",
"execution.executor.ScriptExecutor",
"model.model_helper.is_empty",
"utils.exceptions.missing_arg_exception.MissingArgumentException",
"utils.exceptions.not_found_exception... | [((481, 533), 'logging.getLogger', 'logging.getLogger', (['"""script_server.execution_service"""'], {}), "('script_server.execution_service')\n", (498, 533), False, 'import logging\n'), ((552, 657), 'collections.namedtuple', 'namedtuple', (['"""_ExecutionInfo"""', "['execution_id', 'owner_user', 'audit_name', 'config',... |
import gspread
from oauth2client.service_account import ServiceAccountCredentials
from random import randint
import datetime
def get_random_highlight():
scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleap... | [
"oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name",
"random.randint",
"datetime.datetime.now",
"gspread.authorize"
] | [((352, 421), 'oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name', 'ServiceAccountCredentials.from_json_keyfile_name', (['"""creds.json"""', 'scope'], {}), "('creds.json', scope)\n", (400, 421), False, 'from oauth2client.service_account import ServiceAccountCredentials\n'), ((435, 459), 'gsp... |
#Autre test pour le filtre des musées sur les villes, qui vérifie la correspondance de manière plus précise.
import sys
import os
from pathlib import Path
scriptpath = Path(os.path.dirname(os.path.abspath(__file__))).parent
sys.path.insert(0,str(scriptpath))
import pandas as pd
from data_extraction.filtre_base_de_don... | [
"os.path.abspath",
"data_extraction.filtre_base_de_donnees.filtre_par_villes",
"pandas.isnull",
"pandas.read_excel"
] | [((415, 449), 'pandas.read_excel', 'pd.read_excel', (['"""tests\\\\tests.xlsx"""'], {}), "('tests\\\\tests.xlsx')\n", (428, 449), True, 'import pandas as pd\n'), ((190, 215), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (205, 215), False, 'import os\n'), ((542, 585), 'data_extraction.filtre... |
from src.end_point import EndPoint
class Collection:
def __init__(self, collection_json):
self.end_points = [EndPoint(x) for x in collection_json["item"]]
def get_end_points(self):
return self.end_points
def remove_end_point(self, end_point):
self.end_points.remove(end_point)
| [
"src.end_point.EndPoint"
] | [((123, 134), 'src.end_point.EndPoint', 'EndPoint', (['x'], {}), '(x)\n', (131, 134), False, 'from src.end_point import EndPoint\n')] |
import dill
from celery.utils.log import get_task_logger
celery_log = get_task_logger(__name__)
model_path = './models/tm.dill'
with open(model_path, 'rb') as f:
model = dill.load(f)
def run_predictions(data):
model.predict(data)
celery_log.info('Predict task completed')
| [
"celery.utils.log.get_task_logger",
"dill.load"
] | [((71, 96), 'celery.utils.log.get_task_logger', 'get_task_logger', (['__name__'], {}), '(__name__)\n', (86, 96), False, 'from celery.utils.log import get_task_logger\n'), ((176, 188), 'dill.load', 'dill.load', (['f'], {}), '(f)\n', (185, 188), False, 'import dill\n')] |
from hstest.stage_test import StageTest
from hstest.test_case import TestCase
from hstest.check_result import CheckResult
import re
CheckResult.correct = lambda: CheckResult(True, '')
CheckResult.wrong = lambda feedback: CheckResult(False, feedback)
class LoanCalcTest(StageTest):
def generate(self):
retu... | [
"hstest.check_result.CheckResult.wrong",
"hstest.check_result.CheckResult",
"hstest.test_case.TestCase",
"hstest.check_result.CheckResult.correct",
"re.findall"
] | [((163, 184), 'hstest.check_result.CheckResult', 'CheckResult', (['(True)', '""""""'], {}), "(True, '')\n", (174, 184), False, 'from hstest.check_result import CheckResult\n'), ((222, 250), 'hstest.check_result.CheckResult', 'CheckResult', (['(False)', 'feedback'], {}), '(False, feedback)\n', (233, 250), False, 'from h... |
# coding: utf-8
"""
BillForward REST API
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
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... | [
"unittest.main",
"billforward.apis.analytics_api.AnalyticsApi"
] | [((3095, 3110), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3108, 3110), False, 'import unittest\n'), ((1042, 1087), 'billforward.apis.analytics_api.AnalyticsApi', 'billforward.apis.analytics_api.AnalyticsApi', ([], {}), '()\n', (1085, 1087), False, 'import billforward\n')] |
# import only necessary functions from modules to reduce load
from fdtd_venv import fdtd_mod as fdtd
from numpy import arange, array, where
from matplotlib.pyplot import subplot, plot, xlabel, ylabel, legend, title, suptitle, show, ylim, figure
from scipy.optimize import curve_fit
from os import path
from sys import ar... | [
"matplotlib.pyplot.ylabel",
"numpy.array",
"numpy.arange",
"fdtd_venv.fdtd_mod.PointSource",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"fdtd_venv.fdtd_mod.Grid",
"matplotlib.pyplot.ylim",
"fdtd_venv.fdtd_mod.LineDetector",
"matplotlib.pyplot.title",
"time.time",
"matplotlib.pyplot.... | [((413, 419), 'time.time', 'time', ([], {}), '()\n', (417, 419), False, 'from time import time\n'), ((524, 582), 'fdtd_venv.fdtd_mod.Grid', 'fdtd.Grid', ([], {'shape': '(200, 1.55e-05, 1)', 'grid_spacing': '(7.75e-08)'}), '(shape=(200, 1.55e-05, 1), grid_spacing=7.75e-08)\n', (533, 582), True, 'from fdtd_venv import fd... |
#encoding: utf-8
import json
from datetime import datetime
class DateTimeJSONEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, datetime):
return o.strftime('%Y-%m-%d %H:%M:%S')
return super(DateTimeJSONEncoder, self).default(o)
if __name__ == '__main__':
... | [
"datetime.datetime.strptime",
"json.dumps"
] | [((397, 440), 'datetime.datetime.strptime', 'datetime.strptime', (['"""1988-10-19"""', '"""%Y-%m-%d"""'], {}), "('1988-10-19', '%Y-%m-%d')\n", (414, 440), False, 'from datetime import datetime\n'), ((460, 498), 'json.dumps', 'json.dumps', (['j'], {'cls': 'DateTimeJSONEncoder'}), '(j, cls=DateTimeJSONEncoder)\n', (470, ... |
import torch.nn as nn
def vgg16(num_classes):
return VGG(
cfg=[
64, 64, 'M', 128, 128, 'M',
256, 256, 256, 'M', 512, 512, 512, 'M',
512, 512, 512, 'M'
],
dropout=False,
small_images=True,
bn_linear=False,
num_classes=num_classes
... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.Linear",
"torch.nn.AvgPool2d"
] | [((538, 601), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_channels', 'x'], {'kernel_size': '(3)', 'padding': '(1)', 'bias': '(False)'}), '(in_channels, x, kernel_size=3, padding=1, bias=False)\n', (547, 601), True, 'import torch.nn as nn\n'), ((690, 707), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['x'], {}), '(x)\n', (704, ... |
import unittest
import numpy as np
import torch
from sklearn.metrics import accuracy_score
from pytorch_adapt.validators import AccuracyValidator, ScoreHistory
class TestAccuracyValidator(unittest.TestCase):
def test_accuracy_validator(self):
dataset_size = 1000
ignore_epoch = 0
for sta... | [
"pytorch_adapt.validators.AccuracyValidator",
"numpy.isclose",
"numpy.argmax",
"torch.softmax",
"torch.randint",
"pytorch_adapt.validators.ScoreHistory",
"torch.randn"
] | [((398, 417), 'pytorch_adapt.validators.AccuracyValidator', 'AccuracyValidator', ([], {}), '()\n', (415, 417), False, 'from pytorch_adapt.validators import AccuracyValidator, ScoreHistory\n'), ((446, 496), 'pytorch_adapt.validators.ScoreHistory', 'ScoreHistory', (['validator'], {'ignore_epoch': 'ignore_epoch'}), '(vali... |
import sklearn.datasets as skl_ds
import pandas as pd
import sklearn.model_selection as skl_ms
import sklearn.feature_selection as skl_fs
import sklearn.linear_model as skl_lm
import numpy as np
# Loading the dataset
boston = skl_ds.load_boston()
X = pd.DataFrame(boston.data, columns=boston.feature_names) # Feature ... | [
"sklearn.model_selection.train_test_split",
"sklearn.datasets.load_boston",
"numpy.array",
"sklearn.feature_selection.RFE",
"pandas.DataFrame",
"sklearn.linear_model.LinearRegression"
] | [((228, 248), 'sklearn.datasets.load_boston', 'skl_ds.load_boston', ([], {}), '()\n', (246, 248), True, 'import sklearn.datasets as skl_ds\n'), ((253, 308), 'pandas.DataFrame', 'pd.DataFrame', (['boston.data'], {'columns': 'boston.feature_names'}), '(boston.data, columns=boston.feature_names)\n', (265, 308), True, 'imp... |