code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import typing
from datetime import datetime
from ..schema import BaseTransformer
class Transformer(BaseTransformer):
"""Transform New Jersey raw data for consolidation."""
postal_code = "NJ"
fields = dict(
company="Company",
location="City",
effective_date="Effective Date",
... | [
"datetime.datetime"
] | [((887, 908), 'datetime.datetime', 'datetime', (['(2020)', '(8)', '(23)'], {}), '(2020, 8, 23)\n', (895, 908), False, 'from datetime import datetime\n'), ((954, 975), 'datetime.datetime', 'datetime', (['(2022)', '(4)', '(22)'], {}), '(2022, 4, 22)\n', (962, 975), False, 'from datetime import datetime\n')] |
#!/usr/bin/python
"""
FlowCal Python API example, without using calibration beads data.
This script is divided in two parts. Part one processes data from five cell
samples, and generates plots of each one.
Part two exemplifies how to use the processed cell sample data with
FlowCal's plotting and statistics modules, i... | [
"FlowCal.gate.start_end",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"FlowCal.io.FCSData",
"matplotlib.pyplot.close",
"os.path.exists",
"FlowCal.stats.gmean",
"matplotlib.pyplot.ylim",
"FlowCal.gate.density2d",
"FlowCal.transform.to_rfi",
"FlowCal.plot.hist1d",
"FlowCal.plot... | [((949, 982), 'numpy.array', 'np.array', (['[0, 81, 161, 318, 1000]'], {}), '([0, 81, 161, 318, 1000])\n', (957, 982), True, 'import numpy as np\n'), ((7748, 7776), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 3.5)'}), '(figsize=(6, 3.5))\n', (7758, 7776), True, 'import matplotlib.pyplot as plt\n'), ... |
#coding:utf-8
#################################
#Copyright(c) 2014 dtysky
#################################
import G2R
class CgTag(G2R.TagSource):
def Get(self,Flag,US):
tags=G2R.TagSource.Get(self,Flag,US)
tags['s']={}
for cg in tags['m']:
tags['s'][cg]={}
for s in US.Args[Flag][cg]['Scene']:
for knu... | [
"G2R.TagSource.Get"
] | [((179, 212), 'G2R.TagSource.Get', 'G2R.TagSource.Get', (['self', 'Flag', 'US'], {}), '(self, Flag, US)\n', (196, 212), False, 'import G2R\n')] |
#!/usr/bin/env python
#****************************************************************************
# ©
# Copyright 2014-2015 <NAME>
#
# 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
#
# h... | [
"argparse.ArgumentParser",
"os.path.realpath",
"os.path.splitext",
"traceback.format_exc",
"configManager.ConfigManager",
"fileObject.FileObject",
"os.path.join"
] | [((1626, 1665), 'os.path.join', 'os.path.join', (['cur_path', '"""hookster.conf"""'], {}), "(cur_path, 'hookster.conf')\n", (1638, 1665), False, 'import os\n'), ((1062, 1088), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (1078, 1088), False, 'import os\n'), ((1106, 1139), 'os.path.join', ... |
N, Q = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N - 1)]
cd = [list(map(int, input().split())) for _ in range(Q)]
G = [[] for _ in range(N)]
for a, b in ab:
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
dist = [-1 for _ in range(N)]
#"dist[0] = 0
from collections im... | [
"collections.deque"
] | [((337, 344), 'collections.deque', 'deque', ([], {}), '()\n', (342, 344), False, 'from collections import deque\n')] |
# -*- coding: utf-8 -*-
#
# AUTOR: <NAME>
#
# PLACE: Rio de Janeiro - Brazil
#
# CONTACT: <EMAIL>
#
# CRIATION: ago/2018
#
# LAST MODIFICATION: ago/2018
#
# OBJECTIVE: Processing Artigas' meteorological station data for Bia (INUMET)
import os
import sys
import pandas as pd
from datetime import datetime
sys.path.in... | [
"pandas.DataFrame",
"airsea.pol2cart_wind",
"os.path.join",
"pandas.merge",
"datetime.datetime.now",
"os.path.expanduser"
] | [((2152, 2207), 'pandas.merge', 'pd.merge', (['wspd', 'wdir'], {'left_index': '(True)', 'right_index': '(True)'}), '(wspd, wdir, left_index=True, right_index=True)\n', (2160, 2207), True, 'import pandas as pd\n'), ((2250, 2295), 'airsea.pol2cart_wind', 'airsea.pol2cart_wind', (['df.wspd', 'df.wdir'], {'rnd': '(1)'}), '... |
"""
Serializers
"""
from django.utils.translation import ugettext_lazy as _
from django.core.mail import EmailMultiAlternatives
from django.conf import settings
from applications.authentication import authenticate
from rest_framework import exceptions, serializers
from .state import User
from .tokens import Acce... | [
"rest_framework.serializers.UUIDField",
"rest_framework.exceptions.AuthenticationFailed",
"rest_framework.serializers.SerializerMethodField",
"django.utils.translation.ugettext_lazy",
"rest_framework.serializers.IntegerField",
"rest_framework.serializers.CharField",
"django.core.mail.EmailMultiAlternati... | [((4097, 4123), 'rest_framework.serializers.IntegerField', 'serializers.IntegerField', ([], {}), '()\n', (4121, 4123), False, 'from rest_framework import exceptions, serializers\n'), ((4135, 4158), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (4156, 4158), False, 'from rest_framewo... |
import os
from pathlib import Path
from django.urls import reverse
from django.contrib.auth import get_user_model
from filer.models import File as FilerFile
# from rest_framework import status
from ...tests import APITestFactory
from ...models import Upload, Link
from ..utils import parse_user_files
User = get_us... | [
"django.contrib.auth.get_user_model",
"os.path.join",
"os.path.exists",
"filer.models.File.objects.filter"
] | [((314, 330), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (328, 330), False, 'from django.contrib.auth import get_user_model\n'), ((459, 501), 'os.path.join', 'os.path.join', (['self.user_folder_path', '"""ftp"""'], {}), "(self.user_folder_path, 'ftp')\n", (471, 501), False, 'import os\n')... |
import mock
import pytest
import pwny
def test_default_arch_x86():
with mock.patch('platform.machine') as platform_mock:
platform_mock.return_value = 'i386'
assert pwny.Target().arch is pwny.Target.Arch.x86
def test_default_arch_x86_64():
with mock.patch('platform.machine') as platform_mock... | [
"mock.patch",
"pwny.Target",
"pytest.mark.xfail"
] | [((1649, 1694), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'raises': 'NotImplementedError'}), '(raises=NotImplementedError)\n', (1666, 1694), False, 'import pytest\n'), ((1925, 1961), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'raises': 'ValueError'}), '(raises=ValueError)\n', (1942, 1961), False, 'import pyt... |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
'''
@Time : 2021/06/21 10:22:31
@Author : Camille
@Version : 1.0
'''
import logging
import os
import datetime
class BaseLogs():
"""
@logName: types_datetime
@callerPath: caller function path
"""
def __init__(self, logName, mar... | [
"logging.FileHandler",
"os.makedirs",
"os.path.exists",
"datetime.date.today",
"logging.Logger",
"logging.Formatter",
"os.path.join"
] | [((675, 713), 'os.path.join', 'os.path.join', (['callerPath', '"""logs"""', 'mark'], {}), "(callerPath, 'logs', mark)\n", (687, 713), False, 'import os\n'), ((1360, 1411), 'logging.FileHandler', 'logging.FileHandler', (['logPath', '"""a"""'], {'encoding': '"""utf-8"""'}), "(logPath, 'a', encoding='utf-8')\n", (1379, 14... |
from tornado.web import RequestHandler
from tornado.web import gen
from controller import sugarGuideController
import json
# 保存糖导的结果
class AddSugarGuideResult(RequestHandler):
@gen.coroutine
def post(self):
session_id = self.get_argument('session_id')
gender = self.get_argument('gen... | [
"json.dumps",
"controller.sugarGuideController.retireveHealthWeekly",
"controller.sugarGuideController.createHealthWeekly"
] | [((1131, 1351), 'controller.sugarGuideController.createHealthWeekly', 'sugarGuideController.createHealthWeekly', (['session_id', 'gender', 'age', 'height', 'weight', 'sugarType', 'diseaseAge', 'akin', 'fm', 'manyDrinkWc', 'posion', 'thirsty', 'visionDown', 'diseaseSpeed', 'verifyYear', 'cureWay', 'dsPlan', 'complicatio... |
import pytest
import numpy as np
from sklearn.model_selection import GridSearchCV
from sklego.datasets import load_penguins
from sklearn.pipeline import Pipeline
from sklearn.metrics import make_scorer, accuracy_score
from hulearn.preprocessing import PipeTransformer
from hulearn.outlier import InteractiveOutlierDetec... | [
"sklego.datasets.load_penguins",
"sklearn.metrics.make_scorer",
"numpy.random.random",
"hulearn.common.flatten",
"hulearn.outlier.InteractiveOutlierDetector",
"hulearn.outlier.InteractiveOutlierDetector.from_json",
"hulearn.preprocessing.PipeTransformer"
] | [((1658, 1743), 'hulearn.outlier.InteractiveOutlierDetector.from_json', 'InteractiveOutlierDetector.from_json', (['"""tests/test_classification/demo-data.json"""'], {}), "('tests/test_classification/demo-data.json'\n )\n", (1694, 1743), False, 'from hulearn.outlier import InteractiveOutlierDetector\n'), ((1843, 1928... |
# Copyright (c) 2021, ac and Contributors
# See license.txt
import frappe
import unittest
from accounting.accounting.doctype.sales_invoice.test_sales_invoice import TestSalesInvoice
class TestGLEntry(unittest.TestCase):
def setUp(self) -> None:
self.doctype = 'GL Entry'
def test_gl_entries_for_sales_invoice(s... | [
"frappe.get_last_doc",
"frappe.db.count",
"accounting.accounting.doctype.sales_invoice.test_sales_invoice.TestSalesInvoice.create_sales_invoice"
] | [((345, 374), 'frappe.db.count', 'frappe.db.count', (['self.doctype'], {}), '(self.doctype)\n', (360, 374), False, 'import frappe\n'), ((390, 450), 'accounting.accounting.doctype.sales_invoice.test_sales_invoice.TestSalesInvoice.create_sales_invoice', 'TestSalesInvoice.create_sales_invoice', (['"""Frappe"""', '"""Lapto... |
# -*- coding: utf-8 -*-
from line2.models.command import ContinuousHybridCommand, Parameter, ParameterType, CommandResult, CommandResultType, CommandContinuousCallType
from line2.utils import IsEmpty, AddReverseDict, Lock, AddAtExit, DelAtExit, Acquire
from line2.models.messages import Buttons
from time import time, s... | [
"line2.models.command.ContinuousHybridCommand",
"random.randint",
"line2.models.command.CommandResult.Done",
"random.shuffle",
"threading.Condition",
"line2.utils.AddAtExit",
"random.choice",
"time.time",
"line2.utils.DelAtExit",
"line2.utils.IsEmpty",
"line2.models.messages.Buttons",
"line2.m... | [((49243, 49249), 'line2.utils.Lock', 'Lock', ([], {}), '()\n', (49247, 49249), False, 'from line2.utils import IsEmpty, AddReverseDict, Lock, AddAtExit, DelAtExit, Acquire\n'), ((101943, 102017), 'line2.models.command.ContinuousHybridCommand', 'ContinuousHybridCommand', (['"""ww"""', 'Werewolf'], {'desc': '"""Awoo"""'... |
# TODO 增加右键菜单和拖拽启动打包
import os
import glob
import time
import zipfile
def mark(target):
tt = time.strftime('.%Y%m%d_%H%M%S')
base, ext = os.path.splitext(target)
os.rename(target, base + tt + ext)
def compress(paths, except_key=()):
save_name = os.path.splitext(paths[0])[0] + time.st... | [
"zipfile.ZipFile",
"os.rename",
"time.strftime",
"os.path.isfile",
"os.path.splitext",
"glob.iglob",
"os.listdir"
] | [((109, 140), 'time.strftime', 'time.strftime', (['""".%Y%m%d_%H%M%S"""'], {}), "('.%Y%m%d_%H%M%S')\n", (122, 140), False, 'import time\n'), ((158, 182), 'os.path.splitext', 'os.path.splitext', (['target'], {}), '(target)\n', (174, 182), False, 'import os\n'), ((188, 222), 'os.rename', 'os.rename', (['target', '(base +... |
from tqdm import tqdm
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import time
import argparse
import math
from lib import utils
from lib.utils import log_string
from model.DSTGNN import DSTGNN
parser = argparse.ArgumentParser()
parser.add_argument('--P', type = int, default =... | [
"argparse.ArgumentParser",
"numpy.nan_to_num",
"lib.utils.loadData",
"numpy.isnan",
"numpy.mean",
"torch.no_grad",
"model.DSTGNN.DSTGNN",
"torch.isnan",
"torch.load",
"torch.mean",
"numpy.divide",
"torch.zeros_like",
"math.ceil",
"numpy.square",
"numpy.not_equal",
"torch.cuda.is_availa... | [((246, 271), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (269, 271), False, 'import argparse\n'), ((2329, 2364), 'lib.utils.log_string', 'log_string', (['log', '"""loading data...."""'], {}), "(log, 'loading data....')\n", (2339, 2364), False, 'from lib.utils import log_string\n'), ((2448, ... |
import os
import sys
import scipy.io
import scipy.misc
import matplotlib.pyplot as plt
from PIL import Image
from nst_utils import *
from loss_function import *
import numpy as np
import tensorflow as tf
import time
STYLE_LAYERS = [
('conv1_1', 0.2),
('conv2_1', 0.2),
('conv3_1', 0.2),
('conv4_1', 0.2)... | [
"tensorflow.global_variables_initializer",
"tensorflow.reset_default_graph",
"time.time",
"numpy.array",
"tensorflow.InteractiveSession",
"tensorflow.train.AdamOptimizer"
] | [((765, 789), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (787, 789), True, 'import tensorflow as tf\n'), ((826, 849), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (847, 849), True, 'import tensorflow as tf\n'), ((1887, 1914), 'tensorflow.train.AdamOptimi... |
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
"""
Plots random networks with a varying chance of connections between nodes
for figure 2.3.
"""
node_color = 'red'
node_border_color = 'black'
node_border_width = .6
edge_color = 'black'
N = 10
num_graphs = 6
N_columns = 3
N_rows = 2
P ... | [
"matplotlib.pyplot.show",
"networkx.draw_networkx_edges",
"networkx.fast_gnp_random_graph",
"networkx.spring_layout",
"networkx.draw_networkx_nodes",
"numpy.linspace",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.subplots"
] | [((322, 359), 'numpy.linspace', 'np.linspace', (['(0.0)', '(1.0)'], {'num': 'num_graphs'}), '(0.0, 1.0, num=num_graphs)\n', (333, 359), True, 'import numpy as np\n'), ((729, 760), 'matplotlib.pyplot.subplots', 'plt.subplots', (['N_columns', 'N_rows'], {}), '(N_columns, N_rows)\n', (741, 760), True, 'import matplotlib.p... |
import torch
import torch.nn.functional as F
def train(model,train_loader,test_loader,
optimizer,target_loss,test_losses,
num_steps,print_steps=10000):
model.train()
opt = optimizer(model.parameters())
device = next(model.parameters()).device
test_losslist = []
train_l... | [
"torch.zeros",
"torch.no_grad",
"torch.FloatTensor",
"torch.nn.functional.cross_entropy"
] | [((1369, 1402), 'torch.FloatTensor', 'torch.FloatTensor', (['train_losslist'], {}), '(train_losslist)\n', (1386, 1402), False, 'import torch\n'), ((1404, 1436), 'torch.FloatTensor', 'torch.FloatTensor', (['test_losslist'], {}), '(test_losslist)\n', (1421, 1436), False, 'import torch\n'), ((1866, 1908), 'torch.nn.functi... |
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from digits import test_utils
def test_caffe_imports():
test_utils.skipIfNotFramework('caffe')
import numpy # noqa
import google.protobuf # noqa
| [
"digits.test_utils.skipIfNotFramework"
] | [((171, 209), 'digits.test_utils.skipIfNotFramework', 'test_utils.skipIfNotFramework', (['"""caffe"""'], {}), "('caffe')\n", (200, 209), False, 'from digits import test_utils\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
import datetime
import logging
import logging.handlers
import threading
from time import sleep
import Communication
import Time
import Algorithm, createDistanceMatrix
import Json
import SQLHandler
import url_constructer
one = SQLHandler.SQLHandler()
LOG_FORM... | [
"threading.Thread",
"copy.deepcopy",
"Time.add_timezone",
"logging.basicConfig",
"Communication.sftp_upload",
"logging.handlers.SocketHandler",
"Algorithm.main",
"Json.build_list",
"datetime.date.today",
"time.sleep",
"Json.fill_data_matrix",
"SQLHandler.SQLHandler",
"datetime.time",
"url_... | [((287, 310), 'SQLHandler.SQLHandler', 'SQLHandler.SQLHandler', ([], {}), '()\n', (308, 310), False, 'import SQLHandler\n'), ((380, 486), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""PythonServer.log"""', 'level': 'logging.DEBUG', 'format': 'LOG_FORMAT', 'filemode': '"""w"""'}), "(filename='Pytho... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
from pymongo import MongoClient
from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk
import datetime
import json
from fuzzywuzzy import fuzz
# 一次同步的数据量,批量同步
syncCountPer = 100000
# Es 数据库地址
es_url = 'localhost:9200'
# mongodb 数据库地址
mongo_url = 'localho... | [
"elasticsearch.Elasticsearch",
"fuzzywuzzy.fuzz.ratio",
"pymongo.MongoClient",
"elasticsearch.helpers.bulk",
"datetime.datetime.now"
] | [((412, 444), 'elasticsearch.Elasticsearch', 'Elasticsearch', (['es_url'], {'port': '(9200)'}), '(es_url, port=9200)\n', (425, 444), False, 'from elasticsearch import Elasticsearch\n'), ((452, 481), 'pymongo.MongoClient', 'MongoClient', (['mongo_url', '(27017)'], {}), '(mongo_url, 27017)\n', (463, 481), False, 'from py... |
# Generated by Django 2.1.2 on 2018-10-05 14:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reservations', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='bio',
... | [
"django.db.models.CharField",
"django.db.models.TextField"
] | [((328, 383), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'max_length': '(500)', 'null': '(True)'}), '(blank=True, max_length=500, null=True)\n', (344, 383), False, 'from django.db import migrations, models\n'), ((505, 559), 'django.db.models.CharField', 'models.CharField', ([], {'blank':... |
import unittest
from __init__ import DotMap
class ReadmeTestCase(unittest.TestCase):
def test_basic_use(self):
m = DotMap()
self.assertIsInstance(m, DotMap)
m.name = 'Joe'
self.assertEqual(m.name, 'Joe')
self.assertEqual('Hello ' + m.name, 'Hello Joe')
self.assertIs... | [
"pickle.loads",
"copy.deepcopy",
"__init__.DotMap",
"collections.OrderedDict",
"__init__.DotMap.fromkeys",
"pickle.dumps"
] | [((129, 137), '__init__.DotMap', 'DotMap', ([], {}), '()\n', (135, 137), False, 'from __init__ import DotMap\n'), ((589, 597), '__init__.DotMap', 'DotMap', ([], {}), '()\n', (595, 597), False, 'from __init__ import DotMap\n'), ((721, 737), '__init__.DotMap', 'DotMap', ([], {'a': '(1)', 'b': '(2)'}), '(a=1, b=2)\n', (72... |
import base64
import importlib.util
from hashlib import md5
def secret_hash(data):
"""
Create a secret hash from data.
"""
strings = []
for key, value in sorted(data.items()):
strings.append(key)
try:
if isinstance(value, dict):
value = sorted(value.item... | [
"base64.b85encode"
] | [((635, 663), 'base64.b85encode', 'base64.b85encode', (['hash_value'], {}), '(hash_value)\n', (651, 663), False, 'import base64\n')] |
from wagtail.core import hooks
def allow_blindly(tag):
return tag
# See: http://docs.wagtail.io/en/v1.6/reference/hooks.html#construct-whitelister-element-rules
@hooks.register('construct_whitelister_element_rules')
def whitelister_element_rules():
rules = {}
# Tables
rules.update(dict.fromkeys(['tab... | [
"wagtail.core.hooks.register"
] | [((169, 222), 'wagtail.core.hooks.register', 'hooks.register', (['"""construct_whitelister_element_rules"""'], {}), "('construct_whitelister_element_rules')\n", (183, 222), False, 'from wagtail.core import hooks\n')] |
import gym
import vision_arena
import time
import pybullet as p
import pybullet_data
import cv2
if __name__=="__main__":
env = gym.make("vision_arena-v0")
x=0
while True:
p.stepSimulation()
env.move_husky(5, 5, 5, 5)
if x==100:
img = env.camera_feed()
cv2.imw... | [
"gym.make",
"pybullet.stepSimulation",
"time.sleep"
] | [((132, 159), 'gym.make', 'gym.make', (['"""vision_arena-v0"""'], {}), "('vision_arena-v0')\n", (140, 159), False, 'import gym\n'), ((378, 393), 'time.sleep', 'time.sleep', (['(100)'], {}), '(100)\n', (388, 393), False, 'import time\n'), ((192, 210), 'pybullet.stepSimulation', 'p.stepSimulation', ([], {}), '()\n', (208... |
import time
class BruteForce:
def __init__(self, mainStr, searchStr):
self._mainStr=mainStr
self._searchStr=searchStr
def search(self)->int:
searchLen=len(self._searchStr)
mainLen=len(self._mainStr)
if mainLen==0 or mainLen<searchLen:
return -1
i... | [
"time.time"
] | [((812, 823), 'time.time', 'time.time', ([], {}), '()\n', (821, 823), False, 'import time\n'), ((870, 881), 'time.time', 'time.time', ([], {}), '()\n', (879, 881), False, 'import time\n')] |
import os
import sys
try:
from urllib.request import urlretrieve
except ImportError:
from urllib import urlretrieve
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import tempfile
import time
import logging
from tmdb_api import tmdb
from mutagen.mp4 import MP4, MP4Cover
fr... | [
"io.StringIO",
"os.path.abspath",
"os.path.basename",
"tempfile.gettempdir",
"os.path.exists",
"mutagen.mp4.MP4Cover",
"logging.getLogger",
"tmdb_api.tmdb.configure",
"time.sleep",
"os.path.splitext",
"tmdb_api.tmdb.Movie",
"mutagen.mp4.MP4",
"os.path.join",
"sys.exit"
] | [((2091, 2103), 'mutagen.mp4.MP4', 'MP4', (['mp4Path'], {}), '(mp4Path)\n', (2094, 2103), False, 'from mutagen.mp4 import MP4, MP4Cover\n'), ((5309, 5319), 'io.StringIO', 'StringIO', ([], {}), '()\n', (5317, 5319), False, 'from io import StringIO\n'), ((598, 625), 'logging.getLogger', 'logging.getLogger', (['__name__']... |
import os
import json
import logging
from birdy.twitter import UserClient
logging.basicConfig(filename='tweetme.log', format='%(asctime)s %(message)s', level=logging.DEBUG)
def get_config_from_file(filename="config.json"):
"""
This function will check for the config.json file which holds the Twitter API
... | [
"json.dump",
"logging.error",
"logging.basicConfig",
"birdy.twitter.UserClient",
"os.listdir"
] | [((75, 178), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""tweetme.log"""', 'format': '"""%(asctime)s %(message)s"""', 'level': 'logging.DEBUG'}), "(filename='tweetme.log', format=\n '%(asctime)s %(message)s', level=logging.DEBUG)\n", (94, 178), False, 'import logging\n'), ((718, 730), 'os.list... |
from decimal import Decimal
from .common import SlotMixin
class SlotKalkulator_Wydawnictwo_Ciagle_Prog1(SlotMixin):
"""
Artykuł z czasopisma z listy ministerialnej.
Dla roku 2017, 2018: punkty KBN >= 30
"""
def punkty_pkd(self, dyscyplina):
if self.ma_dyscypline(dyscyplina):
... | [
"decimal.Decimal"
] | [((521, 533), 'decimal.Decimal', 'Decimal', (['"""1"""'], {}), "('1')\n", (528, 533), False, 'from decimal import Decimal\n'), ((650, 662), 'decimal.Decimal', 'Decimal', (['"""1"""'], {}), "('1')\n", (657, 662), False, 'from decimal import Decimal\n'), ((1182, 1196), 'decimal.Decimal', 'Decimal', (['"""0.1"""'], {}), "... |
"""
Tests for the xopen.xopen function
"""
import bz2
from contextlib import contextmanager
import functools
import gzip
import io
import itertools
import lzma
import os
from pathlib import Path
import shutil
import pytest
from xopen import xopen
# TODO this is duplicated in test_piped.py
TEST_DIR = Path(__file__).p... | [
"functools.partial",
"os.chmod",
"os.path.dirname",
"gzip.decompress",
"pytest.fixture",
"shutil.which",
"xopen",
"pathlib.Path",
"pytest.raises",
"io.TextIOWrapper",
"itertools.product",
"pytest.mark.timeout",
"pytest.mark.parametrize",
"shutil.copy"
] | [((1172, 1205), 'pytest.fixture', 'pytest.fixture', ([], {'params': 'extensions'}), '(params=extensions)\n', (1186, 1205), False, 'import pytest\n'), ((1252, 1280), 'pytest.fixture', 'pytest.fixture', ([], {'params': 'files'}), '(params=files)\n', (1266, 1280), False, 'import pytest\n'), ((4522, 4575), 'pytest.mark.par... |
# the -n is important on gdal_merge otherwise data gets stomped!
import os
sep = os.path.sep
s = ['5MCP19/1/20210710/rgb.bin',
'5MCP19/1/20210722/rgb.bin',
'5MCP19/1/20210714/rgb.bin',
'5MCP19/2/20210710/rgb.bin',
'5MCP19/2/20210722/rgb.bin',
'5MCP19/2/20210714/rgb.bin',
'5MCP18/1/20210718... | [
"multiprocessing.Pool",
"os.system",
"multiprocessing.cpu_count"
] | [((1151, 1163), 'os.system', 'os.system', (['c'], {}), '(c)\n', (1160, 1163), False, 'import os\n'), ((1209, 1223), 'multiprocessing.cpu_count', 'mp.cpu_count', ([], {}), '()\n', (1221, 1223), True, 'import multiprocessing as mp\n'), ((1269, 1286), 'multiprocessing.Pool', 'mp.Pool', (['n_thread'], {}), '(n_thread)\n', ... |
from __future__ import annotations
import ast
import pytest
from flake8_pie import Flake8PieCheck
from flake8_pie.base import Error
from flake8_pie.pie784_celery_crontab_args import PIE784, _is_invalid_celery_crontab
from flake8_pie.tests.utils import to_errors
@pytest.mark.parametrize(
"code,expected",
[
... | [
"flake8_pie.pie784_celery_crontab_args.PIE784",
"pytest.mark.parametrize",
"flake8_pie.Flake8PieCheck",
"flake8_pie.pie784_celery_crontab_args._is_invalid_celery_crontab",
"ast.parse",
"ast.Str"
] | [((1995, 2355), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""args,expected"""', "[({'minute', 'hour'}, False), ({'hour'}, True), ({'hour', 'day_of_week'}, \n True), ({'minute', 'hour', 'day_of_week'}, False), ({'minute', 'hour',\n 'day_of_week', 'day_of_month', 'month_of_year', 'another_random_arg'... |
from __future__ import print_function
from infi.execute import execute
import os
import glob
import logging
import shutil
import platform
import hashlib
import stat
from contextlib import contextmanager
from six.moves.configparser import ConfigParser, NoOptionError
from tempfile import NamedTemporaryFile
log = logg... | [
"tempfile.NamedTemporaryFile",
"os.path.abspath",
"os.chmod",
"os.path.pathsep.join",
"os.path.dirname",
"os.environ.copy",
"os.path.exists",
"os.walk",
"infi.registry.LocalComputer",
"os.environ.get",
"tempfile.mkdtemp",
"os.path.relpath",
"six.moves.configparser.ConfigParser",
"infi.reci... | [((316, 343), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (333, 343), False, 'import logging\n'), ((366, 461), 'os.path.join', 'os.path.join', (['"""SOFTWARE"""', '"""Microsoft"""', '"""Windows"""', '"""CurrentVersion"""', '"""Installer"""', '"""UserData"""'], {}), "('SOFTWARE', 'Micro... |
# -*- coding: utf-8 -*-
"""A setuptools based module for the NIVA tsb module/application.
"""
from os import path
from setuptools import setup, find_packages
here = path.abspath(path.dirname(__file__))
# get the version from the __version__.py file
version_dict = {}
with open(path.join(here, 'pyniva', '__version__.p... | [
"os.path.dirname",
"os.path.join",
"setuptools.find_packages"
] | [((180, 202), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (192, 202), False, 'from os import path\n'), ((280, 323), 'os.path.join', 'path.join', (['here', '"""pyniva"""', '"""__version__.py"""'], {}), "(here, 'pyniva', '__version__.py')\n", (289, 323), False, 'from os import path\n'), ((375, ... |
__copyright__ = 'Copyright (C) 2019, Nokia'
import os
import imp
from setuptools import setup, find_packages
VERSIONFILE = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'src', 'crl', 'examplelib', '_version.py')
def get_version():
return imp.load_source('_version', VERSIONFILE).get_version(... | [
"imp.load_source",
"os.path.abspath",
"os.path.dirname",
"setuptools.find_packages"
] | [((160, 185), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (175, 185), False, 'import os\n'), ((794, 814), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (807, 814), False, 'from setuptools import setup, find_packages\n'), ((267, 307), 'imp.load_source', 'imp... |
from copy import copy
import numpy as np
from nipy.core.image.image import Image
class ImageList(object):
''' Class to contain ND image as list of (N-1)D images '''
def __init__(self, images=None):
"""
A lightweight implementation of a list of images.
Parameters
-------... | [
"numpy.asarray",
"copy.copy",
"numpy.rollaxis"
] | [((1776, 1793), 'numpy.asarray', 'np.asarray', (['image'], {}), '(image)\n', (1786, 1793), True, 'import numpy as np\n'), ((1809, 1832), 'numpy.rollaxis', 'np.rollaxis', (['data', 'axis'], {}), '(data, axis)\n', (1820, 1832), True, 'import numpy as np\n'), ((1868, 1882), 'copy.copy', 'copy', (['coordmap'], {}), '(coord... |
# Regular expression exercises from Google Python class
import re
# Example 1
match = re.search('iig','called piiig')
print(match)
print(match.group())
# Example 2
match = re.search('igs','called piiig')
print(match)
def Find(pat, txt):
match = re.search(pat, txt)
if match:
print(match.group())
else:
print(... | [
"re.findall",
"re.search"
] | [((89, 121), 're.search', 're.search', (['"""iig"""', '"""called piiig"""'], {}), "('iig', 'called piiig')\n", (98, 121), False, 'import re\n'), ((176, 208), 're.search', 're.search', (['"""igs"""', '"""called piiig"""'], {}), "('igs', 'called piiig')\n", (185, 208), False, 'import re\n'), ((1722, 1784), 're.search', '... |
from django.db import close_old_connections
from rest_framework_simplejwt.tokens import UntypedToken
from rest_framework_simplejwt.exceptions import InvalidToken, TokenError
from jwt import decode as jwt_decode
from django.conf import settings
from django.contrib.auth import get_user_model
from urllib.parse import pars... | [
"django.contrib.auth.models.AnonymousUser",
"app.models.CustomUser.objects.get",
"jwt.decode",
"rest_framework_simplejwt.tokens.UntypedToken"
] | [((570, 604), 'app.models.CustomUser.objects.get', 'CustomUser.objects.get', ([], {'id': 'user_id'}), '(id=user_id)\n', (592, 604), False, 'from app.models import CustomUser\n'), ((656, 671), 'django.contrib.auth.models.AnonymousUser', 'AnonymousUser', ([], {}), '()\n', (669, 671), False, 'from django.contrib.auth.mode... |
#
# This file is part of Invenio.
# Copyright (C) 2022 Graz University of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Create featured communities table"""
import sqlalchemy as sa
from alembic import op
f... | [
"alembic.op.drop_table",
"sqlalchemy.DateTime",
"alembic.op.f",
"sqlalchemy.dialects.mysql.DATETIME",
"sqlalchemy_utils.UUIDType",
"sqlalchemy.Integer"
] | [((1567, 1604), 'alembic.op.drop_table', 'op.drop_table', (['"""communities_featured"""'], {}), "('communities_featured')\n", (1580, 1604), False, 'from alembic import op\n'), ((952, 964), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (962, 964), True, 'import sqlalchemy as sa\n'), ((1017, 1027), 'sqlalchemy_ut... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='azure_blob_check',
version='2.0',
description='azure blob filelist check',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/kyungjunleeme/azure_blob_check',
download_url='https://github.com/kyu... | [
"setuptools.find_packages"
] | [((380, 421), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['docs', 'tests*']"}), "(exclude=['docs', 'tests*'])\n", (393, 421), False, 'from setuptools import setup, find_packages\n')] |
import os
import argparse
import multiprocessing
from typing import Dict, Union
import numpy as np
import pandas as pd
import skimage.io
from tqdm import tqdm
from src import config
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser()
parser.add_argument(
'--masks',
typ... | [
"pandas.DataFrame",
"argparse.ArgumentParser",
"os.path.exists",
"os.path.splitext",
"multiprocessing.Pool",
"os.path.join",
"os.listdir"
] | [((239, 264), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (262, 264), False, 'import argparse\n'), ((2205, 2227), 'pandas.DataFrame', 'pd.DataFrame', (['metadata'], {}), '(metadata)\n', (2217, 2227), True, 'import pandas as pd\n'), ((1050, 1098), 'os.path.join', 'os.path.join', (['self._mask... |
from libsaas.services import base
from . import resource
class PlansBaseResource(resource.StripeResource):
path = 'plans'
class Plan(PlansBaseResource):
def create(self, *args, **kwargs):
raise base.MethodNotSupported()
class Plans(resource.ListResourceMixin, PlansBaseResource):
def update... | [
"libsaas.services.base.MethodNotSupported"
] | [((217, 242), 'libsaas.services.base.MethodNotSupported', 'base.MethodNotSupported', ([], {}), '()\n', (240, 242), False, 'from libsaas.services import base\n'), ((359, 384), 'libsaas.services.base.MethodNotSupported', 'base.MethodNotSupported', ([], {}), '()\n', (382, 384), False, 'from libsaas.services import base\n'... |
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2019/11/12 16:45
# @author : Mo
# @function:
from keras_textclassification import train
train(graph='TextCNN', # 必填, 算法名, 可选"ALBERT","BERT","XLNET","FASTTEXT","TEXTCNN","CHARCNN",
# "TEXTRNN","RCNN","DCNN","DPCNN","VDCNN","CRNN","DEEPMOJI... | [
"keras_textclassification.train"
] | [((147, 256), 'keras_textclassification.train', 'train', ([], {'graph': '"""TextCNN"""', 'label': '(17)', 'path_train_data': 'None', 'path_dev_data': 'None', 'rate': '(1)', 'hyper_parameters': 'None'}), "(graph='TextCNN', label=17, path_train_data=None, path_dev_data=None,\n rate=1, hyper_parameters=None)\n", (152, ... |
from app import app
import routes
import rest
from myhvac_core import cfg
from myhvac_core.db import api as db
from myhvac_core import log
import logging
LOG = logging.getLogger(__name__)
opts = [
cfg.BoolOpt('debug', default=False,
help='Enables debug mode for the flask rest api'),
cfg.Int... | [
"myhvac_core.cfg.BoolOpt",
"myhvac_core.cfg.IntOpt",
"myhvac_core.log.init_log",
"myhvac_core.db.api.init_db",
"logging.getLogger",
"app.app.run"
] | [((164, 191), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (181, 191), False, 'import logging\n'), ((206, 296), 'myhvac_core.cfg.BoolOpt', 'cfg.BoolOpt', (['"""debug"""'], {'default': '(False)', 'help': '"""Enables debug mode for the flask rest api"""'}), "('debug', default=False, help=... |
import adv_test
import adv
import vanessa
def module():
return Vanessa
class Vanessa(vanessa.Vanessa):
comment = 'void weapon vs HMS'
def pre(this):
this.conf['str_w'] = 1.5*380
this.conf['mod_w'] = ('att','killer',0.2)
if this.condition('last offense'):
this.o_init = ... | [
"adv.Selfbuff"
] | [((480, 517), 'adv.Selfbuff', 'adv.Selfbuff', (['"""last_offense"""', '(0.3)', '(15)'], {}), "('last_offense', 0.3, 15)\n", (492, 517), False, 'import adv\n')] |
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | [
"apache_beam.testing.util.equal_to",
"apache_beam.testing.test_pipeline.TestPipeline",
"gcp_variant_transforms.beam_io.vcf_header_io.VcfHeader",
"pysam.libcbcf.VariantHeader",
"gcp_variant_transforms.libs.vcf_header_definitions_merger.VcfHeaderDefinitions",
"gcp_variant_transforms.transforms.merge_header_... | [((1306, 1329), 'pysam.libcbcf.VariantHeader', 'libcbcf.VariantHeader', ([], {}), '()\n', (1327, 1329), False, 'from pysam import libcbcf\n'), ((1397, 1560), 'gcp_variant_transforms.beam_io.vcf_header_io.VcfHeader', 'vcf_header_io.VcfHeader', ([], {'infos': 'header.info', 'filters': 'header.filters', 'alts': 'header.al... |
"""
Quick Sort is one of the most efficient sorting algorithms.
It is based on the splitting of the input list into smaller lists.
Quick Sort works better with smaller data sets in comparison to merge sort.
"""
import random
rand_list = [random.randint(1, 100) for i in range(0,8)]
def swap(arr: list, i: int, k: int)... | [
"random.randint"
] | [((240, 262), 'random.randint', 'random.randint', (['(1)', '(100)'], {}), '(1, 100)\n', (254, 262), False, 'import random\n')] |
import json
import requests
from requests.exceptions import RequestException
import re
def get_one_page(url,**headers):
try:
response = requests.get(url,headers = headers)
if response.status_code == 200:
return response.text
return None
except RequestException:
retur... | [
"re.findall",
"json.dumps",
"requests.get",
"re.compile"
] | [((375, 547), 're.compile', 're.compile', (['"""<div class="hd".*?href="(.*?)".*?"title">(.*?)</span>.*?"bd">.*?<p class="">(.*?)</p>.*?"star">.*?"v:average">(.*?)</span>.*?inq">(.*?)</span>"""', 're.S'], {}), '(\n \'<div class="hd".*?href="(.*?)".*?"title">(.*?)</span>.*?"bd">.*?<p class="">(.*?)</p>.*?"star">.*?"v... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
###############################################################################
import argparse
import sys
parser=argparse.ArgumentParser(
description='''Parse pfam file''')
__file__ = "pfam_parser.py"
__author__ = '<NAME> (<EMAIL>)'
__version__ = '0.8'
__date__ = 'D... | [
"argparse.ArgumentParser",
"os.path.basename",
"os.path.dirname",
"os.path.join",
"re.sub"
] | [((162, 216), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Parse pfam file"""'}), "(description='Parse pfam file')\n", (185, 216), False, 'import argparse\n'), ((654, 676), 'os.path.basename', 'os.path.basename', (['file'], {}), '(file)\n', (670, 676), False, 'import os\n'), ((736, 757... |
import numpy as np
import matplotlib.pyplot as plt
def plot_price_history(hist):
''' plot price history '''
plt.plot(hist, '-')
plt.xlabel("time steps"); plt.ylabel("price")
plt.title("price history")
plt.show()
def plot_price_std(arr):
''' plot std of price history over simulations'''
plt.plot(arr, '-')
plt.... | [
"matplotlib.pyplot.title",
"numpy.load",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.std",
"numpy.add",
"numpy.zeros",
"numpy.mean",
"matplotlib.pyplot.pie",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((859, 884), 'numpy.load', 'np.load', (['"""price_hist.npy"""'], {}), "('price_hist.npy')\n", (866, 884), True, 'import numpy as np\n'), ((898, 923), 'numpy.load', 'np.load', (['"""hash_power.npy"""'], {}), "('hash_power.npy')\n", (905, 923), True, 'import numpy as np\n'), ((938, 964), 'numpy.load', 'np.load', (['"""w... |
"""
You need to import this file in any app in versatileimagefield.py file
to make it visible for versatileimagefield
"""
from PIL import Image
from PIL.WebPImagePlugin import WebPImageFile
from io import BytesIO
from versatileimagefield.datastructures.sizedimage import (
MalformedSizedImageKey,
settings,
... | [
"versatileimagefield.datastructures.sizedimage.cache.get",
"io.BytesIO",
"versatileimagefield.datastructures.sizedimage.MalformedSizedImageKey",
"versatileimagefield.datastructures.sizedimage.SizedImageInstance",
"versatileimagefield.registry.versatileimagefield_registry.register_filter",
"versatileimagef... | [((7943, 8011), 'versatileimagefield.registry.versatileimagefield_registry.register_filter', 'versatileimagefield_registry.register_filter', (['"""to_webp"""', 'ToWebPImage'], {}), "('to_webp', ToWebPImage)\n", (7987, 8011), False, 'from versatileimagefield.registry import versatileimagefield_registry\n'), ((8012, 8097... |
"""Optimizes for specific Confusion Matrix Values: `FP` - only recommended if threshold is adjusted"""
import typing
import numpy as np
from h2oaicore.metrics import CustomScorer
from sklearn.preprocessing import LabelEncoder
from sklearn.metrics import confusion_matrix
class CMFalsePositive(CustomScorer):
_thres... | [
"sklearn.metrics.confusion_matrix",
"sklearn.preprocessing.LabelEncoder"
] | [((783, 797), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (795, 797), False, 'from sklearn.preprocessing import LabelEncoder\n'), ((941, 1020), 'sklearn.metrics.confusion_matrix', 'confusion_matrix', (['actual', 'predicted'], {'sample_weight': 'sample_weight', 'labels': 'labels'}), '(actual,... |
from flask import Blueprint
from . import auth, models, schemas
user_bp = Blueprint("user", __name__)
| [
"flask.Blueprint"
] | [((76, 103), 'flask.Blueprint', 'Blueprint', (['"""user"""', '__name__'], {}), "('user', __name__)\n", (85, 103), False, 'from flask import Blueprint\n')] |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import unittest
from pathlib import Path
from pymatgen.io.cp2k.outputs import Cp2kOutput
from pymatgen.util.testing import PymatgenTest
class SetTest(PymatgenTest):
def setUp(self):
self.TEST_FILES_DIR = Path.jo... | [
"unittest.main",
"pathlib.Path.joinpath"
] | [((849, 864), 'unittest.main', 'unittest.main', ([], {}), '()\n', (862, 864), False, 'import unittest\n'), ((313, 355), 'pathlib.Path.joinpath', 'Path.joinpath', (['self.TEST_FILES_DIR', '"""cp2k"""'], {}), "(self.TEST_FILES_DIR, 'cp2k')\n", (326, 355), False, 'from pathlib import Path\n'), ((386, 432), 'pathlib.Path.j... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django_extensions.db.fields
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
opera... | [
"django.db.models.TextField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.AutoField",
"django.db.models.BooleanField",
"django.db.models.DateField",
"django.db.models.DateTim... | [((245, 302), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (276, 302), False, 'from django.db import migrations, models\n'), ((478, 571), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""ID"... |
# The poller that queries Telegram for bot updates.
# Assumes it's the only poller enqueueing elements onto a number of queues.
# Nice way to make HTTP get requests
import requests
# To read arguments
import sys
# For our queues
from collections import deque
# To lock and unlock files
import fcntl
# To read/write ... | [
"pickle.dump",
"fcntl.flock",
"time.sleep",
"pickle.load",
"collections.deque"
] | [((2153, 2182), 'fcntl.flock', 'fcntl.flock', (['f', 'fcntl.LOCK_EX'], {}), '(f, fcntl.LOCK_EX)\n', (2164, 2182), False, 'import fcntl\n'), ((2206, 2220), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (2217, 2220), False, 'import pickle\n'), ((2498, 2554), 'pickle.dump', 'pickle.dump', (['writeBuffers[i]', 'f', '... |
# Generated by Django 3.0.7 on 2020-09-06 03:20
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('resources', '0003_remove_resource_code'),
]
operations = [
migrations.AlterModelTable(
name='resource',
table='Resource',
... | [
"django.db.migrations.AlterModelTable"
] | [((231, 292), 'django.db.migrations.AlterModelTable', 'migrations.AlterModelTable', ([], {'name': '"""resource"""', 'table': '"""Resource"""'}), "(name='resource', table='Resource')\n", (257, 292), False, 'from django.db import migrations\n')] |
"""
This file comes from pydc1394 examples.
Written by jordens.
Tested on Linux.
git clone https://github.com/jordens/pydc1394
"""
import time
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
from pymba import Vimba
class CameraPlot:
def __init__(self):
self.vimba = Vimba()
self.vi... | [
"pyqtgraph.Qt.QtGui.QMainWindow",
"pyqtgraph.Qt.QtGui.QApplication.instance",
"pyqtgraph.ImageView",
"pymba.Vimba",
"time.sleep",
"pyqtgraph.Qt.QtGui.QApplication",
"pyqtgraph.Qt.QtCore.QTimer.singleShot"
] | [((2190, 2212), 'pyqtgraph.Qt.QtGui.QApplication', 'QtGui.QApplication', (['[]'], {}), '([])\n', (2208, 2212), False, 'from pyqtgraph.Qt import QtCore, QtGui\n'), ((297, 304), 'pymba.Vimba', 'Vimba', ([], {}), '()\n', (302, 304), False, 'from pymba import Vimba\n'), ((529, 548), 'pyqtgraph.Qt.QtGui.QMainWindow', 'QtGui... |
from django.contrib import admin
from django_summernote.admin import SummernoteModelAdmin
from .models import BlogPost
# Apply summernote to all TextField in model.
class BlogPostAdmin(SummernoteModelAdmin): # instead of ModelAdmin
exclude = ('slug', )
list_display = ('id', 'title', 'category', 'date_created'... | [
"django.contrib.admin.site.register"
] | [((456, 500), 'django.contrib.admin.site.register', 'admin.site.register', (['BlogPost', 'BlogPostAdmin'], {}), '(BlogPost, BlogPostAdmin)\n', (475, 500), False, 'from django.contrib import admin\n')] |
#Importing libraries
import argparse
import cv2
from imutils.video import VideoStream #it creates a really good video stream
from imutils import face_utils, translate, resize
#face_utils : something that converts dlib to numpy so it can be furthur used.
#translate : it's going to translate the current position o... | [
"numpy.maximum",
"argparse.ArgumentParser",
"cv2.VideoWriter_fourcc",
"cv2.bitwise_and",
"cv2.fillPoly",
"imutils.face_utils.shape_to_np",
"imutils.translate",
"imutils.resize",
"cv2.imshow",
"dlib.shape_predictor",
"cv2.cvtColor",
"cv2.boundingRect",
"cv2.destroyAllWindows",
"cv2.waitKey"... | [((482, 507), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (505, 507), False, 'import argparse\n'), ((879, 894), 'time.sleep', 'time.sleep', (['(1.5)'], {}), '(1.5)\n', (889, 894), False, 'import time\n'), ((1069, 1101), 'dlib.get_frontal_face_detector', 'dlib.get_frontal_face_detector', ([],... |
import torch
import numpy as np
import random
from transformers import T5Tokenizer, T5ForConditionalGeneration
#Set all seeds to make output deterministic
torch.manual_seed(0)
np.random.seed(0)
random.seed(0)
#Paragraphs for which we want to generate queries
paragraphs = [
"Python is an interpreted, high-level and g... | [
"numpy.random.seed",
"torch.manual_seed",
"transformers.T5ForConditionalGeneration.from_pretrained",
"random.seed",
"torch.cuda.is_available",
"transformers.T5Tokenizer.from_pretrained",
"torch.no_grad"
] | [((156, 176), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (173, 176), False, 'import torch\n'), ((177, 194), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (191, 194), True, 'import numpy as np\n'), ((195, 209), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (206, 209), Fals... |
"""
Mocks out led device hardware
"""
from logging import getLogger
from unittest.mock import Mock
_LOGGER = getLogger("mock matrix")
class Matrix:
"""
A mock for an led matrix device
"""
_width = 32
_height = 8
_mode = "1"
def __init__(self):
_LOGGER.info("Created mock led matri... | [
"unittest.mock.Mock",
"logging.getLogger"
] | [((110, 134), 'logging.getLogger', 'getLogger', (['"""mock matrix"""'], {}), "('mock matrix')\n", (119, 134), False, 'from logging import getLogger\n'), ((363, 369), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (367, 369), False, 'from unittest.mock import Mock\n')] |
from __future__ import print_function
import time
import numpy as np
import sys
import gym
from PIL import Image
from gibson.core.render.profiler import Profiler
from gibson.envs.husky_env import *
from gibson.envs.ant_env import *
from gibson.envs.humanoid_env import *
from gibson.envs.drone_env import *
import pybull... | [
"numpy.zeros",
"time.sleep",
"numpy.random.random",
"numpy.random.randint",
"numpy.random.choice"
] | [((1326, 1342), 'time.sleep', 'time.sleep', (['(0.01)'], {}), '(0.01)\n', (1336, 1342), False, 'import time\n'), ((628, 666), 'numpy.random.randint', 'np.random.randint', (['self.action_space.n'], {}), '(self.action_space.n)\n', (645, 666), True, 'import numpy as np\n'), ((702, 738), 'numpy.zeros', 'np.zeros', (['self.... |
import sqlite3
from utils import send
import requests
from parameters import recruitment_message as message, login_payload, exclude_inactive, inactivity_threshold
def recruit(key):
""" Finds new players from the nations API, then sends and logs recruitment messages to them. """
conn = sqlite3.connec... | [
"utils.send",
"requests.Session",
"sqlite3.connect",
"requests.get"
] | [((306, 332), 'sqlite3.connect', 'sqlite3.connect', (['"""logs.db"""'], {}), "('logs.db')\n", (321, 332), False, 'import sqlite3\n'), ((1037, 1161), 'requests.get', 'requests.get', (['f"""https://politicsandwar.com/api/nations/?key={key}&alliance_id=0"""'], {'headers': "{'User-Agent': 'Mozilla/5.0'}"}), "(f'https://pol... |
# -*-coding:utf-8-*-
import torch
if __name__ == '__main__':
A = torch.arange(20).reshape(5,-1)
# print(A)
# print(A.T)
#对称矩阵
B = torch.tensor([[1,2,3],[2,0,4],[3,4,5]])
# print(B)
# print(B == B.T)
X = torch.arange(24).reshape(2,3,4)
# print(X)
#注意结果输出,3和4代表最里层3*4矩阵,2代表最外层
... | [
"torch.ones",
"torch.mv",
"torch.arange",
"torch.tensor"
] | [((153, 200), 'torch.tensor', 'torch.tensor', (['[[1, 2, 3], [2, 0, 4], [3, 4, 5]]'], {}), '([[1, 2, 3], [2, 0, 4], [3, 4, 5]])\n', (165, 200), False, 'import torch\n'), ((1735, 1771), 'torch.arange', 'torch.arange', (['(4)'], {'dtype': 'torch.float32'}), '(4, dtype=torch.float32)\n', (1747, 1771), False, 'import torch... |
"""
Copyright 2019 Samsung SDS
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 ... | [
"pandas.DataFrame",
"numpy.array",
"brightics.common.utils.check_required_parameters"
] | [((789, 856), 'brightics.common.utils.check_required_parameters', 'check_required_parameters', (['_polynomial_expansion', 'params', "['table']"], {}), "(_polynomial_expansion, params, ['table'])\n", (814, 856), False, 'from brightics.common.utils import check_required_parameters\n'), ((991, 1005), 'pandas.DataFrame', '... |
from unittest import mock
from urllib.parse import parse_qs, urlparse
import pytest
import python_freeipa
from bs4 import BeautifulSoup
from pyotp import TOTP
from noggin.app import ipa_admin
from noggin.representation.otptoken import OTPToken
from ..utilities import (
assert_form_field_error,
assert_form_ge... | [
"pytest.mark.vcr",
"noggin.representation.otptoken.OTPToken",
"python_freeipa.exceptions.BadRequest",
"noggin.app.ipa_admin.otptoken_del",
"urllib.parse.parse_qs",
"unittest.mock.patch",
"python_freeipa.exceptions.ValidationError",
"python_freeipa.exceptions.FreeIPAError",
"bs4.BeautifulSoup",
"py... | [((955, 972), 'pytest.mark.vcr', 'pytest.mark.vcr', ([], {}), '()\n', (970, 972), False, 'import pytest\n'), ((2052, 2069), 'pytest.mark.vcr', 'pytest.mark.vcr', ([], {}), '()\n', (2067, 2069), False, 'import pytest\n'), ((2497, 2514), 'pytest.mark.vcr', 'pytest.mark.vcr', ([], {}), '()\n', (2512, 2514), False, 'import... |
# Copyright (c) 2017-2018 Cloudify Platform Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | [
"cloudify_common_sdk._compat.text_type",
"cloudify.state.current_ctx.set",
"mock.patch",
"cloudify_rest_client.exceptions.CloudifyClientError",
"mock.MagicMock"
] | [((1118, 1148), 'cloudify_rest_client.exceptions.CloudifyClientError', 'CloudifyClientError', (['"""Mistake"""'], {}), "('Mistake')\n", (1137, 1148), False, 'from cloudify_rest_client.exceptions import CloudifyClientError\n'), ((1303, 1319), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (1317, 1319), False, 'im... |
import data_sourcing
from prefect import Flow, task
@task
def sourcing():
return data_sourcing.get()
with Flow("greenhouse") as flow:
sourcing()
flow.run()
| [
"data_sourcing.get",
"prefect.Flow"
] | [((88, 107), 'data_sourcing.get', 'data_sourcing.get', ([], {}), '()\n', (105, 107), False, 'import data_sourcing\n'), ((115, 133), 'prefect.Flow', 'Flow', (['"""greenhouse"""'], {}), "('greenhouse')\n", (119, 133), False, 'from prefect import Flow, task\n')] |
import numpy as np
import matplotlib.pylab as plt
import pandas as pd
import scipy.signal as signal
#Concatenación de los datos
data1 = pd.read_csv("transacciones2008.txt",sep = ";",names=['Fecha','Hora','Conversion','Monto'],decimal =",")
data2 = pd.read_csv("transacciones2009.txt",sep = ";",names=['Fecha','Hora'... | [
"pandas.DataFrame",
"matplotlib.pylab.savefig",
"matplotlib.pylab.legend",
"scipy.signal.filtfilt",
"matplotlib.pylab.subplot",
"pandas.read_csv",
"matplotlib.pylab.ylabel",
"matplotlib.pylab.plot",
"pandas.to_datetime",
"scipy.signal.butter",
"numpy.correlate",
"matplotlib.pylab.xlabel",
"p... | [((141, 251), 'pandas.read_csv', 'pd.read_csv', (['"""transacciones2008.txt"""'], {'sep': '""";"""', 'names': "['Fecha', 'Hora', 'Conversion', 'Monto']", 'decimal': '""","""'}), "('transacciones2008.txt', sep=';', names=['Fecha', 'Hora',\n 'Conversion', 'Monto'], decimal=',')\n", (152, 251), True, 'import pandas as ... |
#!/usr/bin/env python
import sys,os,stat,inspect,fnmatch
from glob import *
from collections import defaultdict as ddict
from .m4 import *
from .utilities import *
from .mod_autolib import autolib
from .mod_autoprog import autoprog
from .mod_autopackage import autopackage
# todo
#
# am_write should only set bin_PRO... | [
"os.path.realpath",
"sys._getframe"
] | [((674, 690), 'sys._getframe', 'sys._getframe', (['(1)'], {}), '(1)\n', (687, 690), False, 'import sys, os, stat, inspect, fnmatch\n'), ((719, 745), 'os.path.realpath', 'os.path.realpath', (['filename'], {}), '(filename)\n', (735, 745), False, 'import sys, os, stat, inspect, fnmatch\n')] |
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from textwrap import dedent
from unittest import TestCase
from mypy import api
def _check_mypy_on_code(python_code: str) -> str:
file_content = dedent(python_code).strip() + os.linesep
with TemporaryDirectory() as directory_name:
... | [
"textwrap.dedent",
"pathlib.Path",
"tempfile.TemporaryDirectory"
] | [((276, 296), 'tempfile.TemporaryDirectory', 'TemporaryDirectory', ([], {}), '()\n', (294, 296), False, 'from tempfile import TemporaryDirectory\n'), ((339, 359), 'pathlib.Path', 'Path', (['directory_name'], {}), '(directory_name)\n', (343, 359), False, 'from pathlib import Path\n'), ((226, 245), 'textwrap.dedent', 'de... |
from dataclasses import dataclass, field
from pathlib import Path
from typing import Type, AnyStr, List, Optional
from zipfile import ZipFile, ZIP_DEFLATED
import imghdr
import inspect
import json
import os
import pprint
import re
import shutil
import stat
import tempfile
import warnings
import pkg_resources
import re... | [
"os.remove",
"os.lchmod",
"os.walk",
"shutil.copystat",
"chai_py.auth.get_auth",
"pathlib.Path",
"os.path.islink",
"os.path.isfile",
"pprint.pprint",
"os.path.join",
"os.path.lexists",
"tempfile.TemporaryDirectory",
"pkg_resources.Requirement.parse",
"os.path.exists",
"requests.get",
"... | [((3285, 3313), 'pprint.pprint', 'pprint.pprint', (['metadata_dict'], {}), '(metadata_dict)\n', (3298, 3313), False, 'import pprint\n'), ((4957, 4974), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (4969, 4974), False, 'import requests\n'), ((6371, 6386), 'os.listdir', 'os.listdir', (['src'], {}), '(src)\n'... |
import pygame
class Instruction():
def __init__(self, x, y, font_size = 30):
self.x = x
self.y = y
self.line_size = font_size + 30 # 行距
self.color = (255, 255, 255)
self.font_obj = pygame.font.Font("assets/ShadowsIntoLightTwo-Regular.ttf", font_size)
# 為每行文字創建surfac... | [
"pygame.font.Font"
] | [((226, 295), 'pygame.font.Font', 'pygame.font.Font', (['"""assets/ShadowsIntoLightTwo-Regular.ttf"""', 'font_size'], {}), "('assets/ShadowsIntoLightTwo-Regular.ttf', font_size)\n", (242, 295), False, 'import pygame\n')] |
#
# Copyright 2012-2021 Bronto Software, Udviklings- og Forenklingsstyrelsen
# and multiple other contributors
#
# 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... | [
"bs4.BeautifulSoup",
"xml.sax.saxutils.escape",
"collections.namedtuple",
"re.compile"
] | [((798, 872), 'collections.namedtuple', 'collections.namedtuple', (['"""Cell"""', "['type', 'rowspan', 'colspan', 'contents']"], {}), "('Cell', ['type', 'rowspan', 'colspan', 'contents'])\n", (820, 872), False, 'import collections\n'), ((1068, 1127), 're.compile', 're.compile', (['"""<a\\\\s+name\\\\s*=\\\\s*["\\\\\']?... |
import macropy.activate
import JeevesLib
from smt.Z3 import *
import unittest
from Auction import AuctionContext, Bid, User
import JeevesLib
class TestAuction(unittest.TestCase):
def setUp(self):
JeevesLib.init()
self.aliceUser = User(0)
self.bobUser = User(1)
self.claireUser = User(2)
def testOwn... | [
"unittest.main",
"JeevesLib.jhasElt",
"JeevesLib.concretize",
"Auction.Bid",
"Auction.AuctionContext",
"JeevesLib.init",
"Auction.User"
] | [((1807, 1822), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1820, 1822), False, 'import unittest\n'), ((203, 219), 'JeevesLib.init', 'JeevesLib.init', ([], {}), '()\n', (217, 219), False, 'import JeevesLib\n'), ((241, 248), 'Auction.User', 'User', (['(0)'], {}), '(0)\n', (245, 248), False, 'from Auction import... |
import os
from flask import Flask
def create_app(test_config= None):
app = Flask(__name__, instance_relative_config= True)
app.config.from_mapping(
SECRET_KEY = 'dEV',
DATABASE = os.path.join(app.instance_path, 'flaskr.sqlite')
)
if test_config is None:
app.config.from_pyfile... | [
"os.makedirs",
"flask.Flask",
"os.path.join",
"flaskr.db.init_app"
] | [((81, 127), 'flask.Flask', 'Flask', (['__name__'], {'instance_relative_config': '(True)'}), '(__name__, instance_relative_config=True)\n', (86, 127), False, 'from flask import Flask\n'), ((510, 526), 'flaskr.db.init_app', 'db.init_app', (['app'], {}), '(app)\n', (521, 526), False, 'from flaskr import db\n'), ((415, 44... |
import unittest
import filterdesigner.FIRDesign as FIRDesign
import numpy as np
class TestKaiserord(unittest.TestCase):
def setUp(self):
self.f1 = 0.2
self.f2 = 0.3
self.f3 = 0.4
self.f4 = 0.5
self.f5 = 0.6
self.f6 = 0.7
self.m1 = 1
sel... | [
"filterdesigner.FIRDesign.kaiserord",
"numpy.all"
] | [((916, 1017), 'filterdesigner.FIRDesign.kaiserord', 'FIRDesign.kaiserord', (['[self.f1, self.f2, self.f3, self.f4]', '[self.m2, self.m1, self.m2]', 'self.dev2'], {}), '([self.f1, self.f2, self.f3, self.f4], [self.m2, self.m1,\n self.m2], self.dev2)\n', (935, 1017), True, 'import filterdesigner.FIRDesign as FIRDesig... |
__all__ = ['ArduCopter']
import logging
import os
from .state import State
from .sandbox import Sandbox
from .goto import GoTo
from .setmode import SetMode
from .takeoff import Takeoff
from .parachute import Parachute
from ..command_factory import read_commands_yml
from ..base import BaseSystem
from ..common import A... | [
"os.path.dirname",
"os.path.join",
"logging.getLogger"
] | [((381, 408), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (398, 408), False, 'import logging\n'), ((475, 500), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (490, 500), False, 'import os\n'), ((779, 816), 'os.path.join', 'os.path.join', (['dirname', '"""comm... |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from future.builtins import object
from limpyd.contrib.related import re_identifier
from ..related import (FKStringField, FKInstanceHashField,
M2MSetField, M2MListField, M2MSortedSetField,
RelatedCollectionFor... | [
"limpyd.contrib.related.re_identifier.sub"
] | [((2114, 2155), 'limpyd.contrib.related.re_identifier.sub', 're_identifier.sub', (['"""_"""', 'self.dynamic_part'], {}), "('_', self.dynamic_part)\n", (2131, 2155), False, 'from limpyd.contrib.related import re_identifier\n')] |
# The MIT License (MIT)
# Copyright (c) 2021 by Brockmann Consult GmbH and contributors
#
# 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... | [
"pandas.to_datetime",
"xarray.DataArray"
] | [((7746, 7792), 'pandas.to_datetime', 'pd.to_datetime', (['string'], {'format': 'datetime_format'}), '(string, format=datetime_format)\n', (7760, 7792), True, 'import pandas as pd\n'), ((3548, 3643), 'xarray.DataArray', 'xr.DataArray', (['[concat_dim_var.values]'], {'dims': '(concat_dim_name,)', 'attrs': 'concat_dim_va... |
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"os.path.dirname",
"os.path.exists",
"os.makedirs"
] | [((792, 810), 'os.path.dirname', 'os.path.dirname', (['f'], {}), '(f)\n', (807, 810), False, 'import os\n'), ((822, 839), 'os.path.exists', 'os.path.exists', (['d'], {}), '(d)\n', (836, 839), False, 'import os\n'), ((849, 863), 'os.makedirs', 'os.makedirs', (['d'], {}), '(d)\n', (860, 863), False, 'import os\n')] |
import json
import torch
import torch.nn as nn
import torch.nn.functional as F
PAD_token = 0 # Used for padding short sentences
SOS_token = 1 # Start-of-sentence token
EOS_token = 2 # End-of-sentence token
# TODO: `.to(device=device)` for all tensors
class EncoderRNN(nn.Module):
def __init__(self, hidden_si... | [
"torch.nn.Dropout",
"torch.ones",
"torch.nn.GRU",
"json.load",
"torch.jit.trace",
"torch.LongTensor",
"torch.load",
"torch.nn.Embedding",
"torch.cat",
"torch.nn.functional.softmax",
"torch.nn.Linear",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.nn.utils.rnn.pack_padded_sequence",
"tor... | [((3531, 3584), 'torch.load', 'torch.load', (['"""weights/encoder.pth"""'], {'map_location': '"""cpu"""'}), "('weights/encoder.pth', map_location='cpu')\n", (3541, 3584), False, 'import torch\n'), ((3646, 3691), 'torch.ones', 'torch.ones', (['(MAX_LENGTH, 1)'], {'dtype': 'torch.long'}), '((MAX_LENGTH, 1), dtype=torch.l... |
#!/usr/bin/env python3
import argparse
import os
import sys
import itertools
# input file data with illegal characters removed,
# converted according to JESD71 Table 2
# 6 bits per index
inputSymbols = []
# decompressed output data
# 8 bits per index
outputBytes = []
# uncompressed data length in bytes
uncompressed... | [
"itertools.chain.from_iterable",
"argparse.ArgumentParser",
"argparse.FileType"
] | [((5806, 5908), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""decompress ACA-compressed data of one boolean array object"""'}), "(description=\n 'decompress ACA-compressed data of one boolean array object')\n", (5829, 5908), False, 'import argparse\n'), ((1999, 2031), 'itertools.chai... |
"""
Update URL definitions:
https://docs.djangoproject.com/en/2.0/releases/2.0/#simplified-url-routing-syntax
"""
from __future__ import annotations
import ast
import re
from functools import partial
from typing import Iterable, MutableMapping
from weakref import WeakKeyDictionary
from tokenize_rt import Offset, Toke... | [
"django_upgrade.data.Fixer",
"functools.partial",
"django_upgrade.tokens.find",
"django_upgrade.ast.is_rewritable_import_from",
"django_upgrade.ast.ast_start_offset",
"django_upgrade.tokens.insert",
"django_upgrade.tokens.update_import_names",
"re.escape",
"django_upgrade.tokens.replace",
"weakref... | [((644, 679), 'django_upgrade.data.Fixer', 'Fixer', (['__name__'], {'min_version': '(2, 0)'}), '(__name__, min_version=(2, 0))\n', (649, 679), False, 'from django_upgrade.data import Fixer, State, TokenFunc\n'), ((1402, 1421), 'weakref.WeakKeyDictionary', 'WeakKeyDictionary', ([], {}), '()\n', (1419, 1421), False, 'fro... |
# -*- coding: utf-8 -*-
import ast
import re
from setuptools import find_packages, setup
# get version from __version__ variable in repairs/__init__.py
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('repairs/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(f.read().decode('... | [
"setuptools.find_packages",
"re.compile"
] | [((168, 206), 're.compile', 're.compile', (['"""__version__\\\\s+=\\\\s+(.*)"""'], {}), "('__version__\\\\s+=\\\\s+(.*)')\n", (178, 206), False, 'import re\n'), ((565, 580), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (578, 580), False, 'from setuptools import find_packages, setup\n')] |
"""object domain"""
# -*- coding:utf-8 -*-
import json
import threading
from commonbaby.helpers import helper_time
from datacontract.iscoutdataset.iscouttask import EObjectType, IscoutTask
from .mailserver import MailServer
from .portinfo import PortInfo
from .scoutfeedbackbase import ScoutFeedBackBase
from .search... | [
"threading.RLock",
"commonbaby.helpers.helper_time.get_time_sec_tz"
] | [((856, 885), 'commonbaby.helpers.helper_time.get_time_sec_tz', 'helper_time.get_time_sec_tz', ([], {}), '()\n', (883, 885), False, 'from commonbaby.helpers import helper_time\n'), ((976, 993), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (991, 993), False, 'import threading\n'), ((1057, 1074), 'threading.RL... |
import os
import sys
import threading
from Legobot.Lego import Lego
from unittest.mock import patch
LOCAL_PATH = os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'..',
'Local'
)
sys.path.append(LOCAL_PATH)
from shakespeare import Shakespeare # noqa: E402
LOCK = threading.Lock()
BASEPLATE = ... | [
"sys.path.append",
"Legobot.Lego.Lego.start",
"os.path.dirname",
"shakespeare.Shakespeare",
"threading.Lock",
"unittest.mock.patch"
] | [((202, 229), 'sys.path.append', 'sys.path.append', (['LOCAL_PATH'], {}), '(LOCAL_PATH)\n', (217, 229), False, 'import sys\n'), ((291, 307), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (305, 307), False, 'import threading\n'), ((320, 342), 'Legobot.Lego.Lego.start', 'Lego.start', (['None', 'LOCK'], {}), '(Non... |
from setuptools import setup, find_packages
from pathlib import Path
SRC_ROOT = Path(__file__).parent / "src"
ABOUT_MODULE = SRC_ROOT / "sopredictable/about.py"
install_requires = [
"typing-extensions;python_version < '3.8'",
]
extras_require = {
"serve": ["fastapi"],
"dev": ["pytest"]
}
with ABOUT_MOD... | [
"pathlib.Path",
"setuptools.find_packages"
] | [((82, 96), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (86, 96), False, 'from pathlib import Path\n'), ((662, 688), 'setuptools.find_packages', 'find_packages', ([], {'where': '"""src"""'}), "(where='src')\n", (675, 688), False, 'from setuptools import setup, find_packages\n')] |
"""
Stand alone GUI free index builder for Leo's full text search system::
python leoftsindex.py <file1> <file2> <file3>...
If the file name starts with @ it's a assumed to be a simple
text file listing files to be indexed.
If <file> does not contain '#' it's assumed to be a .leo file
to index, and is indexed.
If... | [
"leo.plugins.leofts.get_fts",
"leo.plugins.leofts.GnxCache",
"leo.core.leoBridge.controller",
"leo.plugins.leofts.set_leo"
] | [((1298, 1405), 'leo.core.leoBridge.controller', 'leoBridge.controller', ([], {'gui': '"""nullGui"""', 'loadPlugins': '(False)', 'readSettings': '(False)', 'silent': '(False)', 'verbose': '(False)'}), "(gui='nullGui', loadPlugins=False, readSettings=False,\n silent=False, verbose=False)\n", (1318, 1405), True, 'impo... |
#!/usr/bin/env python
import json
import multiprocessing as mp
import os
import shutil
from multiprocessing.pool import ThreadPool
import gffutils
from Bio.Alphabet import IUPAC
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from pyfaidx import Fasta
def create_padded_cds(template_species_list, fasta_p... | [
"subprocess.Popen",
"Bio.Seq.Seq",
"json.load",
"os.makedirs",
"argparse.ArgumentParser",
"os.remove",
"Bio.SeqRecord.SeqRecord",
"pyfaidx.Fasta",
"gffutils.FeatureDB",
"pytoml.load",
"shutil.rmtree",
"os.listdir",
"multiprocessing.cpu_count"
] | [((1110, 1149), 'Bio.Seq.Seq', 'Seq', (["('n' * n_count)", 'IUPAC.ambiguous_dna'], {}), "('n' * n_count, IUPAC.ambiguous_dna)\n", (1113, 1149), False, 'from Bio.Seq import Seq\n'), ((1154, 1212), 'shutil.rmtree', 'shutil.rmtree', (['template_alignment_path'], {'ignore_errors': '(True)'}), '(template_alignment_path, ign... |
from django.shortcuts import render
def home(request):
return render (request,"base.html") | [
"django.shortcuts.render"
] | [((64, 92), 'django.shortcuts.render', 'render', (['request', '"""base.html"""'], {}), "(request, 'base.html')\n", (70, 92), False, 'from django.shortcuts import render\n')] |
# container-service-extension
# Copyright (c) 2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
import hashlib
from pyvcloud.vcd.api_extension import APIExtension
from pyvcloud.vcd.client import BasicLoginCredentials
from pyvcloud.vcd.client import Client
import requests
from container_se... | [
"container_service_extension.common.utils.server_utils.should_use_mqtt_protocol",
"requests.packages.urllib3.disable_warnings",
"hashlib.sha1",
"pyvcloud.vcd.client.BasicLoginCredentials",
"container_service_extension.mqi.mqtt_extension_manager.MQTTExtensionManager",
"container_service_extension.common.ut... | [((2274, 2288), 'hashlib.sha1', 'hashlib.sha1', ([], {}), '()\n', (2286, 2288), False, 'import hashlib\n'), ((2987, 3000), 'container_service_extension.common.utils.core_utils.NullPrinter', 'NullPrinter', ([], {}), '()\n', (2998, 3000), False, 'from container_service_extension.common.utils.core_utils import NullPrinter... |
# -*- coding: utf-8 -*-
from io import BytesIO
from msgpack import Unpacker
class Writer:
def __init__(self, server):
self.server = server
def write(self, data):
self.server._buf.write(data)
async def drain(self):
pass
def close(self):
pass
class MockRecvServer:
... | [
"io.BytesIO",
"msgpack.Unpacker"
] | [((400, 409), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (407, 409), False, 'from io import BytesIO\n'), ((557, 594), 'msgpack.Unpacker', 'Unpacker', (['self._buf'], {'encoding': '"""utf-8"""'}), "(self._buf, encoding='utf-8')\n", (565, 594), False, 'from msgpack import Unpacker\n')] |
import PyPluMA
PyPluMA.dependency("ClusterCSV2NOA")
PyPluMA.dependency("CSV2GML")
import sys
import os
import math
from ClusterCSV2NOA.ClusterCSV2NOAPlugin import *
from CSV2GML.CSV2GMLPlugin import *
from distutils.spawn import find_executable
class NetworkVizPlugin(CSV2GMLPlugin):
def input(self, filename):
... | [
"PyPluMA.dependency"
] | [((15, 51), 'PyPluMA.dependency', 'PyPluMA.dependency', (['"""ClusterCSV2NOA"""'], {}), "('ClusterCSV2NOA')\n", (33, 51), False, 'import PyPluMA\n'), ((52, 81), 'PyPluMA.dependency', 'PyPluMA.dependency', (['"""CSV2GML"""'], {}), "('CSV2GML')\n", (70, 81), False, 'import PyPluMA\n')] |
#!/usr/bin/env python3
import os
import sys
import socket
import datetime
import argparse
import torch
import numpy as np
from baselines import logger
from baselines.common.vec_env.dummy_vec_env import DummyVecEnv
from baselines.common.vec_env.vec_normalize import VecNormalize
from envs import make_env
from model_tor i... | [
"numpy.stack",
"model_tor.ActorCriticNetwork",
"baselines.common.vec_env.dummy_vec_env.DummyVecEnv",
"envs.make_env",
"argparse.ArgumentParser",
"ppo_tor.VanillaPPO",
"storage_tor.ExperienceBuffer",
"baselines.common.vec_env.vec_normalize.VecNormalize",
"torch.manual_seed",
"torch.FloatTensor",
... | [((730, 759), 'baselines.logger.configure', 'logger.configure', ([], {'dir': 'log_dir'}), '(dir=log_dir)\n', (746, 759), False, 'from baselines import logger\n'), ((764, 792), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (781, 792), False, 'import torch\n'), ((797, 821), 'torch.set_nu... |
import csv
import pandas as pd
from sklearn.linear_model import Perceptron
df = pd.read_csv('original-data.csv')
df_feature = df.ix[:, df.columns != 'label']
df_label = df['label']
quiz = pd.read_csv('quiz.csv')
len = 126387
mega = pd.concat([df, quiz])
full = pd.get_dummies(mega)
multi_category_columns = ['0', '5', '7... | [
"pandas.read_csv",
"pandas.get_dummies",
"pandas.concat"
] | [((80, 112), 'pandas.read_csv', 'pd.read_csv', (['"""original-data.csv"""'], {}), "('original-data.csv')\n", (91, 112), True, 'import pandas as pd\n'), ((188, 211), 'pandas.read_csv', 'pd.read_csv', (['"""quiz.csv"""'], {}), "('quiz.csv')\n", (199, 211), True, 'import pandas as pd\n'), ((232, 253), 'pandas.concat', 'pd... |
"""Tests for the base Arduino hardware implementation."""
from datetime import timedelta
from math import pi
from typing import List, Optional, Set, Tuple, Type, cast
import pytest
from serial import Serial
from serial.tools.list_ports_common import ListPortInfo
from j5.backends.hardware import NotSupportedByHardwar... | [
"typing.cast",
"serial.tools.list_ports_common.ListPortInfo",
"pytest.raises"
] | [((3847, 3872), 'serial.tools.list_ports_common.ListPortInfo', 'ListPortInfo', (['"""/dev/null"""'], {}), "('/dev/null')\n", (3859, 3872), False, 'from serial.tools.list_ports_common import ListPortInfo\n'), ((6532, 6565), 'typing.cast', 'cast', (['MockSerial', 'backend._serial'], {}), '(MockSerial, backend._serial)\n'... |