code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pycurl
import select
import six
import logging
from threading import Lock
from grab.error import GrabTooManyRedirectsError
ERROR_TOO_MANY_REFRESH_REDIRECTS = -2
#ERROR_INTERNAL_GRAB_ERROR = -3
ERROR_ABBR = {
ERROR_TOO_MANY_REFRESH_REDIRECTS: 'too-many-refresh-redirects',
#ERROR_INTERNAL_GRAB_ERROR: 'in... | [
"six.moves.range",
"threading.Lock",
"select.select",
"pycurl.CurlMulti",
"pycurl.Curl"
] | [((631, 649), 'pycurl.CurlMulti', 'pycurl.CurlMulti', ([], {}), '()\n', (647, 649), False, 'import pycurl\n'), ((802, 808), 'threading.Lock', 'Lock', ([], {}), '()\n', (806, 808), False, 'from threading import Lock\n'), ((859, 894), 'six.moves.range', 'six.moves.range', (['self.socket_number'], {}), '(self.socket_numbe... |
import pygame
import screen
import os
import socket
import protocol
import logging
from screen import *
clock = pygame.time.Clock()
BACKGROUND_IMAGE_PATH = os.path.join(PICTURES_PATH, 'opening_screen_picture.png')
bg_image = pygame.image.load(BACKGROUND_IMAGE_PATH)
bg_image = pygame.transform.scale(bg_image, (SCREEN_... | [
"logging.debug",
"pygame.draw.rect",
"pygame.event.get",
"pygame.Rect",
"socket.socket",
"screen.blit",
"pygame.display.flip",
"pygame.transform.scale",
"pygame.image.load",
"pygame.mouse.get_pos",
"protocol.Request",
"pygame.time.Clock",
"os.path.join"
] | [((113, 132), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (130, 132), False, 'import pygame\n'), ((158, 215), 'os.path.join', 'os.path.join', (['PICTURES_PATH', '"""opening_screen_picture.png"""'], {}), "(PICTURES_PATH, 'opening_screen_picture.png')\n", (170, 215), False, 'import os\n'), ((227, 267), 'p... |
from dataclasses import dataclass
import dataclasses
import argparse
from hashlib import pbkdf2_hmac
from typing import Mapping, Any
from interstate_love_song.mapping.base import *
def hash_pass(s: str, salt="IGNORED"):
"""Hash a password.
Not the best way to store a password since the salt is known, but i... | [
"dataclasses.field",
"interstate_love_song.settings.load_dict_into_dataclass",
"argparse.ArgumentParser"
] | [((615, 661), 'dataclasses.field', 'dataclasses.field', ([], {'default_factory': '(lambda : [])'}), '(default_factory=lambda : [])\n', (632, 661), False, 'import dataclasses\n'), ((690, 736), 'dataclasses.field', 'dataclasses.field', ([], {'default_factory': '(lambda : [])'}), '(default_factory=lambda : [])\n', (707, 7... |
from collections import UserDict
from six import StringIO
from gevent.lock import Semaphore
from ..utils.importing import import_dotted_path
try:
from cPickle import Unpickler, Pickler
except ImportError:
from pickle import Unpickler, Pickler
try:
StrictRedis = import_dotted_path('redis.StrictRedis')
ex... | [
"gevent.lock.Semaphore",
"pickle.Unpickler",
"pickle.Pickler",
"six.StringIO"
] | [((2887, 2898), 'gevent.lock.Semaphore', 'Semaphore', ([], {}), '()\n', (2896, 2898), False, 'from gevent.lock import Semaphore\n'), ((3860, 3870), 'six.StringIO', 'StringIO', ([], {}), '()\n', (3868, 3870), False, 'from six import StringIO\n'), ((3883, 3909), 'pickle.Pickler', 'Pickler', (['f', 'self._protocol'], {}),... |
import click
from pulse import Config
from douban import DoubanInterest, DoubanStatus
from github import GitHub
from loguru import logger
from pulse import CombinedPulse
@click.command()
@click.option("-c", "--config", type=click.Path(), help="Path to config")
def pulse(config):
conf = Config(config)
logger.... | [
"loguru.logger.debug",
"douban.DoubanStatus",
"github.GitHub",
"click.command",
"pulse.Config",
"click.Path",
"douban.DoubanInterest",
"pulse.CombinedPulse"
] | [((173, 188), 'click.command', 'click.command', ([], {}), '()\n', (186, 188), False, 'import click\n'), ((294, 308), 'pulse.Config', 'Config', (['config'], {}), '(config)\n', (300, 308), False, 'from pulse import Config\n'), ((313, 353), 'loguru.logger.debug', 'logger.debug', (['f"""The full config: {conf}"""'], {}), "... |
from argparse import ArgumentParser
import pkgutil
import random
from random import randrange, choice
DOGE_PREFIXES = ["such", "much", "so", "many", "wow", "very"]
DOGE_EJACULATES = ["wow"]
WOW_CHANCE = 8
MAX_WHITESPACE = 15
MIN_WHITESPACE = 2
def doge_syntax(clause):
return clause if len(clause.split())>1 e... | [
"pkgutil.get_data",
"random.choice",
"random.randrange",
"argparse.ArgumentParser"
] | [((958, 1016), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Cowsay for a new generation."""'}), "(description='Cowsay for a new generation.')\n", (972, 1016), False, 'from argparse import ArgumentParser\n'), ((433, 450), 'random.randrange', 'randrange', (['(0)', 'max'], {}), '(0, max)\n', (442,... |
# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @Project : stock_quant
# @Date : 2021/12/19 16:27
# @Author : Adolf
# @File : ma5_ma10.py
# @Function:
import pandas as pd
import pandas_ta as ta
from GetBaseData.hanle_data_show import get_show_data
from Utils.ShowKline.base_kline import draw_chart
pd.set_option(... | [
"Utils.ShowKline.base_kline.draw_chart",
"pandas.read_csv",
"pandas_ta.macd",
"pandas_ta.sma",
"pandas_ta.ema",
"pandas.set_option",
"GetBaseData.hanle_data_show.get_show_data"
] | [((306, 347), 'pandas.set_option', 'pd.set_option', (['"""expand_frame_repr"""', '(False)'], {}), "('expand_frame_repr', False)\n", (319, 347), True, 'import pandas as pd\n'), ((348, 387), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', 'None'], {}), "('display.max_rows', None)\n", (361, 387), True, '... |
#data we need:
#1) total votes cast
#2) list of all aandidates who received votes
#3) percentage of votes each candidate won
#4) number of votes each candidate won
#5) winner of the election based on popular vote
import os
import csv
#assign variable to csv
file_to_load = "../Resources/election_results.csv"
#assign var... | [
"csv.reader",
"os.path.join"
] | [((361, 416), 'os.path.join', 'os.path.join', (['""".."""', '"""analysis"""', '"""election_analysis.txt"""'], {}), "('..', 'analysis', 'election_analysis.txt')\n", (373, 416), False, 'import os\n'), ((687, 712), 'csv.reader', 'csv.reader', (['election_data'], {}), '(election_data)\n', (697, 712), False, 'import csv\n')... |
import argparse
import copy
import optuna
import os
from datetime import datetime
import torch
import torch.nn as nn
import torch.optim as optim
from src.dataloader import create_dataloader
from src.model import Model
from src.utils.torch_utils import model_info
from src.utils.common import read_yaml
from src.utils.mac... | [
"copy.deepcopy",
"os.makedirs",
"src.utils.common.read_yaml",
"argparse.ArgumentParser",
"src.utils.macs.calc_macs",
"torch.cuda.device_count",
"src.model.Model",
"torch.cuda.is_available",
"train.train",
"torch.device",
"optuna.storages.RDBStorage",
"datetime.datetime.now",
"optuna.create_s... | [((466, 511), 'src.utils.common.read_yaml', 'read_yaml', ([], {'cfg': '"""configs/model/effinetb1.yaml"""'}), "(cfg='configs/model/effinetb1.yaml')\n", (475, 511), False, 'from src.utils.common import read_yaml\n'), ((526, 565), 'src.utils.common.read_yaml', 'read_yaml', ([], {'cfg': '"""configs/data/taco.yaml"""'}), "... |
"""
1. 选择题型
普通算式 x +/-/*// y
类型算式1 x +/- y +/- z
类型算式2 x +/- y * z
类型算式3 x +/- y / z
2. 选择题量
3. 生成题目 / 打印题目
"""
import random
import wx
import os
import time
from student import math1, math2, math3, math4
'''
frame(窗口):带标题和边框的最顶层窗体
panel(面板):容器类,提供空间放其他组件,包括其他panel
'''
math_list = [math1, math2, math... | [
"wx.App.__init__",
"wx.CheckListBox",
"wx.Panel",
"wx.Button",
"wx.Font",
"wx.Frame"
] | [((386, 407), 'wx.App.__init__', 'wx.App.__init__', (['self'], {}), '(self)\n', (401, 407), False, 'import wx\n'), ((540, 611), 'wx.Frame', 'wx.Frame', ([], {'parent': 'None', 'title': '"""口算题卡生成器"""', 'pos': '(100, 100)', 'size': '(300, 200)'}), "(parent=None, title='口算题卡生成器', pos=(100, 100), size=(300, 200))\n", (548... |
# encoding: utf-8
__author__ = "<NAME>"
# Taken and adapted from: https://github.com/NVIDIA/NeMo/blob/main/nemo/collections/common/callbacks/callbacks.py
import time
from pytorch_lightning.callbacks.base import Callback
from pytorch_lightning.utilities import rank_zero_only
class LogEpochTimeCallback(Callback):
... | [
"time.time"
] | [((538, 549), 'time.time', 'time.time', ([], {}), '()\n', (547, 549), False, 'import time\n'), ((703, 714), 'time.time', 'time.time', ([], {}), '()\n', (712, 714), False, 'import time\n'), ((857, 868), 'time.time', 'time.time', ([], {}), '()\n', (866, 868), False, 'import time\n')] |
from Board.Board import Board
from Location.Location import Location
from Board.Disc import Disc
# BoardクラスのbitBoardとしての実装
class BitBoard(Board):
def __init__(self) -> None:
# 打っているプレイヤーの色
self.player = Disc.black
self.turn = 1
self.playerBoard = 0x0000000810000000
self.oppo... | [
"Location.Location.Location"
] | [((6324, 6338), 'Location.Location.Location', 'Location', (['i', 'j'], {}), '(i, j)\n', (6332, 6338), False, 'from Location.Location import Location\n')] |
from django.urls import path
from rest_framework.routers import DefaultRouter
from investor_management import views
router = DefaultRouter()
app_name = 'investor_management'
urlpatterns = [
path('user/create/', views.CreateInvestorUserView.as_view(), name='investor_user_create'),
path('user/manage/<int:id>... | [
"investor_management.views.CreateInvestorUserView.as_view",
"investor_management.views.ManageInvestorUserView.as_view",
"rest_framework.routers.DefaultRouter"
] | [((128, 143), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (141, 143), False, 'from rest_framework.routers import DefaultRouter\n'), ((220, 258), 'investor_management.views.CreateInvestorUserView.as_view', 'views.CreateInvestorUserView.as_view', ([], {}), '()\n', (256, 258), False, 'from i... |
import os
import sqlite3
from flask import Flask, render_template
from contextlib import closing
app = Flask(__name__)
app.config.update(dict(
DATABASE=os.path.join(app.root_path, 'flaskApp.db'),
))
def connect_db():
return sqlite3.connect(app.config['DATABASE'])
def init_db():
with closing(connect_db())... | [
"flask.Flask",
"sqlite3.connect",
"os.path.join",
"flask.render_template"
] | [((104, 119), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (109, 119), False, 'from flask import Flask, render_template\n'), ((234, 273), 'sqlite3.connect', 'sqlite3.connect', (["app.config['DATABASE']"], {}), "(app.config['DATABASE'])\n", (249, 273), False, 'import sqlite3\n'), ((498, 527), 'flask.rende... |
#!/usr/bin/env python
# Four spaces as indentation [no tabs]
#
# propositional_planner.py
# ma-goal-recognition
#
# Created by <NAME> on 2020-03-12.
# Copyright 2020 <NAME>. All rights reserved.
#
from recognizer.pddl.pddl_parser import PDDL_Parser
from recognizer.pddl.pddl_planner import PDDL_Planner
# from reco... | [
"recognizer.pddl.state.applicable",
"recognizer.pddl.state.apply",
"time.time"
] | [((1218, 1255), 'recognizer.pddl.state.applicable', 'applicable', (['state', 'goal_pos', 'goal_not'], {}), '(state, goal_pos, goal_not)\n', (1228, 1255), False, 'from recognizer.pddl.state import applicable, apply\n'), ((998, 1009), 'time.time', 'time.time', ([], {}), '()\n', (1007, 1009), False, 'import time\n'), ((17... |
# Copyright The PyTorch Lightning team.
#
# 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 i... | [
"inspect.getfullargspec"
] | [((1048, 1079), 'inspect.getfullargspec', 'inspect.getfullargspec', (['hook_fx'], {}), '(hook_fx)\n', (1070, 1079), False, 'import inspect\n')] |
from django.contrib import admin
from .models import ActiveCompound, CompoundSet, ComercialDrug, Prescription
@admin.register(ActiveCompound)
class ActiveCompoundAdmin(admin.ModelAdmin):
search_fields = ['_search_names']
@admin.register(CompoundSet)
class CompoundSetAdmin(admin.ModelAdmin):
search_fields = ['act... | [
"django.contrib.admin.register"
] | [((114, 144), 'django.contrib.admin.register', 'admin.register', (['ActiveCompound'], {}), '(ActiveCompound)\n', (128, 144), False, 'from django.contrib import admin\n'), ((228, 255), 'django.contrib.admin.register', 'admin.register', (['CompoundSet'], {}), '(CompoundSet)\n', (242, 255), False, 'from django.contrib imp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 30 09:52:31 2021
@author: HaoLI
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 8 11:48:41 2021
@author: HaoLI
"""
import torch, torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torc... | [
"matplotlib.pyplot.title",
"sklearn.preprocessing.StandardScaler",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"torch.nn.functional.dropout",
"torch.utils.data.TensorDataset",
"torch.device",
"torch.no_grad",
"os.chdir",
"pandas.DataFrame",
"torch.nn.BCELoss",
"torch.utils.d... | [((851, 876), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (874, 876), False, 'import torch, torch.nn as nn\n'), ((934, 957), 'random.seed', 'random.seed', (['randomseed'], {}), '(randomseed)\n', (945, 957), False, 'import random\n'), ((1253, 1295), 'os.chdir', 'os.chdir', (['"""/Users/HaoLI/... |
# Generated by Django 3.1.13 on 2021-12-06 21:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('reo', '0141_auto_20211202_2315'),
]
operations = [
migrations.RemoveField(
model_name='sitemodel',
name='preprocessed_BAU_l... | [
"django.db.migrations.RemoveField"
] | [((224, 325), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""sitemodel"""', 'name': '"""preprocessed_BAU_lifecycle_emissions_tCO2"""'}), "(model_name='sitemodel', name=\n 'preprocessed_BAU_lifecycle_emissions_tCO2')\n", (246, 325), False, 'from django.db import migrations\n'), ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import logging
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('.'))
import cv2
import numpy as np
import common
import imgpheno as ft
def main():
logging.basicConfig(level=logging.INFO, format='%(le... | [
"os.path.abspath",
"argparse.ArgumentParser",
"logging.basicConfig",
"os.path.basename",
"common.scale_max_perimeter",
"cv2.imwrite",
"common.grabcut",
"imgpheno.split_by_mask",
"cv2.imread",
"logging.info",
"numpy.where",
"os.path.splitext",
"sys.stderr.write",
"os.path.join"
] | [((119, 140), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {}), "('..')\n", (134, 140), False, 'import os\n'), ((161, 181), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (176, 181), False, 'import os\n'), ((268, 343), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.IN... |
from setuptools import setup, find_packages
setup(
name='reply_card_corrector',
version='0.1.0',
packages=find_packages(),
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
install_requires=["opencv-python", "numpy"],
)
| [
"setuptools.find_packages"
] | [((119, 134), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (132, 134), False, 'from setuptools import setup, find_packages\n')] |
import uuid
from static.common.database import Database
class Appointment(object):
def __init__(self, owner_id, date, time, confirmed=False, _id=None):
self.owner_id = owner_id
self.date = date
self.time = time
self.confirmed = confirmed
self._id = uuid.uuid4().hex if _id i... | [
"static.common.database.Database.find_one",
"uuid.uuid4"
] | [((926, 973), 'static.common.database.Database.find_one', 'Database.find_one', (['"""appointments"""', "{'_id': _id}"], {}), "('appointments', {'_id': _id})\n", (943, 973), False, 'from static.common.database import Database\n'), ((295, 307), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (305, 307), False, 'import uuid... |
import argparse
import logging
import json
import copy
import arrow
import requests
import osmapi
import re
import polyline as pl
import osrm as osrm
import shapely.geometry as geo
sensing_configs = json.load(open("sensing_regimes.all.specs.json"))
def validate_and_fill_datetime(current_spec):
ret_spec = copy.cop... | [
"arrow.get",
"copy.deepcopy",
"logging.debug",
"argparse.ArgumentParser",
"logging.basicConfig",
"shapely.geometry.Polygon",
"shapely.geometry.mapping",
"copy.copy",
"osrm.get_route_points",
"polyline.PolylineCodec",
"osmapi.OsmApi"
] | [((312, 335), 'copy.copy', 'copy.copy', (['current_spec'], {}), '(current_spec)\n', (321, 335), False, 'import copy\n'), ((642, 657), 'osmapi.OsmApi', 'osmapi.OsmApi', ([], {}), '()\n', (655, 657), False, 'import osmapi\n'), ((1985, 2005), 'copy.copy', 'copy.copy', (['curr_spec'], {}), '(curr_spec)\n', (1994, 2005), Fa... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'miasmod_data.ui'
#
# Created: Tue Apr 29 18:40:05 2014
# by: pyside-uic 0.2.15 running on PySide 1.2.1
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_MiasmataData(object):
def se... | [
"PySide.QtCore.QSize",
"PySide.QtGui.QFormLayout",
"PySide.QtGui.QLineEdit",
"PySide.QtGui.QPlainTextEdit",
"PySide.QtGui.QTreeView",
"PySide.QtGui.QFont",
"PySide.QtGui.QHBoxLayout",
"PySide.QtGui.QGridLayout",
"PySide.QtGui.QApplication.translate",
"PySide.QtCore.QMetaObject.connectSlotsByName",... | [((468, 499), 'PySide.QtGui.QVBoxLayout', 'QtGui.QVBoxLayout', (['MiasmataData'], {}), '(MiasmataData)\n', (485, 499), False, 'from PySide import QtCore, QtGui\n'), ((598, 617), 'PySide.QtGui.QHBoxLayout', 'QtGui.QHBoxLayout', ([], {}), '()\n', (615, 617), False, 'from PySide import QtCore, QtGui\n'), ((706, 737), 'PyS... |
import logging
logger = logging.getLogger(__name__)
module_uri = "/isam/felb/configuration/logging"
requires_modules = None
requires_versions = None
def get(isamAppliance):
"""
Retrieves logging configuration attributes
"""
return isamAppliance.invoke_get("Retrieving logging configuration", module_u... | [
"logging.getLogger"
] | [((25, 52), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (42, 52), False, 'import logging\n')] |
"""Step arguments tests."""
import functools
import re
from pytest_bdd import given, parsers, scenario, then, when
import pytest
from pytest_bdd import exceptions
scenario_when = functools.partial(scenario, "../when_arguments.feature")
scenario_args = functools.partial(scenario, "../args_steps.feature")
@scenari... | [
"pytest_bdd.parsers.re",
"functools.partial",
"pytest.raises"
] | [((183, 239), 'functools.partial', 'functools.partial', (['scenario', '"""../when_arguments.feature"""'], {}), "(scenario, '../when_arguments.feature')\n", (200, 239), False, 'import functools\n'), ((257, 309), 'functools.partial', 'functools.partial', (['scenario', '"""../args_steps.feature"""'], {}), "(scenario, '../... |
"""
AI Heuristics for various evaluation methods
"""
from __future__ import print_function
import random
__author__ = "Matthew 'MasterOdin' Peveler"
__license__ = "The MIT License (MIT)"
class Heuristic(object):
"""
This is the heuristic interface
"""
@staticmethod
def get_best_column(board):
... | [
"random.randint"
] | [((1048, 1080), 'random.randint', 'random.randint', (['(0)', 'board.COLUMNS'], {}), '(0, board.COLUMNS)\n', (1062, 1080), False, 'import random\n')] |
#
# (c) Copyright 2015 <NAME>. All Rights Reserved.
#
"""
Various utilities.
"""
from flask.ext.restful import abort
from bson.objectid import ObjectId
from base64 import b64decode
from werkzeug.routing import BaseConverter
class AxesURIConverter(BaseConverter):
"""
Flask routing converter for AXES URIs of... | [
"flask.ext.restful.abort",
"bson.objectid.ObjectId",
"base64.b64decode"
] | [((2528, 2543), 'base64.b64decode', 'b64decode', (['data'], {}), '(data)\n', (2537, 2543), False, 'from base64 import b64decode\n'), ((839, 857), 'bson.objectid.ObjectId', 'ObjectId', (['objectid'], {}), '(objectid)\n', (847, 857), False, 'from bson.objectid import ObjectId\n'), ((1059, 1084), 'flask.ext.restful.abort'... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set",
"pulumi.InvokeOptions",
"pulumi.runtime.invoke"
] | [((7191, 7233), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""blockchainPlatformId"""'}), "(name='blockchainPlatformId')\n", (7204, 7233), False, 'import pulumi\n'), ((7357, 7396), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""caCertArchiveText"""'}), "(name='caCertArchiveText')\n", (7370, 7396), False, 'im... |
"""Test of Funsies python functions capabilities."""
# std
from io import BytesIO
from typing import Dict
# funsies
from funsies import _pyfunc as p
from funsies._constants import Encoding
def capitalize(inputs: Dict[str, bytes]) -> Dict[str, bytes]:
"""Capitalize artifacts."""
out = {}
for key, val in i... | [
"io.BytesIO",
"funsies._pyfunc.run_python_funsie",
"funsies._pyfunc.python_funsie"
] | [((691, 783), 'funsies._pyfunc.python_funsie', 'p.python_funsie', (['capitalize'], {'inputs': "{'in': Encoding.blob}", 'outputs': "{'in': Encoding.blob}"}), "(capitalize, inputs={'in': Encoding.blob}, outputs={'in':\n Encoding.blob})\n", (706, 783), True, 'from funsies import _pyfunc as p\n'), ((901, 993), 'funsies.... |
"""Recompute BERT predictions on UKP dev/test without topic information."""
import os
import csv
import itertools
from tqdm import tqdm
from pytorch_pretrained_bert.tokenization import BertTokenizer
import torch
from torch.utils.data import TensorDataset, DataLoader, SequentialSampler
from train import InputExample, c... | [
"tqdm.tqdm",
"csv.reader",
"train.convert_examples_to_features",
"torch.utils.data.DataLoader",
"os.path.basename",
"pytorch_pretrained_bert.tokenization.BertTokenizer.from_pretrained",
"itertools.combinations",
"train.InputExample",
"SigmoidBERT.SigmoidBERT.from_pretrained",
"torch.utils.data.Ten... | [((623, 685), 'pytorch_pretrained_bert.tokenization.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['bert_output'], {'do_lower_case': '(True)'}), '(bert_output, do_lower_case=True)\n', (652, 685), False, 'from pytorch_pretrained_bert.tokenization import BertTokenizer\n'), ((698, 738), 'SigmoidBERT.Si... |
# Copyright (c) 2020 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
import re
from ansible.errors import AnsibleFilterError
from an... | [
"pytest.mark.parametrize",
"ansible_collections.ansible.windows.plugins.filter.quote.quote",
"re.escape"
] | [((617, 1710), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""value, expected"""', '[([\'a b c\', \'d\', \'e\'], \'"a b c" d e\'), ([\'ab"c\', \'\\\\\', \'d\'],\n \'"ab\\\\"c" \\\\ d\'), ([\'a\\\\\\\\\\\\b\', \'de fg\', \'h\'], \'a\\\\\\\\\\\\b "de fg" h\'), (\n [\'a\\\\\\\\b c\', \'d\', \'e\'], \'"a... |
import os, glob
import numpy as np
import pandas as pd
from multiprocessing import Pool
from PIL import Image
from tqdm import tqdm
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import tkinter as tk
import warnings
warnings.filterwarnings("ignore")
... | [
"utils.get_SE",
"utils.get_GR",
"utils.psd2im",
"torch.device",
"torch.no_grad",
"os.path.join",
"utils.get_next_day",
"tkinter.Label",
"utils.mkdirs",
"tkinter.Checkbutton",
"pandas.DataFrame",
"tkinter.Button",
"torch.load",
"matplotlib.figure.Figure",
"tkinter.Tk",
"tqdm.tqdm",
"u... | [((286, 319), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (309, 319), False, 'import warnings\n'), ((4704, 4719), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (4717, 4719), False, 'import torch\n'), ((765, 804), 'os.path.join', 'os.path.join', (['opt.dataroot', '... |
#! /usr/bin/env python
import functools
import uuid
from . import session
from . import utils
class Model(object):
session = session.Session()
def __init__(self, data=None):
self._id = str(uuid.uuid1())
self.in_progress = False
self.read_only = False
self.update = False
... | [
"uuid.uuid1",
"functools.wraps"
] | [((1147, 1165), 'functools.wraps', 'functools.wraps', (['f'], {}), '(f)\n', (1162, 1165), False, 'import functools\n'), ((211, 223), 'uuid.uuid1', 'uuid.uuid1', ([], {}), '()\n', (221, 223), False, 'import uuid\n')] |
"""
Copied from WRF_SPC.py Sep 20, 2019.
Given a model initialization time and a valid time, plot crefuh around hagelslag objects.
"""
import argparse
import datetime
import pdb
import os
import sys
import pandas as pd
import numpy as np
import fieldinfo # levels and color tables - Adapted from /glade/u/home/wrfrt/... | [
"numpy.abs",
"argparse.ArgumentParser",
"pandas.read_csv",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.figure",
"os.path.isfile",
"numpy.arange",
"matplotlib.colors.ListedColormap",
"netCDF4.Dataset",
"wrf.get_cartopy",
"matplotlib.pyplot.close",
"matplotlib.pyplot.colorbar",
"numpy.max",
... | [((511, 532), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (525, 532), False, 'import matplotlib\n'), ((679, 808), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Plot WRF and SPC storm reports"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(... |
from apex.optimizers import FusedLAMB, FusedAdam
from torch.optim.lr_scheduler import LambdaLR
from torch.optim import AdamW, Adam, SGD
import math
# https://huggingface.co/transformers/_modules/transformers/optimization.html#get_linear_schedule_with_warmup
def get_linear_schedule_with_warmup(
optimizer, num_warmu... | [
"apex.optimizers.FusedLAMB",
"torch.optim.AdamW",
"torch.optim.Adam",
"torch.optim.lr_scheduler.LambdaLR",
"torch.optim.SGD"
] | [((1471, 1513), 'torch.optim.lr_scheduler.LambdaLR', 'LambdaLR', (['optimizer', 'lr_lambda', 'last_epoch'], {}), '(optimizer, lr_lambda, last_epoch)\n', (1479, 1513), False, 'from torch.optim.lr_scheduler import LambdaLR\n'), ((3126, 3168), 'torch.optim.lr_scheduler.LambdaLR', 'LambdaLR', (['optimizer', 'lr_lambda', 'l... |
#!/usr/bin/env python3
import sys
from build import Builder
package_name = Builder.package_name_from_filename(__file__)
dependencies = ('zlib-1.2.11',
'bzip2-1.0.8',
'jpeg-9c',
'zstd-be3bd70',
'tiff-4.0.10',
'icu4c-65_1',
... | [
"build.Builder.package_name_from_filename",
"sys.exit"
] | [((77, 121), 'build.Builder.package_name_from_filename', 'Builder.package_name_from_filename', (['__file__'], {}), '(__file__)\n', (111, 121), False, 'from build import Builder\n'), ((540, 551), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (548, 551), False, 'import sys\n')] |
"""
MIT License
Copyright (c) 2017 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... | [
"Qt.QtCore.QMetaObject.connectSlotsByName",
"Qt.QtCore.Slot",
"Qt.QtWidgets.QLabel",
"Qt.QtGui.QFont",
"Qt.QtWidgets.QFrame",
"Qt.QtWidgets.QHBoxLayout",
"maya.OpenMayaUI.MQtUtil.mainWindow",
"Qt.QtWidgets.QLineEdit",
"Qt.QtWidgets.QVBoxLayout",
"Qt.QtWidgets.QSizePolicy",
"Qt.QtWidgets.QPushBut... | [((26133, 26139), 'Qt.QtCore.Slot', 'Slot', ([], {}), '()\n', (26137, 26139), False, 'from Qt.QtCore import Slot\n'), ((26210, 26216), 'Qt.QtCore.Slot', 'Slot', ([], {}), '()\n', (26214, 26216), False, 'from Qt.QtCore import Slot\n'), ((26297, 26303), 'Qt.QtCore.Slot', 'Slot', ([], {}), '()\n', (26301, 26303), False, '... |
from google_translate_py import AsyncTranslator
from ciri import HelpStr
from ciri.utils import ciri_cmd, eor
@ciri_cmd(pattern="at(?: |$)(.*)")
async def _at(e):
payload = e.text.split(maxsplit=3)
if len(payload) == 3:
text = payload[2]
lang = payload[1]
else:
text = payload[1]
... | [
"ciri.utils.eor",
"google_translate_py.AsyncTranslator",
"ciri.HelpStr.update",
"ciri.utils.ciri_cmd"
] | [((114, 147), 'ciri.utils.ciri_cmd', 'ciri_cmd', ([], {'pattern': '"""at(?: |$)(.*)"""'}), "(pattern='at(?: |$)(.*)')\n", (122, 147), False, 'from ciri.utils import ciri_cmd, eor\n'), ((435, 563), 'ciri.HelpStr.update', 'HelpStr.update', (["{'autotranslate': {'at': {'description': 'Auto Translate text while typing',\n ... |
from rest_framework import serializers
from rest_framework.serializers import Serializer, ModelSerializer
from core.models import KeyUrlMap
class RedirectionSerializer(Serializer):
pass
class CreateMappingSerializer(ModelSerializer):
potato_url = serializers.SerializerMethodField(read_only=True)
class... | [
"rest_framework.serializers.SerializerMethodField"
] | [((260, 309), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {'read_only': '(True)'}), '(read_only=True)\n', (293, 309), False, 'from rest_framework import serializers\n')] |
# Copyright 2019 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | [
"ros2cli.node.strategy.NodeStrategy",
"ros2service.api.get_service_names_and_types"
] | [((1569, 1587), 'ros2cli.node.strategy.NodeStrategy', 'NodeStrategy', (['args'], {}), '(args)\n', (1581, 1587), False, 'from ros2cli.node.strategy import NodeStrategy\n'), ((1635, 1732), 'ros2service.api.get_service_names_and_types', 'get_service_names_and_types', ([], {'node': 'node', 'include_hidden_services': 'args.... |
#This runs on each webserver and funnels the /var/log/auth contents to Kafka broker under topic XYZ
# This is a Kafka producer
from kafka import KafkaProducer
import time
import json
producer = KafkaProducer(bootstrap_servers='broker:9092',value_serializer=lambda v:json.dumps(v).encode('ascii'))
logfile = open('/var/... | [
"json.dumps",
"time.sleep"
] | [((513, 527), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (523, 527), False, 'import time\n'), ((267, 280), 'json.dumps', 'json.dumps', (['v'], {}), '(v)\n', (277, 280), False, 'import json\n')] |
import random
import matplotlib
import numpy
from matplotlib import pyplot as plt
from matplotlib.ticker import PercentFormatter
from Resources.data_loader import load_data
from Utils.CrossEntropy import CrossEntropySolver
from Algorithms.CrossEntropy.Solver.ACCADE_cross_entropy_solver import ACCADECrossEntropySolve... | [
"numpy.load",
"Algorithms.CrossEntropy.Solver.GIANT_cross_entropy_solver.GIANTCrossEntropySolver",
"numpy.argsort",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.random.randint",
"matplotlib.pyplot.gca",
"numpy.sqrt",
"matplotlib.pyplot.tight_layout",
"Algorithms.CrossEntropy.Solver.FedGD_cross... | [((950, 975), 'sys.path.append', 'sys.path.append', (['home_dir'], {}), '(home_dir)\n', (965, 975), False, 'import sys\n'), ((10791, 10810), 'numpy.mean', 'numpy.mean', (['x_train'], {}), '(x_train)\n', (10801, 10810), False, 'import numpy\n'), ((10943, 10961), 'numpy.mean', 'numpy.mean', (['x_test'], {}), '(x_test)\n'... |
# -*- coding: utf-8 -*-
__author__ = '<NAME>'
import threading
#import logging
#logger = logging.getLogger(__name__)
import idle_queue
from weak_ref import weak_ref
class Signal:
def __init__(self, name):
self.name = name
self.callbacks = []
self.lock = threading.Lock()
def __call__... | [
"threading.Lock",
"weak_ref.weak_ref",
"idle_queue.idle_add"
] | [((286, 302), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (300, 302), False, 'import threading\n'), ((459, 477), 'weak_ref.weak_ref', 'weak_ref', (['callback'], {}), '(callback)\n', (467, 477), False, 'from weak_ref import weak_ref\n'), ((1445, 1491), 'idle_queue.idle_add', 'idle_queue.idle_add', (['callback'... |
# %%
import os
import unittest
from pathlib import Path
import jsonlines
from eaas import Client, Config
curr_dir = Path(__file__).parent
def read_jsonlines_to_list(file_name):
lines = []
with jsonlines.open(file_name, "r") as reader:
for obj in reader:
lines.append(obj)
return line... | [
"eaas.Client",
"eaas.Config",
"pathlib.Path",
"jsonlines.open",
"os.path.join"
] | [((119, 133), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (123, 133), False, 'from pathlib import Path\n'), ((206, 236), 'jsonlines.open', 'jsonlines.open', (['file_name', '"""r"""'], {}), "(file_name, 'r')\n", (220, 236), False, 'import jsonlines\n'), ((403, 411), 'eaas.Config', 'Config', ([], {}), '()... |
from FEM.Mesh.Geometry import Geometry
from FEM.Mesh.Delaunay import Delaunay
from FEM.PlaneStrain import PlaneStrain
from FEM.Utils.polygonal import roundCorner, giveCoordsCircle
import matplotlib.pyplot as plt
import numpy as np
E = 30*10**(5)
v = 0.25
b = 10
h = 20
he = h/4
ancho_en_h10_in = 18
ancho_en_h20_in = 1... | [
"matplotlib.pyplot.show",
"FEM.PlaneStrain.PlaneStrain",
"numpy.zeros",
"FEM.Mesh.Delaunay.Delaunay",
"FEM.Utils.polygonal.giveCoordsCircle",
"FEM.Mesh.Delaunay.Delaunay._strdelaunay",
"numpy.array",
"numpy.linalg.solve"
] | [((1155, 1189), 'FEM.Utils.polygonal.giveCoordsCircle', 'giveCoordsCircle', (['cent', 'radi'], {'n': '(50)'}), '(cent, radi, n=50)\n', (1171, 1189), False, 'from FEM.Utils.polygonal import roundCorner, giveCoordsCircle\n'), ((1274, 1342), 'FEM.Mesh.Delaunay.Delaunay._strdelaunay', 'Delaunay._strdelaunay', ([], {'constr... |
# Generated by Django 4.0 on 2022-04-16 00:55
import sudan_art.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("sudan_art", "0003_alter_artwork_tags"),
]
operations = [
migrations.AlterField(
model_name="artwork",
... | [
"django.db.models.CharField"
] | [((359, 436), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(250)', 'validators': '[sudan_art.models.validate_tags]'}), '(max_length=250, validators=[sudan_art.models.validate_tags])\n', (375, 436), False, 'from django.db import migrations, models\n')] |
import Rhino # type: ignore
import rhinoscriptsyntax as rs
import scriptcontext
import re
from integral_timber_joints.rhino.load import get_process, get_process_artist, process_is_none
from integral_timber_joints.geometry import JointHalfLap
from integral_timber_joints.rhino.assembly_artist import AssemblyNurbsArtist
... | [
"integral_timber_joints.rhino.load.get_process",
"integral_timber_joints.rhino.load.get_process_artist"
] | [((925, 938), 'integral_timber_joints.rhino.load.get_process', 'get_process', ([], {}), '()\n', (936, 938), False, 'from integral_timber_joints.rhino.load import get_process, get_process_artist, process_is_none\n'), ((952, 972), 'integral_timber_joints.rhino.load.get_process_artist', 'get_process_artist', ([], {}), '()... |
"""Contains FileView."""
from tornado.web import HTTPError
from rubberband.models import TestSet, Result
from rubberband.constants import EXPORT_DATA_FORMATS, EXPORT_FILE_TYPES
from .base import BaseHandler
class FileView(BaseHandler):
"""Request handler handling the view or download of log files or log file con... | [
"rubberband.models.Result.get",
"tornado.web.HTTPError",
"rubberband.models.TestSet.get"
] | [((1067, 1081), 'tornado.web.HTTPError', 'HTTPError', (['(404)'], {}), '(404)\n', (1076, 1081), False, 'from tornado.web import HTTPError\n'), ((1144, 1158), 'tornado.web.HTTPError', 'HTTPError', (['(404)'], {}), '(404)\n', (1153, 1158), False, 'from tornado.web import HTTPError\n'), ((1240, 1283), 'rubberband.models.R... |
from abc import abstractmethod
from collections import defaultdict, deque
from typing import Deque, Dict
from adventofcode2020.utils.abstract import FileReaderSolution
class Day11:
count_seats: int
@abstractmethod
def count_next_to_it(self, grid, row, col) -> int:
"""Count the number of seats ne... | [
"collections.defaultdict",
"collections.deque",
"time.sleep"
] | [((797, 814), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (808, 814), False, 'from collections import defaultdict, deque\n'), ((1978, 1988), 'time.sleep', 'sleep', (['(0.1)'], {}), '(0.1)\n', (1983, 1988), False, 'from time import sleep\n'), ((2209, 2216), 'collections.deque', 'deque', ([], {}... |
# -*- coding: utf-8 -*-
import logging
import os
import requests.exceptions
import six
from configparser import ConfigParser
from ..exc import EmptyResourceError, InvalidResourceError, MissingResourceError
from ..utils import download, is_url
__all__ = [
'parse_bel_resource',
'get_lines',
'get_bel_resour... | [
"configparser.ConfigParser",
"os.path.expanduser",
"logging.getLogger"
] | [((334, 361), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (351, 361), False, 'import logging\n'), ((1149, 1175), 'configparser.ConfigParser', 'ConfigParser', ([], {'strict': '(False)'}), '(strict=False)\n', (1161, 1175), False, 'from configparser import ConfigParser\n'), ((2014, 2042),... |
# Generated by Django 2.2.3 on 2020-03-09 08:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('usersapp', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='customuser',
options={'ordering': [... | [
"django.db.models.CharField",
"django.db.models.DecimalField",
"django.db.migrations.AlterModelOptions"
] | [((225, 313), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""customuser"""', 'options': "{'ordering': ['username']}"}), "(name='customuser', options={'ordering': [\n 'username']})\n", (253, 313), False, 'from django.db import migrations, models\n'), ((459, 537), 'django.d... |
import numpy as np
import os
from astropy.io import ascii
class mesa:
def init(self):
###### parameters ####################
self.path = '/Users/Jason/code/mesa_progenitors/' # file path
# self.type = 'solar' # file type
self.name = 'profileXX.data' ... | [
"astropy.io.ascii.read"
] | [((505, 568), 'astropy.io.ascii.read', 'ascii.read', (['self.name'], {'header_start': '(1)', 'data_start': '(2)', 'data_end': '(3)'}), '(self.name, header_start=1, data_start=2, data_end=3)\n', (515, 568), False, 'from astropy.io import ascii\n'), ((578, 629), 'astropy.io.ascii.read', 'ascii.read', (['self.name'], {'he... |
import cv2
import math
import numpy as np
def get_density_map_gaussian(im, points):
im_density = np.zeros_like(im, dtype=np.float64)
h, w = im_density.shape
if points is None:
return im_density
if points.shape[0] == 1:
x1 = max(0, min(w-1, round(points[0, 0])))
y1 = max(0, min... | [
"numpy.zeros_like",
"math.floor",
"cv2.getGaussianKernel"
] | [((104, 139), 'numpy.zeros_like', 'np.zeros_like', (['im'], {'dtype': 'np.float64'}), '(im, dtype=np.float64)\n', (117, 139), True, 'import numpy as np\n'), ((506, 540), 'cv2.getGaussianKernel', 'cv2.getGaussianKernel', (['f_sz', 'sigma'], {}), '(f_sz, sigma)\n', (527, 540), False, 'import cv2\n'), ((543, 577), 'cv2.ge... |
""" test of base functions"""
import os
import sys
# pylint: disable=import-error disable=wrong-import-position
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from pydit import setup_logging, clean_string
# import numpy as np
# from datetime import datetime, date, timedelta
# from panda... | [
"pydit.clean_string",
"os.path.abspath",
"pydit.setup_logging"
] | [((349, 364), 'pydit.setup_logging', 'setup_logging', ([], {}), '()\n', (362, 364), False, 'from pydit import setup_logging, clean_string\n'), ((445, 481), 'pydit.clean_string', 'clean_string', (['""" <NAME> 123 456 . """'], {}), "(' <NAME> 123 456 . ')\n", (457, 481), False, 'from pydit import setup_logging, clean... |
from django.contrib import admin
from django.utils.html import mark_safe, format_html
from . import models
class CategoryAdmin(admin.ModelAdmin):
fields = ('image_tag', 'title', 'description', 'image',)
readonly_fields = ('image_tag',)
class PostAdmin(admin.ModelAdmin):
fields = ('title', 'content', 'a... | [
"django.contrib.admin.site.register"
] | [((770, 813), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Post', 'PostAdmin'], {}), '(models.Post, PostAdmin)\n', (789, 813), False, 'from django.contrib import admin\n'), ((814, 865), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Category', 'CategoryAdmin'], {}), '(m... |
# -*- coding: utf-8 -*-
"""Simple networks of caches modeled as single caches."""
import random
import numpy as np
from icarus.util import inheritdoc
from icarus.tools import DiscreteDist
from icarus.registry import register_cache_policy, CACHE_POLICY
from .policies import Cache
__all__ = [
'PathCache',
'Tr... | [
"numpy.sum",
"icarus.registry.register_cache_policy",
"random.choice",
"icarus.tools.DiscreteDist",
"icarus.util.inheritdoc"
] | [((622, 651), 'icarus.registry.register_cache_policy', 'register_cache_policy', (['"""PATH"""'], {}), "('PATH')\n", (643, 651), False, 'from icarus.registry import register_cache_policy, CACHE_POLICY\n'), ((2904, 2933), 'icarus.registry.register_cache_policy', 'register_cache_policy', (['"""TREE"""'], {}), "('TREE')\n"... |
import pandas as pd
import pickle
from narrowing_ai_research.utils.list_utils import flatten_list
import narrowing_ai_research
import datetime
import logging
import os
import json
project_dir = narrowing_ai_research.project_dir
def make_ai_ids():
"""Function to extract AI Ids from the categories and expanded pap... | [
"pandas.DataFrame",
"os.remove",
"json.load",
"pandas.read_csv",
"os.path.exists",
"logging.info",
"pickle.load",
"pandas.Series",
"pandas.concat"
] | [((482, 549), 'pandas.read_csv', 'pd.read_csv', (['f"""{project_dir}/data/raw/arxiv_article_categories.csv"""'], {}), "(f'{project_dir}/data/raw/arxiv_article_categories.csv')\n", (493, 549), True, 'import pandas as pd\n'), ((5817, 5872), 'os.remove', 'os.remove', (['f"""{project_dir}/data/raw/arxiv_articles.csv"""'], ... |
#!/usr/bin/env python
# coding: utf-8
from tensorflow.keras.models import Model
from tensorflow.keras.layers import GlobalAveragePooling2D, Conv2D, Dense, Concatenate, Flatten, Input
from .abe_models import ABE
from ..layers import L2Normalisation
from ..layers.horde_layers import CKOP, PKOB
from .extractors import ge... | [
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.Concatenate",
"tensorflow.keras.layers.Dense"
] | [((3482, 3495), 'tensorflow.keras.layers.Concatenate', 'Concatenate', ([], {}), '()\n', (3493, 3495), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Conv2D, Dense, Concatenate, Flatten, Input\n'), ((3599, 3669), 'tensorflow.keras.layers.Conv2D', 'Conv2D', ([], {'filters': 'features_reduction', 'ker... |
# Copyright 2021 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, ... | [
"unittest.main",
"os.mkdir",
"os.path.abspath",
"os.path.dirname",
"os.path.exists",
"un.energy.process.process",
"absl.app.run",
"filecmp.cmp",
"os.path.join"
] | [((976, 1001), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (991, 1001), False, 'import os\n'), ((2520, 2529), 'absl.app.run', 'app.run', ([], {}), '()\n', (2527, 2529), False, 'from absl import app\n'), ((2534, 2549), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2547, 2549), False,... |
#! /usr/bin/env python
import wx
import sys
import os
import uivar
import uidef
sys.path.append(os.path.abspath(".."))
from win import bootDeviceWin_FlexspiNand
class secBootUiFlexspiNand(bootDeviceWin_FlexspiNand.bootDeviceWin_FlexspiNand):
def __init__(self, parent):
bootDeviceWin_FlexspiNand.... | [
"os.path.abspath",
"uivar.setBootDeviceConfiguration",
"uivar.getBootDeviceConfiguration",
"win.bootDeviceWin_FlexspiNand.bootDeviceWin_FlexspiNand.__init__",
"wx.MessageBox"
] | [((102, 123), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {}), "('..')\n", (117, 123), False, 'import os\n'), ((294, 368), 'win.bootDeviceWin_FlexspiNand.bootDeviceWin_FlexspiNand.__init__', 'bootDeviceWin_FlexspiNand.bootDeviceWin_FlexspiNand.__init__', (['self', 'parent'], {}), '(self, parent)\n', (354, 368)... |
from .CosmoHammerSampler import CosmoHammerSampler
from collections import namedtuple
from cosmoHammer.util.SampleFileUtil import SampleFileUtil
from mpi4py import MPI
import emcee
import itertools
class MpiCosmoHammerSampler(CosmoHammerSampler):
"""
A sampler implementation extending the regular sampler in o... | [
"mpi4py.MPI.COMM_WORLD.bcast",
"emcee.EnsembleSampler",
"mpi4py.MPI.COMM_WORLD.Get_rank",
"collections.namedtuple",
"itertools.chain",
"mpi4py.MPI.COMM_WORLD.Get_size"
] | [((608, 633), 'mpi4py.MPI.COMM_WORLD.Get_rank', 'MPI.COMM_WORLD.Get_rank', ([], {}), '()\n', (631, 633), False, 'from mpi4py import MPI\n'), ((2786, 2891), 'emcee.EnsembleSampler', 'emcee.EnsembleSampler', (['self.nwalkers', 'self.paramCount', 'callable'], {'threads': 'self.threadCount', 'pool': 'pool'}), '(self.nwalke... |
from .graph import Graph
import json
import unittest
class Multigraph:
GRAPHS = 'graphs'
TYPE = 'type'
LABEL = 'label'
METADATA = 'metadata'
def __init__(self, graphs=[], type=None, label=None, metadata=None):
"""Constructor of the Multigraph class.
Arguments:
... | [
"unittest.main",
"json.dumps"
] | [((7112, 7127), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7125, 7127), False, 'import unittest\n'), ((1145, 1166), 'json.dumps', 'json.dumps', (['dictionay'], {}), '(dictionay)\n', (1155, 1166), False, 'import json\n'), ((5417, 5435), 'json.dumps', 'json.dumps', (['result'], {}), '(result)\n', (5427, 5435), ... |
"""
-*- coding:utf-8 -*-
@Time :2019/11/27 下午4:54
@Author :wts
@File :utils.py
@Version:1.0
"""
import torch
import torch.utils.data.sampler as Sampler
import torch.nn as nn
import torch.nn.functional as F
class Mish(nn.Module):
def __init__(self):
super().__init__()
#print("Mish activation loa... | [
"torch.nn.functional.softplus"
] | [((384, 397), 'torch.nn.functional.softplus', 'F.softplus', (['x'], {}), '(x)\n', (394, 397), True, 'import torch.nn.functional as F\n')] |
#!/usr/bin/env python
import os
import pytest
import mindfuck
def load_from_file(brainfuck_code):
cwd = os.path.dirname(__file__)
fpath = os.path.join(cwd, 'data/%s' % brainfuck_code)
with open(fpath, 'r') as f:
return f.read()
def test_hello_world(capfd):
code = load_from_file("helloworld.bf... | [
"mindfuck.eval",
"os.path.dirname",
"os.path.join"
] | [((110, 135), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (125, 135), False, 'import os\n'), ((148, 193), 'os.path.join', 'os.path.join', (['cwd', "('data/%s' % brainfuck_code)"], {}), "(cwd, 'data/%s' % brainfuck_code)\n", (160, 193), False, 'import os\n'), ((327, 346), 'mindfuck.eval', '... |
import pytest
from thenewboston_node.business_logic.exceptions import ValidationError
from thenewboston_node.business_logic.tests.baker_factories import (
make_account_state, make_blockchain_state, make_genesis_blockchain_state
)
from thenewboston_node.business_logic.tests.mocks.utils import patch_blockchain_state... | [
"thenewboston_node.business_logic.tests.mocks.utils.patch_blocks",
"thenewboston_node.business_logic.tests.mocks.utils.patch_blockchain_states",
"thenewboston_node.business_logic.tests.baker_factories.make_blockchain_state",
"pytest.raises",
"thenewboston_node.business_logic.tests.baker_factories.make_genes... | [((445, 476), 'thenewboston_node.business_logic.tests.baker_factories.make_genesis_blockchain_state', 'make_genesis_blockchain_state', ([], {}), '()\n', (474, 476), False, 'from thenewboston_node.business_logic.tests.baker_factories import make_account_state, make_blockchain_state, make_genesis_blockchain_state\n'), ((... |
# 混雑度トーナメント選択により新たな探索母集団Qt+1を生成
import numpy as np
import random
import copy
class Tournament(object):
"""混雑度トーナメント選択
"""
def __init__(self, archive_set):
self._archive_set = copy.deepcopy(archive_set)
def tournament(self):
# アーカイブ母集団の個体数分の探索母集団を生成
size = int(self._archive_set... | [
"numpy.append",
"copy.deepcopy",
"numpy.array",
"random.randrange"
] | [((197, 223), 'copy.deepcopy', 'copy.deepcopy', (['archive_set'], {}), '(archive_set)\n', (210, 223), False, 'import copy\n'), ((353, 383), 'numpy.array', 'np.array', (['[]'], {'dtype': 'np.float64'}), '([], dtype=np.float64)\n', (361, 383), True, 'import numpy as np\n'), ((435, 457), 'random.randrange', 'random.randra... |
# Generated by Django 2.0.1 on 2018-01-30 23:36
import datetime
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('registros', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | [
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.DateField",
"django.db.models.AutoField"
] | [((1726, 1819), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""movimento.Transacao"""'}), "(on_delete=django.db.models.deletion.CASCADE, to=\n 'movimento.Transacao')\n", (1743, 1819), False, 'from django.db import migrations, models\n'), ((395, 4... |
import numpy as np
import pandas as pd
import pytest
from numpy.testing import assert_array_almost_equal
from powersimdata.tests.mock_grid import MockGrid
from powersimdata.tests.mock_scenario import MockScenario
from postreise.analyze.generation.emissions import (
generate_emissions_stats,
summarize_emissions... | [
"pandas.DataFrame",
"powersimdata.tests.mock_grid.MockGrid",
"pandas.date_range",
"postreise.analyze.generation.emissions.generate_emissions_stats",
"pytest.raises",
"numpy.array",
"powersimdata.tests.mock_scenario.MockScenario",
"pytest.approx"
] | [((1354, 1448), 'powersimdata.tests.mock_scenario.MockScenario', 'MockScenario', ([], {'grid_attrs': "{'plant': mock_plant, 'gencost_before': mock_gencost}", 'pg': 'mock_pg'}), "(grid_attrs={'plant': mock_plant, 'gencost_before':\n mock_gencost}, pg=mock_pg)\n", (1366, 1448), False, 'from powersimdata.tests.mock_sce... |
import socket
from messages import send_packet, receive_packet, INPUT_MESSAGE
ID = 0
NUM_BOTS = 4
# Notice: multiplicity == 4, telling RLBot I want to control bots.
# Controlled IDs are [id, id + 1, id + 2, id + 3].
# There must be enough cars in the match config file to support this.
HIVE_READY_MESSAGE = {
"typ... | [
"messages.receive_packet",
"socket.socket",
"messages.send_packet"
] | [((797, 846), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (810, 846), False, 'import socket\n'), ((1027, 1071), 'messages.send_packet', 'send_packet', (['self.socket', 'HIVE_READY_MESSAGE'], {}), '(self.socket, HIVE_READY_MESSAGE)\n', (1038... |
import math
import logging
import requests
from itertools import count
from requests import RequestException, HTTPError
from servicelayer.util import backoff
from followthemoney.helpers import entity_filename
from ingestors.settings import CONVERT_URL, CONVERT_TIMEOUT
from ingestors.support.cache import CacheSupport
f... | [
"ingestors.exc.ProcessingException",
"math.sqrt",
"itertools.count",
"requests.post",
"followthemoney.helpers.entity_filename",
"logging.getLogger"
] | [((423, 450), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (440, 450), False, 'import logging\n'), ((1456, 1479), 'followthemoney.helpers.entity_filename', 'entity_filename', (['entity'], {}), '(entity)\n', (1471, 1479), False, 'from followthemoney.helpers import entity_filename\n'), ((... |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from mrsimulator.method.query import TransitionQuery
from mrsimulator.methods import FiveQ_VAS
from mrsimulator.methods import SevenQ_VAS
from mrsimulator.methods import ThreeQ_VAS
__author__ = "<NAME>"
__email__ = "<EMAIL>"
methods = [ThreeQ_VAS, FiveQ_VAS, Se... | [
"mrsimulator.methods.ThreeQ_VAS",
"mrsimulator.method.query.TransitionQuery",
"numpy.allclose",
"pytest.raises",
"mrsimulator.methods.SevenQ_VAS",
"mrsimulator.methods.FiveQ_VAS"
] | [((2134, 2193), 'mrsimulator.methods.ThreeQ_VAS', 'ThreeQ_VAS', ([], {'channels': "['87Rb']", 'spectral_dimensions': '[{}, {}]'}), "(channels=['87Rb'], spectral_dimensions=[{}, {}])\n", (2144, 2193), False, 'from mrsimulator.methods import ThreeQ_VAS\n'), ((2639, 2697), 'numpy.allclose', 'np.allclose', (['mth.affine_ma... |
#!/usr/bin/env python3
import HIH6130
import rospy
from sensor_msgs.msg import Temperature, RelativeHumidity
def publish():
tempPub = rospy.Publisher('InternalTemperature', Temperature, queue_size=1)
humidPub = rospy.Publisher('InternalHumidity', RelativeHumidity, queue_size=1)
rospy.init_node('InternalEnvironment'... | [
"sensor_msgs.msg.RelativeHumidity",
"HIH6130.HIH6130",
"rospy.Publisher",
"rospy.Rate",
"sensor_msgs.msg.Temperature",
"rospy.is_shutdown",
"rospy.init_node"
] | [((136, 201), 'rospy.Publisher', 'rospy.Publisher', (['"""InternalTemperature"""', 'Temperature'], {'queue_size': '(1)'}), "('InternalTemperature', Temperature, queue_size=1)\n", (151, 201), False, 'import rospy\n'), ((214, 281), 'rospy.Publisher', 'rospy.Publisher', (['"""InternalHumidity"""', 'RelativeHumidity'], {'q... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
# from IPython import get_ipython
import time, os, sys, shutil
# from utils.fitting_utils import *
# for math and plotting
import pandas as pd
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # <--- This is... | [
"utils.analysis_tools.particles_to_body_supports_cuda",
"ipywidgets.Valid",
"ipywidgets.Text",
"numpy.einsum",
"ipywidgets.jslink",
"ipywidgets.Output",
"matplotlib.pyplot.figure",
"pickle.load",
"numpy.arange",
"numpy.sin",
"ipywidgets.BoundedIntText",
"ipywidgets.Button",
"numpy.transpose"... | [((24684, 24793), 'ipywidgets.Play', 'widgets.Play', ([], {'value': '(0)', 'min': '(0)', 'max': '(10000)', 'step': '(10)', 'interval': '(100)', 'description': '"""Press play"""', 'disabled': '(False)'}), "(value=0, min=0, max=10000, step=10, interval=100, description=\n 'Press play', disabled=False)\n", (24696, 2479... |
import falcon
import history
from bayesapi.resources import BaseResource
from bayesapi.validation import validate
class AnomaliesResource(BaseResource):
def on_post(self, req, resp):
req_vars = validate(self.api_def, 'post', req)
target_column = req_vars['target-column']
context_columns ... | [
"bayesapi.validation.validate",
"history.save"
] | [((209, 244), 'bayesapi.validation.validate', 'validate', (['self.api_def', '"""post"""', 'req'], {}), "(self.api_def, 'post', req)\n", (217, 244), False, 'from bayesapi.validation import validate\n'), ((937, 1100), 'history.save', 'history.save', (['self.cfg.history', "{'type': 'anomalies', 'query': query, 'result': r... |
import json
import numpy as np
import os
home = os.getcwd() + "/"
with open(home + "averaged_distributions/105_charges_distributions_errors.json") as file:
data = json.load(file)
x = list(np.array(range(4, 38)) * 2.5e-10)
permittivities = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 50, 75, 100, 2, 65, 85]
os.chdir(home... | [
"os.getcwd",
"json.dump",
"json.load",
"os.chdir"
] | [((307, 337), 'os.chdir', 'os.chdir', (["(home + 'charges_105')"], {}), "(home + 'charges_105')\n", (315, 337), False, 'import os\n'), ((48, 59), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (57, 59), False, 'import os\n'), ((166, 181), 'json.load', 'json.load', (['file'], {}), '(file)\n', (175, 181), False, 'import jso... |
# @file signtool_signer.py
# This module contains the abstracted signing interface for Windows Signtool.
# This interface abstraction takes in the signature_options and signer_options
# dictionaries that are used by capsule_tool and capsule_helper.
#
# Will attempt to locate a valid installation of Windows Signtool usi... | [
"warnings.warn",
"tempfile.mkdtemp",
"os.path.join",
"edk2toollib.windows.locate_tools.FindToolInWinSdk"
] | [((3744, 3762), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (3760, 3762), False, 'import tempfile\n'), ((3782, 3827), 'os.path.join', 'os.path.join', (['temp_folder', '"""data_to_sign.bin"""'], {}), "(temp_folder, 'data_to_sign.bin')\n", (3794, 3827), False, 'import os\n'), ((5329, 5377), 'os.path.join', ... |
import argo_workflow_tools.models.io.argoproj.workflow.v1alpha1 as argo
from argo_workflow_tools import dsl, WorkflowTemplate
@dsl.Task(image="python:3.10")
def say_hello(name: str):
return f"hello {name}"
@dsl.DAG()
def command_hello(name):
return say_hello(name)
def test_workflow_template():
workflo... | [
"argo_workflow_tools.models.io.argoproj.workflow.v1alpha1.Parameter",
"argo_workflow_tools.WorkflowTemplate",
"argo_workflow_tools.dsl.Task",
"argo_workflow_tools.dsl.DAG"
] | [((129, 158), 'argo_workflow_tools.dsl.Task', 'dsl.Task', ([], {'image': '"""python:3.10"""'}), "(image='python:3.10')\n", (137, 158), False, 'from argo_workflow_tools import dsl, WorkflowTemplate\n'), ((215, 224), 'argo_workflow_tools.dsl.DAG', 'dsl.DAG', ([], {}), '()\n', (222, 224), False, 'from argo_workflow_tools ... |
from _ctypes import ArgumentError
import zahlwort2num as w2n
import sys
def main():
if(sys.argv[1]):
print(w2n.convert(sys.argv[1]))
else:
raise ArgumentError('No parameter given!') | [
"_ctypes.ArgumentError",
"zahlwort2num.convert"
] | [((171, 207), '_ctypes.ArgumentError', 'ArgumentError', (['"""No parameter given!"""'], {}), "('No parameter given!')\n", (184, 207), False, 'from _ctypes import ArgumentError\n'), ((121, 145), 'zahlwort2num.convert', 'w2n.convert', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (132, 145), True, 'import zahlwort2num as w2n... |
import smart_imports
smart_imports.all()
class AccountError(utils_exceptions.TheTaleError):
MSG = 'account error'
class UnkwnownAchievementTypeError(AccountError):
MSG = 'unknown achievement type: %(achievement_type)r'
class EmailAndPasswordError(AccountError):
MSG = 'email & password must be specif... | [
"smart_imports.all"
] | [((23, 42), 'smart_imports.all', 'smart_imports.all', ([], {}), '()\n', (40, 42), False, 'import smart_imports\n')] |
from PIL import Image # importing packages
import face_recognition
image = face_recognition.load_image_file('group.jpg') # reading group photo
face_locations = face_recognition.face_locations(image)
for face_location in face_locations:
top, right, bottom, left = face_location
face_image = image[top:b... | [
"PIL.Image.fromarray",
"face_recognition.face_locations",
"face_recognition.load_image_file"
] | [((82, 127), 'face_recognition.load_image_file', 'face_recognition.load_image_file', (['"""group.jpg"""'], {}), "('group.jpg')\n", (114, 127), False, 'import face_recognition\n'), ((169, 207), 'face_recognition.face_locations', 'face_recognition.face_locations', (['image'], {}), '(image)\n', (200, 207), False, 'import ... |
# Generated by Django 3.2.7 on 2021-10-12 09:20
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('goods', '0006_auto_20211012_0812'),
]
operations = [
migrations.AlterUniqueTogether(
name='pharmproduct',
unique_together={(... | [
"django.db.migrations.AlterUniqueTogether"
] | [((225, 362), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""pharmproduct"""', 'unique_together': "{('trade_name', 'maker', 'original_packing', 'dosage_packing')}"}), "(name='pharmproduct', unique_together={(\n 'trade_name', 'maker', 'original_packing', 'dosage_packin... |
"""Low level module for IgBLAST api calls
You probably only want to interact with this module through airr as the database files are extremely tricky to get right
"""
from __future__ import annotations
import glob
import logging
import os
import subprocess
import tempfile
import warnings
import semantic_version
from ... | [
"pandas.read_csv",
"os.environ.copy",
"sadie.airr.exceptions.IgBLASTRunTimeError",
"pathlib.Path",
"sadie.airr.exceptions.EmtpyFileError",
"glob.glob",
"sadie.airr.exceptions.BadIgDATA",
"os.path.join",
"multiprocessing.cpu_count",
"os.path.abspath",
"os.path.dirname",
"os.path.exists",
"os.... | [((777, 805), 'logging.getLogger', 'logging.getLogger', (['"""IgBLAST"""'], {}), "('IgBLAST')\n", (794, 805), False, 'import logging\n'), ((1627, 1648), 'os.path.dirname', 'os.path.dirname', (['path'], {}), '(path)\n', (1642, 1648), False, 'import os\n'), ((1767, 1798), 'os.path.abspath', 'os.path.abspath', (['director... |
from django.contrib import admin
from core.models import User, TrackerGroup, TrackerGroupInstance, Question, Answer, Response, TrackerGroupInstance
@admin.register(User)
class UserAdmin(admin.ModelAdmin):
list_display = (
'username',
'name',
'email',
'slug',
)
@admin.register(T... | [
"django.contrib.admin.register"
] | [((150, 170), 'django.contrib.admin.register', 'admin.register', (['User'], {}), '(User)\n', (164, 170), False, 'from django.contrib import admin\n'), ((304, 332), 'django.contrib.admin.register', 'admin.register', (['TrackerGroup'], {}), '(TrackerGroup)\n', (318, 332), False, 'from django.contrib import admin\n'), ((4... |
"""
ssh module
"""
from ker.utils import request
from .list import API_LIST
class SSH:
"""
ssh api
"""
def __init__(self, email, token):
self.email = email
self.token = token
def list(self):
"""
list ssh keys
"""
return request(API_LIST.SSH_LIST.val... | [
"ker.utils.request"
] | [((291, 367), 'ker.utils.request', 'request', (['API_LIST.SSH_LIST.value', "{'email': self.email, 'token': self.token}"], {}), "(API_LIST.SSH_LIST.value, {'email': self.email, 'token': self.token})\n", (298, 367), False, 'from ker.utils import request\n'), ((498, 607), 'ker.utils.request', 'request', (['API_LIST.SSH_CR... |
from jinja2 import Template
import sys
import os
import argparse
sys.path.append(os.path.join(os.path.dirname(__file__), '../lib'))
from ad_struct import ADStructure
with open(os.path.join(os.path.dirname(__file__), '../lib/scripter/templates/fill-ad.ps1.jinja'),'r') as fill_ad:
template = Template(fill_ad.read(... | [
"os.path.dirname",
"ad_struct.ADStructure.from_json"
] | [((3138, 3173), 'ad_struct.ADStructure.from_json', 'ADStructure.from_json', (['ad_structure'], {}), '(ad_structure)\n', (3159, 3173), False, 'from ad_struct import ADStructure\n'), ((94, 119), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (109, 119), False, 'import os\n'), ((192, 217), 'os.p... |
import pyspark
from pyspark.sql import SparkSession
from pyspark.sql.types import *
from pyspark.sql.functions import *
import os
# Configure spark session
# ?readPreference=primaryPreferred
spark = SparkSession\
.builder\
.master('local[2]')\
.appName('accidents_etl')\
.config("spark.mongodb.input.uri... | [
"pyspark.sql.SparkSession.builder.master",
"os.path.dirname",
"os.chdir"
] | [((2814, 2839), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (2829, 2839), False, 'import os\n'), ((2867, 2881), 'os.chdir', 'os.chdir', (['path'], {}), '(path)\n', (2875, 2881), False, 'import os\n'), ((200, 239), 'pyspark.sql.SparkSession.builder.master', 'SparkSession.builder.master', ([... |
from rest_framework import serializers
from .models import CodonUsageTable, CodonUsage
class CodonUsageTableSerializer(serializers.ModelSerializer):
species = serializers.SlugRelatedField(read_only=True, slug_field='name')
class Meta:
model = CodonUsageTable
fields = '__all__'
class CodonU... | [
"rest_framework.serializers.SlugRelatedField"
] | [((166, 229), 'rest_framework.serializers.SlugRelatedField', 'serializers.SlugRelatedField', ([], {'read_only': '(True)', 'slug_field': '"""name"""'}), "(read_only=True, slug_field='name')\n", (194, 229), False, 'from rest_framework import serializers\n')] |
"""add a boolean flag for proxy dataset in ObjectMetadata
Revision ID: f712122fe780
Revises: <PASSWORD>
Create Date: 2022-03-31 07:20:49.411961
"""
# third party
from alembic import op # type: ignore
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f712122fe780"
down_revision = "70fcad0b... | [
"alembic.op.drop_column",
"sqlalchemy.Boolean"
] | [((529, 579), 'alembic.op.drop_column', 'op.drop_column', (['"""obj_metadata"""', '"""is_proxy_dataset"""'], {}), "('obj_metadata', 'is_proxy_dataset')\n", (543, 579), False, 'from alembic import op\n'), ((463, 475), 'sqlalchemy.Boolean', 'sa.Boolean', ([], {}), '()\n', (473, 475), True, 'import sqlalchemy as sa\n')] |
from django.test import TestCase
from django.core.management import call_command
from mock import patch
from robber import expect
from data.factories import AttachmentFileFactory
from data.constants import AttachmentSourceType
class CrawlCopaPortalDataTestCase(TestCase):
@patch('data_importer.copa_crawler.impor... | [
"data.factories.AttachmentFileFactory",
"django.core.management.call_command",
"mock.patch",
"robber.expect"
] | [((281, 394), 'mock.patch', 'patch', (['"""data_importer.copa_crawler.importers.CopaPortalAttachmentImporter.crawl_and_update_attachments"""'], {}), "(\n 'data_importer.copa_crawler.importers.CopaPortalAttachmentImporter.crawl_and_update_attachments'\n )\n", (286, 394), False, 'from mock import patch\n'), ((390, ... |
# Generated by Django 2.1 on 2018-09-21 16:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Cast',
fields=[
... | [
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((2651, 2761), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""reviews"""', 'to': '"""_django.User"""'}), "(on_delete=django.db.models.deletion.CASCADE, related_name\n ='reviews', to='_django.User')\n", (2668, 2761), False, 'from django... |
import os
import jinja2
from webapp2_extras import i18n
jinja_environment = jinja2.Environment(loader=jinja2.FileSystemLoader('static/templates'),extensions=['jinja2.ext.i18n'])
jinja_environment.install_gettext_callables(
i18n.gettext,
i18n.ngettext,
newstyle=True)
jinja_environment.filters.update({
'format_d... | [
"jinja2.FileSystemLoader"
] | [((103, 146), 'jinja2.FileSystemLoader', 'jinja2.FileSystemLoader', (['"""static/templates"""'], {}), "('static/templates')\n", (126, 146), False, 'import jinja2\n')] |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import os
import pyfasta
import allel
import seaborn as sns
import petl as etl
import h5py
import pandas
title = 'Phase 1 AR3 release'
pop_ids = 'AOM', 'BFM', 'GWA', 'GNS', 'BFS', 'CMS', 'GAS', 'UGS', 'KES'
pop_labels = {
... | [
"h5py.File",
"petl.MemorySource",
"pandas.read_csv",
"os.path.exists",
"pyfasta.Fasta",
"seaborn.color_palette",
"petl.fromtsv",
"os.path.join",
"allel.FeatureTable.from_gff3"
] | [((2498, 2533), 'os.path.join', 'os.path.join', (['release_dir', '"""genome"""'], {}), "(release_dir, 'genome')\n", (2510, 2533), False, 'import os\n'), ((2550, 2622), 'os.path.join', 'os.path.join', (['genome_dir', '"""Anopheles-gambiae-PEST_CHROMOSOMES_AgamP3.fa"""'], {}), "(genome_dir, 'Anopheles-gambiae-PEST_CHROMO... |
import ast
import base64
import json
import requests
import pytest
from pytest_bdd import parsers, scenario, then, when
def _negation(value):
"""Parse an optional negation after a verb (in a Gherkin feature spec)."""
if value == "":
return False
elif value in [" not", "not"]:
return True... | [
"pytest_bdd.then",
"pytest_bdd.parsers.parse",
"pytest_bdd.parsers.cfparse",
"pytest.fixture",
"pytest_bdd.when",
"ast.literal_eval",
"requests.post",
"pytest_bdd.scenario"
] | [((435, 512), 'pytest_bdd.scenario', 'scenario', (['"""../features/salt_api.feature"""', '"""Login to SaltAPI using Basic auth"""'], {}), "('../features/salt_api.feature', 'Login to SaltAPI using Basic auth')\n", (443, 512), False, 'from pytest_bdd import parsers, scenario, then, when\n'), ((570, 664), 'pytest_bdd.scen... |
# coding=utf-8
"""Comparison of various classifiers acting alone and inside an bagging ensemble."""
from sklearn import datasets, model_selection, metrics, tree, ensemble
if __name__ == "__main__":
print("Loading data...")
X, y = datasets.load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = model... | [
"sklearn.datasets.load_iris",
"sklearn.model_selection.train_test_split",
"sklearn.tree.DecisionTreeClassifier"
] | [((240, 275), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (258, 275), False, 'from sklearn import datasets, model_selection, metrics, tree, ensemble\n'), ((315, 353), 'sklearn.model_selection.train_test_split', 'model_selection.train_test_split', (['X', 'y'... |
import sys
sys.setrecursionlimit(60000)
def solution(n):
# must recursive dp
# dp = [-1 for i in range(60001)]
# dp[1] = 1
# dp[2] = 2
# for i in range(3, (n+1)):
# dp[i] = dp[i-1] + dp[i-2]
# return dp[n] % 1000000007
dp = [-1 for i in range(60001)]
dp[1] = 1
dp[2] = 2
... | [
"sys.setrecursionlimit"
] | [((12, 40), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(60000)'], {}), '(60000)\n', (33, 40), False, 'import sys\n')] |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def write_event_file():
writer = tf.summary.FileWriter('.')
writer.add_graph(tf.get_default_graph())
print("Event Written")
def execute():
"""
Tensor programs... | [
"tensorflow.get_default_graph",
"tensorflow.summary.FileWriter",
"tensorflow.constant"
] | [((177, 203), 'tensorflow.summary.FileWriter', 'tf.summary.FileWriter', (['"""."""'], {}), "('.')\n", (198, 203), True, 'import tensorflow as tf\n'), ((692, 726), 'tensorflow.constant', 'tf.constant', (['(3.0)'], {'dtype': 'tf.float32'}), '(3.0, dtype=tf.float32)\n', (703, 726), True, 'import tensorflow as tf\n'), ((73... |
"""Pytest plugin to setup and teardown a Decoy instance.
The plugin will be registered with pytest when you install Decoy. It adds a
fixture without modifying any other pytest behavior. Its usage is optional
but highly recommended.
"""
import pytest
from typing import Iterable
from decoy import Decoy
@pytest.fixture... | [
"decoy.Decoy"
] | [((786, 793), 'decoy.Decoy', 'Decoy', ([], {}), '()\n', (791, 793), False, 'from decoy import Decoy\n')] |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import re, os, sys
from dwave_qbsolv import QBSolv
from dwave.system.samplers import DWaveSampler, DWaveCliqueSampler
from dwave.system.composites import EmbeddingComposite, FixedEmbeddingComposite
import dimod
import hybrid
import minorminer
import networkx as n... | [
"numpy.set_printoptions",
"hybrid.MergeSamples",
"random.randint",
"hybrid.InterruptableTabuSampler",
"numpy.zeros",
"os.system",
"math.floor",
"qpu_sampler_time.QPUTimeSubproblemAutoEmbeddingSampler",
"hybrid.SplatComposer",
"dimod.BQM.from_qubo",
"minorminer.find_embedding",
"hybrid.LoopUnti... | [((1645, 1660), 'numpy.zeros', 'np.zeros', (['[Dim]'], {}), '([Dim])\n', (1653, 1660), True, 'import numpy as np\n'), ((1755, 1775), 'numpy.zeros', 'np.zeros', (['[Dim, Dim]'], {}), '([Dim, Dim])\n', (1763, 1775), True, 'import numpy as np\n'), ((1855, 1887), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'prec... |
import os
LABELS_FILE_NAME = 'labels.msl'
README_FILE_NAME = 'README.md'
if os.path.exists(README_FILE_NAME):
os.remove(README_FILE_NAME)
labelsFile = open(LABELS_FILE_NAME, 'r')
readmeFile = open(README_FILE_NAME, 'a+')
readmeFile.write('# WORK\n')
readmeFile.write('\n')
readmeFile.write('|Address|Label|Comment|... | [
"os.remove",
"os.path.exists"
] | [((78, 110), 'os.path.exists', 'os.path.exists', (['README_FILE_NAME'], {}), '(README_FILE_NAME)\n', (92, 110), False, 'import os\n'), ((114, 141), 'os.remove', 'os.remove', (['README_FILE_NAME'], {}), '(README_FILE_NAME)\n', (123, 141), False, 'import os\n')] |