code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
# -*- coding: utf-8 -*-
import numpy as np
from nose.tools import raises, timed, eq_
from jismesh import utils as ju
def _data_scalar():
return [
({'meshcode': 5339}, 1),
({'meshcode': 53392}, 40000),
({'meshcode': 5339235}, 20000),
({'meshcode': 5339467... | [
"numpy.array",
"nose.tools.timed"
] | [((2422, 2430), 'nose.tools.timed', 'timed', (['(2)'], {}), '(2)\n', (2427, 2430), False, 'from nose.tools import raises, timed, eq_\n'), ((1602, 1630), 'numpy.array', 'np.array', (['([6] * num_elements)'], {}), '([6] * num_elements)\n', (1610, 1630), True, 'import numpy as np\n'), ((1559, 1597), 'numpy.array', 'np.arr... |
import torch
import numpy as np
def predict_transform(predictions, inp_dim, anchors, num_classes, cuda_val= True):
batch_size = predictions.size(0)
stride = inp_dim // predictions.size(2)
grid_size = inp_dim//stride
bbox_attrs = 5 + num_classes ## 5+C Class (5 is tx ,ty,tw,ty,objectness score)
... | [
"numpy.meshgrid",
"torch.FloatTensor",
"torch.cat",
"torch.nonzero",
"torch.exp",
"torch.sigmoid",
"torch.clamp",
"numpy.arange",
"torch.max",
"torch.sort",
"torch.min",
"numpy.unique",
"torch.from_numpy"
] | [((861, 896), 'torch.sigmoid', 'torch.sigmoid', (['predictions[:, :, 0]'], {}), '(predictions[:, :, 0])\n', (874, 896), False, 'import torch\n'), ((925, 960), 'torch.sigmoid', 'torch.sigmoid', (['predictions[:, :, 1]'], {}), '(predictions[:, :, 1])\n', (938, 960), False, 'import torch\n'), ((989, 1024), 'torch.sigmoid'... |
# Copyright 2021 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"collections.defaultdict",
"netcad.helpers.parse_istrange",
"netcad.netcam.any_failures"
] | [((3496, 3512), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (3507, 3512), False, 'from collections import defaultdict\n'), ((7476, 7497), 'netcad.netcam.any_failures', 'any_failures', (['results'], {}), '(results)\n', (7488, 7497), False, 'from netcad.netcam import any_failures\n'), ((5369, 5396... |
import unittest
import typewise_alert
class TypewiseTest(unittest.TestCase):
def test_infers_breach_as_per_limits(self):
self.assertTrue(typewise_alert.infer_breach(20, 50, 100) == 'TOO_LOW')
self.assertTrue(typewise_alert.infer_breach(100, 0, 45) == 'TOO_HIGH')
self.assertTrue(typewise_alert.infer_brea... | [
"unittest.main",
"typewise_alert.check_and_alert",
"typewise_alert.classify_temperature_breach",
"typewise_alert.infer_breach"
] | [((1310, 1325), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1323, 1325), False, 'import unittest\n'), ((145, 185), 'typewise_alert.infer_breach', 'typewise_alert.infer_breach', (['(20)', '(50)', '(100)'], {}), '(20, 50, 100)\n', (172, 185), False, 'import typewise_alert\n'), ((220, 259), 'typewise_alert.infer_... |
#!/usr/bin/env python3
# Copyright 2019-2021 <NAME>, <NAME>
#
# This file is part of WarpX.
#
# License: BSD-3-Clause-LBNL
# This script tests the reduced diagnostics.
# The setup is a uniform plasma with electrons, protons and photons.
# Various particle and field quantities are written to file using the reduced dia... | [
"analysis_reduced_diags_impl.do_analysis"
] | [((462, 500), 'analysis_reduced_diags_impl.do_analysis', 'an.do_analysis', ([], {'single_precision': '(False)'}), '(single_precision=False)\n', (476, 500), True, 'import analysis_reduced_diags_impl as an\n')] |
from django.db import models
from django.contrib.auth.models import User
from apps.user_accounts.models import ClientsTable, SubadminTable
# Create your models here.
# Here we define the settings of the app as well as the
# commissions and their different settings
# these value will be used in the transaction or oper... | [
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.FloatField",
"django.db.models.Manager",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((2163, 2255), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'choices': 'PACKAGES', 'blank': '(False)', 'null': '(False)', 'unique': '(True)'}), '(max_length=100, choices=PACKAGES, blank=False, null=False,\n unique=True)\n', (2179, 2255), False, 'from django.db import models\n'), ((... |
import glob
import os
from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
input_dir = "F:/Datasets/DigestPath/safron/test/3/1436_1200/results_tmi3/images"
output_dir = "C:/Users/Srijay/Desktop/Projects/Segmentation/unet/data/crag/TMI_EXP_2/setup3/train/crag_train/real/crag_real_data_provider"
pat... | [
"os.makedirs",
"os.path.exists",
"PIL.Image.open",
"os.path.split",
"os.path.join"
] | [((354, 380), 'os.path.exists', 'os.path.exists', (['output_dir'], {}), '(output_dir)\n', (368, 380), False, 'import os\n'), ((390, 413), 'os.makedirs', 'os.makedirs', (['output_dir'], {}), '(output_dir)\n', (401, 413), False, 'import os\n'), ((512, 534), 'PIL.Image.open', 'Image.open', (['image_path'], {}), '(image_pa... |
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2016, ARM Limited and contributors.
#
# 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
#
# ... | [
"pandas.DataFrame",
"lisa.tests.base.RTATestBundle.check_noisy_tasks",
"math.isnan",
"lisa.wlgen.rta.Periodic",
"lisa.analysis.rta.PerfAnalysis.from_dir",
"matplotlib.pyplot.close",
"lisa.wlgen.rta.Ramp",
"lisa.tests.base.ResultBundle.from_bool",
"lisa.tests.base.CannotCreateError",
"pandas.Series... | [((11688, 11719), 'lisa.trace.requires_events', 'requires_events', (['"""sched_switch"""'], {}), "('sched_switch')\n", (11703, 11719), False, 'from lisa.trace import requires_events\n'), ((11725, 11779), 'lisa.tests.base.RTATestBundle.check_noisy_tasks', 'RTATestBundle.check_noisy_tasks', ([], {'noise_threshold_pct': '... |
#!/usr/bin/env python
# Copyright 2018 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
"dimod.BinaryQuadraticModel.from_coo",
"hybrid.Loop",
"hybrid.SimulatedAnnealingSubproblemSampler",
"hybrid.SplatComposer",
"hybrid.TabuSubproblemSampler",
"hybrid.Identity",
"hybrid.ArgMin",
"hybrid.SimulatedAnnealingProblemSampler",
"hybrid.utils.min_sample",
"hybrid.EnergyImpactDecomposer"
] | [((1361, 1411), 'hybrid.Loop', 'hybrid.Loop', (['iteration'], {'max_iter': '(10)', 'convergence': '(3)'}), '(iteration, max_iter=10, convergence=3)\n', (1372, 1411), False, 'import hybrid\n'), ((776, 815), 'dimod.BinaryQuadraticModel.from_coo', 'dimod.BinaryQuadraticModel.from_coo', (['fp'], {}), '(fp)\n', (811, 815), ... |
import six
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.schedulers.base import STATE_STOPPED
from apscheduler.util import undefined
from bspider.bcron.job import MySQLJob
class MySQLScheduler(BackgroundScheduler):
def add_job(self, func, trigger=None, args=None, kwargs=None,... | [
"six.iteritems",
"bspider.bcron.job.MySQLJob"
] | [((1543, 1571), 'bspider.bcron.job.MySQLJob', 'MySQLJob', (['self'], {}), '(self, **job_kwargs)\n', (1551, 1571), False, 'from bspider.bcron.job import MySQLJob\n'), ((1450, 1475), 'six.iteritems', 'six.iteritems', (['job_kwargs'], {}), '(job_kwargs)\n', (1463, 1475), False, 'import six\n')] |
from wtforms import BooleanField
from wtforms import SelectField
from wtforms import StringField
from wtforms import SubmitField
from wtforms import TextAreaField
from wtforms.validators import DataRequired
from wtforms.validators import Length
from wtforms.validators import Optional
from wtforms.validators import Rege... | [
"tracker.form.validators.SamePackageBase",
"wtforms.validators.Length",
"tracker.form.validators.ValidIssues",
"pyalpm.vercmp",
"wtforms.SubmitField",
"tracker.form.validators.ValidPackageNames",
"wtforms.validators.Optional",
"wtforms.validators.Regexp",
"wtforms.validators.DataRequired",
"tracke... | [((1721, 1743), 'wtforms.SubmitField', 'SubmitField', (['u"""submit"""'], {}), "(u'submit')\n", (1732, 1743), False, 'from wtforms import SubmitField\n'), ((783, 797), 'wtforms.validators.DataRequired', 'DataRequired', ([], {}), '()\n', (795, 797), False, 'from wtforms.validators import DataRequired\n'), ((799, 812), '... |
import unittest
# Given an array of numbers, find the maximum sum of any contiguous subarray of
# the array. [34, -50, 42, 14, -5, 86] => 137
# Additionally, find any the maximum sum of any contiguous subarray of the array
# if the subarray is allowed to wrap around. [8, -1, 3, 4] => 15 because
# we take 3, 4, and 8.
... | [
"unittest.main"
] | [((1199, 1214), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1212, 1214), False, 'import unittest\n')] |
import json
from PIL import Image, ImageFont, ImageDraw
import numpy as np
import os
import requests
# Save just intensities here.
def cache_subpixel_font(ratio, font, palette):
font_cache = {}
for char in palette:
cand_img = Image.new('L', (ratio,ratio))
draw = ImageDraw.Draw(cand_img)
... | [
"PIL.Image.new",
"numpy.sum",
"PIL.ImageFont.load_default",
"os.path.dirname",
"os.path.exists",
"numpy.array",
"requests.get",
"PIL.ImageDraw.Draw"
] | [((957, 981), 'PIL.ImageFont.load_default', 'ImageFont.load_default', ([], {}), '()\n', (979, 981), False, 'from PIL import Image, ImageFont, ImageDraw\n'), ((245, 275), 'PIL.Image.new', 'Image.new', (['"""L"""', '(ratio, ratio)'], {}), "('L', (ratio, ratio))\n", (254, 275), False, 'from PIL import Image, ImageFont, Im... |
import argparse
from glob import glob
import json
from math import ceil
import os
from jinja2 import Environment, FileSystemLoader, select_autoescape
from livereload import Server
from more_itertools import chunked
def main():
parser = configure_argparser()
args = parser.parse_args()
render_library_pages... | [
"os.remove",
"os.makedirs",
"argparse.ArgumentParser",
"math.ceil",
"livereload.Server",
"jinja2.select_autoescape",
"jinja2.FileSystemLoader",
"more_itertools.chunked",
"os.path.join"
] | [((517, 596), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Программа отрендерит страницы библиотеки"""'}), "(description='Программа отрендерит страницы библиотеки')\n", (540, 596), False, 'import argparse\n'), ((849, 885), 'math.ceil', 'ceil', (['(books_on_page / columns_amount)'], {})... |
import logging
import os
from tqdm import tqdm
import json
from dataclasses import dataclass
from transformers.tokenization_bart import BartTokenizer
from transformers.tokenization_roberta import RobertaTokenizer
from transformers.tokenization_utils import PreTrainedTokenizer
from relogic.pretrainkit.datasets.utils im... | [
"tqdm.tqdm",
"json.loads",
"relogic.pretrainkit.datasets.utils.pad_and_tensorize_sequence",
"os.path.isfile",
"logging.getLogger"
] | [((408, 435), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (425, 435), False, 'import logging\n'), ((637, 662), 'os.path.isfile', 'os.path.isfile', (['file_path'], {}), '(file_path)\n', (651, 662), False, 'import os\n'), ((2294, 2388), 'relogic.pretrainkit.datasets.utils.pad_and_tensori... |
"""
get_lemmas.py
This script uses the morphology tier to extract lemmas from a CHILDES
Corpus. These lemmas can be used to create specific mean-length of
utterance counts for individual words.
Function: get_lemmas(filename, outname)- collects all unique lemmas from
... | [
"re.findall"
] | [((760, 789), 're.findall', 're.findall', (['"""(?<=\\\\|)\\\\w+"""', 'l'], {}), "('(?<=\\\\|)\\\\w+', l)\n", (770, 789), False, 'import sys, re\n')] |
"""
============
Sample Files
============
Sample files for unit tests.
"""
import os
DATA_PATH = os.path.join(os.path.dirname(__file__), 'data')
SAMPLE_GRID_FILE = os.path.join(DATA_PATH, 'test_grid.nc')
| [
"os.path.dirname",
"os.path.join"
] | [((169, 208), 'os.path.join', 'os.path.join', (['DATA_PATH', '"""test_grid.nc"""'], {}), "(DATA_PATH, 'test_grid.nc')\n", (181, 208), False, 'import os\n'), ((114, 139), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (129, 139), False, 'import os\n')] |
from nose.tools import *
from ocr import cleaner
samples = [
# 0
'''120-130 Baxter Street, west side, at, adjoining, and south of
the S.W. corner of Hester Street. The view also shows 200-202 Hester
Street, at and adjoining the S.W. corner of Baxter Street.
About 1925.
MAY BE REPRODUCED.
''',
# 1
'''The 440 Club was... | [
"ocr.cleaner.clean",
"ocr.cleaner.remove_warnings",
"ocr.cleaner.merge_lines"
] | [((2076, 2111), 'ocr.cleaner.remove_warnings', 'cleaner.remove_warnings', (['samples[0]'], {}), '(samples[0])\n', (2099, 2111), False, 'from ocr import cleaner\n'), ((2371, 2406), 'ocr.cleaner.remove_warnings', 'cleaner.remove_warnings', (['samples[1]'], {}), '(samples[1])\n', (2394, 2406), False, 'from ocr import clea... |
# Copyright 2016 Autodesk Inc.
# Modifications Copyright (C) 2019 Dietzlab (TUM), <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
#
#... | [
"logging.Formatter",
"logging.StreamHandler",
"logging.getLogger"
] | [((943, 970), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (960, 970), False, 'import logging\n'), ((3367, 3394), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (3384, 3394), False, 'import logging\n'), ((3568, 3591), 'logging.StreamHandler', 'logging.Stre... |
import math
"""Pointwise Mutual Information"""
def pmi(x, y, xy):
return math.log2((xy / x) / y)
def npmi(xy, pmiScore):
return pmiScore / math.log2(xy)
def calculateSimilarity(D, f1, f2, f12):
"""
calculates the PMI similarity
"""
x = (f1 + 1) / (D + 1)
y = (f2 + 1) / (D + 1)
xy ... | [
"math.log2"
] | [((80, 101), 'math.log2', 'math.log2', (['(xy / x / y)'], {}), '(xy / x / y)\n', (89, 101), False, 'import math\n'), ((152, 165), 'math.log2', 'math.log2', (['xy'], {}), '(xy)\n', (161, 165), False, 'import math\n')] |
from django import forms
from django.forms import Form
from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponseNotAllowed
from django.core.urlresolvers import reverse
from django.views import generic
from django.shortcuts import get_object_or_404, render, redirect
from django.core.paginator imp... | [
"django.utils.decorators.method_decorator",
"django.core.urlresolvers.reverse",
"aspc.courses.models.Schedule",
"aspc.courses.models.CourseReview.objects.get_or_create",
"json.dumps",
"aspc.courses.forms.ReviewForm",
"django.http.HttpResponse",
"aspc.courses.models.CourseReview.objects.filter",
"asp... | [((1571, 1599), 'aspc.courses.models.FeaturingQuery.objects.all', 'FeaturingQuery.objects.all', ([], {}), '()\n', (1597, 1599), False, 'from aspc.courses.models import Section, Department, Schedule, RefreshHistory, START_DATE, END_DATE, Term, Course, Instructor, CourseReview, FeaturingQuery\n'), ((3544, 3591), 'aspc.co... |
def get_providers_path():
import pkg_resources
return pkg_resources.resource_filename('dbxref', 'providers.yaml')
def load_providers():
return _load_providers(get_providers_path())
def _load_providers(path):
import yaml
data = []
with open(path) as data_file:
data = yaml.load(data_file... | [
"yaml.load",
"pkg_resources.resource_filename"
] | [((62, 121), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""dbxref"""', '"""providers.yaml"""'], {}), "('dbxref', 'providers.yaml')\n", (93, 121), False, 'import pkg_resources\n'), ((301, 341), 'yaml.load', 'yaml.load', (['data_file'], {'Loader': 'yaml.Loader'}), '(data_file, Loader=yaml.Lo... |
# -*- coding: utf-8 -*-
import os
import json
import codecs
from pathlib import Path
class Config():
def __init__(self, fp=None, default=None):
self.path = fp or './config.json'
self.data = default or {}
if not os.path.isfile(self.path):
self.save()
self.load()
def ... | [
"json.dump",
"json.load",
"codecs.open",
"os.path.isfile",
"pathlib.Path"
] | [((240, 265), 'os.path.isfile', 'os.path.isfile', (['self.path'], {}), '(self.path)\n', (254, 265), False, 'import os\n'), ((345, 381), 'codecs.open', 'codecs.open', (['self.path', '"""r"""', '"""utf-8"""'], {}), "(self.path, 'r', 'utf-8')\n", (356, 381), False, 'import codecs\n'), ((405, 417), 'json.load', 'json.load'... |
from django.test import TestCase
from django.urls import reverse
from bookclubs.models import User, Club, Application, Role
from bookclubs.tests.helpers import reverse_with_next
class ApplicationListViewTestCase(TestCase):
"""Tests for the application list that owners/ moderators can view"""
VIEW = 'applica... | [
"bookclubs.models.Club.objects.get",
"bookclubs.tests.helpers.reverse_with_next",
"bookclubs.models.Application.objects.count",
"django.urls.reverse",
"bookclubs.models.Application.objects.create",
"bookclubs.models.Role.objects.get",
"bookclubs.models.Role.objects.create",
"bookclubs.models.User.obje... | [((560, 597), 'bookclubs.models.User.objects.get', 'User.objects.get', ([], {'username': '"""@johndoe"""'}), "(username='@johndoe')\n", (576, 597), False, 'from bookclubs.models import User, Club, Application, Role\n'), ((623, 660), 'bookclubs.models.User.objects.get', 'User.objects.get', ([], {'username': '"""@janedoe... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-07-13 20:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data_schema', '0003_auto_20151013_1556'),
]
operations = [
migrations.AddFie... | [
"django.db.models.CharField"
] | [((415, 482), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'default': 'None', 'max_length': '(5)', 'null': '(True)'}), '(blank=True, default=None, max_length=5, null=True)\n', (431, 482), False, 'from django.db import migrations, models\n')] |
# Copyright (C) 2017 Mandiant, Inc. All Rights Reserved.
import copy
import operator
import collections
from typing import Dict, List, Tuple, DefaultDict
import tqdm
import viv_utils
import floss.utils
import floss.logging_
from floss.features.extract import (
abstract_features,
extract_insn_features,
ex... | [
"floss.features.extract.abstract_features",
"operator.getitem",
"viv_utils.flirt.is_library_function",
"copy.copy",
"tqdm.contrib.logging.logging_redirect_tqdm",
"collections.defaultdict",
"viv_utils.get_function_name",
"floss.features.extract.extract_basic_block_features",
"viv_utils.Function",
"... | [((2845, 2865), 'copy.copy', 'copy.copy', (['functions'], {}), '(functions)\n', (2854, 2865), False, 'import copy\n'), ((3518, 3547), 'collections.defaultdict', 'collections.defaultdict', (['dict'], {}), '(dict)\n', (3541, 3547), False, 'import collections\n'), ((4087, 4131), 'tqdm.contrib.logging.logging_redirect_tqdm... |
################
# imports #
################
import numpy as np
import pandas as pd
from elasticsearch import Elasticsearch
from flask import Response
from flask import current_app as app
from . import keywords_blueprint
es = Elasticsearch()
################
# routes #
################
@keywords_bluep... | [
"elasticsearch.Elasticsearch",
"numpy.append",
"flask.Response",
"pandas.DataFrame.from_dict"
] | [((235, 250), 'elasticsearch.Elasticsearch', 'Elasticsearch', ([], {}), '()\n', (248, 250), False, 'from elasticsearch import Elasticsearch\n'), ((1063, 1093), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['fields'], {}), '(fields)\n', (1085, 1093), True, 'import pandas as pd\n'), ((1139, 1171), 'flask.Resp... |
import unittest
import mock
from gocdapi.agent import Agent
from gocdapi.go import Go
class TestAgent(unittest.TestCase):
DATA0 = {
"resources": [],
"sandbox": "/var/lib/go-agent",
"os": "Linux",
"free_space": "35.7 GB",
"ip_address": "127.0.0.1",
"agent_name": "v... | [
"unittest.main",
"mock.patch.object",
"gocdapi.go.Go",
"gocdapi.agent.Agent"
] | [((648, 689), 'mock.patch.object', 'mock.patch.object', (['Agent', '"""get_json_data"""'], {}), "(Agent, 'get_json_data')\n", (665, 689), False, 'import mock\n'), ((1145, 1160), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1158, 1160), False, 'import unittest\n'), ((577, 593), 'gocdapi.go.Go', 'Go', (['self.bas... |
import json
from django.core.exceptions import ImproperlyConfigured
try:
import restlib2 # noqa
import preserialize # noqa
except ImportError:
raise ImproperlyConfigured('restlib2 and django-preserialize must be '
'installed to use the resource classes')
from functools impo... | [
"functools.partial",
"django.core.exceptions.ImproperlyConfigured",
"preserialize.serialize.serialize",
"django.http.HttpResponse",
"django.core.urlresolvers.reverse",
"restlib2.params.BoolParam"
] | [((2454, 2465), 'restlib2.params.BoolParam', 'BoolParam', ([], {}), '()\n', (2463, 2465), False, 'from restlib2.params import Parametizer, BoolParam\n'), ((163, 275), 'django.core.exceptions.ImproperlyConfigured', 'ImproperlyConfigured', (['"""restlib2 and django-preserialize must be installed to use the resource class... |
import os
import glob
import numpy
import scipy
from PyQt5.QtCore import *
from PyQt5.QtGui import *
# whole image annotation labels
LPOS, LNEG, LSKIP = 1, -1, 0
# difficulty level:
# skip: no label (default)
# simple L1: one object on clean background
# simple L2: multiple objects on clean background
# medium L3: ... | [
"os.makedirs",
"os.path.basename",
"os.getcwd",
"os.path.isdir",
"os.path.exists",
"os.path.splitext",
"glob.glob"
] | [((1591, 1612), 'os.path.exists', 'os.path.exists', (['fname'], {}), '(fname)\n', (1605, 1612), False, 'import os\n'), ((13974, 13990), 'glob.glob', 'glob.glob', (['chain'], {}), '(chain)\n', (13983, 13990), False, 'import glob\n'), ((5586, 5614), 'os.path.splitext', 'os.path.splitext', (['self.fname'], {}), '(self.fna... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'PinOnDiskMain.ui'
#
# Created by: PyQt5 UI code generator 5.13.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
... | [
"PyQt5.QtWidgets.QSizePolicy",
"PyQt5.QtGui.QColor",
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QTabWidget",
"PyQt5.QtWidgets.QMenuBar",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QWidget",
"PyQt5.... | [((25072, 25104), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (25094, 25104), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((25122, 25145), 'PyQt5.QtWidgets.QMainWindow', 'QtWidgets.QMainWindow', ([], {}), '()\n', (25143, 25145), False, 'from PyQt5 import QtC... |
#!/usr/bin/env python
from utils import find_files,get_args,dict2str
################# FROM FRANK ###################################
import os,sys
from dcnn_base import DCNN_CONFIG
from dcnn_main import DCNN
from dcnn_logger import setup_script_logging,init_logfile
__version__= "2020-07-06-001"
###############... | [
"dcnn_base.DCNN_CONFIG",
"dcnn_logger.setup_script_logging",
"utils.get_args",
"dcnn_main.DCNN",
"utils.find_files",
"os.path.splitext",
"dcnn_logger.init_logfile",
"os.path.join",
"sys.exit"
] | [((1076, 1104), 'dcnn_base.DCNN_CONFIG', 'DCNN_CONFIG', ([], {'verbose': 'verbose'}), '(verbose=verbose)\n', (1087, 1104), False, 'from dcnn_base import DCNN_CONFIG\n'), ((1150, 1168), 'dcnn_main.DCNN', 'DCNN', ([], {}), '(**cfg.config)\n', (1154, 1168), False, 'from dcnn_main import DCNN\n'), ((3565, 3600), 'utils.get... |
#!/bin/python
import listify_circuits
listify_circuits.optimize_circuits(25, 'reverse') | [
"listify_circuits.optimize_circuits"
] | [((39, 88), 'listify_circuits.optimize_circuits', 'listify_circuits.optimize_circuits', (['(25)', '"""reverse"""'], {}), "(25, 'reverse')\n", (73, 88), False, 'import listify_circuits\n')] |
from __future__ import annotations
import os
import re
from pydoc import locate
from syenv.exceptions import SysenvError
from typing import Any, Dict, Generator, List
class Syenv:
"""The Syenv class definition.
Load the environment variables which contains the prefix (if needed)
and auto hydrate itself wi... | [
"pydoc.locate",
"re.match",
"re.findall",
"os.environ.keys",
"syenv.exceptions.SysenvError",
"re.search"
] | [((3003, 3020), 'os.environ.keys', 'os.environ.keys', ([], {}), '()\n', (3018, 3020), False, 'import os\n'), ((2538, 2559), 're.search', 're.search', (['pattern', 'k'], {}), '(pattern, k)\n', (2547, 2559), False, 'import re\n'), ((3037, 3076), 're.match', 're.match', (["('^%s' % self._prefix)", 'env_key'], {}), "('^%s'... |
from models import SegDecNet
import torch
import cv2
import numpy as np
import torch.nn as nn
import matplotlib.pyplot as plt
import os
import streamlit as st
from PIL import Image
st.title("Textile Defect Detection")
def to_tensor(x) -> torch.Tensor:
if x.dtype != np.float32:
x = (x / 255.0).astype(np.f... | [
"matplotlib.pyplot.title",
"streamlit.image",
"matplotlib.pyplot.clf",
"cv2.imdecode",
"streamlit.title",
"matplotlib.pyplot.figure",
"cv2.rectangle",
"matplotlib.pyplot.imshow",
"torch.load",
"matplotlib.pyplot.yticks",
"numpy.transpose",
"numpy.max",
"streamlit.text",
"matplotlib.pyplot.... | [((182, 218), 'streamlit.title', 'st.title', (['"""Textile Defect Detection"""'], {}), "('Textile Defect Detection')\n", (190, 218), True, 'import streamlit as st\n'), ((569, 600), 'models.SegDecNet', 'SegDecNet', (['device', '(512)', '(1408)', '(1)'], {}), '(device, 512, 1408, 1)\n', (578, 600), False, 'from models im... |
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash_table import DataTable
widgets = {
'sintatic_an_dropdown': dcc.Dropdown(
id='sintatic-an-dropdown',
),
'sintatic_an_input': dbc.Input(
id='sintatic-an-input',
pl... | [
"dash_bootstrap_components.Input",
"dash_html_components.Div",
"dash_html_components.A",
"dash_bootstrap_components.Button",
"dash_core_components.Dropdown",
"dash_bootstrap_components.Textarea",
"dash_table.DataTable"
] | [((186, 225), 'dash_core_components.Dropdown', 'dcc.Dropdown', ([], {'id': '"""sintatic-an-dropdown"""'}), "(id='sintatic-an-dropdown')\n", (198, 225), True, 'import dash_core_components as dcc\n'), ((267, 326), 'dash_bootstrap_components.Input', 'dbc.Input', ([], {'id': '"""sintatic-an-input"""', 'placeholder': '"""Gr... |
import shutil
import unittest
from pathlib import Path
from astropy.time import Time
import libstempo as t2
import numpy as np
from libstempo.toasim import fakepulsar
DATA_PATH = t2.__path__[0] + "/data/"
TMP_DIR = Path("test_fake_output")
TMP_DIR.mkdir(exist_ok=True)
class TestFakePulsar(unittest.TestCase):
... | [
"astropy.time.Time",
"libstempo.tempopulsar",
"pathlib.Path",
"numpy.arange",
"shutil.rmtree",
"libstempo.toasim.fakepulsar",
"numpy.all"
] | [((219, 243), 'pathlib.Path', 'Path', (['"""test_fake_output"""'], {}), "('test_fake_output')\n", (223, 243), False, 'from pathlib import Path\n'), ((381, 427), 'numpy.arange', 'np.arange', (['(53000)', '(54800)', '(10)'], {'dtype': 'np.float128'}), '(53000, 54800, 10, dtype=np.float128)\n', (390, 427), True, 'import n... |
from requests import HTTPError
from deriva.core import DerivaServer, ErmrestCatalog, get_credential
from deriva.core.ermrest_model import Table, Column, Key, builtin_types
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('hostname')
parser.add_argument('catalog_number')
parser.add_argument('schem... | [
"deriva.core.ErmrestCatalog",
"deriva.core.DerivaServer",
"argparse.ArgumentParser",
"deriva.core.get_credential"
] | [((198, 223), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (221, 223), False, 'import argparse\n'), ((529, 553), 'deriva.core.get_credential', 'get_credential', (['hostname'], {}), '(hostname)\n', (543, 553), False, 'from deriva.core import DerivaServer, ErmrestCatalog, get_credential\n'), ((... |
#!/usr/bin/python3
import os, random, string
from os import listdir
from os.path import isfile, join
from PIL import Image
def is16to9(img):
img.size
return img.size[0] * 9 == img.size[1] * 16
def cropTo16to9(img):
original_size = img.size
if is16to9(img):
cropped_img = img
else:
width = original_size[0]
... | [
"os.mkdir",
"random.SystemRandom",
"os.stat",
"PIL.Image.open",
"os.path.join",
"os.listdir"
] | [((557, 575), 'os.stat', 'os.stat', (['"""resized"""'], {}), "('resized')\n", (564, 575), False, 'import os, random, string\n'), ((639, 660), 'PIL.Image.open', 'Image.open', (['imagefile'], {}), '(imagefile)\n', (649, 660), False, 'from PIL import Image\n'), ((513, 525), 'os.listdir', 'listdir', (['"""."""'], {}), "('.... |
import sys
import tarfile
import contextlib
def _tarfile_open_ex(*args, **kwargs):
"""
Extend result as a context manager.
"""
return contextlib.closing(tarfile.open(*args, **kwargs))
if sys.version_info[:2] < (2, 7) or (3, 0) <= sys.version_info[:2] < (3, 2):
tarfile_open = _tarfile_open_ex
els... | [
"tarfile.open"
] | [((171, 200), 'tarfile.open', 'tarfile.open', (['*args'], {}), '(*args, **kwargs)\n', (183, 200), False, 'import tarfile\n')] |
# The MIT License (MIT)
#
# Copyright (c) 2018 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | [
"c4d.Matrix",
"weakref.ref",
"c4d.Vector"
] | [((4958, 4975), 'weakref.ref', 'weakref.ref', (['tree'], {}), '(tree)\n', (4969, 4975), False, 'import weakref\n'), ((5066, 5086), 'c4d.Vector', 'c4d.Vector', (['position'], {}), '(position)\n', (5076, 5086), False, 'import c4d\n'), ((5103, 5119), 'c4d.Vector', 'c4d.Vector', (['size'], {}), '(size)\n', (5113, 5119), Fa... |
# 一个问题:这里的变换是直接生成新的文件夹无论原图变换与否都会重新生成的
# 如果数据集比较大,可以将src与dst写成一个,这样就能覆盖原图节省内存,但是慎重,确保无误再这么做!
# 所有变换均为随机的,如果想有目的地进行增强指定部分数据,去掉random的部分即可
import cv2
# import ipdb
import os
import numpy as np
import random
import math
# ipdb.set_trace()
# 仿射变换:旋转/缩放/平移/裁剪
#Translation +/- 10% (vertical and horizontal)
#Rotation ... | [
"cv2.GaussianBlur",
"cv2.warpPerspective",
"numpy.minimum",
"numpy.maximum",
"cv2.getRotationMatrix2D",
"cv2.cvtColor",
"numpy.flipud",
"numpy.clip",
"random.random",
"cv2.warpAffine",
"numpy.fliplr",
"cv2.imread",
"numpy.random.normal",
"numpy.eye",
"os.path.join",
"os.listdir"
] | [((1747, 1850), 'cv2.warpPerspective', 'cv2.warpPerspective', (['img', 'M'], {'dsize': '(height, width)', 'flags': 'cv2.INTER_LINEAR', 'borderValue': 'borderValue'}), '(img, M, dsize=(height, width), flags=cv2.INTER_LINEAR,\n borderValue=borderValue)\n', (1766, 1850), False, 'import cv2\n'), ((4496, 4532), 'cv2.cvtC... |
import random
import json
from datetime import datetime, timedelta
OBJECT_TYPES = ('Order', 'Product', 'Invoice')
PRODUCT_TYPES = ('Laptop', 'Camera', 'Phone', 'Computer', 'Watch', 'Tablet')
STATUS_TYPES = ('paid', 'unpaid')
def create_headers():
return ('object_id', 'object_type', 'timestamp', 'object_changes')... | [
"datetime.datetime.utcnow",
"random.randint",
"random.choice",
"json.dumps"
] | [((400, 417), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (415, 417), False, 'from datetime import datetime, timedelta\n'), ((1759, 1778), 'json.dumps', 'json.dumps', (['changes'], {}), '(changes)\n', (1769, 1778), False, 'import json\n'), ((460, 487), 'random.choice', 'random.choice', (['OBJECT_TY... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utility functions used by client and server implementations.
"""
from six.moves import urllib
def is_scheme_form(form, base, scheme):
"""Returns True if the scheme of the URI for
the given Form matches the scheme argument."""
resolved_url = form.resolve... | [
"six.moves.urllib.parse.urlparse"
] | [((404, 439), 'six.moves.urllib.parse.urlparse', 'urllib.parse.urlparse', (['resolved_url'], {}), '(resolved_url)\n', (425, 439), False, 'from six.moves import urllib\n')] |
from django.db import models
class Project(models.Model):
name = models.CharField(max_length=100)
image = models.ImageField(upload_to='images/', blank=True)
featured = models.BooleanField(default=False)
summary = models.TextField(max_length=200)
body = models.TextField()
link = models.URLField(... | [
"django.db.models.TextField",
"django.db.models.URLField",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.ImageField"
] | [((70, 102), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (86, 102), False, 'from django.db import models\n'), ((115, 165), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""images/"""', 'blank': '(True)'}), "(upload_to='images/', blank=... |
"""
API that web-scrapes ChEMBL.
"""
from __future__ import annotations
import abc
import enum
from functools import cached_property
from pathlib import Path
from typing import Optional, Type
import decorateme
import pandas as pd
from pocketutils.core.enums import CleverEnum
from pocketutils.core.query_utils import Q... | [
"pandas.DataFrame",
"typeddfs.TypedDfs.typed",
"decorateme.auto_repr_str"
] | [((1861, 1887), 'decorateme.auto_repr_str', 'decorateme.auto_repr_str', ([], {}), '()\n', (1885, 1887), False, 'import decorateme\n'), ((3537, 3571), 'pandas.DataFrame', 'pd.DataFrame', (['rows'], {'columns': 'header'}), '(rows, columns=header)\n', (3549, 3571), True, 'import pandas as pd\n'), ((1404, 1449), 'typeddfs.... |
# coding:utf-8
from LxBasic import bscCfg, bscMethods
from LxPreset import prsOutputs
class DtbBasic(object):
DbAssetRoot = prsOutputs.Util.dbAssetRoot
DbRoot_Basic = 'e:/myproject'
#
LxDb_Folder_Basic = '.lynxi.database'
#
LxDb_Folder_Unit = '.unit'
LxDb_Folder_Datum = '.datum'
LxDb... | [
"LxBasic.bscMethods.String.toUniqueId"
] | [((2958, 3007), 'LxBasic.bscMethods.String.toUniqueId', 'bscMethods.String.toUniqueId', (['productModuleString'], {}), '(productModuleString)\n', (2986, 3007), False, 'from LxBasic import bscCfg, bscMethods\n')] |
import unittest
from unittest.mock import MagicMock
from flashflow.cmd.coord import States
from flashflow.msg import FFMsg
class MockMeasrProtocol:
''' Mock coord.MeasrProtocol '''
pass
class MockTorController(MagicMock):
pass
def rand_listen_addr():
from random import randint
# return '[::1]:... | [
"tempfile.TemporaryDirectory",
"random.randint",
"unittest.skip",
"flashflow.msg.FFMsg",
"flashflow.cmd.coord.StateMachine",
"flashflow.config.get_config"
] | [((1921, 1957), 'unittest.skip', 'unittest.skip', (['"""pastly/flashflow#13"""'], {}), "('pastly/flashflow#13')\n", (1934, 1957), False, 'import unittest\n'), ((3518, 3760), 'unittest.skip', 'unittest.skip', (['"""Can\'t figure out why contained cb() called twice, the 1st time with "address already in use". Actually ..... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'server.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^api/', include('api.urls', namespace... | [
"django.conf.urls.include"
] | [((246, 270), 'django.conf.urls.include', 'include', (['admin.site.urls'], {}), '(admin.site.urls)\n', (253, 270), False, 'from django.conf.urls import patterns, include, url\n'), ((291, 327), 'django.conf.urls.include', 'include', (['"""api.urls"""'], {'namespace': '"""api"""'}), "('api.urls', namespace='api')\n", (29... |
from typing import Union
from warnings import warn
import numpy as np
import torch
import torch.nn.functional as F
from torch import Tensor
from disprcnn.layers import interpolate
class DisparityMap:
data: Tensor
def __init__(self, data: Union[np.ndarray, Tensor]):
if isinstance(data, Tensor):
... | [
"torch.zeros",
"warnings.warn",
"torch.nn.functional.adaptive_max_pool2d",
"torch.tensor"
] | [((1017, 1060), 'warnings.warn', 'warn', (['"""dst size < 0, size will not change."""'], {}), "('dst size < 0, size will not change.')\n", (1021, 1060), False, 'from warnings import warn\n'), ((395, 413), 'torch.tensor', 'torch.tensor', (['data'], {}), '(data)\n', (407, 413), False, 'import torch\n'), ((2244, 2275), 't... |
import application.models
from sqlalchemy import func
def get_user_by_id(userid):
return application.models.User.query.filter_by(userid = userid).first()
def get_user_by_name(username):
return application.models.User.query.filter(func.lower(application.models.User.username) == func.lower(username)).first()
... | [
"sqlalchemy.func.lower"
] | [((241, 285), 'sqlalchemy.func.lower', 'func.lower', (['application.models.User.username'], {}), '(application.models.User.username)\n', (251, 285), False, 'from sqlalchemy import func\n'), ((289, 309), 'sqlalchemy.func.lower', 'func.lower', (['username'], {}), '(username)\n', (299, 309), False, 'from sqlalchemy import... |
"""
模块功能:
1. 采集批改网所有在库作文数据
2. 清洗,预处理
3. 入库信息键:pid作文号、title作文标题、abstract简介、refer参考答案{可能为空}、
spider_time采集时间、source_href答题页面访问链接
"""
from gevent import monkey
monkey.patch_all()
import json
import requests
from lxml import etree
import gevent
from gevent.queue import Queue
from fake_useragent import UserAgent
work_q =... | [
"requests.session",
"gevent.spawn",
"fake_useragent.UserAgent",
"requests.utils.cookiejar_from_dict",
"gevent.monkey.patch_all",
"gevent.queue.Queue",
"lxml.etree.HTML",
"gevent.joinall"
] | [((158, 176), 'gevent.monkey.patch_all', 'monkey.patch_all', ([], {}), '()\n', (174, 176), False, 'from gevent import monkey\n'), ((321, 328), 'gevent.queue.Queue', 'Queue', ([], {}), '()\n', (326, 328), False, 'from gevent.queue import Queue\n'), ((353, 371), 'requests.session', 'requests.session', ([], {}), '()\n', (... |
#!/usr/bin/env python
import sys
if __name__ == '__main__':
if len(sys.argv) < 2:
print('Usage: ./update_token [URL]')
sys.exit(1)
beg = sys.argv[1].find('#access_token=') + len('#access_token=')
end = sys.argv[1].find('&', beg)
token = sys.argv[1][beg:end]
with open('token... | [
"sys.exit"
] | [((140, 151), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (148, 151), False, 'import sys\n')] |
# -*- coding: UTF-8 -*-
""""
Created on 08.04.20
Unit tests for samplers
:author: <NAME>
"""
import os
import unittest
from typing import List, Any
from unittest import mock
from torch.utils.data import Dataset
from windpytorchutils.samplers import IndicesSubsampler, SlidingBatchSampler, ResumableSampler
import to... | [
"unittest.main",
"os.remove",
"os.path.realpath",
"os.path.exists",
"os.path.join",
"torch.tensor"
] | [((933, 1004), 'os.path.join', 'os.path.join', (['pathToThisScriptFile', '"""tmp/resumable_sampler_perm.pickle"""'], {}), "(pathToThisScriptFile, 'tmp/resumable_sampler_perm.pickle')\n", (945, 1004), False, 'import os\n'), ((6836, 6851), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6849, 6851), False, 'import u... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.BaseInfoConfig import BaseInfoConfig
from alipay.aop.api.domain.PromiseConfig import PromiseConfig
from alipay.aop.api.domain.RiskConfig import RiskConfig
class ZhimaMerchantCredi... | [
"alipay.aop.api.domain.RiskConfig.RiskConfig.from_alipay_dict",
"alipay.aop.api.domain.PromiseConfig.PromiseConfig.from_alipay_dict",
"alipay.aop.api.domain.BaseInfoConfig.BaseInfoConfig.from_alipay_dict"
] | [((852, 890), 'alipay.aop.api.domain.BaseInfoConfig.BaseInfoConfig.from_alipay_dict', 'BaseInfoConfig.from_alipay_dict', (['value'], {}), '(value)\n', (883, 890), False, 'from alipay.aop.api.domain.BaseInfoConfig import BaseInfoConfig\n'), ((1530, 1567), 'alipay.aop.api.domain.PromiseConfig.PromiseConfig.from_alipay_di... |
#!/usr/bin/python2
# title : cleanupSpam.py
# description : cleanupSpam is responsible for removing files from the spam folder
# in HDFS that have been there longer than the number of days specified
# in the config.yml file. The script gets a directory listing of the spa... | [
"Ingestion.registry.spam_file_path",
"yaml.load",
"os.path.basename",
"os.path.realpath",
"Ingestion.setup_logging",
"time.time",
"pydoop.hdfs.lsl",
"Ingestion.registry.dup_file_path",
"pydoop.hdfs.path.exists",
"pydoop.hdfs.rmr"
] | [((1531, 1552), 'Ingestion.setup_logging', 'setup_logging', (['logger'], {}), '(logger)\n', (1544, 1552), False, 'from Ingestion import setup_logging\n'), ((1115, 1133), 'yaml.load', 'yaml.load', (['ymlfile'], {}), '(ymlfile)\n', (1124, 1133), False, 'import yaml\n'), ((1503, 1529), 'os.path.basename', 'os.path.basenam... |
from base import TestCase
from flask.ext.wtf import html5
class DummyField(object):
def __init__(self, data, name='f', label='', id='', type='TextField'):
self.data = data
self.name = name
self.label = label
self.id = id
self.type = type
_value = lambda x: x.data... | [
"flask.ext.wtf.html5.SearchInput",
"flask.ext.wtf.html5.NumberInput",
"flask.ext.wtf.html5.URLInput",
"flask.ext.wtf.html5.DateInput",
"flask.ext.wtf.html5.EmailInput",
"flask.ext.wtf.html5.RangeInput"
] | [((625, 641), 'flask.ext.wtf.html5.URLInput', 'html5.URLInput', ([], {}), '()\n', (639, 641), False, 'from flask.ext.wtf import html5\n'), ((784, 803), 'flask.ext.wtf.html5.SearchInput', 'html5.SearchInput', ([], {}), '()\n', (801, 803), False, 'from flask.ext.wtf import html5\n'), ((947, 964), 'flask.ext.wtf.html5.Dat... |
# Generated by Django 2.2.4 on 2019-08-15 19:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0003_auto_20190808_1046'),
]
operations = [
migrations.AlterField(
model_name='pro... | [
"django.db.models.ImageField",
"django.db.models.ForeignKey"
] | [((371, 449), 'django.db.models.ImageField', 'models.ImageField', ([], {'default': '"""images/avatar/blank.png"""', 'upload_to': '"""profile_pics"""'}), "(default='images/avatar/blank.png', upload_to='profile_pics')\n", (388, 449), False, 'from django.db import migrations, models\n'), ((574, 661), 'django.db.models.For... |
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from .views import SurveyViewSet, OptionViewSet, VoteViewSet
router = DefaultRouter()
router.register(r"surveys", SurveyViewSet, basename="survey")
router.register(r"options", OptionViewSet, basename="option")
router.register(r"... | [
"django.conf.urls.include",
"rest_framework.routers.DefaultRouter"
] | [((162, 177), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (175, 177), False, 'from rest_framework.routers import DefaultRouter\n'), ((389, 409), 'django.conf.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (396, 409), False, 'from django.conf.urls import url, include\n... |
import numpy as np
import arrow
import requests
from typing import TypeVar, Generic
import math
import json
from earthorbit.maths import Maths
from earthorbit.timeconversion import TimeConversion
TypeVar_NumPy3DArray = TypeVar("NumPy 3D array")
TypeVar_NumPy3x3Matrix = TypeVar("NumPy 3x3 matrix")
TypeVar_DateTime =... | [
"arrow.get",
"numpy.sin",
"numpy.linalg.norm",
"math.pow",
"numpy.tan",
"earthorbit.maths.Maths.rectangular2spherical",
"math.cos",
"earthorbit.maths.Maths.angle_vects",
"typing.TypeVar",
"math.sqrt",
"numpy.cross",
"math.sin",
"numpy.linalg.inv",
"numpy.cos",
"numpy.arctan",
"earthorb... | [((223, 248), 'typing.TypeVar', 'TypeVar', (['"""NumPy 3D array"""'], {}), "('NumPy 3D array')\n", (230, 248), False, 'from typing import TypeVar, Generic\n'), ((274, 301), 'typing.TypeVar', 'TypeVar', (['"""NumPy 3x3 matrix"""'], {}), "('NumPy 3x3 matrix')\n", (281, 301), False, 'from typing import TypeVar, Generic\n'... |
# coding: utf-8
import csv
import math
import matplotlib.pyplot as plt
# park pos
# park_lat = 42 + 39.48779/60
# park_lon = 83 + 14.61487/60
park_lat = 42.658166
park_lon = 83.243656
# USB GPS
USB_lat = []
USB_lon = []
# NEO GPS
NEO_lat = []
NEO_lon = []
# G65 GPS
G65_lat = []
G65_lon = []
... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"csv.reader",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.axis",
"math.cos",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((322, 333), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (331, 333), True, 'import matplotlib.pyplot as plt\n'), ((368, 379), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (377, 379), True, 'import matplotlib.pyplot as plt\n'), ((3788, 3877), 'matplotlib.pyplot.plot', 'plt.plot', (['USB_lon',... |
import configparser
import logging
import os
import sys
import time
import fire
from boto_client import *
from db import *
db = database_credentials()
client = boto_client()
def test_db(args):
db.execute_checkpostgisnames(args)
def major_migration(args):
startm = str(time.time())
print(startm)
migra... | [
"fire.Fire",
"time.time"
] | [((8625, 8636), 'fire.Fire', 'fire.Fire', ([], {}), '()\n', (8634, 8636), False, 'import fire\n'), ((280, 291), 'time.time', 'time.time', ([], {}), '()\n', (289, 291), False, 'import time\n'), ((415, 426), 'time.time', 'time.time', ([], {}), '()\n', (424, 426), False, 'import time\n'), ((535, 546), 'time.time', 'time.t... |
#!/usr/bin/python3
from glob import glob
import json
import sqlite3
def migrate():
for fname in glob("/home/rstenmark/WoWNexusHubClient/data/overview/*.json"):
with open(fname, 'r+') as fd:
resp_dict = json.loads(fd.read())
# Slug index contains WoW server name/fact... | [
"sqlite3.connect",
"glob.glob"
] | [((105, 167), 'glob.glob', 'glob', (['"""/home/rstenmark/WoWNexusHubClient/data/overview/*.json"""'], {}), "('/home/rstenmark/WoWNexusHubClient/data/overview/*.json')\n", (109, 167), False, 'from glob import glob\n'), ((479, 503), 'sqlite3.connect', 'sqlite3.connect', (['"""ah.db"""'], {}), "('ah.db')\n", (494, 503), F... |
"""
TODO:
- use mirror
"""
import contextlib
import typing as ta
from omnibus import check
from omnibus import collections as ocol
from omnibus import dataclasses as dc
from omnibus import lang
from omnibus import properties
from .. import connectors as ctrs
from .. import elements as els
from ... import metadata as... | [
"omnibus.collections.IdentityKeyDict",
"omnibus.collections.IdentitySet",
"omnibus.dataclasses.replace",
"omnibus.check.single",
"omnibus.check.isinstance"
] | [((714, 756), 'omnibus.check.isinstance', 'check.isinstance', (['ctors', 'ctrs.ConnectorSet'], {}), '(ctors, ctrs.ConnectorSet)\n', (730, 756), False, 'from omnibus import check\n'), ((4670, 4688), 'omnibus.collections.IdentitySet', 'ocol.IdentitySet', ([], {}), '()\n', (4686, 4688), True, 'from omnibus import collecti... |
""" Base class for a trainer.
This class includes some basic PyTorch code for multi GPU training, metrics, train and validation code.
"""
import os
import torch
from datetime import datetime as dt
from pathlib import Path
from pprint import pformat
from ignite.contrib.handlers import ProgressBar
from ignite.handler... | [
"ignite.metrics.RunningAverage",
"pprint.pformat",
"datetime.datetime.now",
"torch.save",
"ignite.engine.Engine",
"pathlib.Path",
"ignite.handlers.ModelCheckpoint",
"ignite.contrib.handlers.ProgressBar",
"os.path.join"
] | [((2827, 2846), 'ignite.engine.Engine', 'Engine', (['self.update'], {}), '(self.update)\n', (2833, 2846), False, 'from ignite.engine import Engine, Events\n'), ((2867, 2889), 'ignite.engine.Engine', 'Engine', (['self.inference'], {}), '(self.inference)\n', (2873, 2889), False, 'from ignite.engine import Engine, Events\... |
#!/usr/bin/env python3
from sigmf import SigMFFile, sigmffile
import numpy as np
# Load a dataset
filename = 'hamcap.sigmf-data' # extension is optional
signal = sigmffile.fromfile(filename)
# Get some metadata and all annotations
sample_rate = signal.get_global_field(SigMFFile.SAMPLE_RATE_KEY)
sample_count = signal... | [
"sigmf.sigmffile.fromfile"
] | [((164, 192), 'sigmf.sigmffile.fromfile', 'sigmffile.fromfile', (['filename'], {}), '(filename)\n', (182, 192), False, 'from sigmf import SigMFFile, sigmffile\n')] |
"""
SANS reduction steps
====================
Set of reduction steps for SANS reduction.
"""
from __future__ import print_function
from posixpath import basename, join
from copy import copy, deepcopy
from io import BytesIO
from collections import OrderedDict
import numpy as np
from dataflow.lib.uncertainty import ... | [
"dataflow.lib.err1d.mul",
"numpy.arctan2",
"numpy.sum",
"numpy.floor",
"dataflow.fetch.url_get",
"numpy.argsort",
"numpy.histogram",
"numpy.sin",
"numpy.arange",
"numpy.exp",
"numpy.interp",
"numpy.zeros_like",
"dataflow.lib.uncertainty.sum",
"numpy.arcsin",
"scipy.special.gammainc",
"... | [((5477, 5495), 'jsonpatch.JsonPatch', 'JsonPatch', (['patches'], {}), '(patches)\n', (5486, 5495), False, 'from jsonpatch import JsonPatch\n'), ((13092, 13131), 'numpy.sqrt', 'np.sqrt', (['(X ** 2 + (Y + 2.0 * YG_d) ** 2)'], {}), '(X ** 2 + (Y + 2.0 * YG_d) ** 2)\n', (13099, 13131), True, 'import numpy as np\n'), ((13... |
import csv
import json
import os
import pickle
def load_from_pickle(path):
with open(path, "rb") as f:
return pickle.load(f)
def save_to_pickle(data, path):
with open(ensure_path(path), "wb") as f:
pickle.dump(data, f)
def load_json(input_path):
with open(input_path, "rb") as f:
... | [
"json.dump",
"pickle.dump",
"json.load",
"csv.reader",
"os.makedirs",
"csv.writer",
"os.path.dirname",
"os.path.exists",
"pickle.load"
] | [((830, 851), 'os.path.dirname', 'os.path.dirname', (['path'], {}), '(path)\n', (845, 851), False, 'import os\n'), ((124, 138), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (135, 138), False, 'import pickle\n'), ((226, 246), 'pickle.dump', 'pickle.dump', (['data', 'f'], {}), '(data, f)\n', (237, 246), False, 'im... |
# Form implementation generated from reading ui file 'pyqt6rc/test/myPackage/templates/template1.ui'
#
# Created by: PyQt6 UI code generator 6.1.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from importlib.resour... | [
"PyQt6.QtWidgets.QGridLayout",
"PyQt6.QtWidgets.QPushButton",
"PyQt6.QtWidgets.QLabel",
"PyQt6.QtGui.QIcon",
"PyQt6.QtCore.QMetaObject.connectSlotsByName",
"importlib.resources.path"
] | [((525, 552), 'PyQt6.QtWidgets.QGridLayout', 'QtWidgets.QGridLayout', (['Form'], {}), '(Form)\n', (546, 552), False, 'from PyQt6 import QtCore, QtGui, QtWidgets\n'), ((631, 658), 'PyQt6.QtWidgets.QPushButton', 'QtWidgets.QPushButton', (['Form'], {}), '(Form)\n', (652, 658), False, 'from PyQt6 import QtCore, QtGui, QtWi... |
# -*- coding: utf-8 -*-
"""Copyright 2015 <NAME>.
FilterPy library.
http://github.com/rlabbe/filterpy
Documentation at:
https://filterpy.readthedocs.org
Supporting book at:
https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python
This is licensed under an MIT license. See the readme.MD file
for more informa... | [
"numpy.random.seed",
"math.atan2",
"numpy.allclose",
"numpy.arange",
"filterpy.kalman.KalmanFilter",
"numpy.random.randn",
"math.radians",
"filterpy.kalman.UnscentedKalmanFilter",
"numpy.linspace",
"filterpy.kalman.unscented_transform",
"math.sqrt",
"numpy.asarray",
"filterpy.kalman.MerweSca... | [((951, 969), 'numpy.array', 'np.array', (['[[1, 2]]'], {}), '([[1, 2]])\n', (959, 969), True, 'import numpy as np\n'), ((978, 1008), 'numpy.array', 'np.array', (['[[2, 1.2], [1.2, 2]]'], {}), '([[2, 1.2], [1.2, 2]])\n', (986, 1008), True, 'import numpy as np\n'), ((1119, 1154), 'filterpy.kalman.JulierSigmaPoints', 'Ju... |
"""Change Username Column
Revision ID: ed5ce2cd18c2
Revises: <PASSWORD>
Create Date: 2017-10-31 11:21:18.185746
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ed5ce2cd18c2'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
... | [
"sqlalchemy.VARCHAR",
"alembic.op.drop_index",
"alembic.op.create_index",
"alembic.op.f",
"alembic.op.drop_column",
"sqlalchemy.String"
] | [((742, 796), 'alembic.op.drop_index', 'op.drop_index', (['"""ix_users_username"""'], {'table_name': '"""users"""'}), "('ix_users_username', table_name='users')\n", (755, 796), False, 'from alembic import op\n'), ((801, 836), 'alembic.op.drop_column', 'op.drop_column', (['"""users"""', '"""username"""'], {}), "('users'... |
import numpy as np
import matplotlib.pyplot as plt
import pickle
import librosa
import pdb
save_path = '/scratch/speech/hand_raw_dataset/'
f_train = open('/scratch/speech/hand_raw_dataset/EMO39_raw_audio_augmented_train.pkl', 'rb')
f_test = open('/scratch/speech/hand_raw_dataset/EMO39_raw_audio_augmented_test.pkl', 'r... | [
"matplotlib.pyplot.specgram",
"pickle.dump",
"pickle.load",
"matplotlib.pyplot.clf"
] | [((337, 357), 'pickle.load', 'pickle.load', (['f_train'], {}), '(f_train)\n', (348, 357), False, 'import pickle\n'), ((370, 389), 'pickle.load', 'pickle.load', (['f_test'], {}), '(f_test)\n', (381, 389), False, 'import pickle\n'), ((673, 682), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (680, 682), True, 'imp... |
import collections
import os
import random
import math
import pdb
from mdp import *
import time
# -------------------
# Inference with VI
# -------------------
def valueIteration(mdp):
V = collections.defaultdict(float)
def Q(s,a):
return sum([proba*(reward + mdp.discount()*V[sp]) for sp,proba,reward in mdp.succ... | [
"collections.defaultdict",
"os.system",
"time.time"
] | [((192, 222), 'collections.defaultdict', 'collections.defaultdict', (['float'], {}), '(float)\n', (215, 222), False, 'import collections\n'), ((372, 383), 'time.time', 'time.time', ([], {}), '()\n', (381, 383), False, 'import time\n'), ((393, 423), 'collections.defaultdict', 'collections.defaultdict', (['float'], {}), ... |
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.response import Response
from rest_framework.authtoken.models import Token
from rest_framework.settings import api_settings
from user.serializers import UserSerializer, AuthTo... | [
"rest_framework.authtoken.models.Token.objects.get_or_create",
"rest_framework.response.Response",
"user.serializers.UserSerializer"
] | [((932, 970), 'rest_framework.authtoken.models.Token.objects.get_or_create', 'Token.objects.get_or_create', ([], {'user': 'user'}), '(user=user)\n', (959, 970), False, 'from rest_framework.authtoken.models import Token\n'), ((997, 1017), 'user.serializers.UserSerializer', 'UserSerializer', (['user'], {}), '(user)\n', (... |
import logging
from ibmsecurity.utilities import tools
logger = logging.getLogger(__name__)
uri = "/wga/redis_config/collections"
requires_modules = ["wga"]
requires_version = "10.0.1"
def get_all(isamAppliance, check_mode=False, force=False):
"""
Retrieve the list of configured Redis collections
"""
... | [
"ibmsecurity.utilities.tools.json_compare",
"ibmsecurity.utilities.tools.json_sort",
"logging.getLogger"
] | [((65, 92), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (82, 92), False, 'import logging\n'), ((7304, 7330), 'ibmsecurity.utilities.tools.json_sort', 'tools.json_sort', (['json_data'], {}), '(json_data)\n', (7319, 7330), False, 'from ibmsecurity.utilities import tools\n'), ((7413, 7445... |
from dataclasses import dataclass
from scipy.stats import beta # type: ignore[import]
from probs.continuous.rv import ContinuousRV
@dataclass(eq=False)
class Beta(ContinuousRV):
"""
The beta distribution is a family of continuous probability distributions
defined on the interval [0, 1] parameterized by... | [
"scipy.stats.beta.pdf",
"dataclasses.dataclass"
] | [((137, 156), 'dataclasses.dataclass', 'dataclass', ([], {'eq': '(False)'}), '(eq=False)\n', (146, 156), False, 'from dataclasses import dataclass\n'), ((1992, 2026), 'scipy.stats.beta.pdf', 'beta.pdf', (['x', 'self.alpha', 'self.beta'], {}), '(x, self.alpha, self.beta)\n', (2000, 2026), False, 'from scipy.stats import... |
import csv
class CSVGenerator:
def __init__(self, delimiter='\t', lineterminator='\n'):
self.writer = csv.writer(
self,
delimiter=delimiter,
lineterminator=lineterminator
)
def writerow(self, row):
self.writer.writerow(row)
return self.row
... | [
"csv.writer"
] | [((117, 185), 'csv.writer', 'csv.writer', (['self'], {'delimiter': 'delimiter', 'lineterminator': 'lineterminator'}), '(self, delimiter=delimiter, lineterminator=lineterminator)\n', (127, 185), False, 'import csv\n')] |
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 22})
import sys
try:
from numba import jit,njit,float64,int32
import numba as nb
except pkg_resources.DistributionNotFound:
sys.stdout.write("Debes instalar el paquete numba primero")
sys.exit()
var = np.loadtxt('input... | [
"matplotlib.pyplot.title",
"sys.stdout.write",
"matplotlib.pyplot.figure",
"numpy.mean",
"numba.types.UniTuple",
"numpy.std",
"numpy.max",
"matplotlib.pyplot.rcParams.update",
"numpy.loadtxt",
"matplotlib.pyplot.subplots",
"numpy.min",
"numpy.concatenate",
"sys.exit",
"matplotlib.pyplot.hi... | [((51, 89), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 22}"], {}), "({'font.size': 22})\n", (70, 89), True, 'import matplotlib.pyplot as plt\n'), ((303, 342), 'numpy.loadtxt', 'np.loadtxt', (['"""inputs.txt"""'], {'delimiter': '""","""'}), "('inputs.txt', delimiter=',')\n", (313, 342),... |
from pitop.common.command_runner import run_command
from pitop.common.common_ids import FirmwareDeviceID, PeripheralID
from pitop.common.common_names import PeripheralName
from pitop.common.firmware_device import FirmwareDevice
from pitop.common.ptdm import Message, PTDMRequestClient
def legacy_pitop_peripherals():
... | [
"pitop.common.firmware_device.FirmwareDevice.device_info.items",
"pitop.common.ptdm.Message.from_parts",
"pitop.common.command_runner.run_command",
"pitop.common.firmware_device.FirmwareDevice",
"pitop.common.ptdm.PTDMRequestClient"
] | [((1912, 1946), 'pitop.common.firmware_device.FirmwareDevice.device_info.items', 'FirmwareDevice.device_info.items', ([], {}), '()\n', (1944, 1946), False, 'from pitop.common.firmware_device import FirmwareDevice\n'), ((3046, 3077), 'pitop.common.command_runner.run_command', 'run_command', (['"""lsusb"""'], {'timeout':... |
"""
Caminata aleatoria unidimensional (Promedios estadísticos)
<NAME>
Facultad de Ciencias Físico Matemáticas
Física Computacional
jue 15 abr 2021 09:55:53 CDT
Repositorio: https://github.com/Luis2501/Fisica-Computacional-1
"""
import sys
import numpy as np
import matplotlib.pyplot as plt
sys.path.append("../")... | [
"sys.path.append",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"sklearn.linear_model.LinearRegression",
"PhysicsPy.Random_Walk.Random_Walk_1D",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplo... | [((298, 320), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (313, 320), False, 'import sys\n'), ((433, 457), 'PhysicsPy.Random_Walk.Random_Walk_1D', 'Random_Walk_1D', (['(0.5)', '(100)'], {}), '(0.5, 100)\n', (447, 457), False, 'from PhysicsPy.Random_Walk import Random_Walk_1D\n'), ((621, 641)... |
import torch.nn.functional as F
import torch.nn as nn
import torch
class SoftCrossEntropy(nn.Module):
"""
Measure cross entropy between two distributions.
Assume that both input, target have shape (N, C).
Both input, target are given as logits.
"""
def __init__(self, temperature):
sup... | [
"torch.mean",
"torch.isinf",
"torch.nn.KLDivLoss",
"torch.nn.functional.softmax",
"torch.exp",
"torch.nn.functional.log_softmax",
"torch.log"
] | [((476, 522), 'torch.nn.functional.log_softmax', 'F.log_softmax', (['(input / self.temperature)'], {'dim': '(1)'}), '(input / self.temperature, dim=1)\n', (489, 522), True, 'import torch.nn.functional as F\n'), ((542, 585), 'torch.nn.functional.softmax', 'F.softmax', (['(target / self.temperature)'], {'dim': '(1)'}), '... |
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.io.decode_image",
"official.vision.ops.preprocess_ops.center_crop_image_v2",
"tensorflow.image.extract_jpeg_shape",
"tensorflow.image.random_flip_left_right",
"official.vision.ops.preprocess_ops.random_crop_image_v2",
"tensorflow.shape",
"official.vision.ops.preprocess_ops.center_crop_image"... | [((2003, 2088), 'tensorflow.image.resize', 'tf.image.resize', (['image', 'self._output_size'], {'method': 'tf.image.ResizeMethod.BILINEAR'}), '(image, self._output_size, method=tf.image.ResizeMethod.BILINEAR\n )\n', (2018, 2088), True, 'import tensorflow as tf\n'), ((2325, 2373), 'tensorflow.image.convert_image_dtyp... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from google.ads.google_ads.v5.proto.resources import feed_item_target_pb2 as google_dot_ads_dot_googleads__v5_dot_proto_dot_resources_dot_feed__item__target__pb2... | [
"grpc.method_handlers_generic_handler",
"grpc.unary_unary_rpc_method_handler",
"grpc.experimental.unary_unary"
] | [((3644, 3768), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""google.ads.googleads.v5.services.FeedItemTargetService"""', 'rpc_method_handlers'], {}), "(\n 'google.ads.googleads.v5.services.FeedItemTargetService',\n rpc_method_handlers)\n", (3680, 3768), False, 'import grpc... |
#
# Copyright 2019 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | [
"pandas.Timestamp",
"pandas.tseries.holiday.Holiday",
"pandas.tseries.holiday.weekend_to_monday",
"pytz.timezone",
"datetime.time",
"itertools.chain"
] | [((2093, 2184), 'pandas.tseries.holiday.Holiday', 'Holiday', (['"""New Year\'s Holiday"""'], {'month': '(1)', 'day': '(2)', 'observance': 'new_years_holiday_observance'}), '("New Year\'s Holiday", month=1, day=2, observance=\n new_years_holiday_observance)\n', (2100, 2184), False, 'from pandas.tseries.holiday import... |
# -*- coding: utf-8 -*-
#/src/controller/VelhaController.py
"""
Tic-Toc-Toe
------------------------------------------------------------------------
EndPoints
------------------------------------------------------------------------
"""
import uuid
from ... | [
"flask.json.dumps",
"uuid.uuid4",
"flask.Blueprint",
"flask.request.get_json"
] | [((476, 508), 'flask.Blueprint', 'Blueprint', (['"""velha_api"""', '__name__'], {}), "('velha_api', __name__)\n", (485, 508), False, 'from flask import request, json, Response, Blueprint\n'), ((1447, 1465), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (1463, 1465), False, 'from flask import request, ... |
"""
Copyright (c) 2020, the Decred developers
See LICENSE for details
Tests use the "http_get_post" and "MockWebSocketClient" fixtures in conftest.py
"""
import json
from pathlib import Path
import pytest
from decred import DecredError
from decred.crypto import opcode
from decred.dcr import account, agenda, dcrdata... | [
"decred.dcr.dcrdata.makeOutputs",
"decred.dcr.dcrdata.DcrdataPath",
"decred.DecredError",
"decred.dcr.account.UTXO.parse",
"decred.dcr.dcrdata.DcrdataClient",
"pytest.raises",
"decred.util.encode.ByteArray",
"decred.dcr.dcrdata.checkOutput",
"decred.dcr.dcrdata.DcrdataBlockchain",
"decred.dcr.wire... | [((1300, 1313), 'decred.dcr.dcrdata.DcrdataPath', 'DcrdataPath', ([], {}), '()\n', (1311, 1313), False, 'from decred.dcr.dcrdata import DcrdataBlockchain, DcrdataClient, DcrdataError, DcrdataPath\n'), ((2521, 2534), 'decred.dcr.wire.msgtx.TxOut', 'msgtx.TxOut', ([], {}), '()\n', (2532, 2534), False, 'from decred.dcr.wi... |
#!/usr/bin/env python3
# Copyright 2022 Xiaomi Corp. (authors: <NAME>)
#
# See ../../../../LICENSE for clarification regarding multiple authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the... | [
"argparse.ArgumentParser",
"librispeech.LibriSpeech",
"random.Random",
"asr_datamodule.AsrDataModule.add_arguments",
"asr_datamodule.AsrDataModule",
"pathlib.Path",
"gigaspeech.GigaSpeech"
] | [((1076, 1155), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (1099, 1155), False, 'import argparse\n'), ((1174, 1209), 'asr_datamodule.AsrDataModule.add_arguments', 'AsrDataModule.... |
# coding: utf-8
import sys
import os
import alabaster
from pyquickhelper.helpgen.default_conf import set_sphinx_variables
sys.path.insert(0, os.path.abspath(os.path.join(os.path.split(__file__)[0])))
set_sphinx_variables(__file__, "python3_module_template", "<NAME>", 2021,
"alabaster", alabaster.... | [
"os.path.split",
"alabaster.get_path"
] | [((310, 330), 'alabaster.get_path', 'alabaster.get_path', ([], {}), '()\n', (328, 330), False, 'import alabaster\n'), ((171, 194), 'os.path.split', 'os.path.split', (['__file__'], {}), '(__file__)\n', (184, 194), False, 'import os\n')] |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | [
"extensions.value_generators.models.generators.Copier",
"extensions.value_generators.models.generators.RandomSelector"
] | [((1069, 1088), 'extensions.value_generators.models.generators.Copier', 'generators.Copier', ([], {}), '()\n', (1086, 1088), False, 'from extensions.value_generators.models import generators\n'), ((1851, 1878), 'extensions.value_generators.models.generators.RandomSelector', 'generators.RandomSelector', ([], {}), '()\n'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 <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... | [
"matplotlib.pyplot.title",
"numpy.array_equal",
"numpy.sum",
"numpy.abs",
"numpy.empty",
"numpy.ones",
"numpy.isnan",
"numpy.argsort",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy.isclose",
"matplotlib.pyplot.gca",
"scipy.interpolate.interp1d",
"matplotlib.pyplot.tight_layout",
"doc... | [((6866, 6880), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (6878, 6880), True, 'import pandas as pd\n'), ((34631, 34766), 'kineticstoolkit.decorators.deprecated', 'deprecated', ([], {'since': '"""0.5"""', 'until': '"""0.7"""', 'details': '"""Please use the ui_edit_events method, which is the more powerful re... |
# Copyright (c) 2015-2019 The Botogram Authors (see AUTHORS)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... | [
"hmac.compare_digest"
] | [((2229, 2254), 'hmac.compare_digest', 'hmac.compare_digest', (['a', 'b'], {}), '(a, b)\n', (2248, 2254), False, 'import hmac\n')] |
from django.contrib import admin
from shop.models import Category, Product, Genre, Season
@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
list_display = ["name", "slug"]
prepopulated_fields = {"slug": ("name",)}
@admin.register(Genre)
class GenreAdmin(admin.ModelAdmin):
list_display = ["name"]
pr... | [
"django.contrib.admin.register"
] | [((92, 116), 'django.contrib.admin.register', 'admin.register', (['Category'], {}), '(Category)\n', (106, 116), False, 'from django.contrib import admin\n'), ((234, 255), 'django.contrib.admin.register', 'admin.register', (['Genre'], {}), '(Genre)\n', (248, 255), False, 'from django.contrib import admin\n'), ((362, 384... |
# Generated by Django 3.2.10 on 2022-01-10 22:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0126_filelink_link_linkdomain"),
]
operations = [
migrations.RemoveConstraint(
model_name="report",
nam... | [
"django.db.migrations.RemoveConstraint",
"django.db.models.ManyToManyField"
] | [((243, 311), 'django.db.migrations.RemoveConstraint', 'migrations.RemoveConstraint', ([], {'model_name': '"""report"""', 'name': '"""self_report"""'}), "(model_name='report', name='self_report')\n", (270, 311), False, 'from django.db import migrations, models\n'), ((454, 508), 'django.db.models.ManyToManyField', 'mode... |
from django.contrib import admin
from .models import WeatherLocation, WeatherForecast
class WeatherLocationAdmin(admin.ModelAdmin):
pass
admin.site.register(WeatherLocation, WeatherLocationAdmin)
class WeatherForecastAdmin(admin.ModelAdmin):
pass
admin.site.register(WeatherForecast, WeatherForecastAdmin)... | [
"django.contrib.admin.site.register"
] | [((145, 203), 'django.contrib.admin.site.register', 'admin.site.register', (['WeatherLocation', 'WeatherLocationAdmin'], {}), '(WeatherLocation, WeatherLocationAdmin)\n', (164, 203), False, 'from django.contrib import admin\n'), ((262, 320), 'django.contrib.admin.site.register', 'admin.site.register', (['WeatherForecas... |
"""Provides an abstraction around the DICOM query model and data hierarchy
"""
from __future__ import annotations
import logging
from copy import deepcopy
from collections import OrderedDict, defaultdict
from itertools import chain
from functools import partial
from enum import IntEnum
from dataclasses import dataclass... | [
"functools.partial",
"copy.deepcopy",
"pydicom.dataset.Dataset",
"tree_format.format_tree",
"logging.getLogger",
"dataclasses.field",
"collections.OrderedDict",
"dataclasses.dataclass"
] | [((673, 700), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (690, 700), False, 'import logging\n'), ((1559, 1581), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (1568, 1581), False, 'from dataclasses import dataclass, field\n'), ((1804, 1826), 'data... |
from fuzzywuzzy import fuzz
class Fuzzy_Comp:
def __init__(self, s1, s2):
self.s1 = s1
self.s2 = s2
def compare_aut(self):
return fuzz.partial_ratio(self.s1, self.s2)
def compare_tit(self):
return fuzz.partial_token_set_ratio(self.s1, self.s2)
def choos... | [
"fuzzywuzzy.fuzz.partial_ratio",
"fuzzywuzzy.fuzz.partial_token_set_ratio"
] | [((174, 210), 'fuzzywuzzy.fuzz.partial_ratio', 'fuzz.partial_ratio', (['self.s1', 'self.s2'], {}), '(self.s1, self.s2)\n', (192, 210), False, 'from fuzzywuzzy import fuzz\n'), ((257, 303), 'fuzzywuzzy.fuzz.partial_token_set_ratio', 'fuzz.partial_token_set_ratio', (['self.s1', 'self.s2'], {}), '(self.s1, self.s2)\n', (2... |
# Copyright 2018 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | [
"cirq.DensityMatrixSimulator",
"numpy.abs",
"math.sqrt",
"cirq.IdentityGate",
"numpy.flip",
"cirq.Simulator",
"numpy.isclose",
"numpy.array",
"cirq.PauliSum",
"numpy.diag",
"pennylane.DeviceError"
] | [((3141, 3186), 'numpy.array', 'np.array', (['basis_state_operation.parameters[0]'], {}), '(basis_state_operation.parameters[0])\n', (3149, 3186), True, 'import numpy as np\n'), ((4324, 4396), 'numpy.array', 'np.array', (['qubit_state_vector_operation.parameters[0]'], {'dtype': 'np.complex64'}), '(qubit_state_vector_op... |
# -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.utils.encoding import iri_to_uri
class HttpResponseNoContent(HttpResponse):
status_code = 204
def __init__(self):
HttpResponse.__init__(self)
class HttpResponseGetAfterPost(HttpResponse):
status_code = 303
def __init__... | [
"django.utils.encoding.iri_to_uri",
"django.http.HttpResponse.__init__"
] | [((205, 232), 'django.http.HttpResponse.__init__', 'HttpResponse.__init__', (['self'], {}), '(self)\n', (226, 232), False, 'from django.http import HttpResponse\n'), ((349, 376), 'django.http.HttpResponse.__init__', 'HttpResponse.__init__', (['self'], {}), '(self)\n', (370, 376), False, 'from django.http import HttpRes... |
import sys
from PyQt5.QtWidgets import QApplication, QDialog, QMessageBox
from PyQt5.QtGui import QPixmap
from PyQt5.QtCore import Qt, pyqtSignal
from battle_config import Servant, Enemy, Master, BattleConfig
import ViewDetailsUi
import pandas as pd
class Ui_ViewDetails(QDialog, ViewDetailsUi.Ui_Dialog):
def __init_... | [
"battle_config.BattleConfig",
"battle_config.Servant",
"battle_config.Master",
"battle_config.Enemy",
"PyQt5.QtGui.QPixmap",
"PyQt5.QtWidgets.QApplication"
] | [((5944, 5966), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (5956, 5966), False, 'from PyQt5.QtWidgets import QApplication, QDialog, QMessageBox\n'), ((6040, 6054), 'battle_config.BattleConfig', 'BattleConfig', ([], {}), '()\n', (6052, 6054), False, 'from battle_config import Ser... |
import numpy as np
import torch
import torch.nn.functional as F
# Classification
def nll_loss(output, target):
return F.nll_loss(output, target)
# Normal\MC_dropout\BBB\BBB_LR\Qd
def mse_loss(output, target):
return F.mse_loss(output, target, reduction="sum")
# Normal\MC_dropout\BBB\BBB_LR\Qd
def mse_loss_me... | [
"numpy.log",
"torch.nn.functional.mse_loss",
"torch.exp",
"torch.nn.functional.nll_loss",
"torch.pow",
"torch.log"
] | [((123, 149), 'torch.nn.functional.nll_loss', 'F.nll_loss', (['output', 'target'], {}), '(output, target)\n', (133, 149), True, 'import torch.nn.functional as F\n'), ((226, 269), 'torch.nn.functional.mse_loss', 'F.mse_loss', (['output', 'target'], {'reduction': '"""sum"""'}), "(output, target, reduction='sum')\n", (236... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.