code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
import wget
import time
import glob
import getpass
import tarfile
import subprocess
import email.mime.multipart
import email.mime.text
import email.mime.image
import email.mime.audio
from datetime import datetime
from pprint import pprint
from colorama import Style, Fore
from smtplib import SMTP, SMTP_SSL
fro... | [
"subprocess.getoutput",
"wget.download",
"tarfile.open",
"smtplib.SMTP",
"time.strptime",
"imaplib.IMAP4_SSL",
"smtplib.SMTP_SSL",
"imaplib.IMAP4",
"getpass.getuser",
"time.localtime",
"time.time",
"glob.glob"
] | [((636, 662), 'smtplib.SMTP_SSL', 'SMTP_SSL', ([], {'host': 'smtp_server'}), '(host=smtp_server)\n', (644, 662), False, 'from smtplib import SMTP, SMTP_SSL\n'), ((1448, 1470), 'imaplib.IMAP4_SSL', 'IMAP4_SSL', (['imap_server'], {}), '(imap_server)\n', (1457, 1470), False, 'from imaplib import IMAP4_SSL, IMAP4\n'), ((65... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(name="pyims",
version='0.1.2',
description='A python wrapper for the IMS Word Sense Disambiguation tool (Zhong and Ng, 2010)',
url='http://github.com/vishnumenon/pyims',
author="<NAME>",
author_em... | [
"setuptools.find_packages"
] | [((457, 483), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (481, 483), False, 'import setuptools\n')] |
# UnitTests of all triggmine events
import unittest
import datetime
from client import Client
class ClientTest(unittest.TestCase):
def setUp(self):
self.client = Client('YOUR API_URL', 'YOUR API_KEY')
# Registration event
def test_registration_success(self):
response = self.client.regist... | [
"unittest.main",
"datetime.datetime.now",
"client.Client"
] | [((11253, 11268), 'unittest.main', 'unittest.main', ([], {}), '()\n', (11266, 11268), False, 'import unittest\n'), ((177, 215), 'client.Client', 'Client', (['"""YOUR API_URL"""', '"""YOUR API_KEY"""'], {}), "('YOUR API_URL', 'YOUR API_KEY')\n", (183, 215), False, 'from client import Client\n'), ((840, 863), 'datetime.d... |
from flask_restful import Resource, reqparse
parser = reqparse.RequestParser()
parser.add_argument('command', required=True)
parser.add_argument('docker', required=True)
class Build(Resource):
def get(self):
return {'status': 'building'}
def post(self):
args = parser.parse_args()
pr... | [
"flask_restful.reqparse.RequestParser"
] | [((55, 79), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ([], {}), '()\n', (77, 79), False, 'from flask_restful import Resource, reqparse\n')] |
from pathlib import Path
from shutil import which
from subprocess import run, PIPE
import click
from .main import main, lprint
@main.command()
@click.pass_context
@click.argument('watcher')
def symlink(ctx, watcher):
"""Locally install a symlink to sera"""
if ctx.parent.params['watcher']:
click.echo... | [
"click.echo",
"click.argument",
"shutil.which"
] | [((168, 193), 'click.argument', 'click.argument', (['"""watcher"""'], {}), "('watcher')\n", (182, 193), False, 'import click\n'), ((310, 349), 'click.echo', 'click.echo', (['"""This command runs locally"""'], {}), "('This command runs locally')\n", (320, 349), False, 'import click\n'), ((394, 407), 'shutil.which', 'whi... |
from typing import Optional, Dict, List
import aiohttp
plate_to_version = {
'真1': 'maimai',
'真2': 'maimai PLUS',
'超': 'maimai GreeN',
'檄': 'maimai GreeN PLUS',
'橙': 'maimai ORANGE',
'暁': 'maimai ORANGE PLUS',
'晓': 'maimai ORANGE PLUS',
'桃': 'maimai PiNK'... | [
"aiohttp.request"
] | [((802, 905), 'aiohttp.request', 'aiohttp.request', (['"""POST"""', '"""https://www.diving-fish.com/api/maimaidxprober/query/plate"""'], {'json': 'payload'}), "('POST',\n 'https://www.diving-fish.com/api/maimaidxprober/query/plate', json=payload)\n", (817, 905), False, 'import aiohttp\n')] |
import os
import re
import time
import numpy as np
from msedge.selenium_tools import EdgeOptions, Edge
from selenium.webdriver.common.action_chains import ActionChains
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36 Edg/8... | [
"msedge.selenium_tools.EdgeOptions",
"time.sleep",
"os.getcwd",
"selenium.webdriver.common.action_chains.ActionChains",
"re.findall"
] | [((541, 554), 'msedge.selenium_tools.EdgeOptions', 'EdgeOptions', ([], {}), '()\n', (552, 554), False, 'from msedge.selenium_tools import EdgeOptions, Edge\n'), ((380, 391), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (389, 391), False, 'import os\n'), ((811, 822), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (820, 822)... |
import pixiedust
my_logger = pixiedust.getLogger(__name__)
| [
"pixiedust.getLogger"
] | [((29, 58), 'pixiedust.getLogger', 'pixiedust.getLogger', (['__name__'], {}), '(__name__)\n', (48, 58), False, 'import pixiedust\n')] |
# Generated by Django 2.1.11 on 2020-06-04 09:19
from django.db import migrations, models
def fix_period_before_after(apps, schema_editor):
# noinspection PyPep8Naming
Form = apps.get_model("iaso", "Form")
for form in Form.objects.filter(period_type=None).exclude(periods_before_allowed=0, periods_after_... | [
"django.db.migrations.RunPython",
"django.db.models.TextField",
"django.db.models.IntegerField"
] | [((1119, 1209), 'django.db.migrations.RunPython', 'migrations.RunPython', (['fix_period_before_after'], {'reverse_code': 'migrations.RunPython.noop'}), '(fix_period_before_after, reverse_code=migrations.\n RunPython.noop)\n', (1139, 1209), False, 'from django.db import migrations, models\n'), ((659, 802), 'django.db... |
from hca.dss import DSSClient
dss = DSSClient()
dss.logout()
| [
"hca.dss.DSSClient"
] | [((37, 48), 'hca.dss.DSSClient', 'DSSClient', ([], {}), '()\n', (46, 48), False, 'from hca.dss import DSSClient\n')] |
import sys
import os
import os.path
import random
from pathlib import Path
import torch
import torchaudio
from .audiodataset import AUDIO_EXTENSIONS, default_loader
from ..dataset import PureDatasetFolder, has_file_allowed_extension
class TAU2019(PureDatasetFolder):
"""TAU urban acoustic scene 2019 dataset.
... | [
"os.path.join",
"os.path.split",
"os.path.isdir",
"sys.stdout.flush",
"os.path.expanduser",
"sys.stdout.write"
] | [((2934, 2956), 'sys.stdout.write', 'sys.stdout.write', (['"""\n"""'], {}), "('\\n')\n", (2950, 2956), False, 'import sys\n'), ((3443, 3472), 'os.path.expanduser', 'os.path.expanduser', (['directory'], {}), '(directory)\n', (3461, 3472), False, 'import os\n'), ((2592, 2610), 'sys.stdout.flush', 'sys.stdout.flush', ([],... |
import os
import torch
import hashlib
from collections import OrderedDict
from util.env import env_factory, eval_policy
from util.logo import print_logo
if __name__ == "__main__":
import sys, argparse, time, os
parser = argparse.ArgumentParser()
parser.add_argument("--nolog", action='store_true')
print... | [
"argparse.ArgumentParser",
"util.env.eval_policy",
"torch.load",
"sys.argv.remove",
"algos.off_policy.run_experiment",
"util.logo.print_logo",
"cassie.udp.run_udp"
] | [((227, 252), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (250, 252), False, 'import sys, argparse, time, os\n'), ((315, 384), 'util.logo.print_logo', 'print_logo', ([], {'subtitle': '"""Recurrent Reinforcement Learning for Robotics."""'}), "(subtitle='Recurrent Reinforcement Learning for Ro... |
import read_data as RD
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
X = RD.read_data()
print('X = ',X.shape)
X_mean = np.reshape(np.sum(X,1)/X.shape[1],[ X.shape[0],1])
X = X-X_mean
print('X_centerred = ',X.shape)
[U,S,V] = np.linalg.svd(X, full_matrices=False)
print('U = ',U.shape)
print('... | [
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.savefig",
"numpy.reshape",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"numpy.arange",
"numpy.sqrt",
"matplotlib.pyplot.xlabel",
"numpy.sum",
"matplotlib.pyplot.figure",
"read_data.read_data",
"matplotlib.pyplot.yticks",
"numpy.matmu... | [((101, 115), 'read_data.read_data', 'RD.read_data', ([], {}), '()\n', (113, 115), True, 'import read_data as RD\n'), ((253, 290), 'numpy.linalg.svd', 'np.linalg.svd', (['X'], {'full_matrices': '(False)'}), '(X, full_matrices=False)\n', (266, 290), True, 'import numpy as np\n'), ((406, 434), 'matplotlib.pyplot.figure',... |
from django.db import models
from manager_utils import ManagerUtilsQuerySet, ManagerUtilsManager
from activatable_model.signals import model_activations_changed
class ActivatableQuerySet(ManagerUtilsQuerySet):
"""
Provides bulk activation/deactivation methods.
"""
def update(self, *args, **kwargs):
... | [
"activatable_model.signals.model_activations_changed.send"
] | [((986, 1121), 'activatable_model.signals.model_activations_changed.send', 'model_activations_changed.send', (['self.model'], {'instance_ids': 'updated_instance_ids', 'is_active': 'kwargs[self.model.ACTIVATABLE_FIELD_NAME]'}), '(self.model, instance_ids=\n updated_instance_ids, is_active=kwargs[self.model.ACTIVATABL... |
# my_lambdata/my_mod.py
# my_lambdata.my_mod
import pandas as pd
def enlarge(num):
return num * 100
def null_check(df):
null_lines = df[df.isnull().any(axis=1)]
return null_lines
def date_divider(df,date_col):
'''
df: the whole dataframe adding new day, month, year to
date_col: the name of the c... | [
"pandas.DatetimeIndex"
] | [((409, 449), 'pandas.DatetimeIndex', 'pd.DatetimeIndex', (['converted_df[date_col]'], {}), '(converted_df[date_col])\n', (425, 449), True, 'import pandas as pd\n'), ((482, 522), 'pandas.DatetimeIndex', 'pd.DatetimeIndex', (['converted_df[date_col]'], {}), '(converted_df[date_col])\n', (498, 522), True, 'import pandas ... |
import sys
sys.path.append('./')
import os
import pandas as pd
from vtkplotter import load
from brainrender import DEFAULT_STRUCTURE_COLOR
def get_rat_regions_metadata(metadata_fld):
"""
:param metadata_fld:
"""
return pd.read_pickle(os.path.join(metadata_fld, "rat_structures.pkl"))
def get_rat_... | [
"os.path.join",
"sys.path.append",
"vtkplotter.load",
"os.path.isfile"
] | [((11, 32), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (26, 32), False, 'import sys\n'), ((257, 305), 'os.path.join', 'os.path.join', (['metadata_fld', '"""rat_structures.pkl"""'], {}), "(metadata_fld, 'rat_structures.pkl')\n", (269, 305), False, 'import os\n'), ((2015, 2048), 'vtkplotter.loa... |
import pandas as pd
from melusine.prepare_email.mail_segmenting import structure_email, tag_signature
structured_historic = [
{
"text": " \n \n \n Bonjours, \n \n Suite a notre conversation \
téléphonique de Mardi , pourriez vous me dire la \n somme que je vous \
dois afin d'd'être en régularisat... | [
"pandas.DataFrame",
"pandas.Series",
"pandas.testing.assert_series_equal"
] | [((2304, 2364), 'pandas.DataFrame', 'pd.DataFrame', (["{'structured_historic': [structured_historic]}"], {}), "({'structured_historic': [structured_historic]})\n", (2316, 2364), True, 'import pandas as pd\n'), ((2384, 2403), 'pandas.Series', 'pd.Series', (['[output]'], {}), '([output])\n', (2393, 2403), True, 'import p... |
"""
===================================
Merging two instances in the design
===================================
This example demonstrate how to merge two instance in the design to create a new
merged definition
.. hdl-diagram:: ../../../examples/basic/_initial_design_merge.v
:type: netlistsvg
:align: center
... | [
"logging.getLogger",
"spydrnet.compose",
"spydrnet_physical.load_netlist_by_name",
"spydrnet.enable_file_logging"
] | [((594, 628), 'logging.getLogger', 'logging.getLogger', (['"""spydrnet_logs"""'], {}), "('spydrnet_logs')\n", (611, 628), False, 'import logging\n'), ((629, 670), 'spydrnet.enable_file_logging', 'sdn.enable_file_logging', ([], {'LOG_LEVEL': '"""INFO"""'}), "(LOG_LEVEL='INFO')\n", (652, 670), True, 'import spydrnet as s... |
import praw
import re
import os
reddit = praw.Reddit('Splunge Bot v1', client_id=os.environ['REDDIT_CLIENT_ID'], client_secret=os.environ['REDDIT_CLIENT_SECRET'], password=os.environ['REDDIT_PASSWORD'], username=os.environ['REDDIT_USERNAME'])
subreddit = reddit.subreddit('tubasaur')
for submission in subreddit.new(lim... | [
"praw.Reddit",
"re.search"
] | [((42, 252), 'praw.Reddit', 'praw.Reddit', (['"""Splunge Bot v1"""'], {'client_id': "os.environ['REDDIT_CLIENT_ID']", 'client_secret': "os.environ['REDDIT_CLIENT_SECRET']", 'password': "os.environ['REDDIT_PASSWORD']", 'username': "os.environ['REDDIT_USERNAME']"}), "('Splunge Bot v1', client_id=os.environ['REDDIT_CLIENT... |
import discord
from discord import embeds
from discord.ext import commands
from discord.ext.commands.core import command
from pymongo import MongoClient, collation
from discord_components import Button, Select, SelectOption, ComponentsBot
from discord.utils import get
class managecommands(commands.Cog):
def __ini... | [
"discord.ext.commands.has_permissions",
"discord_components.SelectOption",
"discord.utils.get",
"discord_components.Select",
"pymongo.MongoClient",
"discord.Embed",
"discord.ext.commands.command"
] | [((395, 430), 'discord.ext.commands.command', 'commands.command', ([], {'pass_context': '(True)'}), '(pass_context=True)\n', (411, 430), False, 'from discord.ext import commands\n'), ((436, 479), 'discord.ext.commands.has_permissions', 'commands.has_permissions', ([], {'manage_guild': '(True)'}), '(manage_guild=True)\n... |
import unittest
import mock
from src.api.resources import log
from tests import LOGS_PATH
class TestLogListResource(unittest.TestCase):
def setUp(self):
self.class_ = log.LogListResource()
def test_post_with_file_that_exits(self):
class FakeRequest:
@staticmethod
def ... | [
"unittest.main",
"src.api.resources.log.LogListResource",
"mock.patch"
] | [((1095, 1110), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1108, 1110), False, 'import unittest\n'), ((182, 203), 'src.api.resources.log.LogListResource', 'log.LogListResource', ([], {}), '()\n', (201, 203), False, 'from src.api.resources import log\n'), ((394, 456), 'mock.patch', 'mock.patch', (['"""src.api.... |
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, <NAME>, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyri... | [
"threading.Thread.__init__"
] | [((1924, 1955), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {}), '(self)\n', (1949, 1955), False, 'import threading\n')] |
import json
import regex
import nltk.data
from nltk.tokenize import word_tokenize
import sys
sent_detector = nltk.data.load('tokenizers/punkt/english.pickle')
def tokenize(string):
return word_tokenize(string)
def split_paragraphs(text):
"""
remove urls, lowercase all words and separate paragraphs
""... | [
"json.dumps",
"json.loads",
"regex.split",
"nltk.tokenize.word_tokenize"
] | [((194, 215), 'nltk.tokenize.word_tokenize', 'word_tokenize', (['string'], {}), '(string)\n', (207, 215), False, 'from nltk.tokenize import word_tokenize\n'), ((335, 360), 'regex.split', 'regex.split', (['"""\\\\n+"""', 'text'], {}), "('\\\\n+', text)\n", (346, 360), False, 'import regex\n'), ((695, 724), 'regex.split'... |
from helpers.concurrency import execute
from scaleapi import exceptions
def upsert(client, project_name, batches):
print("\n\nCreating Batches...")
print("===================")
def upsert_batch(desired_batch):
batch_name = desired_batch['name']
batch_callback_url = desired_batch['callbac... | [
"helpers.concurrency.execute"
] | [((1458, 1499), 'helpers.concurrency.execute', 'execute', (['upsert_batch', "batches['batches']"], {}), "(upsert_batch, batches['batches'])\n", (1465, 1499), False, 'from helpers.concurrency import execute\n'), ((2217, 2260), 'helpers.concurrency.execute', 'execute', (['finalize_batch', "batches['batches']"], {}), "(fi... |
from zzcore import StdAns, mysakuya
import requests
class Ans(StdAns):
def GETMSG(self):
msg=''
try:
msg += xs()
except:
msg += '可能是机器人笑死了!'
return msg
def xs():
url = "http://api-x.aya1.xyz:6/"
text = requests.get(url=url).text
return text
| [
"requests.get"
] | [((272, 293), 'requests.get', 'requests.get', ([], {'url': 'url'}), '(url=url)\n', (284, 293), False, 'import requests\n')] |
import copy
import datetime
import importlib
import logging
import operator
import re
from calendar import different_locale
import translations
from data_source.game_data import GameData
from game_constants import COLORS, EVENT_TYPES, RARITY_COLORS, SOULFORGE_REQUIREMENTS, TROOP_RARITIES, \
UNDERWORLD_SOULFORGE_RE... | [
"logging.getLogger",
"logging.StreamHandler",
"re.compile",
"game_constants.TROOP_RARITIES.index",
"util.dig",
"game_constants.RARITY_COLORS.values",
"translations.Translations",
"copy.deepcopy",
"operator.itemgetter",
"datetime.timedelta",
"translations.LOCALE_MAPPING.get",
"util.extract_sear... | [((542, 605), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)-15s [%(levelname)s] %(message)s"""'], {}), "('%(asctime)-15s [%(levelname)s] %(message)s')\n", (559, 605), False, 'import logging\n'), ((616, 639), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (637, 639), False, 'import logg... |
import math
from numpy import linalg
from scipy import stats
from scipy.spatial import distance
import numpy
def euclidean(p, Q):
return numpy.apply_along_axis(lambda q: linalg.norm(p - q), 0, Q)
def hellinger(p, Q):
factor = 1 / math.sqrt(2)
sqrt_p = numpy.sqrt(p)
return factor * numpy.apply_along... | [
"scipy.stats.entropy",
"numpy.sqrt",
"math.sqrt",
"numpy.square",
"numpy.linalg.norm",
"scipy.spatial.distance.jensenshannon"
] | [((269, 282), 'numpy.sqrt', 'numpy.sqrt', (['p'], {}), '(p)\n', (279, 282), False, 'import numpy\n'), ((243, 255), 'math.sqrt', 'math.sqrt', (['(2)'], {}), '(2)\n', (252, 255), False, 'import math\n'), ((177, 195), 'numpy.linalg.norm', 'linalg.norm', (['(p - q)'], {}), '(p - q)\n', (188, 195), False, 'from numpy import... |
import json
import math
from dataclasses import dataclass
from datetime import timedelta
from enum import Enum
from pathlib import Path
from typing import List, Optional
import numpy as np
from vad.util.time_utils import (
format_timedelta_to_milliseconds,
format_timedelta_to_timecode,
parse_timecode_to_t... | [
"vad.util.time_utils.parse_timecode_to_timedelta",
"vad.util.time_utils.format_timedelta_to_milliseconds",
"numpy.zeros",
"json.load",
"datetime.timedelta",
"json.dump",
"vad.util.time_utils.format_timedelta_to_timecode"
] | [((10019, 10057), 'numpy.zeros', 'np.zeros', (['total_samples'], {'dtype': 'np.long'}), '(total_samples, dtype=np.long)\n', (10027, 10057), True, 'import numpy as np\n'), ((863, 878), 'json.load', 'json.load', (['file'], {}), '(file)\n', (872, 878), False, 'import json\n'), ((4223, 4289), 'json.dump', 'json.dump', (['v... |
import sys
import urllib.parse as urlparse
print("Argumentos recibidos por STDIN: ")
try:
for line in sys.stdin:
url = 'foo.com/?' + line
parsed = urlparse.urlparse(url)
print('Recibido: {}'.format(urlparse.parse_qs(parsed.query)))
except:
ignorar = True
| [
"urllib.parse.parse_qs",
"urllib.parse.urlparse"
] | [((177, 199), 'urllib.parse.urlparse', 'urlparse.urlparse', (['url'], {}), '(url)\n', (194, 199), True, 'import urllib.parse as urlparse\n'), ((239, 270), 'urllib.parse.parse_qs', 'urlparse.parse_qs', (['parsed.query'], {}), '(parsed.query)\n', (256, 270), True, 'import urllib.parse as urlparse\n')] |
# -------------------------------------------------------------------
# Copyright 2021 Virtex authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.... | [
"virtex.core.timing.async_now",
"asyncio.iscoroutinefunction",
"functools.wraps",
"virtex.core.timing.now"
] | [((1475, 1486), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (1480, 1486), False, 'from functools import wraps\n'), ((1767, 1778), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (1772, 1778), False, 'from functools import wraps\n'), ((2023, 2056), 'asyncio.iscoroutinefunction', 'asyncio.iscoroutinef... |
# coding = utf-8
from abc import ABCMeta, abstractmethod
import torch
from Putil.torch.indicator.vision.object_detection import box
##@brief 计算iou
# @note
# @return
def _iou(x11, y11, x12, y12, x21, y21, x22, y22):
cap, cup = box._cap_cup(x11, y11, x12, y12, x21, y21, x22, y22)
return cap / cup
def _cap_cup_... | [
"Putil.torch.indicator.vision.object_detection.box._cap_cup",
"Putil.torch.indicator.vision.object_detection.box._tlwh_to_tlbr",
"torch.nansum",
"torch.isnan",
"torch.nn.Module.__init__",
"Putil.torch.indicator.vision.object_detection.box._to_xyxy"
] | [((232, 284), 'Putil.torch.indicator.vision.object_detection.box._cap_cup', 'box._cap_cup', (['x11', 'y11', 'x12', 'y12', 'x21', 'y21', 'x22', 'y22'], {}), '(x11, y11, x12, y12, x21, y21, x22, y22)\n', (244, 284), False, 'from Putil.torch.indicator.vision.object_detection import box\n'), ((652, 682), 'torch.nn.Module._... |
# today is 389f
# the python pit
# magPi - 05
# MOUNTAINS
import os, pygame; from pygame.locals import *
pygame.init(); clock = pygame.time.Clock()
os.environ['SDL_VIDEO_WINDOW_POS'] = 'center'
pygame.display.set_caption("Mountains")
screen=pygame.display.set_mode([600,382],0,32)
sky = pygame.Surface((600,255))
r=0;... | [
"pygame.draw.polygon",
"pygame.init",
"pygame.Surface",
"pygame.time.wait",
"pygame.display.set_mode",
"pygame.time.Clock",
"pygame.draw.rect",
"pygame.display.set_caption",
"pygame.display.update"
] | [((107, 120), 'pygame.init', 'pygame.init', ([], {}), '()\n', (118, 120), False, 'import os, pygame\n'), ((130, 149), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (147, 149), False, 'import os, pygame\n'), ((196, 235), 'pygame.display.set_caption', 'pygame.display.set_caption', (['"""Mountains"""'], {}),... |
"""
Handles reports
"""
from parkour.env import env
from parkour.utils import normalize_name
import asyncio
import aiotfm
import time
class Reports(aiotfm.Client):
def __init__(self, *args, **kwargs):
self.rep_id = 0
self.reports = {}
self.reported = []
self.reporters = []
super().__init__(*args, **kwarg... | [
"parkour.utils.normalize_name",
"time.time",
"asyncio.sleep"
] | [((1546, 1557), 'time.time', 'time.time', ([], {}), '()\n', (1555, 1557), False, 'import time\n'), ((493, 504), 'time.time', 'time.time', ([], {}), '()\n', (502, 504), False, 'import time\n'), ((3432, 3455), 'parkour.utils.normalize_name', 'normalize_name', (['args[0]'], {}), '(args[0])\n', (3446, 3455), False, 'from p... |
from joblib import load
from os.path import join
import argparse
import numpy as np
import matplotlib.pyplot as plt
from mvmm_sim.simulation.sim_viz import save_fig
from mvmm_sim.data_analysis.utils import load_data
from mvmm_sim.simulation.utils import make_and_get_dir
from mvmm_sim.mouse_et.MouseETPaths import Mous... | [
"mvmm_sim.mouse_et.raw_ephys_loading.load_raw_ephys",
"mvmm_sim.simulation.utils.make_and_get_dir",
"mvmm_sim.mouse_et.ephys_viz.plot_cluster_ephys_curve",
"mvmm_sim.data_analysis.utils.load_data",
"argparse.ArgumentParser",
"mvmm_sim.mouse_et.MouseETPaths.MouseETPaths",
"os.path.join",
"mvmm_sim.mous... | [((523, 585), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Cluster interpretation."""'}), "(description='Cluster interpretation.')\n", (546, 585), False, 'import argparse\n'), ((915, 949), 'os.path.join', 'join', (['results_dir', '"""model_fitting"""'], {}), "(results_dir, 'model_fitti... |
#!/usr/bin/env python
# Copyright (c) 2009-2016 <NAME> <<EMAIL>>
#
# This module is free software. You can redistribute it and/or modify it under
# the terms of the MIT License, see the file COPYING included with this
# distribution.
from __future__ import print_function
from gimmemotifs.comparison import MotifCompa... | [
"gimmemotifs.motif.pwmfile_to_motifs",
"gimmemotifs.motif.Motif",
"gimmemotifs.comparison.MotifComparer",
"gimmemotifs.plot.match_plot"
] | [((590, 605), 'gimmemotifs.comparison.MotifComparer', 'MotifComparer', ([], {}), '()\n', (603, 605), False, 'from gimmemotifs.comparison import MotifComparer\n'), ((1766, 1796), 'gimmemotifs.plot.match_plot', 'match_plot', (['plotdata', 'args.img'], {}), '(plotdata, args.img)\n', (1776, 1796), False, 'from gimmemotifs.... |
# -*- coding: utf-8 -*-
"""
Created on 2017-4-25
@author: cheng.li
"""
import datetime as dt
import numpy as np
from sklearn.linear_model import LinearRegression
from alphamind.data.neutralize import neutralize
def benchmark_neutralize(n_samples: int, n_features: int, n_loops: int) -> None:
pr... | [
"numpy.testing.assert_array_almost_equal",
"alphamind.data.neutralize.neutralize",
"datetime.datetime.now",
"numpy.random.randint",
"numpy.random.randn",
"sklearn.linear_model.LinearRegression"
] | [((591, 620), 'numpy.random.randn', 'np.random.randn', (['n_samples', '(5)'], {}), '(n_samples, 5)\n', (606, 620), True, 'import numpy as np\n'), ((630, 668), 'numpy.random.randn', 'np.random.randn', (['n_samples', 'n_features'], {}), '(n_samples, n_features)\n', (645, 668), True, 'import numpy as np\n'), ((684, 701), ... |
from __future__ import annotations
from math import log
from typing import List, Type, Union
from imm import MuteState, Sequence, lprob_add, lprob_zero
from nmm import (
AminoAlphabet,
AminoLprob,
BaseLprob,
CodonLprob,
CodonMarg,
DNAAlphabet,
FrameState,
RNAAlphabet,
codon_iter,
)... | [
"nmm.CodonLprob.create",
"nmm.BaseLprob.create",
"imm.MuteState.create",
"imm.Sequence.create",
"math.log",
"nmm.AminoLprob.create",
"nmm.codon_iter",
"nmm.FrameState.create",
"nmm.CodonMarg.create",
"imm.lprob_add",
"imm.lprob_zero"
] | [((6106, 6147), 'nmm.AminoLprob.create', 'AminoLprob.create', (['amino_abc', 'null_lprobs'], {}), '(amino_abc, null_lprobs)\n', (6123, 6147), False, 'from nmm import AminoAlphabet, AminoLprob, BaseLprob, CodonLprob, CodonMarg, DNAAlphabet, FrameState, RNAAlphabet, codon_iter\n'), ((7728, 7734), 'math.log', 'log', (['(3... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Description
"""
import torch
from ptranking.ltr_global import global_gpu as gpu
def get_one_hot_reprs(batch_stds):
""" Get one-hot representation of batch ground-truth labels """
batch_size = batch_stds.size(0)
hist_size = batch_stds.size(1)
int_batch... | [
"torch.unsqueeze",
"torch.cuda.FloatTensor",
"torch.FloatTensor"
] | [((435, 483), 'torch.cuda.FloatTensor', 'torch.cuda.FloatTensor', (['batch_size', 'hist_size', '(3)'], {}), '(batch_size, hist_size, 3)\n', (457, 483), False, 'import torch\n'), ((496, 539), 'torch.FloatTensor', 'torch.FloatTensor', (['batch_size', 'hist_size', '(3)'], {}), '(batch_size, hist_size, 3)\n', (513, 539), F... |
from ..utils import run
import logging
logger = logging.getLogger(__name__)
def process_one_package(path, package, python_version="3"):
"""Get details about one precise python package in the given image.
:param path: path were the docker image filesystem is expanded.
:type path: string
:param pa... | [
"logging.getLogger"
] | [((49, 76), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (66, 76), False, 'import logging\n')] |
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponse, JsonResponse
from django.views.generic.base import View
from django.contrib.auth.mixins import LoginRequiredMixin
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import ... | [
"backend.courses.api_views.CompletedTasks",
"backend.courses.models.RealizationTask.objects.get",
"backend.courses.models.Course.objects.get",
"django.http.JsonResponse"
] | [((1717, 1758), 'django.http.JsonResponse', 'JsonResponse', (['serializer.data'], {'safe': '(False)'}), '(serializer.data, safe=False)\n', (1729, 1758), False, 'from django.http import HttpResponse, JsonResponse\n'), ((4423, 4671), 'django.http.JsonResponse', 'JsonResponse', (["{'task': {'exists': task_exists, 'success... |
# 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, software
# d... | [
"tempest.lib.services.placement.resource_providers_client.ResourceProvidersClient",
"tempest.tests.lib.fake_auth_provider.FakeAuthProvider"
] | [((2962, 2999), 'tempest.tests.lib.fake_auth_provider.FakeAuthProvider', 'fake_auth_provider.FakeAuthProvider', ([], {}), '()\n', (2997, 2999), False, 'from tempest.tests.lib import fake_auth_provider\n'), ((3022, 3112), 'tempest.lib.services.placement.resource_providers_client.ResourceProvidersClient', 'resource_provi... |
from problems import utils, mymath
@utils.memoize
def sum_proper_factors(n):
return sum(mymath.proper_factorization(n))
def solve():
upper_bound = 1000000
chains = dict()
for start_number in range(1, upper_bound):
chain = [start_number]
current_number = sum_proper_factors(start_num... | [
"problems.mymath.proper_factorization",
"problems.mymath.key_of_max_value"
] | [((881, 919), 'problems.mymath.key_of_max_value', 'mymath.key_of_max_value', (['chain_lengths'], {}), '(chain_lengths)\n', (904, 919), False, 'from problems import utils, mymath\n'), ((94, 124), 'problems.mymath.proper_factorization', 'mymath.proper_factorization', (['n'], {}), '(n)\n', (121, 124), False, 'from problem... |
import logging
from django.utils import timezone
from typing import Union
from .exceptions import InvalidTrustchain, TrustchainMissingMetadata
from .models import FetchedEntityStatement, TrustChain
from .statements import EntityConfiguration, get_entity_configurations
from .settings import HTTPC_PARAMS
from .trust_ch... | [
"logging.getLogger",
"django.utils.timezone.localtime"
] | [((402, 429), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (419, 429), False, 'import logging\n'), ((5925, 5945), 'django.utils.timezone.localtime', 'timezone.localtime', ([], {}), '()\n', (5943, 5945), False, 'from django.utils import timezone\n')] |
##########################################################################
# Copyright (c) 2009, ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092... | [
"results.PassFailMultiResult"
] | [((949, 987), 'results.PassFailMultiResult', 'PassFailMultiResult', (['self.name', 'errors'], {}), '(self.name, errors)\n', (968, 987), False, 'from results import PassFailMultiResult\n')] |
import requests
from requests.exceptions import HTTPError
import time
class APIBase:
"""
This class is to be used as a base to build an API library.
Authorization token generation and endpoint functions must be written
"""
def __init__(self, root, proxies=None, requests_session=True, max_retries... | [
"requests.Session",
"time.sleep"
] | [((1113, 1131), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1129, 1131), False, 'import requests\n'), ((3310, 3331), 'time.sleep', 'time.sleep', (['(delay + 1)'], {}), '(delay + 1)\n', (3320, 3331), False, 'import time\n'), ((2981, 3002), 'time.sleep', 'time.sleep', (['(delay + 1)'], {}), '(delay + 1)\n'... |
# Copyright (C) 2011-2020 Airbus, <EMAIL>
containers = { 'ELF': 'X86_64', 'MACHO': 'X86_64' }
try:
from plasmasm.python.compatibility import set
except ImportError:
pass
from plasmasm.arch.I386 import opcodes as opcodes_x86
x64_att_opcodes = set([
'jmpq', 'callq', 'retq', 'popq', 'pushq',
'movq'... | [
"plasmasm.python.compatibility.set"
] | [((250, 779), 'plasmasm.python.compatibility.set', 'set', (["['jmpq', 'callq', 'retq', 'popq', 'pushq', 'movq', 'cmpq', 'testq', 'leaq',\n 'btq', 'bswapq', 'notq', 'orq', 'xorq', 'andq', 'bsfq', 'bslq', 'bsrq',\n 'rolq', 'rorq', 'sarq', 'salq', 'shrq', 'shlq', 'sbbq', 'negq', 'decq',\n 'incq', 'adcq', 'addq', ... |
# Generated by Django 3.1.5 on 2021-01-25 16:24
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0002_auto_20210124_0610'),
]
operations = [
migrations.RenameModel(
old_name='Parent',
new_name='Account',
),... | [
"django.db.migrations.RenameModel"
] | [((223, 284), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""Parent"""', 'new_name': '"""Account"""'}), "(old_name='Parent', new_name='Account')\n", (245, 284), False, 'from django.db import migrations\n')] |
#!/usr/bin/python3
import threading
import time
import base64
from lynkco_app_request import lynkco_app_request
from com.uestcit.api.gateway.sdk.auth.aes import aes as AES
from sms_request import sms_request
import json
import sys
import os
import re
class lynco_regist_wrok(threading.Thread):
"""新开线程处理任务"""
d... | [
"threading.Thread.__init__",
"re.compile",
"time.strftime",
"json.dumps",
"base64.b64decode",
"time.sleep",
"com.uestcit.api.gateway.sdk.auth.aes.aes",
"sms_request.sms_request",
"lynkco_app_request.lynkco_app_request"
] | [((371, 402), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {}), '(self)\n', (396, 402), False, 'import threading\n'), ((611, 624), 'sms_request.sms_request', 'sms_request', ([], {}), '()\n', (622, 624), False, 'from sms_request import sms_request\n'), ((1113, 1130), 'com.uestcit.api.gateway.sdk.... |
# Author: <NAME> <<EMAIL>>
# A core-attachment based method to detect protein complexes in PPI networks
# <NAME>, Kwoh, Ng (2009)
# http://www.biomedcentral.com/1471-2105/10/169
from collections import defaultdict
from itertools import combinations
import functools
# return average degree and density for a graph
de... | [
"functools.reduce",
"collections.defaultdict"
] | [((2492, 2508), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (2503, 2508), False, 'from collections import defaultdict\n'), ((5261, 5323), 'functools.reduce', 'functools.reduce', (['(lambda x, y: x | y)', '(data[v] for v in nodes)'], {}), '(lambda x, y: x | y, (data[v] for v in nodes))\n', (5277,... |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from common.constants import DEFAULT_QUEUE
from common.waterfall import failure_type
from gae_libs.pipeline_wrapper import pipeline_handlers
from waterfall i... | [
"waterfall.revert_and_notify_culprit_pipeline.RevertAndNotifyCulpritPipeline"
] | [((1383, 1497), 'waterfall.revert_and_notify_culprit_pipeline.RevertAndNotifyCulpritPipeline', 'RevertAndNotifyCulpritPipeline', (['master_name', 'builder_name', 'build_number', 'culprits', 'heuristic_cls', 'try_job_type'], {}), '(master_name, builder_name, build_number,\n culprits, heuristic_cls, try_job_type)\n', ... |
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn import functional as F
import numpy as np
class LSTM(nn.Module):
def __init__(self, embedding_matrix, embedding_dim, vocab_size, hidden_dim, dropout, num_layers, bidirectional, output_dim):
"""
Args:
... | [
"torch.nn.LSTM",
"torch.tensor",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.Embedding"
] | [((991, 1030), 'torch.nn.Embedding', 'nn.Embedding', (['vocab_size', 'embedding_dim'], {}), '(vocab_size, embedding_dim)\n', (1003, 1030), True, 'import torch.nn as nn\n'), ((1532, 1590), 'torch.nn.Linear', 'nn.Linear', ([], {'in_features': 'hidden_dim', 'out_features': 'output_dim'}), '(in_features=hidden_dim, out_fea... |
from django.core.urlresolvers import resolve
from django.shortcuts import render,redirect,HttpResponse
from kingadmin.permission_list import perm_dic
from django.conf import settings
def perm_check(*args,**kwargs):
request = args[0]
resolve_url_obj = resolve(request.path)
current_url_name = resolve_url_o... | [
"django.shortcuts.render",
"django.core.urlresolvers.resolve",
"django.shortcuts.redirect",
"kingadmin.permission_list.perm_dic.items"
] | [((262, 283), 'django.core.urlresolvers.resolve', 'resolve', (['request.path'], {}), '(request.path)\n', (269, 283), False, 'from django.core.urlresolvers import resolve\n'), ((644, 660), 'kingadmin.permission_list.perm_dic.items', 'perm_dic.items', ([], {}), '()\n', (658, 660), False, 'from kingadmin.permission_list i... |
#!/usr/bin/env python3
from time import sleep
import logging
import os
import subprocess
print("Nebra ECC Tool")
preTestFail = 0
afterTestFail = 0
ECC_SUCCESSFUL_TOUCH_FILEPATH = "/var/data/gwmfr_ecc_provisioned"
logging.basicConfig(level=os.environ.get("LOGLEVEL", "DEBUG"))
def record_successful_provision():
... | [
"logging.debug",
"os.getenv",
"subprocess.run",
"os.environ.get",
"time.sleep"
] | [((2556, 2594), 'os.getenv', 'os.getenv', (['"""OVERRIDE_GWMFR_EXIT"""', 'None'], {}), "('OVERRIDE_GWMFR_EXIT', None)\n", (2565, 2594), False, 'import os\n'), ((321, 363), 'logging.debug', 'logging.debug', (['"""ECC provisioning complete"""'], {}), "('ECC provisioning complete')\n", (334, 363), False, 'import logging\n... |
#!/usr/bin/env python3
""" Simple example/demo of the unlinkable DP-3T design
This demo simulates some interactions between two phones,
represented by the contact tracing modules, and then runs
contact tracing.
"""
__copyright__ = """
Copyright 2020 EPFL
Licensed under the Apache License, Version 2.0 (the "... | [
"datetime.timedelta",
"dp3t.protocols.unlinkable.ContactTracer",
"dp3t.protocols.unlinkable.TracingDataBatch"
] | [((2289, 2304), 'dp3t.protocols.unlinkable.ContactTracer', 'ContactTracer', ([], {}), '()\n', (2302, 2304), False, 'from dp3t.protocols.unlinkable import ContactTracer, TracingDataBatch\n'), ((2315, 2330), 'dp3t.protocols.unlinkable.ContactTracer', 'ContactTracer', ([], {}), '()\n', (2328, 2330), False, 'from dp3t.prot... |
from django.urls import reverse
from rest_framework import status
from rest_framework.test import force_authenticate
from rest_framework_simplejwt.state import User
from core.views import DeactivateSelfAPIView, BecomeCommercialAPIView
from tests.unittests.common import APIFactoryTestCase
class BecomeCommercialAPITes... | [
"rest_framework.test.force_authenticate",
"core.views.BecomeCommercialAPIView.as_view",
"rest_framework_simplejwt.state.User.objects.get",
"django.urls.reverse"
] | [((454, 487), 'core.views.BecomeCommercialAPIView.as_view', 'BecomeCommercialAPIView.as_view', ([], {}), '()\n', (485, 487), False, 'from core.views import DeactivateSelfAPIView, BecomeCommercialAPIView\n'), ((508, 541), 'rest_framework_simplejwt.state.User.objects.get', 'User.objects.get', ([], {'username': '"""User""... |
# Comment
import pandas as pd
import re
from google.cloud import storage
from pathlib import Path
def load_data(filename, chunksize=10000):
good_columns = [
'created_at',
'entities',
'favorite_count',
'full_text',
'id_str',
'in_reply_to_screen_name',
'in_rep... | [
"google.cloud.storage.Client",
"re.compile",
"pathlib.Path.cwd",
"pandas.concat",
"pandas.read_json"
] | [((529, 674), 'pandas.read_json', 'pd.read_json', (['filename'], {'lines': '(True)', 'chunksize': 'chunksize', 'dtype': "{'id_str': str, 'in_reply_to_status_id_str': str, 'quoted_status_id_str': str}"}), "(filename, lines=True, chunksize=chunksize, dtype={'id_str':\n str, 'in_reply_to_status_id_str': str, 'quoted_st... |
import os
import glob
import torch
import numpy as np
# from PIL import Image, UnidentifiedImageError
from torch.utils.data import Dataset
from torchvision.datasets import MNIST
class ToyDataset(Dataset):
def __init__(self, N_K=50, K=4, X=None, Y=None):
super().__init__()
if X is not None:
self.data,... | [
"torch.ones_like",
"torch.randperm",
"torch.Tensor",
"torch.zeros_like",
"torch.Size",
"torch.randn",
"torch.cat"
] | [((1207, 1241), 'torch.cat', 'torch.cat', (['[X1, X2, X3, X4]'], {'dim': '(0)'}), '([X1, X2, X3, X4], dim=0)\n', (1216, 1241), False, 'import torch\n'), ((1287, 1314), 'torch.cat', 'torch.cat', (['[Y1, Y2, Y3, Y4]'], {}), '([Y1, Y2, Y3, Y4])\n', (1296, 1314), False, 'import torch\n'), ((1136, 1153), 'torch.Size', 'torc... |
from django.shortcuts import render, HttpResponse
from django.views.generic.list import ListView
from django.views.generic.edit import UpdateView, DeleteView, CreateView
from . models import OuverTimeRecord
from django.contrib.auth.models import User
from django.urls import reverse_lazy
from django.views import View
im... | [
"xhtml2pdf.pisa.CreatePDF",
"django.shortcuts.HttpResponse",
"xlwt.XFStyle",
"csv.writer",
"io.BytesIO",
"django.urls.reverse_lazy",
"reportlab.pdfgen.canvas.Canvas",
"xlwt.Workbook",
"django.template.loader.get_template"
] | [((603, 621), 'django.shortcuts.HttpResponse', 'HttpResponse', (['"""ok"""'], {}), "('ok')\n", (615, 621), False, 'from django.shortcuts import render, HttpResponse\n'), ((1385, 1428), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""ouvertime_record:ouver-time"""'], {}), "('ouvertime_record:ouver-time')\n", (1397, 14... |
import unittest as ut
import time
class test_magick(ut.TestCase):
def test_us(self):
list_r = list(range(0, 100))
for i in list_r:
with self.subTest(case=i):
self.assertEqual(magick(i), i)
def magick(x=None, start=0, stop=100):
yes = ['да', 'д', 'yes', 'y', 'ye']... | [
"unittest.main",
"time.time"
] | [((907, 918), 'time.time', 'time.time', ([], {}), '()\n', (916, 918), False, 'import time\n'), ((1005, 1016), 'time.time', 'time.time', ([], {}), '()\n', (1014, 1016), False, 'import time\n'), ((1103, 1114), 'time.time', 'time.time', ([], {}), '()\n', (1112, 1114), False, 'import time\n'), ((1193, 1202), 'unittest.main... |
# coding=utf-8
# Copyright 2020 The Tensor2Robot Authors.
#
# 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 ... | [
"tensorflow.compat.v1.train.Features",
"tensorflow.compat.v1.train.FloatList",
"numpy.random.choice",
"numpy.sort",
"numpy.array",
"tensorflow.compat.v1.train.BytesList",
"collections.defaultdict",
"tensorflow.compat.v1.train.FeatureList",
"numpy.concatenate",
"tensorflow.compat.v1.train.Int64List... | [((2614, 2630), 'numpy.sort', 'np.sort', (['indices'], {}), '(indices)\n', (2621, 2630), True, 'import numpy as np\n'), ((3634, 3663), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (3657, 3663), False, 'import collections\n'), ((2168, 2202), 'numpy.array', 'np.array', (['[0, original... |
from exceptions import BarryFileException, BarryConversionException, BarryExportException, BarryDFException
import pandas as pd
import requests
from StringIO import StringIO
def detect_file_extension(filename):
"""Extract and return the extension of a file given a filename.
Args:
filename (str): name... | [
"StringIO.StringIO",
"exceptions.BarryFileException",
"exceptions.BarryDFException",
"pandas.read_csv",
"exceptions.BarryConversionException",
"requests.get",
"pandas.read_excel",
"exceptions.BarryExportException"
] | [((506, 558), 'exceptions.BarryFileException', 'BarryFileException', (['"""Input file name cannot be None"""'], {}), "('Input file name cannot be None')\n", (524, 558), False, 'from exceptions import BarryFileException, BarryConversionException, BarryExportException, BarryDFException\n'), ((705, 782), 'exceptions.Barry... |
from flask_script import Command
from app import db
class SeedCommand(Command):
""" Seed the DB."""
def run(self):
if (
input(
"Are you sure you want to drop all tables and recreate? (y/N)\n"
).lower() == "y"
):
print("Dropping tables...")
... | [
"app.db.create_all",
"app.db.drop_all",
"app.db.session.commit"
] | [((332, 345), 'app.db.drop_all', 'db.drop_all', ([], {}), '()\n', (343, 345), False, 'from app import db\n'), ((358, 373), 'app.db.create_all', 'db.create_all', ([], {}), '()\n', (371, 373), False, 'from app import db\n'), ((386, 405), 'app.db.session.commit', 'db.session.commit', ([], {}), '()\n', (403, 405), False, '... |
# -*- coding: utf-8 -*-
"""
Core client, used for all API requests.
"""
import os
import platform
from collections import namedtuple
from plivo.base import ResponseObject
from plivo.exceptions import (AuthenticationError, InvalidRequestError,
PlivoRestError, PlivoServerError,
... | [
"requests.Session",
"plivo.resources.Addresses",
"plivo.resources.Applications",
"plivo.utils.is_valid_mainaccount",
"plivo.resources.Accounts",
"plivo.resources.live_calls.LiveCalls",
"plivo.base.ResponseObject",
"plivo.exceptions.PlivoServerError",
"collections.namedtuple",
"plivo.resources.Iden... | [((871, 932), 'collections.namedtuple', 'namedtuple', (['"""AuthenticationCredentials"""', '"""auth_id auth_token"""'], {}), "('AuthenticationCredentials', 'auth_id auth_token')\n", (881, 932), False, 'from collections import namedtuple\n'), ((1759, 1820), 'plivo.exceptions.AuthenticationError', 'AuthenticationError', ... |
from django import template
from django.conf import settings
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag
def setting(name):
return getattr(settings, name, "")
#@register.filter
#def format_difference(value):
# number = int(value)
# if number > 0:
# ... | [
"django.template.Library"
] | [((119, 137), 'django.template.Library', 'template.Library', ([], {}), '()\n', (135, 137), False, 'from django import template\n')] |
# Given a series of input numbers, count the number of times
# the values increase from one to the next.
import pandas as pd
# Part 1
sample = pd.read_csv(".\Day1\sample.txt", header=None, squeeze=True)
input = pd.read_csv(".\Day1\input.txt", header=None, squeeze=True)
#print(type(input))
ans = input.diff(1).apply(l... | [
"pandas.read_csv"
] | [((145, 206), 'pandas.read_csv', 'pd.read_csv', (['""".\\\\Day1\\\\sample.txt"""'], {'header': 'None', 'squeeze': '(True)'}), "('.\\\\Day1\\\\sample.txt', header=None, squeeze=True)\n", (156, 206), True, 'import pandas as pd\n'), ((214, 274), 'pandas.read_csv', 'pd.read_csv', (['""".\\\\Day1\\\\input.txt"""'], {'header... |
################################################################################
# Copyright (c) 2021 ContinualAI. #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. ... | [
"GPUtil.getGPUs",
"time.monotonic",
"avalanche.evaluation.metric_utils.phase_and_task",
"avalanche.evaluation.metric_results.MetricValue",
"warnings.warn",
"threading.Thread",
"avalanche.evaluation.metric_utils.get_metric_name",
"avalanche.evaluation.metric_utils.stream_type"
] | [((3087, 3103), 'time.monotonic', 'time.monotonic', ([], {}), '()\n', (3101, 3103), False, 'import time\n'), ((5440, 5471), 'avalanche.evaluation.metric_utils.get_metric_name', 'get_metric_name', (['self', 'strategy'], {}), '(self, strategy)\n', (5455, 5471), False, 'from avalanche.evaluation.metric_utils import get_me... |
import base64
import datetime
import io
import json
import os
import requests
from collections import namedtuple
from urllib.parse import urlparse
import faust
import numpy as np
import keras_preprocessing.image as keras_img
from avro import schema
from confluent_kafka import avro
from confluent_kafka.avro import Avr... | [
"requests.post",
"numpy.log10",
"confluent_kafka.avro.loads",
"faust.App",
"keras_preprocessing.image.load_img",
"io.BytesIO",
"confluent_kafka.avro.cached_schema_registry_client.CachedSchemaRegistryClient",
"blob.BlobConfig",
"blob.Blob",
"numpy.nanmax",
"collections.namedtuple",
"biovolume.c... | [((637, 692), 'os.environ.get', 'os.environ.get', (['"""IFCB_STREAM_APP_CONFIG"""', '"""config.json"""'], {}), "('IFCB_STREAM_APP_CONFIG', 'config.json')\n", (651, 692), False, 'import os\n'), ((777, 911), 'collections.namedtuple', 'namedtuple', (['"""Stats"""', "['time', 'ifcb_id', 'roi', 'name', 'classifier', 'prob',... |
import discord
from discord.ext import commands
from discord.utils import get
class c260(commands.Cog, name="c260"):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.command(name='Yikilth_Lair_of_the_Abyssals', aliases=['c260', 'Abyssal_11'])
async def example_embed(self, ctx):
... | [
"discord.Embed",
"discord.ext.commands.command"
] | [((190, 279), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""Yikilth_Lair_of_the_Abyssals"""', 'aliases': "['c260', 'Abyssal_11']"}), "(name='Yikilth_Lair_of_the_Abyssals', aliases=['c260',\n 'Abyssal_11'])\n", (206, 279), False, 'from discord.ext import commands\n'), ((332, 399), 'discord.Emb... |
"""
This module tests utils
"""
from unittest.mock import patch, MagicMock
from superset_patchup.utils import get_complex_env_var, is_safe_url, is_valid_provider
from superset_patchup.oauth import CustomSecurityManager
class TestUtils:
"""
Class to test the utils module
"""
@patch("superset_patchup.... | [
"superset_patchup.utils.is_safe_url",
"superset_patchup.utils.is_valid_provider",
"unittest.mock.patch",
"superset_patchup.utils.get_complex_env_var"
] | [((296, 335), 'unittest.mock.patch', 'patch', (['"""superset_patchup.utils.request"""'], {}), "('superset_patchup.utils.request')\n", (301, 335), False, 'from unittest.mock import patch, MagicMock\n'), ((667, 708), 'unittest.mock.patch', 'patch', (['"""superset_patchup.utils.os.getenv"""'], {}), "('superset_patchup.uti... |
# Generated by Django 2.2.5 on 2019-10-28 21:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0003_auto_20191028_1802'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='registered_a... | [
"django.db.models.DateTimeField"
] | [((342, 413), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)', 'verbose_name': '"""date_registered"""'}), "(auto_now_add=True, verbose_name='date_registered')\n", (362, 413), False, 'from django.db import migrations, models\n')] |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import tensorflow as tf
from fewshot.models.kmeans_utils import compute_logits
from fewshot.models.model import Model
from fewshot.models.refine_model import RefineModel
from fewshot.models... | [
"tensorflow.train.AdamOptimizer",
"tensorflow.eye",
"tensorflow.shape",
"tensorflow.pow",
"fewshot.models.basic_model_VAT.BasicModelVAT.get_train_op",
"fewshot.utils.logger.get",
"tensorflow.summary.scalar",
"tensorflow.stop_gradient",
"tensorflow.summary.histogram",
"tensorflow.constant",
"fews... | [((656, 668), 'fewshot.utils.logger.get', 'logger.get', ([], {}), '()\n', (666, 668), False, 'from fewshot.utils import logger\n'), ((672, 702), 'fewshot.models.model_factory.RegisterModel', 'RegisterModel', (['"""basic-VAT-ENT"""'], {}), "('basic-VAT-ENT')\n", (685, 702), False, 'from fewshot.models.model_factory impo... |
import unittest
import os
import pathlib
import h5py
from desc.input_reader import InputReader
from desc.equilibrium_io import hdf5Writer, hdf5Reader
from desc.configuration import Configuration, Equilibrium
#from desc.input_output import read_input
#class TestIO(unittest.TestCase):
# """tests for input/output fun... | [
"desc.input_reader.InputReader",
"pathlib.Path",
"desc.equilibrium_io.hdf5Writer",
"h5py.File",
"desc.equilibrium_io.hdf5Reader"
] | [((1042, 1073), 'desc.input_reader.InputReader', 'InputReader', ([], {'cl_args': 'self.argv2'}), '(cl_args=self.argv2)\n', (1053, 1073), False, 'from desc.input_reader import InputReader\n'), ((2451, 2476), 'desc.input_reader.InputReader', 'InputReader', ([], {'cl_args': 'argv'}), '(cl_args=argv)\n', (2462, 2476), Fals... |
from unittest import skip
import unittest2
from nose.plugins.attrib import attr
from nose.tools import assert_equals
@attr('test_nose_plugin')
class TestNosePlugin(unittest2.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_one(self):
"""first test, simulation p... | [
"nose.tools.assert_equals",
"nose.plugins.attrib.attr"
] | [((121, 145), 'nose.plugins.attrib.attr', 'attr', (['"""test_nose_plugin"""'], {}), "('test_nose_plugin')\n", (125, 145), False, 'from nose.plugins.attrib import attr\n'), ((343, 362), 'nose.tools.assert_equals', 'assert_equals', (['(1)', '(1)'], {}), '(1, 1)\n', (356, 362), False, 'from nose.tools import assert_equals... |
# Copyright 2020-2021 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 writi... | [
"logging.getLogger",
"yaml.dump"
] | [((859, 886), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (876, 886), False, 'import logging\n'), ((2319, 2337), 'yaml.dump', 'yaml.dump', (['content'], {}), '(content)\n', (2328, 2337), False, 'import yaml\n')] |
#ecoding:utf-8
import DatasetLoader
import RICNNModel
import tensorflow as tf
import sys
import numpy as np
import regularization as re
import os
import trainLoader
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
TRAIN_FILENAME = '/media/liuqi/Files/dataset/test_mnist_ricnn_raw_100.h5'
TEST_FILENAME = '/media/liuqi/Files/da... | [
"tensorflow.cast",
"sys.stdout.flush",
"tensorflow.initialize_all_variables",
"trainLoader.DataLoader",
"tensorflow.placeholder",
"tensorflow.Session",
"RICNNModel.define_model",
"tensorflow.argmax",
"tensorflow.name_scope",
"numpy.random.seed",
"regularization.regu_constraint",
"tensorflow.nn... | [((801, 820), 'numpy.random.seed', 'np.random.seed', (['(100)'], {}), '(100)\n', (815, 820), True, 'import numpy as np\n'), ((821, 844), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(100)'], {}), '(100)\n', (839, 844), True, 'import tensorflow as tf\n'), ((849, 951), 'tensorflow.placeholder', 'tf.placeholder'... |
#!/usr/bin/env python
"""Extract radial, sulcal, and gyral orientations from gyral coordinate NIFTI file"""
def main():
import argparse
parser = argparse.ArgumentParser("Extract radial, sulcal, and gyral dyads from a coord NIFTI file")
parser.add_argument('coord', help='name of the coord file')
parse... | [
"mcot.core.surface.utils.gcoord_split",
"argparse.ArgumentParser"
] | [((156, 251), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Extract radial, sulcal, and gyral dyads from a coord NIFTI file"""'], {}), "(\n 'Extract radial, sulcal, and gyral dyads from a coord NIFTI file')\n", (179, 251), False, 'import argparse\n'), ((795, 819), 'mcot.core.surface.utils.gcoord_split'... |
import pyautogui
import time
import datetime
class SwipeCard:
def __init__(self):
self.resolution = pyautogui.size()
def resolve_task(self):
try:
hide_card_position = pyautogui.center(
pyautogui.locateOnScreen(f"assets/tasks/swipe_card/main.png",
... | [
"pyautogui.moveTo",
"pyautogui.locateOnScreen",
"time.sleep",
"pyautogui.size",
"pyautogui.click",
"datetime.datetime.now",
"pyautogui.mouseDown"
] | [((114, 130), 'pyautogui.size', 'pyautogui.size', ([], {}), '()\n', (128, 130), False, 'import pyautogui\n'), ((1081, 1104), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1102, 1104), False, 'import datetime\n'), ((372, 433), 'pyautogui.click', 'pyautogui.click', (['hide_card_position[0]', 'hide_... |
from service import Service
from unittest import TestCase
from mock import patch
import sys
class TestService(TestCase):
@patch('service.Service.bad_random', return_value=10)
def test_bad_random(self, bad_random):
self.assertEqual(bad_random(), 10)
@patch('service.Service.bad_random', return_value=10)
def test_... | [
"mock.patch",
"service.Service"
] | [((124, 176), 'mock.patch', 'patch', (['"""service.Service.bad_random"""'], {'return_value': '(10)'}), "('service.Service.bad_random', return_value=10)\n", (129, 176), False, 'from mock import patch\n'), ((257, 309), 'mock.patch', 'patch', (['"""service.Service.bad_random"""'], {'return_value': '(10)'}), "('service.Ser... |
"""Use TIMESTAMP column for latest submission
Revision ID: eff<PASSWORD>0<PASSWORD>
Revises: <PASSWORD>
Create Date: 2017-01-08 22:20:43.814375
"""
# revision identifiers, used by Alembic.
revision = 'eff<PASSWORD>'
down_revision = '<PASSWORD>'
from alembic import op # lgtm[py/unused-import]
import sqlalchemy as ... | [
"alembic.op.alter_column",
"alembic.op.drop_column",
"libweasyl.models.helpers.ArrowColumn",
"alembic.op.execute",
"libweasyl.models.helpers.WeasylTimestampColumn"
] | [((433, 536), 'alembic.op.alter_column', 'op.alter_column', (['"""profile"""', '"""latest_submission_time"""'], {'new_column_name': '"""latest_submission_time_old"""'}), "('profile', 'latest_submission_time', new_column_name=\n 'latest_submission_time_old')\n", (448, 536), False, 'from alembic import op\n'), ((736, ... |
from bs4 import BeautifulSoup
import requests
import math
import time
start_url='https://www.macys.com'
domain='https://www.macys.com'
''' get soup '''
def get_soup(url):
# get contents from url
content=''
while content=='':
try:
content = requests.get(url,
... | [
"math.ceil",
"time.sleep",
"requests.get",
"bs4.BeautifulSoup",
"time.time"
] | [((575, 605), 'bs4.BeautifulSoup', 'BeautifulSoup', (['content', '"""lxml"""'], {}), "(content, 'lxml')\n", (588, 605), False, 'from bs4 import BeautifulSoup\n'), ((1199, 1220), 'math.ceil', 'math.ceil', (['(count / 60)'], {}), '(count / 60)\n', (1208, 1220), False, 'import math\n'), ((2012, 2023), 'time.time', 'time.t... |
from pydantic import BaseModel, Field, EmailStr
class PostSchema(BaseModel):
id: int = Field(default=None)
title: str = Field(...)
content: str = Field(...)
class Config:
schema_extra = {
"example": {
"title": "Securing FastAPI applications with JWT.",
... | [
"pydantic.Field"
] | [((93, 112), 'pydantic.Field', 'Field', ([], {'default': 'None'}), '(default=None)\n', (98, 112), False, 'from pydantic import BaseModel, Field, EmailStr\n'), ((130, 140), 'pydantic.Field', 'Field', (['...'], {}), '(...)\n', (135, 140), False, 'from pydantic import BaseModel, Field, EmailStr\n'), ((160, 170), 'pydantic... |
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions a... | [
"test_plan.Test"
] | [((3586, 3602), 'test_plan.Test', 'test_plan.Test', ([], {}), '()\n', (3600, 3602), False, 'import test_plan\n')] |
#!/usr/bin/env python
# vim:ts=4:sts=4:sw=4:et
#
# Author: <NAME>
# Date: 2018-09-09 23:06:06 +0100 (Sun, 09 Sep 2018)
#
# https://github.com/harisekhon/devops-python-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optional... | [
"os.path.exists",
"os.path.isfile",
"os.path.dirname",
"harisekhon.utils.log_option",
"os.path.isdir",
"harisekhon.utils.die",
"harisekhon.utils.strip_ansi_escape_codes",
"sys.exit",
"sys.path.append"
] | [((900, 923), 'sys.path.append', 'sys.path.append', (['libdir'], {}), '(libdir)\n', (915, 923), False, 'import sys\n'), ((863, 888), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (878, 888), False, 'import os\n'), ((1381, 1392), 'sys.exit', 'sys.exit', (['(4)'], {}), '(4)\n', (1389, 1392), F... |
from vk_bot.core.modules.basicplug import BasicPlug
import time
class Counting(BasicPlug):
command = ("отсчет",)
doc = "Отсчет от 1 до 3"
def main(self):
for x in range(3, -1, -1):
if x == 0:
return
self.sendmsg(x)
time.sleep(1)
| [
"time.sleep"
] | [((287, 300), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (297, 300), False, 'import time\n')] |
## Copyright © 2021, Oracle and/or its affiliates.
## Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
#!/usr/bin/env python
from setuptools import setup
setup(name='wind-marketplace-library',
version="1.0.0",
description='Robot Framework test librar... | [
"setuptools.setup"
] | [((212, 803), 'setuptools.setup', 'setup', ([], {'name': '"""wind-marketplace-library"""', 'version': '"""1.0.0"""', 'description': '"""Robot Framework test library for OCI Marketplace"""', 'long_description': '"""Robot Framework test library for OCI Marketplace"""', 'classifiers': "['Operating System :: OS Independent... |
from django.http import JsonResponse
from django.shortcuts import reverse
from django.urls import NoReverseMatch
from django.views import View
from rest_framework import __version__ as drf_version
from rest_framework.exceptions import ValidationError
from rest_framework.permissions import AllowAny
from rest_framework.r... | [
"rest_framework.response.Response",
"rest_framework.exceptions.ValidationError",
"django.shortcuts.reverse",
"django.http.JsonResponse"
] | [((681, 704), 'django.http.JsonResponse', 'JsonResponse', (['self.data'], {}), '(self.data)\n', (693, 704), False, 'from django.http import JsonResponse\n'), ((1369, 1391), 'rest_framework.response.Response', 'Response', (["{'url': url}"], {}), "({'url': url})\n", (1377, 1391), False, 'from rest_framework.response impo... |
from zerver.lib.actions import do_add_realm_playground
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import RealmPlayground, get_realm
class RealmPlaygroundTests(ZulipTestCase):
def test_create_one_playground_entry(self) -> None:
iago = self.example_user("iago")
payload = {... | [
"zerver.models.RealmPlayground.objects.filter",
"zerver.lib.actions.do_add_realm_playground",
"zerver.models.get_realm"
] | [((697, 715), 'zerver.models.get_realm', 'get_realm', (['"""zulip"""'], {}), "('zulip')\n", (706, 715), False, 'from zerver.models import RealmPlayground, get_realm\n'), ((1517, 1535), 'zerver.models.get_realm', 'get_realm', (['"""zulip"""'], {}), "('zulip')\n", (1526, 1535), False, 'from zerver.models import RealmPlay... |
#
# This is Seisflows
#
# See LICENCE file
#
#
###############################################################################
# Import system modules
import os
# Import Numpy
import numpy as np
# Local imports
from seisflows.tools import unix
from seisflows.tools.math import dot
from seisflows.tools.tools import lo... | [
"seisflows.tools.unix.mkdir",
"seisflows.tools.unix.cd",
"seisflows.tools.tools.loadtxt",
"seisflows.tools.tools.savetxt",
"seisflows.tools.math.dot"
] | [((2343, 2360), 'seisflows.tools.math.dot', 'dot', (['g_old', 'g_old'], {}), '(g_old, g_old)\n', (2346, 2360), False, 'from seisflows.tools.math import dot\n'), ((2505, 2522), 'seisflows.tools.math.dot', 'dot', (['g_old', 'g_old'], {}), '(g_old, g_old)\n', (2508, 2522), False, 'from seisflows.tools.math import dot\n'),... |
from dataclasses import dataclass, field
from typing import Optional
__NAMESPACE__ = "sdformat/v1.5/physics.xsd"
@dataclass
class Physics:
"""
The physics tag specifies the type and properties of the dynamics engine.
Parameters
----------
max_step_size: Maximum time step size at which every syst... | [
"dataclasses.field"
] | [((1829, 1918), 'dataclasses.field', 'field', ([], {'default': '(0.001)', 'metadata': "{'type': 'Element', 'namespace': '', 'required': True}"}), "(default=0.001, metadata={'type': 'Element', 'namespace': '',\n 'required': True})\n", (1834, 1918), False, 'from dataclasses import dataclass, field\n'), ((2015, 2102), ... |
#!/usr/bin/env python
# Copyright 2018-present Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"os.path.dirname",
"os.path.join",
"subprocess.call",
"shutil.rmtree"
] | [((793, 818), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (808, 818), False, 'import os\n'), ((1066, 1098), 'os.path.join', 'os.path.join', (['PLUGIN_PATH', '"""gen"""'], {}), "(PLUGIN_PATH, 'gen')\n", (1078, 1098), False, 'import os\n'), ((1114, 1179), 'os.path.join', 'os.path.join', (['O... |
from lxml import html
from d_parser.d_spider_common import DSpiderCommon
from d_parser.helpers.re_set import Ree
from helpers.url_generator import UrlGenerator
from d_parser.helpers.stat_counter import StatCounter as SC
VERSION = 29
# Warn: Don't remove task argument even if not use it (it's break grab and spider ... | [
"helpers.url_generator.UrlGenerator.get_page_params",
"d_parser.helpers.re_set.Ree.float.match",
"lxml.html.fromstring"
] | [((3756, 3824), 'helpers.url_generator.UrlGenerator.get_page_params', 'UrlGenerator.get_page_params', (['self.domain', 'product_photo_url_raw', '{}'], {}), '(self.domain, product_photo_url_raw, {})\n', (3784, 3824), False, 'from helpers.url_generator import UrlGenerator\n'), ((1550, 1601), 'helpers.url_generator.UrlGen... |
#!/usr/bin/python3
import logging
import argparse
from time import time
import toml
from data.io.knowledge_graph import KnowledgeGraph
from data.io.tarball import Tarball
from data.io.tsv import TSV
from data.utils import is_readable, is_writable
from embeddings import graph_structure
from tasks.node_classification ... | [
"logging.getLogger",
"logging.StreamHandler",
"tasks.utils.mksplits",
"tasks.utils.init_fold",
"logging.debug",
"embeddings.graph_structure.generate",
"data.io.knowledge_graph.KnowledgeGraph",
"tasks.utils.strip_graph",
"data.io.tarball.Tarball",
"tasks.node_classification.build_model",
"argpars... | [((766, 825), 'tasks.utils.mksplits', 'mksplits', (['X', 'Y', 'X_node_map', "config['task']['dataset_ratio']"], {}), "(X, Y, X_node_map, config['task']['dataset_ratio'])\n", (774, 825), False, 'from tasks.utils import mksplits, init_fold, mkfolds, sample_mask, set_seed, strip_graph\n'), ((906, 934), 'tasks.node_classif... |
import argparse, time, os, cv2, shutil, datetime, math, subprocess, pickle, multiprocessing
from actn import *
ap = argparse.ArgumentParser()
# for help -> python alpha.py --help
ap.add_argument("-f", "--file", required=True,
help="name of the file")
ap.add_argument("-o", "--output", required=True,
... | [
"os.listdir",
"math.ceil",
"argparse.ArgumentParser",
"os.makedirs",
"datetime.datetime.now",
"shutil.rmtree",
"os.system",
"time.time",
"os.remove"
] | [((117, 142), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (140, 142), False, 'import argparse, time, os, cv2, shutil, datetime, math, subprocess, pickle, multiprocessing\n'), ((8644, 8655), 'time.time', 'time.time', ([], {}), '()\n', (8653, 8655), False, 'import argparse, time, os, cv2, shut... |
from dcim.choices import DeviceStatusChoices
from dcim.models import Device
from extras.reports import Report
class DeviceIPReport(Report):
description = (
"Check that every device has either an IPv4 or IPv6 primary address assigned"
)
def test_primary_ip4(self):
for device in Device.obje... | [
"dcim.models.Device.objects.filter"
] | [((309, 372), 'dcim.models.Device.objects.filter', 'Device.objects.filter', ([], {'status': 'DeviceStatusChoices.STATUS_ACTIVE'}), '(status=DeviceStatusChoices.STATUS_ACTIVE)\n', (330, 372), False, 'from dcim.models import Device\n')] |
import socket
import random
import os
import requests
import re
import github
import minecraft
import string
import sys
HOST = "xeroxirc.net"
PORT = 6667
NICK = "ak_sus"
#PASSWORD = os.getenv("PASSWORD")
CHANNEL = "#BlockySurvival"
SERVER = ""
readbuffer = ""
def send(message):
s.send(message)
print(message)
s ... | [
"github.get_issue_title",
"minecraft.get",
"random.randint",
"socket.socket"
] | [((322, 337), 'socket.socket', 'socket.socket', ([], {}), '()\n', (335, 337), False, 'import socket\n'), ((1631, 1653), 'random.randint', 'random.randint', (['(0)', '(100)'], {}), '(0, 100)\n', (1645, 1653), False, 'import random\n'), ((2726, 2741), 'minecraft.get', 'minecraft.get', ([], {}), '()\n', (2739, 2741), Fals... |
"""
The file defines the evaluate process on target dataset.
@Author: <NAME>
@Github: https://github.com/luyanger1799
@Project: https://github.com/luyanger1799/amazing-semantic-segmentation
"""
from sklearn.metrics import multilabel_confusion_matrix
from amazingutils.helpers import *
from amazingutils.utils import lo... | [
"os.path.exists",
"numpy.mean",
"os.listdir",
"argparse.ArgumentParser",
"os.path.join",
"argparse.ArgumentTypeError",
"os.getcwd",
"sys.stdout.flush",
"amazingutils.utils.load_image"
] | [((651, 676), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (674, 676), False, 'import argparse\n'), ((1311, 1355), 'os.path.join', 'os.path.join', (['args.dataset', '"""class_dict.csv"""'], {}), "(args.dataset, 'class_dict.csv')\n", (1323, 1355), False, 'import os\n'), ((1142, 1153), 'os.getc... |
from pso.GPSO import GPSO
import numpy as np
import time
import pandas as pd
np.random.seed(42)
# f1 完成
def Sphere(p):
# Sphere函数
out_put = 0
for i in p:
out_put += i ** 2
return out_put
# f2 完成
def Sch222(x):
out_put = 0
out_put01 = 1
for i in x:
out_put += abs(i)
... | [
"numpy.abs",
"numpy.prod",
"numpy.sqrt",
"numpy.random.rand",
"numpy.ones",
"numpy.floor",
"numpy.min",
"numpy.square",
"numpy.exp",
"numpy.sum",
"numpy.zeros",
"numpy.random.seed",
"numpy.cos",
"numpy.std",
"pandas.DataFrame",
"time.time"
] | [((78, 96), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (92, 96), True, 'import numpy as np\n'), ((2299, 2316), 'numpy.zeros', 'np.zeros', (['(2, 10)'], {}), '((2, 10))\n', (2307, 2316), True, 'import numpy as np\n'), ((2325, 2343), 'numpy.zeros', 'np.zeros', (['(10, 30)'], {}), '((10, 30))\n', (23... |
# -*- coding:utf-8 -*-
# @Time : 2019/7/21 12:35 PM
# @Author : __wutonghe__
# docs https://channels.readthedocs.io/en/latest/tutorial/part_3.html#rewrite-the-consumer-to-be-asynchronous
from channels.generic.websocket import AsyncWebsocketConsumer
import json
class MessageConsumer(AsyncWebsocketConsumer):
"... | [
"json.dumps"
] | [((793, 814), 'json.dumps', 'json.dumps', (['text_data'], {}), '(text_data)\n', (803, 814), False, 'import json\n')] |
import io
from .. import util
def test_parsing_pkg_info_file(mocker):
open_mock = mocker.patch('vcsver.util.open')
open_mock.return_value = io.StringIO(
'Name: name\n'
'Version: 1.0\n'
)
pkg_info_data = util.parse_pkg_info_file(mocker.sentinel.path)
open_mock = open_mock.assert_... | [
"io.StringIO"
] | [((151, 194), 'io.StringIO', 'io.StringIO', (['"""Name: name\nVersion: 1.0\n"""'], {}), '("""Name: name\nVersion: 1.0\n""")\n', (162, 194), False, 'import io\n')] |
#!/usr/bin/env python
# This "flattens" a LaTeX document by replacing all
# \input{X} lines w/ the text actually contained in X. See
# associated README.md for details.
# Use as a python module in a python script by saying import flatex then flatex.main(in file, out file)
import os
import re
import sys
de... | [
"os.path.abspath",
"os.path.split",
"re.search"
] | [((673, 702), 're.search', 're.search', (['tex_input_re', 'line'], {}), '(tex_input_re, line)\n', (682, 702), False, 'import re\n'), ((859, 897), 're.search', 're.search', (['tex_input_filename_re', 'line'], {}), '(tex_input_filename_re, line)\n', (868, 897), False, 'import re\n'), ((1217, 1246), 'os.path.abspath', 'os... |