code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
# Copyright 2013-2014, <NAME>, <EMAIL>
#
# Part of 'hiss' the asynchronous notification library
import os
import sys
sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import pytest
from hiss.encryption import EncryptionInfo
def test_Encryption... | [
"pytest.raises",
"os.path.dirname",
"hiss.encryption.EncryptionInfo"
] | [((460, 496), 'hiss.encryption.EncryptionInfo', 'EncryptionInfo', (['"""AES"""', "b'1111111111'"], {}), "('AES', b'1111111111')\n", (474, 496), False, 'from hiss.encryption import EncryptionInfo\n'), ((698, 734), 'hiss.encryption.EncryptionInfo', 'EncryptionInfo', (['"""AES"""', "b'1111111111'"], {}), "('AES', b'111111... |
import sys
from collections import namedtuple
Point = namedtuple('Point', 'x,y')
ai = False
class SokobanMap:
"""
Instance of a Sokoban game map. You may use this class and its functions
directly or duplicate and modify it in your solution. You should avoid
modifying this file directly.
COMP3702... | [
"sys.stdin.read",
"collections.namedtuple"
] | [((55, 81), 'collections.namedtuple', 'namedtuple', (['"""Point"""', '"""x,y"""'], {}), "('Point', 'x,y')\n", (65, 81), False, 'from collections import namedtuple\n'), ((11129, 11146), 'sys.stdin.read', 'sys.stdin.read', (['(1)'], {}), '(1)\n', (11143, 11146), False, 'import sys\n')] |
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 26 21:00:01 2020
@author: Meet
"""
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
import models.MobileNet_v2_config as MobileNet_v2_config
from models.MobileNet_v2_config import g
class MobileNet_v2:
def __init__(self, input_dims=(64, 64)... | [
"tensorflow.nn.softmax",
"tensorflow.contrib.layers.l2_regularizer",
"tensorflow.reduce_mean",
"tensorflow.nn.depthwise_conv2d",
"tensorflow.variable_scope",
"models.MobileNet_v2_config.g",
"tensorflow.layers.conv2d",
"tensorflow.squeeze",
"tensorflow.nn.relu6",
"tensorflow.layers.batch_normalizat... | [((442, 490), 'tensorflow.contrib.layers.variance_scaling_initializer', 'tf.contrib.layers.variance_scaling_initializer', ([], {}), '()\n', (488, 490), True, 'import tensorflow as tf\n'), ((678, 750), 'tensorflow.contrib.layers.l2_regularizer', 'tf.contrib.layers.l2_regularizer', ([], {'scale': 'MobileNet_v2_config.wei... |
'''Its an collection of usefull/repeated functions. It has traditional funcction as well as lambda'''
# =================LIST OPERATIONS===================#
def findDiff(first, second):
second = set(second)
return [item for item in first if item not in second]
# findDiff = lambda first, second: [item for it... | [
"collections.Counter",
"tldextract.extract"
] | [((1076, 1099), 'tldextract.extract', 'tldextract.extract', (['url'], {}), '(url)\n', (1094, 1099), False, 'import tldextract\n'), ((438, 460), 'collections.Counter', 'collections.Counter', (['x'], {}), '(x)\n', (457, 460), False, 'import collections\n')] |
"""Transform metrics stored in SQuaSH into InfluxDB format.
See sqr-009.lsst.io for a description on how metrics are stored in SQuaSH and
the resulting InfluxDB data model.
"""
__all__ = ["Transformer"]
import logging
import math
import pathlib
import urllib.parse
import requests
import yaml
from requests.exception... | [
"squash.tasks.utils.format.Formatter.format_influxdb_line",
"yaml.load",
"math.isnan",
"squash.tasks.utils.format.Formatter.format_timestamp",
"pathlib.Path",
"squash.tasks.utils.format.Formatter.sanitize",
"requests.get",
"logging.getLogger"
] | [((415, 442), 'logging.getLogger', 'logging.getLogger', (['"""squash"""'], {}), "('squash')\n", (432, 442), False, 'import logging\n'), ((2711, 2764), 'squash.tasks.utils.format.Formatter.format_timestamp', 'Formatter.format_timestamp', (["self.data['date_created']"], {}), "(self.data['date_created'])\n", (2737, 2764),... |
#!/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
#
# Copyright (C) 2019 <NAME> (<EMAIL>)
#
# 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/licen... | [
"Crypto.Cipher.Blowfish.new"
] | [((1683, 1723), 'Crypto.Cipher.Blowfish.new', 'Blowfish.new', (['key', 'Blowfish.MODE_CBC', 'iv'], {}), '(key, Blowfish.MODE_CBC, iv)\n', (1695, 1723), False, 'from Crypto.Cipher import Blowfish\n')] |
import hashlib
from time import time
from aiohttp import web
from aiohttp_session import get_session
from app.core.models.participant import Participant
routes = web.RouteTableDef()
def set_session(session, user_id, request):
session['email'] = str(user_id)
session['last_visit'] = time()
@routes.post('/lo... | [
"aiohttp.web.RouteTableDef",
"aiohttp_session.get_session",
"app.core.models.participant.Participant.make_transaction",
"aiohttp.web.json_response",
"time.time",
"app.core.models.participant.Participant.get_transactions",
"app.core.models.participant.Participant.create",
"app.core.models.participant.P... | [((164, 183), 'aiohttp.web.RouteTableDef', 'web.RouteTableDef', ([], {}), '()\n', (181, 183), False, 'from aiohttp import web\n'), ((294, 300), 'time.time', 'time', ([], {}), '()\n', (298, 300), False, 'from time import time\n'), ((492, 537), 'app.core.models.participant.Participant.get', 'Participant.get', (['request.... |
# Generated by Django 2.1.2 on 2019-08-29 07:41
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | [
"django.db.models.OneToOneField",
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.AutoField",
"django.db.models.IntegerField"
] | [((247, 304), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (278, 304), False, 'from django.db import migrations, models\n'), ((2816, 2934), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', '... |
import click
@click.command()
def cli(args=None):
"""Console script for multi_notifier."""
click.echo("Replace this message by putting your code into "
"multi_notifier.cli.cli")
click.echo("See click documentation at https://click.palletsprojects.com/")
return 0
| [
"click.echo",
"click.command"
] | [((17, 32), 'click.command', 'click.command', ([], {}), '()\n', (30, 32), False, 'import click\n'), ((102, 190), 'click.echo', 'click.echo', (['"""Replace this message by putting your code into multi_notifier.cli.cli"""'], {}), "(\n 'Replace this message by putting your code into multi_notifier.cli.cli')\n", (112, 1... |
"""basic array functions"""
import multiprocessing
import warnings
import numpy as np
try:
import numexpr
numexpr.set_num_threads(multiprocessing.cpu_count())
numexpr.set_vml_num_threads(multiprocessing.cpu_count())
except ImportError:
warnings.warn('numexpr not detected, use `sudo pip install numexp... | [
"numpy.sum",
"numpy.nan_to_num",
"numpy.copy",
"numpy.zeros",
"numexpr.evaluate",
"numpy.isnan",
"warnings.warn",
"numpy.concatenate",
"multiprocessing.cpu_count"
] | [((559, 593), 'numpy.zeros', 'np.zeros', (['array.shape'], {'dtype': 'dtype'}), '(array.shape, dtype=dtype)\n', (567, 593), True, 'import numpy as np\n'), ((605, 660), 'numexpr.evaluate', 'numexpr.evaluate', (['"""array"""'], {'out': 'result', 'casting': '"""unsafe"""'}), "('array', out=result, casting='unsafe')\n", (6... |
from django.contrib import admin
from .models import Deterrent
from .models import DeterrenceCampaign
from .models import DeterrenceMessage
class DeterrenceMessageInline(admin.TabularInline):
model = DeterrenceMessage
readonly_fields = ('date_created',
'status',
... | [
"django.contrib.admin.register"
] | [((914, 939), 'django.contrib.admin.register', 'admin.register', (['Deterrent'], {}), '(Deterrent)\n', (928, 939), False, 'from django.contrib import admin\n'), ((992, 1026), 'django.contrib.admin.register', 'admin.register', (['DeterrenceCampaign'], {}), '(DeterrenceCampaign)\n', (1006, 1026), False, 'from django.cont... |
import asyncio
import discord
import random
from discord.ext import commands
from Cogs import Settings
from Cogs import DisplayName
from Cogs import Nullify
import requests
class Star:
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True, no_pm=True)
async def randstar(self, c... | [
"discord.ext.commands.command",
"requests.get"
] | [((245, 292), 'discord.ext.commands.command', 'commands.command', ([], {'pass_context': '(True)', 'no_pm': '(True)'}), '(pass_context=True, no_pm=True)\n', (261, 292), False, 'from discord.ext import commands\n'), ((353, 411), 'requests.get', 'requests.get', (['"""https://sydneyerickson.me/starapi/rand.php"""'], {}), "... |
import pandas as pd
df = pd.read_csv('data/src/sample_pandas_normal.csv', index_col=0)
print(df)
# age state point
# name
# Alice 24 NY 64
# Bob 42 CA 92
# Charlie 18 CA 70
# Dave 68 TX 70
# Ellen 24 CA 88
# Frank 30 NY 5... | [
"pandas.read_csv"
] | [((26, 87), 'pandas.read_csv', 'pd.read_csv', (['"""data/src/sample_pandas_normal.csv"""'], {'index_col': '(0)'}), "('data/src/sample_pandas_normal.csv', index_col=0)\n", (37, 87), True, 'import pandas as pd\n')] |
from django.contrib import admin
from .models import Product, Category
# Pour pouvoir modifier les données de register depuis Product
# Dépuis admin ça permet d'ajouter du site ça permet de faire les modifications
admin.site.register(Product)
admin.site.register(Category)
# Register your models here.
| [
"django.contrib.admin.site.register"
] | [((215, 243), 'django.contrib.admin.site.register', 'admin.site.register', (['Product'], {}), '(Product)\n', (234, 243), False, 'from django.contrib import admin\n'), ((244, 273), 'django.contrib.admin.site.register', 'admin.site.register', (['Category'], {}), '(Category)\n', (263, 273), False, 'from django.contrib imp... |
import asyncio
import datetime
import random
import time
from nonebot.command import CommandSession
from nonebot.experimental.plugin import on_command
from aiocqhttp.message import MessageSegment # aiocqhttp 是 nonebot 的自带依赖
import requests
import json
__plugin_name__ = 'english'
__plugin_usage__ = '用法: 对我说 "english"... | [
"nonebot.experimental.plugin.on_command",
"json.loads",
"aiocqhttp.message.MessageSegment.image",
"time.strftime",
"time.mktime",
"datetime.timedelta",
"aiocqhttp.message.MessageSegment.record",
"requests.get",
"datetime.datetime.now",
"time.localtime"
] | [((334, 369), 'nonebot.experimental.plugin.on_command', 'on_command', (['"""english"""'], {'aliases': '"""英语"""'}), "('english', aliases='英语')\n", (344, 369), False, 'from nonebot.experimental.plugin import on_command\n'), ((423, 446), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (444, 446), Fals... |
#!/usr/bin/python3
"""Unit tests for checkimages script."""
#
# (C) Pywikibot team, 2015-2022
#
# Distributed under the terms of the MIT license.
#
import unittest
from pywikibot import FilePage
from scripts import checkimages
from tests.aspects import DefaultSiteTestCase, TestCase
class TestSettings(TestCase):
... | [
"unittest.main",
"pywikibot.FilePage",
"scripts.checkimages.CheckImagesBot.important_image"
] | [((1188, 1203), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1201, 1203), False, 'import unittest\n'), ((1022, 1072), 'scripts.checkimages.CheckImagesBot.important_image', 'checkimages.CheckImagesBot.important_image', (['images'], {}), '(images)\n', (1064, 1072), False, 'from scripts import checkimages\n'), ((1... |
# -*- coding: utf-8 -*-
import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy_redis_loadbalancing.spiders import RedisSpider
class TestSpider(RedisSpider):
name = 'test'
# allowed_domains = ['localhost']
# start_urls = ['http://localhost:8998/']
link_extractor = LinkExtractor()
... | [
"scrapy.linkextractors.LinkExtractor",
"scrapy.Request"
] | [((299, 314), 'scrapy.linkextractors.LinkExtractor', 'LinkExtractor', ([], {}), '()\n', (312, 314), False, 'from scrapy.linkextractors import LinkExtractor\n'), ((430, 475), 'scrapy.Request', 'scrapy.Request', (['link.url'], {'callback': 'self.parse'}), '(link.url, callback=self.parse)\n', (444, 475), False, 'import sc... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"sys.stdout.write",
"json.load",
"argparse.ArgumentParser",
"os.path.basename",
"numpy.zeros",
"os.path.exists",
"PIL.Image.open",
"sys.stdout.flush",
"numpy.array",
"PIL.Image.fromarray",
"os.path.join",
"numpy.concatenate"
] | [((2186, 2234), 'numpy.array', 'np.array', (["metadata['alphapose_input_size'][::-1]"], {}), "(metadata['alphapose_input_size'][::-1])\n", (2194, 2234), True, 'import numpy as np\n'), ((2250, 2285), 'numpy.array', 'np.array', (["metadata['size_LR'][::-1]"], {}), "(metadata['size_LR'][::-1])\n", (2258, 2285), True, 'imp... |
import collections
import copy
import datetime
import gc
import time
# import torch
import numpy as np
from util.logconf import logging
log = logging.getLogger(__name__)
# log.setLevel(logging.WARN)
# log.setLevel(logging.INFO)
log.setLevel(logging.DEBUG)
IrcTuple = collections.namedtuple('IrcTuple', ['index', 'row'... | [
"datetime.datetime.now",
"time.time",
"util.logconf.logging.getLogger",
"numpy.histogram",
"numpy.array",
"collections.namedtuple",
"numpy.linalg.inv",
"datetime.datetime.fromtimestamp",
"datetime.timedelta",
"numpy.round"
] | [((144, 171), 'util.logconf.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (161, 171), False, 'from util.logconf import logging\n'), ((270, 329), 'collections.namedtuple', 'collections.namedtuple', (['"""IrcTuple"""', "['index', 'row', 'col']"], {}), "('IrcTuple', ['index', 'row', 'col'])\... |
import os
import sys
import argparse
import datetime
import time
import os.path as osp
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import numpy as np
import torch
import torch.nn as nn
from torch.optim import lr_scheduler
import torch.backends.cudnn as cudnn
import datasets
import mod... | [
"os.mkdir",
"torch.optim.lr_scheduler.StepLR",
"argparse.ArgumentParser",
"torch.no_grad",
"os.path.join",
"models.create",
"utils.AverageMeter",
"matplotlib.pyplot.close",
"os.path.exists",
"datetime.timedelta",
"datasets.create",
"torch.manual_seed",
"matplotlib.pyplot.legend",
"center_l... | [((105, 126), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (119, 126), False, 'import matplotlib\n'), ((408, 454), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Center Loss Example"""'], {}), "('Center Loss Example')\n", (431, 454), False, 'import argparse\n'), ((1781, 1809), 'tor... |
# -*- coding: utf-8 -*-
#
#
# Author: alex
# Created Time: 2019年09月11日 星期三 18时12分55秒
from PIL import Image
from yolo import YOLO
from utils import parse_input_image, parse_output_image, \
format_input_path
# 识别模型配置
detect_configs = {
# 通用目标检测
'common': {
'model_path': 'model_data/yolov3-spp.h5',
... | [
"PIL.Image.open",
"utils.parse_output_image",
"utils.parse_input_image",
"utils.format_input_path",
"yolo.YOLO"
] | [((953, 974), 'yolo.YOLO', 'YOLO', ([], {}), '(**detect_config)\n', (957, 974), False, 'from yolo import YOLO\n'), ((2128, 2204), 'utils.parse_input_image', 'parse_input_image', ([], {'image': 'image', 'image_path': 'image_path', 'image_type': 'image_type'}), '(image=image, image_path=image_path, image_type=image_type)... |
from pytest import mark
from messages import show_count
@mark.parametrize('qty, expected', [
(1, '1 part'),
(2, '2 parts'),
(0, 'no parts'),
])
def test_show_count(qty: int, expected: str) -> None:
got = show_count(qty, 'part')
assert got == expected
# tag::TEST_IRREGULAR[]
@mark.parametrize('q... | [
"pytest.mark.parametrize",
"messages.show_count"
] | [((60, 147), 'pytest.mark.parametrize', 'mark.parametrize', (['"""qty, expected"""', "[(1, '1 part'), (2, '2 parts'), (0, 'no parts')]"], {}), "('qty, expected', [(1, '1 part'), (2, '2 parts'), (0,\n 'no parts')])\n", (76, 147), False, 'from pytest import mark\n'), ((301, 395), 'pytest.mark.parametrize', 'mark.param... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
#read in ipsilateral breast labelmap/volume
#mask this patient's breast
#generate histogram of intensity
#DIR to new patient's breast
#expand/dilate region (might need to be manual)
#mask new patient's breast
#generate histogram of intensity
# In[2]:
#import modules... | [
"SimpleITK.BinaryThreshold",
"SimpleITK.Resample",
"platipy.imaging.registration.registration.fast_symmetric_forces_demons_registration",
"SimpleITK.ConnectedComponent",
"SimpleITK.GetArrayViewFromImage",
"SimpleITK.ReadImage",
"SimpleITK.GetArrayFromImage",
"numpy.max",
"SimpleITK.BinaryMorphologic... | [((588, 648), 'SimpleITK.ReadImage', 'sitk.ReadImage', (['"""/home/alicja/Downloads/Segmentation.nii.gz"""'], {}), "('/home/alicja/Downloads/Segmentation.nii.gz')\n", (602, 648), True, 'import SimpleITK as sitk\n'), ((677, 850), 'SimpleITK.ReadImage', 'sitk.ReadImage', (['"""/home/alicja/Documents/WES_010/IMAGES/WES_01... |
import numpy as np
def hole_filling(img, kernel=3):
N, M = img.shape
for i in range(N):
for j in range(M):
if img[i, j] == 0:
neighbour = img[max(int((i-(kernel-1)/2)), 0):min(int((i+(kernel-1)/2)), N), max(int((j-(kernel-1)/2)),0):min(int((j+(kernel-1)/2)), M)]
... | [
"numpy.amax"
] | [((429, 447), 'numpy.amax', 'np.amax', (['neighbour'], {}), '(neighbour)\n', (436, 447), True, 'import numpy as np\n')] |
from django.conf import settings
from archiver.models import Tune, Setting, Competition, CompetitionRecording, TuneComment, CompetitionComment, Collection, CollectionEntry, CompetitionTuneVote, CompetitionRecordingVote
from actstream import action, actions, registry
#Tune = apps.get_model('archiver', 'Tune')
registry.... | [
"archiver.models.CompetitionRecordingVote.objects.all",
"archiver.models.CompetitionRecording.objects.all",
"archiver.models.CollectionEntry.objects.all",
"archiver.models.CompetitionTuneVote.objects.all",
"actstream.registry.register",
"archiver.models.TuneComment.objects.all",
"archiver.models.Competi... | [((311, 334), 'actstream.registry.register', 'registry.register', (['Tune'], {}), '(Tune)\n', (328, 334), False, 'from actstream import action, actions, registry\n'), ((393, 411), 'archiver.models.Tune.objects.all', 'Tune.objects.all', ([], {}), '()\n', (409, 411), False, 'from archiver.models import Tune, Setting, Com... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='blogcategory',
... | [
"django.db.migrations.AlterModelOptions",
"datetime.datetime"
] | [((253, 381), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""blogcategory"""', 'options': "{'ordering': ['name'], 'verbose_name_plural': 'Blog Categories'}"}), "(name='blogcategory', options={'ordering': [\n 'name'], 'verbose_name_plural': 'Blog Categories'})\n", (281, 38... |
from core.advbase import *
def module():
return Julietta
class Julietta(Adv):
conf = {}
conf['slots.a'] = ['Valiant_Crown','Primal_Crisis']
conf['slots.d'] = 'Gala_Thor'
conf['acl'] = """
`dragon, self.energy()<4
`s3, not buff(s3)
`s2
`s1
`s4, s1.charged<s1... | [
"core.simulate.test_with_argv"
] | [((539, 570), 'core.simulate.test_with_argv', 'test_with_argv', (['None', '*sys.argv'], {}), '(None, *sys.argv)\n', (553, 570), False, 'from core.simulate import test_with_argv\n')] |
"""
A set of functions that should not be publically accessible.
"""
from typing import List
import matplotlib.pyplot as plt
import numpy as np
def _preamble(
data, axis, plot_kwargs, positions, vertical_violins, sides="both"
):
if vertical_violins is True:
assert sides in ["both", "left", "right"]
... | [
"matplotlib.pyplot.subplots"
] | [((444, 458), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (456, 458), True, 'import matplotlib.pyplot as plt\n')] |
# !/usr/local/python/bin/python
# -*- coding: utf-8 -*-
# (C) <NAME>, 2020
# All rights reserved
# @Author: '<NAME> <<EMAIL>>'
# @Time: '2020-07-11 09:37'
from flask import Flask
from flask_redis import Redis
redis = Redis()
app = Flask(__name__)
app.config["REDIS_PREFIX"] = "EG:"
app.config["REDIS_URL"] = "redis://... | [
"flask_redis.Redis",
"flask.Flask"
] | [((218, 225), 'flask_redis.Redis', 'Redis', ([], {}), '()\n', (223, 225), False, 'from flask_redis import Redis\n'), ((232, 247), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (237, 247), False, 'from flask import Flask\n')] |
# -*- coding: utf-8 -*-
# how to use https://github.com/getsentry/responses
import json
import pytest
from aiohttp import web
from src import client_interface as api
payload = {"name": "", "date": "", "requests_sent": 0}
schemas = {
"post": {
"type": "object",
"properties": {
"name":... | [
"aiohttp.web.Response",
"aiohttp.web.Application",
"src.client_interface.post"
] | [((763, 780), 'aiohttp.web.Application', 'web.Application', ([], {}), '()\n', (778, 780), False, 'from aiohttp import web\n'), ((610, 661), 'aiohttp.web.Response', 'web.Response', ([], {'body': "{'successful': True}", 'status': '(200)'}), "(body={'successful': True}, status=200)\n", (622, 661), False, 'from aiohttp imp... |
"""FastStars specific catalog class."""
import codecs
import json
import os
from collections import OrderedDict
from datetime import datetime
from subprocess import check_output
from astrocats.catalog.catalog import Catalog
from astrocats.catalog.quantity import QUANTITY
from astrocats.catalog.utils import read_json_a... | [
"codecs.open",
"astrocats.catalog.utils.read_json_dict",
"os.path.dirname",
"subprocess.check_output",
"json.dumps",
"collections.OrderedDict",
"os.path.join"
] | [((3358, 3371), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (3369, 3371), False, 'from collections import OrderedDict\n'), ((3402, 3439), 'astrocats.catalog.utils.read_json_dict', 'read_json_dict', (['self.PATHS.BIBAUTHORS'], {}), '(self.PATHS.BIBAUTHORS)\n', (3416, 3439), False, 'from astrocats.catalog... |
#!/usr/bin/env python3
# Run a command on the hub.
# Guts were lifted from spikeprime-tools/spiketools/spikejsonrpcapispike.py
import base64
from comm.DirectConnectionMonitor import DirectConnectionMonitor
from comm.UsbConnectionMonitor import UsbConnectionMonitor
from comm.SerialConnection import SerialConnection
im... | [
"tempfile.NamedTemporaryFile",
"tqdm.tqdm",
"argparse.ArgumentParser",
"os.path.getsize",
"comm.UsbConnectionMonitor.UsbConnectionMonitor",
"os.path.dirname",
"data.HubMonitor.HubMonitor",
"random.choice",
"logging.getLogger",
"time.sleep",
"time.time",
"datetime.datetime.utcfromtimestamp",
... | [((618, 642), 'logging.getLogger', 'logging.getLogger', (['"""App"""'], {}), "('App')\n", (635, 642), False, 'import logging\n'), ((8100, 8171), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Tools for Spike Hub RPC protocol"""'}), "(description='Tools for Spike Hub RPC protocol')\n", (8... |
'''
adapted from Harry
'''
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
from pyPCGA import PCGA
# import mf
import math
import datetime as dt
import os
import sys
from poro import Model
#print(np.__version__)
# domain parameters
nx = 128
ny = 128
N... | [
"numpy.meshgrid",
"poro.Model",
"pyPCGA.PCGA",
"numpy.ones",
"matplotlib.use",
"numpy.array",
"numpy.loadtxt",
"numpy.linspace",
"numpy.exp",
"numpy.prod"
] | [((49, 70), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (63, 70), False, 'import matplotlib\n'), ((323, 341), 'numpy.array', 'np.array', (['[nx, ny]'], {}), '([nx, ny])\n', (331, 341), True, 'import numpy as np\n'), ((347, 357), 'numpy.prod', 'np.prod', (['N'], {}), '(N)\n', (354, 357), True, ... |
import os
from pathlib import Path
import sys
import time
from termcolor import colored
import traceback
from app.commands import Adventure
name = input("Welcome to the world, adventurer! What name would you like to be "
"known as in this land? \n")
adventure = Adventure(name)
print(f"Nice to meet you... | [
"app.commands.Adventure",
"os.path.dirname",
"time.time",
"termcolor.colored",
"traceback.format_exc",
"sys.exit"
] | [((279, 294), 'app.commands.Adventure', 'Adventure', (['name'], {}), '(name)\n', (288, 294), False, 'from app.commands import Adventure\n'), ((1501, 1512), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (1509, 1512), False, 'import sys\n'), ((594, 605), 'time.time', 'time.time', ([], {}), '()\n', (603, 605), False, 'i... |
import click
from the_price.search_engines.search_engine import SearchEngine
@click.command()
@click.argument('item', type=click.STRING)
@click.option('--shop', help='Narrow done the search to a specific shop')
def ask_the_price_of(item, shop):
"""Main function to get the price of an item from a specific shop.
... | [
"click.argument",
"click.echo",
"click.option",
"click.command",
"the_price.search_engines.search_engine.SearchEngine"
] | [((79, 94), 'click.command', 'click.command', ([], {}), '()\n', (92, 94), False, 'import click\n'), ((96, 137), 'click.argument', 'click.argument', (['"""item"""'], {'type': 'click.STRING'}), "('item', type=click.STRING)\n", (110, 137), False, 'import click\n'), ((139, 211), 'click.option', 'click.option', (['"""--shop... |
import os
from optparse import OptionParser
import appstore_scrape
import play_scrape
# Constants
PLATFORM_ANDROID_FILENAME_SUFFIX = 'android'
PLATFORM_IOS_FILENAME_SUFFIX = 'ios'
def append_platform_to_filename(base_filename, platform_suffix):
"""
Appends the platform suffix to the end of the file name
... | [
"appstore_scrape.save_page_reviews",
"play_scrape.save_page_reviews",
"os.path.splitext",
"optparse.OptionParser"
] | [((534, 565), 'os.path.splitext', 'os.path.splitext', (['base_filename'], {}), '(base_filename)\n', (550, 565), False, 'import os\n'), ((672, 746), 'optparse.OptionParser', 'OptionParser', ([], {'usage': '"""usage: %prog [options] filename"""', 'version': '"""%prog 1.0"""'}), "(usage='usage: %prog [options] filename', ... |
from django.urls import path
from . import views
from rest_framework.authtoken.views import obtain_auth_token
urlpatterns = [
path('maps/map/', views.mapView.as_view(), name='map'),
path('maps/map_image/', views.mapImageView.as_view(), name='map_image'),
path('maps/duplicate_map/', views.duplicateMapView.a... | [
"django.urls.path"
] | [((4973, 5043), 'django.urls.path', 'path', (['"""authentication/get_token/"""', 'obtain_auth_token'], {'name': '"""get_token"""'}), "('authentication/get_token/', obtain_auth_token, name='get_token')\n", (4977, 5043), False, 'from django.urls import path\n')] |
# Copyright (c) 2021. <NAME>
#
# This software is licensed under the The MIT License.
# You should have received a copy of the license terms with the software.
# Otherwise, you can find the text here: https://opensource.org/licenses/MIT
#
#
# This software is licensed under the The MIT License.
# You should have... | [
"textstat.textstat.text_standard",
"textstat.textstat.sentence_count",
"fairest.models.RuleDescription",
"textstat.textstat.lexicon_count",
"textstat.textstat.avg_sentence_length",
"textstat.textstat.reading_time"
] | [((845, 1025), 'fairest.models.RuleDescription', 'RuleDescription', ([], {'title': '"""Document Statistics Rule"""', 'description': '"""Produces a report of some useful statistics of the document. Uses textstat."""', 'author': '"""Core Fairest Plugin"""'}), "(title='Document Statistics Rule', description=\n 'Produce... |
# encoding: utf-8
from __future__ import unicode_literals
import argparse
from gym_bot_app.models import Admin
from gym_bot_app.commands import Command
from gym_bot_app.tasks import (GoToGymTask,
WentToGymTask,
NewWeekSelectDaysTask)
class AdminCommand(C... | [
"gym_bot_app.models.Admin.objects.is_admin",
"argparse.ArgumentParser"
] | [((948, 973), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (971, 973), False, 'import argparse\n'), ((1292, 1340), 'gym_bot_app.models.Admin.objects.is_admin', 'Admin.objects.is_admin', (['update.effective_user.id'], {}), '(update.effective_user.id)\n', (1314, 1340), False, 'from gym_bot_app.... |
""" Userbot module for other small commands. """
from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP
from userbot.utils import edit_or_reply, man_cmd
@man_cmd(pattern="ihelp$")
async def usit(event):
me = await event.client.get_me()
await edit_or_reply(
event,
f"**Hai {me.first... | [
"userbot.utils.man_cmd",
"userbot.CMD_HELP.update",
"userbot.utils.edit_or_reply"
] | [((169, 194), 'userbot.utils.man_cmd', 'man_cmd', ([], {'pattern': '"""ihelp$"""'}), "(pattern='ihelp$')\n", (176, 194), False, 'from userbot.utils import edit_or_reply, man_cmd\n'), ((710, 737), 'userbot.utils.man_cmd', 'man_cmd', ([], {'pattern': '"""listvar$"""'}), "(pattern='listvar$')\n", (717, 737), False, 'from ... |
import torch
import torch.nn as nn
from EncoderLayer import EncoderLayer
import math
class Encoder(nn.Module):
def __init__(self, input_dim, embed_dim, num_layers, num_heads, expand_dim, dropout, device, max_length = 30):
super().__init__()
self.tok_embedding = nn.Embedding(input_dim, embed... | [
"torch.nn.Dropout",
"EncoderLayer.EncoderLayer",
"torch.nn.Embedding",
"torch.FloatTensor",
"torch.cos",
"torch.arange",
"torch.zeros",
"math.log",
"torch.sin"
] | [((291, 325), 'torch.nn.Embedding', 'nn.Embedding', (['input_dim', 'embed_dim'], {}), '(input_dim, embed_dim)\n', (303, 325), True, 'import torch.nn as nn\n'), ((652, 671), 'torch.nn.Dropout', 'nn.Dropout', (['dropout'], {}), '(dropout)\n', (662, 671), True, 'import torch.nn as nn\n'), ((1564, 1599), 'torch.zeros', 'to... |
# -*- coding: utf-8 -*-
import pickle
class Color:
def __init__(self, red, green, blue):
self.red = int(red)
self.green = int(green)
self.blue = int(blue)
def toHash(self):
return hash((self.red, self.green, self.blue))
def regFormat(self):
return "{},{},{}".form... | [
"pickle.dumps"
] | [((1783, 1812), 'pickle.dumps', 'pickle.dumps', (['self.colors', '(-1)'], {}), '(self.colors, -1)\n', (1795, 1812), False, 'import pickle\n')] |
#!/usr/bin/env python3
import tensorflow as tf
tf.config.run_functions_eagerly(True)
import numpy as np
from graph2tensor.model.layers import GCNConv
from graph2tensor.model.models import MessagePassing
from unittest import TestCase, main
conv_layers = [
GCNConv(units=32, name="layer1"),
GCNConv(units=32, name... | [
"unittest.main",
"tensorflow.config.run_functions_eagerly",
"graph2tensor.model.layers.GCNConv",
"tensorflow.range",
"graph2tensor.model.models.MessagePassing.from_config",
"numpy.random.random",
"numpy.testing.assert_allclose",
"graph2tensor.model.models.MessagePassing"
] | [((47, 84), 'tensorflow.config.run_functions_eagerly', 'tf.config.run_functions_eagerly', (['(True)'], {}), '(True)\n', (78, 84), True, 'import tensorflow as tf\n'), ((376, 469), 'graph2tensor.model.models.MessagePassing', 'MessagePassing', (['[conv_layers, conv_layers, conv_layers]'], {'name': '"""sage"""', 'concat_hi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
High level functions for signal characterization from 1D signals
Code licensed under both GPL and BSD licenses
Authors: <NAME> <<EMAIL>>
<NAME> <<EMAIL>>
"""
from scipy.signal import periodogram, welch
import pandas as pd
import numpy as np
def psd(s,... | [
"scipy.signal.periodogram",
"numpy.mean",
"pandas.Series",
"scipy.signal.welch"
] | [((2212, 2247), 'pandas.Series', 'pd.Series', (['psd_s'], {'index': 'index_names'}), '(psd_s, index=index_names)\n', (2221, 2247), True, 'import pandas as pd\n'), ((2260, 2295), 'pandas.Series', 'pd.Series', (['f_idx'], {'index': 'index_names'}), '(f_idx, index=index_names)\n', (2269, 2295), True, 'import pandas as pd\... |
import json
import logging
import sys
from datetime import datetime, timedelta
import discord
from discord.ext import commands
import urbandictionary as ud
import shinden as sh
import covid19
import timer
import languages
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', datefmt='%d/%m/%Y %H:%M... | [
"discord.Embed",
"languages.Language",
"discord.ext.commands.Bot",
"shinden.search_characters",
"timer.Timer",
"urbandictionary.define",
"logging.warning",
"discord.Streaming",
"datetime.timedelta",
"shinden.search_users",
"datetime.datetime.now",
"urbandictionary.random",
"shinden.search_ti... | [((225, 349), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(message)s"""', 'datefmt': '"""%d/%m/%Y %H:%M:%S"""', 'level': 'logging.INFO'}), "(format='%(asctime)s - %(levelname)s - %(message)s',\n datefmt='%d/%m/%Y %H:%M:%S', level=logging.INFO)\n", (244, 349), Fals... |
#import what we need
import pandas as pd
from sqlalchemy import create_engine
#Read in the Titanic df
df = pd.read_csv('module2-sql-for-analysis/titanic.csv')
#make sure we got it
df.head()
#See what the datatypes are
df.dtypes
df.info()
# Create engine for DF insertion
engine = create_engine('postgres:... | [
"pandas.read_csv",
"sqlalchemy.create_engine"
] | [((113, 164), 'pandas.read_csv', 'pd.read_csv', (['"""module2-sql-for-analysis/titanic.csv"""'], {}), "('module2-sql-for-analysis/titanic.csv')\n", (124, 164), True, 'import pandas as pd\n'), ((296, 354), 'sqlalchemy.create_engine', 'create_engine', (['"""postgres://ensbdkiv:<EMAIL>:5432/ensbdkiv"""'], {}), "('postgres... |
###/usr/bin/env python
### coding: utf-8
import pandas as pd
import yfinance as yf
import investpy
import numpy as np
df_main = pd.read_excel(r'RawData.xlsx')
df_main = df_main [:-2] #remove last 2 rows so that data is able to update even when there are no new rows. This is ensure the code runs when there is a trans... | [
"pandas.read_html",
"pandas.DataFrame",
"yfinance.download",
"pandas.read_excel",
"pandas.to_datetime",
"investpy.get_index_historical_data",
"yfinance.Ticker",
"pandas.concat"
] | [((131, 160), 'pandas.read_excel', 'pd.read_excel', (['"""RawData.xlsx"""'], {}), "('RawData.xlsx')\n", (144, 160), True, 'import pandas as pd\n'), ((479, 497), 'pandas.read_html', 'pd.read_html', (['page'], {}), '(page)\n', (491, 497), True, 'import pandas as pd\n'), ((1008, 1026), 'pandas.read_html', 'pd.read_html', ... |
import os
from PIL import Image
import numpy as np
path='faces/faces_4/an2i'
trainx=[]
trainy=[]
for filename in os.listdir(path):
pixel=[]
im=Image.open(path+'/'+filename)
for i in range(im.size[0]):
row=[]
for j in range(im.size[1]):
row.append(im.getpixel((i,j)))
pixel.append(row)
trainx.append(pixel)
... | [
"numpy.transpose",
"numpy.array",
"os.listdir",
"PIL.Image.open"
] | [((114, 130), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (124, 130), False, 'import os\n'), ((565, 581), 'numpy.array', 'np.array', (['trainx'], {}), '(trainx)\n', (573, 581), True, 'import numpy as np\n'), ((590, 606), 'numpy.array', 'np.array', (['trainy'], {}), '(trainy)\n', (598, 606), True, 'import nu... |
from pathlib import Path
from loguru import logger
import numpy as np
import torch
from torch.utils.data import Dataset
import ganslate
from ganslate.utils import sitk_utils
from ganslate.data.utils.normalization import min_max_normalize, min_max_denormalize
from ganslate.data.utils.body_mask import apply_body_mask
#... | [
"ganslate.data.utils.normalization.min_max_normalize",
"ganslate.utils.sitk_utils.tensor_to_sitk_image",
"ganslate.data.utils.normalization.min_max_denormalize",
"ganslate.utils.sitk_utils.write",
"ganslate.utils.sitk_utils.get_npy",
"pathlib.Path",
"torch.clamp",
"ganslate.utils.sitk_utils.get_npy_dt... | [((1229, 1255), 'ganslate.utils.sitk_utils.load', 'sitk_utils.load', (['path_CBCT'], {}), '(path_CBCT)\n', (1244, 1255), False, 'from ganslate.utils import sitk_utils\n'), ((1770, 1788), 'torch.tensor', 'torch.tensor', (['CBCT'], {}), '(CBCT)\n', (1782, 1788), False, 'import torch\n'), ((1853, 1896), 'torch.clamp', 'to... |
from gpio import Gpio
from time import sleep
class Wh1602:
def __init__(self):
self.reserve_gpios()
self.rw.set_value(0)
sleep(0.05)
def __del__(self):
pass
def reserve_gpios(self):
self.rs = Gpio(2, "out")
self.rw = Gpio(3, "out")
self.e = Gpio(4, ... | [
"gpio.Gpio",
"time.sleep"
] | [((150, 161), 'time.sleep', 'sleep', (['(0.05)'], {}), '(0.05)\n', (155, 161), False, 'from time import sleep\n'), ((247, 261), 'gpio.Gpio', 'Gpio', (['(2)', '"""out"""'], {}), "(2, 'out')\n", (251, 261), False, 'from gpio import Gpio\n'), ((280, 294), 'gpio.Gpio', 'Gpio', (['(3)', '"""out"""'], {}), "(3, 'out')\n", (2... |
# -*- coding: utf-8 -*-
import scrapy
import hashlib
from bitco_in_forum.items import BitcoInForumItem
class BitcoInforumSpider(scrapy.Spider):
name = 'Bitco_inForum'
allowed_domains = ['bitco.in/forum/']
start_urls = ['http://bitco.in/forum//']
def parse(self, response):
subforums = response... | [
"bitco_in_forum.items.BitcoInForumItem",
"scrapy.Request"
] | [((1478, 1496), 'bitco_in_forum.items.BitcoInForumItem', 'BitcoInForumItem', ([], {}), '()\n', (1494, 1496), False, 'from bitco_in_forum.items import BitcoInForumItem\n'), ((428, 481), 'scrapy.Request', 'scrapy.Request', ([], {'url': 'board', 'callback': 'self.parse_topics'}), '(url=board, callback=self.parse_topics)\n... |
"""
Collections of Fermion-to-Qubit encodings known to tequila
Most are Interfaces to OpenFermion
"""
from tequila.circuit.circuit import QCircuit
from tequila.circuit.gates import X
from tequila.hamiltonian.qubit_hamiltonian import QubitHamiltonian
import openfermion
def known_encodings():
# convenience for testi... | [
"openfermion.get_interaction_operator",
"openfermion.FermionOperator",
"tequila.wavefunction.qubit_wavefunction.QubitWaveFunction.from_int",
"tequila.circuit.circuit.QCircuit",
"openfermion.bravyi_kitaev",
"openfermion.symmetry_conserving_bravyi_kitaev",
"openfermion.bravyi_kitaev_fast",
"openfermion.... | [((3895, 3935), 'openfermion.FermionOperator', 'openfermion.FermionOperator', (['string', '(1.0)'], {}), '(string, 1.0)\n', (3922, 3935), False, 'import openfermion\n'), ((4051, 4099), 'tequila.wavefunction.qubit_wavefunction.QubitWaveFunction.from_int', 'QubitWaveFunction.from_int', (['(0)'], {'n_qubits': 'n_qubits'})... |
import math
s = input()
s1 = input().split()
s1_n = []
for i in range(0,int(s),1):
s1_n.append(int(s1[i]))
s1_n.sort(reverse=True)
gcd_now = s1_n[0]
for i in range(1, len(s1_n), 1):
gcd_now = math.gcd(gcd_now,s1_n[i])
print(gcd_now)
| [
"math.gcd"
] | [((204, 230), 'math.gcd', 'math.gcd', (['gcd_now', 's1_n[i]'], {}), '(gcd_now, s1_n[i])\n', (212, 230), False, 'import math\n')] |
import glob
import os
import torch
from torch.utils.data import Dataset, DataLoader
import numpy as np
import matplotlib.image as mpimg
import pandas as pd
import cv2
class FacialKeypointsDataset(Dataset):
"""Face Landmarks dataset."""
def __init__(self, csv_file, root_dir, transform=None):
"""
... | [
"matplotlib.image.imread",
"numpy.copy",
"pandas.read_csv",
"cv2.cvtColor",
"numpy.ones",
"cv2.warpAffine",
"numpy.random.randint",
"numpy.random.random",
"numpy.matmul",
"os.path.join",
"cv2.getRotationMatrix2D",
"cv2.resize",
"torch.from_numpy"
] | [((608, 629), 'pandas.read_csv', 'pd.read_csv', (['csv_file'], {}), '(csv_file)\n', (619, 629), True, 'import pandas as pd\n'), ((815, 875), 'os.path.join', 'os.path.join', (['self.root_dir', 'self.key_pts_frame.iloc[idx, 0]'], {}), '(self.root_dir, self.key_pts_frame.iloc[idx, 0])\n', (827, 875), False, 'import os\n')... |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from smartfields import fields
from django.utils import timezone
from django.conf import settings
# Create your models here.
class Hood(models.Model):
name = models.CharField(max_length=40, null... | [
"django.db.models.TextField",
"django.db.models.URLField",
"django.db.models.OneToOneField",
"smartfields.fields.ImageField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.Manager",
"django.db.models.ImageField",
"django.db.models.IntegerField",
"django.db.models.D... | [((284, 326), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(40)', 'null': '(True)'}), '(max_length=40, null=True)\n', (300, 326), False, 'from django.db import models\n'), ((339, 377), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""images/"""'}), "(upload_to='images... |
# Generated by Django 3.1.3 on 2021-03-29 07:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('social_media_api', '0005_auto_20210329_0621'),
]
operations = [
migrations.CreateModel(
name='CanadaPosts',
fields=[... | [
"django.db.models.TextField",
"django.db.migrations.RenameModel",
"django.db.models.CharField",
"django.db.models.FloatField",
"django.db.models.BooleanField",
"django.db.models.IntegerField",
"django.db.migrations.AlterModelOptions",
"django.db.models.DateTimeField"
] | [((52249, 52334), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""SubredditPostModel"""', 'new_name': '"""WorldNewsPosts"""'}), "(old_name='SubredditPostModel', new_name='WorldNewsPosts'\n )\n", (52271, 52334), False, 'from django.db import migrations, models\n'), ((52374, 52521),... |
import putiopy
import os
KB = 1024
MB = 1024 * KB
OAUTH_TOKEN = 'xxx'
CLIENT_SECRET = 'xxx'
CLIENT_ID = 1
# Read and write operations are limited to this chunk size.
# This can make a big difference when dealing with large files.
CHUNK_SIZE = 256 * KB * 10
#destination folder on NAS
dest='/volume1/homes/... | [
"os.system",
"putiopy.Client",
"putiopy.AuthHelper"
] | [((480, 542), 'putiopy.AuthHelper', 'putiopy.AuthHelper', (['CLIENT_ID', 'CLIENT_SECRET', '""""""'], {'type': '"""token"""'}), "(CLIENT_ID, CLIENT_SECRET, '', type='token')\n", (498, 542), False, 'import putiopy\n'), ((585, 612), 'putiopy.Client', 'putiopy.Client', (['OAUTH_TOKEN'], {}), '(OAUTH_TOKEN)\n', (599, 612), ... |
from __future__ import unicode_literals
import posixpath
import frappe
from models import (OpencartCategory,
OpencartProductOption,
OpencartProductOptionExt,
OpencartStore,
OpencartCustomerGroup,
OpencartOrder)
from util... | [
"models.OpencartProductOption",
"models.OpencartOrder",
"posixpath.join",
"models.OpencartStore",
"frappe.get_doc",
"utils.oc_request",
"models.OpencartProductOptionExt",
"utils.oc_upload_file"
] | [((506, 548), 'frappe.get_doc', 'frappe.get_doc', (['"""Opencart Site"""', 'site_name'], {}), "('Opencart Site', site_name)\n", (520, 548), False, 'import frappe\n'), ((1182, 1225), 'posixpath.join', 'posixpath.join', (['base_api_url', '"""api"""', '"""rest"""'], {}), "(base_api_url, 'api', 'rest')\n", (1196, 1225), Fa... |
import sys
from PySide2.QtWidgets import QApplication
import view.mainwindow
import controller.controller
import model.memory
memory = model.memory.MainMemory()
controller = controller.controller.Controller(memory)
app = QApplication(sys.argv)
mw = view.mainwindow.MainWindow(controller)
mw.show()
sys.exit(app.exec... | [
"PySide2.QtWidgets.QApplication"
] | [((226, 248), 'PySide2.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (238, 248), False, 'from PySide2.QtWidgets import QApplication\n')] |
# coding: utf-8
import logging
import sys
from collections import Mapping, Set
from functools import wraps
from PyQt5.QtCore import QAbstractItemModel, QModelIndex, Qt
from PyQt5.QtWidgets import QApplication, QMainWindow, QTreeView
from mhw_armor_edit.utils import is_sequence
data = {
"Gravity": {
"Defa... | [
"PyQt5.QtCore.QModelIndex",
"logging.basicConfig",
"mhw_armor_edit.utils.is_sequence",
"PyQt5.QtWidgets.QTreeView",
"functools.wraps",
"PyQt5.QtWidgets.QApplication"
] | [((4610, 4686), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(levelname)s %(message)s"""'}), "(level=logging.DEBUG, format='%(levelname)s %(message)s')\n", (4629, 4686), False, 'import logging\n'), ((4721, 4743), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv... |
from abc import ABCMeta
from datetime import datetime
from typing import NewType
from openstacktenantcleaner.external.hgicommon.models import Model
OpenstackIdentifier = NewType("OpenstackIdentifier", str)
class OpenstackCredentials(Model):
"""
Credentials used to login to OpenStack.
"""
def __init_... | [
"typing.NewType"
] | [((172, 207), 'typing.NewType', 'NewType', (['"""OpenstackIdentifier"""', 'str'], {}), "('OpenstackIdentifier', str)\n", (179, 207), False, 'from typing import NewType\n')] |
import pandas as pd
# variable holding the amount of rows you want
amount = 10
# create a Pandas DataFrame from Sunspots.csv
sunspots_df = pd.read_csv("Sunspots.csv")
# get the most recent data by selecting the last 10 rows
recent_sunspots = sunspots_df.tail(amount)
# calculate the mean
avg = sum(recent_sunspots["M... | [
"pandas.read_csv"
] | [((141, 168), 'pandas.read_csv', 'pd.read_csv', (['"""Sunspots.csv"""'], {}), "('Sunspots.csv')\n", (152, 168), True, 'import pandas as pd\n')] |
#!/home/ivan/.virtualenvs/yagolabelfetcher/bin/python
import re
def _split_camelcase(string):
_camel_case_regex = re.compile(r"([A-Z])") ... | [
"re.compile"
] | [((247, 268), 're.compile', 're.compile', (['"""([A-Z])"""'], {}), "('([A-Z])')\n", (257, 268), False, 'import re\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import pandas as pd
import click
from sklearn.preprocessing import StandardScaler
@click.command()
@click.option("--training", type=float, default=0.7)
@click.option("--validation", type=float, default=0.2)
@click.option("--test", type=float, default=0.1)
def m... | [
"sklearn.preprocessing.StandardScaler",
"click.option",
"click.command",
"os.path.isfile",
"pandas.read_parquet"
] | [((142, 157), 'click.command', 'click.command', ([], {}), '()\n', (155, 157), False, 'import click\n'), ((159, 210), 'click.option', 'click.option', (['"""--training"""'], {'type': 'float', 'default': '(0.7)'}), "('--training', type=float, default=0.7)\n", (171, 210), False, 'import click\n'), ((212, 265), 'click.optio... |
from django.contrib import admin
from .models import *
class ParticipantesInline(admin.TabularInline):
model = Participantes
extra = 1
class NivelConocimientoInline(admin.TabularInline):
model = NivelConocimiento
extra = 1
class FotosMediosInline(admin.TabularInline):
model = FotosMedios
extra = 1
class Medio... | [
"django.contrib.admin.site.register"
] | [((642, 712), 'django.contrib.admin.site.register', 'admin.site.register', (['MediosFortalecimiento', 'MediosFortalecimientoAdmin'], {}), '(MediosFortalecimiento, MediosFortalecimientoAdmin)\n', (661, 712), False, 'from django.contrib import admin\n'), ((713, 745), 'django.contrib.admin.site.register', 'admin.site.regi... |
# from vimba import *
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QLabel
from PyQt5.QtWidgets import QWidget
from PyQt5 import uic
qtcreator_file = "C:\\Users\\Andrew\\Documents\\PhDSantiago\\VimbaCameraGUI\\GUI_vimbaCamera.ui" # Enter file here.
# Ui_MainWindow, QtBaseClass = uic.... | [
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QWidget"
] | [((385, 407), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (397, 407), False, 'from PyQt5.QtWidgets import QApplication\n'), ((418, 427), 'PyQt5.QtWidgets.QWidget', 'QWidget', ([], {}), '()\n', (425, 427), False, 'from PyQt5.QtWidgets import QWidget\n'), ((532, 578), 'PyQt5.QtWidg... |
import codecs
# Extract wordclass type from HTML file
f = codecs.open('KENCOLLO2', 'r', 'utf-8')
categories = []
for line in f:
start = line.find("【")
if start > 0:
end = line.rfind("】")
category = line[start:end+1]
if category not in categories:
print(category)
... | [
"codecs.open"
] | [((59, 97), 'codecs.open', 'codecs.open', (['"""KENCOLLO2"""', '"""r"""', '"""utf-8"""'], {}), "('KENCOLLO2', 'r', 'utf-8')\n", (70, 97), False, 'import codecs\n')] |
import os
import shutil
import subprocess
if __name__ == "__main__":
root = os.path.dirname(os.path.abspath(__file__))
shutil.rmtree(os.path.join(root,"bin"), ignore_errors=True)
shutil.rmtree(os.path.join(root,"include"), ignore_errors=True)
if os.path.exists(os.path.join(root,".built")):
os.r... | [
"os.path.abspath",
"os.path.join"
] | [((97, 122), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (112, 122), False, 'import os\n'), ((142, 167), 'os.path.join', 'os.path.join', (['root', '"""bin"""'], {}), "(root, 'bin')\n", (154, 167), False, 'import os\n'), ((206, 235), 'os.path.join', 'os.path.join', (['root', '"""include"""'... |
#
# error.py
# CloudKitPy
#
# Created by <NAME> on 01/05/2016.
# Copyright (c) 2016 <NAME> - Pig on a Hill Productions.
#
# !/usr/bin/env python
from datatypes import ZoneID
from helpers import parse
class CKError:
is_error = False
ck_error_code = None
is_server_error = False
server_error_code = No... | [
"helpers.parse",
"datatypes.ZoneID"
] | [((688, 714), 'helpers.parse', 'parse', (['json', '"""ckErrorCode"""'], {}), "(json, 'ckErrorCode')\n", (693, 714), False, 'from helpers import parse\n'), ((811, 841), 'helpers.parse', 'parse', (['json', '"""serverErrorCode"""'], {}), "(json, 'serverErrorCode')\n", (816, 841), False, 'from helpers import parse\n'), ((9... |
import numpy as np
import megengine as mge
import megengine.functional as F
from common import se3, so3
def compute_losses(data_batch, endpoints, params):
loss = {}
# compute losses
if params.loss_type == "omnet":
num_iter = len(endpoints["all_pose_pair"])
for i in range(num_iter):
... | [
"megengine.tensor",
"megengine.functional.nn.l1_loss",
"megengine.functional.clip",
"common.se3.mge_inverse",
"megengine.functional.nn.square_loss",
"megengine.functional.mean",
"megengine.functional.norm",
"megengine.functional.abs",
"common.so3.mge_dcm2euler",
"megengine.functional.concat"
] | [((2027, 2083), 'megengine.functional.mean', 'F.mean', (['((r_gt_euler_deg - r_pred_euler_deg) ** 2)'], {'axis': '(1)'}), '((r_gt_euler_deg - r_pred_euler_deg) ** 2, axis=1)\n', (2033, 2083), True, 'import megengine.functional as F\n'), ((2163, 2199), 'megengine.functional.mean', 'F.mean', (['((t_gt - t_pred) ** 2)'], ... |
import json
import logging
from eth_utils.hexadecimal import is_hex
import base64
from service_client.generic import GenericServiceClient
from tcf_connector.work_order_interface import WorkOrderInterface
from tcf_connector.utils import create_jrpc_response
from utils.tcf_types import JsonRpcErrorCode
logging.basicConf... | [
"logging.error",
"eth_utils.hexadecimal.is_hex",
"logging.basicConfig",
"json.dumps",
"base64.b64decode",
"tcf_connector.utils.create_jrpc_response",
"service_client.generic.GenericServiceClient"
] | [((303, 398), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s - %(levelname)s - %(message)s',\n level=logging.INFO)\n", (322, 398), False, 'import logging\n'), ((501, 552), 'service_client.generic.Generi... |
# class Event(object):
# _observers = []
#
# def __init__(self, webscraper, item):
# self.webscraper = webscraper
# self.item = item
#
# def __repr__(self):
# return self.__class__.__name__
#
# @classmethod
# def register(cls, observer):
# if observer not in cls._obse... | [
"numpy.arange"
] | [((2095, 2113), 'numpy.arange', 'np.arange', (['(0)', 'c', 'f'], {}), '(0, c, f)\n', (2104, 2113), True, 'import numpy as np\n')] |
#!/usr/bin/env python
# Copyright 2007 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or ag... | [
"os.getcwd",
"google.appengine.ext.ndb.StringProperty",
"google.appengine.ext.ndb.DateProperty",
"webapp2.WSGIApplication",
"google.appengine.ext.ndb.TimeProperty"
] | [((11494, 11613), 'webapp2.WSGIApplication', 'webapp2.WSGIApplication', (["[('/projects', ProjectsHomeHandler), ('/projects/.*', ProjectsRouterHandler)]"], {'debug': '(True)'}), "([('/projects', ProjectsHomeHandler), (\n '/projects/.*', ProjectsRouterHandler)], debug=True)\n", (11517, 11613), False, 'import webapp2\... |
from copy import copy
import time
import os
import numpy as np
import numpy.linalg as linalg
import gym
from gym import spaces
from gym.utils import seeding
from roboball2d.physics import B2World
from roboball2d.robot import DefaultRobotConfig
from roboball2d.robot import DefaultRobotState
from roboball2d.ball impor... | [
"roboball2d.rendering.pyglet_utils.draw_vector",
"numpy.clip",
"roboball2d.rendering.pyglet_utils.draw_box",
"roboball2d.physics.B2World",
"gym.utils.seeding.np_random",
"roboball2d.robot.DefaultRobotState",
"roboball2d.ball.BallConfig",
"pyglet.gl.glTranslatef",
"roboball2d.ball_gun.DefaultBallGun"... | [((2207, 2227), 'roboball2d.robot.DefaultRobotConfig', 'DefaultRobotConfig', ([], {}), '()\n', (2225, 2227), False, 'from roboball2d.robot import DefaultRobotConfig\n'), ((3020, 3183), 'roboball2d.physics.B2World', 'B2World', ([], {'robot_configs': 'self._robot_config', 'ball_configs': 'self._ball_configs', 'visible_ar... |
import os
import shutil
import tempfile
import subprocess
import pytest
from lightning import LightningRpc
from bitcoin import BitcoinRPC
from .utils import TailableProc, wait_for
bitcoind_bin = os.getenv("BITCOIND")
lightningd_bin = os.getenv("LIGHTNINGD")
bitcoin_cli_bin = os.getenv("BITCOIN_CLI")
@pytest.fixtur... | [
"subprocess.run",
"os.environ.copy",
"bitcoin.BitcoinRPC",
"tempfile.mkdtemp",
"shutil.rmtree",
"os.path.join",
"os.getenv"
] | [((198, 219), 'os.getenv', 'os.getenv', (['"""BITCOIND"""'], {}), "('BITCOIND')\n", (207, 219), False, 'import os\n'), ((237, 260), 'os.getenv', 'os.getenv', (['"""LIGHTNINGD"""'], {}), "('LIGHTNINGD')\n", (246, 260), False, 'import os\n'), ((279, 303), 'os.getenv', 'os.getenv', (['"""BITCOIN_CLI"""'], {}), "('BITCOIN_... |
from typing import Optional, Union, List, Tuple
import os
import cv2 as cv
import numpy as np
from PySide6.QtWidgets import QLayout, QLabel, QWidget, QGridLayout
from PySide6.QtGui import QImage, QMouseEvent, QCloseEvent, QResizeEvent, QMoveEvent, QPixmap
from PySide6.QtCore import Slot, QSize, QPoint, Qt, Signal
f... | [
"numpy.load",
"os.path.dirname",
"PySide6.QtWidgets.QLabel",
"PySide6.QtGui.QImage",
"PySide6.QtCore.Signal",
"PySide6.QtCore.QSize",
"PySide6.QtGui.QPixmap.fromImage",
"PySide6.QtCore.Slot",
"PySide6.QtWidgets.QGridLayout",
"os.path.join"
] | [((2253, 2265), 'PySide6.QtCore.Signal', 'Signal', (['list'], {}), '(list)\n', (2259, 2265), False, 'from PySide6.QtCore import Slot, QSize, QPoint, Qt, Signal\n'), ((4502, 4536), 'PySide6.QtCore.Slot', 'Slot', (['LayerImageEntry', 'QMouseEvent'], {}), '(LayerImageEntry, QMouseEvent)\n', (4506, 4536), False, 'from PySi... |
from app.models import ParentHood
from datetime import datetime
from flask import jsonify, request
from flask_jwt_extended import get_jwt_identity, jwt_required
from app import db
from app.api import bluePrint
from app.api.auth.auth_utils import jwt_roles_required
from app.dbUtils.dbUtils import query_existing_user,... | [
"app.dbUtils.dbUtils.query_unvalidated_parents",
"flask_jwt_extended.get_jwt_identity",
"app.dbUtils.dbUtils.query_parent_students",
"app.api.bluePrint.route",
"app.dbUtils.dbUtils.query_parent_hood",
"flask_jwt_extended.jwt_required",
"app.dbUtils.dbUtils.query_existing_user",
"datetime.datetime.utcn... | [((586, 630), 'app.api.bluePrint.route', 'bluePrint.route', (['"""/parent"""'], {'methods': "['POST']"}), "('/parent', methods=['POST'])\n", (601, 630), False, 'from app.api import bluePrint\n'), ((632, 667), 'app.api.auth.auth_utils.jwt_roles_required', 'jwt_roles_required', (['Roles.EVERYBODY'], {}), '(Roles.EVERYBOD... |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
update-model-url-to-authorized-endpoint
"""
from yoyo import step
__depends__ = {"20210621_01_IRyiT-rename-qa-f1"}
steps = [
step(
... | [
"yoyo.step"
] | [((313, 457), 'yoyo.step', 'step', (['"""UPDATE rounds SET url = REPLACE(url, \'fhcxpbltv0\', \'obws766r82\')"""', '"""UPDATE rounds SET url = REPLACE(url, \'obws766r82\', \'fhcxpbltv0\')"""'], {}), '("UPDATE rounds SET url = REPLACE(url, \'fhcxpbltv0\', \'obws766r82\')",\n "UPDATE rounds SET url = REPLACE(url, \'ob... |
import os
import __main__
import http.server
import socketserver
PORT = 8001
HOST = "0.0.0.0"
DIR = os.path.dirname(os.path.dirname(os.path.realpath(__main__.__file__)))
DIR = os.path.join(DIR, "data")
os.chdir(DIR)
Handler = http.server.SimpleHTTPRequestHandler
httpd = socketserver.TCPServer((HOST, PORT), Handler... | [
"os.path.realpath",
"socketserver.TCPServer",
"os.path.join",
"os.chdir"
] | [((178, 203), 'os.path.join', 'os.path.join', (['DIR', '"""data"""'], {}), "(DIR, 'data')\n", (190, 203), False, 'import os\n'), ((205, 218), 'os.chdir', 'os.chdir', (['DIR'], {}), '(DIR)\n', (213, 218), False, 'import os\n'), ((276, 321), 'socketserver.TCPServer', 'socketserver.TCPServer', (['(HOST, PORT)', 'Handler']... |
import typing
from flask import url_for
from flask_babel import gettext
from flask_login import current_user
from web.table.table import lazy_join, DictValueMixin, custom_formatter_column, IbanColumn
from web.table.table import BootstrapTable, Column, SplittedTable, \
BtnColumn, LinkColumn, button_toolbar, DateC... | [
"web.table.table.BtnColumn",
"web.table.table.DateColumn",
"web.template_filters.money_filter",
"web.table.table.custom_formatter_column",
"web.table.table.LinkColumn",
"web.table.table.Column",
"flask.url_for",
"web.table.table.IbanColumn",
"web.table.table.button_toolbar",
"flask_babel.gettext",... | [((391, 440), 'web.table.table.custom_formatter_column', 'custom_formatter_column', (['"""table.coloredFormatter"""'], {}), "('table.coloredFormatter')\n", (414, 440), False, 'from web.table.table import lazy_join, DictValueMixin, custom_formatter_column, IbanColumn\n'), ((1649, 1670), 'web.table.table.Column', 'Column... |
#!/usr/bin/env python3
# Copyright 2020-present NAVER Corp. Under BSD 3-clause license
import os.path as path
import path_to_kapture_localization # noqa: F401
import kapture_localization.utils.path_to_kapture # noqa: F401
from kapture.utils.paths import safe_remove_any_path
HERE_PATH = path.normpath(path.dirname(__f... | [
"os.path.isdir",
"os.path.dirname",
"kapture.utils.paths.safe_remove_any_path",
"os.path.join"
] | [((348, 382), 'os.path.join', 'path.join', (['HERE_PATH', '"""colmap-sfm"""'], {}), "(HERE_PATH, 'colmap-sfm')\n", (357, 382), True, 'import os.path as path\n'), ((412, 455), 'os.path.join', 'path.join', (['HERE_PATH', '"""colmap-localization"""'], {}), "(HERE_PATH, 'colmap-localization')\n", (421, 455), True, 'import ... |
import numpy as np
import torch
from tensorboardX import SummaryWriter
from tqdm import tqdm
import argparse
import config
from data_gen import TextMelLoader, TextMelCollate
from taco2models.loss_function import Tacotron2Loss
from taco2models.models import Tacotron2
from taco2models.optimizer import Tacotron2Optimizer
... | [
"tensorboardX.SummaryWriter",
"numpy.random.seed",
"utils_1.get_logger",
"torch.utils.data.DataLoader",
"argparse.ArgumentParser",
"utils_1.AverageMeter",
"torch.manual_seed",
"torch.load",
"taco2models.loss_function.Tacotron2Loss",
"data_gen.TextMelLoader",
"torch.cuda.empty_cache",
"utils_1.... | [((426, 446), 'torch.manual_seed', 'torch.manual_seed', (['(7)'], {}), '(7)\n', (443, 446), False, 'import torch\n'), ((451, 468), 'numpy.random.seed', 'np.random.seed', (['(7)'], {}), '(7)\n', (465, 468), True, 'import numpy as np\n'), ((564, 579), 'tensorboardX.SummaryWriter', 'SummaryWriter', ([], {}), '()\n', (577,... |
#!/usr/bin/env python3
import os
import unittest
from textwrap import dedent
from python_utils import import_vars, set_env_var, print_input_args, \
print_info_msg, print_err_msg_exit, cfg_to_yaml_str
from fill_jinja_template import fill_jinja_template
def create_diag_table_file(run_dir):
... | [
"python_utils.set_env_var",
"python_utils.print_info_msg",
"os.path.abspath",
"python_utils.cfg_to_yaml_str",
"fill_jinja_template.fill_jinja_template",
"python_utils.import_vars",
"python_utils.print_err_msg_exit",
"os.path.join",
"os.getenv"
] | [((537, 550), 'python_utils.import_vars', 'import_vars', ([], {}), '()\n', (548, 550), False, 'from python_utils import import_vars, set_env_var, print_input_args, print_info_msg, print_err_msg_exit, cfg_to_yaml_str\n'), ((631, 827), 'python_utils.print_info_msg', 'print_info_msg', (['f"""\n Creating a diagnosti... |
from src.Squad import Squad
import src
def test_squad_getters():
country = src.CountriesConstants.FRANCE
army = src.Army.Army(country, None)
sq = Squad(army)
assert (sq.get_country() == country)
assert (sq.get_army() == army)
assert (sq.get_init_health() == src.GameplayParameters.INI... | [
"src.Archer.Archer",
"src.Swordsman.Swordsman",
"src.Squad.Squad",
"src.Army.Army"
] | [((128, 156), 'src.Army.Army', 'src.Army.Army', (['country', 'None'], {}), '(country, None)\n', (141, 156), False, 'import src\n'), ((167, 178), 'src.Squad.Squad', 'Squad', (['army'], {}), '(army)\n', (172, 178), False, 'from src.Squad import Squad\n'), ((954, 982), 'src.Army.Army', 'src.Army.Army', (['country', 'None'... |
from scipy.spatial import KDTree
def listOfClosest(list_sem, radius = 100):
"""
Gives back the indices of elements to be removed
Notice that this method requires some sophistication.
In this approach we just leave the first element we find.
:param m_list_px:
:param m_l... | [
"scipy.spatial.KDTree"
] | [((728, 745), 'scipy.spatial.KDTree', 'KDTree', (['tree_list'], {}), '(tree_list)\n', (734, 745), False, 'from scipy.spatial import KDTree\n')] |
import rclpy
from rclpy.node import Node
import random
from geometry_msgs.msg import Twist
import time
class CmdPublisher(Node):
def __init__(self):
super().__init__('cmd_vel_node')
self.publisher_ = self.create_publisher(Twist, '/cmd_vel', 1)
timer_period = 1
self.timer = s... | [
"rclpy.spin",
"rclpy.init",
"geometry_msgs.msg.Twist",
"time.sleep",
"rclpy.shutdown"
] | [((1069, 1090), 'rclpy.init', 'rclpy.init', ([], {'args': 'args'}), '(args=args)\n', (1079, 1090), False, 'import rclpy\n'), ((424, 431), 'geometry_msgs.msg.Twist', 'Twist', ([], {}), '()\n', (429, 431), False, 'from geometry_msgs.msg import Twist\n'), ((1029, 1042), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', ... |
from doppelkopf.db import db
from datetime import datetime
from enum import Enum
class EventTypes(Enum):
GAME_SINGLEPLAYER_START = 0
GAME_SINGLEPLAYER_WIN = 1
GAME_SINGLEPLAYER_LOSE = 2
GAME_MULTIPLAYER_START = 100
CRON_DB_BACKUP = 1000
class Event(db.Model):
id = db.Column(db.Integer, pri... | [
"doppelkopf.db.db.Enum",
"datetime.datetime.utcnow",
"doppelkopf.db.db.Column"
] | [((295, 334), 'doppelkopf.db.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (304, 334), False, 'from doppelkopf.db import db\n'), ((362, 381), 'doppelkopf.db.db.Enum', 'db.Enum', (['EventTypes'], {}), '(EventTypes)\n', (369, 381), False, 'from doppelkopf.db imp... |
import ROOT as root
########################## Data of .C file, insert data underneath ######################################
qMap_Ag_C0_V0 = root.TProfile2D("qMap_Ag_C0_V0","qMap_Ag_C0 (V0)",52,0,52,80,0,80,0,0);
qMap_Ag_C0_V0.SetBinEntries(2345,1);
qMap_Ag_C0_V0.SetBinEntries(2398,14628);
qMap_Ag_C0_V0.SetBinEntri... | [
"ROOT.TColor.GetColor",
"ROOT.TProfile2D"
] | [((145, 224), 'ROOT.TProfile2D', 'root.TProfile2D', (['"""qMap_Ag_C0_V0"""', '"""qMap_Ag_C0 (V0)"""', '(52)', '(0)', '(52)', '(80)', '(0)', '(80)', '(0)', '(0)'], {}), "('qMap_Ag_C0_V0', 'qMap_Ag_C0 (V0)', 52, 0, 52, 80, 0, 80, 0, 0)\n", (160, 224), True, 'import ROOT as root\n'), ((3335, 3366), 'ROOT.TColor.GetColor',... |
import pytest
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import repeat, rearrange
from src.models.modules.masking import FullMask, LengthMask
from src.models.attention.linformer_attention import LinformerAttention
def seed_cpu_cuda(seed):
torch.manual_seed(seed)
torch.c... | [
"torch.ones_like",
"torch.randint",
"torch.zeros_like",
"torch.manual_seed",
"torch.cuda.manual_seed",
"torch.randn",
"src.models.attention.linformer_attention.LinformerAttention",
"pytest.mark.parametrize",
"torch.all"
] | [((285, 308), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (302, 308), False, 'import torch\n'), ((313, 341), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', (['seed'], {}), '(seed)\n', (335, 341), False, 'import torch\n'), ((380, 430), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ... |
import importlib
import json
import os
import sys
from threading import Thread
from typing import *
from kivy.app import App as KivyApp
from kivy.config import ConfigParser
from kivy.lang.builder import Builder
from kivy.logger import Logger
from kivy.uix.screenmanager import ScreenManager
from aiventure.common.ai im... | [
"kivy.lang.builder.Builder.load_file",
"json.load",
"kivy.uix.screenmanager.ScreenManager",
"importlib.import_module",
"aiventure.common.utils.is_model_valid",
"aiventure.common.utils.get_save_name",
"kivy.logger.Logger.info",
"kivy.config.ConfigParser"
] | [((1425, 1439), 'kivy.config.ConfigParser', 'ConfigParser', ([], {}), '()\n', (1437, 1439), False, 'from kivy.config import ConfigParser\n'), ((2962, 3013), 'kivy.logger.Logger.info', 'Logger.info', (['f"""Modules: Loading {f}.filter_display"""'], {}), "(f'Modules: Loading {f}.filter_display')\n", (2973, 3013), False, ... |
#! /usr/bin/env python3
import Deck as D
import Player as P
import Game as G
import matplotlib.pyplot as plt
import cProfile
score_dict = {1:'High Card',
2:'One Pair',
3:'Two Pair',
4:'Three of a Kind',
5:'Straight',
6:'Flush',
7:'Full ... | [
"Player.Player",
"matplotlib.pyplot.show",
"Deck.Deck",
"Game.PokerPool",
"Game.PokerHand",
"matplotlib.pyplot.subplots"
] | [((2273, 2281), 'Deck.Deck', 'D.Deck', ([], {}), '()\n', (2279, 2281), True, 'import Deck as D\n'), ((2562, 2588), 'Game.PokerPool', 'G.PokerPool', (['"""common_pool"""'], {}), "('common_pool')\n", (2573, 2588), True, 'import Game as G\n'), ((1163, 1193), 'Game.PokerHand', 'G.PokerHand', (['p.hand', 'pool.hand'], {}), ... |
# -*-coding:utf-8-*-
# 作者: 29511
# 文件名: list_shuffle.py
# 日期时间:2021/4/19,15:47
def list_shuffle(li):
"""
打乱列表元素
:param li: 原列表
"""
import random
random.shuffle(li)
li = [1, 2, 3, 4, 5]
list_shuffle(li) # 调用之后li反生了改变
print(li)
| [
"random.shuffle"
] | [((174, 192), 'random.shuffle', 'random.shuffle', (['li'], {}), '(li)\n', (188, 192), False, 'import random\n')] |
# -*- coding: utf-8 -*-
"""
Created on Wed May 6 09:28:40 2020
@author: yo
Función auxiliar para calcular el RSE
"""
import numpy as np
def calc_rse(valores,prediccion):
return(sum(valores-prediccion)**2/sum((valores-np.mean(valores))**2)) | [
"numpy.mean"
] | [((226, 242), 'numpy.mean', 'np.mean', (['valores'], {}), '(valores)\n', (233, 242), True, 'import numpy as np\n')] |
# Copyright (c) 2021 - present / Neuralmagic, Inc. 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... | [
"torch.ne",
"sparseml.pytorch.utils.tensor_sparsity",
"sparseml.pytorch.utils.get_prunable_layers",
"sparseml.pytorch.optim.modifier.ModifierProp",
"sparseml.pytorch.optim.modifier.PyTorchModifierYAML"
] | [((2222, 2243), 'sparseml.pytorch.optim.modifier.PyTorchModifierYAML', 'PyTorchModifierYAML', ([], {}), '()\n', (2241, 2243), False, 'from sparseml.pytorch.optim.modifier import ModifierProp, PyTorchModifierYAML, ScheduledModifier\n'), ((5457, 5489), 'sparseml.pytorch.optim.modifier.ModifierProp', 'ModifierProp', ([], ... |
#!/usr/bin/env python3
#
#
#
#
# <NAME> (03 Apr 2019), contact: <EMAIL>
import argparse
import datetime
import os
import re
import sys
import requests
import kbr.config_utils as config_utils
import kbr.db_utils as db_utils
import kbr.timedate_utils as timedate_utils
points = []
url = None
db = None
dbuser = N... | [
"kbr.timedate_utils.timedelta_to_sec",
"kbr.db_utils.DB",
"argparse.ArgumentParser",
"kbr.config_utils.readin_config_file",
"re.match",
"kbr.timedate_utils.datestr_to_ts",
"datetime.datetime.utcfromtimestamp",
"datetime.timedelta",
"requests.post",
"sys.exit"
] | [((1308, 1345), 'datetime.datetime.utcfromtimestamp', 'datetime.datetime.utcfromtimestamp', (['(0)'], {}), '(0)\n', (1342, 1345), False, 'import datetime\n'), ((1486, 1521), 'kbr.timedate_utils.datestr_to_ts', 'timedate_utils.datestr_to_ts', (['start'], {}), '(start)\n', (1514, 1521), True, 'import kbr.timedate_utils a... |
from fastapi import APIRouter
router = APIRouter()
@router.get('/')
def index():
return 'hello ergo'
| [
"fastapi.APIRouter"
] | [((40, 51), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (49, 51), False, 'from fastapi import APIRouter\n')] |
import cv2
cap = cv2.VideoCapture("peo.mp4") # input video file
ret, primary = cap.read()
ret, secondary = cap.read()
while cap.isOpened():
diff = cv2.absdiff(primary, secondary)
gray_img = cv2.cvtColor(diff, cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(gray_img, (5, 5), 0)
_, thresh = cv2.threshold... | [
"cv2.resize",
"cv2.GaussianBlur",
"cv2.boundingRect",
"cv2.contourArea",
"cv2.dilate",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.threshold",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.rectangle",
"cv2.absdiff",
"cv2.destroyAllWindows",
"cv2.findContours"
] | [((18, 45), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""peo.mp4"""'], {}), "('peo.mp4')\n", (34, 45), False, 'import cv2\n'), ((893, 916), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (914, 916), False, 'import cv2\n'), ((156, 187), 'cv2.absdiff', 'cv2.absdiff', (['primary', 'secondary'], {}), ... |
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
#initialize webdriver
executable_path='/Users/softwareengineer/Desktop/web_automation/chromedriver'
driver = webdriver.Chrome(executable_path)
# Expand the window
driver.maximize_window()
driver.implicitly_wait(5)
#Ope... | [
"selenium.webdriver.Chrome",
"time.sleep"
] | [((209, 242), 'selenium.webdriver.Chrome', 'webdriver.Chrome', (['executable_path'], {}), '(executable_path)\n', (225, 242), False, 'from selenium import webdriver\n'), ((477, 485), 'time.sleep', 'sleep', (['(3)'], {}), '(3)\n', (482, 485), False, 'from time import sleep\n'), ((589, 597), 'time.sleep', 'sleep', (['(5)'... |
"""This script crawls the CURIA database and saves all cases
and relevant document links for each case to the database.
"""
import argparse
import concurrent.futures
from lazylawyer.crawlers.crawlers import CURIACrawler
from lazylawyer.database import table_cases, table_docs, table_appeals
from lazylawyer import... | [
"lazylawyer.helpers.create_batches_list",
"lazylawyer.crawlers.crawlers.CURIACrawler",
"tqdm.tqdm",
"argparse.ArgumentParser",
"lazylawyer.database.table_cases.get_all_cases",
"lazylawyer.database.table_cases.update_subject",
"lazylawyer.database.table_docs.get_max_case_id_in_docs",
"lazylawyer.databa... | [((769, 783), 'lazylawyer.crawlers.crawlers.CURIACrawler', 'CURIACrawler', ([], {}), '()\n', (781, 783), False, 'from lazylawyer.crawlers.crawlers import CURIACrawler\n'), ((1857, 1895), 'lazylawyer.helpers.create_batches_list', 'helpers.create_batches_list', (['cases', '(50)'], {}), '(cases, 50)\n', (1884, 1895), Fals... |
# +
from .variable import Variable
from .spd import SPD
from collections import Counter
from math import pi
import torch
gauss_norm = torch.tensor(2*pi).sqrt()
def discrete(val, delta):
return tuple(val.div(delta).floor().int().view(-1).tolist())
def conformed(x):
if x.dim() > 1:
return x
else... | [
"torch.ones",
"torch.stack",
"collections.Counter",
"torch.cat",
"torch.distributions.transforms.LowerCholeskyTransform",
"torch.zeros",
"torch.as_tensor",
"torch.optim.LBFGS",
"torch.tensor"
] | [((136, 156), 'torch.tensor', 'torch.tensor', (['(2 * pi)'], {}), '(2 * pi)\n', (148, 156), False, 'import torch\n'), ((522, 544), 'torch.as_tensor', 'torch.as_tensor', (['delta'], {}), '(delta)\n', (537, 544), False, 'import torch\n'), ((819, 874), 'torch.distributions.transforms.LowerCholeskyTransform', 'torch.distri... |