code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import copy
import matplotlib.pyplot as plt
from utility import mm_to_inch
from sphere_array import *
diam_sphere_mm = 9.0
params = {
'num_x' : 4,
'num_y' : 2,
'diam_sphere' : mm_to_inch(diam_sphere_mm),
'num_tab' : 3,
'tab_thickness' : 0.5*mm_to_inch(diam_sphere_mm), ... | [
"copy.deepcopy",
"matplotlib.pyplot.show",
"utility.mm_to_inch"
] | [((211, 237), 'utility.mm_to_inch', 'mm_to_inch', (['diam_sphere_mm'], {}), '(diam_sphere_mm)\n', (221, 237), False, 'from utility import mm_to_inch\n'), ((1477, 1498), 'copy.deepcopy', 'copy.deepcopy', (['params'], {}), '(params)\n', (1490, 1498), False, 'import copy\n'), ((2044, 2065), 'copy.deepcopy', 'copy.deepcopy... |
from datetime import datetime
from django import forms
from mptt.forms import TreeNodeChoiceField
from .models import EcosystemsAsset, EcosystemsProjectAsset, EcosystemsGISLayer, EcosystemsProject, FilingCode, \
PlantTag, AnimalTag, CommonPlantName, IndigenousPlantName, CommonAnimalName, IndigenousAnimalName
from... | [
"cedar_settings.models.GeneralSetting.objects.get",
"django.forms.CharField"
] | [((4557, 4620), 'cedar_settings.models.GeneralSetting.objects.get', 'GeneralSetting.objects.get', (['"""ecosystems_project_misc_textareas"""'], {}), "('ecosystems_project_misc_textareas')\n", (4583, 4620), False, 'from cedar_settings.models import GeneralSetting\n'), ((5102, 5165), 'cedar_settings.models.GeneralSetting... |
import pygame, random
#Initialize pygame
pygame.init()
#Set display surface
WINDOW_WIDTH = 1000
WINDOW_HEIGHT = 400
display_surface = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT))
pygame.display.set_caption("Feed the Dragon")
#Set FPS and clock
FPS = 60
clock = pygame.time.Clock()
#Set game values
PLAYER_S... | [
"pygame.quit",
"pygame.draw.line",
"random.randint",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.mixer.music.load",
"pygame.init",
"pygame.mixer.music.play",
"pygame.mixer.music.stop",
"pygame.display.update",
"pygame.font.Font",
"pygame.image.load",
"pygame.display.set_caption",
... | [((42, 55), 'pygame.init', 'pygame.init', ([], {}), '()\n', (53, 55), False, 'import pygame, random\n'), ((136, 190), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(WINDOW_WIDTH, WINDOW_HEIGHT)'], {}), '((WINDOW_WIDTH, WINDOW_HEIGHT))\n', (159, 190), False, 'import pygame, random\n'), ((191, 236), 'pygame.di... |
'''
This module gathers the number of various categories under each sequential including
the number of html, videos, verticals etc.
Usage:
python sequential_aggregation.py
'''
from collections import defaultdict
from base_edx import EdXConnection
from generate_csv_report import CSV
connection = EdXConnection('cour... | [
"generate_csv_report.CSV",
"collections.defaultdict",
"base_edx.EdXConnection"
] | [((301, 334), 'base_edx.EdXConnection', 'EdXConnection', (['"""course_structure"""'], {}), "('course_structure')\n", (314, 334), False, 'from base_edx import EdXConnection\n'), ((1405, 1697), 'generate_csv_report.CSV', 'CSV', (['result', "['Sequential ID', 'Chapter Display Name', 'Sequential Name',\n 'Number of Vert... |
# coding: utf-8
"""
AsyncMirrorGroupLinkBandwidthTestResults.py
The Clear BSD License
Copyright (c) – 2016, NetApp, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the follo... | [
"six.iteritems"
] | [((8734, 8763), 'six.iteritems', 'iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (8743, 8763), False, 'from six import iteritems\n')] |
from game import constants
import arcade
import math
class Create_zombie(arcade.Sprite):
"""This class will allow us to create basic zombies with ease"""
def __init__(self, sprite, scalling, zombie_modifier):
super().__init__(sprite, scalling)
self.hit = False
self.count = 0
se... | [
"arcade.load_texture",
"math.cos",
"math.sin",
"math.atan2"
] | [((2564, 2590), 'math.atan2', 'math.atan2', (['y_diff', 'x_diff'], {}), '(y_diff, x_diff)\n', (2574, 2590), False, 'import math\n'), ((2753, 2768), 'math.cos', 'math.cos', (['angle'], {}), '(angle)\n', (2761, 2768), False, 'import math\n'), ((2811, 2826), 'math.sin', 'math.sin', (['angle'], {}), '(angle)\n', (2819, 282... |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\server_commands\debug_commands.py
# Compiled at: 2018-07-12 00:36:27
# Size of source mod 2**32: 748... | [
"zone.set_debug_lag",
"simulate_to_time.SimulateToTime",
"debugger.attach",
"time.sleep",
"services.time_service",
"elements.FunctionElement",
"areaops.trigger_native_assert",
"sys.getrecursionlimit",
"sys.setrecursionlimit"
] | [((721, 770), 'debugger.attach', 'debugger.attach', (['host'], {'port': 'port', 'suspend': 'suspend'}), '(host, port=port, suspend=suspend)\n', (736, 770), False, 'import debugger\n'), ((1231, 1259), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['limit'], {}), '(limit)\n', (1252, 1259), False, 'import sys\n'), ((... |
"""
* The <code>ThreadedTestGroup</code> is a <code>ThreadGroup</code>
* that catches and handles exceptions thrown by threads created
* and started by <code>ThreadedTest</code> instances.
* <p>
* If a thread managed by a <code>ThreadedTestGroup</code> throws
* an uncaught exception, then the exception is added... | [
"ThreadedGroup.ThreadedGroup.__init__"
] | [((865, 899), 'ThreadedGroup.ThreadedGroup.__init__', 'ThreadedGroup.__init__', (['self', 'name'], {}), '(self, name)\n', (887, 899), False, 'from ThreadedGroup import ThreadedGroup\n')] |
from multiprocessing.connection import Listener
import random
import time
print("Manananggal AUTO server version 1.0.0 for UCA Cluster, based in Heimdall")
# Create a socket object and sets up the ports and population size (play with it if you want)
#host = input("Enter the hostname> ")
host = "192.168.102"
po... | [
"random.randint",
"multiprocessing.connection.Listener",
"time.time"
] | [((1052, 1074), 'multiprocessing.connection.Listener', 'Listener', (['(host, port)'], {}), '((host, port))\n', (1060, 1074), False, 'from multiprocessing.connection import Listener\n'), ((3515, 3526), 'time.time', 'time.time', ([], {}), '()\n', (3524, 3526), False, 'import time\n'), ((627, 651), 'random.randint', 'rand... |
#!/usr/bin/env python3
import re
encode = lambda code: list(map(ord,code))
decode = lambda code: "".join(map(chr,code))
#print(decode([99,116,102,47,102,108,97,103,46,116,120,116])) # example decode
# build a lambda-function that takes a string and uses it under the variablename "Math" to be allowed to call it, as th... | [
"re.sub"
] | [((1043, 1071), 're.sub', 're.sub', (['"""[\\\\s\\\\[\\\\]]"""', '""""""', 'a'], {}), "('[\\\\s\\\\[\\\\]]', '', a)\n", (1049, 1071), False, 'import re\n'), ((1093, 1121), 're.sub', 're.sub', (['"""[\\\\s\\\\[\\\\]]"""', '""""""', 'b'], {}), "('[\\\\s\\\\[\\\\]]', '', b)\n", (1099, 1121), False, 'import re\n')] |
# Generated by Django 3.0.3 on 2020-03-18 17:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0003_auto_20200314_1537'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='date_joined',
... | [
"django.db.migrations.RemoveField",
"django.db.models.CharField",
"django.db.models.ImageField",
"django.db.models.EmailField"
] | [((232, 293), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""user"""', 'name': '"""date_joined"""'}), "(model_name='user', name='date_joined')\n", (254, 293), False, 'from django.db import migrations, models\n'), ((338, 398), 'django.db.migrations.RemoveField', 'migrations.RemoveF... |
import os
import kivy
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.button import Button
from cilantro_audit.constants import KIVY_REQUIRED_VERSION
# Required Version
kivy.require(KIVY_REQUIRED_VERSION)
Builder.load_file(os.path.dirname(os.path.abspath(__file__)) + "/widgets/cilantro_button.kv"... | [
"kivy.require",
"os.path.abspath"
] | [((192, 227), 'kivy.require', 'kivy.require', (['KIVY_REQUIRED_VERSION'], {}), '(KIVY_REQUIRED_VERSION)\n', (204, 227), False, 'import kivy\n'), ((262, 287), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (277, 287), False, 'import os\n')] |
import sys
from PyQt5.QtWidgets import (
QApplication,
QHBoxLayout,
QMainWindow,
QShortcut,
QWidget,
QDockWidget,
QLabel
)
from PyQt5.QtCore import Qt
from empyres.core.player import (
PlayerFleets,
PlayerTechnology,
PlayerColors
)
from empyres.core.unit import (
ShipGroup,
... | [
"PyQt5.QtWidgets.QLabel",
"empyres.core.player.PlayerTechnology",
"empyres.ui.unit.FleetInfoWidget",
"empyres.core.player.PlayerFleets",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QDockWidget"
] | [((1287, 1309), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (1299, 1309), False, 'from PyQt5.QtWidgets import QApplication, QHBoxLayout, QMainWindow, QShortcut, QWidget, QDockWidget, QLabel\n'), ((591, 625), 'empyres.core.player.PlayerTechnology', 'PlayerTechnology', (['PlayerCol... |
from django.contrib import admin
from .models import Link, Vote, UserProfile
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth import get_user_model
# Register your models here.
class LinkAdmin(admin.ModelAdmin):
pass
admin.site.register(Link, LinkAdmin)
class VoteAdmin(admin.ModelAdmin)... | [
"django.contrib.auth.get_user_model",
"django.contrib.admin.site.register"
] | [((248, 284), 'django.contrib.admin.site.register', 'admin.site.register', (['Link', 'LinkAdmin'], {}), '(Link, LinkAdmin)\n', (267, 284), False, 'from django.contrib import admin\n'), ((331, 367), 'django.contrib.admin.site.register', 'admin.site.register', (['Vote', 'LinkAdmin'], {}), '(Vote, LinkAdmin)\n', (350, 367... |
from pypot.primitive import LoopPrimitive
from .trajectory import ConstantTrajectory, FootstepTrajectory
from .ik import darwin_ik
from .ik import PELVIS_HEIGHT_REST, FOOT_SPREAD
from numpy import rad2deg
class WalkingState(object):
SINGLE_SUPPORT = 1
DOUBLE_SUPPORT = 2
class WalkStraight(LoopPrimitive):
... | [
"numpy.rad2deg",
"pypot.primitive.LoopPrimitive.__init__"
] | [((396, 442), 'pypot.primitive.LoopPrimitive.__init__', 'LoopPrimitive.__init__', (['self', 'robot', 'frequency'], {}), '(self, robot, frequency)\n', (418, 442), False, 'from pypot.primitive import LoopPrimitive\n'), ((4577, 4587), 'numpy.rad2deg', 'rad2deg', (['q'], {}), '(q)\n', (4584, 4587), False, 'from numpy impor... |
from django.http import HttpResponse
from core.models import Exam
from .htmx_render import htmx_render_page
def index(request):
exams = Exam.objects.order_by("name")
return HttpResponse(htmx_render_page(request, 'ui_htmx/index.html', {'exams': exams}))
| [
"core.models.Exam.objects.order_by"
] | [((143, 172), 'core.models.Exam.objects.order_by', 'Exam.objects.order_by', (['"""name"""'], {}), "('name')\n", (164, 172), False, 'from core.models import Exam\n')] |
from api.models import Token, Room, Hotel, Hub, Service, ServiceAction, ServiceActionQuantity
from rest_framework import serializers
class TokenSerializer(serializers.ModelSerializer):
class Meta:
model = Token
fields = ('id', )
class RecursiveSerializer(serializers.Serializer):
def to_represe... | [
"api.models.Hotel.objects.all"
] | [((1439, 1458), 'api.models.Hotel.objects.all', 'Hotel.objects.all', ([], {}), '()\n', (1456, 1458), False, 'from api.models import Token, Room, Hotel, Hub, Service, ServiceAction, ServiceActionQuantity\n')] |
'''
---------------------------
Licensing and Distribution
---------------------------
Program name: Pilgrim
Version : 2021.5
License : MIT/x11
Copyright (c) 2021, <NAME> (<EMAIL>) and
<NAME> (<EMAIL>)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associat... | [
"numpy.matrix",
"common.fncs.angle",
"common.internal.zmat_thirdatom",
"numpy.zeros",
"numpy.hstack",
"numpy.rad2deg",
"common.internal.get_adjmatrix",
"numpy.vstack",
"common.internal.link_fragments"
] | [((2281, 2299), 'numpy.matrix', 'np.matrix', (['cmatrix'], {}), '(cmatrix)\n', (2290, 2299), True, 'import numpy as np\n'), ((2097, 2148), 'common.internal.get_adjmatrix', 'intl.get_adjmatrix', (['xcc', 'symbols', 'cscal'], {'mode': '"""int"""'}), "(xcc, symbols, cscal, mode='int')\n", (2115, 2148), True, 'import commo... |
# %%
import seaborn as sns
import torch
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import torch.nn.functional as F
from perturb_pca import compute_dot_products
from mpl_toolkits.axes_grid1 import make_axes_locatable
# matplotlib.style.use('seaborn-white')
plt.rcParams['font.family'] = 'Cali... | [
"mpl_toolkits.axes_grid1.make_axes_locatable",
"seaborn.lineplot",
"perturb_pca.compute_dot_products",
"seaborn.despine",
"torch.Tensor",
"numpy.arange",
"matplotlib.pyplot.subplots",
"seaborn.set_theme"
] | [((1989, 2024), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(3)'], {'figsize': '(18, 6)'}), '(1, 3, figsize=(18, 6))\n', (2001, 2024), True, 'import matplotlib.pyplot as plt\n'), ((3038, 3052), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (3050, 3052), True, 'import matplotlib.pyplot as p... |
# Generated by Django 3.0.2 on 2020-02-16 16:59
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("aws_environments", "0006_auto_20200213_1425"),
]
operations = [
migrations.AlterUniqueTogether(
name="project", unique_together={("envir... | [
"django.db.migrations.AlterUniqueTogether"
] | [((236, 333), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""project"""', 'unique_together': "{('environment_id', 'name')}"}), "(name='project', unique_together={(\n 'environment_id', 'name')})\n", (266, 333), False, 'from django.db import migrations\n')] |
import json
from collections.__init__ import OrderedDict
import numpy as np
from PIL import Image
from annotation_predictor.util.class_reader import ClassReader
from annotation_predictor.util.oid_classcode_reader import OIDClassCodeReader
from settings import known_class_ids_annotation_predictor, path_to_model_evalua... | [
"json.load",
"numpy.asarray",
"numpy.zeros",
"numpy.expand_dims",
"PIL.Image.open",
"annotation_predictor.util.oid_classcode_reader.OIDClassCodeReader",
"annotation_predictor.util.class_reader.ClassReader"
] | [((1247, 1296), 'annotation_predictor.util.class_reader.ClassReader', 'ClassReader', (['known_class_ids_annotation_predictor'], {}), '(known_class_ids_annotation_predictor)\n', (1258, 1296), False, 'from annotation_predictor.util.class_reader import ClassReader\n'), ((1666, 1680), 'numpy.zeros', 'np.zeros', (['(1000)']... |
#!/usr/bin/env python
"""Tests for `jasmin_obj_store_policy_mgmt` package."""
__author__ = """<NAME>"""
__contact__ = "<EMAIL>"
__copyright__ = "Copyright 2021 United Kingdom Research and Innovation"
__license__ = "BSD - see LICENSE file in top-level package directory"
import json
import os
import typing
from typing ... | [
"jasmin.obj_store.policy_mgmt.policy.S3Policy.from_string",
"jasmin.obj_store.policy_mgmt.policy.S3Policy.from_file",
"jasmin.obj_store.policy_mgmt.policy.S3Policy",
"typing.cast",
"os.path.dirname",
"click.testing.CliRunner",
"jasmin.obj_store.policy_mgmt.policy.TS3Principal",
"os.path.join",
"jasm... | [((1179, 1190), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (1188, 1190), False, 'from click.testing import CliRunner\n'), ((1716, 1727), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (1725, 1727), False, 'from click.testing import CliRunner\n'), ((2729, 2796), 'jasmin.obj_store.policy_mgmt.po... |
from fastapi import APIRouter
from model.model import ResponseModel
router = APIRouter(
prefix="/echo",
tags=["Echo"],
responses={
404: {"description": "Go away"}
}
)
@router.get("", response_model=ResponseModel)
async def echo():
return ResponseModel(result="Ok", message="Success")
| [
"model.model.ResponseModel",
"fastapi.APIRouter"
] | [((78, 169), 'fastapi.APIRouter', 'APIRouter', ([], {'prefix': '"""/echo"""', 'tags': "['Echo']", 'responses': "{(404): {'description': 'Go away'}}"}), "(prefix='/echo', tags=['Echo'], responses={(404): {'description':\n 'Go away'}})\n", (87, 169), False, 'from fastapi import APIRouter\n'), ((268, 313), 'model.model... |
import wandb
import torch
import torch.nn.functional as F
import pytorch_lightning as pl
from typing import Dict, Optional
class WandbImageCallback(pl.Callback):
def __init__(
self,
classes: Dict[str, int],
sem_classes: Optional[Dict[str, int]]
) -> None:
"""
... | [
"wandb.Image",
"torch.nn.functional.softmax"
] | [((3333, 3375), 'wandb.Image', 'wandb.Image', (['a[i, ...]'], {'caption': '"""Aux maps"""'}), "(a[i, ...], caption='Aux maps')\n", (3344, 3375), False, 'import wandb\n'), ((1496, 1524), 'torch.nn.functional.softmax', 'F.softmax', (['soft_types'], {'dim': '(1)'}), '(soft_types, dim=1)\n', (1505, 1524), True, 'import tor... |
# AUTOGENERATED! DO NOT EDIT! File to edit: evaluation-core.ipynb (unless otherwise specified).
__all__ = ['logger', 'box_area', 'intersection_box', 'union_box', 'intersection_over_union', 'configure_logging']
# Cell
import argparse
import logging
import sys
# Cell
logger = logging.getLogger(__name__)
# Cell
def... | [
"logging.StreamHandler",
"argparse.ArgumentParser",
"logging.getLogger"
] | [((280, 307), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (297, 307), False, 'import logging\n'), ((3309, 3342), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (3330, 3342), False, 'import logging\n'), ((3546, 3571), 'argparse.ArgumentParser',... |
# 读取数据函数
# 1. 标签处理
# 2. 标签编码
# 3. 可视化编码过程
# 4. 定义预处理类
from torch.utils.data import Dataset
import os
from PIL import Image
import CFG
import torchvision.transforms.functional as ff
from torchvision.transforms import transforms
# 图片数据集处理
# return:img,label
class DIV2KDataset(Dataset):
def __init__(self, file_pat... | [
"torchvision.transforms.functional.center_crop",
"torchvision.transforms.transforms.ToTensor",
"PIL.Image.open",
"os.path.join",
"os.listdir"
] | [((1065, 1080), 'PIL.Image.open', 'Image.open', (['img'], {}), '(img)\n', (1075, 1080), False, 'from PIL import Image\n'), ((1097, 1114), 'PIL.Image.open', 'Image.open', (['label'], {}), '(label)\n', (1107, 1114), False, 'from PIL import Image\n'), ((1514, 1530), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', ... |
import requests
import argparse
from multiprocessing import Pool
# list of all paths that wil be created in change diff
stats_path = "/microservice2/stats"
responses_path = "/microservice2/responses"
responses_change_path = "/microservice2/response_change"
latency_path = "/microservice2/latency"
hidden_path = "/micros... | [
"requests.request",
"argparse.ArgumentParser",
"multiprocessing.Pool"
] | [((6012, 6113), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Traffic generator. make sure you activate a server before"""'}), "(description=\n 'Traffic generator. make sure you activate a server before')\n", (6035, 6113), False, 'import argparse\n'), ((1313, 1436), 'requests.request... |
''' for python 3 reqires for of textFSM avialable at https://github.com/jonathanslenders/textfsm
Copyright 2016 Hewlett Packard Enterprise Development LP.
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 o... | [
"json.dumps",
"jtextfsm.TextFSM"
] | [((1138, 1163), 'jtextfsm.TextFSM', 'textfsm.TextFSM', (['template'], {}), '(template)\n', (1153, 1163), True, 'import jtextfsm as textfsm\n'), ((1212, 1245), 'json.dumps', 'json.dumps', (['fsm_results'], {'indent': '(4)'}), '(fsm_results, indent=4)\n', (1222, 1245), False, 'import json\n')] |
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn import datasets
from sklearn.decomposition import PCA
import pandas as pd
from urllib.request import urlretrieve
import numpy as np
from sklearn.linear_model import LogisticRegression # for Logistic Regression Algorithm
from sklearn.mo... | [
"matplotlib.pyplot.show",
"numpy.nan_to_num",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.accuracy_score",
"matplotlib.pyplot.subplots",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.tree.export_graphviz",
"pydotplus.graph_from_dot_data",
"sklearn.model_select... | [((881, 915), 'pandas.read_csv', 'pd.read_csv', (['"""googleplaystore.csv"""'], {}), "('googleplaystore.csv')\n", (892, 915), True, 'import pandas as pd\n'), ((3249, 3263), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (3261, 3263), True, 'import matplotlib.pyplot as plt\n'), ((3518, 3536), 'matplotli... |
import ssl
import sys
import requests
from requests.adapters import HTTPAdapter
## from requests.packages.urllib3.util.retry import Retry
from urllib3.util import Retry
from urllib3 import PoolManager
import six
if six.PY3:
from functools import lru_cache
elif six.PY2:
# python 2 support
from backports.fu... | [
"urllib3.util.Retry",
"requests.Session",
"urllib3.PoolManager",
"backports.functools_lru_cache.lru_cache"
] | [((358, 369), 'backports.functools_lru_cache.lru_cache', 'lru_cache', ([], {}), '()\n', (367, 369), False, 'from backports.functools_lru_cache import lru_cache\n'), ((1838, 1856), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1854, 1856), False, 'import requests\n'), ((1943, 2094), 'urllib3.util.Retry', 'R... |
import os
import time
import torch
import torch.multiprocessing as mp
from rl.envs import GameInterfaceHandler
from rl.model import FullyConv
from rl.optim import SharedAdam
from rl.a3c.worker import worker_fn
from rl.a3c.monitor import monitor_fn
from rl.a3c.summary import writer_fn, Summary
from rl.utils.sys_process... | [
"rl.model.FullyConv",
"os.getpid",
"rl.envs.GameInterfaceHandler",
"torch.load",
"torch.multiprocessing.Value",
"rl.utils.sys_process.kill_child_processes",
"time.sleep",
"torch.multiprocessing.set_start_method",
"torch.multiprocessing.Process",
"torch.multiprocessing.Queue",
"rl.a3c.summary.Sum... | [((371, 399), 'torch.multiprocessing.set_start_method', 'mp.set_start_method', (['"""spawn"""'], {}), "('spawn')\n", (390, 399), True, 'import torch.multiprocessing as mp\n'), ((460, 470), 'torch.multiprocessing.Queue', 'mp.Queue', ([], {}), '()\n', (468, 470), True, 'import torch.multiprocessing as mp\n'), ((487, 518)... |
import os
import sys
# NOTE
# ====
# Renaming should happen in groups based on extention.
# All files should first be renamed with a unique ID.
################################################################################
ERR = False
ALL = ''.join(map(chr, xrange(256)))
NUM = '0123456789'
LET = ALL.translate(ALL,... | [
"os.path.basename",
"os.path.isdir",
"os.walk",
"sys.stderr.write",
"os.path.join"
] | [((1300, 1313), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (1307, 1313), False, 'import os\n'), ((1067, 1086), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (1080, 1086), False, 'import os\n'), ((2247, 2280), 'os.path.join', 'os.path.join', (['root', 'name.filename'], {}), '(root, name.filename)\... |
from typing import Dict, Optional
from doom.levelfinder import LevelData
from doom.levelreaderbase import LevelReaderBase
from doom.level import Level, LevelNamespace, LevelFormat
from doom.udmfparser import UDMFParser, UDMFParserError
from utils.lexer import LexerError
UDMF_NAMESPACE_MAP: Dict[str, LevelNamespace] ... | [
"doom.udmfparser.UDMFParser",
"doom.level.Level"
] | [((962, 974), 'doom.udmfparser.UDMFParser', 'UDMFParser', ([], {}), '()\n', (972, 974), False, 'from doom.udmfparser import UDMFParser, UDMFParserError\n'), ((1099, 1226), 'doom.level.Level', 'Level', (['level_name', 'namespace', 'LevelFormat.UDMF', 'parser.vertices', 'parser.lines', 'parser.sides', 'parser.sectors', '... |
import argparse
import os
from collections import defaultdict
from typing import Dict, List
import ipdb
import torch
import torchvision.transforms as T
import torchvision.transforms.functional as F
from torch import nn
from torch.utils.data import DataLoader, Dataset
from tqdm import tqdm
from yacs.config import CfgN... | [
"argparse.ArgumentParser",
"ipdb.set_trace",
"collections.defaultdict",
"maskrcnn_benchmark.config.cfg.merge_from_list",
"maskrcnn_benchmark.modeling.detector.build_detection_model",
"torch.device",
"torchvision.transforms.Normalize",
"maskrcnn_benchmark.structures.image_list.to_image_list",
"torch.... | [((1350, 1375), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1373, 1375), False, 'import argparse\n'), ((5589, 5658), 'maskrcnn_benchmark.structures.image_list.to_image_list', 'to_image_list', (['batch'], {'size_divisible': 'cfg.DATALOADER.SIZE_DIVISIBILITY'}), '(batch, size_divisible=cfg.DA... |
"""
Generative Adversarial Network for fitting tuning curve generator.
This module implements Wasserstein GAN (`BPTTWassersteinGAN`) to fit
`TuningCurveGenerator`. It is composed of the following components:
- `BPTTWassersteinGAN`
- `.TuningCurveGenerator`: generator
- `UnConditionalDiscriminator`: discriminato... | [
"lasagne.regularization.apply_penalty",
"lasagne.layers.get_all_params",
"numpy.random.RandomState",
"itertools.count",
"lasagne.layers.get_output",
"numpy.array",
"theano.tensor.jacobian",
"theano.tensor.sgn",
"theano.tensor.scalar",
"theano.tensor.matrix"
] | [((2229, 2239), 'theano.tensor.matrix', 'T.matrix', ([], {}), '()\n', (2237, 2239), True, 'from theano import tensor as T\n'), ((2293, 2303), 'theano.tensor.matrix', 'T.matrix', ([], {}), '()\n', (2301, 2303), True, 'from theano import tensor as T\n'), ((2614, 2671), 'lasagne.layers.get_all_params', 'lasagne.layers.get... |
#
# This file is part of LUNA.
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-3-Clause
""" LambdaConcept board platform definitions.
This is a non-core platform. To use it, you'll need to set your LUNA_PLATFORM variable:
> export LUNA_PLATFORM="luna.gateware.platform.lambdaconcept:USB2Sni... | [
"amaranth.build.Pins",
"amaranth.build.DiffPairs",
"amaranth.build.Connector",
"amaranth.Module",
"amaranth.build.Clock",
"os.environ.get",
"amaranth.build.PinsN",
"amaranth.ResetSignal",
"amaranth.ClockDomain",
"amaranth.build.Attrs",
"subprocess.check_call"
] | [((1027, 1034), 'amaranth.build.Attrs', 'Attrs', ([], {}), '()\n', (1032, 1034), False, 'from amaranth.build import Resource, Subsignal, Pins, PinsN, Attrs, Clock, DiffPairs, Connector\n'), ((1809, 1817), 'amaranth.Module', 'Module', ([], {}), '()\n', (1815, 1817), False, 'from amaranth import Elaboratable, ClockDomain... |
import parslepy
from parslepy.base import InvalidKeySyntax
from nose.tools import *
from lxml.etree import XPathSyntaxError
from .tools import *
class TestKeySyntax(object):
with_valid_keys = (
('title_big', ('title_big', None, None, None)),
('title-short(.span)', ('title-short', None, '(.span)', ... | [
"parslepy.base.Parselet.REGEX_PARSELET_KEY.match"
] | [((680, 732), 'parslepy.base.Parselet.REGEX_PARSELET_KEY.match', 'parslepy.base.Parselet.REGEX_PARSELET_KEY.match', (['key'], {}), '(key)\n', (727, 732), False, 'import parslepy\n')] |
from __future__ import unicode_literals
from frappe import msgprint
import frappe
from frappe.model.document import Document
class FiscalYear(Document):
def validate (self):
if(self.start_date > self.end_date):
frappe.throw('Your selected <b>Start Date</b> is more recent than <b>End Date</b>!') | [
"frappe.throw"
] | [((218, 307), 'frappe.throw', 'frappe.throw', (['"""Your selected <b>Start Date</b> is more recent than <b>End Date</b>!"""'], {}), "(\n 'Your selected <b>Start Date</b> is more recent than <b>End Date</b>!')\n", (230, 307), False, 'import frappe\n')] |
import unittest
from typing import Callable, Any
import icontract_hypothesis
from icontract_hypothesis import CallableT
from correct_programs.aoc2020 import day_5_binary_boarding
class TestWithIcontractHypothesis(unittest.TestCase):
def test_functions(self) -> None:
for func in [
day_5_binar... | [
"unittest.main",
"correct_programs.aoc2020.day_5_binary_boarding.determine_id",
"correct_programs.aoc2020.day_5_binary_boarding.determine_row_and_column",
"icontract_hypothesis.test_with_inferred_strategy"
] | [((1501, 1516), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1514, 1516), False, 'import unittest\n'), ((1096, 1165), 'correct_programs.aoc2020.day_5_binary_boarding.determine_row_and_column', 'day_5_binary_boarding.determine_row_and_column', ([], {'identifier': 'identifier'}), '(identifier=identifier)\n', (114... |
from __future__ import annotations
from typing import List
from typing import FrameType
import logging
import traceback
import enum
import datetime
import jsonpickle
import os
from pathlib import Path
from inspect import currentframe, getframeinfo
log = logging.getLogger('ksu.synapse')
class LOG_TYPE(enum.Enum):
... | [
"traceback.TracebackException.from_exception",
"inspect.getframeinfo",
"pathlib.Path",
"inspect.currentframe",
"datetime.datetime.now",
"logging.getLogger",
"jsonpickle.encode"
] | [((255, 287), 'logging.getLogger', 'logging.getLogger', (['"""ksu.synapse"""'], {}), "('ksu.synapse')\n", (272, 287), False, 'import logging\n'), ((1702, 1725), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1723, 1725), False, 'import datetime\n'), ((1773, 1787), 'inspect.currentframe', 'currentf... |
import boto3
import boto3.session
import uuid
from typing import Iterable
from cklib.args import ArgumentParser
from cklib.baseresources import BaseResource
from cklib.graph import Graph
from retrying import retry
from prometheus_client import Counter
from botocore.exceptions import ConnectionClosedError, CredentialRet... | [
"uuid.uuid4",
"prometheus_client.Counter",
"retrying.retry",
"boto3.session.Session"
] | [((363, 468), 'prometheus_client.Counter', 'Counter', (['"""cloudkeeper_plugin_aws_session_exceptions_total"""', '"""Unhandled AWS Plugin Session Exceptions"""'], {}), "('cloudkeeper_plugin_aws_session_exceptions_total',\n 'Unhandled AWS Plugin Session Exceptions')\n", (370, 468), False, 'from prometheus_client impo... |
#! /usr/bin/env python
"""Basic replication core."""
import sys, os, time
import skytools, pgq
__all__ = ['Replicator', 'TableState',
'TABLE_MISSING', 'TABLE_IN_COPY', 'TABLE_CATCHING_UP',
'TABLE_WANNA_SYNC', 'TABLE_DO_SYNC', 'TABLE_OK']
# state # owner - who is allowed to change
TABLE_MISSI... | [
"skytools.quote_fqident",
"os.remove",
"skytools.signal_pidfile",
"pgq.bulk_insert_events",
"skytools.Snapshot",
"os.system",
"time.sleep",
"pgq.SerialConsumer.__init__",
"os.path.isfile",
"sys.exit"
] | [((8647, 8734), 'pgq.SerialConsumer.__init__', 'pgq.SerialConsumer.__init__', (['self', '"""londiste"""', '"""provider_db"""', '"""subscriber_db"""', 'args'], {}), "(self, 'londiste', 'provider_db',\n 'subscriber_db', args)\n", (8674, 8734), False, 'import skytools, pgq\n'), ((15714, 15747), 'skytools.quote_fqident'... |
import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import Input, Dense, DeConv2d, Reshape, BatchNorm2d, Conv2d, Flatten
def get_generator(shape, gf_dim=64): # Dimension of gen filters in the first conv layer. [64]
image_size = 64
s16 = image_size // 16
# w_init = tf.glorot_normal_init... | [
"tensorlayer.models.Model",
"tensorlayer.layers.DeConv2d",
"tensorlayer.layers.BatchNorm2d",
"tensorlayer.layers.Flatten",
"tensorlayer.layers.Reshape",
"tensorlayer.layers.Input",
"tensorflow.random_normal_initializer",
"tensorlayer.layers.Conv2d",
"tensorflow.nn.leaky_relu",
"tensorlayer.layers.... | [((343, 384), 'tensorflow.random_normal_initializer', 'tf.random_normal_initializer', ([], {'stddev': '(0.02)'}), '(stddev=0.02)\n', (371, 384), True, 'import tensorflow as tf\n'), ((404, 443), 'tensorflow.random_normal_initializer', 'tf.random_normal_initializer', (['(1.0)', '(0.02)'], {}), '(1.0, 0.02)\n', (432, 443)... |
import webapp2
import logging
import re
import jinja2
import os
import time
from google.appengine.ext import db
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'])
class Art(db.Model):
title = db.StringProperty()
art = db.TextPr... | [
"google.appengine.ext.db.DateTimeProperty",
"google.appengine.ext.db.GqlQuery",
"google.appengine.ext.db.StringProperty",
"os.path.dirname",
"time.sleep",
"logging.info",
"google.appengine.ext.db.TextProperty",
"webapp2.WSGIApplication"
] | [((2219, 2306), 'webapp2.WSGIApplication', 'webapp2.WSGIApplication', (["[('/', MainPage), ('/favorite', FavoritePage)]"], {'debug': '(True)'}), "([('/', MainPage), ('/favorite', FavoritePage)],\n debug=True)\n", (2242, 2306), False, 'import webapp2\n'), ((284, 303), 'google.appengine.ext.db.StringProperty', 'db.Str... |
from xevo.oobj import oobj
import random
class mob(oobj):
"""multiple oobj are also an oobj"""
def __init__(s,gen_new=None,d=3,mutws=1.0,shallrnd=True):
s.initial()
s.d=d
s.mutws=mutws
if gen_new is None:return#allow initialisations without generation
s.gen_new=gen_ne... | [
"random.random"
] | [((934, 949), 'random.random', 'random.random', ([], {}), '()\n', (947, 949), False, 'import random\n')] |
import argparse
from data import get_loaders
from model import Classifier
from manta.training import ModelTrainer
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--lr", help="Learning rate for the adam optimizer.", type=float, default=10e-4
)
parser.add_argument(
... | [
"data.get_loaders",
"manta.training.ModelTrainer",
"argparse.ArgumentParser",
"model.Classifier"
] | [((145, 170), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (168, 170), False, 'import argparse\n'), ((900, 969), 'data.get_loaders', 'get_loaders', ([], {'batch_size': 'args.batch_size', 'num_workers': 'args.num_workers'}), '(batch_size=args.batch_size, num_workers=args.num_workers)\n', (911,... |
import numpy as np
import os
import shutil
import random
from model_mask_cond import MaskNN
import torch
import sklearn.utils
from torch.nn import functional as F
vector_num = 256
cond_num = 12
rest_pitch = 129
hold_pitch = 128
cpath = "processed_data"
train_path = cpath + "/vae_train_data.npy"
validate_path = cpath + ... | [
"numpy.load",
"model_mask_cond.MaskNN",
"torch.cuda.is_available",
"numpy.array",
"torch.cuda.current_device",
"torch.no_grad",
"torch.from_numpy"
] | [((530, 568), 'numpy.load', 'np.load', (['train_path'], {'allow_pickle': '(True)'}), '(train_path, allow_pickle=True)\n', (537, 568), True, 'import numpy as np\n'), ((582, 619), 'numpy.load', 'np.load', (['test_path'], {'allow_pickle': '(True)'}), '(test_path, allow_pickle=True)\n', (589, 619), True, 'import numpy as n... |
import random
NEIGHBORINGLETTERS = {
'a': ['q', 'w', 's', 'z'],
'b': ['v', 'g', 'h', 'n'],
'c': ['x', 'd', 'f', 'v'],
'd': ['s', 'e', 'r', 'f', 'c', 'x'],
'e': ['r', 'd', 's', 'w'],
'f': ['d', 'r', 't', 'g', 'v', 'c'],
'g': ['f', 't', 'y', 'h', 'b', 'v'],
'h': ['n', 'b', 'g', 'y', 'u', ... | [
"random.randint",
"random.seed",
"random.choice"
] | [((2618, 2635), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (2629, 2635), False, 'import random\n'), ((2774, 2802), 'random.choice', 'random.choice', (['[True, False]'], {}), '([True, False])\n', (2787, 2802), False, 'import random\n'), ((3395, 3412), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\... |
import os
import unittest
from mapswipe_workers.utils import tile_grouping_functions as t
class TestGroupsOverlap(unittest.TestCase):
def setUp(self):
self.test_dir = os.path.dirname(os.path.abspath(__file__))
def test_project_geometries_intersection(self):
zoom = 18
project_extent_f... | [
"unittest.main",
"os.path.abspath",
"mapswipe_workers.utils.tile_grouping_functions.extent_to_groups",
"os.path.join"
] | [((597, 612), 'unittest.main', 'unittest.main', ([], {}), '()\n', (610, 612), False, 'import unittest\n'), ((326, 402), 'os.path.join', 'os.path.join', (['self.test_dir', '"""fixtures/completeness/closed_polygons.geojson"""'], {}), "(self.test_dir, 'fixtures/completeness/closed_polygons.geojson')\n", (338, 402), False,... |
"""Модель данных дивизии"""
import constants
import geometry
DIVISIONS = {
'BTD1': 12,
'RTD1': 12,
'BAD1': 12,
'RAD1': 12,
'BID1': 12,
'RID1': 12
}
RED_NAMES = tuple(x for x in DIVISIONS if 'R' in x)
BLUE_NAMES = tuple(x for x in DIVISIONS if 'B' in x)
TANK_NAMES = tuple(x for x in DIVISIONS if... | [
"geometry.Point"
] | [((764, 812), 'geometry.Point', 'geometry.Point', ([], {'x': "self.pos['x']", 'z': "self.pos['z']"}), "(x=self.pos['x'], z=self.pos['z'])\n", (778, 812), False, 'import geometry\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import cv2
import numpy as np
path = cv2.data.haarcascades + "haarcascade_frontalface_default.xml"
path2 = cv2.data.haarcascades + "haarcascade_eye.xml"
# Inicializa o classificador cascade
face_classifier = cv2.CascadeClassifier(path)
olhos_classifier = cv2.CascadeCla... | [
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.rectangle",
"cv2.CascadeClassifier",
"cv2.destroyAllWindows"
] | [((258, 285), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['path'], {}), '(path)\n', (279, 285), False, 'import cv2\n'), ((306, 334), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['path2'], {}), '(path2)\n', (327, 334), False, 'import cv2\n'), ((382, 401), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], ... |
import requests
import pandas as pd
import plotly.graph_objs as go
def new_case_calculator(data):
if data["date"] < pd.to_datetime("26/11/2020"):
val = data["patients"]
else:
val = data["cases"]
return val
def get_data():
payload = {'format': 'json'}
data = requests.get('https://r... | [
"pandas.to_datetime",
"requests.get"
] | [((297, 431), 'requests.get', 'requests.get', (['"""https://raw.githubusercontent.com/ozanerturk/covid19-turkey-api/master/dataset/timeline.json"""'], {'params': 'payload'}), "(\n 'https://raw.githubusercontent.com/ozanerturk/covid19-turkey-api/master/dataset/timeline.json'\n , params=payload)\n", (309, 431), Fal... |
__author__ = 'rowens'
import logging
import cad_library
MECHANICAL_UNIT_STRESS_PA = "Pa" # Pascals
MECHANICAL_UNIT_STRESS_MPA = "MPa" # Mega Pascals
MECHANICAL_UNIT_DENSITY_KG_PER_M3 = "kg/m^3"
MECHANICAL_UNIT_NONE = "None" # Used for ratios (e.g. modulus_elastic )
MECHANICAL_UNIT_NOT_DEFINED = "Not Defin... | [
"cad_library.exitwitherror",
"logging.getLogger"
] | [((1304, 1323), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1321, 1323), False, 'import logging\n'), ((996, 1112), 'cad_library.exitwitherror', 'cad_library.exitwitherror', (['"""Non-consistent unit scale. All parts should have the same distance units."""', '(-1)'], {}), "(\n 'Non-consistent unit sc... |
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from dymoesco.dynamics.dynamic_models import DoubleIntegrator
matplotlib.use('qt5agg')
nominalu = 2
key_to_u_map = {
'up': [0,nominalu],
'down': [0,-nominalu],
'right': [nominalu,0],
'left': [-nominalu,0]
}
dt = 0.05
di = DoubleIntegrator(... | [
"matplotlib.use",
"dymoesco.dynamics.dynamic_models.DoubleIntegrator"
] | [((142, 166), 'matplotlib.use', 'matplotlib.use', (['"""qt5agg"""'], {}), "('qt5agg')\n", (156, 166), False, 'import matplotlib\n'), ((303, 326), 'dymoesco.dynamics.dynamic_models.DoubleIntegrator', 'DoubleIntegrator', ([], {'dim': '(2)'}), '(dim=2)\n', (319, 326), False, 'from dymoesco.dynamics.dynamic_models import D... |
# coding: utf-8
"""Defines types support"""
import datetime
import json
import re
from collections import defaultdict
### ---------- JSON support -------------- ###
class JsonEncoder(json.JSONEncoder):
"""Add python types encoding. Customs types should dumps to python types first."""
@staticmethod
def c... | [
"datetime.date",
"datetime.datetime",
"collections.defaultdict",
"re.search",
"re.sub"
] | [((1513, 1538), 'datetime.date', 'datetime.date', (['(1800)', '(1)', '(1)'], {}), '(1800, 1, 1)\n', (1526, 1538), False, 'import datetime\n'), ((1558, 1587), 'datetime.datetime', 'datetime.datetime', (['(1800)', '(1)', '(1)'], {}), '(1800, 1, 1)\n', (1575, 1587), False, 'import datetime\n'), ((5017, 5064), 'collections... |
# sudo pip install python-telegram-bot --upgrade
import logging
import os
import subprocess
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import CommandHandler, Updater, CallbackQueryHandler
from shades import runningstateset, runningstateget, tintShadeset, tintBackset, modeset, sa... | [
"shades.runningstateset",
"shades.sandd",
"subprocess.Popen",
"telegram.ext.CallbackQueryHandler",
"logging.basicConfig",
"shades.tintBackset",
"telegram.InlineKeyboardButton",
"shades.getiso",
"os.system",
"telegram.ext.Updater",
"telegram.InlineKeyboardMarkup",
"shades.runningstateget",
"t... | [((350, 457), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)\n", (369, 457), False, 'import logging\n'), ((483, 510), 'loggin... |
from matplotlib import pyplot as plt
import pandas as pd
import numpy as np
from matplotlib.ticker import MaxNLocator
def parse_data(filepath):
i = 0
df = pd.DataFrame()
with open(filepath, 'r') as f:
for line in f:
if "Silhouette coefficient" in line:
df.at[i, "model"... | [
"pandas.DataFrame",
"matplotlib.pyplot.show",
"matplotlib.ticker.MaxNLocator",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig"
] | [((165, 179), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (177, 179), True, 'import pandas as pd\n'), ((1150, 1165), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""k"""'], {}), "('k')\n", (1160, 1165), True, 'from matplotlib import pyplot as plt\n'), ((1533, 1601), 'matplotlib.pyplot.savefig', 'plt.savefig',... |
"""
Parse Tiles Both Ways
"""
import click
import xt
@click.command("xt")
@click.argument("inputtiles", default="-", required=False)
@click.option("--delimiter", "-d", type=str, default="/")
def cli(inputtiles, delimiter):
"""
Automatically onvert a stream of tiles to another format\n
\tz/x/y | z-x-y ==> ... | [
"xt.xvert",
"click.argument",
"click.echo",
"click.option",
"click.command",
"click.open_file"
] | [((56, 75), 'click.command', 'click.command', (['"""xt"""'], {}), "('xt')\n", (69, 75), False, 'import click\n'), ((77, 134), 'click.argument', 'click.argument', (['"""inputtiles"""'], {'default': '"""-"""', 'required': '(False)'}), "('inputtiles', default='-', required=False)\n", (91, 134), False, 'import click\n'), (... |
from order import Order
if __name__ == "__main__":
cart = [
{'name': 'Product 1', 'price': 2.79, 'amount': 1},
{'name': 'Product 2', 'price': 1, 'amount': 3},
{'name': 'Product 3', 'price': 3.49, 'amount': 1},
{'name': 'Product 4', 'price': 1.37, 'amount': 1},
{'name': 'Prod... | [
"order.Order"
] | [((395, 416), 'order.Order', 'Order', (['"""Polska"""', 'cart'], {}), "('Polska', cart)\n", (400, 416), False, 'from order import Order\n'), ((478, 498), 'order.Order', 'Order', (['"""Drugi"""', 'cart'], {}), "('Drugi', cart)\n", (483, 498), False, 'from order import Order\n')] |
"""String field tests."""
from enum import Enum
from pofy.core.errors import ErrorCode
from pofy.fields.enum_field import EnumField
from tests.helpers import check_field
from tests.helpers import check_field_error
class _TestEnum(Enum):
FIRST = 10
SECOND = 20
THIRD = 30
class _EnumObject:
class S... | [
"pofy.fields.enum_field.EnumField",
"tests.helpers.check_field",
"tests.helpers.check_field_error"
] | [((478, 538), 'tests.helpers.check_field', 'check_field', (['_EnumObject', '"""field"""', 'yml_value', 'expected_value'], {}), "(_EnumObject, 'field', yml_value, expected_value)\n", (489, 538), False, 'from tests.helpers import check_field\n'), ((620, 686), 'tests.helpers.check_field_error', 'check_field_error', (['_En... |
"""ADD TheiaPaste Model
Revision ID: 88db21968c0d
Revises: 8c17dcffa2be
Create Date: 2022-04-06 10:25:20.125746
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "8c17dcffa2be"
branch_labels = None
depends_on = None
def upgrade():
# ... | [
"alembic.op.drop_table",
"sqlalchemy.DateTime",
"alembic.op.f",
"sqlalchemy.LargeBinary",
"sqlalchemy.PrimaryKeyConstraint",
"alembic.op.drop_column",
"sqlalchemy.Boolean",
"alembic.op.get_bind",
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.String"
] | [((1509, 1522), 'alembic.op.get_bind', 'op.get_bind', ([], {}), '()\n', (1520, 1522), False, 'from alembic import op\n'), ((1744, 1794), 'alembic.op.drop_column', 'op.drop_column', (['"""assignment"""', '"""anti_cheat_enabled"""'], {}), "('assignment', 'anti_cheat_enabled')\n", (1758, 1794), False, 'from alembic import... |
from django.contrib.auth.models import User
from django.test import TestCase
from nose.tools import eq_
from .fixtures import create_user, create_project
from ..models import Project, Template
class ProjectsManagerTest(TestCase):
def setUp(self):
self.user = create_user('bob')
def tearDown(self):
... | [
"nose.tools.eq_"
] | [((1664, 1689), 'nose.tools.eq_', 'eq_', (['project.author', 'alex'], {}), '(project.author, alex)\n', (1667, 1689), False, 'from nose.tools import eq_\n'), ((1848, 1885), 'nose.tools.eq_', 'eq_', (['project.source', 'project_original'], {}), '(project.source, project_original)\n', (1851, 1885), False, 'from nose.tools... |
import gym
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Normal
import numpy as np
import sys
sys.path.append(".")
from args.config import PPO_continuous_params as params
class PPO(nn.Module):
def __init__(self, learning_rate, miniba... | [
"sys.path.append",
"gym.make",
"torch.exp",
"torch.clamp",
"torch.nn.Linear",
"torch.distributions.Normal",
"torch.no_grad",
"torch.min",
"torch.tensor",
"torch.from_numpy"
] | [((175, 195), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (190, 195), False, 'import sys\n'), ((718, 735), 'torch.nn.Linear', 'nn.Linear', (['(3)', '(128)'], {}), '(3, 128)\n', (727, 735), True, 'import torch.nn as nn\n'), ((757, 774), 'torch.nn.Linear', 'nn.Linear', (['(128)', '(1)'], {}), '(12... |
import sys
print(sys.path)
sys.path.append('./')
print(sys.path)
from modeling import build_model
from data.datasets.cuhk_sysu import CUHK_SYSU
from data.datasets.transformer import get_transform
from tools.util import ship_data_to_cuda,draw_box_in_image
from torch.utils.data import DataLoader
import torch
from tqdm i... | [
"sys.path.append",
"data.datasets.transformer.get_transform",
"matplotlib.pyplot.show",
"torch.utils.data.DataLoader",
"matplotlib.pyplot.ioff",
"matplotlib.pyplot.imshow",
"torch.load",
"numpy.where",
"tools.util.draw_box_in_image",
"tools.util.ship_data_to_cuda"
] | [((27, 48), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (42, 48), False, 'import sys\n'), ((563, 585), 'torch.load', 'torch.load', (['model_path'], {}), '(model_path)\n', (573, 585), False, 'import torch\n'), ((740, 819), 'torch.utils.data.DataLoader', 'DataLoader', (['testset'], {'batch_size'... |
import requests
from bs4 import BeautifulSoup
import re
class SOthread:
def __init__(self,url):
self.url = url
maxattempt = 3
for i in range(1,maxattempt+1):
try:
page = requests.get(url, timeout=10)
break
except requests.Timeout:
... | [
"bs4.BeautifulSoup",
"re.search",
"requests.get",
"re.compile"
] | [((520, 562), 'bs4.BeautifulSoup', 'BeautifulSoup', (['page.content', '"""html.parser"""'], {}), "(page.content, 'html.parser')\n", (533, 562), False, 'from bs4 import BeautifulSoup\n'), ((636, 662), 're.search', 're.search', (['"""^.*?\\\\d+"""', 'url'], {}), "('^.*?\\\\d+', url)\n", (645, 662), False, 'import re\n'),... |
# Shoddy directory-wise run script
import os
import json
import sys
from pprint import pprint
from bytes_encoder import BytesEncoder
from tf2_dem_py.flags import FLAGS
from tf2_dem_py.demo_parser import DemoParser
p = sys.argv[1]
for i, file in enumerate([os.path.join(p, i) for i in os.listdir(p) if i.endswith(".... | [
"json.dump",
"tf2_dem_py.demo_parser.DemoParser",
"os.path.join",
"os.listdir"
] | [((348, 391), 'tf2_dem_py.demo_parser.DemoParser', 'DemoParser', (['(FLAGS.CHAT | FLAGS.COMPACT_CHAT)'], {}), '(FLAGS.CHAT | FLAGS.COMPACT_CHAT)\n', (358, 391), False, 'from tf2_dem_py.demo_parser import DemoParser\n'), ((262, 280), 'os.path.join', 'os.path.join', (['p', 'i'], {}), '(p, i)\n', (274, 280), False, 'impor... |
import os
import setuptools
import subprocess
import sys
def shell_command(command, short_description):
"""Create a simple command that is invoked using subprocess."""
class ShellCommand(setuptools.Command):
"""Run custom script when invoked."""
description = short_description
user_o... | [
"os.path.expanduser",
"setuptools.setup",
"os.path.realpath",
"subprocess.call",
"os.path.join",
"os.listdir",
"setuptools.find_packages"
] | [((1195, 1221), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (1219, 1221), False, 'import setuptools\n'), ((1826, 2178), 'setuptools.setup', 'setuptools.setup', ([], {'install_requires': 'REQUIRES', 'python_requires': '""">=3.7"""', 'scripts': 'SCRIPTS', 'data_files': 'DATA_FILES', 'package... |
from marshmallow import fields, Schema
class BaseNodeDBSerializator(Schema):
type = fields.String() # Тип объекта строкой
format_sign = fields.Boolean(allow_none=True) # Признак формата в строке Boolean
path = fields.String(allow_none=True) # Полный путь до файла
filename = fields.String(allow_none=Tru... | [
"marshmallow.fields.Integer",
"marshmallow.fields.Boolean",
"marshmallow.fields.String"
] | [((89, 104), 'marshmallow.fields.String', 'fields.String', ([], {}), '()\n', (102, 104), False, 'from marshmallow import fields, Schema\n'), ((145, 176), 'marshmallow.fields.Boolean', 'fields.Boolean', ([], {'allow_none': '(True)'}), '(allow_none=True)\n', (159, 176), False, 'from marshmallow import fields, Schema\n'),... |
from pathlib import Path
import json
import sys
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
import numpy as np
import matplotlib.pyplot as plt
from sklearn.dummy import DummyClassifier
from sklearn.metrics import accuracy_score
from src import DataProcessor,... | [
"matplotlib.pyplot.title",
"pathlib.Path",
"matplotlib.pyplot.figure",
"torch.device",
"torch.no_grad",
"sklearn.dummy.DummyClassifier",
"numpy.zeros_like",
"logging.FileHandler",
"torch.utils.data.DataLoader",
"src.binary_accuracy",
"torch.load",
"torch.cuda.set_device",
"src.Model",
"src... | [((1604, 1621), 'pathlib.Path', 'Path', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (1608, 1621), False, 'from pathlib import Path\n'), ((2354, 2381), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2371, 2381), False, 'import logging\n'), ((2399, 2430), 'torch.manual_seed', 'torch.manual_s... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | [
"numpy.frombuffer",
"paddle.fluid.core.GETensor",
"paddle.fluid.core.GEShape",
"numpy.ones"
] | [((5204, 5230), 'paddle.fluid.core.GETensor', 'core.GETensor', (['tensor_desc'], {}), '(tensor_desc)\n', (5217, 5230), True, 'import paddle.fluid.core as core\n'), ((5391, 5425), 'numpy.frombuffer', 'np.frombuffer', (['buf'], {'dtype': 'np.uint8'}), '(buf, dtype=np.uint8)\n', (5404, 5425), True, 'import numpy as np\n')... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import time
import argparse
import numpy as np
from scipy.sparse import csr_matrix
import pandas as pd
import logging
from sklearn.decomposition import TruncatedSVD
from sklearn.linear_model import LinearRegres... | [
"torch.mean",
"torch.ones",
"torch.nn.ReLU",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"torch.autograd.grad",
"time.time",
"model.Generator",
"torch.cuda.is_available",
"torch.device",
"model.Discriminator"
] | [((584, 609), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (607, 609), False, 'import argparse\n'), ((2518, 2543), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (2541, 2543), False, 'import torch\n'), ((2601, 2618), 'torch.device', 'torch.device', (['dev'], {}), '(de... |
"""
A class that is responsible for detecting a barcode and extracting information
from said barcode.
"""
import numpy as np
import cv2
import zbar.misc
__author__ = "<NAME>"
__copyright__ = "Copyright 2017, Java the Hutts"
__license__ = "BSD"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"... | [
"cv2.GaussianBlur",
"cv2.subtract",
"numpy.int0",
"cv2.dilate",
"cv2.cvtColor",
"cv2.getStructuringElement",
"cv2.threshold",
"cv2.morphologyEx",
"cv2.blur",
"cv2.boxPoints",
"cv2.convertScaleAbs",
"cv2.minAreaRect",
"cv2.erode",
"cv2.boundingRect",
"cv2.Sobel"
] | [((1854, 1893), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2GRAY'], {}), '(image, cv2.COLOR_BGR2GRAY)\n', (1866, 1893), False, 'import cv2\n'), ((1912, 1968), 'cv2.Sobel', 'cv2.Sobel', (['gray'], {'ddepth': 'cv2.CV_32F', 'dx': '(1)', 'dy': '(0)', 'ksize': '(-1)'}), '(gray, ddepth=cv2.CV_32F, dx=1, dy=0, k... |
# -*- mode:python; coding:utf-8 -*-
# Copyright (c) 2020 IBM Corp. 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
#
# ... | [
"compliance.evidence.evidences",
"arboretum.auditree.evidences.repo_commit.RepoCommitEvidence.from_evidence",
"urllib.parse.urlparse",
"compliance.evidence.ReportEvidence"
] | [((1904, 1922), 'urllib.parse.urlparse', 'urlparse', (['repo_url'], {}), '(repo_url)\n', (1912, 1922), False, 'from urllib.parse import urlparse\n'), ((1388, 1500), 'compliance.evidence.ReportEvidence', 'ReportEvidence', (['"""filepath_new_commits.md"""', '"""auditree"""', 'DAY', '"""Repository/branch/filepath new comm... |
# Generated by Django 3.0.6 on 2020-05-22 11:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('spreadsheetui', '0002_auto_20200522_0752'),
]
operations = [
migrations.RemoveField(
model_name='job',
name='source_... | [
"django.db.migrations.RemoveField",
"django.db.models.BooleanField"
] | [((241, 303), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""job"""', 'name': '"""source_client"""'}), "(model_name='job', name='source_client')\n", (263, 303), False, 'from django.db import migrations, models\n'), ((449, 483), 'django.db.models.BooleanField', 'models.BooleanField... |
# -*- coding: utf-8 -*-
"""nnetwork.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1pMeLa_X6bXVDBF07Nf5ISyPfmGEpurvH
"""
import pandas as pd
import numpy as np
# first neural network with keras tutorial
from numpy import loadtxt
from sklearn.mod... | [
"numpy.random.seed",
"tensorflow.keras.layers.Dense",
"pandas.read_csv",
"numpy.corrcoef",
"sklearn.model_selection.train_test_split",
"numpy.array",
"tensorflow.keras.models.Sequential",
"tensorflow.test.gpu_device_name"
] | [((495, 520), 'tensorflow.test.gpu_device_name', 'tf.test.gpu_device_name', ([], {}), '()\n', (518, 520), True, 'import tensorflow as tf\n'), ((718, 781), 'pandas.read_csv', 'pd.read_csv', (['"""/content/drive/MyDrive/data_1000.csv"""'], {'nrows': '(1000)'}), "('/content/drive/MyDrive/data_1000.csv', nrows=1000)\n", (7... |
# Generated by Django 2.0.13 on 2019-06-17 08:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("contacts", "0005_auto_20190520_1322"),
]
operations = [
migrations.RemoveField(model_name="contactuser", name="case",),
migrations.RemoveFi... | [
"django.db.migrations.RemoveField",
"django.db.migrations.DeleteModel"
] | [((229, 290), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""contactuser"""', 'name': '"""case"""'}), "(model_name='contactuser', name='case')\n", (251, 290), False, 'from django.db import migrations\n'), ((301, 365), 'django.db.migrations.RemoveField', 'migrations.RemoveField', (... |
#!/usr/bin/python3
#coding:utf-8
import os, sys
class Stream:
EOF = (-1)
def __init__(self, src):
self._src = src
self._limit = len(src)
self._index = 0
def eof(self):
return self._index >= self._limit or self._index < 0
def get(self):
if self.eof():
return self.EOF
ch = self.... | [
"sys.stdin.readline"
] | [((5837, 5857), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (5855, 5857), False, 'import os, sys\n')] |
from pyflink.common import ExecutionMode, RestartStrategies
from pyflink.common.serialization import JsonRowDeserializationSchema
from pyflink.common.typeinfo import Types
from pyflink.dataset import ExecutionEnvironment
from pyflink.datastream import StreamExecutionEnvironment, CheckpointingMode, ExternalizedCheckpoin... | [
"pyflink.common.serialization.JsonRowDeserializationSchema.builder",
"pyflink.datastream.StreamExecutionEnvironment.get_execution_environment",
"pyflink.datastream.RocksDBStateBackend",
"pyflink.common.RestartStrategies.fixed_delay_restart",
"pyflink.common.typeinfo.Types.STRING",
"pyflink.common.typeinfo... | [((565, 619), 'pyflink.datastream.StreamExecutionEnvironment.get_execution_environment', 'StreamExecutionEnvironment.get_execution_environment', ([], {}), '()\n', (617, 619), False, 'from pyflink.datastream import StreamExecutionEnvironment, CheckpointingMode, ExternalizedCheckpointCleanup, TimeCharacteristic, RocksDBS... |
"""
### cache.py
### author : <NAME>
### created : 2019-05-01
"""
"""
Leave all the records in the text file.
If the administrator uses the student number to search the log file,
he can see the time and number of times he escaped.
"""
#!/usr/bin/python
#-------------------------------------------------------------... | [
"datetime.datetime.now"
] | [((456, 470), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (468, 470), False, 'from datetime import datetime\n')] |
"""Tests for the ANN strategy."""
import unittest
import axelrod
from axelrod.strategies.ann import split_weights
from .test_player import TestMatch, TestPlayer
C, D = axelrod.Actions.C, axelrod.Actions.D
class TestSplitWeights(unittest.TestCase):
def test_split_weights(self):
with self.assertRaises(Va... | [
"axelrod.Defector",
"axelrod.EvolvedANNNoise05",
"axelrod.EvolvedANN",
"axelrod.TitForTat",
"axelrod.Cooperator",
"axelrod.EvolvedANN5",
"axelrod.strategies.ann.split_weights"
] | [((399, 429), 'axelrod.strategies.ann.split_weights', 'split_weights', (['([0] * 70)', '(5)', '(10)'], {}), '([0] * 70, 5, 10)\n', (412, 429), False, 'from axelrod.strategies.ann import split_weights\n'), ((434, 464), 'axelrod.strategies.ann.split_weights', 'split_weights', (['([0] * 12)', '(10)', '(1)'], {}), '([0] * ... |
##############################################################################
#
# Copyright (c) 2009 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [
"ZODB.POSException.UndoError",
"zope.interface.implementer",
"relstorage.iter.fetchmany",
"time.time",
"relstorage.treemark.TreeMarker",
"relstorage._compat.db_binary_to_bytes",
"ZODB.utils.u64",
"logging.getLogger"
] | [((1120, 1147), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1137, 1147), False, 'import logging\n'), ((5183, 5205), 'zope.interface.implementer', 'implementer', (['IPackUndo'], {}), '(IPackUndo)\n', (5194, 5205), False, 'from zope.interface import implementer\n'), ((29682, 29704), 'zo... |
# coding=utf-8
# Copyright 2018 The DisentanglementLib Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | [
"tensorflow.compat.v1.train.get_or_create_global_step",
"six.moves.range",
"tensorflow.compat.v1.pow",
"disentanglement_lib.methods.shared.optimizers.make_vae_optimizer",
"tensorflow.compat.v1.test.main",
"tensorflow.compat.v1.Variable",
"tensorflow.compat.v1.global_variables_initializer"
] | [((3199, 3213), 'tensorflow.compat.v1.test.main', 'tf.test.main', ([], {}), '()\n', (3211, 3213), True, 'import tensorflow.compat.v1 as tf\n'), ((2601, 2617), 'tensorflow.compat.v1.Variable', 'tf.Variable', (['(0.0)'], {}), '(0.0)\n', (2612, 2617), True, 'import tensorflow.compat.v1 as tf\n'), ((2628, 2648), 'tensorflo... |
"""
Route to join a game.
"""
from typing import Dict
from fastapi import APIRouter, HTTPException, Security, status
from whist.core.user.player import Player
from whist.server.database.warning import PlayerAlreadyJoinedWarning
from whist.server.services.authentication import get_current_user
from whist.server.servic... | [
"fastapi.HTTPException",
"whist.server.services.password.PasswordService",
"fastapi.Security",
"whist.server.services.game_db_service.GameDatabaseService",
"fastapi.APIRouter"
] | [((435, 460), 'fastapi.APIRouter', 'APIRouter', ([], {'prefix': '"""/game"""'}), "(prefix='/game')\n", (444, 460), False, 'from fastapi import APIRouter, HTTPException, Security, status\n'), ((580, 606), 'fastapi.Security', 'Security', (['get_current_user'], {}), '(get_current_user)\n', (588, 606), False, 'from fastapi... |
# The MIT License (MIT)
# Copyright © 2021 <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, ... | [
"bittensor.wallet",
"unittest.mock.MagicMock",
"os.path.exists",
"time.time",
"os.path.isfile",
"bittensor.utils.balance.Balance",
"bittensor.wallet.config",
"shutil.rmtree",
"bittensor.subtensor",
"bittensor.wallet.mock"
] | [((1312, 1339), 'os.path.exists', 'os.path.exists', (['wallet_path'], {}), '(wallet_path)\n', (1326, 1339), False, 'import os\n'), ((1398, 1464), 'bittensor.wallet', 'bittensor.wallet', ([], {'path': 'wallet_path', 'name': '"""pytest"""', 'hotkey': '"""pytest"""'}), "(path=wallet_path, name='pytest', hotkey='pytest')\n... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ckanext.cloudstorage.storage import ResourceCloudStorage
from ckan.logic import get_action
def use_secure_urls():
return all([
ResourceCloudStorage.use_secure_urls.fget(None),
# Currently implemented just AWS version
'S3' in ResourceCloudS... | [
"ckan.logic.get_action",
"ckanext.cloudstorage.storage.ResourceCloudStorage.driver_options.fget",
"ckanext.cloudstorage.storage.ResourceCloudStorage.driver_name.fget",
"ckanext.cloudstorage.storage.ResourceCloudStorage.use_secure_urls.fget"
] | [((499, 541), 'ckan.logic.get_action', 'get_action', (['"""cloudstorage_check_multipart"""'], {}), "('cloudstorage_check_multipart')\n", (509, 541), False, 'from ckan.logic import get_action\n'), ((192, 239), 'ckanext.cloudstorage.storage.ResourceCloudStorage.use_secure_urls.fget', 'ResourceCloudStorage.use_secure_urls... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
# 通过tf.set_random_seed设定种子数,后面定义的全部变量都可以跨会话生成相同的随机数
tf.set_random_seed(1)
np.random.seed(1)
learn_rate = 0.01
batch_size = 64
xdata = np.linspace(-1, 1, 100)[:, np.newaxis] # shape (100,... | [
"matplotlib.pyplot.show",
"numpy.random.seed",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"tensorflow.global_variables_initializer",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"numpy.power",
"tensorflow.Session",
"tensorflow.layers.dense",
"tensorflow.losses.mean_squared_e... | [((171, 192), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(1)'], {}), '(1)\n', (189, 192), True, 'import tensorflow as tf\n'), ((193, 210), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (207, 210), True, 'import numpy as np\n'), ((332, 374), 'numpy.random.normal', 'np.random.normal', (['(0)'... |
"""
A view representing an instance of a requestnt of interest. Requests can be added, changed or retrieved via this view.
"""
import logging
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
from django.shortcuts import render, redirect
from django.util... | [
"django.contrib.auth.decorators.permission_required",
"django.shortcuts.redirect",
"django.shortcuts.render",
"django.utils.translation.ugettext",
"logging.getLogger"
] | [((465, 492), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (482, 492), False, 'import logging\n'), ((540, 604), 'django.contrib.auth.decorators.permission_required', 'permission_required', (['"""cms.manage_requests"""'], {'raise_exception': '(True)'}), "('cms.manage_requests', raise_exc... |
import fractions, sys
if sys.version_info.major == 2:
range = xrange
def compute():
P = 1009
Q = 3643
TOTIENT = (P - 1) * (Q - 1)
numunconcealedp = count_all_unconcealed(P)
numunconcealedq = count_all_unconcealed(Q)
minunconcealedp = min(numunconcealedp)
minunconcealedq = min(numunconcealedq)
ans = sum(e f... | [
"fractions.gcd"
] | [((550, 577), 'fractions.gcd', 'fractions.gcd', (['e', '(prime - 1)'], {}), '(e, prime - 1)\n', (563, 577), False, 'import fractions, sys\n')] |
#!/usr/bin/env python
# Copyright 2021 Hyperia
#
# 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 ... | [
"json.dumps",
"hyperia.Hyperia"
] | [((979, 988), 'hyperia.Hyperia', 'Hyperia', ([], {}), '()\n', (986, 988), False, 'from hyperia import Hyperia\n'), ((1356, 1386), 'json.dumps', 'json.dumps', (['response'], {'indent': '(4)'}), '(response, indent=4)\n', (1366, 1386), False, 'import json\n')] |
from osgeo.osr import OAMS_TRADITIONAL_GIS_ORDER
from osgeo_utils.samples.gdallocationinfo import gdallocationinfo
from pywps import FORMATS
from pywps.app import Process
from .process_defaults import process_defaults, LiteralInputD
from pywps.app.Common import Metadata
from pywps.response.execute import ExecuteRespon... | [
"osgeo_utils.samples.gdallocationinfo.gdallocationinfo",
"processes.process_helper.get_ovr",
"processes.io_generator.input_srs",
"processes.io_generator.output_r",
"pywps.app.Common.Metadata",
"processes.process_helper.get_location_info_srs",
"processes.process_helper.open_ds_from_wps_input",
"process... | [((1431, 1492), 'processes.process_helper.open_ds_from_wps_input', 'process_helper.open_ds_from_wps_input', (["request.inputs['r'][0]"], {}), "(request.inputs['r'][0])\n", (1468, 1492), False, 'from processes import process_helper\n'), ((1558, 1610), 'processes.process_helper.get_location_info_srs', 'process_helper.get... |
import json
import os
import jsonschema
from jsonschema import ValidationError
from traitlets.config import LoggingConfigurable
root = os.path.dirname(__file__)
class BaseValidator(LoggingConfigurable):
schema = None
def __init__(self, version):
if self.schema is None:
with open(os.pat... | [
"jsonschema.validate",
"os.path.dirname"
] | [((138, 163), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (153, 163), False, 'import os\n'), ((801, 860), 'jsonschema.validate', 'jsonschema.validate', (["cell.metadata['nbgrader']", 'self.schema'], {}), "(cell.metadata['nbgrader'], self.schema)\n", (820, 860), False, 'import jsonschema\n'... |
import os
from spira.technologies.mit.process import RDD
import spira.all as spira
import spira.yevon.io.input_gdsii as io
from copy import copy, deepcopy
if __name__ == '__main__':
# file_name = '/home/therealtyler/code/phd/spira/tests/8-parse/jj_mitll.gds'
# file_name = '/home/therealtyler/code/phd/spira/t... | [
"spira.all.InputGdsii"
] | [((945, 1020), 'spira.all.InputGdsii', 'spira.InputGdsii', ([], {'file_name': 'file_name', 'layer_map': 'RDD.GDSII.IMPORT_LAYER_MAP'}), '(file_name=file_name, layer_map=RDD.GDSII.IMPORT_LAYER_MAP)\n', (961, 1020), True, 'import spira.all as spira\n')] |
import sys
from PyQt5 import QtCore, QtWidgets
import subprocess
import os
class EmbTerminal(QtWidgets.QWidget):
def __init__(self, parent=None):
super(EmbTerminal, self).__init__(parent)
self.resize(1280, 720)
self.process = QtCore.QProcess(self)
self.terminal = QtWidgets.QWidget(... | [
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtCore.QProcess",
"PyQt5.QtWidgets.QWidget"
] | [((1818, 1850), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (1840, 1850), False, 'from PyQt5 import QtCore, QtWidgets\n'), ((256, 277), 'PyQt5.QtCore.QProcess', 'QtCore.QProcess', (['self'], {}), '(self)\n', (271, 277), False, 'from PyQt5 import QtCore, QtWidgets\n'), (... |
from __future__ import annotations
import itertools
from functools import partial
from typing import Dict, List
import dill
import numpy as np
import pandas as pd
import plotly.figure_factory as ff
import plotly.graph_objects as go
from plotly.graph_objs import Figure
from plotly.subplots import make_subplots
class... | [
"functools.partial",
"plotly.graph_objects.layout.Margin",
"plotly.figure_factory.create_annotated_heatmap",
"itertools.groupby",
"plotly.graph_objects.layout.Annotation"
] | [((8594, 8625), 'itertools.groupby', 'itertools.groupby', (['self.data[0]'], {}), '(self.data[0])\n', (8611, 8625), False, 'import itertools\n'), ((7320, 7349), 'functools.partial', 'partial', (['np.round'], {'decimals': '(3)'}), '(np.round, decimals=3)\n', (7327, 7349), False, 'from functools import partial\n'), ((740... |
#!/usr/bin/python
import sys
import re
import pysam
import os
from collections import Counter
from contextlib import contextmanager
bamfile = sys.argv[1]
outfolder = sys.argv[2]
barcodeTag = sys.argv[3]
min_barcodes = int(sys.argv[4])
mtchr = sys.argv[5]
quant_file = sys.argv[6]
passing_file = sys.argv[7]
base=os.pa... | [
"pysam.AlignmentFile",
"os.path.splitext",
"os.path.basename"
] | [((315, 340), 'os.path.basename', 'os.path.basename', (['bamfile'], {}), '(bamfile)\n', (331, 340), False, 'import os\n'), ((350, 372), 'os.path.splitext', 'os.path.splitext', (['base'], {}), '(base)\n', (366, 372), False, 'import os\n'), ((661, 695), 'pysam.AlignmentFile', 'pysam.AlignmentFile', (['bamfile', '"""rb"""... |
import numpy as np
from scipy import linalg
from numpy.testing import assert_almost_equal
from megamix.online.base import _log_normal_matrix
from megamix.online.base import _full_covariance_matrices, _spherical_covariance_matrices
from megamix.utils_testing import generate
def test_log_normal_matrix_full():
n_poin... | [
"megamix.online.base._full_covariance_matrices",
"numpy.sum",
"numpy.log",
"megamix.online.base._log_normal_matrix",
"numpy.random.randn",
"numpy.empty",
"numpy.testing.assert_almost_equal",
"scipy.linalg.cholesky",
"megamix.utils_testing.generate.generate_covariance_matrices_full",
"numpy.linalg.... | [((376, 413), 'numpy.random.randn', 'np.random.randn', (['n_points', 'n_features'], {}), '(n_points, n_features)\n', (391, 413), True, 'import numpy as np\n'), ((425, 466), 'numpy.random.randn', 'np.random.randn', (['n_components', 'n_features'], {}), '(n_components, n_features)\n', (440, 466), True, 'import numpy as n... |
import json
from botocore.stub import Stubber
from freezegun import freeze_time
from datahub.ingestion.api.common import PipelineContext
from datahub.ingestion.source.sagemaker import SagemakerSource, SagemakerSourceConfig
from datahub.ingestion.source.sagemaker_processors.jobs import SAGEMAKER_JOB_TYPES
from tests.t... | [
"json.dump",
"datahub.ingestion.api.common.PipelineContext",
"tests.unit.test_sagemaker_source_stubs.job_stubs.items",
"tests.test_helpers.mce_helpers.check_golden_file",
"botocore.stub.Stubber",
"datahub.ingestion.source.sagemaker.SagemakerSourceConfig",
"freezegun.freeze_time"
] | [((1446, 1470), 'freezegun.freeze_time', 'freeze_time', (['FROZEN_TIME'], {}), '(FROZEN_TIME)\n', (1457, 1470), False, 'from freezegun import freeze_time\n'), ((6943, 7103), 'tests.test_helpers.mce_helpers.check_golden_file', 'mce_helpers.check_golden_file', (['pytestconfig'], {'output_path': "(tmp_path / 'sagemaker_mc... |
# =============================================================================
# Copyright 2020 NVIDIA. 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://ww... | [
"random.randint",
"numpy.asarray",
"nemo.collections.nlp.utils.callback_utils.get_classification_report",
"nemo.collections.nlp.utils.callback_utils.plot_confusion_matrix",
"nemo.logging.info",
"numpy.mean",
"nemo.collections.nlp.utils.callback_utils.get_f1_scores",
"nemo.collections.nlp.utils.callbac... | [((3299, 3343), 'numpy.asarray', 'np.asarray', (["global_vars['all_intent_labels']"], {}), "(global_vars['all_intent_labels'])\n", (3309, 3343), True, 'import numpy as np\n'), ((3363, 3406), 'numpy.asarray', 'np.asarray', (["global_vars['all_intent_preds']"], {}), "(global_vars['all_intent_preds'])\n", (3373, 3406), Tr... |
import unittest
from azul import price_manager_registry
from datetime import datetime, timedelta
from click.testing import CliRunner
import tempfile
import pathlib
import azul
class TestPolygonPriceManager(unittest.TestCase):
def setUp(self):
# Set start date a few days before today
self.start_da... | [
"tempfile.TemporaryDirectory",
"pathlib.Path",
"datetime.timedelta",
"click.testing.CliRunner",
"datetime.datetime.now",
"azul.price_manager_registry.get"
] | [((681, 718), 'azul.price_manager_registry.get', 'price_manager_registry.get', (['"""polygon"""'], {}), "('polygon')\n", (707, 718), False, 'from azul import price_manager_registry\n'), ((597, 634), 'azul.price_manager_registry.get', 'price_manager_registry.get', (['"""polygon"""'], {}), "('polygon')\n", (623, 634), Fa... |
"""
Support for KNX components.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/knx/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (
EVENT_HOMEASSISTANT_STOP, CONF_H... | [
"knxip.core.parse_group_address",
"voluptuous.Optional",
"knxip.ip.KNXIPTunnel",
"logging.getLogger"
] | [((426, 453), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (443, 453), False, 'import logging\n'), ((1175, 1198), 'knxip.ip.KNXIPTunnel', 'KNXIPTunnel', (['host', 'port'], {}), '(host, port)\n', (1186, 1198), False, 'from knxip.ip import KNXIPTunnel\n'), ((8168, 8193), 'knxip.core.parse... |