code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.core.management.base import CommandError
from django.db import models
from django.utils.translation import ugettext_lazy as _
class DjCrontabSchedule(models.Model):
minute = models.CharField(max_length=64, default="*")
hour = models.CharField(max_length=64, default="*")
day_of_week = models.Ch... | [
"django.utils.translation.ugettext_lazy",
"django.db.models.BooleanField",
"django.db.models.PositiveIntegerField",
"django.db.models.SmallIntegerField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((192, 236), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(64)', 'default': '"""*"""'}), "(max_length=64, default='*')\n", (208, 236), False, 'from django.db import models\n'), ((248, 292), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(64)', 'default': '"""*"""'}), "... |
import time
import os
import pickle
import argparse
import multiprocessing as mp
from multiprocessing import Pool
import numpy as np
from single_peaked_bandits.solvers import OptimalSolver
from single_peaked_bandits.helpers import (
get_reward_for_policy,
)
from single_peaked_bandits.constants import RESULTS_FOLD... | [
"argparse.ArgumentParser",
"os.makedirs",
"single_peaked_bandits.helpers.get_reward_for_policy",
"make_plots.make_plots",
"os.path.join",
"multiprocessing.get_context",
"numpy.linspace",
"single_peaked_bandits.solvers.OptimalSolver",
"time.time",
"numpy.arange"
] | [((662, 673), 'time.time', 'time.time', ([], {}), '()\n', (671, 673), False, 'import time\n'), ((805, 861), 'single_peaked_bandits.helpers.get_reward_for_policy', 'get_reward_for_policy', (['bandit.noise_free_arms', 'T', 'policy'], {}), '(bandit.noise_free_arms, T, policy)\n', (826, 861), False, 'from single_peaked_ban... |
from django.urls import path
from . import views
app_name = 'posts'
urlpatterns = [
path('create/<int:pk>/', views.create_post, name='create_post'),
] | [
"django.urls.path"
] | [((91, 154), 'django.urls.path', 'path', (['"""create/<int:pk>/"""', 'views.create_post'], {'name': '"""create_post"""'}), "('create/<int:pk>/', views.create_post, name='create_post')\n", (95, 154), False, 'from django.urls import path\n')] |
####
# Author: <NAME>
# Last Modified: Sept 1st, 2020
# About:
# This script launches a new AWS EC2 instance with a running base Django application.
####
import boto3 as bt
import botocore as bc
import paramiko
import time
client = bt.client('ec2')
resource = bt.resource('ec2')
key_name = 'ec2'
max_ssh_attempts = 5... | [
"boto3.client",
"paramiko.AutoAddPolicy",
"paramiko.RSAKey.from_private_key_file",
"time.sleep",
"boto3.resource",
"paramiko.SSHClient"
] | [((236, 252), 'boto3.client', 'bt.client', (['"""ec2"""'], {}), "('ec2')\n", (245, 252), True, 'import boto3 as bt\n'), ((264, 282), 'boto3.resource', 'bt.resource', (['"""ec2"""'], {}), "('ec2')\n", (275, 282), True, 'import boto3 as bt\n'), ((857, 913), 'paramiko.RSAKey.from_private_key_file', 'paramiko.RSAKey.from_p... |
import asyncio
import discord
from discord.ext import commands
import get_link
client = commands.Bot(command_prefix='.') # Sets the prefix to listen.
async def post_tasks(): # background method to send the data extracted in get_link.py
await client.wait_until_ready()
channel = client.get_channel(6806... | [
"get_link.get_information_main",
"discord.ext.commands.Bot",
"discord.Colour.blurple",
"get_link.get_html",
"asyncio.sleep"
] | [((92, 124), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': '"""."""'}), "(command_prefix='.')\n", (104, 124), False, 'from discord.ext import commands\n'), ((444, 463), 'get_link.get_html', 'get_link.get_html', ([], {}), '()\n', (461, 463), False, 'import get_link\n'), ((1644, 1664), 'asyncio.slee... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.KnCertSendOrderDetail import KnCertSendOrderDetail
class AlipayMarketingCampaignCertQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayMarket... | [
"alipay.aop.api.domain.KnCertSendOrderDetail.KnCertSendOrderDetail.from_alipay_dict"
] | [((857, 898), 'alipay.aop.api.domain.KnCertSendOrderDetail.KnCertSendOrderDetail.from_alipay_dict', 'KnCertSendOrderDetail.from_alipay_dict', (['i'], {}), '(i)\n', (895, 898), False, 'from alipay.aop.api.domain.KnCertSendOrderDetail import KnCertSendOrderDetail\n')] |
import os
import torch as t
from utils.config import opt
from model import FasterRCNNVGG16
from trainer import FasterRCNNTrainer
from data.util import read_image
from utils.vis_tool import vis_bbox
from utils import array_tool as at
from train import train
from Test import test
# train()
# test()
fas... | [
"model.FasterRCNNVGG16",
"os.listdir",
"torch.from_numpy",
"trainer.FasterRCNNTrainer",
"utils.array_tool.tonumpy",
"data.util.read_image"
] | [((331, 348), 'model.FasterRCNNVGG16', 'FasterRCNNVGG16', ([], {}), '()\n', (346, 348), False, 'from model import FasterRCNNVGG16\n'), ((461, 482), 'os.listdir', 'os.listdir', (['demo_path'], {}), '(demo_path)\n', (471, 482), False, 'import os\n'), ((536, 586), 'data.util.read_image', 'read_image', (["(demo_path + '/' ... |
"""This is a script that does not form part of normal testing, but can be
used as a starting point when trying to test features that normally run as
part of plugins. For example, twitter searches.
"""
from dataclasses import dataclass
from datetime import datetime
from plugins.twitter import PROVIDER as provider
from ... | [
"plugins.twitter.PROVIDER._validate",
"plugins.twitter.PROVIDER.client.search_tweets_iterable",
"plugins.twitter.PROVIDER._add_validator_context",
"TwitterSearch.TwitterSearchOrder",
"plugins.twitter.PROVIDER.instantiate_client"
] | [((691, 787), 'plugins.twitter.PROVIDER._add_validator_context', 'provider._add_validator_context', ([], {'uri_id': '(1111111111111111)', 'origin': '(1)', 'provider': '(1)', 'scrape_id': '(1)'}), '(uri_id=1111111111111111, origin=1, provider\n =1, scrape_id=1)\n', (722, 787), True, 'from plugins.twitter import PROVI... |
from flask import Flask, render_template,request
from textblob import TextBlob
from wtforms import Form,StringField,TextAreaField,validators
app = Flask(__name__)
class homepageForm(Form):
sentiments = TextAreaField('Text', render_kw={"rows": 5, "cols": 11})
@app.route('/',methods=['GET','POST'])
def index():
... | [
"flask.render_template",
"textblob.TextBlob",
"wtforms.TextAreaField",
"flask.Flask"
] | [((150, 165), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (155, 165), False, 'from flask import Flask, render_template, request\n'), ((210, 266), 'wtforms.TextAreaField', 'TextAreaField', (['"""Text"""'], {'render_kw': "{'rows': 5, 'cols': 11}"}), "('Text', render_kw={'rows': 5, 'cols': 11})\n", (223, 2... |
"""
Models used by speechmatics
"""
import ssl
from dataclasses import asdict, dataclass, field
from enum import Enum
def del_none(dictionary):
"""
Recursively delete from the dictionary all entries which values are None.
Args:
dictionary (dict): input dictionary
Returns:
dict: outpu... | [
"dataclasses.field",
"dataclasses.asdict"
] | [((1556, 1605), 'dataclasses.field', 'field', ([], {'default_factory': 'ssl.create_default_context'}), '(default_factory=ssl.create_default_context)\n', (1561, 1605), False, 'from dataclasses import asdict, dataclass, field\n'), ((997, 1009), 'dataclasses.asdict', 'asdict', (['self'], {}), '(self)\n', (1003, 1009), Fal... |
import numpy as np
def identity_function(x):
return x
def leaky_relu(x):
return np.max(0.1 * x, x)
def relu(x):
return np.max(0, x)
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def tanh(x):
return np.tanh(x)
def step_function(x):
return np.array(x > 0, dtype=np.int)
def softmax(x):
... | [
"numpy.exp",
"numpy.array",
"numpy.tanh",
"numpy.max"
] | [((92, 110), 'numpy.max', 'np.max', (['(0.1 * x)', 'x'], {}), '(0.1 * x, x)\n', (98, 110), True, 'import numpy as np\n'), ((137, 149), 'numpy.max', 'np.max', (['(0)', 'x'], {}), '(0, x)\n', (143, 149), True, 'import numpy as np\n'), ((226, 236), 'numpy.tanh', 'np.tanh', (['x'], {}), '(x)\n', (233, 236), True, 'import n... |
import torch
import torch.nn as nn
import torch.utils.data as data
import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
import argparse
# import matplotlib.pyplot as plt
import numpy as np
from torch.autograd import Variable
# from sklearn.decomposition import PCA
import sett... | [
"numpy.logical_not",
"classifier.Classifier",
"torch.from_numpy",
"torch.nn.functional.sigmoid",
"torch.cuda.is_available",
"argparse.ArgumentParser",
"numpy.random.random",
"numpy.concatenate",
"torchvision.transforms.ToTensor",
"torch.autograd.Variable",
"numpy.abs",
"numpy.random.choice",
... | [((772, 838), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""MNIST noise active learning"""'}), "(description='MNIST noise active learning')\n", (795, 838), False, 'import argparse\n'), ((1329, 1425), 'torchvision.datasets.MNIST', 'torchvision.datasets.MNIST', (['"""datasets/MNIST"""'], ... |
#!/usr/local/bin/python
import re
import os
refsbib = open('refs.bib', 'r').read()
p = re.compile('@.+{(.*),')
g = p.findall(refsbib)
for f in g:
name = f + '.pdf'
if os.path.isfile(os.path.join('./live/files/', name)):
print("[OK] %s ready" % f)
else:
print("[--] %s not found" % f)
| [
"os.path.join",
"re.compile"
] | [((89, 112), 're.compile', 're.compile', (['"""@.+{(.*),"""'], {}), "('@.+{(.*),')\n", (99, 112), False, 'import re\n'), ((193, 228), 'os.path.join', 'os.path.join', (['"""./live/files/"""', 'name'], {}), "('./live/files/', name)\n", (205, 228), False, 'import os\n')] |
import textwrap
import re
import pytest
from grep_prs import RepoName, _format_matches, _grep_diff
@pytest.mark.parametrize("s", ["", "noslash", "too/many/slashes"])
def test_parse_repo_name_invalid(s):
with pytest.raises(ValueError):
RepoName.parse(s)
@pytest.mark.parametrize(
"pattern, diff, exp... | [
"textwrap.dedent",
"grep_prs.RepoName.parse",
"re.compile",
"pytest.mark.parametrize",
"pytest.raises",
"grep_prs._format_matches"
] | [((104, 169), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""s"""', "['', 'noslash', 'too/many/slashes']"], {}), "('s', ['', 'noslash', 'too/many/slashes'])\n", (127, 169), False, 'import pytest\n'), ((272, 1116), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""pattern, diff, expected"""', '[(\... |
# import
import numpy as np
import json
import pandas as pd
import torch
import os
def seed_everything(seed):
np.random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
torch.manual_seed(seed)
seed_everything(42)
class TrainPipeline:
def __init__(self, hparams, gpu, model, Dataset_train):
... | [
"torch.manual_seed",
"os.makedirs",
"json.dump",
"numpy.random.seed",
"numpy.round"
] | [((116, 136), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (130, 136), True, 'import numpy as np\n'), ((186, 209), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (203, 209), False, 'import torch\n'), ((2196, 2265), 'os.makedirs', 'os.makedirs', (["(self.hparams['debug_path']... |
"""
Unit test for util (i.e. for the parameterisation maths)
"""
import numpy as np
from fourbody import util
def test_inv_mass_stationary():
"""
Test invariant mass of a stationary particle gets calculated correctly
"""
b0_mass = 5279.65
momentum = np.array([[0.0]])
energy = np.array([[b0_... | [
"numpy.allclose",
"numpy.add",
"fourbody.util._invariant_masses",
"fourbody.util.m_plus_minus",
"numpy.array",
"numpy.linspace",
"numpy.cos",
"fourbody.util.phi",
"numpy.sin"
] | [((275, 292), 'numpy.array', 'np.array', (['[[0.0]]'], {}), '([[0.0]])\n', (283, 292), True, 'import numpy as np\n'), ((306, 327), 'numpy.array', 'np.array', (['[[b0_mass]]'], {}), '([[b0_mass]])\n', (314, 327), True, 'import numpy as np\n'), ((609, 637), 'numpy.array', 'np.array', (['[[-2405.25192233]]'], {}), '([[-24... |
import re
class BadRequestError(ValueError):
pass
def valid_int(value):
"""Converts the value to an integer value or zero.
"""
try:
result = int(value)
except ValueError:
result = 0
return result
URL_PATTERN = re.compile(r"^https?://([^#]+)")
def valid_url(url):
match... | [
"re.compile"
] | [((257, 288), 're.compile', 're.compile', (['"""^https?://([^#]+)"""'], {}), "('^https?://([^#]+)')\n", (267, 288), False, 'import re\n')] |
import smtplib
# bring in the by fault email module
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders
# turned into a function to import into scrape.py
# put your own values in the from & to email fields
def send(filenam... | [
"smtplib.SMTP",
"email.mime.base.MIMEBase",
"email.encoders.encode_base64",
"email.mime.multipart.MIMEMultipart",
"email.mime.text.MIMEText"
] | [((420, 435), 'email.mime.multipart.MIMEMultipart', 'MIMEMultipart', ([], {}), '()\n', (433, 435), False, 'from email.mime.multipart import MIMEMultipart\n'), ((647, 686), 'email.mime.base.MIMEBase', 'MIMEBase', (['"""application"""', '"""octet-stream"""'], {}), "('application', 'octet-stream')\n", (655, 686), False, '... |
from pathlib import Path
import requests
from bs4 import BeautifulSoup
from dateutil import parser
from pathvalidate import sanitize_filename
from ..utils import HEADERS
FILE_DIR = Path(Path.home() / "Downloads" / "podcasts" / "conspirituality-podcast")
BASE_URL = "https://conspirituality.net/"
def process_content... | [
"pathvalidate.sanitize_filename",
"pathlib.Path.home",
"requests.get"
] | [((951, 998), 'pathvalidate.sanitize_filename', 'sanitize_filename', (['f"""{pub_date}-Ep-{title}.mp3"""'], {}), "(f'{pub_date}-Ep-{title}.mp3')\n", (968, 998), False, 'from pathvalidate import sanitize_filename\n'), ((1304, 1343), 'requests.get', 'requests.get', (['BASE_URL'], {'headers': 'HEADERS'}), '(BASE_URL, head... |
import fnmatch
import os
from collections import Counter
from conans.client import packager
from conans.client.build_requires import BuildRequires
from conans.client.client_cache import ClientCache
from conans.client.cmd.export import cmd_export, _execute_export
from conans.client.deps_builder import DepsGraphBuilder
... | [
"conans.client.cmd.export.cmd_export",
"conans.client.remover.ConanRemover",
"conans.client.loader_parse.load_conanfile_class",
"conans.model.ref.PackageReference",
"os.path.exists",
"conans.client.tools.cross_building",
"conans.client.cmd.export._execute_export",
"conans.client.importer.run_imports",... | [((28225, 28263), 'os.path.join', 'os.path.join', (['current_path', 'BUILD_INFO'], {}), '(current_path, BUILD_INFO)\n', (28237, 28263), False, 'import os\n'), ((6856, 6910), 'conans.client.loader.ConanFileLoader', 'ConanFileLoader', (['self._runner', 'cache_settings', 'profile'], {}), '(self._runner, cache_settings, pr... |
# -*- coding: utf-8 -*-
import sys
import pandas
import numpy
sys.path.append('../')
import heatmap
from matplotlib.colors import LinearSegmentedColormap
from matplotlib.lines import Line2D
import matplotlib
matplotlib.rcParams['font.sans-serif'] = ['FreeSans', ]
matplotlib.rcParams['mathtext.fontset'] = 'custom'
matp... | [
"pandas.read_csv",
"matplotlib.colors.LinearSegmentedColormap.from_list",
"heatmap.Clustergram",
"sys.path.append",
"numpy.arange"
] | [((63, 85), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (78, 85), False, 'import sys\n'), ((400, 488), 'pandas.read_csv', 'pandas.read_csv', (['"""./rRNAs_analysis/final_distance_matrix.tsv"""'], {'sep': '"""\t"""', 'index_col': '(0)'}), "('./rRNAs_analysis/final_distance_matrix.tsv', sep='\... |
#!/usr/bin/python3
import sys
# stream processing
# streams have groups and garbage.
# groups are delimited by {}.
# groups can contain other groups and garbage.
# garbage is delimited by <>.
# garbage can't contain groups.
# any character followed by ! is cancelled.
# goal is to find total score for all groups.
# g... | [
"sys.stdin.readlines",
"sys.exit"
] | [((1716, 1737), 'sys.stdin.readlines', 'sys.stdin.readlines', ([], {}), '()\n', (1735, 1737), False, 'import sys\n'), ((1792, 1803), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1800, 1803), False, 'import sys\n')] |
import sys, os
sys.path = [os.path.abspath(os.path.dirname(os.path.dirname(__file__)))] + sys.path
import unittest
import nose
from sqlalchemy import create_engine
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey, Boolean, DateTime
from sqlalchemy.orm import mapper
from sqlalchemy impo... | [
"logging.basicConfig",
"logging.getLogger",
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.create_engine",
"nose.runmodule",
"uuid.uuid1",
"os.path.dirname",
"tempfile.NamedTemporaryFile",
"pmpmanager.db_devices.init",
"pmpmanager.job_manage.job_manage"
] | [((5713, 5734), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (5732, 5734), False, 'import logging\n'), ((5774, 5813), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'LoggingLevel'}), '(level=LoggingLevel)\n', (5793, 5813), False, 'import logging\n'), ((5824, 5849), 'logging.getLogger', ... |
from django.db import models
class Call(models.Model):
name = models.CharField(max_length=200)
matriline = models.CharField(max_length=200)
notes = models.CharField(max_length=200)
audio = models.CharField(max_length=200)
image = models.CharField(max_length=200)
duration = models.FloatField()
... | [
"django.db.models.FloatField",
"django.db.models.CharField"
] | [((67, 99), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (83, 99), False, 'from django.db import models\n'), ((116, 148), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (132, 148), False, 'from django.db im... |
from mlx.od.config import cfg, process_config
from mlx.od.data import build_databunch
from mlx.od.plot import plot_dataloader
cfg.base_uri = '/opt/data/pascal2007'
cfg.test_mode = True
process_config(cfg)
tmp_dir = '/opt/data/'
databunch = build_databunch(cfg, tmp_dir)
output_dir = '/opt/data/test/'
plot_dataloader(... | [
"mlx.od.data.build_databunch",
"mlx.od.plot.plot_dataloader",
"mlx.od.config.process_config"
] | [((186, 205), 'mlx.od.config.process_config', 'process_config', (['cfg'], {}), '(cfg)\n', (200, 205), False, 'from mlx.od.config import cfg, process_config\n'), ((242, 271), 'mlx.od.data.build_databunch', 'build_databunch', (['cfg', 'tmp_dir'], {}), '(cfg, tmp_dir)\n', (257, 271), False, 'from mlx.od.data import build_... |
import unittest
from mockito import mock, when, unstub
from pageobject import PageObject
class PageObjectTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.lib = PageObject()
def tearDown(self):
unstub()
def test_01_demo(self):
page = mock()
... | [
"mockito.mock",
"mockito.when",
"mockito.unstub",
"pageobject.PageObject"
] | [((206, 218), 'pageobject.PageObject', 'PageObject', ([], {}), '()\n', (216, 218), False, 'from pageobject import PageObject\n'), ((255, 263), 'mockito.unstub', 'unstub', ([], {}), '()\n', (261, 263), False, 'from mockito import mock, when, unstub\n'), ((311, 317), 'mockito.mock', 'mock', ([], {}), '()\n', (315, 317), ... |
import xadmin
from .models import Courses, Chapter
class CoursesAdmin(object):
list_display = ["title", "is_visible", "show_on_homepage", "add_time", "order", "teachers"]
list_filter = ["teachers", "is_visible", "title"]
search_fields = ['title', ]
class ChapterAdmin(object):
list_display = ["course... | [
"xadmin.site.register"
] | [((483, 526), 'xadmin.site.register', 'xadmin.site.register', (['Courses', 'CoursesAdmin'], {}), '(Courses, CoursesAdmin)\n', (503, 526), False, 'import xadmin\n'), ((527, 570), 'xadmin.site.register', 'xadmin.site.register', (['Chapter', 'ChapterAdmin'], {}), '(Chapter, ChapterAdmin)\n', (547, 570), False, 'import xad... |
# -*- coding: utf-8 -*-
"""
"""
import objc
import Foundation
NSUserDefaults = Foundation.NSUserDefaults
import AppKit
NSApplication = AppKit.NSApplication
NSWindowController = AppKit.NSWindowController
import CactusTools
####
#
# Open Preferences
#
class CactusPreferenceController(NSWindowController):
bu... | [
"CactusTools.getFolderDialog",
"objc.IBOutlet"
] | [((338, 353), 'objc.IBOutlet', 'objc.IBOutlet', ([], {}), '()\n', (351, 353), False, 'import objc\n'), ((371, 386), 'objc.IBOutlet', 'objc.IBOutlet', ([], {}), '()\n', (384, 386), False, 'import objc\n'), ((405, 420), 'objc.IBOutlet', 'objc.IBOutlet', ([], {}), '()\n', (418, 420), False, 'import objc\n'), ((445, 460), ... |
"""
Copyright 2013 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | [
"cloudcafe.objectstorage.objectstorage_api.client.ObjectStorageAPIClient",
"cloudcafe.objectstorage.objectstorage_api.config.ObjectStorageAPIConfig",
"cloudcafe.objectstorage.objectstorage_api.behaviors.ObjectStorageAPI_Behaviors",
"cloudcafe.objectstorage.config.ObjectStorageConfig",
"cloudcafe.auth.config... | [((1306, 1322), 'cloudcafe.auth.config.UserAuthConfig', 'UserAuthConfig', ([], {}), '()\n', (1320, 1322), False, 'from cloudcafe.auth.config import UserAuthConfig, UserConfig\n'), ((1345, 1357), 'cloudcafe.auth.config.UserConfig', 'UserConfig', ([], {}), '()\n', (1355, 1357), False, 'from cloudcafe.auth.config import U... |
from distutils.version import LooseVersion
from io import StringIO
from itertools import product
from string import ascii_lowercase
import struct
import sys
import types
import warnings
import numpy as np
from numpy.random import RandomState
from numpy.testing import (
assert_allclose,
assert_almost_equal,
... | [
"numpy.random.standard_normal",
"struct.calcsize",
"numpy.sqrt",
"numpy.testing.assert_equal",
"numpy.linalg.pinv",
"arch.univariate.volatility.ARCH",
"numpy.array",
"scipy.stats.chi2",
"numpy.isfinite",
"pytest.fixture",
"pandas.testing.assert_frame_equal",
"arch.univariate.mean.ConstantMean"... | [((1871, 1923), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'params': '[True, False]'}), "(scope='module', params=[True, False])\n", (1885, 1923), False, 'import pytest\n'), ((39622, 39736), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""volatility"""', '[GARCH, EGARCH, RiskMetrics20... |
import argparse
import textwrap
from argparse import RawDescriptionHelpFormatter
import help_text
from subparsers.share_image import share_image_subparser
from subparsers.consumer_set_status import consumer_set_status_subparser
from subparsers.list_custom_images import list_custom_images_subparser
from subparsers.list_... | [
"subparsers.consumer_set_status.consumer_set_status_subparser",
"subparsers.share_image.share_image_subparser",
"textwrap.dedent",
"subparsers.list_members.list_members_subparser",
"subparsers.list_all_images.list_all_images_subparser",
"subparsers.member_del.member_del_subparser",
"subparsers.list_cust... | [((1062, 1094), 'subparsers.share_image.share_image_subparser', 'share_image_subparser', (['subparser'], {}), '(subparser)\n', (1083, 1094), False, 'from subparsers.share_image import share_image_subparser\n'), ((1099, 1130), 'subparsers.member_add.member_add_subparser', 'member_add_subparser', (['subparser'], {}), '(s... |
"""
Migration script to (a) create tables for annotating pages.
"""
from __future__ import print_function
import logging
from sqlalchemy import (
Column,
ForeignKey,
Index,
Integer,
MetaData,
Table,
TEXT
)
from galaxy.model.migrate.versions.util import (
create_table,
drop_table
)... | [
"logging.getLogger",
"galaxy.model.migrate.versions.util.create_table",
"galaxy.model.migrate.versions.util.drop_table",
"sqlalchemy.ForeignKey",
"sqlalchemy.MetaData",
"sqlalchemy.Index",
"sqlalchemy.Column"
] | [((328, 355), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (345, 355), False, 'import logging\n'), ((367, 377), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (375, 377), False, 'from sqlalchemy import Column, ForeignKey, Index, Integer, MetaData, Table, TEXT\n'), ((469, 508), 'sq... |
import random
import math
import numpy as np
import cv2
import matplotlib.pyplot as plt
__author__ = '__Girish_Hegde__'
class Sampler:
def __init__(self, radius=1, center=(0, 0), method='rejection_sample'):
self.radius = radius
self.r2 = radius**2
self.cx, self.cy = ce... | [
"cv2.imshow",
"math.cos",
"numpy.array",
"cv2.circle",
"numpy.zeros",
"random.random",
"math.sin",
"cv2.waitKey"
] | [((3885, 3922), 'numpy.zeros', 'np.zeros', (['(hw, hw, 3)'], {'dtype': 'np.uint8'}), '((hw, hw, 3), dtype=np.uint8)\n', (3893, 3922), True, 'import numpy as np\n'), ((3995, 4071), 'cv2.circle', 'cv2.circle', (['coord_frame', '(hw // 2 + cx, hw - (hw // 2 + cy))', 'r', '(255, 0, 0)'], {}), '(coord_frame, (hw // 2 + cx, ... |
import pytest
from utils.jsondict import *
@pytest.mark.parametrize('maybe_dict, key, expected', [
({}, '', None), ({}, 'k', None),
(123, '', 123), (123, 'k', 123),
({'h': 1}, '', None), ({'h': 1}, 'k', None),
({'k': 1}, '', None), ({'k': 1}, 'k', 1)
])
def test_safe_get_value(maybe_dict, key, expecte... | [
"pytest.mark.parametrize"
] | [((46, 262), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""maybe_dict, key, expected"""', "[({}, '', None), ({}, 'k', None), (123, '', 123), (123, 'k', 123), ({'h': 1\n }, '', None), ({'h': 1}, 'k', None), ({'k': 1}, '', None), ({'k': 1},\n 'k', 1)]"], {}), "('maybe_dict, key, expected', [({}, '', N... |
# -*- coding: utf-8 -*-
# django-read-only-admin
# tests/test_utils.py
from typing import List # pylint: disable=W0611
from django.test import TestCase
from django.test.utils import override_settings
from read_only_admin.utils import (
get_read_only_permission_name,
get_read_only_permission_codename,
)
... | [
"read_only_admin.utils.get_read_only_permission_name",
"django.test.utils.override_settings",
"read_only_admin.utils.get_read_only_permission_codename"
] | [((879, 934), 'django.test.utils.override_settings', 'override_settings', ([], {'READ_ONLY_ADMIN_PERMISSION_PREFIX': '""""""'}), "(READ_ONLY_ADMIN_PERMISSION_PREFIX='')\n", (896, 934), False, 'from django.test.utils import override_settings\n'), ((1663, 1723), 'django.test.utils.override_settings', 'override_settings',... |
"""Create sql tables"""
# pylint: disable=unused-argument
# pylint: disable=consider-using-from-import
import logging
import azure.functions as func
import azure.cosmos.cosmos_client as cosmos_client
import azure.cosmos.exceptions as exceptions
from azure.cosmos.partition_key import PartitionKey
from shared_code impor... | [
"shared_code.get_config.get_containers",
"azure.cosmos.cosmos_client.CosmosClient",
"azure.functions.HttpResponse",
"shared_code.get_config.get_cosmosdb",
"azure.cosmos.partition_key.PartitionKey",
"logging.info"
] | [((417, 452), 'logging.info', 'logging.info', (['"""Creating sql tables"""'], {}), "('Creating sql tables')\n", (429, 452), False, 'import logging\n'), ((554, 579), 'shared_code.get_config.get_cosmosdb', 'get_config.get_cosmosdb', ([], {}), '()\n', (577, 579), False, 'from shared_code import get_config\n'), ((593, 672)... |
import os
import tarfile
from cm.util import misc
import cm.util.paths as paths
from cm.services import ServiceRole
from cm.services import ServiceDependency
from cm.services import service_states
from cm.services.apps import ApplicationService
import logging
log = logging.getLogger('cloudman')
class CloudgeneServi... | [
"logging.getLogger",
"os.path.exists",
"tarfile.open",
"cm.services.ServiceRole.to_string",
"os.path.join",
"cm.services.ServiceDependency",
"os.mkdir",
"cm.util.misc.run"
] | [((268, 297), 'logging.getLogger', 'logging.getLogger', (['"""cloudman"""'], {}), "('cloudman')\n", (285, 297), False, 'import logging\n'), ((494, 538), 'cm.services.ServiceRole.to_string', 'ServiceRole.to_string', (['ServiceRole.CLOUDGENE'], {}), '(ServiceRole.CLOUDGENE)\n', (515, 538), False, 'from cm.services import... |
import os
import threading
import time
from liota.dcc_comms.timeout_exceptions import timeoutException
class checkConnection:
def __init__(self, interval=1, hostname = "8.8.8.8"):
self.interval = interval
self.hostname = hostname
self.check = 1
self.thread = threading.Thread(target=self.run)
self.thread.da... | [
"threading.Thread",
"os.system",
"time.sleep"
] | [((270, 303), 'threading.Thread', 'threading.Thread', ([], {'target': 'self.run'}), '(target=self.run)\n', (286, 303), False, 'import threading\n'), ((580, 641), 'os.system', 'os.system', (["('ping -c 1 ' + self.hostname + ' > /dev/null 2>&1')"], {}), "('ping -c 1 ' + self.hostname + ' > /dev/null 2>&1')\n", (589, 641)... |
"""
Trainer for BiGAN/ALI
"""
import numpy as np
import torch
from torch.autograd import Variable
from tqdm import tqdm
from ....common import FloatTensor
from ....utils.plot import get_visdom_line_plotter
class Trainer(object):
def __init__(self, trick_dict=None):
if trick_dict is None:
sel... | [
"numpy.random.normal",
"numpy.array",
"tqdm.tqdm",
"numpy.random.randn"
] | [((2503, 2520), 'tqdm.tqdm', 'tqdm', (['data_loader'], {}), '(data_loader)\n', (2507, 2520), False, 'from tqdm import tqdm\n'), ((4567, 4605), 'numpy.array', 'np.array', (['[dis_loss_lst, gen_loss_lst]'], {}), '([dis_loss_lst, gen_loss_lst])\n', (4575, 4605), True, 'import numpy as np\n'), ((4745, 4775), 'numpy.array',... |
from django.template import Library
from evap.evaluation.models import Semester
from evap.settings import DEBUG, LANGUAGES
register = Library()
@register.inclusion_tag("navbar.html")
def include_navbar(user, language):
return {
"user": user,
"current_language": language,
"languages": LAN... | [
"evap.evaluation.models.Semester.objects.filter",
"evap.evaluation.models.Semester.get_all_with_unarchived_results",
"django.template.Library",
"evap.evaluation.models.Semester.get_all_with_published_unarchived_results"
] | [((136, 145), 'django.template.Library', 'Library', ([], {}), '()\n', (143, 145), False, 'from django.template import Library\n'), ((366, 418), 'evap.evaluation.models.Semester.get_all_with_published_unarchived_results', 'Semester.get_all_with_published_unarchived_results', ([], {}), '()\n', (416, 418), False, 'from ev... |
from functools import partial
# from ..config_new import BTE_FILTERS
BTE_FILTERS = ["nodeDegree", "ngd", "drugPhase", "survivalProbability"]
def filter_response(res, criteria):
"""
Filter API response based on filtering criteria
:param res: API Response
:param criteria: filtering criteria
"""
... | [
"functools.partial"
] | [((1294, 1356), 'functools.partial', 'partial', (['filter_by_operation'], {'key': 'f', 'val': "v['=']", 'operation': '"""="""'}), "(filter_by_operation, key=f, val=v['='], operation='=')\n", (1301, 1356), False, 'from functools import partial\n'), ((1557, 1619), 'functools.partial', 'partial', (['filter_by_operation'],... |
from experiments.training import train
import logging
import uuid
import time
from utilities.monitor import save_scores, render_figure, save_states
class Experiment():
def __init__(self, name, environment, agents, max_t=100, num_episodes=1000, goal = 0., save_states_every = 0, brain_name="", experiment_num=0):
... | [
"utilities.monitor.save_states",
"experiments.training.train",
"time.strftime",
"uuid.uuid4",
"utilities.monitor.save_scores",
"utilities.monitor.render_figure"
] | [((576, 588), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (586, 588), False, 'import uuid\n'), ((2974, 3137), 'utilities.monitor.render_figure', 'render_figure', (['score_history'], {'agents': 'self.agents', 'name': 'self.name', 'goal': 'self.goal', 'display': 'display', 'save': "('figures' in options)", 'scores_wind... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright 2021-... <NAME> <<EMAIL>>.
# This program is distributed under the MIT license.
# Glory to Ukraine!
import DipTrace
import math
from typing import List
data = [
{'uni': 'SMAJ5.0A', 'bi': 'SMAJ5.0CA', 'voltage': 5.0},
{'uni': 'SMAJ6.0A', 'bi': 'SMAJ6.0CA', 'vol... | [
"DipTrace.NameFont",
"DipTrace.Category",
"DipTrace.Origin",
"DipTrace.SpiceModel",
"DipTrace.Point",
"DipTrace.PatternLibrary",
"math.radians",
"DipTrace.compare",
"DipTrace.format_xml"
] | [((6989, 7030), 'DipTrace.format_xml', 'DipTrace.format_xml', (['actual_patterns_path'], {}), '(actual_patterns_path)\n', (7008, 7030), False, 'import DipTrace\n'), ((7032, 7075), 'DipTrace.format_xml', 'DipTrace.format_xml', (['actual_components_path'], {}), '(actual_components_path)\n', (7051, 7075), False, 'import D... |
'''
defines all the sources necessary for building cgui.pyd
'''
import os
BUILD_BUDDYLIST_GUI = False
thisdir = os.path.dirname(os.path.abspath(__file__))
sources = '''
src/ctextutil.cpp
src/SplitImage4.cpp
src/ScrollWindow.cpp
src/skinvlist.cpp
src/pyutils.cpp
src/cwindowfx.cpp
... | [
"os.path.abspath",
"os.getenv"
] | [((824, 846), 'os.getenv', 'os.getenv', (['"""BOOST_DIR"""'], {}), "('BOOST_DIR')\n", (833, 846), False, 'import os\n'), ((135, 160), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (150, 160), False, 'import os\n')] |
import random
print('Enter the two different values')
first = input('Enter first side : ')
second = input('Enter second side : ')
fate = [first,second]
x=random.randint(0,1)
print(fate[x])
| [
"random.randint"
] | [((155, 175), 'random.randint', 'random.randint', (['(0)', '(1)'], {}), '(0, 1)\n', (169, 175), False, 'import random\n')] |
from flask import Flask, render_template
from planner import algorithm, constants
from model.body import Body
app = Flask(__name__)
@app.route('/hello')
def hello_world():
return render_template('main.html')
@app.route('/planner/')
@app.route('/planner/<username>')
def hello(username="Guest"):
one_hot_enco... | [
"flask.render_template",
"model.body.Body",
"planner.constants.one_hot_encoded_weekdays",
"flask.Flask"
] | [((117, 132), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (122, 132), False, 'from flask import Flask, render_template\n'), ((186, 214), 'flask.render_template', 'render_template', (['"""main.html"""'], {}), "('main.html')\n", (201, 214), False, 'from flask import Flask, render_template\n'), ((335, 371)... |
#! /usr/bin/python3
import socket
import threading
import time
class Server:
def __init__(self):
self._drawDataCache = []
self._keyCache = []
self._alive = True
self._host = "localhost"
self._port = 60003
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STRE... | [
"threading.Thread",
"time.sleep",
"socket.socket"
] | [((274, 323), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (287, 323), False, 'import socket\n'), ((495, 528), 'threading.Thread', 'threading.Thread', ([], {'target': 'self.run'}), '(target=self.run)\n', (511, 528), False, 'import threading\... |
from django.conf.urls import patterns
from status.views import StatusView, ExtraStatusView
urlpatterns = patterns('status.views',
(r'^/?$', StatusView.as_view()),
(r'^/(?P<machine_name>[^/]+)$', StatusView.as_view()),
(r'^(?P<query>.+)/$', ExtraStatusView.as_view()),
)
| [
"status.views.ExtraStatusView.as_view",
"status.views.StatusView.as_view"
] | [((147, 167), 'status.views.StatusView.as_view', 'StatusView.as_view', ([], {}), '()\n', (165, 167), False, 'from status.views import StatusView, ExtraStatusView\n'), ((206, 226), 'status.views.StatusView.as_view', 'StatusView.as_view', ([], {}), '()\n', (224, 226), False, 'from status.views import StatusView, ExtraSta... |
from funcs.ngram import ngram
def test_ngram_string():
"""
ngram can be called with a string (e.g. a single cell containing a string)
"""
grams = ngram('Hello world. Hello, world! Hello Alice and Bob.')
assert grams == [
('world hello', 2),
('hello world', 2),
('and bob', 1... | [
"funcs.ngram.ngram"
] | [((164, 220), 'funcs.ngram.ngram', 'ngram', (['"""Hello world. Hello, world! Hello Alice and Bob."""'], {}), "('Hello world. Hello, world! Hello Alice and Bob.')\n", (169, 220), False, 'from funcs.ngram import ngram\n'), ((540, 599), 'funcs.ngram.ngram', 'ngram', (["['Hello world.', 'Hello, world!', 'Hello... world?']"... |
import pytest
from seleniumbase import BaseCase
from qa327.models import db, User
from qa327_test.conftest import base_url
from unittest.mock import patch
from werkzeug.security import generate_password_hash, check_password_hash
test_user = User(
email='<EMAIL>',
name='testuser',
password=generate_password... | [
"unittest.mock.patch",
"werkzeug.security.generate_password_hash"
] | [((952, 1007), 'unittest.mock.patch', 'patch', (['"""qa327.backend.get_user"""'], {'return_value': 'test_user'}), "('qa327.backend.get_user', return_value=test_user)\n", (957, 1007), False, 'from unittest.mock import patch\n'), ((2072, 2127), 'unittest.mock.patch', 'patch', (['"""qa327.backend.get_user"""'], {'return_v... |
'''
SFCMapper.py
Updated: 2/6/18
This script contains methods to generate space filling curves and uses them to
map high dimensional data into lower dimensions.
'''
import numpy as np
class SFCMapper(object):
"""
SFCMapper object is used to generate 3D and 2D space filling curves and map
the traveseral o... | [
"numpy.array",
"numpy.log2",
"numpy.zeros",
"numpy.sqrt"
] | [((723, 749), 'numpy.sqrt', 'np.sqrt', (['(self.size_3d ** 3)'], {}), '(self.size_3d ** 3)\n', (730, 749), True, 'import numpy as np\n'), ((1423, 1439), 'numpy.zeros', 'np.zeros', (['[s, s]'], {}), '([s, s])\n', (1431, 1439), True, 'import numpy as np\n'), ((1039, 1060), 'numpy.log2', 'np.log2', (['self.size_3d'], {}),... |
import inspect
from abc import abstractmethod, ABCMeta
from typing import Callable, Union, Optional, List
from joblib import Memory
# import cupy as cp
from warnings import warn
import numpy as np
from scipy.integrate import quad
# from Operator import Quadrature
from decorators import timer, vectorize
location = ... | [
"decorators.vectorize",
"numpy.less",
"numpy.repeat",
"scipy.integrate.quad",
"numpy.square",
"joblib.Memory",
"numpy.array",
"warnings.warn",
"numpy.vectorize",
"inspect.getsource"
] | [((342, 401), 'joblib.Memory', 'Memory', (['location'], {'verbose': '(0)', 'bytes_limit': '(1024 * 1024 * 1024)'}), '(location, verbose=0, bytes_limit=1024 * 1024 * 1024)\n', (348, 401), False, 'from joblib import Memory\n'), ((7869, 7896), 'numpy.vectorize', 'np.vectorize', (['__q_estimator'], {}), '(__q_estimator)\n'... |
from django.utils.translation import ugettext_lazy as _
from mayan.apps.acls.classes import ModelPermission
from mayan.apps.acls.permissions import permission_acl_edit, permission_acl_view
from mayan.apps.common.apps import MayanAppConfig
from mayan.apps.common.menus import (
menu_multi_item, menu_object, menu_sec... | [
"mayan.apps.common.menus.menu_secondary.bind_links",
"mayan.apps.events.classes.ModelEventType.register",
"django.utils.translation.ugettext_lazy",
"mayan.apps.navigation.classes.SourceColumn",
"mayan.apps.common.menus.menu_object.bind_links",
"mayan.apps.common.menus.menu_multi_item.bind_links",
"mayan... | [((911, 928), 'django.utils.translation.ugettext_lazy', '_', (['"""File caching"""'], {}), "('File caching')\n", (912, 928), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((1105, 1145), 'mayan.apps.events.classes.EventModelRegistry.register', 'EventModelRegistry.register', ([], {'model': 'Cache'})... |
####################################################################
# Skeleton for Appium tests on Sauce Labs RDC
####################################################################
###################################################################
# Imports that are good to use
###################################... | [
"termcolor.colored",
"multiprocessing.Process",
"time.sleep",
"appium.webdriver.Remote",
"urllib3.disable_warnings",
"datetime.datetime.now",
"sys.exit"
] | [((1231, 1298), 'urllib3.disable_warnings', 'urllib3.disable_warnings', (['urllib3.exceptions.InsecureRequestWarning'], {}), '(urllib3.exceptions.InsecureRequestWarning)\n', (1255, 1298), False, 'import urllib3\n'), ((4880, 4890), 'sys.exit', 'sys.exit', ([], {}), '()\n', (4888, 4890), False, 'import sys\n'), ((5680, 5... |
####
# This sample uses the PyPDF2 library for combining pdfs together to get the full pdf for all the views in a
# workbook.
#
# You will need to do `pip install PyPDF2` to use this sample.
#
# To run the script, you must have installed Python 3.5 or later.
####
import argparse
import getpass
import logging
import t... | [
"logging.basicConfig",
"sys.exit",
"logging.debug",
"argparse.ArgumentParser",
"tableauserverclient.TableauAuth",
"getpass.getpass",
"PyPDF2.PdfFileMerger",
"tempfile.mkdtemp",
"functools.partial",
"shutil.rmtree",
"tableauserverclient.Server"
] | [((1200, 1222), 'shutil.rmtree', 'shutil.rmtree', (['tempdir'], {}), '(tempdir)\n', (1213, 1222), False, 'import shutil\n'), ((1250, 1339), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Export to PDF all of the views in a workbook."""'}), "(description=\n 'Export to PDF all of the vi... |
from __future__ import annotations
from dataclasses import dataclass
from datetime import datetime
from snapflow import DataFunctionContext, datafunction
from . import base_import
@dataclass
class ImportCrunchbaseFundingRoundsCSVState:
latest_imported_at: datetime
@datafunction(
"import_funding_rounds",
... | [
"snapflow.datafunction"
] | [((276, 447), 'snapflow.datafunction', 'datafunction', (['"""import_funding_rounds"""'], {'namespace': '"""crunchbase"""', 'state_class': 'ImportCrunchbaseFundingRoundsCSVState', 'display_name': '"""Import Crunchbase Funding Rounds"""'}), "('import_funding_rounds', namespace='crunchbase', state_class=\n ImportCrunch... |
#!/usr/bin/python
# coding=utf-8
# pylint: disable=I0011
# Copyright 2021 getcarrier.io
#
# 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/LICEN... | [
"subprocess.Popen",
"pylon.core.tools.log.info"
] | [((821, 909), 'subprocess.Popen', 'subprocess.Popen', (['*args'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.STDOUT'}), '(*args, **kvargs, stdout=subprocess.PIPE, stderr=subprocess\n .STDOUT)\n', (837, 909), False, 'import subprocess\n'), ((1108, 1122), 'pylon.core.tools.log.info', 'log.info', (['line'], {}... |
from copy import deepcopy
from .transforms import TRANSFORMS
SCHEME_CACHE = {} # global scheme registry
class Scheme():
def __init__(self, scheme_list, agent_flatten=True):
self.scheme_list = scheme_list
if agent_flatten:
self.agent_flatten() # NEW!
self.t_id_depth = self._g... | [
"copy.deepcopy"
] | [((2498, 2515), 'copy.deepcopy', 'deepcopy', (['_scheme'], {}), '(_scheme)\n', (2506, 2515), False, 'from copy import deepcopy\n')] |
import os
from nmapy.classification import *
if __name__ == "__main__":
in_image = "/mnt/GATES/UserDirs/4ja/data/johannesburg_cw_wv2_000024000_000078000_00114.tif"
out = None
block = "30 meters"
model_dir = "/mnt/GATES/UserDirs/4ja/models"
classifier_file = os.path.join(model_dir,... | [
"os.path.join"
] | [((297, 337), 'os.path.join', 'os.path.join', (['model_dir', '"""svm_model.pkl"""'], {}), "(model_dir, 'svm_model.pkl')\n", (309, 337), False, 'import os\n'), ((357, 399), 'os.path.join', 'os.path.join', (['model_dir', '"""data_scaler.pkl"""'], {}), "(model_dir, 'data_scaler.pkl')\n", (369, 399), False, 'import os\n'),... |
from dataclasses import dataclass
import flowpost.wake.helpers.wake_stats as ws
from wake_config import WakeCaseParams
import flowpost.IO.pyTecIO.tecreader as tecreader
import os
import numpy as np
from ...calc.stats import VelocityStatistics, ReynoldsStresses
###########################################################... | [
"flowpost.wake.helpers.wake_stats.compute_field_acf_index",
"flowpost.wake.helpers.wake_stats.rotate_velocities",
"numpy.savez",
"scipy.signal.welch",
"os.makedirs",
"scipy.stats.kurtosis",
"dataclasses.dataclass",
"os.path.join",
"scipy.stats.skew",
"flowpost.wake.helpers.wake_stats.transform_wak... | [((586, 607), 'dataclasses.dataclass', 'dataclass', ([], {'init': '(False)'}), '(init=False)\n', (595, 607), False, 'from dataclasses import dataclass\n'), ((1596, 1649), 'numpy.gradient', 'np.gradient', (['self.vx', '(-self.dy / 1000)', '(self.dx / 1000)'], {}), '(self.vx, -self.dy / 1000, self.dx / 1000)\n', (1607, 1... |
from ..dataloader import load_batch
from .flownet_s_interp import FlowNetS_interp
import argparse
from ..utils import str2bool
import tensorflow as tf
# TODO: update traning scripts for all other architectures with latest changes
def main():
# Create a new network
net = FlowNetS_interp(no_deconv_biases=FLAGS.... | [
"argparse.ArgumentParser",
"tensorflow.Variable"
] | [((10456, 10481), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (10479, 10481), False, 'import argparse\n'), ((924, 991), 'tensorflow.Variable', 'tf.Variable', (['(0)'], {'trainable': '(False)', 'name': '"""global_step"""', 'dtype': 'tf.int64'}), "(0, trainable=False, name='global_step', dtype... |
import urllib.request
import urllib.error
import socket
from .base import ToshiHTTPClientBase, ToshiHTTPResponse
from io import BytesIO
import time
class ToshiHTTPClient(ToshiHTTPClientBase):
def fetch_impl(self, request):
req = urllib.request.Request(
request.url, method=request.method,
... | [
"time.time"
] | [((394, 405), 'time.time', 'time.time', ([], {}), '()\n', (403, 405), False, 'import time\n'), ((668, 679), 'time.time', 'time.time', ([], {}), '()\n', (677, 679), False, 'import time\n')] |
#!/usr/bin/env python3
import sys
from os import path, chmod
from urllib.request import urlopen, Request
from urllib.error import HTTPError
from pathlib import Path
from concurrent.futures import ThreadPoolExecutor, as_completed
target_dir = sys.argv[1]
csv_file = sys.argv[2]
def read_selected_songs(csv_file):
sel... | [
"pathlib.Path",
"concurrent.futures.ThreadPoolExecutor",
"urllib.request.Request",
"os.chmod",
"concurrent.futures.as_completed",
"os.path.isfile"
] | [((1158, 1180), 'os.chmod', 'chmod', (['target_dir', '(493)'], {}), '(target_dir, 493)\n', (1163, 1180), False, 'from os import path, chmod\n'), ((1414, 1448), 'concurrent.futures.ThreadPoolExecutor', 'ThreadPoolExecutor', ([], {'max_workers': '(10)'}), '(max_workers=10)\n', (1432, 1448), False, 'from concurrent.future... |
"""Tests for stopping criteria of probabilistic linear solvers."""
import operator
from typing import Callable
import pytest
from probnum import LambdaStoppingCriterion, StoppingCriterion
@pytest.fixture
def stopcrit():
return LambdaStoppingCriterion(stopcrit=lambda: True)
def test_invert_stopcrit(stopcrit: ... | [
"pytest.mark.parametrize",
"probnum.LambdaStoppingCriterion"
] | [((388, 455), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""binary_op"""', '[operator.and_, operator.or_]'], {}), "('binary_op', [operator.and_, operator.or_])\n", (411, 455), False, 'import pytest\n'), ((236, 283), 'probnum.LambdaStoppingCriterion', 'LambdaStoppingCriterion', ([], {'stopcrit': '(lambda :... |
import numpy
import random
import sys
from nsga2 import Nsga2
class Mtsp(object):
@staticmethod
def crossover_sequence_ox(parent_sequence_a, parent_sequence_b):
sequence_length = len(parent_sequence_a)
child_sequence_a = [None] * sequence_length
child_sequence_b = [None] * sequence_le... | [
"nsga2.Nsga2",
"numpy.zeros",
"random.shuffle",
"random.randrange"
] | [((343, 376), 'random.randrange', 'random.randrange', (['sequence_length'], {}), '(sequence_length)\n', (359, 376), False, 'import random\n'), ((394, 427), 'random.randrange', 'random.randrange', (['sequence_length'], {}), '(sequence_length)\n', (410, 427), False, 'import random\n'), ((1276, 1300), 'random.randrange', ... |
# Generated by Django 2.2.9 on 2020-02-06 15:23
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0005_auto_20200206_1222'),
]
operations = [
migrations.CreateModel(
name='LimiteCategoria',
fiel... | [
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.DecimalField",
"django.db.models.UUIDField"
] | [((348, 441), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (364, 441), False, 'from django.db import migrations, models\... |
import sys
import tensorflow as tf
import pdb
import numpy as np
import myParams
import GTools as GT
import scipy.io
import h5py
import time
FLAGS = tf.app.flags.FLAGS
def setup_inputs(sess, filenames, image_size=None, capacity_factor=3, TestStuff=False):
batch_size=myParams.myDict['batch_size']
channel... | [
"tensorflow.image.resize_images",
"tensorflow.imag",
"tensorflow.get_variable",
"tensorflow.transpose",
"tensorflow.scatter_nd_update",
"numpy.int32",
"tensorflow.multiply",
"tensorflow.real",
"tensorflow.TFRecordReader",
"GTools.TFGenerateRandomSinPhase",
"tensorflow.reduce_mean",
"tensorflow... | [((35891, 35910), 'tensorflow.TFRecordReader', 'tf.TFRecordReader', ([], {}), '()\n', (35908, 35910), True, 'import tensorflow as tf\n'), ((35933, 35974), 'tensorflow.train.string_input_producer', 'tf.train.string_input_producer', (['filenames'], {}), '(filenames)\n', (35963, 35974), True, 'import tensorflow as tf\n'),... |
from django.conf import settings
from django.urls import path
from dictionary.views.detail import Chat, ChatArchive, UserProfile
from dictionary.views.edit import UserPreferences
from dictionary.views.images import ImageList, ImageUpload, ImageDetailProduction, ImageDetailDevelopment
from dictionary.views.list import ... | [
"dictionary.views.list.ActivityList.as_view",
"dictionary.views.edit.UserPreferences.as_view",
"dictionary.views.list.PeopleList.as_view",
"dictionary.views.images.ImageUpload.as_view",
"dictionary.views.detail.UserProfile.as_view",
"dictionary.views.images.ImageList.as_view",
"dictionary.views.list.Con... | [((683, 708), 'dictionary.views.edit.UserPreferences.as_view', 'UserPreferences.as_view', ([], {}), '()\n', (706, 708), False, 'from dictionary.views.edit import UserPreferences\n'), ((756, 776), 'dictionary.views.list.PeopleList.as_view', 'PeopleList.as_view', ([], {}), '()\n', (774, 776), False, 'from dictionary.view... |
# Generated by Django 3.1.8 on 2021-04-23 08:35
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
import uuid
class Migration(migrations.Migration):
replaces = [('flags', '0001_initial'), ('flags... | [
"django.db.models.Index",
"django.db.models.UUIDField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.migrations.RemoveIndex",
"django.db.models.BooleanField",
"django.db.migrations.AlterModelOptions",
"django.db.migrations.AlterModelTable",
"django.db.models.PositiveSmallI... | [((3591, 3664), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""flag"""', 'options': "{'ordering': ['team']}"}), "(name='flag', options={'ordering': ['team']})\n", (3619, 3664), False, 'from django.db import migrations, models\n'), ((3709, 3802), 'django.db.migrations.RemoveI... |
from json import loads as json_loads
from json import dumps as json_dumps
from datetime import timedelta
from redis import Redis
from app.library.market import get_market_data
from app import config
class Cache(object):
def __init__(self):
self.redis = Redis(host=config.REDIS_HOST, port=config.REDIS_POR... | [
"json.loads",
"json.dumps",
"redis.Redis",
"app.library.market.get_market_data",
"datetime.timedelta"
] | [((269, 322), 'redis.Redis', 'Redis', ([], {'host': 'config.REDIS_HOST', 'port': 'config.REDIS_PORT'}), '(host=config.REDIS_HOST, port=config.REDIS_PORT)\n', (274, 322), False, 'from redis import Redis\n'), ((448, 485), 'datetime.timedelta', 'timedelta', ([], {'minutes': 'expiration_minutes'}), '(minutes=expiration_min... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
import numpy as np
import torch
import json
import cv2
import os
from utils.image import flip, color_aug
from utils.image import get_affine_transform, affine_transform
from utils... | [
"numpy.clip",
"math.cos",
"numpy.array",
"utils.image.get_affine_transform",
"numpy.arange",
"numpy.random.random",
"cv2.minAreaRect",
"numpy.concatenate",
"numpy.abs",
"cv2.warpAffine",
"numpy.int0",
"cv2.resize",
"utils.image.color_aug",
"cv2.imread",
"numpy.random.randn",
"math.ceil... | [((530, 608), 'numpy.array', 'np.array', (['[box[0], box[1], box[0] + box[2], box[1] + box[3]]'], {'dtype': 'np.float32'}), '([box[0], box[1], box[0] + box[2], box[1] + box[3]], dtype=np.float32)\n', (538, 608), True, 'import numpy as np\n'), ((1736, 1771), 'numpy.array', 'np.array', (['corners'], {'dtype': 'np.float32... |
from typing import Optional, Any
from nornir.core.task import Result, Task
import requests
def http_method(
task: Optional[Task] = None,
method: str = "get",
url: str = "",
raise_for_status: bool = True,
**kwargs: Any
) -> Result:
"""
This is a convenience task that uses `requests <http:/... | [
"nornir.core.task.Result",
"requests.request"
] | [((1319, 1358), 'requests.request', 'requests.request', (['method', 'url'], {}), '(method, url, **kwargs)\n', (1335, 1358), False, 'import requests\n'), ((1609, 1676), 'nornir.core.task.Result', 'Result', ([], {'host': '(task.host if task else None)', 'response': 'r', 'result': 'result'}), '(host=task.host if task else... |
# -*- coding: utf-8 -*-
"""SKiDL: A Python-Based Schematic Design Language
This module extends Python with the ability to design electronic
circuits. It provides classes for working with:
* Electronic parts (``Part``),
* Collections of part terminals (``Pin``) connected via wires (``Net``), and
* Groups of related n... | [
"future.standard_library.install_aliases"
] | [((1338, 1372), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (1370, 1372), False, 'from future import standard_library\n')] |
# -*- coding: utf-8 -*-
import os, yaml, json
import logging
from yconf.util import NestedDict
logger = logging.getLogger(__name__)
def check_config(obj, name):
return name in obj \
if isinstance(obj, dict) else hasattr(obj, name)
def get_config(obj, name):
return obj.get(name, None) \
if ... | [
"logging.getLogger",
"os.path.exists",
"json.loads",
"yconf.util.NestedDict",
"os.path.join"
] | [((106, 133), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (123, 133), False, 'import logging\n'), ((450, 463), 'yconf.util.NestedDict', 'NestedDict', (['d'], {}), '(d)\n', (460, 463), False, 'from yconf.util import NestedDict\n'), ((544, 574), 'json.loads', 'json.loads', (['self.args.s... |
from sklearn.pipeline import Pipeline, FeatureUnion, _name_estimators
class PartialFeatureUnion(FeatureUnion):
"""
A `PartialFeatureUnion` is a `FeatureUnion` but able to `.partial_fit`.
Arguments:
transformer_list: a list of transformers to apply and concatenate
Example:
```python
... | [
"sklearn.pipeline._name_estimators"
] | [((2878, 2912), 'sklearn.pipeline._name_estimators', '_name_estimators', (['transformer_list'], {}), '(transformer_list)\n', (2894, 2912), False, 'from sklearn.pipeline import Pipeline, FeatureUnion, _name_estimators\n'), ((5406, 5429), 'sklearn.pipeline._name_estimators', '_name_estimators', (['steps'], {}), '(steps)\... |
from openalpr import Alpr
import cv2
import re
import os
alpr = Alpr("eu", "/etc/openalpr/openalpr.conf","/home/pi/openalpr/runtime_data")
if not alpr.is_loaded():
print('Erro ao carregar ALPR')
sys.exit(1)
alpr.set_top_n(200)
#alpr.set_default_region('md')
#Trabalhando com imagens
img = ('/home/pi/Pictures/cel... | [
"re.search",
"cv2.imwrite",
"cv2.VideoCapture",
"openalpr.Alpr"
] | [((64, 139), 'openalpr.Alpr', 'Alpr', (['"""eu"""', '"""/etc/openalpr/openalpr.conf"""', '"""/home/pi/openalpr/runtime_data"""'], {}), "('eu', '/etc/openalpr/openalpr.conf', '/home/pi/openalpr/runtime_data')\n", (68, 139), False, 'from openalpr import Alpr\n'), ((359, 378), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0... |
#!/usr/bin/env python
import argparse as ap
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as clr
from hmmlearn.hmm import GaussianHMM
import scipy.stats as scistats
import logging
import pickle
import os, ntpath
import tables
import cooler
from scipy.sparse import csr_matrix, triu, lil_ma... | [
"numpy.log",
"numpy.count_nonzero",
"numpy.array",
"logging.info",
"numpy.arange",
"numpy.histogram",
"argparse.ArgumentParser",
"numpy.where",
"numpy.ma.masked_where",
"matplotlib.pyplot.close",
"numpy.isinf",
"hmmlearn.hmm.GaussianHMM",
"numpy.tile",
"numpy.triu_indices",
"tables.open_... | [((20269, 20344), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s - %(message)s', level=logging.INFO)\n", (20288, 20344), False, 'import logging\n'), ((20354, 20373), 'argparse.ArgumentParser', 'ap.ArgumentParser', ([], {}... |
import numpy as np
a = np.arange(6)
b = a.reshape(2,3)
c = np.arange(24).reshape(2,3,4)
d = np.arange(100).reshape(2, -1)
e = np.arange(100).reshape(-1, 5)
f = np.ravel(c)
g = np.arange(10).reshape(2,-1)
print(a, a.shape)
print(b, b.shape)
print(c, c.shape)
print(d, d.shape)
print(e, e.shape)
print(f, f.shape)
... | [
"numpy.ravel",
"numpy.arange"
] | [((25, 37), 'numpy.arange', 'np.arange', (['(6)'], {}), '(6)\n', (34, 37), True, 'import numpy as np\n'), ((166, 177), 'numpy.ravel', 'np.ravel', (['c'], {}), '(c)\n', (174, 177), True, 'import numpy as np\n'), ((62, 75), 'numpy.arange', 'np.arange', (['(24)'], {}), '(24)\n', (71, 75), True, 'import numpy as np\n'), ((... |
# -*- coding: utf-8 -*-
# Author: XuMing <<EMAIL>>
# Data: 17/11/23
# Brief: convolutional_network
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("../data/", one_hot=False)
# training params
learning_rate = 0.001
num_steps = 20 # 00
batch_size = ... | [
"tensorflow.contrib.layers.flatten",
"tensorflow.variable_scope",
"tensorflow.layers.max_pooling2d",
"tensorflow.estimator.Estimator",
"tensorflow.estimator.EstimatorSpec",
"tensorflow.metrics.accuracy",
"tensorflow.estimator.inputs.numpy_input_fn",
"tensorflow.examples.tutorials.mnist.input_data.read... | [((192, 244), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""../data/"""'], {'one_hot': '(False)'}), "('../data/', one_hot=False)\n", (217, 244), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((1916, 1946), 'tensorflow.argmax', 'tf.argmax', ... |
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | [
"buildbot.util.safeTranslate"
] | [((3043, 3062), 'buildbot.util.safeTranslate', 'safeTranslate', (['name'], {}), '(name)\n', (3056, 3062), False, 'from buildbot.util import safeTranslate\n')] |
import tensorflow as tf
input = tf.placeholder(tf.string, None)
'''
{
"input": {
"foo": {
"bar": "bar"
}
}
}
'''
root = tf.parse_single_example(input[0], features={
'foo': tf.FixedLenFeature(shape=[], dtype=tf.string),
})
foo = tf.parse_single_example(root['foo'], features={
... | [
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.saved_model.simple_save",
"tensorflow.FixedLenFeature"
] | [((33, 64), 'tensorflow.placeholder', 'tf.placeholder', (['tf.string', 'None'], {}), '(tf.string, None)\n', (47, 64), True, 'import tensorflow as tf\n'), ((389, 401), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (399, 401), True, 'import tensorflow as tf\n'), ((403, 531), 'tensorflow.saved_model.simple_save', ... |
# Generated by Django 3.2.7 on 2021-09-24 22:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('massiliarp', '0002_auto_20210925_0116'),
]
operations = [
migrations.AlterField(
model_name='armyunit',
name='recrui... | [
"django.db.models.DecimalField"
] | [((351, 440), 'django.db.models.DecimalField', 'models.DecimalField', ([], {'decimal_places': '(3)', 'max_digits': '(5)', 'verbose_name': '"""Recruitment cost"""'}), "(decimal_places=3, max_digits=5, verbose_name=\n 'Recruitment cost')\n", (370, 440), False, 'from django.db import migrations, models\n'), ((564, 643)... |
#!/usr/bin/env python
import os
import os.path
import math
from datetime import date
from typing import Union, Optional
from .token import (
SERIAL_LENGTH,
Token,
AbstractTokenFile
)
from .utils import (
AES_KEY_SIZE,
Bytes,
aes_ecb_encrypt,
aes_ecb_decrypt,
Bytearray
)
from .exceptions... | [
"os.path.expanduser",
"math.floor"
] | [((7460, 7481), 'math.floor', 'math.floor', (['(start / 8)'], {}), '(start / 8)\n', (7470, 7481), False, 'import math\n'), ((7919, 7940), 'math.floor', 'math.floor', (['(start / 8)'], {}), '(start / 8)\n', (7929, 7940), False, 'import math\n'), ((2567, 2595), 'os.path.expanduser', 'os.path.expanduser', (['filename'], {... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2019-07-14 16:14:12
# @Author : <NAME> & <NAME> (<EMAIL>)
# @Link : http://iridescent.ink
# @Version : $1.0$
import os
import h5py
import sys
import pickle as pkl
import scipy.io as scio
import numpy as np
def save(data, file):
"""save data to file
... | [
"pickle.dump",
"scipy.io.savemat",
"scipy.io.loadmat",
"pickle.load",
"os.path.splitext"
] | [((913, 935), 'os.path.splitext', 'os.path.splitext', (['file'], {}), '(file)\n', (929, 935), False, 'import os\n'), ((507, 529), 'os.path.splitext', 'os.path.splitext', (['file'], {}), '(file)\n', (523, 529), False, 'import os\n'), ((592, 612), 'pickle.dump', 'pkl.dump', (['data', 'f', '(0)'], {}), '(data, f, 0)\n', (... |
from schafkopf.suits import ACORNS, BELLS, LEAVES, HEARTS, SUITS
from schafkopf.ranks import RANKS, SEVEN, EIGHT, NINE, TEN, UNTER, OBER, KING, ACE
from schafkopf.helpers import sort_hand
class Player:
def __init__(self, name="<NAME>"):
self.name = name
self.hand = []
self.starting_hand = [... | [
"schafkopf.helpers.sort_hand"
] | [((410, 437), 'schafkopf.helpers.sort_hand', 'sort_hand', (['hand', 'trumpcards'], {}), '(hand, trumpcards)\n', (419, 437), False, 'from schafkopf.helpers import sort_hand\n'), ((842, 1117), 'schafkopf.helpers.sort_hand', 'sort_hand', (['starting_hand'], {'trumpcards': '[(OBER, ACORNS), (OBER, LEAVES), (OBER, HEARTS), ... |
from __future__ import absolute_import
from __future__ import print_function
import autograd.numpy as np
import matplotlib.pyplot as plt
from autograd import grad
from builtins import range, map
def fun(x):
return np.sin(x)
d_fun = grad(fun) # First derivative
dd_fun = grad(d_fun) # Second derivative
x = np.l... | [
"matplotlib.pyplot.savefig",
"autograd.numpy.sin",
"autograd.grad",
"autograd.numpy.abs",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.axis",
"autograd.numpy.linspace",
"builtins.range",
"builtins.map",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim"
] | [((238, 247), 'autograd.grad', 'grad', (['fun'], {}), '(fun)\n', (242, 247), False, 'from autograd import grad\n'), ((279, 290), 'autograd.grad', 'grad', (['d_fun'], {}), '(d_fun)\n', (283, 290), False, 'from autograd import grad\n'), ((316, 341), 'autograd.numpy.linspace', 'np.linspace', (['(-10)', '(10)', '(100)'], {... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set",
"pulumi.InvokeOptions",
"pulumi.runtime.invoke"
] | [((2022, 2054), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""bestRoutes"""'}), "(name='bestRoutes')\n", (2035, 2054), False, 'import pulumi\n'), ((2200, 2242), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""bestRoutesForRouters"""'}), "(name='bestRoutesForRouters')\n", (2213, 2242), False, 'import pulumi\n'... |
from utilities.utilities import bisect_string
class BigramWordSegmenter:
"""
Segments a sentence containing no spaces into a list of words, by finding the segmentation that maximizes the bigram
probability. The score for of each possible sentence is the bigram probability of the sentence (probability of ... | [
"utilities.utilities.bisect_string"
] | [((2554, 2578), 'utilities.utilities.bisect_string', 'bisect_string', (['string', 'i'], {}), '(string, i)\n', (2567, 2578), False, 'from utilities.utilities import bisect_string\n')] |
""" contains a class to store the a dictionary of properties,
as produced by the VariantMatrix class .model property,
as json.
This is required because of
a) the need to store these dictionaries for unittesting
b) the insecurity of pickle
c) the fact that pickled data doesn't unpickle properly... | [
"json.loads",
"json.dumps",
"pickle.load",
"pandas.read_json",
"datetime.date.fromisoformat"
] | [((3758, 3780), 'json.dumps', 'json.dumps', (['outputdict'], {}), '(outputdict)\n', (3768, 3780), False, 'import json\n'), ((3903, 3922), 'json.loads', 'json.loads', (['jsonobj'], {}), '(jsonobj)\n', (3913, 3922), False, 'import json\n'), ((4715, 4729), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (4726, 4729), ... |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import copy
import json
import re
from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.fetcher.http import HTTP
from svtplay_dl.service import OpenGraphThumbMixin
from svtplay_dl.se... | [
"json.loads",
"svtplay_dl.error.ServiceError",
"copy.copy",
"re.search"
] | [((523, 585), 're.search', 're.search', (['"""data-config-url="([^"]+)" data-fallback-url"""', 'data'], {}), '(\'data-config-url="([^"]+)" data-fallback-url\', data)\n', (532, 585), False, 'import re\n'), ((616, 676), 're.search', 're.search', (['"""vimeo\\\\.clip_page_config\\\\s*=\\\\s*({.+?});"""', 'data'], {}), "('... |
"""Test tilted backpropagation algorithm"""
import numpy as np
import odtbrain
from common_methods import create_test_sino_3d, create_test_sino_3d_tilted, \
cutout, get_test_parameter_set
def test_3d_backprop_phase_real():
sino, angles = create_test_sino_3d()
parameters = get_test_parameter_set(2)
#... | [
"numpy.allclose",
"common_methods.get_test_parameter_set",
"odtbrain.backpropagate_3d_tilted",
"numpy.array",
"numpy.dot",
"common_methods.create_test_sino_3d_tilted",
"common_methods.cutout",
"numpy.cos",
"numpy.sin",
"odtbrain.backpropagate_3d",
"common_methods.create_test_sino_3d"
] | [((250, 271), 'common_methods.create_test_sino_3d', 'create_test_sino_3d', ([], {}), '()\n', (269, 271), False, 'from common_methods import create_test_sino_3d, create_test_sino_3d_tilted, cutout, get_test_parameter_set\n'), ((289, 314), 'common_methods.get_test_parameter_set', 'get_test_parameter_set', (['(2)'], {}), ... |
from torchvision import datasets, transforms
import torch
from torch.utils.data.sampler import SubsetRandomSampler
import numpy as np
def load_train_data(dataset_name, batch_size, val_split=0.9, dataset_seed=0, resolution=32):
if dataset_name.lower() == "mnist":
dataset = datasets.MNIST('./data/mnist', tr... | [
"torch.utils.data.sampler.SubsetRandomSampler",
"torchvision.transforms.Grayscale",
"numpy.random.seed",
"torch.utils.data.DataLoader",
"torchvision.transforms.Resize",
"torchvision.transforms.ToTensor",
"numpy.random.shuffle"
] | [((1483, 1511), 'numpy.random.seed', 'np.random.seed', (['dataset_seed'], {}), '(dataset_seed)\n', (1497, 1511), True, 'import numpy as np\n'), ((1516, 1542), 'numpy.random.shuffle', 'np.random.shuffle', (['indices'], {}), '(indices)\n', (1533, 1542), True, 'import numpy as np\n'), ((1690, 1724), 'torch.utils.data.samp... |
import pytest
from medipack.lib.time import Time
def test_get_time():
assert Time.get_time('0:5') == '00:00:05'
def test_relative_time():
assert Time.get_relative_time('0:5','0:15') == '00:00:10'
| [
"medipack.lib.time.Time.get_time",
"medipack.lib.time.Time.get_relative_time"
] | [((83, 103), 'medipack.lib.time.Time.get_time', 'Time.get_time', (['"""0:5"""'], {}), "('0:5')\n", (96, 103), False, 'from medipack.lib.time import Time\n'), ((156, 193), 'medipack.lib.time.Time.get_relative_time', 'Time.get_relative_time', (['"""0:5"""', '"""0:15"""'], {}), "('0:5', '0:15')\n", (178, 193), False, 'fro... |
from kivymd.uix.screen import MDScreen
from kivy.lang import Builder
from conexion_BD import Conexion_BD
from kivymd.app import MDApp
# importado para ir al enlace
import webbrowser
#importando la pantalla de navegacion
from navigation_screen import NavigationScreen
kv="""
<LoginScreen>:
name:'login_s... | [
"navigation_screen.NavigationScreen",
"kivy.lang.Builder.load_string",
"webbrowser.open",
"kivymd.app.MDApp.get_running_app",
"conexion_BD.Conexion_BD"
] | [((3141, 3164), 'kivy.lang.Builder.load_string', 'Builder.load_string', (['kv'], {}), '(kv)\n', (3160, 3164), False, 'from kivy.lang import Builder\n'), ((3247, 3270), 'kivymd.app.MDApp.get_running_app', 'MDApp.get_running_app', ([], {}), '()\n', (3268, 3270), False, 'from kivymd.app import MDApp\n'), ((3298, 3311), 'c... |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: FBS
import flatbuffers
class FBody(object):
__slots__ = ["_tab"]
# FBody
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# FBody
def Velocity(self, obj):
obj.Init(self._tab... | [
"flatbuffers.table.Table"
] | [((218, 251), 'flatbuffers.table.Table', 'flatbuffers.table.Table', (['buf', 'pos'], {}), '(buf, pos)\n', (241, 251), False, 'import flatbuffers\n')] |
import re
from typing import Dict, List, Tuple
import h5py
import numpy as np
from logzero import logger
from trcdproc.core import (
H5File,
Dataset,
Group,
subgroups,
datasets,
)
from trcdproc.navigate.common import wavelength_set
from trcdproc.reorganize.common import recursive_copy
def is_wit... | [
"trcdproc.core.subgroups",
"re.compile",
"trcdproc.core.datasets",
"trcdproc.navigate.common.wavelength_set",
"h5py.File",
"logzero.logger.info",
"trcdproc.reorganize.common.recursive_copy",
"logzero.logger.debug"
] | [((1228, 1256), 're.compile', 're.compile', (['"""spectrum(\\\\d+)"""'], {}), "('spectrum(\\\\d+)')\n", (1238, 1256), False, 'import re\n'), ((1306, 1325), 'trcdproc.core.subgroups', 'subgroups', (['old_file'], {}), '(old_file)\n', (1315, 1325), False, 'from trcdproc.core import H5File, Dataset, Group, subgroups, datas... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | [
"qiskit.quantum_info.operators.predicates.is_identity_matrix",
"numpy.allclose",
"numpy.sqrt",
"numpy.conj",
"qiskit.quantum_info.operators.mixins.generate_apidocs",
"qiskit.quantum_info.operators.op_shape.OpShape.auto",
"numpy.asarray",
"qiskit.quantum_info.operators.channel.transformations._to_kraus... | [((12941, 12964), 'qiskit.quantum_info.operators.mixins.generate_apidocs', 'generate_apidocs', (['Kraus'], {}), '(Kraus)\n', (12957, 12964), False, 'from qiskit.quantum_info.operators.mixins import generate_apidocs\n'), ((8055, 8102), 'qiskit.quantum_info.operators.predicates.is_identity_matrix', 'is_identity_matrix', ... |
import json
import textwrap
from redict import utils
class JsonMinifyTestCase:
def template(self, json_string, expected):
in_dict = json.loads(utils.json_minify(json_string))
expected_dict = json.loads(expected)
assert in_dict == expected_dict
def test_1(self):
json_string =... | [
"redict.utils.json_minify",
"textwrap.dedent",
"json.loads"
] | [((215, 235), 'json.loads', 'json.loads', (['expected'], {}), '(expected)\n', (225, 235), False, 'import json\n'), ((321, 944), 'textwrap.dedent', 'textwrap.dedent', (['"""\n // this is a JSON file with comments\n {\n "foo": "bar", // this is cool\n "bar": [\n ... |
import datetime
from .data import subset_data_GBP
from .data import country_subset
today = datetime.datetime.today().strftime('%Y-%m-%d')
subset_data_GBP.process_data_GBP('./data/raw/winemag-data-130k-v2.csv')
country_subset.get_country(f'./data/interim/{today}-winemag_priceGBP.csv', 'Chile')
| [
"datetime.datetime.today"
] | [((92, 117), 'datetime.datetime.today', 'datetime.datetime.today', ([], {}), '()\n', (115, 117), False, 'import datetime\n')] |
import re
PATTERN = re.compile(r"""^([0-9A-Fa-f]+) # (first code)
(\.\.([0-9A-Fa-f]+))? # (.. last code)?
\s*
; # ;
\s*
(\w+) # (property name)
... | [
"re.compile"
] | [((22, 437), 're.compile', 're.compile', (['"""^([0-9A-Fa-f]+) # (first code)\n (\\\\.\\\\.([0-9A-Fa-f]+))? # (.. last code)?\n \\\\s*\n ; # ;\n \\\\s*\n (\\\\w+) ... |