code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
import peewee
from electrum_gui.common.basic.orm.models import AutoDateTimeField, BaseModel
from electrum_gui.common.transaction.data import TxActionStatus
class TxAction(BaseModel):
id = peewee.IntegerField(primary_key=True)
txid = peewee.CharField()
status = peewee.IntegerField(choices=TxActionStatus.t... | [
"electrum_gui.common.transaction.data.TxActionStatus.to_choices",
"electrum_gui.common.basic.orm.models.AutoDateTimeField",
"peewee.IntegerField",
"peewee.CharField",
"peewee.TextField",
"peewee.DecimalField"
] | [((195, 232), 'peewee.IntegerField', 'peewee.IntegerField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (214, 232), False, 'import peewee\n'), ((244, 262), 'peewee.CharField', 'peewee.CharField', ([], {}), '()\n', (260, 262), False, 'import peewee\n'), ((350, 368), 'peewee.CharField', 'peewee.CharField', (... |
import os
import json
import pandas as pd
from matplotlib import pyplot
import math
import itertools
from ast import literal_eval
import matplotlib.pyplot as plt
import seaborn as sns
from pathlib import Path
import matplotlib.backends.backend_pdf
directory = '../data/1_source/'
for filename in sorted(os.listdir(dire... | [
"os.path.join",
"os.listdir"
] | [((305, 326), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (315, 326), False, 'import os\n'), ((461, 497), 'os.path.join', 'os.path.join', (['directory', '"""jun30.csv"""'], {}), "(directory, 'jun30.csv')\n", (473, 497), False, 'import os\n')] |
import json
from collections import OrderedDict
from django.contrib.auth import get_user_model
from django.db.models import F
from django_redis import get_redis_connection
from sonsuz_website.blog.models import Article, Like
from sonsuz_website.blog.api.serializers import CommentSerializer
from config import celery_ap... | [
"json.loads",
"config.celery_app.task",
"sonsuz_website.blog.models.Article.objects.get",
"django.contrib.auth.get_user_model",
"sonsuz_website.blog.api.serializers.CommentSerializer",
"django.db.models.F",
"sonsuz_website.blog.models.Like.objects.create",
"collections.OrderedDict",
"django_redis.ge... | [((330, 346), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (344, 346), False, 'from django.contrib.auth import get_user_model\n'), ((354, 376), 'django_redis.get_redis_connection', 'get_redis_connection', ([], {}), '()\n', (374, 376), False, 'from django_redis import get_redis_connection\n'... |
from asyncio import AbstractEventLoop
from collections import OrderedDict
from typing import List
import pytest
from cetus.data_access import (get_connection,
update)
from cetus.types import (RecordType,
UpdatesType)
from sqlalchemy.engine.url import URL
from sql... | [
"tests.utils.records_to_dicts",
"cetus.data_access.update",
"tests.utils.fetch",
"tests.utils.is_sub_dictionary",
"pytest.fixture",
"tests.utils.insert",
"cetus.data_access.get_connection",
"collections.OrderedDict"
] | [((572, 604), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (586, 604), False, 'import pytest\n'), ((826, 878), 'tests.utils.records_to_dicts', 'records_to_dicts', ([], {'records': 'table_records', 'table': 'table'}), '(records=table_records, table=table)\n', (842, 878),... |
#! python3
import argparse
import os
import json
def load_config():
parser = argparse.ArgumentParser(
description='pyclient',
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("--cfg", default="./config.json",
help="configure file", type=str)
... | [
"os.path.dirname",
"os.path.exists",
"argparse.ArgumentParser"
] | [((84, 190), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""pyclient"""', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), "(description='pyclient', formatter_class=argparse.\n RawDescriptionHelpFormatter)\n", (107, 190), False, 'import argparse\n'), ((436, 460), 'os.path.... |
# Import Census Subdiv Shapefile from
# https://www12.statcan.gc.ca/census-recensement/alternative_alternatif.cfm?l=eng&dispext=zip&teng=lcsd000b16a_e.zip&k=%20%20%20%2047761&loc=http://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/files-fichiers/2016/lcsd000b16a_e.zip
'''
(outputfrom ogr2ogr -so ...)
L... | [
"pipeline.importers.utils.import_data_into_area_model",
"django.apps.apps.get_model",
"pipeline.models.general.Service.objects.all",
"pipeline.models.RegionalDistrict.objects.get_or_create",
"pipeline.models.general.Hex",
"os.path.join",
"django.contrib.gis.geos.GEOSGeometry",
"pipeline.importers.cens... | [((2741, 2768), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2758, 2768), False, 'import logging\n'), ((3484, 3526), 'pipeline.models.general.DataSource.objects.get', 'DataSource.objects.get', ([], {'name': 'resource_type'}), '(name=resource_type)\n', (3506, 3526), False, 'from pipelin... |
from allauth.socialaccount.models import SocialApp
from allauth.socialaccount.providers.google.provider import GoogleProvider
from django import forms
from django.contrib.sites.shortcuts import get_current_site
from builds.models import Project, GlobalSettings
class ProjectCreateForm(forms.ModelForm):
class Meta... | [
"builds.models.GlobalSettings.get",
"django.forms.BooleanField",
"django.forms.PasswordInput",
"allauth.socialaccount.models.SocialApp.objects.create",
"allauth.socialaccount.models.SocialApp.objects.get_current",
"django.contrib.sites.shortcuts.get_current_site",
"django.forms.CharField"
] | [((440, 474), 'django.forms.BooleanField', 'forms.BooleanField', ([], {'required': '(False)'}), '(required=False)\n', (458, 474), False, 'from django import forms\n'), ((498, 529), 'django.forms.CharField', 'forms.CharField', ([], {'required': '(False)'}), '(required=False)\n', (513, 529), False, 'from django import fo... |
import pytest
from poetry.core.spdx.helpers import license_by_id
def test_license_by_id():
license = license_by_id("MIT")
assert license.id == "MIT"
assert license.name == "MIT License"
assert license.is_osi_approved
assert not license.is_deprecated
license = license_by_id("LGPL-3.0-or-late... | [
"pytest.raises",
"poetry.core.spdx.helpers.license_by_id"
] | [((108, 128), 'poetry.core.spdx.helpers.license_by_id', 'license_by_id', (['"""MIT"""'], {}), "('MIT')\n", (121, 128), False, 'from poetry.core.spdx.helpers import license_by_id\n'), ((289, 323), 'poetry.core.spdx.helpers.license_by_id', 'license_by_id', (['"""LGPL-3.0-or-later"""'], {}), "('LGPL-3.0-or-later')\n", (30... |
#!/usr/bin/env python3
import os
import sys
import glob
import struct
import optparse
import math
import random
import utils
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor, as_completed
import config_engine as conf
tile_filename = "tiles.dat"
meta_filename = "meta.dat"
stat_filename = "tile_st... | [
"utils.mkdirp",
"os.sync",
"optparse.OptionParser",
"os.path.basename",
"os.getcwd",
"os.path.dirname",
"os.system",
"struct.pack",
"random.seed",
"os.path.join",
"random.getstate",
"concurrent.futures.as_completed"
] | [((408, 425), 'random.getstate', 'random.getstate', ([], {}), '()\n', (423, 425), False, 'import random\n'), ((430, 441), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (439, 441), False, 'import os\n'), ((445, 470), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (460, 470), False, 'import os\n'... |
from pathlib import Path
from pylexibank.dataset import Dataset
class Test(Dataset):
dir = Path(__file__).parent
id = 'test_dataset_cldf_capitalisation'
def cmd_download(self, args):
pass
def cmd_makecldf(self, args):
args.writer.add_language(ID='l')
args.writer.add_concepts... | [
"pathlib.Path"
] | [((98, 112), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (102, 112), False, 'from pathlib import Path\n')] |
"""create_event_table
Revision ID: 89fec1d69a9d
Revises: <PASSWORD>
Create Date: 2019-04-23 10:18:50.019797
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "89fec1d69a9d"
down_revision = "<PASSWORD>"
branch_labels = Non... | [
"alembic.op.drop_table",
"sqlalchemy.DateTime",
"alembic.op.f",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.dialects.postgresql.UUID",
"sqlalchemy.ForeignKeyConstraint"
] | [((1294, 1316), 'alembic.op.drop_table', 'op.drop_table', (['"""event"""'], {}), "('event')\n", (1307, 1316), False, 'from alembic import op\n'), ((745, 822), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['user_id']", "['user_account.id']"], {'ondelete': '"""CASCADE"""'}), "(['user_id'], ['user_acco... |
#!/usr/bin/env python
import numpy as np
from base.simulator import Simulator
class Categorical3(Simulator):
def __init__(
self, num_samples, num_features, correlated=False, binarize=False
) -> None:
super().__init__(num_samples, num_features, correlated, binarize)
def formula(self, X):... | [
"numpy.zeros",
"numpy.vectorize"
] | [((508, 529), 'numpy.zeros', 'np.zeros', (['num_samples'], {}), '(num_samples)\n', (516, 529), True, 'import numpy as np\n'), ((879, 894), 'numpy.vectorize', 'np.vectorize', (['f'], {}), '(f)\n', (891, 894), True, 'import numpy as np\n')] |
import re
import pytest
from pandas import Timedelta
import pandas.tseries.frequencies as frequencies
import pandas.tseries.offsets as offsets
@pytest.mark.parametrize(
"freq_input,expected",
[
(frequencies.to_offset("10us"), offsets.Micro(10)),
(offsets.Hour(), offsets.Hour()),
((5... | [
"pandas.tseries.offsets.Nano",
"pandas.tseries.offsets.Hour",
"pandas.tseries.frequencies.to_offset",
"pandas.tseries.offsets.SemiMonthBegin",
"pandas.tseries.offsets.Day",
"pandas.tseries.offsets.Week",
"pandas.tseries.offsets.QuarterEnd",
"pandas.tseries.offsets.SemiMonthEnd",
"pandas.tseries.offs... | [((1214, 1326), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""freqstr,expected"""', "[('-1S', -1), ('-2SM', -2), ('-1SMS', -1), ('-5min10s', -310)]"], {}), "('freqstr,expected', [('-1S', -1), ('-2SM', -2), (\n '-1SMS', -1), ('-5min10s', -310)])\n", (1237, 1326), False, 'import pytest\n'), ((1455, 1761)... |
import numpy as np
import argparse
import json
import xml.etree.ElementTree as ET
import os
from utils import (
My_Custom_Generator,
yolo_loss,
CustomLearningRateScheduler,
lr_schedule,
)
from model import yolo_model
import matplotlib.pyplot as plt
from tensorflow.keras.callbacks import ModelCheckpoint
... | [
"utils.My_Custom_Generator",
"xml.etree.ElementTree.parse",
"json.load",
"numpy.save",
"argparse.ArgumentParser",
"tensorflow.keras.callbacks.ModelCheckpoint",
"model.yolo_model",
"os.path.join",
"utils.CustomLearningRateScheduler"
] | [((1053, 1075), 'json.load', 'json.load', (['config_file'], {}), '(config_file)\n', (1062, 1075), False, 'import json\n'), ((1693, 1750), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Build Annotations."""'}), "(description='Build Annotations.')\n", (1716, 1750), False, 'import argparse... |
# This sample tests error conditions for ParamSpec (PEP 612).
from typing import Callable, Concatenate, ParamSpec
P = ParamSpec("P")
def add(f: Callable[P, int]) -> Callable[Concatenate[str, P], None]:
def func1(s: str, *args: P.args, **kwargs: P.kwargs) -> None: # Accepted
pass
# Param... | [
"typing.ParamSpec"
] | [((124, 138), 'typing.ParamSpec', 'ParamSpec', (['"""P"""'], {}), "('P')\n", (133, 138), False, 'from typing import Callable, Concatenate, ParamSpec\n')] |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import math
matplotlib.style.use('seaborn')
data = np.genfromtxt(fname="../build/mse.txt",
dtype=np.float32,
delimiter=',',
skip_header=0)
end = -2
energy = data[1:end,0]
errors =... | [
"matplotlib.pyplot.show",
"matplotlib.style.use",
"matplotlib.pyplot.legend",
"numpy.genfromtxt",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.semilogy",
"matplotlib.pyplot.xlabel"
] | [((82, 113), 'matplotlib.style.use', 'matplotlib.style.use', (['"""seaborn"""'], {}), "('seaborn')\n", (102, 113), False, 'import matplotlib\n'), ((122, 213), 'numpy.genfromtxt', 'np.genfromtxt', ([], {'fname': '"""../build/mse.txt"""', 'dtype': 'np.float32', 'delimiter': '""","""', 'skip_header': '(0)'}), "(fname='../... |
from qiskit import QuantumCircuit
from qiskit.compiler import transpile
from qiskit.transpiler import PassManager
# Create simple circuit with toffoli gate
circ = QuantumCircuit(3)
circ.ccx(0,1,2)
circ.draw('mpl').show()
# Unroll circuit (show base gates)
from qiskit.transpiler.passes import Unroller
pass_ = Unroller... | [
"qiskit.circuit.library.U2Gate",
"logging.getLogger",
"logging.Formatter",
"qiskit.converters.circuit_to_dag",
"qiskit.transpiler.PassManager",
"qiskit.tools.visualization.dag_drawer",
"qiskit.circuit.library.CCXGate",
"qiskit.transpiler.passes.BasicSwap",
"qiskit.dagcircuit.DAGCircuit",
"qiskit.t... | [((164, 181), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['(3)'], {}), '(3)\n', (178, 181), False, 'from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit\n'), ((312, 346), 'qiskit.transpiler.passes.Unroller', 'Unroller', (["['u1', 'u2', 'u3', 'cx']"], {}), "(['u1', 'u2', 'u3', 'cx'])\n", (320, 346), Fa... |
#!/usr/bin/python
# -*- coding: utf8 -*-
import sys
import time
import os
allbars = "[--------]"
emptybars = "[ ]"
home = os.getenv("HOME")
with open(home + "/.volume") as f:
content = f.readlines()
with open(home + "/.mute") as f:
isunmuted = (int(f.readlines()[0]) == 0)
if isunmuted:
maxvol = 655... | [
"os.getenv"
] | [((134, 151), 'os.getenv', 'os.getenv', (['"""HOME"""'], {}), "('HOME')\n", (143, 151), False, 'import os\n')] |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | [
"horizon.messages.error",
"copy.copy",
"json.dumps",
"horizon.exceptions.handle",
"horizon.messages.success"
] | [((2348, 2375), 'copy.copy', 'copy.copy', (['self.request.GET'], {}), '(self.request.GET)\n', (2357, 2375), False, 'import copy\n'), ((5103, 5133), 'horizon.messages.success', 'messages.success', (['request', 'msg'], {}), '(request, msg)\n', (5119, 5133), False, 'from horizon import messages\n'), ((5247, 5275), 'horizo... |
import os
import sys
import struct
def eswap_main(filepath, fmt, savepath, verbose=False):
verboseprint = print if verbose else lambda *a, **k: None
verboseprint('Opening file')
fdata = open_file(filepath)
verboseprint('Swapping endianess in file every', fmt, 'bytes')
swapped = swap(fdata, fmt)
... | [
"os.path.isdir",
"struct.iter_unpack",
"struct.pack",
"os.path.split",
"os.path.join"
] | [((333, 356), 'os.path.split', 'os.path.split', (['filepath'], {}), '(filepath)\n', (346, 356), False, 'import os\n'), ((727, 756), 'struct.iter_unpack', 'struct.iter_unpack', (['fmt', 'data'], {}), '(fmt, data)\n', (745, 756), False, 'import struct\n'), ((1685, 1708), 'os.path.isdir', 'os.path.isdir', (['savepath'], {... |
import argparse
import kind_loader
import importer
import exporter
import gql
import console
import processor_indexed
import processor_csv
import processor_sql
import processor_update
import processor_mapper
import oauth
import oauth_gce
import oauth_installed
import oauth_local
import oauth_serviceaccount
import confi... | [
"argparse.ArgumentParser"
] | [((539, 583), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""DSOpz"""'}), "(description='DSOpz')\n", (562, 583), False, 'import argparse\n')] |
import sys
import time
import difflib
import requests
monitor_url = 'https://www.nuedc-training.com.cn/'
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'
}
last_html = None
while True:
res = requests.get(url=monitor_... | [
"difflib.ndiff",
"requests.get",
"time.sleep"
] | [((295, 355), 'requests.get', 'requests.get', ([], {'url': 'monitor_url', 'headers': 'headers', 'verify': '(False)'}), '(url=monitor_url, headers=headers, verify=False)\n', (307, 355), False, 'import requests\n'), ((826, 839), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (836, 839), False, 'import time\n'), ((60... |
#coding=utf8
"""
# Author: <NAME>
# Created Time : Mon 06 Jul 2020 09:26:02 AM CST
# File Name: 01-simplereceive.py
# Description:
"""
import random
import pika
import time
credentials = pika.PlainCredentials('admin','<PASSWORD>')
conn = pika.BlockingConnection(pika.ConnectionParameters(host='rabbitmq',credentials=cr... | [
"random.randint",
"pika.PlainCredentials",
"pika.ConnectionParameters"
] | [((189, 233), 'pika.PlainCredentials', 'pika.PlainCredentials', (['"""admin"""', '"""<PASSWORD>"""'], {}), "('admin', '<PASSWORD>')\n", (210, 233), False, 'import pika\n'), ((264, 331), 'pika.ConnectionParameters', 'pika.ConnectionParameters', ([], {'host': '"""rabbitmq"""', 'credentials': 'credentials'}), "(host='rabb... |
from pablo.envs import Canvas
from pablo.agents import Agent
from gym.envs.registration import register
register(
id='pablo-v0',
entry_point='pablo.envs:Canvas',
)
| [
"gym.envs.registration.register"
] | [((106, 162), 'gym.envs.registration.register', 'register', ([], {'id': '"""pablo-v0"""', 'entry_point': '"""pablo.envs:Canvas"""'}), "(id='pablo-v0', entry_point='pablo.envs:Canvas')\n", (114, 162), False, 'from gym.envs.registration import register\n')] |
import numpy as np
class Token:
def __init__(self, score, history, words=None, parent_node=None):
self.score = score
self.history = history
self.parent_node = parent_node
if words is None:
self.words = []
else:
self.words = words
def __eq__(se... | [
"subprocess.check_output",
"numpy.log"
] | [((8275, 8329), 'subprocess.check_output', 'subprocess.check_output', (['args'], {'universal_newlines': '(True)'}), '(args, universal_newlines=True)\n', (8298, 8329), False, 'import subprocess\n'), ((3218, 3227), 'numpy.log', 'np.log', (['p'], {}), '(p)\n', (3224, 3227), True, 'import numpy as np\n'), ((3702, 3717), 'n... |
"""Depth-based models for supervised classification."""
from __future__ import annotations
from itertools import combinations
from typing import Generic, Optional, Sequence, TypeVar, Union
import numpy as np
from scipy.interpolate import lagrange
from sklearn.base import BaseEstimator, ClassifierMixin, clone
from skl... | [
"numpy.argmax",
"numpy.polyval",
"sklearn.metrics.accuracy_score",
"scipy.interpolate.lagrange",
"sklearn.utils.validation.check_is_fitted",
"typing.TypeVar",
"sklearn.base.clone"
] | [((800, 825), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': 'FData'}), "('T', bound=FData)\n", (807, 825), False, 'from typing import Generic, Optional, Sequence, TypeVar, Union\n'), ((5277, 5306), 'sklearn.utils.validation.check_is_fitted', 'sklearn_check_is_fitted', (['self'], {}), '(self)\n', (5300, 5306), Tr... |
import hypothesis.extra.numpy as hnp
import hypothesis.strategies as st
import numpy as np
from hypothesis import given
from numpy.testing import assert_allclose
from mygrad import Tensor
from mygrad.nnet.activations import logsoftmax, softmax
from tests.custom_strategies import valid_axes
from tests.wrappers.uber imp... | [
"numpy.logical_and",
"hypothesis.strategies.data",
"numpy.asarray",
"numpy.testing.assert_allclose",
"hypothesis.strategies.floats",
"numpy.finfo",
"mygrad.nnet.activations.softmax",
"numpy.array",
"mygrad.Tensor",
"mygrad.nnet.activations.logsoftmax",
"tests.custom_strategies.valid_axes",
"hy... | [((1368, 1381), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (1378, 1381), True, 'import numpy as np\n'), ((2617, 2675), 'numpy.array', 'np.array', (['[0.87566484, 0.53596079, 0.85693981, 0.09526036]'], {}), '([0.87566484, 0.53596079, 0.85693981, 0.09526036])\n', (2625, 2675), True, 'import numpy as np\n'), ((2... |
from __future__ import print_function
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import torchvision
import torchvision.transforms as transforms
from torch.nn.utils.rnn import pack_padded_sequence
from utils_rasha import to_device
import numpy as np
from absl import f... | [
"torch.nn.utils.rnn.pack_padded_sequence",
"new_models_rasha.Encoder_Rasha",
"test_rasha.test_rasha",
"torch.nn.CrossEntropyLoss",
"new_models_rasha.Decoder_Rasha",
"utils_rasha.get_data",
"time.time",
"absl.logging.info",
"utils_rasha.to_device",
"torch.optim.Adam",
"torch.cuda.is_available",
... | [((536, 557), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (555, 557), True, 'import torch.nn as nn\n'), ((675, 700), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (698, 700), False, 'import torch\n'), ((1472, 1487), 'utils_rasha.get_data', 'get_data', (['batch'], {}),... |
import numpy as np
import os
import shutil
import torch
def count_parameters_in_MB(model):
return np.sum(
np.prod(v.size())
for name, v in model.named_parameters() if "auxiliary" not in name
) / 1e6
def save_checkpoint(state, is_best, save):
filename = os.path.join(save, 'c... | [
"torch.save",
"torch.load",
"shutil.copyfile",
"os.path.join"
] | [((299, 339), 'os.path.join', 'os.path.join', (['save', '"""checkpoint.pth.tar"""'], {}), "(save, 'checkpoint.pth.tar')\n", (311, 339), False, 'import os\n'), ((345, 372), 'torch.save', 'torch.save', (['state', 'filename'], {}), '(state, filename)\n', (355, 372), False, 'import torch\n'), ((415, 455), 'os.path.join', '... |
import os
import sys
import time
import json
import shelve
import urllib
import threading
from datetime import timedelta
from functools import wraps
import xbmcswift2
from xbmcswift2 import xbmc, xbmcaddon, xbmcplugin, xbmcgui
from xbmcswift2.storage import TimedStorage
from xbmcswift2.logger import log
from xbmcswift... | [
"os.remove",
"xbmcswift2.xbmcplugin.setContent",
"xbmcswift2.xbmc.executebuiltin",
"json.dumps",
"xbmcswift2.ListItem.from_dict",
"xbmcswift2.logger.log.error",
"os.path.join",
"xbmcswift2.xbmc.PlayList",
"xbmcswift2.storage.TimedStorage",
"json.loads",
"xbmcswift2.xbmc.Player",
"threading.Loc... | [((1222, 1238), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1236, 1238), False, 'import threading\n'), ((4040, 4072), 'os.path.join', 'os.path.join', (['storage_path', 'name'], {}), '(storage_path, name)\n', (4052, 4072), False, 'import os\n'), ((12000, 12034), 'xbmcswift2.xbmc.PlayList', 'xbmc.PlayList', ([... |
import tensorflow as tf
import numpy as np
import rllab.misc.logger as logger
from rllab.misc import ext
from rllab.misc.overrides import overrides
from sandbox.rocky.tf.algos.batch_maml_dagger_polopt import BatchMAMLPolopt
from sandbox.rocky.tf.misc import tensor_utils
from sandbox.rocky.tf.optimizers.penalty_lbfgs_op... | [
"tensorflow.reduce_sum",
"rllab.misc.logger.log",
"tensorflow.stop_gradient",
"tensorflow.reduce_mean",
"tensorflow.concat",
"rllab.misc.ext.extract",
"tensorflow.stack",
"tensorflow.cast",
"tensorflow.multiply",
"tensorflow.shape",
"numpy.arange",
"tensorflow.exp",
"tensorflow.square",
"s... | [((23244, 23279), 'rllab.misc.logger.log', 'logger.log', (['"""Computing loss before"""'], {}), "('Computing loss before')\n", (23254, 23279), True, 'import rllab.misc.logger as logger\n'), ((1361, 1459), 'sandbox.rocky.tf.optimizers.quad_dist_expert_optimizer.QuadDistExpertOptimizer', 'QuadDistExpertOptimizer', (['"""... |
from nlp_architect.data.cdc_resources.embedding.embed_elmo import ElmoEmbedding
from nlp_architect.data.cdc_resources.relations.relation_types_enums import EmbeddingMethod, \
RelationType
from nlp_architect.data.cdc_resources.relations.word_embedding_relation_extraction import \
WordEmbeddingRelationExtraction
... | [
"nlp_architect.data.cdc_resources.embedding.embed_elmo.ElmoEmbedding",
"tests.cdc.test_utils.get_mentions",
"nlp_architect.data.cdc_resources.relations.word_embedding_relation_extraction.WordEmbeddingRelationExtraction"
] | [((408, 422), 'tests.cdc.test_utils.get_mentions', 'get_mentions', ([], {}), '()\n', (420, 422), False, 'from tests.cdc.test_utils import get_mentions\n'), ((437, 452), 'nlp_architect.data.cdc_resources.embedding.embed_elmo.ElmoEmbedding', 'ElmoEmbedding', ([], {}), '()\n', (450, 452), False, 'from nlp_architect.data.c... |
from django import forms
from django.contrib.contenttypes.models import ContentType
from django.db.models import ObjectDoesNotExist
from ckeditor.widgets import CKEditorWidget
from .models import Comment
'''
用于提交评论的表单
'''
class CommentForm(forms.Form):
content_type = forms.CharField(widget=forms.HiddenInput)
... | [
"django.forms.IntegerField",
"django.contrib.contenttypes.models.ContentType.objects.get",
"django.forms.HiddenInput",
"django.forms.ValidationError",
"ckeditor.widgets.CKEditorWidget",
"django.forms.CharField"
] | [((274, 315), 'django.forms.CharField', 'forms.CharField', ([], {'widget': 'forms.HiddenInput'}), '(widget=forms.HiddenInput)\n', (289, 315), False, 'from django import forms\n'), ((332, 376), 'django.forms.IntegerField', 'forms.IntegerField', ([], {'widget': 'forms.HiddenInput'}), '(widget=forms.HiddenInput)\n', (350,... |
"""
djinga
Unobtrusive jinja2 integration in Django
(c) 2014-2017 <NAME>
MIT license (see LICENSE.txt) unless otherwise stated in file header
"""
from setuptools import setup, find_packages
import os
# imports __version__ variable
exec(open('djinga/version.py').read())
dev_status = __version_info__[3]
... | [
"os.path.join",
"setuptools.find_packages"
] | [((1545, 1578), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "('tests',)"}), "(exclude=('tests',))\n", (1558, 1578), False, 'from setuptools import setup, find_packages\n'), ((768, 794), 'os.path.join', 'os.path.join', (['"""README.rst"""'], {}), "('README.rst')\n", (780, 794), False, 'import os\n')] |
# Generated by Django 3.0.7 on 2020-10-03 22:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='userdetail',
name='phone',
... | [
"django.db.models.CharField"
] | [((326, 368), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(15)', 'null': '(True)'}), '(max_length=15, null=True)\n', (342, 368), False, 'from django.db import migrations, models\n')] |
# Generated by Django 2.2.2 on 2019-07-01 05:17
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('api', '0003_auto_20190630_1620'),
]
operations = [
migrations.AlterField(
model_name='favourite',
... | [
"django.db.models.DateTimeField"
] | [((370, 441), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'default': 'django.utils.timezone.now', 'editable': '(False)'}), '(default=django.utils.timezone.now, editable=False)\n', (390, 441), False, 'from django.db import migrations, models\n')] |
"""
Configuration file for the Sphinx documentation builder.
This file only contains a selection of the most common options. For a full
list see the documentation:
https://www.sphinx-doc.org/en/master/usage/configuration.html
"""
# -- Path setup --------------------------------------------------------------
import sy... | [
"sphinx.util.inspect.getdoc",
"sys.path.extend",
"sphinx.util.docstrings.separate_metadata"
] | [((414, 441), 'sys.path.extend', 'sys.path.extend', (["['../src']"], {}), "(['../src'])\n", (429, 441), False, 'import sys\n'), ((1595, 1627), 'sphinx.util.inspect.getdoc', 'getdoc', (['obj'], {'cls': 'name', 'name': 'name'}), '(obj, cls=name, name=name)\n', (1601, 1627), False, 'from sphinx.util.inspect import getdoc\... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='todo_index'),
path('login/', views.log, name='test_login'),
path('reg/', views.reg, name='reg'),
path('add_todo/', views.add_list, name='add_list'),
path('delete_todo/', views.delete_list, name='delete_list... | [
"django.urls.path"
] | [((70, 110), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""todo_index"""'}), "('', views.index, name='todo_index')\n", (74, 110), False, 'from django.urls import path\n'), ((116, 160), 'django.urls.path', 'path', (['"""login/"""', 'views.log'], {'name': '"""test_login"""'}), "('login/', views.log... |
import _pickle as pickle
from phocnet.attributes.phoc import build_phoc
# build a PHOC dictionary to perform QbS/word recognition
def main():
# IAM PHOC unigrams
unigrams = ['-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', \
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', \
... | [
"phocnet.attributes.phoc.build_phoc"
] | [((643, 722), 'phocnet.attributes.phoc.build_phoc', 'build_phoc', ([], {'words': 'words', 'phoc_unigrams': 'unigrams', 'unigram_levels': '[1, 2, 3, 4, 5]'}), '(words=words, phoc_unigrams=unigrams, unigram_levels=[1, 2, 3, 4, 5])\n', (653, 722), False, 'from phocnet.attributes.phoc import build_phoc\n')] |
import vtk
from vtk.util.numpy_support import numpy_to_vtk, vtk_to_numpy, numpy_to_vtkIdTypeArray
import numpy as np
import vedo
from vedo.colors import printc
import time
import math
import sys
__doc__ = (
"""
Utilities submodule.
"""
+ vedo.docs._defs
)
__all__ = [
"ProgressBar",
"geometry",
"is... | [
"numpy.arctan2",
"vedo.Mesh",
"vtk.vtkPoints",
"vtk.util.numpy_support.numpy_to_vtk",
"numpy.abs",
"numpy.sum",
"vtk.util.numpy_support.vtk_to_numpy",
"numpy.isnan",
"numpy.around",
"numpy.histogram",
"numpy.sin",
"numpy.arange",
"vtk.util.numpy_support.numpy_to_vtkIdTypeArray",
"numpy.lin... | [((7281, 7306), 'numpy.ascontiguousarray', 'np.ascontiguousarray', (['arr'], {}), '(arr)\n', (7301, 7306), True, 'import numpy as np\n'), ((7937, 7955), 'vtk.util.numpy_support.vtk_to_numpy', 'vtk_to_numpy', (['varr'], {}), '(varr)\n', (7949, 7955), False, 'from vtk.util.numpy_support import numpy_to_vtk, vtk_to_numpy,... |
# review/tests/test_media_api.py
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from review.models import Project, Review, Asset, Media
from review.serializers import MediaSeria... | [
"review.models.Media.objects.get",
"review.models.Media.objects.create",
"review.models.Media.objects.filter",
"rest_framework.test.APIClient",
"review.serializers.MediaSerializer",
"django.contrib.auth.get_user_model",
"django.urls.reverse",
"review.models.Review.objects.create",
"review.models.Med... | [((345, 366), 'django.urls.reverse', 'reverse', (['"""media_list"""'], {}), "('media_list')\n", (352, 366), False, 'from django.urls import reverse\n'), ((514, 535), 'django.urls.reverse', 'reverse', (['"""media_list"""'], {}), "('media_list')\n", (521, 535), False, 'from django.urls import reverse\n'), ((837, 877), 'd... |
import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
import os.path as osp
import tempfile
import xml.etree.ElementTree as ET
# import gym.envs.mujoco.arm_shaping
import os
import IPython
import scipy.misc
class PusherEnv7DOFExp2(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):... | [
"xml.etree.ElementTree.parse",
"numpy.random.uniform",
"gym.envs.mujoco.mujoco_env.MujocoEnv.__init__",
"os.path.dirname",
"numpy.asarray",
"numpy.square",
"numpy.array",
"numpy.linalg.norm",
"gym.utils.EzPickle.__init__"
] | [((329, 358), 'gym.utils.EzPickle.__init__', 'utils.EzPickle.__init__', (['self'], {}), '(self)\n', (352, 358), False, 'from gym import utils\n'), ((427, 477), 'gym.envs.mujoco.mujoco_env.MujocoEnv.__init__', 'mujoco_env.MujocoEnv.__init__', (['self', '"""temp.xml"""', '(5)'], {}), "(self, 'temp.xml', 5)\n", (456, 477)... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 Klimaat
import time
import signal
import syslog
class Timer(object):
"""
Simple Timer object.
"""
def __init__(self, name=None):
self.name = name
def __enter__(self):
self.tstart = time.time()
def __exit__(self, type_, value, trace... | [
"signal.signal",
"time.sleep",
"syslog.syslog",
"time.time"
] | [((635, 693), 'syslog.syslog', 'syslog.syslog', (["('%s Elapsed: %d:%02d:%02d' % (msg, h, m, s))"], {}), "('%s Elapsed: %d:%02d:%02d' % (msg, h, m, s))\n", (648, 693), False, 'import syslog\n'), ((265, 276), 'time.time', 'time.time', ([], {}), '()\n', (274, 276), False, 'import time\n'), ((825, 867), 'signal.signal', '... |
"""empty message
Revision ID: <PASSWORD>
Revises: <PASSWORD>
Create Date: 2021-07-11 20:10:55.356770
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from sqlalchemy.dialects.postgresql import JSONB, ARRAY, TIMESTAMP
from sqlalchemy.ext.mutable import MutableDict, MutableL... | [
"alembic.op.alter_column",
"sqlalchemy.ext.mutable.MutableDict.as_mutable",
"sqlalchemy.orm.declarative_base",
"sqlalchemy.String",
"sqlalchemy.dialects.postgresql.ARRAY",
"sqlalchemy.ForeignKey",
"alembic.op.drop_column",
"sqlalchemy.Text",
"alembic.op.execute",
"sqlalchemy.Column",
"alembic.op... | [((885, 903), 'sqlalchemy.orm.declarative_base', 'declarative_base', ([], {}), '()\n', (901, 903), False, 'from sqlalchemy.orm import declarative_base\n'), ((612, 648), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html'], {'features': '"""lxml"""'}), "(html, features='lxml')\n", (625, 648), False, 'from bs4 import Beautifu... |
# Types.py - PyCIL type handling
# Copyright 2010 <NAME>
# See LICENSE for details
import unittest
from ClassDefinition import ClassDefinition
import Types
UserDefinedTypes = []
SystemTypes = []
Aliases = {}
NativeIntSize = 4
NativeFloatSize = 4
NativePointerSize = 4
def register_custom_type(c, is_system_type = Fals... | [
"ClassDefinition.ClassDefinition"
] | [((4828, 4845), 'ClassDefinition.ClassDefinition', 'ClassDefinition', ([], {}), '()\n', (4843, 4845), False, 'from ClassDefinition import ClassDefinition\n'), ((4949, 4966), 'ClassDefinition.ClassDefinition', 'ClassDefinition', ([], {}), '()\n', (4964, 4966), False, 'from ClassDefinition import ClassDefinition\n'), ((5... |
"""
:date_created: 2021-11-21
"""
import crypt
import hashlib
from do_py import R
from db_able import Loadable, Creatable, Savable, Deletable
class User(Loadable, Creatable, Savable, Deletable):
"""
User DataObject with DB CRUD implementation.
Customized to handle password encryption and security stand... | [
"crypt.mksalt"
] | [((876, 909), 'crypt.mksalt', 'crypt.mksalt', (['crypt.METHOD_SHA512'], {}), '(crypt.METHOD_SHA512)\n', (888, 909), False, 'import crypt\n')] |
from django.test import TestCase
from doac.models import Client
class TestClientModel(TestCase):
def test_unicode(self):
client = Client(name="<NAME>", access_host="http://localhost/")
client.save()
self.assertEqual(unicode(client), client.name)
def test_generate_secret(self):
... | [
"doac.models.Client"
] | [((145, 199), 'doac.models.Client', 'Client', ([], {'name': '"""<NAME>"""', 'access_host': '"""http://localhost/"""'}), "(name='<NAME>', access_host='http://localhost/')\n", (151, 199), False, 'from doac.models import Client\n'), ((332, 386), 'doac.models.Client', 'Client', ([], {'name': '"""<NAME>"""', 'access_host': ... |
import httpx
from utils.etc import search_manga, get_chapter
# get manga chapters
def manga(url_query: str):
resp = httpx.get(search_manga(url_query), timeout=None)
# the magna-api server returns `null`
# if there was a problem with the request
# so, try to decode it
# and parse no data, if there... | [
"utils.etc.search_manga",
"utils.etc.get_chapter"
] | [((131, 154), 'utils.etc.search_manga', 'search_manga', (['url_query'], {}), '(url_query)\n', (143, 154), False, 'from utils.etc import search_manga, get_chapter\n'), ((618, 640), 'utils.etc.get_chapter', 'get_chapter', (['url_query'], {}), '(url_query)\n', (629, 640), False, 'from utils.etc import search_manga, get_ch... |
from datetimerange import DateTimeRange
from datetime import date
from dateutil.relativedelta import relativedelta
import sqlite3 as lite
con = lite.connect('JobDetails.db')
cur = con.cursor()
finalResults = []
for year in range(2013, 2020):
start = str(year) + "/1/1"
end = str(year) + "/12/31"
# start... | [
"sqlite3.connect",
"datetimerange.DateTimeRange"
] | [((145, 174), 'sqlite3.connect', 'lite.connect', (['"""JobDetails.db"""'], {}), "('JobDetails.db')\n", (157, 174), True, 'import sqlite3 as lite\n'), ((389, 414), 'datetimerange.DateTimeRange', 'DateTimeRange', (['start', 'end'], {}), '(start, end)\n', (402, 414), False, 'from datetimerange import DateTimeRange\n')] |
#
# SPDX-License-Identifier: Apache-2.0
#
import logging
import os
from django.conf import settings
from api.lib.agent.docker import DockerAgent
from api.lib.agent.kubernetes import KubernetesAgent
from api.common.enums import HostType
LOG = logging.getLogger(__name__)
MEDIA_ROOT = getattr(settings, "MEDIA_ROOT")
... | [
"os.path.dirname",
"api.lib.agent.docker.DockerAgent",
"logging.getLogger",
"api.common.enums.HostType.Kubernetes.name.lower",
"api.common.enums.HostType.Docker.name.lower",
"api.lib.agent.kubernetes.KubernetesAgent"
] | [((245, 272), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (262, 272), False, 'import logging\n'), ((1166, 1194), 'api.common.enums.HostType.Docker.name.lower', 'HostType.Docker.name.lower', ([], {}), '()\n', (1192, 1194), False, 'from api.common.enums import HostType\n'), ((1222, 1244)... |
"""
Abstract base class for the various polynomial base classes.
This module contains the abstract base classes, from which all concrete implementations of polynomial classes shall subclass.
This ensures that all polynomials work with the same interface, so futher features can be formulated without referencing the con... | [
"copy.deepcopy",
"numpy.concatenate"
] | [((28551, 28612), 'numpy.concatenate', 'np.concatenate', (['(self.internal_domain, extra_internal_domain)'], {}), '((self.internal_domain, extra_internal_domain))\n', (28565, 28612), True, 'import numpy as np\n'), ((28735, 28788), 'numpy.concatenate', 'np.concatenate', (['(self.user_domain, extra_user_domain)'], {}), '... |
class Solution:
def letterCombinations(self, digits):
"""
:type digits: str
:rtype: List[str]
"""
# if not digits:
# return []
# mapping = {
# '1': [],
# '2': ['a', 'b', 'c'],
# '3': ['d', 'e', 'f'],
# '4': ... | [
"functools.reduce"
] | [((1392, 1453), 'functools.reduce', 'reduce', (['(lambda x, y: [(i + j) for i in x for j in y])', 'letters'], {}), '(lambda x, y: [(i + j) for i in x for j in y], letters)\n', (1398, 1453), False, 'from functools import reduce\n')] |
import matplotlib
matplotlib.use("Agg")
import argparse
import pandas as pd
import pickle
import explain
import shap
from flask import Flask, render_template, request, redirect, url_for
import os
from werkzeug import secure_filename
from werkzeug import SharedDataMiddleware
app = Flask(__name__)
app.confi... | [
"explain.Explain",
"pandas.read_csv",
"os.getcwd",
"flask.Flask",
"werkzeug.SharedDataMiddleware",
"shap.KernelExplainer",
"werkzeug.secure_filename",
"matplotlib.use",
"shap.TreeExplainer",
"flask.render_template",
"shap.DeepExplainer",
"os.path.join"
] | [((19, 40), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (33, 40), False, 'import matplotlib\n'), ((294, 309), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (299, 309), False, 'from flask import Flask, render_template, request, redirect, url_for\n'), ((3080, 3144), 'werkzeug.Share... |
import numpy as np
from shapely import ops
from shapely.geometry import Polygon
from .. import util
from .. import bounds
from .. import graph
from .. import geometry
from .. import grouping
from ..constants import log
from ..constants import tol_path as tol
from ..transformations import transform_points
from .simp... | [
"numpy.argmax",
"matplotlib.pyplot.axes",
"scipy.spatial.Voronoi",
"numpy.clip",
"numpy.isclose",
"numpy.sin",
"numpy.linalg.norm",
"numpy.unique",
"shapely.geometry.Polygon",
"rtree.Rtree",
"shapely.vectorized.contains",
"numpy.append",
"numpy.reshape",
"matplotlib.pyplot.show",
"numpy.... | [((1513, 1520), 'rtree.Rtree', 'Rtree', ([], {}), '()\n', (1518, 1520), False, 'from rtree import Rtree\n'), ((1572, 1584), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (1582, 1584), True, 'import networkx as nx\n'), ((6570, 6609), 'numpy.asanyarray', 'np.asanyarray', (['matrix'], {'dtype': 'np.float64'}), '(mat... |
"""
Tests for concierge-cli's adapter classes
"""
# from gitlab.v4.objects import (
# Group as Gitlab_Group,
# GroupMember as Gitlab_GroupMember,
# )
from unittest.mock import Mock, patch
from concierge_cli.manager import GitlabAPI
from concierge_cli.adapter import (
# GITLAB_PERMISSIONS,
# GroupMember... | [
"unittest.mock.patch",
"unittest.mock.Mock",
"concierge_cli.manager.GitlabAPI"
] | [((1218, 1256), 'unittest.mock.patch', 'patch', (['"""concierge_cli.adapter.Project"""'], {}), "('concierge_cli.adapter.Project')\n", (1223, 1256), False, 'from unittest.mock import Mock, patch\n'), ((411, 444), 'unittest.mock.Mock', 'Mock', (['"""gitlab.v4.objects.Project"""'], {}), "('gitlab.v4.objects.Project')\n", ... |
import logging
import os
import random
import string
import subprocess
import sys
from argparse import Namespace
logging.getLogger("transformers").setLevel(logging.WARNING)
import click
import torch
from luke.utils.model_utils import ModelArchive
from .utils.experiment_logger import commet_logger_args, CometLogger,... | [
"argparse.Namespace",
"os.environ.copy",
"click.option",
"subprocess.CalledProcessError",
"click.Path",
"torch.device",
"os.path.exists",
"click.Choice",
"torch.cuda.set_device",
"click.group",
"subprocess.Popen",
"os.path.basename",
"sys.exit",
"torch.distributed.init_process_group",
"o... | [((694, 721), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (711, 721), False, 'import logging\n'), ((725, 738), 'click.group', 'click.group', ([], {}), '()\n', (736, 738), False, 'import click\n'), ((876, 913), 'click.option', 'click.option', (['"""--num-gpus"""'], {'default': '(1)'}), ... |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
# Copyright 2022 Northern System Service Co., Ltd. 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
#
# h... | [
"dataloader.factory.parser_generator",
"tensorflow.compat.v1.data.experimental.map_and_batch",
"ops.spatial_transform_ops.fused_transpose_and_space_to_depth",
"tensorflow.compat.v1.transpose",
"tensorflow.compat.v1.data.Dataset.list_files"
] | [((1735, 1854), 'ops.spatial_transform_ops.fused_transpose_and_space_to_depth', 'spatial_transform_ops.fused_transpose_and_space_to_depth', (['batch_images', 'space_to_depth_block_size', 'transpose_images'], {}), '(batch_images,\n space_to_depth_block_size, transpose_images)\n', (1791, 1854), False, 'from ops import... |
import os
import smtplib
import time
import yagmail
import config
import logs
# A list of tuples containing email data (see 'send_emails()' documentation for details)
site_emails = []
admin_email = []
@logs.unexpected_exception_handling
def replace_angle_brackets(content):
"""Replace angle brackets with curly ... | [
"os.mkdir",
"logs.update_main_log",
"os.path.isdir",
"yagmail.register",
"logs.admin_email_errors.copy",
"logs.get_timestamp",
"logs.get_err_str",
"time.sleep",
"logs.log_error",
"yagmail.SMTP"
] | [((2119, 2160), 'yagmail.register', 'yagmail.register', (['config.SENDER_EMAIL', 'pw'], {}), '(config.SENDER_EMAIL, pw)\n', (2135, 2160), False, 'import yagmail\n'), ((2949, 2982), 'logs.update_main_log', 'logs.update_main_log', (['success_msg'], {}), '(success_msg)\n', (2969, 2982), False, 'import logs\n'), ((3020, 30... |
import utils.dsa as dsa
from hashlib import sha256
from modules.abstract_module import *
from json import loads
class KnownNonceDSa(AbstractModule):
name = 'known_nonce'
description = 'This module queries a signature oracle until it gets a repeated r value and then computes the private key'
arguments = [M... | [
"utils.dsa.DSAVerify",
"utils.dsa.known_nonce"
] | [((991, 1021), 'utils.dsa.known_nonce', 'dsa.known_nonce', (['k', 'h', 's', 'r', 'q'], {}), '(k, h, s, r, q)\n', (1006, 1021), True, 'import utils.dsa as dsa\n'), ((947, 978), 'utils.dsa.DSAVerify', 'dsa.DSAVerify', (['public_key', 'data'], {}), '(public_key, data)\n', (960, 978), True, 'import utils.dsa as dsa\n')] |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2011 by the <NAME>, see AUTHORS for more details.
#
# 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... | [
"hashlib.md5",
"heapq.heappush",
"heapq.heappop",
"time.time",
"random.random"
] | [((1016, 1021), 'hashlib.md5', 'md5', ([], {}), '()\n', (1019, 1021), False, 'from hashlib import md5\n'), ((1885, 1891), 'time.time', 'time', ([], {}), '()\n', (1889, 1891), False, 'from time import time\n'), ((2922, 2952), 'heapq.heappush', 'heappush', (['self._queue', 'session'], {}), '(self._queue, session)\n', (29... |
import logging
from flask import Flask
from apscheduler.schedulers.background import BackgroundScheduler
import atexit
from .main import html, db
from .main.persistence.utils import set_database_config
from .main.handler import sensor_handler
from .main.handler.sensor_handler import handle_current_sensors
from .main... | [
"apscheduler.schedulers.background.BackgroundScheduler",
"flask.Flask",
"logging.getLogger"
] | [((1189, 1204), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (1194, 1204), False, 'from flask import Flask\n'), ((2285, 2317), 'apscheduler.schedulers.background.BackgroundScheduler', 'BackgroundScheduler', ([], {'daemon': '(True)'}), '(daemon=True)\n', (2304, 2317), False, 'from apscheduler.schedulers.b... |
"""
Testing for the base module (sklearn.ensemble.base).
"""
# Authors: <NAME>
# License: BSD 3 clause
from numpy.testing import assert_equal
from nose.tools import assert_raises, assert_true
from sklearn.ensemble import BaseEnsemble
from sklearn.tree import DecisionTreeClassifier
def test_base():
"""Check Bas... | [
"nose.tools.assert_raises",
"sklearn.ensemble.BaseEnsemble",
"sklearn.tree.DecisionTreeClassifier"
] | [((353, 377), 'sklearn.tree.DecisionTreeClassifier', 'DecisionTreeClassifier', ([], {}), '()\n', (375, 377), False, 'from sklearn.tree import DecisionTreeClassifier\n'), ((393, 442), 'sklearn.ensemble.BaseEnsemble', 'BaseEnsemble', ([], {'base_estimator': 'tree', 'n_estimators': '(3)'}), '(base_estimator=tree, n_estima... |
import torch
import torch.nn.functional as F
import numpy as np
import random
from importlib import import_module
from .default import NormalNN
from .default import *
from .regularization import SI, L2, EWC, MAS
from dataloaders.wrapper import Storage
from collections import Counter
from scipy import stats
import data... | [
"torch.nn.functional.binary_cross_entropy",
"dataloaders.base.EMNIST",
"numpy.sum",
"torch.eye",
"ipdb.set_trace",
"torch.randn",
"torch.cat",
"numpy.argmin",
"numpy.argsort",
"utils.metric.Timer",
"torch.nn.Softmax",
"numpy.exp",
"dataloaders.datasetGen.SplitGen",
"torch.no_grad",
"torc... | [((1754, 1770), 'numpy.sum', 'np.sum', (['count_np'], {}), '(count_np)\n', (1760, 1770), True, 'import numpy as np\n'), ((1933, 1998), 'scipy.stats.rv_discrete', 'stats.rv_discrete', ([], {'name': '"""prior"""', 'values': '(xk, prob_tup)', 'seed': 'seed'}), "(name='prior', values=(xk, prob_tup), seed=seed)\n", (1950, 1... |
import logging
import os
import shutil
import galaxy.tools
from galaxy import util
from galaxy.datatypes.sniff import is_column_based
from galaxy.tool_shed.util import basic_util
from galaxy.util import checkers
from galaxy.util.expressions import ExpressionContext
from galaxy.web.form_builder import SelectField
log ... | [
"os.path.lexists",
"os.path.abspath",
"galaxy.web.form_builder.SelectField",
"galaxy.util.checkers.check_binary",
"galaxy.util.checkers.check_html",
"galaxy.util.listify",
"shutil.copy",
"galaxy.util.checkers.is_bz2",
"galaxy.tool_shed.util.basic_util.strip_path",
"galaxy.util.expressions.Expressi... | [((322, 349), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (339, 349), False, 'import logging\n'), ((863, 897), 'galaxy.web.form_builder.SelectField', 'SelectField', ([], {'name': '"""shed_tool_conf"""'}), "(name='shed_tool_conf')\n", (874, 897), False, 'from galaxy.web.form_builder imp... |
# pseudo-code
# fetch data from api
# save relevant data into variables
import urllib
# import urllib3.request
import json
def api_to_json(url):
response = urllib.urlopen(url).read()
# response = urllib3.request.urlopen(url).read()
return json.loads(response)
| [
"urllib.urlopen",
"json.loads"
] | [((253, 273), 'json.loads', 'json.loads', (['response'], {}), '(response)\n', (263, 273), False, 'import json\n'), ((162, 181), 'urllib.urlopen', 'urllib.urlopen', (['url'], {}), '(url)\n', (176, 181), False, 'import urllib\n')] |
from django.contrib.auth import get_user_model
from mayan.apps.documents.tests.base import GenericDocumentViewTestCase
from mayan.apps.metadata.permissions import permission_document_metadata_edit
from mayan.apps.metadata.tests.mixins import MetadataTypeTestMixin
from mayan.apps.testing.tests.base import GenericViewTe... | [
"django.contrib.auth.get_user_model"
] | [((7257, 7273), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (7271, 7273), False, 'from django.contrib.auth import get_user_model\n'), ((7729, 7745), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (7743, 7745), False, 'from django.contrib.auth import get_user_mode... |
#!/usr/bin/python3
# This file collects all the "theory" bounds for various private ERM methods,
# i.e. bounds that say a given set of parameters has such an expected excess error.
import sys
import math
import numpy as np
import matplotlib.pyplot as plt
import traceback
usage_str = """
Usage: python3 theory.py n di... | [
"matplotlib.pyplot.show",
"math.sqrt",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"traceback.format_exc",
"numpy.linspace",
"math.log"
] | [((1853, 1869), 'math.sqrt', 'math.sqrt', (['(a / c)'], {}), '(a / c)\n', (1862, 1869), False, 'import math\n'), ((2338, 2354), 'math.sqrt', 'math.sqrt', (['(a / c)'], {}), '(a / c)\n', (2347, 2354), False, 'import math\n'), ((2835, 2860), 'math.sqrt', 'math.sqrt', (['(1.0 / n + lamb)'], {}), '(1.0 / n + lamb)\n', (284... |
# Create and plot an icosahedron.
#
import pyvista
tetra = pyvista.Icosahedron()
tetra.plot(categories=True)
| [
"pyvista.Icosahedron"
] | [((59, 80), 'pyvista.Icosahedron', 'pyvista.Icosahedron', ([], {}), '()\n', (78, 80), False, 'import pyvista\n')] |
# -*- coding: utf-8 -*-
"""
@authors: <NAME> and <NAME>
"""
"""
Error codes can be found at the end of this file
"""
import ipaddress as ip
import urllib.parse as urlparse
import ssl
import socket
import requests
from bs4 import BeautifulSoup as bs
from ast import literal_eval
import urllib
import re
from datetime i... | [
"selenium.webdriver.chrome.options.Options",
"urllib.request.Request",
"ast.literal_eval",
"ssl.create_default_context",
"requests.Session",
"socket.socket",
"ipaddress.ip_address",
"datetime.datetime.now",
"urllib.request.build_opener",
"platform.system",
"pathlib.Path",
"urllib.parse.urlspli... | [((715, 726), 'fluffypancakes.recurrent.Recurrent', 'Recurrent', ([], {}), '()\n', (724, 726), False, 'from fluffypancakes.recurrent import Recurrent\n'), ((2796, 2849), 'os.path.join', 'os.path.join', (['path', '"""data"""', '"""shortening_services.txt"""'], {}), "(path, 'data', 'shortening_services.txt')\n", (2808, 2... |
# Copyright The OpenTelemetry 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"opentelemetry.sdk.trace.export.BatchSpanProcessor",
"opentelemetry.sdk.trace.TracerProvider",
"opentelemetry.exporter.richconsole.RichConsoleSpanExporter",
"pytest.fixture"
] | [((772, 809), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""span_processor"""'}), "(name='span_processor')\n", (786, 809), False, 'import pytest\n'), ((991, 1029), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""tracer_provider"""'}), "(name='tracer_provider')\n", (1005, 1029), False, 'import pytest\n'), ... |
# Generated by Django 3.0.9 on 2020-08-22 14:06
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUT... | [
"django.db.models.TextField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((276, 333), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (307, 333), False, 'from django.db import migrations, models\n'), ((462, 555), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
# --------------------------------------------------------
# Dragon
# Copyright(c) 2017 SeetaTech
# Written by <NAME>
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
try:
import cPickle
except:
... | [
"dragon.core.mpi.Rank",
"pickle.dump",
"dragon.core.mpi.Is_Init",
"dragon.protos.dragon_pb2.DeviceOption",
"dragon.core.utils.MakeDeviceOption",
"os.makedirs",
"os.path.exists",
"dragon.core.scope._DEVICE_SCOPE.split",
"numpy.array",
"dragon.core.mpi.AllowSnapshot",
"os.path.split",
"os.path.j... | [((7676, 7723), 'numpy.array', 'np.array', (['ndarray'], {'dtype': 'auto_dtype', 'copy': '(False)'}), '(ndarray, dtype=auto_dtype, copy=False)\n', (7684, 7723), True, 'import numpy as np\n'), ((10399, 10412), 'dragon.protos.dragon_pb2.GraphDef', 'pb.GraphDef', ([], {}), '()\n', (10410, 10412), True, 'import dragon.prot... |
"""Testing Python with Markdata
An example of using Markdata to extract a code snippet from within a
larger testing context (in this case, pytest).
"""
def test_yaml():
"""An example of testing a Python code example.
"""
from ruamel.yaml import YAML
inp = """\
- &CENTER {x: 1, y: 2}
- &LEFT ... | [
"ruamel.yaml.YAML"
] | [((742, 748), 'ruamel.yaml.YAML', 'YAML', ([], {}), '()\n', (746, 748), False, 'from ruamel.yaml import YAML\n')] |
import functools
import pytest
from prefect import Flow, Task, case, Parameter, resource_manager, task
from prefect.engine.flow_runner import FlowRunner
from prefect.engine.state import Paused, Resume
from prefect.utilities import tasks, edges
from prefect.utilities.tasks import apply_map
from prefect.tasks.control_fl... | [
"prefect.tasks.control_flow.merge",
"prefect.case",
"prefect.utilities.tasks.task",
"prefect.utilities.tasks.apply_map",
"prefect.tasks.core.constants.Constant",
"pytest.mark.parametrize",
"prefect.Task",
"prefect.engine.flow_runner.FlowRunner",
"prefect.utilities.tasks.tags",
"prefect.utilities.t... | [((4463, 4537), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""method"""', "['map', 'set_dependencies', 'add_edge']"], {}), "('method', ['map', 'set_dependencies', 'add_edge'])\n", (4486, 4537), False, 'import pytest\n'), ((5876, 5936), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""api"""', "... |
from django.db import models
from django.utils import timezone
from django.urls import reverse
from accounts.models import Enterprise
from accounts.models import User
# Create your models here.
class Annonce(models.Model):
LANGUAGES_FRENCH = 'FR'
LANGUAGES_ENGLISH = 'EN'
OFFER_CDI = 'CDI'
OFFER_CDD ... | [
"django.db.models.URLField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.utils.timezone.now",
"django.db.models.BooleanField",
"django.db.models.SlugField",
"django.db.models.EmailField",
"django.urls.reverse",
"django.db.models.DateTimeField"
] | [((1579, 1611), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (1595, 1611), False, 'from django.db import models\n'), ((1623, 1694), 'django.db.models.SlugField', 'models.SlugField', ([], {'max_length': '(200)', 'db_index': '(True)', 'unique': '(True)', 'null': '... |
import os
import sqlite3
import pytest
import simpy
from desmod.component import Component
from desmod.queue import Queue
from desmod.pool import Pool
from desmod.simulation import simulate
pytestmark = pytest.mark.usefixtures('cleandir')
@pytest.fixture
def cleandir(tmpdir):
origin = os.getcwd()
tmpdir.ch... | [
"simpy.Resource",
"os.getcwd",
"os.path.isdir",
"os.path.exists",
"simpy.Container",
"desmod.pool.Pool",
"sqlite3.connect",
"pytest.raises",
"os.chdir",
"desmod.queue.Queue",
"os.path.join",
"desmod.simulation.simulate",
"pytest.mark.usefixtures"
] | [((206, 241), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""cleandir"""'], {}), "('cleandir')\n", (229, 241), False, 'import pytest\n'), ((295, 306), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (304, 306), False, 'import os\n'), ((345, 361), 'os.chdir', 'os.chdir', (['origin'], {}), '(origin)\n', (353, 36... |
import os
from django.apps import apps
from django.conf import settings
from django.urls import reverse
from google.api_core.retry import Retry
from google.cloud import tasks_v2
from google.oauth2 import service_account
def get_credentials():
cred = getattr(settings, 'GTASK_CREDENTIAL_FILE', os.environ.get('GOOG... | [
"os.environ.get",
"google.api_core.retry.Retry",
"django.urls.reverse",
"google.cloud.tasks_v2.CloudTasksClient"
] | [((731, 774), 'google.cloud.tasks_v2.CloudTasksClient', 'tasks_v2.CloudTasksClient', ([], {'credentials': 'cred'}), '(credentials=cred)\n', (756, 774), False, 'from google.cloud import tasks_v2\n'), ((1092, 1126), 'google.api_core.retry.Retry', 'Retry', ([], {'deadline': '(10)'}), '(deadline=10, **retry_kwargs)\n', (10... |
import torch
from sha_rnn import DecoderRNN
x = torch.rand(15, 128)
encoder = DecoderRNN(15, 128)
hidden = encoder.init_hidden()
y, hidden = encoder(x, hidden)
print (y.shape)
print (hidden.shape) | [
"sha_rnn.DecoderRNN",
"torch.rand"
] | [((49, 68), 'torch.rand', 'torch.rand', (['(15)', '(128)'], {}), '(15, 128)\n', (59, 68), False, 'import torch\n'), ((79, 98), 'sha_rnn.DecoderRNN', 'DecoderRNN', (['(15)', '(128)'], {}), '(15, 128)\n', (89, 98), False, 'from sha_rnn import DecoderRNN\n')] |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS
Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | [
"django.utils.timezone.localtime",
"datetime.datetime.strptime",
"django.utils.timezone.make_aware"
] | [((1137, 1191), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['date_string', 'format_string'], {}), '(date_string, format_string)\n', (1163, 1191), False, 'import datetime\n'), ((1273, 1308), 'django.utils.timezone.make_aware', 'timezone.make_aware', (['naive_dt', 'zone'], {}), '(naive_dt, zone)\n', (12... |
from blockkit.attributes import TextAttr
from blockkit.generics import *
class MockSlackObject(SlackObject):
block_id = TextAttr()
action_id = TextAttr(required=False)
class TestSlackObject:
def test(self):
obj = MockSlackObject(block_id="1", action_id=None)
assert obj["block_id"] == "1"... | [
"blockkit.attributes.TextAttr"
] | [((126, 136), 'blockkit.attributes.TextAttr', 'TextAttr', ([], {}), '()\n', (134, 136), False, 'from blockkit.attributes import TextAttr\n'), ((153, 177), 'blockkit.attributes.TextAttr', 'TextAttr', ([], {'required': '(False)'}), '(required=False)\n', (161, 177), False, 'from blockkit.attributes import TextAttr\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
import re
class TwissStruct:
'''Structure containing Twiss file information'''
APER_COLUMNS = ['APERTYPE', 'APER_1', 'APER_2', 'APER_3', 'APER_4']
APER_VALUES = ['APER_1', 'APER_2', 'APER_3', 'APER_4']
def __init__(self):
... | [
"re.findall"
] | [((1046, 1086), 're.findall', 're.findall', (['"""(?:")[^"]*(?:")|\\\\S+"""', 'line'], {}), '(\'(?:")[^"]*(?:")|\\\\S+\', line)\n', (1056, 1086), False, 'import re\n')] |
import pandas as pd
import codecs
# function that rescales data
def scaleInRange(x, oldmin, oldmax, newmin, newmax):
# linear scaling (see koeper 2016). (Softmax makes no sense)
return ((newmax - newmin) * (x - oldmin)) / (oldmax - oldmin) + newmin
def load_english(path):
'''
Warriner et al. 2013
... | [
"pandas.read_csv",
"codecs.open",
"pandas.read_excel"
] | [((343, 369), 'pandas.read_csv', 'pd.read_csv', (['path'], {'sep': '""","""'}), "(path, sep=',')\n", (354, 369), True, 'import pandas as pd\n'), ((788, 807), 'pandas.read_excel', 'pd.read_excel', (['path'], {}), '(path)\n', (801, 807), True, 'import pandas as pd\n'), ((1720, 1767), 'codecs.open', 'codecs.open', (['lemm... |
"""
global_config.py
====================================
It stores the global configuration of the files and consists of modules for processing data.
"""
from pathlib import Path
class GeneratorConfig(object):
"""Configuration for Generator
Args:
batch_size (int): int value for batch size
... | [
"pathlib.Path"
] | [((1379, 1389), 'pathlib.Path', 'Path', (['""".."""'], {}), "('..')\n", (1383, 1389), False, 'from pathlib import Path\n')] |
############################################################################################################################
# Enhancements to out-of-the-box python functions to add extra functionality, flexibility, or to enhance code readability
########################################################################... | [
"copy.deepcopy",
"operator.itemgetter"
] | [((767, 780), 'copy.deepcopy', 'deepcopy', (['obj'], {}), '(obj)\n', (775, 780), False, 'from copy import deepcopy\n'), ((1153, 1166), 'operator.itemgetter', 'itemgetter', (['k'], {}), '(k)\n', (1163, 1166), False, 'from operator import itemgetter\n')] |
import json
import os
import copy
from powerdns.interface import PDNSEndpointBase, LOG
from powerdns.models.rrset import RRSet
class PDNSZone(PDNSEndpointBase):
"""Powerdns API Zone Endpoint
.. autoattribute:: details
.. autoattribute:: records
:param PDNSApiClient api_client: Cachet API client inst... | [
"powerdns.models.rrset.RRSet.parse",
"powerdns.interface.LOG.debug",
"copy.copy"
] | [((2651, 2675), 'copy.copy', 'copy.copy', (['self._details'], {}), '(self._details)\n', (2660, 2675), False, 'import copy\n'), ((3820, 3840), 'powerdns.interface.LOG.debug', 'LOG.debug', (['zone_data'], {}), '(zone_data)\n', (3829, 3840), False, 'from powerdns.interface import PDNSEndpointBase, LOG\n'), ((3164, 3187), ... |
from CryptoFactory.CFCryptoX import *
import os
import filecmp
import unittest
import shutil
class TestCrypto(unittest.TestCase):
def test_StringCrypto(self):
original_string = 'this is a secret!!! 这是一个秘密!!!'
my_cipher = StringCrypto('this is password')
encrypt_str = my_cipher.encrypt(orig... | [
"unittest.main",
"shutil.rmtree",
"os.remove",
"filecmp.cmp"
] | [((5064, 5079), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5077, 5079), False, 'import unittest\n'), ((1058, 1094), 'os.remove', 'os.remove', (['"""./testdata/aes_test.png"""'], {}), "('./testdata/aes_test.png')\n", (1067, 1094), False, 'import os\n'), ((1103, 1139), 'os.remove', 'os.remove', (['"""./testdata... |
from fluent.core.window import window
def launch(target: object): # App launching function
window.show() # Showing window
while True:
target.render(xy=(0, 0)) # Rendering generic widget
window.update()
| [
"fluent.core.window.window.update",
"fluent.core.window.window.show"
] | [((98, 111), 'fluent.core.window.window.show', 'window.show', ([], {}), '()\n', (109, 111), False, 'from fluent.core.window import window\n'), ((216, 231), 'fluent.core.window.window.update', 'window.update', ([], {}), '()\n', (229, 231), False, 'from fluent.core.window import window\n')] |
from django.db import models
from django.db.models import QuerySet
from weather.models import city as ci
class city(models.Model):
username=models.CharField(primary_key=True,max_length=40)
city_id=models.ForeignKey(ci,on_delete=models.CASCADE)
class signup():
username : str
city : str
email : str
... | [
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((145, 194), 'django.db.models.CharField', 'models.CharField', ([], {'primary_key': '(True)', 'max_length': '(40)'}), '(primary_key=True, max_length=40)\n', (161, 194), False, 'from django.db import models\n'), ((206, 253), 'django.db.models.ForeignKey', 'models.ForeignKey', (['ci'], {'on_delete': 'models.CASCADE'}), ... |
"""Usage: small_training_set_extractor.py --input_directory=input --output_directory=output
--train_size=2700 --valid_size=150 --test_size=150
small_training_set_extractor.py --help | -help | -h
This file is for extracting a higher loos files calculated usi... | [
"json.dump",
"numpy.load",
"json.load",
"numpy.abs",
"os.makedirs",
"docopt.docopt",
"os.path.isdir",
"pathlib.Path",
"numpy.savez_compressed"
] | [((6828, 6843), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (6834, 6843), False, 'from docopt import docopt\n'), ((6855, 6891), 'pathlib.Path', 'Path', (["arguments['--input_directory']"], {}), "(arguments['--input_directory'])\n", (6859, 6891), False, 'from pathlib import Path\n'), ((6903, 6940), 'pat... |
import click
from lhotse.bin.modes import download, prepare
from lhotse.recipes.aidatatang_200zh import (
download_aidatatang_200zh,
prepare_aidatatang_200zh,
)
from lhotse.utils import Pathlike
__all__ = ["aidatatang_200zh"]
@prepare.command(context_settings=dict(show_default=True))
@click.argument("corpus... | [
"lhotse.recipes.aidatatang_200zh.prepare_aidatatang_200zh",
"lhotse.recipes.aidatatang_200zh.download_aidatatang_200zh",
"click.Path"
] | [((681, 740), 'lhotse.recipes.aidatatang_200zh.prepare_aidatatang_200zh', 'prepare_aidatatang_200zh', (['corpus_dir'], {'output_dir': 'output_dir'}), '(corpus_dir, output_dir=output_dir)\n', (705, 740), False, 'from lhotse.recipes.aidatatang_200zh import download_aidatatang_200zh, prepare_aidatatang_200zh\n'), ((1077, ... |
# Generated by Django 3.0.5 on 2020-04-17 17:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('reportcards', '0011_result_subject'),
]
operations = [
migrations.RemoveField(
model_name='result',
name='subject',
... | [
"django.db.migrations.RemoveField"
] | [((227, 286), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""result"""', 'name': '"""subject"""'}), "(model_name='result', name='subject')\n", (249, 286), False, 'from django.db import migrations\n')] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUME... | [
"ansible.module_utils.ovirt.equal",
"ansible.module_utils.ovirt.create_connection",
"traceback.format_exc",
"ansible.module_utils.ovirt.check_sdk",
"ansible.module_utils.basic.AnsibleModule"
] | [((3989, 4057), 'ansible.module_utils.basic.AnsibleModule', 'AnsibleModule', ([], {'argument_spec': 'argument_spec', 'supports_check_mode': '(True)'}), '(argument_spec=argument_spec, supports_check_mode=True)\n', (4002, 4057), False, 'from ansible.module_utils.basic import AnsibleModule\n'), ((4233, 4250), 'ansible.mod... |
import sys
import cs50
def main():
if len(sys.argv) != 2:
print("missing command-line argument")
exit(0)
if sys.argv[1].isdigit() == False:
print("only digits allowed!")
exit(1)
key = int(sys.argv[1])
#key = sys.argv[1]
#keylen = len(sys.argv[1])
print("plain... | [
"cs50.get_string"
] | [((346, 363), 'cs50.get_string', 'cs50.get_string', ([], {}), '()\n', (361, 363), False, 'import cs50\n')] |
from dffml import Feature, Features
from dffml.noasync import accuracy, predict, train
from dffml_model_scratch.anomalydetection import AnomalyModel
from dffml_model_scratch.anomaly_detection_scorer import (
AnomalyDetectionAccuracy,
)
# Configure the model
model = AnomalyModel(
features=Features(Feature("A"... | [
"dffml_model_scratch.anomaly_detection_scorer.AnomalyDetectionAccuracy",
"dffml.noasync.train",
"dffml.Feature"
] | [((411, 438), 'dffml.noasync.train', 'train', (['model', '"""trainex.csv"""'], {}), "(model, 'trainex.csv')\n", (416, 438), False, 'from dffml.noasync import accuracy, predict, train\n'), ((480, 506), 'dffml_model_scratch.anomaly_detection_scorer.AnomalyDetectionAccuracy', 'AnomalyDetectionAccuracy', ([], {}), '()\n', ... |
#! /usr/bin/env python
"""
Modul zawiera testy klasy MaxHistogramFeature
"""
import unittest
from bitmap.bitmap_grayscale import BitmapGrayscale
from feature.simple_features.max_histogram_feature import MaxHistogramFeature
from tests.bitmap_generator import BitmapGenerator
class TestMaxHistogramFeature(unittest.Te... | [
"tests.bitmap_generator.BitmapGenerator.plain_black",
"tests.bitmap_generator.BitmapGenerator.plain_color",
"feature.simple_features.max_histogram_feature.MaxHistogramFeature"
] | [((435, 456), 'feature.simple_features.max_histogram_feature.MaxHistogramFeature', 'MaxHistogramFeature', ([], {}), '()\n', (454, 456), False, 'from feature.simple_features.max_histogram_feature import MaxHistogramFeature\n'), ((1278, 1324), 'tests.bitmap_generator.BitmapGenerator.plain_color', 'BitmapGenerator.plain_c... |
"""Color edit tool."""
import sublime
import sublime_plugin
from .lib.coloraide import Color
import mdpopups
from . import ch_util as util
from .ch_mixin import _ColorMixin
import copy
from . import ch_tools as tools
DEF_EDIT = """---
markdown_extensions:
- markdown.extensions.attr_list
- markdown.extensions.def_list
... | [
"mdpopups.color_box"
] | [((8368, 8513), 'mdpopups.color_box', 'mdpopups.color_box', (['[preview, preview_alpha]', 'preview_border', 'second_border'], {'border_size': '(2)', 'height': 'height', 'width': 'width', 'check_size': 'check_size'}), '([preview, preview_alpha], preview_border, second_border,\n border_size=2, height=height, width=wid... |
# In the most cases it is enough to train ones with fixed sn and sf (b were assumed to be always fixed)
# and optional S, U depending on the data-set with about 50 to 100 iterations
owd = 'C:/Users/flo9fe/Desktop/GIT_IP_true/python_ip_true'
#owd = '/usr/local/home/GIT_IP_true/python_ip_true'
import os;
os.chdi... | [
"scipy.optimize.minimize",
"numpy.set_printoptions",
"scipy.io.loadmat",
"time.gmtime",
"numpy.zeros",
"scipy.io.savemat",
"numpy.require",
"time.time",
"numpy.hstack",
"DEEPvSSGP_opt_SV2_IP.DEEPvSSGP_opt",
"numpy.array",
"numpy.random.normal",
"numpy.int64",
"os.chdir",
"numpy.prod",
... | [((313, 326), 'os.chdir', 'os.chdir', (['owd'], {}), '(owd)\n', (321, 326), False, 'import os\n'), ((457, 504), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)', 'suppress': '(True)'}), '(precision=2, suppress=True)\n', (476, 504), True, 'import numpy as np\n'), ((592, 608), 'os.chdir', 'os.chd... |
"""
Part of the Core Cog Files, slash.py handles all the new logic for the new slash commands feature.
Since the slash commands feature is so new, some things might not work (especially "this interaction failed"), but that's OK.
I kind of ctrl-c ctrl-v this code, so I might not be that good at making slashes...
"""
fr... | [
"discord.utils.get",
"arrow.get",
"arrow.now",
"discord.ext.commands.check",
"discord.Color.red",
"discord.Color.green",
"discord_slash.cog_ext.cog_slash",
"discord_slash.utils.manage_commands.create_option",
"os.listdir"
] | [((1555, 1580), 'discord.ext.commands.check', 'commands.check', (['predicate'], {}), '(predicate)\n', (1569, 1580), False, 'from discord.ext import commands\n'), ((1668, 1771), 'discord_slash.cog_ext.cog_slash', 'cog_ext.cog_slash', ([], {'name': '"""ping"""', 'description': '"""Checks the bot latency. What else?"""', ... |
# author: <NAME>
# date: 2021-11-25
"""
This script runs preprocessed data through Wilcoxon rank-sum tests
for significance of difference of median substance_use_total
between 'pre' and 'post' datasets.
Usage: stat_tests.py --data_path=<dir> [--output=<file>]
Options:
--data_path=<dir> path to dir in which preproces... | [
"pandas.DataFrame",
"docopt.docopt",
"pandas.read_csv",
"glob.glob",
"scipy.stats.ranksums"
] | [((553, 568), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (559, 568), False, 'from docopt import docopt\n'), ((1213, 1248), 'pandas.read_csv', 'pd.read_csv', (["(data_path + '/' + file)"], {}), "(data_path + '/' + file)\n", (1224, 1248), True, 'import pandas as pd\n'), ((1417, 1461), 'scipy.stats.ranks... |
# third party
import petlib as pl
# syft relative
from ...generate_wrapper import GenerateWrapper
from ...proto.lib.petlib.ecpt_group_pb2 import EcPtGroup as EcPtGroup_PB
def object2proto_group(obj: pl.ec.EcGroup) -> EcPtGroup_PB:
proto = EcPtGroup_PB()
proto.group_nid = obj.nid()
return proto
def prot... | [
"petlib.ec.EcGroup"
] | [((389, 419), 'petlib.ec.EcGroup', 'pl.ec.EcGroup', (['proto.group_nid'], {}), '(proto.group_nid)\n', (402, 419), True, 'import petlib as pl\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.