code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from django.db.models.query import QuerySet
from django.db.models import Model
import inspect
from django.apps import apps
"""
How the decorator should work.
Layer 1: for_class
The for_class decorator shoul... | [
"django.dispatch.receiver"
] | [((1199, 1235), 'django.dispatch.receiver', 'receiver', (['signals'], {'sender': 'class_name'}), '(signals, sender=class_name)\n', (1207, 1235), False, 'from django.dispatch import receiver\n')] |
import sys
import time
from functools import partial
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
import matplotlib.animation as animation
import signal
import serial
import serial.tools.l... | [
"serial.Serial",
"tkinter.PhotoImage",
"tkinter.Grid.columnconfigure",
"tkinter.StringVar",
"tkinter.Grid.rowconfigure",
"functools.partial",
"tkinter.Frame.__init__",
"serial.tools.list_ports.comports",
"matplotlib.animation.FuncAnimation",
"tkinter.Radiobutton",
"matplotlib.figure.Figure",
"... | [((97, 120), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (111, 120), False, 'import matplotlib\n'), ((508, 532), 'serial.Serial', 'serial.Serial', ([], {'timeout': '(1)'}), '(timeout=1)\n', (521, 532), False, 'import serial\n'), ((586, 617), 'matplotlib.figure.Figure', 'Figure', ([], {'fig... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 17 13:59:16 2017
@author: User
"""
import datetime
class Employee:
num_of_emps = 0
raise_amount = 1.04
def __init__(self, first, last, pay):
self.first = first
self.last = last
self.pay = pay
self.ema... | [
"datetime.datetime.now",
"datetime.date"
] | [((981, 1004), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1002, 1004), False, 'import datetime\n'), ((1041, 1068), 'datetime.date', 'datetime.date', (['(2017)', '(11)', '(16)'], {}), '(2017, 11, 16)\n', (1054, 1068), False, 'import datetime\n')] |
import os
import sys
from setuptools import find_packages, setup
ROOT = os.path.abspath(os.path.dirname(__file__))
# Import the README and use it as the long-description.
# Note: this will only work if 'README.rst' is present in your MANIFEST.in
# file!
with open(os.path.join(ROOT, 'README.rst')) as f:
long_desc... | [
"os.path.dirname",
"os.path.join",
"setuptools.find_packages"
] | [((90, 115), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (105, 115), False, 'import os\n'), ((267, 299), 'os.path.join', 'os.path.join', (['ROOT', '"""README.rst"""'], {}), "(ROOT, 'README.rst')\n", (279, 299), False, 'import os\n'), ((428, 476), 'os.path.join', 'os.path.join', (['ROOT', '... |
from django.db import models
class A(models.Model):
null_field = models.IntegerField(null=True)
new_null_field = models.IntegerField(null=True)
| [
"django.db.models.IntegerField"
] | [((71, 101), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'null': '(True)'}), '(null=True)\n', (90, 101), False, 'from django.db import models\n'), ((123, 153), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'null': '(True)'}), '(null=True)\n', (142, 153), False, 'from django.db import m... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from functools import partial
import math
import numpy as np
from .helpers import load_pretrained
from .layers import DropPath, to_2tuple, trunc_normal_
from ..losses import accuracy
from ..builder import HEADS
from .decode_head import BaseDecodeHead
fr... | [
"torch.bmm",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.cat",
"torch.randn",
"torch.nn.BatchNorm2d",
"torch.nn.Softmax",
"torch.max",
"torch.nn.functional.interpolate",
"mmseg.ops.resize"
] | [((686, 704), 'torch.nn.Softmax', 'nn.Softmax', ([], {'dim': '(-1)'}), '(dim=-1)\n', (696, 704), True, 'import torch.nn as nn\n'), ((1125, 1156), 'torch.bmm', 'torch.bmm', (['proj_query', 'proj_key'], {}), '(proj_query, proj_key)\n', (1134, 1156), False, 'import torch\n'), ((1386, 1418), 'torch.bmm', 'torch.bmm', (['at... |
#!/usr/bin/env python
#
# Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
#
# 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/li... | [
"cob_manipulation_msgs.msg.QueryGraspsGoal",
"rospy.init_node",
"actionlib.SimpleActionClient"
] | [((827, 890), 'actionlib.SimpleActionClient', 'actionlib.SimpleActionClient', (['"""query_grasps"""', 'QueryGraspsAction'], {}), "('query_grasps', QueryGraspsAction)\n", (855, 890), False, 'import actionlib\n'), ((932, 949), 'cob_manipulation_msgs.msg.QueryGraspsGoal', 'QueryGraspsGoal', ([], {}), '()\n', (947, 949), F... |
from typing import Dict, Any, Optional, cast
from django.contrib.auth import authenticate
from django.contrib.auth.models import AbstractUser
from rest_framework import serializers, exceptions
from rest_framework_simplejwt.tokens import RefreshToken
from .models import Log
class TokenObtainSerializer(serializers.Seri... | [
"rest_framework_simplejwt.tokens.RefreshToken.for_user",
"rest_framework.exceptions.AuthenticationFailed"
] | [((628, 655), 'rest_framework_simplejwt.tokens.RefreshToken.for_user', 'RefreshToken.for_user', (['user'], {}), '(user)\n', (649, 655), False, 'from rest_framework_simplejwt.tokens import RefreshToken\n'), ((576, 609), 'rest_framework.exceptions.AuthenticationFailed', 'exceptions.AuthenticationFailed', ([], {}), '()\n'... |
# Copyright (c) 2016, AB Uobis
# All rights reserved.
from xac import db
from sqlalchemy.dialects.postgresql import JSON
from sqlalchemy import BigInteger
# Memoranda are source documents from which accounting information is extracted to form General Journal entries. As a preliminary step, all of the details for eac... | [
"xac.db.ForeignKey",
"xac.db.relationship",
"xac.db.Column"
] | [((439, 475), 'xac.db.Column', 'db.Column', (['db.Text'], {'primary_key': '(True)'}), '(db.Text, primary_key=True)\n', (448, 475), False, 'from xac import db\n'), ((487, 521), 'xac.db.Column', 'db.Column', (['db.DateTime'], {'index': '(True)'}), '(db.DateTime, index=True)\n', (496, 521), False, 'from xac import db\n'),... |
"""
Copyright 2022 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... | [
"subprocess.check_output",
"subprocess.check_call",
"argparse.ArgumentParser",
"sys.exit"
] | [((699, 715), 'sys.exit', 'sys.exit', (['status'], {}), '(status)\n', (707, 715), False, 'import sys\n'), ((876, 931), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Flattening Image"""'}), "(description='Flattening Image')\n", (899, 931), False, 'import argparse\n'), ((1448, 1513), 'sub... |
from discord.ext import commands
import discord
import requests
from .errorstuff import basicerror
from botlibrary import constants
class Anime(commands.Cog):
def __init__(self, client):
self.client = client
self.anime_url = constants.anime
@commands.command(name="anime")
async def anime_c... | [
"requests.post",
"discord.ext.commands.command",
"discord.Embed"
] | [((268, 298), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""anime"""'}), "(name='anime')\n", (284, 298), False, 'from discord.ext import commands\n'), ((615, 633), 'requests.post', 'requests.post', (['url'], {}), '(url)\n', (628, 633), False, 'import requests\n'), ((1286, 1317), 'discord.Embed',... |
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY ... | [
"copy.deepcopy"
] | [((2131, 2147), 'copy.deepcopy', 'deepcopy', (['module'], {}), '(module)\n', (2139, 2147), False, 'from copy import deepcopy\n')] |
#!/usr/bin/env python
import re
import bs4
import _collections_abc
from bs4 import BeautifulSoup
def my_decode(self, indent_level=None,
eventual_encoding=bs4.DEFAULT_OUTPUT_ENCODING,
formatter="minimal", preserve_newlines=False, whitespace_left=True, whitespace_right=True):
"""Returns... | [
"re.search",
"bs4.element.EntitySubstitution.quoted_attribute_value",
"re.compile"
] | [((6007, 6024), 're.compile', 're.compile', (['"""\\\\S"""'], {}), "('\\\\S')\n", (6017, 6024), False, 'import re\n'), ((7805, 7833), 're.search', 're.search', (['"""\\\\s"""', 'text[::-1]'], {}), "('\\\\s', text[::-1])\n", (7814, 7833), False, 'import re\n'), ((8223, 8264), 're.compile', 're.compile', (['"""^( |\t)+(.... |
"""
Provides classes that represent quasar continuum objects.
"""
import abc
import scipy.interpolate
import numpy as np
import qusp
class Continuum(object):
"""
Abstract base class for quasar continuum objects.
"""
__metaclass__ = abc.ABCMeta
def __init__(self):
raise NotImplementedE... | [
"h5py.File",
"numpy.ones_like",
"numpy.argmax",
"qusp.wavelength.Wavelength",
"qusp.SpectralFluxDensity"
] | [((1023, 1042), 'h5py.File', 'h5py.File', (['specfits'], {}), '(specfits)\n', (1032, 1042), False, 'import h5py\n'), ((2499, 2542), 'numpy.argmax', 'np.argmax', (["(target['target'] == self.targets)"], {}), "(target['target'] == self.targets)\n", (2508, 2542), True, 'import numpy as np\n'), ((3236, 3296), 'qusp.Spectra... |
from app.constants import main_menu_first_answer
from app.models import User
from tg_bot import bot
from tg_bot.keyboards import main_keyboard
# Group callback
@bot.callback_query_handler(
func=lambda call_back: "Выбери группу:" in call_back.message.text
)
# Educator choose message
@bot.callback_query_handler(
... | [
"tg_bot.keyboards.main_keyboard",
"tg_bot.bot.callback_query_handler",
"tg_bot.bot.edit_message_text"
] | [((163, 260), 'tg_bot.bot.callback_query_handler', 'bot.callback_query_handler', ([], {'func': "(lambda call_back: 'Выбери группу:' in call_back.message.text)"}), "(func=lambda call_back: 'Выбери группу:' in\n call_back.message.text)\n", (189, 260), False, 'from tg_bot import bot\n'), ((290, 394), 'tg_bot.bot.callba... |
# Generated by Django 2.2.12 on 2020-06-19 12:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('metadata', '0005_auto_20200610_0922'),
]
operations = [
migrations.AlterField(
model_name='classificationfurtherexplanation',
... | [
"django.db.models.TextField"
] | [((369, 397), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (385, 397), False, 'from django.db import migrations, models\n')] |
from out import OpenCC
cc = OpenCC.opencc_open("out/s2t.json")
text = "测试"
result = OpenCC.opencc_convert_utf8(cc, text, len(text.encode("utf-8")))
OpenCC.opencc_close(cc)
print("{0} --> {1}".format(text, result))
| [
"out.OpenCC.opencc_open",
"out.OpenCC.opencc_close"
] | [((31, 65), 'out.OpenCC.opencc_open', 'OpenCC.opencc_open', (['"""out/s2t.json"""'], {}), "('out/s2t.json')\n", (49, 65), False, 'from out import OpenCC\n'), ((154, 177), 'out.OpenCC.opencc_close', 'OpenCC.opencc_close', (['cc'], {}), '(cc)\n', (173, 177), False, 'from out import OpenCC\n')] |
import django
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
SOCIALACCOUNT_ENABLED = 'allauth.socialaccount' in settings.INSTALLED_APPS
if SOCIALACCOUNT_ENABLED:
allauth_ctx = 'allauth.socialaccount.context_processors.socialaccount'
ctx_present = True
if django.V... | [
"django.core.exceptions.ImproperlyConfigured"
] | [((700, 906), 'django.core.exceptions.ImproperlyConfigured', 'ImproperlyConfigured', (['"""socialaccount context processor not found in settings.TEMPLATE_CONTEXT_PROCESSORS.See settings.py instructions here: https://github.com/pennersr/django-allauth#installation"""'], {}), "(\n 'socialaccount context processor not ... |
import re
import requests
from lxml import html
from bs4 import BeautifulSoup
def exercises(self, Session, SchoolId, StudentId):
EXERCISE_URL = "https://www.lectio.dk/lectio/{}/OpgaverElev.aspx?elevid={}".format(SchoolId, StudentId)
# Scrape url
result = Session.get(EXERCISE_URL)
soup = BeautifulSoup(result.te... | [
"bs4.BeautifulSoup"
] | [((297, 347), 'bs4.BeautifulSoup', 'BeautifulSoup', (['result.text'], {'features': '"""html.parser"""'}), "(result.text, features='html.parser')\n", (310, 347), False, 'from bs4 import BeautifulSoup\n')] |
"""
Support for visonic partitions control when used with a connection to a Visonic Alarm Panel.
Currently, there is only support for a single partition
Initial setup by <NAME>
"""
import logging
import asyncio
import homeassistant.helpers.config_validation as cv
import homeassistant.components.alarm_control_panel as... | [
"homeassistant.core.valid_entity_id",
"voluptuous.Optional",
"voluptuous.Required",
"datetime.timedelta",
"logging.getLogger"
] | [((1418, 1439), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(30)'}), '(seconds=30)\n', (1427, 1439), False, 'from datetime import timedelta\n'), ((1673, 1700), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1690, 1700), False, 'import logging\n'), ((1505, 1533), 'voluptuous.Requ... |
"""
Copyright (C) 2012 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublice... | [
"pyec.space.Euclidean",
"pyec.util.registry.BENCHMARKS.load",
"pyec.config.Config"
] | [((4571, 4587), 'pyec.config.Config', 'Config', ([], {}), '(**config)\n', (4577, 4587), False, 'from pyec.config import Config\n'), ((4103, 4127), 'pyec.space.Euclidean', 'Euclidean', ([], {'dim': 'dimension'}), '(dim=dimension)\n', (4112, 4127), False, 'from pyec.space import Euclidean, Hyperrectangle\n'), ((4352, 437... |
import logging
import sqlalchemy as sqa
from sqlalchemy import func
from sqlalchemy.orm import Session
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ParseMode, Update
from telegram.ext import CallbackContext
from app.bot.commands.utils import end
from app.bot.decorators import acquire_user, db_sess... | [
"sqlalchemy.exists",
"telegram.InlineKeyboardButton",
"app.bot.api.bot.send_message",
"telegram.InlineKeyboardMarkup",
"sqlalchemy.func.count",
"app.bot.commands.utils.end",
"app.bot.keyboards.build_keyboard_menu",
"logging.getLogger"
] | [((557, 584), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (574, 584), False, 'import logging\n'), ((1426, 1486), 'app.bot.keyboards.build_keyboard_menu', 'build_keyboard_menu', (['kb_buttons', '(4)'], {'footer_buttons': 'kb_footer'}), '(kb_buttons, 4, footer_buttons=kb_footer)\n', (144... |
from module_base import ModuleBase
from module_mixins import NoConfigModuleMixin
import module_utils
import vtk
IMAGE_DATA = 0
POLY_DATA = 1
class StreamerVTK(NoConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
ModuleBase.__init__(self, module_manager)
self._image_data_streamer ... | [
"module_mixins.NoConfigModuleMixin.__init__",
"vtk.vtkImageDataStreamer",
"module_mixins.NoConfigModuleMixin.close",
"vtk.vtkPolyDataStreamer",
"module_base.ModuleBase.__init__",
"module_utils.setup_vtk_object_progress"
] | [((243, 284), 'module_base.ModuleBase.__init__', 'ModuleBase.__init__', (['self', 'module_manager'], {}), '(self, module_manager)\n', (262, 284), False, 'from module_base import ModuleBase\n'), ((322, 348), 'vtk.vtkImageDataStreamer', 'vtk.vtkImageDataStreamer', ([], {}), '()\n', (346, 348), False, 'import vtk\n'), ((3... |
import cscripts as cs
import ctools as ct
import gammalib as gl
import math
import sys
from lib.utils import li_ma
import argparse
# PYTHONPATH=path/to/lib python delta_significance.py onoff_obs_list.xml ml_result.xml
def inspect_onoff_observations(onoff_obs_file):
oo_obs_list = gl.GObservations(onoff_obs_file)
... | [
"argparse.ArgumentParser",
"math.sqrt",
"lib.utils.li_ma",
"gammalib.GObservations",
"gammalib.GModels"
] | [((286, 318), 'gammalib.GObservations', 'gl.GObservations', (['onoff_obs_file'], {}), '(onoff_obs_file)\n', (302, 318), True, 'import gammalib as gl\n'), ((801, 836), 'lib.utils.li_ma', 'li_ma', (['on_counts', 'off_counts', 'alpha'], {}), '(on_counts, off_counts, alpha)\n', (806, 836), False, 'from lib.utils import li_... |
import unittest
from unittest.mock import mock_open, patch
from charm import ScriptDeployer
from ops.model import ActiveStatus
from ops.testing import Harness
class TestCharm(unittest.TestCase):
def setUp(self):
self.location = "/tmp/foo-test"
self.harness = Harness(ScriptDeployer)
self.a... | [
"unittest.mock.patch",
"ops.model.ActiveStatus",
"ops.testing.Harness"
] | [((387, 404), 'unittest.mock.patch', 'patch', (['"""os.chmod"""'], {}), "('os.chmod')\n", (392, 404), False, 'from unittest.mock import mock_open, patch\n'), ((410, 469), 'unittest.mock.patch', 'patch', (['"""__main__.__builtins__.open"""'], {'new_callable': 'mock_open'}), "('__main__.__builtins__.open', new_callable=m... |
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import numpy as np
from voronoi.events import CircleEvent
class Colors:
SWEEP_LINE = "#636e72"
CELL_POINTS = "black"
BEACH_LINE = "#636e72"
EDGE = "#636e72"
ARC = "#b2bec3"
INCIDENT_POINT_POINTER = "#dfe6e9"
INVALID_CIRCL... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.close",
"matplotlib.patches.Circle",
"numpy.min",
"matplotlib.pyplot.Circle",
"numpy.linspace",
"matplotlib.pyplot.subplots"
] | [((644, 654), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (652, 654), True, 'import matplotlib.pyplot as plt\n'), ((704, 734), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(17, 17)'}), '(figsize=(17, 17))\n', (716, 734), True, 'import matplotlib.pyplot as plt\n'), ((872, 883), 'matplotlib... |
import sys
import numpy as np
from collections import defaultdict
def DumpHistogram(h):
f = open("hist.txt", 'w')
for addr in sorted(h.keys()):
print >>f, hex(addr), h[addr]
f.close()
def CollectSamples(infile):
histogram = defaultdict(int)
checkpointctr = 0
while True:
buf =... | [
"collections.defaultdict",
"numpy.frombuffer"
] | [((252, 268), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (263, 268), False, 'from collections import defaultdict\n'), ((397, 426), 'numpy.frombuffer', 'np.frombuffer', (['buf', 'np.uint16'], {}), '(buf, np.uint16)\n', (410, 426), True, 'import numpy as np\n')] |
#!env python
import functools
import pprint
def solve1(startarray, lengths):
data = list(startarray)
pos = 0
skip = 0
for length in lengths:
if pos + length >= len(data):
endlen = len(data[pos:])
endpos = pos + length - len(data)
subdata = list(reversed(dat... | [
"functools.reduce"
] | [((1483, 1530), 'functools.reduce', 'functools.reduce', (['(lambda x, y: x ^ y)', 'datarange'], {}), '(lambda x, y: x ^ y, datarange)\n', (1499, 1530), False, 'import functools\n')] |
import art
import os
from random import randint
from game_data import data as dt
logo = art.logo
vs = art.vs
def clearConsole():
command = 'clear'
if os.name in ('nt', 'dos'): # If Machine is running on Windows, use cls
command = 'cls'
os.system(command)
def compare(person1... | [
"os.system"
] | [((277, 295), 'os.system', 'os.system', (['command'], {}), '(command)\n', (286, 295), False, 'import os\n')] |
import streamlit as st
import streamlit.components.v1 as components
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
import base64
from io import BytesIO
import warnings
warnings.filterwarnings('ignore', category=UserWarning)
def st_yellowbrick(visualizer, scrolling=False):
"""Embed a Yellowbr... | [
"io.BytesIO",
"warnings.filterwarnings",
"matplotlib.pyplot.close",
"matplotlib.pyplot.cla",
"streamlit.components.v1.html"
] | [((191, 246), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (214, 246), False, 'import warnings\n'), ((1433, 1442), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (1440, 1442), False, 'from io import BytesIO\n'), ((1647, 1656), '... |
from cities import app
app.run(debug=True)
| [
"cities.app.run"
] | [((24, 43), 'cities.app.run', 'app.run', ([], {'debug': '(True)'}), '(debug=True)\n', (31, 43), False, 'from cities import app\n')] |
# Imports
import asyncio
import time
import discord
from discord.ext import commands
import Config
class Misc(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(aliases = ["latency"])
async def ping(self, ctx):
"""
Show the bot's current la... | [
"discord.ext.commands.command",
"time.perf_counter",
"discord.Embed"
] | [((201, 238), 'discord.ext.commands.command', 'commands.command', ([], {'aliases': "['latency']"}), "(aliases=['latency'])\n", (217, 238), False, 'from discord.ext import commands\n'), ((357, 434), 'discord.Embed', 'discord.Embed', ([], {'title': '"""Ping"""', 'description': '"""Pinging..."""', 'color': 'Config.MAINCOL... |
from util import loader
from wrappers.update import Update
from games.base_class import Game
class RocketLeague(Game):
def __init__(self):
super().__init__('Rocket League', homepage='https://www.rocketleague.com')
def scan(self):
soup = loader.soup("https://www.rocketleague.com/ajax/articles-results/?cat=7-5aa... | [
"util.loader.soup",
"wrappers.update.Update"
] | [((246, 338), 'util.loader.soup', 'loader.soup', (['"""https://www.rocketleague.com/ajax/articles-results/?cat=7-5aa1f33-rqfqqm"""'], {}), "(\n 'https://www.rocketleague.com/ajax/articles-results/?cat=7-5aa1f33-rqfqqm')\n", (257, 338), False, 'from util import loader\n'), ((513, 530), 'util.loader.soup', 'loader.sou... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
import django.utils.timezone
import uuidfield.fields
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0001_initial'),
... | [
"django.db.models.URLField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.BooleanField",
"django.db.migrations.DeleteModel",
"django.db.models.AutoField"
] | [((406, 452), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""TemplateService"""'}), "(name='TemplateService')\n", (428, 452), False, 'from django.db import models, migrations\n'), ((485, 524), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""Template"""'})... |
from __future__ import absolute_import, division, print_function
# LIBTBX_SET_DISPATCHER_NAME boost_adaptbx.inexact
import boost_adaptbx.boost.python as bp
import sys
def run(args):
assert len(args) == 0
print("Now creating a NaN in C++ as 0/0 ...")
sys.stdout.flush()
result = bp.ext.divide_doubles(0, 0)
p... | [
"boost_adaptbx.boost.python.ext.divide_doubles",
"sys.stdout.flush"
] | [((259, 277), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (275, 277), False, 'import sys\n'), ((289, 316), 'boost_adaptbx.boost.python.ext.divide_doubles', 'bp.ext.divide_doubles', (['(0)', '(0)'], {}), '(0, 0)\n', (310, 316), True, 'import boost_adaptbx.boost.python as bp\n')] |
import requests
import json
import os
import logging
def caption(image_path):
# Replace <Subscription Key> with your valid subscription key.
subscription_key = "6288ad9fa371475dad4c60fa1ae1933f"
assert subscription_key
vision_base_url = "https://eastus.api.cognitive.microsoft.com/vision/v2.0/"
ana... | [
"requests.post"
] | [((631, 706), 'requests.post', 'requests.post', (['analyze_url'], {'headers': 'headers', 'params': 'params', 'data': 'image_data'}), '(analyze_url, headers=headers, params=params, data=image_data)\n', (644, 706), False, 'import requests\n')] |
#!/usr/bin/env python
'''
Verify PySide installation
Defines a simple GUI using Qt Designer which consists of
a centralWidget more two QLabel widgets: one has fixed text,
the text of the other is set runtime with the current PySide version.
This script depends on Qt Designer ui files.
The depending rules are declare... | [
"mainctrl.GuiApplication"
] | [((656, 676), 'mainctrl.GuiApplication', 'GuiApplication', (['argv'], {}), '(argv)\n', (670, 676), False, 'from mainctrl import GuiApplication\n')] |
#!/usr/bin/python
# coding=utf-8
from pymongo import MongoClient
class TDocDB:
def __init__(self):
self.mongoclient = MongoClient('127.0.0.1', 27017, connect=False)
self.db = self.mongoclient['mhsb_gt']
self.mongostate = self.db.authenticate('zz', '123456')
print(self.mongostate)
... | [
"pymongo.MongoClient"
] | [((133, 179), 'pymongo.MongoClient', 'MongoClient', (['"""127.0.0.1"""', '(27017)'], {'connect': '(False)'}), "('127.0.0.1', 27017, connect=False)\n", (144, 179), False, 'from pymongo import MongoClient\n')] |
"""Example workflow pipeline script for abalone pipeline.
. -RegisterModel
.
Process-> Train -> Evaluate -> Condition .
.
. -(stop... | [
"sagemaker.huggingface.HuggingFace",
"sagemaker.processing.ProcessingInput",
"sagemaker.workflow.properties.PropertyFile",
"boto3.Session",
"sagemaker.workflow.parameters.ParameterInteger",
"sagemaker.workflow.condition_step.ConditionStep",
"os.path.realpath",
"sagemaker.workflow.pipeline.Pipeline",
... | [((1349, 1375), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (1365, 1375), False, 'import os\n'), ((1431, 1464), 'boto3.Session', 'boto3.Session', ([], {'region_name': 'region'}), '(region_name=region)\n', (1444, 1464), False, 'import boto3\n'), ((1862, 1895), 'boto3.Session', 'boto3.Sess... |
from fastapi import APIRouter, Depends, status, Query
from sqlalchemy.ext.asyncio import AsyncSession
from app.admin import views
from app.admin.schemas import UsersPaginate, UserMaximal, RegisterAdmin, UpdateUser
from app.schemas import Message
from app.views import is_superuser
from db import get_db
admin_router = ... | [
"app.admin.views.unbind_github",
"app.admin.views.get_all_users",
"app.admin.views.create_user",
"app.admin.views.get_user",
"app.admin.views.update_level",
"fastapi.Query",
"fastapi.Depends",
"app.admin.views.update_user",
"fastapi.APIRouter"
] | [((320, 331), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (329, 331), False, 'from fastapi import APIRouter, Depends, status, Query\n'), ((635, 657), 'fastapi.Query', 'Query', ([], {'default': '(1)', 'gt': '(0)'}), '(default=1, gt=0)\n', (640, 657), False, 'from fastapi import APIRouter, Depends, status, Query\... |
import sys
import os
sys.path.append(r"D:\Dupre\_data\program\python\pyensae\src")
import pyensae
from time import strftime, strptime
import datetime
from pyensae.sql.database_main import Database
tbl = "stations.txt"
if not os.path.exists(tbl):
sql = """SELECT DISTINCT address, contract_name,lat,lng,name,number... | [
"sys.path.append",
"datetime.datetime.strptime",
"os.path.exists"
] | [((21, 87), 'sys.path.append', 'sys.path.append', (['"""D:\\\\Dupre\\\\_data\\\\program\\\\python\\\\pyensae\\\\src"""'], {}), "('D:\\\\Dupre\\\\_data\\\\program\\\\python\\\\pyensae\\\\src')\n", (36, 87), False, 'import sys\n'), ((227, 246), 'os.path.exists', 'os.path.exists', (['tbl'], {}), '(tbl)\n', (241, 246), Fal... |
import os
from torchvision import datasets
from torchvision.transforms import transforms
from core.datasets.transforms.custom_transform import *
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
def train_dataset(data_dir, transform=TinyImageNetT... | [
"torchvision.datasets.ImageNet",
"os.path.join",
"torchvision.transforms.transforms.Normalize"
] | [((158, 233), 'torchvision.transforms.transforms.Normalize', 'transforms.Normalize', ([], {'mean': '[0.485, 0.456, 0.406]', 'std': '[0.229, 0.224, 0.225]'}), '(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])\n', (178, 233), False, 'from torchvision.transforms import transforms\n'), ((362, 393), 'os.path.join', '... |
from flask import current_app, url_for
from app.articles import get_current_locale
GC_ARTICLES_ROUTES = {
"home": {"en": "/home", "fr": "/accueil"},
"whynotify": {"en": "/why-gc-notify", "fr": "/pourquoi-gc-notification"},
"features": {"en": "/features", "fr": "/fonctionnalites"},
"guidance": {"en": "... | [
"flask.url_for",
"app.articles.get_current_locale"
] | [((1551, 1582), 'app.articles.get_current_locale', 'get_current_locale', (['current_app'], {}), '(current_app)\n', (1569, 1582), False, 'from app.articles import get_current_locale\n'), ((1454, 1491), 'flask.url_for', 'url_for', (['"""main.index"""'], {'_external': '(True)'}), "('main.index', _external=True)\n", (1461,... |
from datetime import timedelta as td, datetime as dt
def ends_at(max_mana:float, percent_done:float)->float:
"""param:
: max_mana: float, in terms of 1e14 mana
: percent done: float, between 0 and 1
"""
print(dt.now() + td(days=2e4/(24*36*max_mana)*(1-percent_done)))
| [
"datetime.datetime.now",
"datetime.timedelta"
] | [((250, 258), 'datetime.datetime.now', 'dt.now', ([], {}), '()\n', (256, 258), True, 'from datetime import timedelta as td, datetime as dt\n'), ((261, 321), 'datetime.timedelta', 'td', ([], {'days': '(20000.0 / (24 * 36 * max_mana) * (1 - percent_done))'}), '(days=20000.0 / (24 * 36 * max_mana) * (1 - percent_done))\n'... |
# Copyright (c) 2019 <NAME>. See LICENSE
import sys
import socketserver
import pathlib
from .configuration import Configuration
from benten.version import __version__
from benten.langserver.jsonrpc import JSONRPC2Connection, ReadWriter, TCPReadWriter
from benten.langserver.server import LangServer
from cwlformat.v... | [
"benten.langserver.jsonrpc.ReadWriter",
"benten.langserver.jsonrpc.TCPReadWriter",
"argparse.ArgumentParser",
"logging.basicConfig",
"benten.langserver.server.LangServer",
"logging.Formatter",
"pathlib.Path",
"logging.handlers.RotatingFileHandler",
"logging.getLogger"
] | [((523, 542), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (540, 542), False, 'import logging\n'), ((1082, 1128), 'pathlib.Path', 'pathlib.Path', (['config.log_path', '"""benten-ls.log"""'], {}), "(config.log_path, 'benten-ls.log')\n", (1094, 1128), False, 'import pathlib\n'), ((1176, 1218), 'logging.han... |
''' Open DOI
Version 1.0.3 (2021-07-30)
Copyright (c) 2021 <NAME>
MIT License
'''
import sublime
import sublime_plugin
import webbrowser
class OpenDoiCommand(sublime_plugin.TextCommand):
'''Open the DOI/shortDOI, selected in Sublime Text, in your browser.'''
doi_list = []
def run(self, edit... | [
"webbrowser.open"
] | [((379, 420), 'webbrowser.open', 'webbrowser.open', (["('https://doi.org/' + doi)"], {}), "('https://doi.org/' + doi)\n", (394, 420), False, 'import webbrowser\n')] |
"""
Orders serializer.
This serializer validates the orders's fields first.
"""
from rest_framework import serializers
from django.db.models import Sum
from cart.serializers import CartSerializer
from cart.models import Cart
from .models import Orders
class OrdersSerializer(serializers.ModelSerializer):
"""
... | [
"rest_framework.serializers.SerializerMethodField",
"cart.models.Cart.objects.filter",
"django.db.models.Sum",
"cart.serializers.CartSerializer",
"rest_framework.serializers.CharField"
] | [((438, 479), 'cart.serializers.CartSerializer', 'CartSerializer', ([], {'many': '(True)', 'read_only': '(True)'}), '(many=True, read_only=True)\n', (452, 479), False, 'from cart.serializers import CartSerializer\n'), ((491, 553), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'source': '"""user... |
# USDA_CoA_Cropland.py (flowsa)
# !/usr/bin/env python3
# coding=utf-8
"""
Functions used to import and parse USDA Census of Ag Cropland data
in NAICS format
"""
import json
import numpy as np
import pandas as pd
from flowsa.location import US_FIPS, abbrev_us_state
from flowsa.common import WITHDRAWN_KEYWORD, \
f... | [
"pandas.DataFrame",
"flowsa.flowbyfunctions.assign_fips_location_system",
"json.loads",
"flowsa.flowbyfunctions.equally_allocate_suppressed_parent_to_child_naics",
"numpy.where",
"pandas.concat"
] | [((2261, 2282), 'json.loads', 'json.loads', (['resp.text'], {}), '(resp.text)\n', (2271, 2282), False, 'import json\n'), ((2301, 2341), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': "cropland_json['data']"}), "(data=cropland_json['data'])\n", (2313, 2341), True, 'import pandas as pd\n'), ((2671, 2701), 'pandas.conc... |
import unittest
import torch
from fastNLP import Vocabulary
from fastNLP.embeddings import StaticEmbedding
from fastNLP.modules import TransformerSeq2SeqDecoder
from fastNLP.modules import LSTMSeq2SeqDecoder
from fastNLP import seq_len_to_mask
class TestTransformerSeq2SeqDecoder(unittest.TestCase):
def test_cas... | [
"fastNLP.modules.LSTMSeq2SeqDecoder",
"fastNLP.Vocabulary",
"torch.LongTensor",
"torch.randn",
"fastNLP.seq_len_to_mask",
"fastNLP.modules.TransformerSeq2SeqDecoder",
"fastNLP.embeddings.StaticEmbedding"
] | [((468, 508), 'fastNLP.embeddings.StaticEmbedding', 'StaticEmbedding', (['vocab'], {'embedding_dim': '(10)'}), '(vocab, embedding_dim=10)\n', (483, 508), False, 'from fastNLP.embeddings import StaticEmbedding\n'), ((535, 556), 'torch.randn', 'torch.randn', (['(2)', '(3)', '(10)'], {}), '(2, 3, 10)\n', (546, 556), False... |
import math
import time
def isPrime(n):
sqrtN = math.floor(math.sqrt(n))
if (n<=1):
return False
elif (n ==2):
return True
else:
for i in range(3,sqrtN+1,2):
if((n%i) ==0):
return False
else:
... | [
"math.sqrt"
] | [((69, 81), 'math.sqrt', 'math.sqrt', (['n'], {}), '(n)\n', (78, 81), False, 'import math\n')] |
# This file implements the search methods for some parameters
from ascii import preprocess_ascii, image_to_ascii, post_process
import cv2 as cv
import numpy as np
import os
def draw_patch(image, x0, y0, Tw, Th, Rw, Rh, idx):
image = np.asarray(image)
image = cv.cvtColor(image, cv.COLOR_BGR2RGB)
for i in r... | [
"os.mkdir",
"cv2.cvtColor",
"ascii.preprocess_ascii",
"numpy.asarray",
"os.path.exists",
"cv2.imread",
"ascii.image_to_ascii",
"cv2.rectangle"
] | [((239, 256), 'numpy.asarray', 'np.asarray', (['image'], {}), '(image)\n', (249, 256), True, 'import numpy as np\n'), ((269, 305), 'cv2.cvtColor', 'cv.cvtColor', (['image', 'cv.COLOR_BGR2RGB'], {}), '(image, cv.COLOR_BGR2RGB)\n', (280, 305), True, 'import cv2 as cv\n'), ((974, 1020), 'ascii.preprocess_ascii', 'preproce... |
from .bot import Bot
from ..game import Board
from random import randrange, choice
from itertools import permutations
def new_box(board, n):
out = [n]*9
for i,j in enumerate(board):
if j != 0:
out[i] = 0
rs = board.max_rotations()
if len(rs) > 1:
for i,j in enumerate(out):
... | [
"matplotlib.pylab.savefig",
"matplotlib.pylab.clf",
"random.choice",
"matplotlib.pylab.xlabel",
"matplotlib.pylab.ylabel",
"matplotlib.pylab.show"
] | [((2153, 2164), 'random.choice', 'choice', (['rot'], {}), '(rot)\n', (2159, 2164), False, 'from random import randrange, choice\n'), ((3059, 3088), 'matplotlib.pylab.xlabel', 'plt.xlabel', (['"""Number of games"""'], {}), "('Number of games')\n", (3069, 3088), True, 'import matplotlib.pylab as plt\n'), ((3097, 3149), '... |
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader, random_split, Subset
import json, time, pickle, csv, re, os, gc, logging, zlib, orjson, joblib
import numpy as np
from tqdm import tqdm
from sklearn.... | [
"torch.nn.Dropout",
"numpy.random.seed",
"torch.nn.Embedding",
"torch.cat",
"torch.no_grad",
"numpy.round",
"torch.ones",
"torch.utils.data.DataLoader",
"numpy.power",
"torch.load",
"os.path.exists",
"torch.nn.Embedding.from_pretrained",
"reformer_pytorch.ReformerLM",
"torch.nn.functional.... | [((5907, 6091), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': "(log_dir + 'train1116.log')", 'filemode': '"""a"""', 'format': '"""%(asctime)s %(name)s:%(levelname)s:%(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""', 'level': 'logging.INFO'}), "(filename=log_dir + 'train1116.log', filemode='a',\n ... |
from enum import Enum
from glTF_editor.common.data_serializer import \
serializer
from .accessor import \
Accessor, Sparse, Indices, Values
from .animation import \
Animation, AnimationSampler, Channel, Target
from .asset import \
Asset
from .buffer import \
Buffer
from .buffer... | [
"glTF_editor.common.data_serializer.serializer.loads",
"glTF_editor.common.data_serializer.serializer.dumps"
] | [((9213, 9253), 'glTF_editor.common.data_serializer.serializer.dumps', 'serializer.dumps', (['self'], {'type_hints': '(False)'}), '(self, type_hints=False)\n', (9229, 9253), False, 'from glTF_editor.common.data_serializer import serializer\n'), ((6888, 6909), 'glTF_editor.common.data_serializer.serializer.loads', 'seri... |
from floodsystem.stationdata import build_station_list, update_water_levels
from floodsystem.datafetcher import fetch_measure_levels
from floodsystem.analysis import polyfit
import datetime
import numpy
def test_polyfit():
# Creating list of stations and updating
stations = build_station_list()
update_wate... | [
"floodsystem.stationdata.build_station_list",
"floodsystem.stationdata.update_water_levels",
"datetime.timedelta",
"floodsystem.analysis.polyfit"
] | [((284, 304), 'floodsystem.stationdata.build_station_list', 'build_station_list', ([], {}), '()\n', (302, 304), False, 'from floodsystem.stationdata import build_station_list, update_water_levels\n'), ((309, 338), 'floodsystem.stationdata.update_water_levels', 'update_water_levels', (['stations'], {}), '(stations)\n', ... |
#
# Copyright 2014 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
#... | [
"gnuradio.analog.sig_source_c",
"gnuradio.gr.io_signature",
"gnuradio.blocks.message_debug",
"gnuradio.gr.hier_block2._optional_endpoints",
"gnuradio.blocks.head",
"gnuradio.gr.top_block",
"gnuradio.gr.hier_block2._multiple_endpoints",
"time.sleep",
"gnuradio.gr_unittest.run",
"gnuradio.blocks.vec... | [((1944, 1971), 'gnuradio.gr.hier_block2._multiple_endpoints', '_multiple_endpoints', (['test_f'], {}), '(test_f)\n', (1963, 1971), False, 'from gnuradio.gr.hier_block2 import _multiple_endpoints, _optional_endpoints\n'), ((1982, 2009), 'gnuradio.gr.hier_block2._optional_endpoints', '_optional_endpoints', (['test_f'], ... |
import typing
from starlette import status
from starlette.types import ASGIApp, Message, Receive, Scope, Send
from kupala.responses import PlainTextResponse
class LargeEntityError(ValueError):
pass
class RequestLimitMiddleware:
"""Limit request body to a value of max_body_size.
When request body exceed... | [
"kupala.responses.PlainTextResponse"
] | [((1273, 1369), 'kupala.responses.PlainTextResponse', 'PlainTextResponse', (['"""Entity Too Large"""'], {'status_code': 'status.HTTP_413_REQUEST_ENTITY_TOO_LARGE'}), "('Entity Too Large', status_code=status.\n HTTP_413_REQUEST_ENTITY_TOO_LARGE)\n", (1290, 1369), False, 'from kupala.responses import PlainTextResponse... |
from itertools import chain
from src.independent.TransitivelyClosedDirectedGraphWithUnions import TransitivelyClosedDirectedGraphWithUnions
from src.typechecking.standard_sorts import *
from src.typechecking.SubsortConstraint import sschain, SubsortConstraint
SubsortGraph = TransitivelyClosedDirectedGraphWithUnions[... | [
"src.typechecking.SubsortConstraint.sschain"
] | [((2259, 2291), 'src.typechecking.SubsortConstraint.sschain', 'sschain', (['PosTimeDelta', 'TimeDelta'], {}), '(PosTimeDelta, TimeDelta)\n', (2266, 2291), False, 'from src.typechecking.SubsortConstraint import sschain, SubsortConstraint\n'), ((2298, 2323), 'src.typechecking.SubsortConstraint.sschain', 'sschain', (['Pos... |
import requests
from athera.api.common import headers, api_debug
route_driver = "/storage/driver"
route_drivers = "/storage/drivers"
route_driver_id = "/storage/driver/{driver_id}"
# Drivers
@api_debug
def get_drivers(base_url, group_id, token):
"""
Get all user storage drivers. It gets the drivers associa... | [
"athera.api.common.headers"
] | [((619, 643), 'athera.api.common.headers', 'headers', (['group_id', 'token'], {}), '(group_id, token)\n', (626, 643), False, 'from athera.api.common import headers, api_debug\n'), ((1039, 1063), 'athera.api.common.headers', 'headers', (['group_id', 'token'], {}), '(group_id, token)\n', (1046, 1063), False, 'from athera... |
import os
import re
import itertools
import pandas as pd
import numpy as np
def read_input_data(readdir, readfile):
return pd.read_pickle(os.path.join(readdir, readfile))
def create_record_for_coapps(df, coapp_lname, matchvars=[], keepvars=[]):
in_vars = [coapp_lname] + matchvars + keepvars
output = df[... | [
"itertools.product",
"os.path.join",
"pandas.concat",
"re.compile"
] | [((1025, 1056), 're.compile', 're.compile', (['"""[\\\\`\\\\{}\\\\,.0-9"]"""'], {}), '(\'[\\\\`\\\\{}\\\\,.0-9"]\')\n', (1035, 1056), False, 'import re\n'), ((1200, 1217), 're.compile', 're.compile', (['"""[\']"""'], {}), '("[\']")\n', (1210, 1217), False, 'import re\n'), ((1417, 1438), 're.compile', 're.compile', (['"... |
import re
text = input()
pattern = r"((\d{2})([/\.-])([A-Z][a-z]{2})\2(\d){4}))"
matches = re.findall(pattern, text)
for match in matches:
print(f"Day: {match.group('day')}, Month: {match.group('month')}, Year: {match.group('year')}") | [
"re.findall"
] | [((91, 116), 're.findall', 're.findall', (['pattern', 'text'], {}), '(pattern, text)\n', (101, 116), False, 'import re\n')] |
import os
import numpy as np
import json
import cv2
from tqdm import tqdm
from collections import defaultdict
def convert(img_dir, split, label_dir, save_label_dir, filter_crowd=False, filter_ignore=False):
cat2id = {'train':6, 'car':3, 'bus':5, 'other person': 1, 'rider':2, 'pedestrian':1, 'other vehicle':3, '... | [
"tqdm.tqdm",
"os.makedirs",
"collections.defaultdict",
"os.path.join",
"os.listdir"
] | [((384, 401), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (395, 401), False, 'from collections import defaultdict\n'), ((1081, 1109), 'os.path.join', 'os.path.join', (['img_dir', 'split'], {}), '(img_dir, split)\n', (1093, 1109), False, 'import os\n'), ((1126, 1156), 'os.path.join', 'os.path.j... |
# This was an idea that formed after seeing this post on r/admincraft https://www.reddit.com/r/admincraft/comments/qh3175/plugin_for_ingame_rewards_for_being_active_in/
import discord, json
from mcrcon import MCRcon
from discord.ext import commands
print("Starting up...")
f = open('config.json')
config = json.load(f... | [
"json.load",
"discord.ext.commands.Bot"
] | [((309, 321), 'json.load', 'json.load', (['f'], {}), '(f)\n', (318, 321), False, 'import discord, json\n'), ((433, 510), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': 'prefix', 'help_command': 'None', 'case_insensitive': '(True)'}), '(command_prefix=prefix, help_command=None, case_insensitive=True... |
"""This script is very interconnected with Dockerfile and paths there
be sure to check the file if you plan to change something.
"""
import logging
import os
import shutil
import dataclasses
import json
from tester.config import Config, SubmissionMode, Visibility
import tester.logger
import tester.compiler as compile... | [
"json.dump",
"tester.config.Config.teachers_json",
"tester.config.Config.students_json",
"tester.config.Config.tests_path",
"tester.config.Config.build_output_path",
"tester.compiler.check_cmake",
"tester.config.Config.dumps",
"dataclasses.asdict",
"dataclasses.is_dataclass",
"tester.config.Config... | [((352, 379), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (369, 379), False, 'import logging\n'), ((800, 844), 'tester.compiler.compile_cmake_project', 'compiler.compile_cmake_project', (['project_path'], {}), '(project_path)\n', (830, 844), True, 'import tester.compiler as compiler\n'... |
"""
Interactron Random Training Loop
The interactorn model is trained on random sequences of data.
"""
import math
from tqdm import tqdm
import numpy as np
import os
from datetime import datetime
import torch
from torch.utils.data.dataloader import DataLoader
from datasets.sequence_dataset import SequenceDataset
fr... | [
"datasets.sequence_dataset.SequenceDataset",
"datetime.datetime.now",
"numpy.mean",
"torch.cuda.is_available",
"math.cos",
"torch.utils.data.dataloader.DataLoader",
"torch.cuda.current_device",
"torch.nn.DataParallel",
"os.path.join"
] | [((992, 1033), 'os.path.join', 'os.path.join', (['self.out_dir', '"""detector.pt"""'], {}), "(self.out_dir, 'detector.pt')\n", (1004, 1033), False, 'import os\n'), ((1064, 1209), 'datasets.sequence_dataset.SequenceDataset', 'SequenceDataset', (['config.DATASET.TRAIN.IMAGE_ROOT', 'config.DATASET.TRAIN.ANNOTATION_ROOT', ... |
#!/usr/bin/env python3
from typing import List
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from info import EEG_SHAPE, participants
band_names = ['delta', 'theta', 'alpha', 'beta', 'gamma']
if __name__ == '__main__':
T, H, W, R =... | [
"numpy.load",
"numpy.ravel",
"numpy.var",
"numpy.amax",
"numpy.max",
"numpy.min",
"numpy.mean",
"numpy.exp",
"matplotlib.pyplot.subplots"
] | [((342, 382), 'numpy.load', 'np.load', (['"""data/data-processed-bands.npz"""'], {}), "('data/data-processed-bands.npz')\n", (349, 382), True, 'import numpy as np\n'), ((478, 541), 'matplotlib.pyplot.subplots', 'plt.subplots', (['R', 'C'], {'sharex': '"""all"""', 'sharey': '"""all"""', 'figsize': '(12, 4)'}), "(R, C, s... |
# Generated by Django 3.0.10 on 2020-10-31 13:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recommendations', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='recommendation',
name='score... | [
"django.db.models.DecimalField"
] | [((341, 417), 'django.db.models.DecimalField', 'models.DecimalField', ([], {'blank': '(True)', 'decimal_places': '(10)', 'max_digits': '(12)', 'null': '(True)'}), '(blank=True, decimal_places=10, max_digits=12, null=True)\n', (360, 417), False, 'from django.db import migrations, models\n')] |
from django.contrib import admin
from .models import Forum, Thread, ThreadResponse
@admin.register(Forum)
class ForumAdmin(admin.ModelAdmin):
list_display = ('__str__', 'course_home', 'status')
list_filter = ('status', 'course_home')
readonly_fields = ('created_date', 'created_by')
def save_model(sel... | [
"django.contrib.admin.register"
] | [((86, 107), 'django.contrib.admin.register', 'admin.register', (['Forum'], {}), '(Forum)\n', (100, 107), False, 'from django.contrib import admin\n'), ((478, 500), 'django.contrib.admin.register', 'admin.register', (['Thread'], {}), '(Thread)\n', (492, 500), False, 'from django.contrib import admin\n'), ((860, 890), '... |
import os
import numpy as np
from sklearn.model_selection import train_test_split
from properties import dataset_path
def get_test_set(dataset_type):
if dataset_type == 'T':
y_gaze_angles = np.load(os.path.join(dataset_path, 'UnityEyes', 'dataset_y_gaze_angles_np.npy'))
y_gaze_train, y_gaze_tes... | [
"sklearn.model_selection.train_test_split",
"os.path.join"
] | [((324, 387), 'sklearn.model_selection.train_test_split', 'train_test_split', (['y_gaze_angles'], {'test_size': '(0.2)', 'random_state': '(42)'}), '(y_gaze_angles, test_size=0.2, random_state=42)\n', (340, 387), False, 'from sklearn.model_selection import train_test_split\n'), ((214, 285), 'os.path.join', 'os.path.join... |
import numpy as np
import cv2
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
cap = cv2.VideoCapture(0)
while 1:
ret, img = cap.read()
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
check = False
for (x, y, w, h) in fac... | [
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.rectangle",
"cv2.CascadeClassifier",
"cv2.destroyAllWindows"
] | [((46, 106), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haarcascade_frontalface_default.xml"""'], {}), "('haarcascade_frontalface_default.xml')\n", (67, 106), False, 'import cv2\n'), ((114, 133), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (130, 133), False, 'import cv2\n'), ((605, 628)... |
# Copyright (c) 2011 - 2017, Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | [
"json.loads",
"json.dumps"
] | [((1356, 1374), 'json.loads', 'json.loads', (['ret[2]'], {}), '(ret[2])\n', (1366, 1374), False, 'import json\n'), ((2116, 2134), 'json.loads', 'json.loads', (['ret[2]'], {}), '(ret[2])\n', (2126, 2134), False, 'import json\n'), ((3106, 3124), 'json.loads', 'json.loads', (['ret[2]'], {}), '(ret[2])\n', (3116, 3124), Fa... |
import os
from initializer import App
import unittest
BASE_PATH = os.getcwd()
app = App(BASE_PATH)
test_path = BASE_PATH + "/School"
encrypted_path = BASE_PATH + "/.eu/data/School"
test_path_without_base_path = "/School"
class Internal_Methods(unittest.TestCase):
def testing_conversion_of_path_without_base_pat... | [
"os.getcwd",
"unittest.main",
"initializer.App"
] | [((67, 78), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (76, 78), False, 'import os\n'), ((86, 100), 'initializer.App', 'App', (['BASE_PATH'], {}), '(BASE_PATH)\n', (89, 100), False, 'from initializer import App\n'), ((1422, 1437), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1435, 1437), False, 'import unittes... |
'''
Description: A class file for our database to define each table
'''
from . import db
import uuid
import os
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
class User(db.Model):
__tablename__="user"
id = db.Column(db.Integer, primary_key=True)
... | [
"werkzeug.security.check_password_hash",
"os.getenv",
"werkzeug.security.generate_password_hash"
] | [((1889, 1911), 'os.getenv', 'os.getenv', (['"""FLASK_ENV"""'], {}), "('FLASK_ENV')\n", (1898, 1911), False, 'import os\n'), ((1744, 1776), 'werkzeug.security.generate_password_hash', 'generate_password_hash', (['password'], {}), '(password)\n', (1766, 1776), False, 'from werkzeug.security import generate_password_hash... |
#!/usr/bin/env python
#
# Downloads cubieboard2.img to a board that is running an initramfs,
# power cycles the board, and verifies that the first boot is successful.
# This is similar to pyboot but is used for a later stage.
from __future__ import print_function
import hashlib
import os
import pexpect
import sys
co... | [
"hashlib.md5",
"os.path.join",
"os.getenv"
] | [((440, 474), 'os.path.join', 'os.path.join', (['tftp_dir', 'image_name'], {}), '(tftp_dir, image_name)\n', (452, 474), False, 'import os\n'), ((516, 533), 'os.getenv', 'os.getenv', (['"""USER"""'], {}), "('USER')\n", (525, 533), False, 'import os\n'), ((747, 760), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (758, ... |
"""Tests for service authentication"""
import copy
import os
import sys
from binascii import hexlify
from unittest import mock
from urllib.parse import parse_qs
from urllib.parse import urlparse
import pytest
from pytest import raises
from tornado.httputil import url_concat
from .. import orm
from .. import roles
fro... | [
"copy.deepcopy",
"tornado.httputil.url_concat",
"urllib.parse.parse_qs",
"unittest.mock.patch",
"pytest.raises",
"pytest.mark.parametrize",
"os.urandom",
"urllib.parse.urlparse"
] | [((599, 649), 'unittest.mock.patch', 'mock.patch', (['"""time.monotonic"""', '(lambda : sys.maxsize)'], {}), "('time.monotonic', lambda : sys.maxsize)\n", (609, 649), False, 'from unittest import mock\n'), ((3093, 3306), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""scopes, allowed"""', "[(['db:services']... |
from pathlib import Path
import pickle
import gzip
import requests
import torch
import math
DATA_PATH = Path("data")
PATH = DATA_PATH / "mnist"
PATH.mkdir(parents=True, exist_ok=True)
URL = "http://deeplearning.net/data/mnist/"
FILENAME = "mnist.pkl.gz"
if not (PATH / FILENAME).exists():
CONTENT = requests.get(... | [
"math.sqrt",
"torch.argmax",
"torch.randn",
"pathlib.Path",
"pickle.load",
"requests.get",
"torch.zeros"
] | [((106, 118), 'pathlib.Path', 'Path', (['"""data"""'], {}), "('data')\n", (110, 118), False, 'from pathlib import Path\n'), ((728, 763), 'torch.zeros', 'torch.zeros', (['(10)'], {'requires_grad': '(True)'}), '(10, requires_grad=True)\n', (739, 763), False, 'import torch\n'), ((498, 532), 'pickle.load', 'pickle.load', (... |
"""
This module contains tests for event schemas.
"""
import pytest
from hypothesis import given, strategies as st
from .utilities import EVENT_VALID_MAP as VALID_MAP, EVENT_INVALID_MAP as INVALID_MAP
from ..utilities import xfail_from_kw, success_from_kw
from spacenet.schemas import Event
pytestmark = [pytest.mark.... | [
"hypothesis.strategies.fixed_dictionaries"
] | [((784, 824), 'hypothesis.strategies.fixed_dictionaries', 'st.fixed_dictionaries', ([], {'mapping': 'VALID_MAP'}), '(mapping=VALID_MAP)\n', (805, 824), True, 'from hypothesis import given, strategies as st\n'), ((897, 983), 'hypothesis.strategies.fixed_dictionaries', 'st.fixed_dictionaries', ([], {'mapping': "{**VALID_... |
import numpy as np
import scipy.linalg
def register_points(P, Q, allowReflection = False):
'''
Find the best-fit rigid transformation aligning points in Q to points in P:
min_(R, t) sum_i ||P_i - (R Q_i + t)||^2
Parameters
----------
P : (N, D) array_like
Collection of N points... | [
"numpy.linalg.det",
"numpy.mean",
"numpy.linalg.eig",
"numpy.sqrt"
] | [((582, 600), 'numpy.mean', 'np.mean', (['P'], {'axis': '(0)'}), '(P, axis=0)\n', (589, 600), True, 'import numpy as np\n'), ((635, 653), 'numpy.mean', 'np.mean', (['Q'], {'axis': '(0)'}), '(Q, axis=0)\n', (642, 653), True, 'import numpy as np\n'), ((1350, 1368), 'numpy.mean', 'np.mean', (['V'], {'axis': '(0)'}), '(V, ... |
from flask import Flask, render_template, request
from processing import calculate
app = Flask(__name__)
@app.route('/')
def main():
return render_template('app.html')
@app.route('/send', methods=['POST'])
def send(sum=sum):
if request.method == 'POST':
principal = int(request.form['principal'])
... | [
"flask.Flask",
"processing.calculate",
"flask.render_template"
] | [((90, 105), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (95, 105), False, 'from flask import Flask, render_template, request\n'), ((147, 174), 'flask.render_template', 'render_template', (['"""app.html"""'], {}), "('app.html')\n", (162, 174), False, 'from flask import Flask, render_template, request\n'... |
from anndata import read_h5ad
import sys
from time import time
from scipy import stats, sparse
import numpy as np
import collections
import pickle
from sklearn.preprocessing import normalize
import os
from collections import Counter
from scipy import spatial
from sklearn.model_selection import train_test_split
from skl... | [
"numpy.sum",
"numpy.argmax",
"numpy.ones",
"collections.defaultdict",
"numpy.shape",
"numpy.mean",
"sys.stdout.flush",
"numpy.linalg.norm",
"sklearn.utils.graph_shortest_path.graph_shortest_path",
"numpy.diag",
"numpy.unique",
"sklearn.metrics.pairwise.cosine_similarity",
"numpy.copy",
"sc... | [((1270, 1304), 'numpy.concatenate', 'np.concatenate', (['(seen_l, unseen_l)'], {}), '((seen_l, unseen_l))\n', (1284, 1304), True, 'import numpy as np\n'), ((1412, 1441), 'collections.defaultdict', 'collections.defaultdict', (['dict'], {}), '(dict)\n', (1435, 1441), False, 'import collections\n'), ((1453, 1473), 'numpy... |
import datetime
from aiohttp import ClientSession
from fastapi import FastAPI, HTTPException, status
from fastapi.encoders import jsonable_encoder
from fastapi.responses import JSONResponse
import schemas
from communication import send_requests
from config.config_provider import config
from config.logger import arbite... | [
"communication.send_requests.send_request_to_data_nodes",
"config.logger.arbiter_logger.get_logger",
"aiohttp.ClientSession",
"schemas.ClearDataRequest.parse_obj",
"communication.send_requests.start_map_phase",
"local_database.utils.FileDBManager",
"communication.send_requests.generate_hash_ranges",
"... | [((404, 439), 'config.logger.arbiter_logger.get_logger', 'arbiter_logger.get_logger', (['__name__'], {}), '(__name__)\n', (429, 439), False, 'from config.logger import arbiter_logger\n'), ((447, 456), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (454, 456), False, 'from fastapi import FastAPI, HTTPException, status\... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import tqdm
def fitness(length):
return 1 / length
def route_length(route, distance_matrix):
n = route.size
idx = np.concatenate((route, [route[0]]))
length = np.sum(distance_matrix[idx[:n], idx[1:n+1]... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.savefig",
"numpy.flip",
"numpy.sum",
"matplotlib.pyplot.plot",
"tqdm.trange",
"matplotlib.pyplot.show",
"numpy.ceil",
"numpy.zeros",
"numpy.argsort",
"numpy.random.randint",
"numpy.array",
"numpy.linalg.norm",
"numpy.random.choice",
"numpy.ra... | [((229, 264), 'numpy.concatenate', 'np.concatenate', (['(route, [route[0]])'], {}), '((route, [route[0]]))\n', (243, 264), True, 'import numpy as np\n'), ((278, 324), 'numpy.sum', 'np.sum', (['distance_matrix[idx[:n], idx[1:n + 1]]'], {}), '(distance_matrix[idx[:n], idx[1:n + 1]])\n', (284, 324), True, 'import numpy as... |
#!/usr/bin/env python3
# Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice... | [
"tinycudann.Network",
"torch.rand"
] | [((1839, 1872), 'torch.rand', 'torch.rand', (['(256)', '(3)'], {'device': '"""cuda"""'}), "(256, 3, device='cuda')\n", (1849, 1872), False, 'import torch\n'), ((1915, 1948), 'torch.rand', 'torch.rand', (['(256)', '(3)'], {'device': '"""cuda"""'}), "(256, 3, device='cuda')\n", (1925, 1948), False, 'import torch\n'), ((1... |
import utils as ut
import random
import time
class Event:
def __init__(self, user):
self.user = user
self.date = time.strftime('%Y-%m-%d', ut.random_date_time())
btime = ut.random_date_time()
self.begin_time = time.strftime('%H:%M:%S', btime)
self.end_time = time.strftime('... | [
"utils.random_date_time",
"random.randint",
"time.strftime",
"utils.random_time_gt",
"utils.find_element_id"
] | [((200, 221), 'utils.random_date_time', 'ut.random_date_time', ([], {}), '()\n', (219, 221), True, 'import utils as ut\n'), ((248, 280), 'time.strftime', 'time.strftime', (['"""%H:%M:%S"""', 'btime'], {}), "('%H:%M:%S', btime)\n", (261, 280), False, 'import time\n'), ((381, 401), 'random.randint', 'random.randint', (['... |
#!/usr/bin/env pypy3 python3
import os
import time
import glob
import pandas as pd
import sys
import matplotlib.pyplot as plt
import seaborn as sns
from collections import OrderedDict
from decimal import Decimal
from scipy.stats import hypergeom
import math
import mechanize
from urllib.error import HTTPError
import nu... | [
"os.remove",
"argparse.ArgumentParser",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"glob.glob",
"matplotlib.pyplot.tick_params",
"sys.setrecursionlimit",
"matplotlib.pyplot.hlines",
"os.path.join",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.cm.ScalarMappable",
"collections.OrderedDict.... | [((357, 368), 'time.time', 'time.time', ([], {}), '()\n', (366, 368), False, 'import time\n'), ((374, 385), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (383, 385), False, 'import os\n'), ((421, 490), 'glob.glob', 'glob.glob', (["(wd + '/' + 'Functional-datafiles' + '/' + 'conversation/*')"], {}), "(wd + '/' + 'Function... |
import uuid
from django.shortcuts import get_object_or_404, render_to_response
from django.http import HttpResponseBadRequest
from django.views.decorators.http import require_POST
from django.forms.models import modelformset_factory
from models import Ticket,TicketGroup
TicketFormSet = modelformset_factory(Ticket, ext... | [
"django.shortcuts.render_to_response",
"uuid.uuid4",
"models.TicketGroup.objects.all",
"models.Ticket.objects.filter",
"django.http.HttpResponseBadRequest",
"django.shortcuts.get_object_or_404",
"django.forms.models.modelformset_factory"
] | [((288, 325), 'django.forms.models.modelformset_factory', 'modelformset_factory', (['Ticket'], {'extra': '(0)'}), '(Ticket, extra=0)\n', (308, 325), False, 'from django.forms.models import modelformset_factory\n'), ((766, 809), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['TicketGroup'], {'pk': 'group_i... |
import os
import bpy
import addon_utils
import bmesh
import math
from bpy import context as C
from mathutils import Vector
from bpy_extras.object_utils import world_to_camera_view
class Importer:
def __init__(self, file_path, blender_config):
self.__file_path = file_path
self.__blender_config = b... | [
"bpy.ops.wm.save_as_mainfile",
"bpy.ops.mesh.flip_normals",
"bpy_extras.object_utils.world_to_camera_view",
"bpy.ops.mesh.separate",
"bmesh.ops.bisect_plane",
"bmesh.update_edit_mesh",
"bpy.ops.object.delete",
"bmesh.from_edit_mesh",
"mathutils.Vector",
"bpy.data.materials.new",
"bpy.ops.object.... | [((668, 710), 'bpy.ops.object.select_all', 'bpy.ops.object.select_all', ([], {'action': '"""SELECT"""'}), "(action='SELECT')\n", (693, 710), False, 'import bpy\n'), ((719, 757), 'bpy.ops.object.delete', 'bpy.ops.object.delete', ([], {'use_global': '(True)'}), '(use_global=True)\n', (740, 757), False, 'import bpy\n'), (... |
import plotnine as p9
class Theme(p9.themes.theme_bw):
'''
Tufte Maximal Data, Minimal Ink Theme
Theme based on Chapter 6 'Data-Ink Maximization and Graphical
Design of Edward Tufte *The Visual Display of Quantitative
Information*. No border, no axis lines, no grids. This theme
works best in co... | [
"plotnine.themes.theme_bw.__init__",
"plotnine.themes.elements.element_blank"
] | [((1324, 1381), 'plotnine.themes.theme_bw.__init__', 'p9.themes.theme_bw.__init__', (['self', 'base_size', 'base_family'], {}), '(self, base_size, base_family)\n', (1351, 1381), True, 'import plotnine as p9\n'), ((1469, 1503), 'plotnine.themes.elements.element_blank', 'p9.themes.elements.element_blank', ([], {}), '()\n... |
"""This Module was inspired by
@TwitFace 's https://t.me/c/1356929597/86989"""
from telethon.tl.functions.help import GetAppConfigRequest
from telethon.tl.functions.messages import GetStickerSetRequest
from telethon.tl.types import InputStickerSetDice
from uniborg.util import admin_cmd
@borg.on(admin_cmd(pattern="w... | [
"uniborg.util.admin_cmd",
"telethon.tl.types.InputStickerSetDice",
"telethon.tl.functions.help.GetAppConfigRequest"
] | [((300, 343), 'uniborg.util.admin_cmd', 'admin_cmd', ([], {'pattern': '"""watmg"""', 'allow_sudo': '(True)'}), "(pattern='watmg', allow_sudo=True)\n", (309, 343), False, 'from uniborg.util import admin_cmd\n'), ((458, 479), 'telethon.tl.functions.help.GetAppConfigRequest', 'GetAppConfigRequest', ([], {}), '()\n', (477,... |
# -*- coding: utf-8 -*-
import threading
import time
class AdvancedThread(threading.Thread):
def __init__(self):
super().__init__()
self._running = threading.Event()
self.setDaemon(True)
self.created()
def run(self) -> None:
self._running.set()
self.mounted()
... | [
"threading.Event",
"time.sleep"
] | [((170, 187), 'threading.Event', 'threading.Event', ([], {}), '()\n', (185, 187), False, 'import threading\n'), ((727, 740), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (737, 740), False, 'import time\n')] |
import pytest
import parallel
from parallel.models import ParallelJob
from ..base import *
# Tests:
####################
# Single Parameter #
####################
def test_map_dict_basic_single_param():
results = parallel.map(sleep_return_single_param, {
'r1': .2,
'r2': .3
})
assert resu... | [
"parallel.models.ParallelJob",
"pytest.raises",
"parallel.arg",
"parallel.map"
] | [((221, 284), 'parallel.map', 'parallel.map', (['sleep_return_single_param', "{'r1': 0.2, 'r2': 0.3}"], {}), "(sleep_return_single_param, {'r1': 0.2, 'r2': 0.3})\n", (233, 284), False, 'import parallel\n'), ((502, 578), 'parallel.map', 'parallel.map', (['sleep_return_multi_param', "{'r1': (0.2, 'a'), 'r2': (0.3, 'b')}"... |
import enum
import logging
from sqlalchemy.sql import func
from drovirt.models.base import db, SerializerMixin
from drovirt.models.node import Node
logger = logging.getLogger(__name__)
class TaskStatus(enum.Enum):
QUEUED = "QUEUED"
ACTIVE = "ACTIVE"
COMPLETED = "COMPLETED"
FAILED = "FAILED"
class... | [
"sqlalchemy.sql.func.now",
"drovirt.models.base.db.backref",
"drovirt.models.base.db.ForeignKey",
"drovirt.models.base.db.Enum",
"drovirt.models.base.db.String",
"drovirt.models.base.db.Column",
"logging.getLogger"
] | [((160, 187), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (177, 187), False, 'import logging\n'), ((390, 429), 'drovirt.models.base.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (399, 429), False, 'from drovirt.models.base imp... |
import errno
import os
import pickle
import numpy
from utilities_nn.ResourceManager import ResourceManager
class WordVectorsManager(ResourceManager):
def __init__(self, corpus=None, dim=None, omit_non_english=False):
super().__init__()
self.omit_non_english = omit_non_english
self.wv_filena... | [
"pickle.dump",
"os.path.dirname",
"numpy.asarray",
"os.path.exists",
"pickle.load",
"os.strerror"
] | [((721, 754), 'os.path.exists', 'os.path.exists', (['_word_vector_file'], {}), '(_word_vector_file)\n', (735, 754), False, 'import os\n'), ((2352, 2380), 'os.path.exists', 'os.path.exists', (['_parsed_file'], {}), '(_parsed_file)\n', (2366, 2380), False, 'import os\n'), ((640, 665), 'os.path.dirname', 'os.path.dirname'... |
from chalice import Chalice, Rate
import logging
app = Chalice(app_name='chalice-lambdas')
app.log.setLevel(logging.DEBUG)
@app.route('/')
def index():
return {'message': 'Olar Chalice!'}
@app.route('/batatinhas')
def batatinhas():
return {'message': 'Olar batatinhas!'}
@app.route('/query')
def query():... | [
"chalice.Rate",
"chalice.Chalice"
] | [((57, 92), 'chalice.Chalice', 'Chalice', ([], {'app_name': '"""chalice-lambdas"""'}), "(app_name='chalice-lambdas')\n", (64, 92), False, 'from chalice import Chalice, Rate\n'), ((697, 723), 'chalice.Rate', 'Rate', (['(1)'], {'unit': 'Rate.MINUTES'}), '(1, unit=Rate.MINUTES)\n', (701, 723), False, 'from chalice import ... |
from django.contrib import admin
from app.models import (
Quotation,
Security,
CompanyDetails,
VirtualPurchase,
Watchlist,
Sector,
MarketQuoteCache
)
from app.paginator import NoCountPaginator
@admin.register(Quotation)
class QuoteAdmin(admin.ModelAdmin):
#date_hierarchy = 'year_high_da... | [
"django.contrib.admin.register"
] | [((223, 248), 'django.contrib.admin.register', 'admin.register', (['Quotation'], {}), '(Quotation)\n', (237, 248), False, 'from django.contrib import admin\n'), ((637, 661), 'django.contrib.admin.register', 'admin.register', (['Security'], {}), '(Security)\n', (651, 661), False, 'from django.contrib import admin\n'), (... |
import unittest
import requests
from service import create_user
from unittest.mock import patch, Mock
import json
class TestService(unittest.TestCase):
@patch.object(requests, 'post')
def test_create_user(self, mock_post):
mock_json = Mock()
mock_json.return_value = 'mock data'
mock_po... | [
"unittest.main",
"unittest.mock.patch.object",
"unittest.mock.Mock",
"json.dumps",
"service.create_user"
] | [((159, 189), 'unittest.mock.patch.object', 'patch.object', (['requests', '"""post"""'], {}), "(requests, 'post')\n", (171, 189), False, 'from unittest.mock import patch, Mock\n'), ((629, 644), 'unittest.main', 'unittest.main', ([], {}), '()\n', (642, 644), False, 'import unittest\n'), ((253, 259), 'unittest.mock.Mock'... |
"""Check if a bugs.python.org issue number is specified in the pull request's title."""
import re
from gidgethub import routing
from . import util
router = routing.Router()
TAG_NAME = "issue-number"
CLOSING_TAG = f"<!-- /{TAG_NAME} -->"
BODY = f"""\
{{body}}
<!-- {TAG_NAME}: bpo-{{issue_number}} -->
https://bugs.p... | [
"gidgethub.routing.Router",
"re.compile"
] | [((160, 176), 'gidgethub.routing.Router', 'routing.Router', ([], {}), '()\n', (174, 176), False, 'from gidgethub import routing\n'), ((382, 415), 're.compile', 're.compile', (['"""bpo-(?P<issue>\\\\d+)"""'], {}), "('bpo-(?P<issue>\\\\d+)')\n", (392, 415), False, 'import re\n')] |
from django.dispatch import Signal
match_forfeit = Signal(providing_args=["match", "team"])
score_updated = Signal(providing_args=["match"])
| [
"django.dispatch.Signal"
] | [((52, 92), 'django.dispatch.Signal', 'Signal', ([], {'providing_args': "['match', 'team']"}), "(providing_args=['match', 'team'])\n", (58, 92), False, 'from django.dispatch import Signal\n'), ((109, 141), 'django.dispatch.Signal', 'Signal', ([], {'providing_args': "['match']"}), "(providing_args=['match'])\n", (115, 1... |
"""
@Description: 训练器
@version: 1.0.0
@License: MIT
@Author: <NAME>
@Date: 2020-11-30 11:31:00
@LastEditors: <NAME>
@LastEditTime: 2020-12-02 17:36:01
"""
import os
from tensorflow.keras.models import Model
from tensorflow.keras.callbacks import Callback
from tensorflow.keras.callbacks import EarlyStopping
class Repo... | [
"os.path.join",
"tensorflow.keras.callbacks.EarlyStopping"
] | [((2791, 2835), 'os.path.join', 'os.path.join', (['self._save_path', 'self._version'], {}), '(self._save_path, self._version)\n', (2803, 2835), False, 'import os\n'), ((2001, 2045), 'os.path.join', 'os.path.join', (['self._save_path', 'self._version'], {}), '(self._save_path, self._version)\n', (2013, 2045), False, 'im... |
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from Script.preprocess_data import clean_data
from Script.train import train_using_logistic_regression
def get_data():
urls = ["https://risingnepaldaily.com/main-news"]
driver = set_up_driver()
headlines = []
for ur... | [
"Script.preprocess_data.clean_data",
"Script.train.train_using_logistic_regression",
"selenium.webdriver.ChromeOptions",
"webdriver_manager.chrome.ChromeDriverManager"
] | [((862, 883), 'Script.preprocess_data.clean_data', 'clean_data', (['headlines'], {}), '(headlines)\n', (872, 883), False, 'from Script.preprocess_data import clean_data\n'), ((924, 961), 'Script.train.train_using_logistic_regression', 'train_using_logistic_regression', (['data'], {}), '(data)\n', (955, 961), False, 'fr... |