code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import sys
import time
import uasyncio as asyncio
from ahttpserver import sendfile, Server
app = Server()
@app.route("GET", "/")
async def root(reader, writer, request):
writer.write(b"HTTP/1.1 200 OK\r\n")
writer.write(b"Connection: close\r\n")
writer.write(b"Content-Type: text/html\r\n")
... | [
"uasyncio.new_event_loop",
"sys.print_exception",
"ahttpserver.sendfile",
"uasyncio.get_event_loop",
"time.localtime",
"uasyncio.sleep",
"ahttpserver.Server"
] | [((105, 113), 'ahttpserver.Server', 'Server', ([], {}), '()\n', (111, 113), False, 'from ahttpserver import sendfile, Server\n'), ((1303, 1319), 'time.localtime', 'time.localtime', ([], {}), '()\n', (1317, 1319), False, 'import time\n'), ((2184, 2208), 'uasyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class Unet(nn.Module):
def __init__(self, fc_dim=64, num_downs=5, ngf=64, use_dropout=False):
super(Unet, self).__init__()
# construct unet structure
unet_block = UnetBlock(
ngf * 8, ngf * 8, input_n... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.LeakyReLU",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.nn.Upsample"
] | [((1046, 1063), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['(1)'], {}), '(1)\n', (1060, 1063), True, 'import torch.nn as nn\n'), ((1983, 2006), 'torch.nn.LeakyReLU', 'nn.LeakyReLU', (['(0.2)', '(True)'], {}), '(0.2, True)\n', (1995, 2006), True, 'import torch.nn as nn\n'), ((2027, 2057), 'torch.nn.BatchNorm2d', 'nn.Ba... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import scriptcontext as sc
import compas_rhino
from compas_ags.rhino import SettingsForm
from compas_ags.rhino import FormObject
from compas_ags.rhino import ForceObject
__commandname__ = "AGS_toolbar_displa... | [
"compas_rhino.display_message",
"compas_ags.rhino.SettingsForm.from_scene"
] | [((586, 685), 'compas_ags.rhino.SettingsForm.from_scene', 'SettingsForm.from_scene', (['scene'], {'object_types': '[FormObject, ForceObject]', 'global_settings': "['AGS']"}), "(scene, object_types=[FormObject, ForceObject],\n global_settings=['AGS'])\n", (609, 685), False, 'from compas_ags.rhino import SettingsForm\... |
from typing import (
Any,
cast,
List,
Optional,
Type
)
import lpp.ast as ast
from lpp.builtins import BUILTINS
from lpp.object import(
Boolean,
Builtin,
Environment,
Error,
Function,
Integer,
Null,
Object,
ObjectType,
String,
Return
)
TRUE = Boolean(True... | [
"lpp.object.String",
"lpp.object.Integer",
"lpp.object.Environment",
"lpp.object.Boolean",
"lpp.object.Null",
"lpp.object.Function",
"lpp.object.Return",
"typing.cast"
] | [((308, 321), 'lpp.object.Boolean', 'Boolean', (['(True)'], {}), '(True)\n', (315, 321), False, 'from lpp.object import Boolean, Builtin, Environment, Error, Function, Integer, Null, Object, ObjectType, String, Return\n'), ((330, 344), 'lpp.object.Boolean', 'Boolean', (['(False)'], {}), '(False)\n', (337, 344), False, ... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
# with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accom... | [
"re.escape",
"configparser.ConfigParser",
"pcluster.config.validators.EBS_VOLUME_TYPE_TO_VOLUME_SIZE_BOUNDS.keys",
"pytest.fixture",
"pcluster.config.validators.queue_compute_type_validator",
"pcluster.config.validators.region_validator",
"datetime.datetime",
"pcluster.config.validators.efa_gdr_valida... | [((1665, 1681), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1679, 1681), False, 'import pytest\n'), ((1757, 2976), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""section_dict, expected_message, expected_warning"""', "[({'scheduler': 'sge', 'initial_queue_size': 1, 'max_queue_size': 2,\n 'main... |
import os
from functools import reduce
import boto3
import yaml
from copy import deepcopy
from cryptography.fernet import Fernet
from pycbc import json
from pycbc.utils import AttrDict as d
s3 = boto3.client('s3')
_mapping_tag = yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG
_DEFAULTS = d({
'users': [],
'enc... | [
"boto3.client",
"os.getenv",
"yaml.load",
"copy.deepcopy",
"pycbc.utils.AttrDict",
"cryptography.fernet.Fernet.generate_key"
] | [((198, 216), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (210, 216), False, 'import boto3\n'), ((2208, 2247), 'yaml.load', 'yaml.load', (['data'], {'Loader': 'yaml.FullLoader'}), '(data, Loader=yaml.FullLoader)\n', (2217, 2247), False, 'import yaml\n'), ((1086, 1089), 'pycbc.utils.AttrDict', 'd', (... |
def us_choropleth(t):
import matplotlib.cm
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
from matplotlib.colors import Normalize
import shapefile
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
im... | [
"matplotlib.pyplot.gca",
"matplotlib.pyplot.colorbar",
"matplotlib.collections.PatchCollection",
"collections.Counter",
"numpy.array",
"mpl_toolkits.basemap.Basemap",
"matplotlib.colors.Normalize",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.patches.Polygon",
"matplotlib.pyplot.ge... | [((397, 426), 'matplotlib.pyplot.title', 'plt.title', (['"""NER"""'], {'fontsize': '(12)'}), "('NER', fontsize=12)\n", (406, 426), True, 'import matplotlib.pyplot as plt\n'), ((451, 577), 'mpl_toolkits.basemap.Basemap', 'Basemap', ([], {'resolution': '"""l"""', 'llcrnrlon': '(-128.94)', 'llcrnrlat': '(23.52)', 'urcrnrl... |
import csv
import os
from collections import deque
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
INPUT_PATH = os.path.join(BASE_DIR, 'goods_source.csv')
OUTPUT_PATH = os.path.join(BASE_DIR, 'result.csv')
FILE_ENCODE = 'shift_jis'
INPUT_COLS = ('id', 'goods_name', 'price')
def import_csv():
"""入力データの読み込... | [
"os.path.abspath",
"collections.deque",
"csv.DictReader",
"os.path.join"
] | [((120, 162), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""goods_source.csv"""'], {}), "(BASE_DIR, 'goods_source.csv')\n", (132, 162), False, 'import os\n'), ((177, 213), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""result.csv"""'], {}), "(BASE_DIR, 'result.csv')\n", (189, 213), False, 'import os\n'), ((80, 1... |
import pandas as pd
import numpy as np
import swifter
def money_precision_at_k(y_pred: pd.Series, y_true: pd.Series, item_price, k=5):
y_pred = y_pred.swifter.progress_bar(False).apply(pd.Series)
user_filter = ~(y_true.swifter.progress_bar(False).apply(len) < k)
y_pred = y_pred.loc[user_filter]
y_tru... | [
"numpy.array"
] | [((558, 571), 'numpy.array', 'np.array', (['row'], {}), '(row)\n', (566, 571), True, 'import numpy as np\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from caqe import app
app.run(debug=True, threaded=True) | [
"caqe.app.run"
] | [((68, 102), 'caqe.app.run', 'app.run', ([], {'debug': '(True)', 'threaded': '(True)'}), '(debug=True, threaded=True)\n', (75, 102), False, 'from caqe import app\n')] |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"unittest.main",
"azext_devops.dev.common.format.trim_for_display",
"azext_devops.dev.common.format.date_time_to_only_date"
] | [((1363, 1378), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1376, 1378), False, 'import unittest\n'), ((605, 632), 'azext_devops.dev.common.format.trim_for_display', 'trim_for_display', (['input', '(20)'], {}), '(input, 20)\n', (621, 632), False, 'from azext_devops.dev.common.format import trim_for_display, da... |
import inspect
import numpy as np
class TypeCheck(object):
"""
Decorator that performs a typecheck on the input to a function
"""
def __init__(self, accepted_structures, arg_name):
"""
When initialized, include list of accepted datatypes and the
arg_name to enforce the check on.... | [
"numpy.power",
"numpy.max",
"inspect.getargspec",
"numpy.array",
"numpy.min",
"numpy.vectorize"
] | [((2604, 2633), 'numpy.power', 'np.power', (['array', 'distribution'], {}), '(array, distribution)\n', (2612, 2633), True, 'import numpy as np\n'), ((2753, 2766), 'numpy.max', 'np.max', (['array'], {}), '(array)\n', (2759, 2766), True, 'import numpy as np\n'), ((2768, 2781), 'numpy.min', 'np.min', (['array'], {}), '(ar... |
# -*- coding: utf-8 -*-
import unittest
from openprocurement.api.tests.base import snitch
from openprocurement.api.tests.base import BaseWebTest
from openprocurement.tender.belowthreshold.tests.base import test_lots
from openprocurement.tender.belowthreshold.tests.tender import TenderResourceTestMixin
from openprocur... | [
"unittest.main",
"unittest.TestSuite",
"openprocurement.api.tests.base.snitch",
"unittest.makeSuite"
] | [((1237, 1262), 'openprocurement.api.tests.base.snitch', 'snitch', (['simple_add_tender'], {}), '(simple_add_tender)\n', (1243, 1262), False, 'from openprocurement.api.tests.base import snitch\n'), ((1470, 1491), 'openprocurement.api.tests.base.snitch', 'snitch', (['empty_listing'], {}), '(empty_listing)\n', (1476, 149... |
from __future__ import print_function, division
import os
import numpy as np
import h5py
def dict_2_h5(fname, dic, append=False):
'''Writes a dictionary to a hdf5 file with given filename
It will use lzf compression for all numpy arrays
Args:
fname (str): filename to write to
dic (dic... | [
"os.makedirs",
"os.path.join",
"h5py.File",
"os.path.isdir",
"numpy.loadtxt"
] | [((1075, 1094), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (1088, 1094), False, 'import os\n'), ((3009, 3068), 'os.path.join', 'os.path.join', (['finesse_directory', '"""F_post_equal_weights.dat"""'], {}), "(finesse_directory, 'F_post_equal_weights.dat')\n", (3021, 3068), False, 'import os\n'), ((308... |
from openmdao.main.factory import Factory
from analysis_server import client, proxy, server
class ASFactory(Factory):
"""
Factory for components running under an AnalysisServer.
An instance would typically be passed to
:meth:`openmdao.main.factorymanager.register_class_factory`.
host: string
... | [
"analysis_server.proxy.ComponentProxy",
"analysis_server.client.Client"
] | [((652, 677), 'analysis_server.client.Client', 'client.Client', (['host', 'port'], {}), '(host, port)\n', (665, 677), False, 'from analysis_server import client, proxy, server\n'), ((1313, 1366), 'analysis_server.proxy.ComponentProxy', 'proxy.ComponentProxy', (['typname', 'self._host', 'self._port'], {}), '(typname, se... |
from typing import Tuple, List, Optional
import json
import sys
import os
import shlex
import asyncio
import argparse
import logging
import tempfile
from urllib.parse import urlparse
logger = logging.getLogger(__name__)
def find_sqlmat_json() -> Optional[dict]:
json_path = os.getenv('SQLMAT_JSON_PATH')
if jso... | [
"logging.getLogger",
"os.path.exists",
"shlex.join",
"urllib.parse.urlparse",
"argparse.ArgumentParser",
"os.getenv",
"os.path.join",
"os.getcwd",
"shlex.quote",
"asyncio.create_subprocess_shell",
"tempfile.NamedTemporaryFile",
"json.load",
"asyncio.get_event_loop"
] | [((193, 220), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (210, 220), False, 'import logging\n'), ((280, 309), 'os.getenv', 'os.getenv', (['"""SQLMAT_JSON_PATH"""'], {}), "('SQLMAT_JSON_PATH')\n", (289, 309), False, 'import os\n'), ((1050, 1102), 'argparse.ArgumentParser', 'argparse.Ar... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
year: 2019 - 2021
This script is used to calculate the eddy-induced overturning in CESM2 and NorESM2 (LM and MM) south of 50S
for the CMIP experiments piControl and abrupt-4xCO2 after 150
the average time is 30 years
The result is used in FIGURE 4
"""
... | [
"xarray.open_mfdataset",
"sys.path.insert",
"read_modeldata_cmip6.ecs_models_cmip6",
"read_modeldata_cmip6.Modelinfo",
"dask.diagnostics.ProgressBar",
"CMIP6_SEAICE_UTILS.consistent_naming",
"CMIP6_ATMOS_UTILS.yearly_avg",
"CMIP6_ATMOS_UTILS.fix_time",
"warnings.simplefilter",
"xarray.set_options"... | [((332, 395), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""/scratch/adagj/CMIP6/CLIMSENS/CMIP6_UTILS"""'], {}), "(1, '/scratch/adagj/CMIP6/CLIMSENS/CMIP6_UTILS')\n", (347, 395), False, 'import sys\n'), ((623, 654), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (644, 654... |
##############################################################################
#
# Copyright (c) 2004 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [
"unittest.main",
"unittest.makeSuite"
] | [((2301, 2337), 'unittest.makeSuite', 'unittest.makeSuite', (['CookbookTestCase'], {}), '(CookbookTestCase)\n', (2319, 2337), False, 'import unittest\n'), ((2370, 2409), 'unittest.main', 'unittest.main', ([], {'defaultTest': '"""test_suite"""'}), "(defaultTest='test_suite')\n", (2383, 2409), False, 'import unittest\n')... |
# Generated by Django 2.2 on 2020-11-07 01:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bullet_point', '0005_bulletpoint_created_location'),
]
operations = [
migrations.AddField(
model_name='bulletpoint',
n... | [
"django.db.models.FloatField"
] | [((361, 401), 'django.db.models.FloatField', 'models.FloatField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (378, 401), False, 'from django.db import migrations, models\n')] |
import pkg_resources
from fastapi import FastAPI
from fastapi.openapi.utils import get_openapi
from starlette.responses import RedirectResponse, JSONResponse
from routers import auth, media, video, photo, user, igtv, clip, album, story, hashtag, direct
app = FastAPI()
app.include_router(auth.router)
app.include_route... | [
"starlette.responses.RedirectResponse",
"pkg_resources.require",
"fastapi.FastAPI",
"fastapi.openapi.utils.get_openapi"
] | [((261, 270), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (268, 270), False, 'from fastapi import FastAPI\n'), ((756, 785), 'starlette.responses.RedirectResponse', 'RedirectResponse', ([], {'url': '"""/docs"""'}), "(url='/docs')\n", (772, 785), False, 'from starlette.responses import RedirectResponse, JSONResponse\... |
# Imports
import numpy as np
import pandas as pd
import sys
import tqdm
import warnings
import time
import ternary
from ternary.helpers import simplex_iterator
import multiprocessing as mp
warnings.simplefilter("ignore")
if sys.platform == "darwin":
sys.path.append("/Users/aymericvie/Documents/GitHub/evology/evol... | [
"pandas.DataFrame",
"tqdm.tqdm",
"numpy.array",
"main.main",
"numpy.random.seed",
"multiprocessing.Pool",
"time.time",
"warnings.simplefilter",
"sys.path.append",
"ternary.helpers.simplex_iterator"
] | [((190, 221), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (211, 221), False, 'import warnings\n'), ((529, 540), 'time.time', 'time.time', ([], {}), '()\n', (538, 540), False, 'import time\n'), ((256, 330), 'sys.path.append', 'sys.path.append', (['"""/Users/aymericvie/Docume... |
print("@"*30)
print("Alistamento - Serviço Militar")
print("@"*30)
from datetime import date
ano_nasc = int(input("Digite seu ano de nascimento: "))
ano_atual = date.today().year
idade = ano_atual - ano_nasc
print(f"Quem nasceu em {ano_nasc} tem {idade} anos em {ano_atual}")
if idade == 18:
print("É a hora de se... | [
"datetime.date.today"
] | [((163, 175), 'datetime.date.today', 'date.today', ([], {}), '()\n', (173, 175), False, 'from datetime import date\n')] |
import numpy as np
import requests
from django.db.models import Q
from api.models import Photo, User
from api.util import logger
from ownphotos.settings import IMAGE_SIMILARITY_SERVER
def search_similar_embedding(user, emb, result_count=100, threshold=27):
if type(user) == int:
user_id = user
else:
... | [
"numpy.array",
"django.db.models.Q",
"requests.post"
] | [((368, 399), 'numpy.array', 'np.array', (['emb'], {'dtype': 'np.float32'}), '(emb, dtype=np.float32)\n', (376, 399), True, 'import numpy as np\n'), ((575, 642), 'requests.post', 'requests.post', (["(IMAGE_SIMILARITY_SERVER + '/search/')"], {'json': 'post_data'}), "(IMAGE_SIMILARITY_SERVER + '/search/', json=post_data)... |
import sbol2
import pandas as pd
import os
import logging
from openpyxl import load_workbook
from openpyxl.worksheet.table import Table, TableStyleInfo
from openpyxl.utils.dataframe import dataframe_to_rows
from openpyxl.styles import Font, PatternFill, Border, Side
from requests_html import HTMLSession
#wasderivedfro... | [
"sbol2.setHomespace",
"openpyxl.worksheet.table.TableStyleInfo",
"openpyxl.styles.Border",
"openpyxl.load_workbook",
"openpyxl.utils.dataframe.dataframe_to_rows",
"os.path.join",
"openpyxl.styles.Font",
"pandas.DataFrame.from_dict",
"logging.warning",
"os.path.dirname",
"openpyxl.styles.Side",
... | [((731, 756), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (746, 756), False, 'import os\n'), ((778, 834), 'os.path.join', 'os.path.join', (['self.file_location_path', '"""ontologies.xlsx"""'], {}), "(self.file_location_path, 'ontologies.xlsx')\n", (790, 834), False, 'import os\n'), ((866, ... |
#
# Copyright 2021 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
#
import json
import os
import time
from collections import namedtuple
import requests
from eth_utils import remove_0x_prefix
from ocean_lib.data_provider.data_service_provider import DataServiceProvider
from ocean_lib.enforce_typing_sh... | [
"collections.namedtuple",
"ocean_lib.data_provider.data_service_provider.DataServiceProvider.write_file",
"ocean_lib.ocean.util.from_base_18",
"ocean_lib.web3_internal.web3_provider.Web3Provider.get_web3",
"os.path.join",
"time.sleep",
"ocean_lib.web3_internal.event_filter.EventFilter",
"web3.Web3.sha... | [((884, 998), 'collections.namedtuple', 'namedtuple', (['"""OrderValues"""', "('consumer', 'amount', 'serviceId', 'startedAt', 'marketFeeCollector',\n 'marketFee')"], {}), "('OrderValues', ('consumer', 'amount', 'serviceId', 'startedAt',\n 'marketFeeCollector', 'marketFee'))\n", (894, 998), False, 'from collectio... |
""" Linear solvers that are used to solve for the gradient of an OpenMDAO System.
(Not to be confused with the OpenMDAO Solver classes.)
"""
# pylint: disable=E0611, F0401
import numpy as np
from scipy.sparse.linalg import gmres, LinearOperator
from openmdao.main.mpiwrap import MPI
from openmdao.util.graph import fix... | [
"scipy.sparse.linalg.LinearOperator",
"scipy.sparse.linalg.gmres",
"petsc4py.PETSc.KSP",
"petsc4py.PETSc.Vec",
"petsc4py.PETSc.Mat",
"numpy.sum",
"numpy.zeros",
"openmdao.util.graph.fix_single_tuple",
"openmdao.util.log.logger.error",
"numpy.linalg.norm"
] | [((1524, 1543), 'numpy.zeros', 'np.zeros', (['(n_edge,)'], {}), '((n_edge,))\n', (1532, 1543), True, 'import numpy as np\n'), ((1570, 1589), 'numpy.zeros', 'np.zeros', (['(n_edge,)'], {}), '((n_edge,))\n', (1578, 1589), True, 'import numpy as np\n'), ((1608, 1671), 'scipy.sparse.linalg.LinearOperator', 'LinearOperator'... |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, unicode_literals, print_function)
__all__ = ['MultiLayerPerceptronBackend']
import os
import sys
import math
import time
import types
import logging
import itertools
log = logging.getLogger('sknn')
import numpy
import theano
import sklearn.... | [
"logging.getLogger",
"sys.stdout.flush",
"theano.tensor.exp",
"theano.function",
"theano.tensor.matrix",
"theano.tensor.vector",
"sys.stdout.write",
"numpy.zeros",
"theano.tensor.scalar",
"theano.tensor.tensor4",
"numpy.transpose",
"numpy.arange",
"numpy.random.shuffle"
] | [((250, 275), 'logging.getLogger', 'logging.getLogger', (['"""sknn"""'], {}), "('sknn')\n", (267, 275), False, 'import logging\n'), ((3608, 3772), 'theano.function', 'theano.function', (['[self.data_input, self.data_output, self.data_mask]', 'cost'], {'updates': 'self._learning_rule', 'on_unused_input': '"""ignore"""',... |
import django_filters
from django.forms import TextInput
from src.accounts.models import User
from src.application.models import Quiz, StudentGrade
class UserFilter(django_filters.FilterSet):
username = django_filters.CharFilter(widget=TextInput(attrs={'placeholder': 'username'}), lookup_expr='icontains')
fi... | [
"django.forms.TextInput"
] | [((243, 287), 'django.forms.TextInput', 'TextInput', ([], {'attrs': "{'placeholder': 'username'}"}), "(attrs={'placeholder': 'username'})\n", (252, 287), False, 'from django.forms import TextInput\n'), ((364, 410), 'django.forms.TextInput', 'TextInput', ([], {'attrs': "{'placeholder': 'first name'}"}), "(attrs={'placeh... |
# Made by Kerberos
# this script is part of the Official L2J Datapack Project.
# Visit http://www.l2jdp.com/forum/ for more details.
import sys
from com.l2jserver.gameserver.instancemanager import QuestManager
from com.l2jserver.gameserver.model.quest import State
from com.l2jserver.gameserver.model.quest import QuestS... | [
"com.l2jserver.gameserver.instancemanager.QuestManager.getInstance",
"com.l2jserver.gameserver.model.quest.jython.QuestJython.__init__"
] | [((513, 551), 'com.l2jserver.gameserver.model.quest.jython.QuestJython.__init__', 'JQuest.__init__', (['self', 'id', 'name', 'descr'], {}), '(self, id, name, descr)\n', (528, 551), True, 'from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest\n'), ((618, 644), 'com.l2jserver.gameserver.instancema... |
# Copyright 2018 The AI Safety Gridworlds 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 b... | [
"numpy.where",
"absl.flags.DEFINE_integer",
"absl.app.run",
"absl.flags.DEFINE_boolean",
"numpy.array",
"ai_safety_gridworlds.environments.shared.safety_game.add_hidden_reward",
"ai_safety_gridworlds.environments.shared.safety_game.terminate_episode",
"numpy.sum",
"pycolab.rendering.ObservationChara... | [((1882, 1943), 'absl.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""level"""', '(0)', '"""Which game level to play."""'], {}), "('level', 0, 'Which game level to play.')\n", (1902, 1943), False, 'from absl import flags\n'), ((1946, 2035), 'absl.flags.DEFINE_boolean', 'flags.DEFINE_boolean', (['"""noops"""', '(Fa... |
"""
modeling
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import shutil
import numpy as np
import tensorflow as tf
from tensorflow.contrib import rnn
from tensorflow.contrib import layers
from utils_cnn import Norm
class C_MODE... | [
"tensorflow.unstack",
"tensorflow.contrib.layers.flatten",
"tensorflow.transpose",
"tensorflow.gradients",
"tensorflow.get_variable_scope",
"tensorflow.zeros_initializer",
"tensorflow.reduce_mean",
"utils_cnn.Norm",
"tensorflow.placeholder",
"tensorflow.maximum",
"tensorflow.square",
"tensorfl... | [((1065, 1071), 'utils_cnn.Norm', 'Norm', ([], {}), '()\n', (1069, 1071), False, 'from utils_cnn import Norm\n'), ((1613, 1660), 'tensorflow.train.get_or_create_global_step', 'tf.train.get_or_create_global_step', ([], {'graph': 'graph'}), '(graph=graph)\n', (1647, 1660), True, 'import tensorflow as tf\n'), ((1730, 1883... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2021 <NAME>.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
from django.conf import settings
from django.test import TestCase
from django.urls import reverse
from TestHelpers.e2ehelpers import E2EHelpers
# updaten met dit com... | [
"django.urls.reverse"
] | [((3072, 3094), 'django.urls.reverse', 'reverse', (['"""admin:login"""'], {}), "('admin:login')\n", (3079, 3094), False, 'from django.urls import reverse\n'), ((5131, 5154), 'django.urls.reverse', 'reverse', (['"""admin:logout"""'], {}), "('admin:logout')\n", (5138, 5154), False, 'from django.urls import reverse\n'), (... |
import FWCore.ParameterSet.Config as cms
from L1Trigger.TrackTrigger.ProducerSetup_cff import TrackTriggerSetup
from L1Trigger.TrackerTFP.Producer_cfi import TrackerTFPProducer_params
from L1Trigger.TrackerTFP.ProducerES_cff import TrackTriggerDataFormats
from L1Trigger.TrackerTFP.ProducerLayerEncoding_cff import Trac... | [
"FWCore.ParameterSet.Config.EDProducer"
] | [((646, 723), 'FWCore.ParameterSet.Config.EDProducer', 'cms.EDProducer', (['"""trklet::ProducerKFin"""', 'TrackFindingTrackletProducerKF_params'], {}), "('trklet::ProducerKFin', TrackFindingTrackletProducerKF_params)\n", (660, 723), True, 'import FWCore.ParameterSet.Config as cms\n'), ((759, 838), 'FWCore.ParameterSet.... |
"""A python library for intuitively creating CUI/TUI interfaces with pre-built widgets.
"""
#
# Author: <NAME>
# Created: 12-Aug-2019
# Docs: https://jwlodek.github.io/py_cui-docs
# License: BSD-3-Clause (New/Revised)
#
# Some python core library imports
import sys
import os
import time
import copy
import shu... | [
"py_cui.keys.get_char_from_ascii",
"curses.start_color",
"curses.init_color",
"curses.endwin",
"py_cui.popups.LoadingBarPopup",
"time.sleep",
"py_cui.controls.slider.SliderWidget",
"py_cui.colors._COLOR_MAP.keys",
"py_cui.widgets.Button",
"curses.getmouse",
"curses.mousemask",
"os.environ.setd... | [((3432, 3471), 'os.environ.setdefault', 'os.environ.setdefault', (['"""ESCDELAY"""', '"""25"""'], {}), "('ESCDELAY', '25')\n", (3453, 3471), False, 'import os\n'), ((4229, 4284), 'py_cui.statusbar.StatusBar', 'py_cui.statusbar.StatusBar', (['self._title', 'BLACK_ON_WHITE'], {}), '(self._title, BLACK_ON_WHITE)\n', (425... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 3
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class AuthAccessAccessItemFile(object):... | [
"six.iteritems"
] | [((4307, 4340), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (4320, 4340), False, 'import six\n')] |
import sys
from sqlalchemy.exc import DatabaseError
from . import cli
from .configuration import settings, init as init_config
from .observer import HelpdeskObserver, MaximumClientsReached
from .models import init as init_models, metadata, engine, check_db
from .smtp import SMTPConfigurationError
__version__ = '0.... | [
"sys.exit"
] | [((972, 983), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (980, 983), False, 'import sys\n'), ((638, 650), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-1)\n', (646, 650), False, 'import sys\n'), ((857, 869), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-1)\n', (865, 869), False, 'import sys\n')] |
#!/usr/bin/env python
from app import app
app.run(debug = True)
| [
"app.app.run"
] | [((43, 62), 'app.app.run', 'app.run', ([], {'debug': '(True)'}), '(debug=True)\n', (50, 62), False, 'from app import app\n')] |
import sys, yaml, test_appliance
def main(args=None):
collections = []
import test_yaml
collections.append(test_yaml)
if yaml.__with_libyaml__:
import test_yaml_ext
collections.append(test_yaml_ext)
return test_appliance.run(collections, args)
if __name__ == '__main__':
main()... | [
"test_appliance.run"
] | [((244, 281), 'test_appliance.run', 'test_appliance.run', (['collections', 'args'], {}), '(collections, args)\n', (262, 281), False, 'import sys, yaml, test_appliance\n')] |
import threading
from queue import Queue, Empty
from time import sleep
from libAnt.drivers.driver import Driver
from libAnt.message import *
class Network:
def __init__(self, key: bytes = b'\x00' * 8, name: str = None):
self.key = key
self.name = name
self.number = 0
def __str__(self... | [
"threading.Event",
"queue.Queue",
"time.sleep"
] | [((518, 535), 'threading.Event', 'threading.Event', ([], {}), '()\n', (533, 535), False, 'import threading\n'), ((2821, 2828), 'queue.Queue', 'Queue', ([], {}), '()\n', (2826, 2828), False, 'from queue import Queue, Empty\n'), ((2910, 2917), 'queue.Queue', 'Queue', ([], {}), '()\n', (2915, 2917), False, 'from queue imp... |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 30 12:17:04 2021
@author: Oli
"""
import pytest
import pandas as pd
import numpy as np
import netCDF4 as nc
import os
from copy import deepcopy
os.chdir(os.path.dirname(os.path.realpath(__file__)))
wd = os.getcwd().replace('\\', '/')
exec(open("test_set... | [
"model_interface.wham.WHAM",
"os.getcwd",
"os.chdir",
"os.path.realpath",
"numpy.nanmean",
"numpy.nanquantile",
"copy.deepcopy",
"numpy.nansum"
] | [((339, 378), 'os.chdir', 'os.chdir', (["(wd[0:-6] + '/src/data_import')"], {}), "(wd[0:-6] + '/src/data_import')\n", (347, 378), False, 'import os\n'), ((3057, 3073), 'model_interface.wham.WHAM', 'WHAM', (['parameters'], {}), '(parameters)\n', (3061, 3073), False, 'from model_interface.wham import WHAM\n'), ((3136, 31... |
import datetime
from django.db import transaction
def compute_diff(obj1, obj2):
"""
Given two objects compute a list of differences.
Each diff dict has the following keys:
field - name of the field
new - the new value for the field
one - value of the field in o... | [
"datetime.datetime.utcnow"
] | [((2984, 3010), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (3008, 3010), False, 'import datetime\n')] |
from __future__ import absolute_import
from django.contrib import admin
from .models import Deposit, Withdrawal, Support
from .forms import DepositForm, WithdrawalForm
# Register your models here.
@admin.register(Deposit)
class DepositAdmin(admin.ModelAdmin):
# form = DepositForm
list_display = ["__str__", "... | [
"django.contrib.admin.register",
"django.contrib.admin.site.register"
] | [((201, 224), 'django.contrib.admin.register', 'admin.register', (['Deposit'], {}), '(Deposit)\n', (215, 224), False, 'from django.contrib import admin\n'), ((505, 531), 'django.contrib.admin.register', 'admin.register', (['Withdrawal'], {}), '(Withdrawal)\n', (519, 531), False, 'from django.contrib import admin\n'), (... |
import os
DEBUG = True
DATABASES = {
'default':
{
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/tmp/piston.db'
}
}
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = '/tmp/piston.db'
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessi... | [
"os.path.dirname"
] | [((467, 492), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (482, 492), False, 'import os\n')] |
import unittest
import shutil
from rdyn.alg.RDyn_v2 import RDynV2
class RDynTestCase(unittest.TestCase):
def test_rdyn_simplified(self):
print("1")
rdb = RDynV2(size=500, iterations=100)
rdb.execute(simplified=True)
print("2")
rdb = RDynV2(size=500, iterations=100, max_ev... | [
"unittest.main",
"rdyn.alg.RDyn_v2.RDynV2",
"shutil.rmtree"
] | [((609, 624), 'unittest.main', 'unittest.main', ([], {}), '()\n', (622, 624), False, 'import unittest\n'), ((178, 210), 'rdyn.alg.RDyn_v2.RDynV2', 'RDynV2', ([], {'size': '(500)', 'iterations': '(100)'}), '(size=500, iterations=100)\n', (184, 210), False, 'from rdyn.alg.RDyn_v2 import RDynV2\n'), ((281, 325), 'rdyn.alg... |
""""""
# Standard library modules.
import abc
# Third party modules.
from django.core.mail import send_mail
from django.template import Engine, Context
# Local modules.
from .models import RunState
# Globals and constants variables.
class Notification(metaclass=abc.ABCMeta):
@classmethod
def notify(self, ... | [
"django.core.mail.send_mail",
"django.template.Engine.get_default",
"django.template.Context"
] | [((856, 876), 'django.template.Engine.get_default', 'Engine.get_default', ([], {}), '()\n', (874, 876), False, 'from django.template import Engine, Context\n'), ((974, 1001), 'django.template.Context', 'Context', (["{'jobrun': jobrun}"], {}), "({'jobrun': jobrun})\n", (981, 1001), False, 'from django.template import En... |
# Copyright 2019 The FastEstimator 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 appl... | [
"tensorflow.keras.datasets.cifar10.load_data",
"fastestimator.dataset.numpy_dataset.NumpyDataset"
] | [((1356, 1393), 'tensorflow.keras.datasets.cifar10.load_data', 'tf.keras.datasets.cifar10.load_data', ([], {}), '()\n', (1391, 1393), True, 'import tensorflow as tf\n'), ((1411, 1465), 'fastestimator.dataset.numpy_dataset.NumpyDataset', 'NumpyDataset', (['{image_key: x_train, label_key: y_train}'], {}), '({image_key: x... |
from setuptools import setup
import os
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
#NEWS = open(os.path.join(here, 'NEWS.txt')).read()
rootdir = os.path.dirname(os.path.abspath(__file__))
exec(open(rootdir + '/cerridwen/version.py').read())
version = __VERS... | [
"os.path.abspath",
"os.path.dirname",
"setuptools.setup",
"os.path.join"
] | [((327, 1341), 'setuptools.setup', 'setup', ([], {'name': '"""cerridwen"""', 'version': 'version', 'description': '"""Accurate solar system data for everyone"""', 'long_description': 'README', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""http://cerridwen.bluemagician.vc/"""', 'license': '"""MIT... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-08-19 17:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('heroquest', '0001_initial'),
]
operations = [
migrations.RemoveField(
... | [
"django.db.migrations.RemoveField",
"django.db.models.ManyToManyField"
] | [((290, 347), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""player"""', 'name': '"""armor"""'}), "(model_name='player', name='armor')\n", (312, 347), False, 'from django.db import migrations, models\n'), ((492, 585), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (... |
# -*- coding: utf-8 -*-
# Code will only work with Django >= 1.5. See tests/config.py
import re
from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.core import validators
from django.contrib.auth.models import BaseUserManager
from oscar.apps.customer.abstract_models impor... | [
"django.utils.translation.ugettext_lazy",
"re.compile"
] | [((1208, 1221), 'django.utils.translation.ugettext_lazy', '_', (['"""username"""'], {}), "('username')\n", (1209, 1221), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((1556, 1576), 'django.utils.translation.ugettext_lazy', '_', (['"""Nobody needs me"""'], {}), "('Nobody needs me')\n", (1557, 1576... |
import pytest
import asyncio
from system.utils import *
from random import randrange as rr
import hashlib
import time
from datetime import datetime, timedelta, timezone
from indy import payment
import logging
logger = logging.getLogger(__name__)
@pytest.mark.usefixtures('docker_setup_and_teardown')
class TestAuthMa... | [
"logging.getLogger",
"hashlib.sha256",
"random.randrange",
"pytest.mark.skip",
"datetime.timedelta",
"pytest.mark.parametrize",
"datetime.datetime.now",
"pytest.mark.usefixtures",
"indy.payment.parse_get_payment_sources_response",
"asyncio.sleep",
"indy.payment.build_get_payment_sources_request"... | [((220, 247), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (237, 247), False, 'import logging\n'), ((251, 303), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""docker_setup_and_teardown"""'], {}), "('docker_setup_and_teardown')\n", (274, 303), False, 'import pytest\n'), ((33... |
import libhustpass.sbDes as sbDes
import libhustpass.captcha as captcha
import requests
import re
import random
def toWideChar(data):
data_bytes = bytes(data, encoding="utf-8")
ret = []
for i in data_bytes:
ret.extend([0, i])
while len(ret) % 8 != 0:
ret.append(0)
return ret
def En... | [
"requests.session",
"libhustpass.sbDes.des",
"libhustpass.captcha.deCaptcha",
"random.random",
"re.search"
] | [((1293, 1311), 'requests.session', 'requests.session', ([], {}), '()\n', (1309, 1311), False, 'import requests\n'), ((1758, 1796), 'libhustpass.captcha.deCaptcha', 'captcha.deCaptcha', (['captcha_content.raw'], {}), '(captcha_content.raw)\n', (1775, 1796), True, 'import libhustpass.captcha as captcha\n'), ((704, 745),... |
import cv2 as cv
import numpy as np
def areaFinder(contours):
areas = []
for c in contours:
a =cv.contourArea(c)
areas.append(a)
return areas
def sortedContoursByArea(img, larger_to_smaller=True):
edges_img = cv.Canny(img, 100, 150)
contours , h = cv.findContours(edges_img, cv.RETR_... | [
"cv2.drawContours",
"cv2.imshow",
"cv2.contourArea",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.findContours",
"cv2.Canny",
"cv2.imread"
] | [((474, 512), 'cv2.imread', 'cv.imread', (['"""./Images/sample-image.png"""'], {}), "('./Images/sample-image.png')\n", (483, 512), True, 'import cv2 as cv\n'), ((757, 779), 'cv2.destroyAllWindows', 'cv.destroyAllWindows', ([], {}), '()\n', (777, 779), True, 'import cv2 as cv\n'), ((242, 265), 'cv2.Canny', 'cv.Canny', (... |
from mung.torch_ext.eval import Loss
from ltprg.model.seq import DataParameter, SequenceModelNoInput, SequenceModelInputToHidden, SequenceModelAttendedInput
from ltprg.model.seq import VariableLengthNLLLoss
# Expects config of the form:
# {
# data_parameter : {
# seq : [SEQUENCE PARAMETER NAME]
# inp... | [
"mung.torch_ext.eval.Loss",
"ltprg.model.seq.SequenceModelAttendedInput",
"ltprg.model.seq.VariableLengthNLLLoss",
"ltprg.model.seq.SequenceModelInputToHidden",
"ltprg.model.seq.SequenceModelNoInput",
"ltprg.model.seq.DataParameter.make"
] | [((1060, 1106), 'ltprg.model.seq.DataParameter.make', 'DataParameter.make', ([], {}), "(**config['data_parameter'])\n", (1078, 1106), False, 'from ltprg.model.seq import DataParameter, SequenceModelNoInput, SequenceModelInputToHidden, SequenceModelAttendedInput\n'), ((3436, 3482), 'ltprg.model.seq.DataParameter.make', ... |
from shutil import move
import piexif
from PIL import Image
def delete_metadata(full_path_to_img):
"""
This function used for remove metadata only from documents, if you send image 'as image' Telegram automatically
removes all metadata at sending. This function removes all metadata via 'piexif' lib, save... | [
"PIL.Image.open",
"piexif.remove",
"shutil.move"
] | [((493, 543), 'piexif.remove', 'piexif.remove', (['full_path_to_img', '"""clean_image.jpg"""'], {}), "(full_path_to_img, 'clean_image.jpg')\n", (506, 543), False, 'import piexif\n'), ((548, 600), 'shutil.move', 'move', (['"""clean_image.jpg"""', '"""documents/clean_image.jpg"""'], {}), "('clean_image.jpg', 'documents/c... |
#py_unit_2.py
import unittest
class FirstTest(unittest.TestCase):
def setUp(self):
"setUp() runs before every test"
self.msg="Sorry, Charlie, but {} is not the same as {}."
def tearDown(self):
"tearDown runs after every test"
pass
def test_me(self):
"this test should pass"
first=1
second=2
self.asse... | [
"unittest.main"
] | [((750, 765), 'unittest.main', 'unittest.main', ([], {}), '()\n', (763, 765), False, 'import unittest\n')] |
from sys import exit
# ------------------------------------------------------------------------------
global dev_name
global game_title
dev_name = "" # enter your name in the quotes!
game_title = "" # enter the game title in the quotes!
# ------------------------------------------------------------------------------
... | [
"sys.exit"
] | [((1008, 1015), 'sys.exit', 'exit', (['(0)'], {}), '(0)\n', (1012, 1015), False, 'from sys import exit\n')] |
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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 a... | [
"os.environ.get",
"asyncio.sleep",
"pytest.raises"
] | [((2212, 2261), 'os.environ.get', 'os.environ.get', (['"""POOL_START_METHOD"""', '"""forkserver"""'], {}), "('POOL_START_METHOD', 'forkserver')\n", (2226, 2261), False, 'import os\n'), ((4441, 4476), 'pytest.raises', 'pytest.raises', (['httpclient.HTTPError'], {}), '(httpclient.HTTPError)\n', (4454, 4476), False, 'impo... |
"""
例子为MNIST,对手写图片进行分类。
神经网络hello world。
"""
import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
# 封装网络用到的API
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.... | [
"tensorflow.nn.conv2d",
"tensorflow.nn.max_pool",
"tensorflow.InteractiveSession",
"tensorflow.initialize_all_variables",
"tensorflow.Variable",
"tensorflow.reduce_sum",
"tensorflow.placeholder",
"tensorflow.examples.tutorials.mnist.input_data.read_data_sets",
"tensorflow.argmax",
"tensorflow.cons... | [((155, 208), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""MNIST_data"""'], {'one_hot': '(True)'}), "('MNIST_data', one_hot=True)\n", (180, 208), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((819, 842), 'tensorflow.InteractiveSession', '... |
import pbge
from game.content.plotutility import LMSkillsSelfIntro
from game.content import backstory
from pbge.plots import Plot
from pbge.dialogue import Offer, ContextTag
from game.ghdialogue import context
import gears
import game.content.gharchitecture
import game.content.ghterrain
import random
from game import m... | [
"random.choice",
"game.content.plotutility.LMSkillsSelfIntro",
"gears.color.random_mecha_colors",
"gears.relationships.Relationship",
"pbge.dialogue.ContextTag",
"random.randint"
] | [((4839, 4859), 'random.randint', 'random.randint', (['(1)', '(4)'], {}), '(1, 4)\n', (4853, 4859), False, 'import random\n'), ((8555, 8597), 'random.choice', 'random.choice', (['gears.personality.MUTATIONS'], {}), '(gears.personality.MUTATIONS)\n', (8568, 8597), False, 'import random\n'), ((11591, 11662), 'gears.relat... |
#!/usr/bin/env python
import websocket
import time
try:
import thread
except ImportError:
import _thread as thread
runs = 100
def on_message(ws, message):
print(message)
def on_error(ws, error):
print(error)
def on_close(ws):
print("### closed ###")
def on_open(ws):
... | [
"websocket.enableTrace",
"websocket.WebSocketApp",
"time.sleep",
"_thread.start_new_thread"
] | [((513, 545), '_thread.start_new_thread', 'thread.start_new_thread', (['run', '()'], {}), '(run, ())\n', (536, 545), True, 'import _thread as thread\n'), ((585, 612), 'websocket.enableTrace', 'websocket.enableTrace', (['(True)'], {}), '(True)\n', (606, 612), False, 'import websocket\n'), ((658, 750), 'websocket.WebSock... |
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
import seaborn as sns
from matplotlib import rcParams
import statsmodels.api as sm
from statsmodels.formula.api import ols
df = pd.read_csv('kc_house_data.csv')
# print(df.head())
# print(df.isnull().any())
# print(df.d... | [
"seaborn.jointplot",
"pandas.read_csv",
"matplotlib.pyplot.show"
] | [((228, 260), 'pandas.read_csv', 'pd.read_csv', (['"""kc_house_data.csv"""'], {}), "('kc_house_data.csv')\n", (239, 260), True, 'import pandas as pd\n'), ((836, 924), 'seaborn.jointplot', 'sns.jointplot', ([], {'x': '"""sqft_living"""', 'y': '"""price"""', 'data': 'df', 'kind': '"""reg"""', 'fit_reg': '(True)', 'size':... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 14 10:37:04 2021
@author: <NAME>
"""
#calculates trajectory of small mass positioned close to L4 Lagrange point
#creates gif as output
import math
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation, PillowWriter
Distan... | [
"matplotlib.pyplot.plot",
"math.sqrt",
"math.cos",
"numpy.linspace",
"numpy.meshgrid",
"matplotlib.animation.PillowWriter",
"numpy.vectorize",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((495, 528), 'math.sqrt', 'math.sqrt', (['(G * (M1 + M2) / a ** 3)'], {}), '(G * (M1 + M2) / a ** 3)\n', (504, 528), False, 'import math\n'), ((1949, 1966), 'numpy.vectorize', 'np.vectorize', (['pot'], {}), '(pot)\n', (1961, 1966), True, 'import numpy as np\n'), ((2170, 2195), 'numpy.linspace', 'np.linspace', (['(0)',... |
#!/bin/env python3
from transformers import TFBertForTokenClassification
from data_preparation.data_preparation_pos import MBERTTokenizer as MBERT_Tokenizer_pos
import sys
if __name__ == "__main__":
if len(sys.argv) > 1:
modelname = sys.argv[1]
else:
modelname = "ltgoslo/norbert"
model = T... | [
"data_preparation.data_preparation_pos.MBERTTokenizer.from_pretrained",
"transformers.TFBertForTokenClassification.from_pretrained"
] | [((319, 388), 'transformers.TFBertForTokenClassification.from_pretrained', 'TFBertForTokenClassification.from_pretrained', (['modelname'], {'from_pt': '(True)'}), '(modelname, from_pt=True)\n', (363, 388), False, 'from transformers import TFBertForTokenClassification\n'), ((405, 472), 'data_preparation.data_preparation... |
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
def seasonality_model(thetas, t, device):
p = thetas.size()[-1]
assert p < 10, 'thetas_dim is too big.'
p1, p2 = (p // 2, p // 2) if p % 2 == 0 else (p // 2, p // 2 + 1)
s1 = torch.tensor([np.cos(2 * np.pi * i * ... | [
"numpy.linspace",
"numpy.cos",
"torch.nn.Linear",
"numpy.sin",
"torch.nn.ParameterList",
"torch.cat"
] | [((447, 466), 'torch.cat', 'torch.cat', (['[s1, s2]'], {}), '([s1, s2])\n', (456, 466), False, 'import torch\n'), ((768, 853), 'numpy.linspace', 'np.linspace', (['(-backcast_length)', 'forecast_length', '(backcast_length + forecast_length)'], {}), '(-backcast_length, forecast_length, backcast_length +\n forecast_len... |
from math import exp
from random import seed
from random import random
def initialize_network(n_inputs, n_hidden, n_outputs):
network = list()
hidden_layer = [{'weights':[random() for i in range(n_inputs + 1)]} for i in range(n_hidden)]
network.append(hidden_layer)
output_layer = [{'weights':[random() for i in r... | [
"random.random",
"math.exp",
"random.seed"
] | [((2380, 2387), 'random.seed', 'seed', (['(1)'], {}), '(1)\n', (2384, 2387), False, 'from random import seed\n'), ((615, 631), 'math.exp', 'exp', (['(-activation)'], {}), '(-activation)\n', (618, 631), False, 'from math import exp\n'), ((176, 184), 'random.random', 'random', ([], {}), '()\n', (182, 184), False, 'from r... |
"""\
Copyright (c) 2009 <NAME> <<EMAIL>>
This file is part of hypercouch which is released uner the MIT license.
"""
import time
import unittest
import couchdb
COUCHURI = "http://127.0.0.1:5984/"
TESTDB = "hyper_tests"
class MultiDesignTest(unittest.TestCase):
def setUp(self):
self.srv = couchdb.Server(CO... | [
"time.sleep",
"couchdb.Server"
] | [((303, 327), 'couchdb.Server', 'couchdb.Server', (['COUCHURI'], {}), '(COUCHURI)\n', (317, 327), False, 'import couchdb\n'), ((1258, 1273), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (1268, 1273), False, 'import time\n')] |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.models import OrganizationMember, OrganizationMemberTeam, Team
from sentry.testutils import TestCase, PermissionTestCase
class CreateTeamPermissionTest(PermissionTestCase):
def setUp(self):
super(CreateTeamPe... | [
"sentry.models.Team.objects.filter",
"sentry.models.Team.objects.get",
"django.core.urlresolvers.reverse",
"sentry.models.OrganizationMemberTeam.objects.filter",
"sentry.models.OrganizationMember.objects.get"
] | [((368, 428), 'django.core.urlresolvers.reverse', 'reverse', (['"""sentry-create-team"""'], {'args': '[self.organization.slug]'}), "('sentry-create-team', args=[self.organization.slug])\n", (375, 428), False, 'from django.core.urlresolvers import reverse\n'), ((941, 996), 'django.core.urlresolvers.reverse', 'reverse', ... |
# Generated by Django 3.2.8 on 2021-11-29 05:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('agendamentos', '0010_agendamentosfuncionarios'),
]
operations = [
migrations.AlterModelTable(
name='agendamentosfuncionarios',
... | [
"django.db.migrations.AlterModelTable"
] | [((238, 335), 'django.db.migrations.AlterModelTable', 'migrations.AlterModelTable', ([], {'name': '"""agendamentosfuncionarios"""', 'table': '"""agendamento_funcionario"""'}), "(name='agendamentosfuncionarios', table=\n 'agendamento_funcionario')\n", (264, 335), False, 'from django.db import migrations\n')] |
import unittest
import os
from pyxdsm.XDSM import XDSM, __file__
from numpy.distutils.exec_command import find_executable
def filter_lines(lns):
# Empty lines are excluded.
# Leading and trailing whitespaces are removed
# Comments are removed.
return [ln.strip() for ln in lns if ln.strip() and not ln.... | [
"pyxdsm.XDSM.XDSM",
"os.path.join",
"os.getcwd",
"os.chdir",
"os.path.isfile",
"os.path.isdir",
"tempfile.mkdtemp",
"numpy.distutils.exec_command.find_executable",
"shutil.rmtree",
"unittest.main",
"os.system",
"os.path.abspath"
] | [((10690, 10705), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10703, 10705), False, 'import unittest\n'), ((470, 481), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (479, 481), False, 'import os\n'), ((505, 540), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {'prefix': '"""testdir-"""'}), "(prefix='testdir-')\n",... |
# -*- coding: utf-8 -*-
from wecom_sdk.base.crypt import encrypt_msg, decrypt_msg
class WeChatWorkCallbackSDK(object):
"""
企业微信回调SDK基本类,用于实现内部系统和企业微信客户端的双向通信
详细说明:https://work.weixin.qq.com/api/doc/90000/90135/90930
"""
def __init__(self, token, encoding_aes_key):
self.token = token
... | [
"wecom_sdk.base.crypt.encrypt_msg",
"wecom_sdk.base.crypt.decrypt_msg"
] | [((548, 623), 'wecom_sdk.base.crypt.encrypt_msg', 'encrypt_msg', (['data'], {'token': 'self.token', 'encoding_aes_key': 'self.encoding_aes_key'}), '(data, token=self.token, encoding_aes_key=self.encoding_aes_key)\n', (559, 623), False, 'from wecom_sdk.base.crypt import encrypt_msg, decrypt_msg\n'), ((763, 904), 'wecom_... |
import os
os.makedirs(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'build')), exist_ok=True)
from .chamfer_distance import ChamferDistance
| [
"os.path.dirname"
] | [((51, 76), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (66, 76), False, 'import os\n')] |
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import sys
import ST7735
# Create ST7735 LCD display class object and set pin numbers and display hardware information.
disp = ST7735.ST7735(
dc=24,
cs=ST7735.BG_SPI_CS_BACK,
rst=25,
port=0,
width=122,
height=160,
ro... | [
"PIL.Image.new",
"PIL.ImageDraw.Draw",
"PIL.ImageFont.truetype",
"ST7735.ST7735"
] | [((203, 306), 'ST7735.ST7735', 'ST7735.ST7735', ([], {'dc': '(24)', 'cs': 'ST7735.BG_SPI_CS_BACK', 'rst': '(25)', 'port': '(0)', 'width': '(122)', 'height': '(160)', 'rotation': '(270)'}), '(dc=24, cs=ST7735.BG_SPI_CS_BACK, rst=25, port=0, width=122,\n height=160, rotation=270)\n', (216, 306), False, 'import ST7735\... |
import sqlite3
conn=sqlite3.connect('Survey.db')
fo=open('insertcommand.txt')
str=fo.readline()
while str:
str="INSERT INTO data VALUES"+str
conn.execute(str)
#print(str)
str=fo.readline()
conn.commit()
conn.close()
fo.close()
| [
"sqlite3.connect"
] | [((21, 49), 'sqlite3.connect', 'sqlite3.connect', (['"""Survey.db"""'], {}), "('Survey.db')\n", (36, 49), False, 'import sqlite3\n')] |
# DO NOT EDIT THIS FILE!
#
# This file is generated from the CDP specification. If you need to make
# changes, edit the generator and regenerate all of the modules.
#
# CDP domain: HeadlessExperimental (experimental)
from __future__ import annotations
from cdp.util import event_class, T_JSON_DICT
from dataclasses impo... | [
"cdp.util.event_class"
] | [((4272, 4331), 'cdp.util.event_class', 'event_class', (['"""HeadlessExperimental.needsBeginFramesChanged"""'], {}), "('HeadlessExperimental.needsBeginFramesChanged')\n", (4283, 4331), False, 'from cdp.util import event_class, T_JSON_DICT\n')] |
import pytest
from detectem.core import Detector, Result, ResultCollection
from detectem.plugin import Plugin, PluginCollection
from detectem.settings import INDICATOR_TYPE, HINT_TYPE, MAIN_ENTRY, GENERIC_TYPE
from detectem.plugins.helpers import meta_generator
class TestDetector():
HAR_ENTRY_1 = {
'requ... | [
"detectem.plugins.helpers.meta_generator",
"detectem.core.Detector",
"pytest.mark.parametrize",
"detectem.core.ResultCollection",
"detectem.core.Result",
"detectem.plugin.PluginCollection"
] | [((2707, 2831), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""har,index"""', '[(HAR_NO_URL_REDIRECT, 0), (HAR_URL_REDIRECT_PATH, 1), (\n HAR_URL_REDIRECT_ABS, 1)]'], {}), "('har,index', [(HAR_NO_URL_REDIRECT, 0), (\n HAR_URL_REDIRECT_PATH, 1), (HAR_URL_REDIRECT_ABS, 1)])\n", (2730, 2831), False, 'im... |
# -*- coding: utf-8 -*-
import numpy as np
import torch
from torch import nn
from kbcr.kernels import GaussianKernel
from kbcr.smart import NeuralKB
import pytest
@pytest.mark.light
def test_smart_v1():
embedding_size = 50
rs = np.random.RandomState(0)
for _ in range(32):
with torch.no_grad(... | [
"numpy.random.RandomState",
"torch.LongTensor",
"pytest.main",
"kbcr.smart.NeuralKB",
"numpy.array",
"kbcr.kernels.GaussianKernel",
"torch.no_grad",
"torch.nn.Embedding"
] | [((243, 267), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (264, 267), True, 'import numpy as np\n'), ((3032, 3055), 'pytest.main', 'pytest.main', (['[__file__]'], {}), '([__file__])\n', (3043, 3055), False, 'import pytest\n'), ((306, 321), 'torch.no_grad', 'torch.no_grad', ([], {}), '()... |
import tkinter
window=tkinter.Tk()
window.title("YUN DAE HEE")
window.geometry("640x400+100+100")
window.resizable(True, True)
image=tkinter.PhotoImage(file="opencv_frame_0.png")
label=tkinter.Label(window, image=image)
label.pack()
window.mainloop() | [
"tkinter.PhotoImage",
"tkinter.Tk",
"tkinter.Label"
] | [((23, 35), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (33, 35), False, 'import tkinter\n'), ((135, 180), 'tkinter.PhotoImage', 'tkinter.PhotoImage', ([], {'file': '"""opencv_frame_0.png"""'}), "(file='opencv_frame_0.png')\n", (153, 180), False, 'import tkinter\n'), ((188, 222), 'tkinter.Label', 'tkinter.Label', (['... |
# -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies 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
#
# http://www.apache.org/licenses/LICENS... | [
"distributed.security.Security",
"logging.debug",
"socket.socket",
"subprocess.Popen",
"shutil.which",
"os.path.dirname",
"distributed.Client",
"logging.error",
"random.randint"
] | [((1229, 1389), 'distributed.security.Security', 'Security', ([], {'tls_ca_file': 'sec_cfg.ca_cert', 'tls_client_cert': 'sec_cfg.client_cert_dask', 'tls_client_key': 'sec_cfg.client_secret_key_dask', 'require_encryption': '(True)'}), '(tls_ca_file=sec_cfg.ca_cert, tls_client_cert=sec_cfg.\n client_cert_dask, tls_cli... |
"""
StarGAN v2
Copyright (c) 2020-present NAVER Corp.
This work is licensed under the Creative Commons Attribution-NonCommercial
4.0 International License. To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
Creative Commons, PO Box 1866, Mountain View, CA 94042, US... | [
"metrics.eval.calculate_metrics",
"core.model.build_model",
"torch.nn.L1Loss",
"torch.nn.InstanceNorm2d",
"torch.full_like",
"torch.cuda.is_available",
"torch.lerp",
"datetime.timedelta",
"core.utils.abs_criterion",
"core.utils.debug_image",
"torch.abs",
"core.data_loader.InputFetcher",
"cor... | [((7079, 7094), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (7092, 7094), False, 'import torch\n'), ((7811, 7826), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (7824, 7826), False, 'import torch\n'), ((11421, 11463), 'torch.full_like', 'torch.full_like', (['logits'], {'fill_value': 'target'}), '(logits, ... |
import random
highscore = []
def not_in_range(guess_it):
"""This is to check that the numbers inputted by the user are in range,
and will let the user know. If the numbers are in range then it passes.
"""
if guess_it < 1:
print('I am not thinking of negative numbers!')
elif guess_it > 10:... | [
"random.randint"
] | [((1411, 1432), 'random.randint', 'random.randint', (['(1)', '(10)'], {}), '(1, 10)\n', (1425, 1432), False, 'import random\n')] |
#!/usr/bin/python3
#
# MIT License
#
# Copyright (c) 2021 <NAME> <<EMAIL>>
#
# 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 ... | [
"rsscast.logger.configure_console",
"sys.exit",
"argparse.ArgumentParser",
"rsscast.rss.ytconverter.convert_yt"
] | [((1684, 1746), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""YouTube convert example"""'}), "(description='YouTube convert example')\n", (1707, 1746), False, 'import argparse\n'), ((1777, 1803), 'rsscast.logger.configure_console', 'logger.configure_console', ([], {}), '()\n', (1801, 18... |
# Prepare my dataset for Digital Pathology
import os
import math
import cv2
import pdb
rootFolder = "F:\DataBase\LymphnodePathology"
trainFolder = rootFolder + "\\trainDataSet"
testFolder = rootFolder + "\\testDataSet"
srcTrainFilePath = trainFolder + "\\20X\\"
dstTrainFilePath = trainFolder + "\\5X\\"
srcTestFileP... | [
"cv2.imwrite",
"cv2.resize",
"os.listdir",
"cv2.imread"
] | [((460, 488), 'os.listdir', 'os.listdir', (['srcTrainFilePath'], {}), '(srcTrainFilePath)\n', (470, 488), False, 'import os\n'), ((516, 543), 'os.listdir', 'os.listdir', (['srcTestFilePath'], {}), '(srcTestFilePath)\n', (526, 543), False, 'import os\n'), ((619, 666), 'cv2.imread', 'cv2.imread', (['(srcTrainFilePath + s... |
# -*- coding: utf8 -*-
import os
from utensor_cgen.utils import save_consts, save_graph, save_idx
import numpy as np
import tensorflow as tf
def generate():
test_dir = os.path.dirname(__file__)
graph = tf.Graph()
with graph.as_default():
x = tf.constant(np.random.randn(10),
dtype=tf.floa... | [
"tensorflow.Graph",
"utensor_cgen.utils.save_graph",
"utensor_cgen.utils.save_consts",
"tensorflow.Session",
"os.path.join",
"os.path.dirname",
"tensorflow.reshape",
"numpy.random.randn"
] | [((172, 197), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (187, 197), False, 'import os\n'), ((208, 218), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (216, 218), True, 'import tensorflow as tf\n'), ((370, 408), 'tensorflow.reshape', 'tf.reshape', (['x', '[5, 2]'], {'name': '"""output... |
"""Logging helpers."""
import logging
import sys
import colorlog
import tqdm
class TqdmLoggingHandler(logging.StreamHandler):
"""TqdmLoggingHandler, outputs log messages to the console compatible with tqdm."""
def emit(self, record): # noqa: D102
message = self.format(record)
tqdm.tqdm.writ... | [
"logging.basicConfig",
"logging._nameToLevel.copy",
"colorlog.TTYColoredFormatter",
"tqdm.tqdm.write"
] | [((1994, 2093), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'level', 'format': 'log_format', 'datefmt': 'log_datefmt', 'handlers': 'log_handlers'}), '(level=level, format=log_format, datefmt=log_datefmt,\n handlers=log_handlers)\n', (2013, 2093), False, 'import logging\n'), ((2288, 2315), 'logging._... |
#Basic Ultrasonic sensor (HC-SR04) code
import RPi.GPIO as GPIO #GPIO RPI library
import time # makes sure Pi waits between steps
GPIO.setmode(GPIO.BCM) #sets GPIO pin numbering
#GPIO.setmode(GPIO.BOARD)
#Remove warnings
GPIO.setwarnings(False)
#Create loop variable
#loop = 1
#BCM
TRIG = 23 #output pin - triggers t... | [
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"RPi.GPIO.setwarnings",
"time.sleep",
"RPi.GPIO.input",
"time.time",
"RPi.GPIO.setmode"
] | [((131, 153), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (143, 153), True, 'import RPi.GPIO as GPIO\n'), ((223, 246), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}), '(False)\n', (239, 246), True, 'import RPi.GPIO as GPIO\n'), ((604, 630), 'RPi.GPIO.setup', 'GPIO.setup', (['T... |
"""Python proxy to run Swift action.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Ve... | [
"sys.stdout.flush",
"actionproxy.main",
"subprocess.Popen",
"json.dumps",
"sys.stderr.flush",
"actionproxy.ActionRunner.__init__",
"os.path.isfile",
"os.chdir",
"os.chmod",
"sys.stdout.write",
"sys.stderr.write",
"codecs.open",
"actionproxy.ActionRunner.env",
"sys.path.append",
"glob.glo... | [((921, 954), 'sys.path.append', 'sys.path.append', (['"""../actionProxy"""'], {}), "('../actionProxy')\n", (936, 954), False, 'import sys\n'), ((3928, 3934), 'actionproxy.main', 'main', ([], {}), '()\n', (3932, 3934), False, 'from actionproxy import ActionRunner, main, setRunner\n'), ((1346, 1406), 'actionproxy.Action... |
import typing as t
from yandex_market_language import models
from yandex_market_language.models.abstract import XMLElement, XMLSubElement
class Promo(models.AbstractModel):
"""
Docs: https://yandex.ru/support/partnermarket/elements/promo-gift.html
"""
MAPPING = {
"start-date": "start_date",
... | [
"yandex_market_language.models.abstract.XMLElement",
"yandex_market_language.models.abstract.XMLSubElement"
] | [((1677, 1705), 'yandex_market_language.models.abstract.XMLElement', 'XMLElement', (['"""promo"""', 'attribs'], {}), "('promo', attribs)\n", (1687, 1705), False, 'from yandex_market_language.models.abstract import XMLElement, XMLSubElement\n'), ((2004, 2042), 'yandex_market_language.models.abstract.XMLSubElement', 'XML... |
# -*- coding: utf-8 -*-
"""
policy._cache
~~~~~~~~~~~~~~~
Cache for policy file.
"""
import os
import logging
LOG = logging.getLogger(__name__)
# Global file cache
CACHE = {}
def read_file(filename: str, force_reload=False):
"""Read a file if it has been modified.
:param filename: File name ... | [
"logging.getLogger",
"os.path.getmtime"
] | [((132, 159), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (149, 159), False, 'import logging\n'), ((580, 606), 'os.path.getmtime', 'os.path.getmtime', (['filename'], {}), '(filename)\n', (596, 606), False, 'import os\n')] |
from typing import Reversible
from django.test import TestCase, Client
from challenge.models import Challenge
from codingPage.models import Command, Log
from django.core.exceptions import ValidationError
from django.urls import reverse
class CodingPageTest(TestCase):
def setUp(self) -> None:
self.client = ... | [
"codingPage.models.Command.objects.create",
"challenge.models.Challenge.objects.create",
"django.urls.reverse",
"codingPage.models.Log.objects.create",
"django.test.Client"
] | [((320, 357), 'django.test.Client', 'Client', ([], {'HTTP_USER_AGENT': '"""Mozilla/5.0"""'}), "(HTTP_USER_AGENT='Mozilla/5.0')\n", (326, 357), False, 'from django.test import TestCase, Client\n'), ((383, 475), 'challenge.models.Challenge.objects.create', 'Challenge.objects.create', ([], {'name': '"""abc"""', 'map': '""... |
from pydantic import BaseModel
from tracardi.domain.entity import Entity
from tracardi.domain.scheduler_config import SchedulerConfig
from tracardi.domain.resource import ResourceCredentials
from tracardi.service.storage.driver import storage
from tracardi.service.plugin.runner import ActionRunner
from tracardi.servic... | [
"tracardi.service.plugin.domain.register.Spec",
"tracardi.service.storage.driver.storage.driver.resource.load",
"tracardi.service.plugin.domain.register.MetaData",
"tracardi.service.plugin.domain.result.Result"
] | [((844, 890), 'tracardi.service.storage.driver.storage.driver.resource.load', 'storage.driver.resource.load', (['config.source.id'], {}), '(config.source.id)\n', (872, 890), False, 'from tracardi.service.storage.driver import storage\n'), ((1345, 1380), 'tracardi.service.plugin.domain.result.Result', 'Result', ([], {'p... |
from main import app
import os
import uvicorn
if __name__ == '__main__':
port = int(os.getenv("PORT"))
uvicorn.run(app, host="0.0.0.0", port=port, workers=1, reload=True)
| [
"uvicorn.run",
"os.getenv"
] | [((112, 179), 'uvicorn.run', 'uvicorn.run', (['app'], {'host': '"""0.0.0.0"""', 'port': 'port', 'workers': '(1)', 'reload': '(True)'}), "(app, host='0.0.0.0', port=port, workers=1, reload=True)\n", (123, 179), False, 'import uvicorn\n'), ((89, 106), 'os.getenv', 'os.getenv', (['"""PORT"""'], {}), "('PORT')\n", (98, 106... |
# Copyright (c) 2018, deepakn94. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | [
"collections.namedtuple",
"pandas.to_datetime",
"pandas.read_csv"
] | [((672, 751), 'collections.namedtuple', 'namedtuple', (['"""RatingData"""', "['items', 'users', 'ratings', 'min_date', 'max_date']"], {}), "('RatingData', ['items', 'users', 'ratings', 'min_date', 'max_date'])\n", (682, 751), False, 'from collections import namedtuple\n'), ((1331, 1377), 'pandas.to_datetime', 'pd.to_da... |
from rpython.jit.backend.llsupport.descr import get_size_descr,\
get_field_descr, get_array_descr, ArrayDescr, FieldDescr,\
SizeDescr, get_interiorfield_descr
from rpython.jit.backend.llsupport.gc import GcLLDescr_boehm,\
GcLLDescr_framework
from rpython.jit.backend.llsupport import jitframe
from rpython... | [
"rpython.jit.backend.llsupport.descr.get_field_descr",
"rpython.jit.backend.llsupport.descr.get_interiorfield_descr",
"rpython.jit.backend.llsupport.descr.FieldDescr",
"rpython.rtyper.lltypesystem.lltype.malloc",
"rpython.rtyper.lltypesystem.lltype.GcArray",
"rpython.jit.tool.oparser.parse",
"rpython.rt... | [((932, 982), 'rpython.rtyper.lltypesystem.lltype.malloc', 'lltype.malloc', (['rclass.OBJECT_VTABLE'], {'immortal': '(True)'}), '(rclass.OBJECT_VTABLE, immortal=True)\n', (945, 982), False, 'from rpython.rtyper.lltypesystem import lltype, rffi\n'), ((1097, 1161), 'rpython.rtyper.lltypesystem.lltype.GcStruct', 'lltype.G... |
import re
def remove_not_alpha_num(string):
return re.sub('[^0-9a-zA-Z]+', '', string)
if __name__ == '__main__':
print(remove_not_alpha_num('a000 aa-b') == 'a000aab')
| [
"re.sub"
] | [((57, 92), 're.sub', 're.sub', (['"""[^0-9a-zA-Z]+"""', '""""""', 'string'], {}), "('[^0-9a-zA-Z]+', '', string)\n", (63, 92), False, 'import re\n')] |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import os
import re
import shlex
import subprocess
import signal
import csv
import logging
import json
import time
from datetime import datetime as dt
from requests.exceptions import RequestException
import glob
import traceback
i... | [
"logging.getLogger",
"logging.StreamHandler",
"beacon_manager_server.BeaconManagerServer",
"shlex.split",
"time.sleep",
"badge_discoverer.BeaconDiscoverer",
"badge_manager_server.BadgeManagerServer",
"os.remove",
"os.path.exists",
"argparse.ArgumentParser",
"subprocess.Popen",
"json.dumps",
... | [((1294, 1327), 'logging.getLogger', 'logging.getLogger', (['"""badge_server"""'], {}), "('badge_server')\n", (1311, 1327), False, 'import logging\n'), ((1418, 1452), 'logging.FileHandler', 'logging.FileHandler', (['log_file_name'], {}), '(log_file_name)\n', (1437, 1452), False, 'import logging\n'), ((1535, 1558), 'log... |
import compileall
compileall.compile_dir(".",force=1) | [
"compileall.compile_dir"
] | [((18, 54), 'compileall.compile_dir', 'compileall.compile_dir', (['"""."""'], {'force': '(1)'}), "('.', force=1)\n", (40, 54), False, 'import compileall\n')] |
# Generated by Django 3.1.5 on 2021-02-17 11:04
from django.db import migrations
import saleor.core.db.fields
import saleor.core.utils.editorjs
def update_empty_description_field(apps, schema_editor):
Category = apps.get_model("product", "Category")
CategoryTranslation = apps.get_model("product", "CategoryT... | [
"django.db.migrations.RunPython"
] | [((2888, 2967), 'django.db.migrations.RunPython', 'migrations.RunPython', (['update_empty_description_field', 'migrations.RunPython.noop'], {}), '(update_empty_description_field, migrations.RunPython.noop)\n', (2908, 2967), False, 'from django.db import migrations\n')] |
#!/usr/bin/env python3
import sys
import random
def read_file(file_name):
"""File reader and parser the num of variables, num of clauses and put the clauses in a list"""
clauses =[]
with open(file_name) as all_file:
for line in all_file:
if line.startswith('c'): continue #ignore comment... | [
"random.random",
"random.choice"
] | [((4087, 4117), 'random.choice', 'random.choice', (['bests_variables'], {}), '(bests_variables)\n', (4100, 4117), False, 'import random\n'), ((3216, 3251), 'random.choice', 'random.choice', (['list_all_unsatisfied'], {}), '(list_all_unsatisfied)\n', (3229, 3251), False, 'import random\n'), ((1283, 1298), 'random.random... |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from collections import OrderedDict
from functools import partial
from jax import lax, random, tree_flatten, tree_map, tree_multimap, tree_unflatten
import jax.numpy as jnp
from jax.tree_util import register_pytree_node_class
from nu... | [
"numpyro.handlers.trace",
"numpyro.primitives.apply_stack",
"jax.tree_map",
"jax.numpy.shape",
"jax.random.split",
"numpyro.contrib.funsor.enum",
"numpyro.contrib.funsor.enum_messenger.LocalNamedMessenger",
"numpyro.contrib.funsor.markov",
"numpyro.handlers.seed",
"numpyro.contrib.funsor.config_en... | [((1814, 1829), 'jax.numpy.ndim', 'jnp.ndim', (['value'], {}), '(value)\n', (1822, 1829), True, 'import jax.numpy as jnp\n'), ((5098, 5127), 'jax.tree_map', 'tree_map', (['(lambda x: x[-1])', 'xs'], {}), '(lambda x: x[-1], xs)\n', (5106, 5127), False, 'from jax import lax, random, tree_flatten, tree_map, tree_multimap,... |
import json
from nbformat.notebooknode import NotebookNode
from nbconvert.exporters.exporter import ResourcesDict
from typing import Tuple
from nbgrader.api import MissingEntry
from nbgrader.preprocessors import OverwriteCells as NbgraderOverwriteCells
from ..utils.extra_cells import is_singlechoice, is_multiplechoi... | [
"json.loads"
] | [((1182, 1212), 'json.loads', 'json.loads', (['source_cell.source'], {}), '(source_cell.source)\n', (1192, 1212), False, 'import json\n')] |