code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
import pandas as pd
import pytest
from user_similarity_model.config.core import DATASET_DIR, config
@pytest.fixture()
def sample_local_data():
"""AI is creating summary for sample_local_data
Returns:
[Dict]: This function returns a dictionary with CSV files which
in dataset folder... | [
"pytest.fixture",
"os.path.join"
] | [((115, 131), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (129, 131), False, 'import pytest\n'), ((544, 575), 'os.path.join', 'os.path.join', (['DATASET_DIR', 'file'], {}), '(DATASET_DIR, file)\n', (556, 575), False, 'import os\n')] |
from django.apps import AppConfig
import logging
logger = logging.getLogger(__name__)
class WeatherConfig(AppConfig):
name = 'weather'
def ready(self):
from forecastUpdater import updater
updater.start()
| [
"logging.getLogger",
"forecastUpdater.updater.start"
] | [((59, 86), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (76, 86), False, 'import logging\n'), ((216, 231), 'forecastUpdater.updater.start', 'updater.start', ([], {}), '()\n', (229, 231), False, 'from forecastUpdater import updater\n')] |
import logging
import os
from datetime import datetime
from inspect import signature, Parameter
from pathlib import Path
from pprint import pprint
from textwrap import dedent
from typing import Optional, Union
import fire
import tensorflow as tf
from tensorflow.keras.callbacks import EarlyStopping, ModelCheckpoint, Te... | [
"logging.getLogger",
"textwrap.dedent",
"tensorflow.keras.callbacks.TerminateOnNaN",
"spellnn.data.processing.DataProcessor",
"tensorflow.keras.callbacks.TensorBoard",
"fire.Fire",
"pathlib.Path",
"tensorflow.numpy_function",
"tensorflow.data.TextLineDataset",
"spellnn.data.util.nb_lines",
"tens... | [((5759, 5773), 'fire.Fire', 'fire.Fire', (['cli'], {}), '(cli)\n', (5768, 5773), False, 'import fire\n'), ((674, 705), 'logging.getLogger', 'logging.getLogger', (['"""tensorflow"""'], {}), "('tensorflow')\n", (691, 705), False, 'import logging\n'), ((1555, 1605), 'spellnn.layers.mapping.CharMapping', 'CharMapping', ([... |
import fileinput
counts = {}
for line in fileinput.input():
line = line.strip()
p1, p2 = line.split('>')
p1 = p1[:-2]
x1, y1 = p1.split(',')
x1 = int(x1)
y1 = int(y1)
p2 = p2[1:]
x2, y2 = p2.split(',')
x2 = int(x2)
y2 = int(y2)
if x1 == x2:
dx = 0
elif x1 > x2:... | [
"fileinput.input"
] | [((42, 59), 'fileinput.input', 'fileinput.input', ([], {}), '()\n', (57, 59), False, 'import fileinput\n')] |
import logging
from web3 import Web3
import sys
import time
import meditation.meditation as meditation
if __name__ == "__main__":
log_format = '%(asctime)s|%(name)s|%(levelname)s: %(message)s'
logger = logging.getLogger("DFK-meditation")
logger.setLevel(logging.DEBUG)
logging.basicConfig(level=loggin... | [
"logging.getLogger",
"logging.basicConfig",
"meditation.meditation.get_hero_meditation",
"meditation.meditation.stat2id",
"meditation.meditation.get_active_meditations",
"time.sleep",
"meditation.meditation.get_required_runes",
"web3.Web3.HTTPProvider"
] | [((213, 248), 'logging.getLogger', 'logging.getLogger', (['"""DFK-meditation"""'], {}), "('DFK-meditation')\n", (230, 248), False, 'import logging\n'), ((288, 365), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': 'log_format', 'stream': 'sys.stdout'}), '(level=logging.INFO, format... |
import pygame
import random
pygame.init()
clock = pygame.time.Clock()
fps = 60
#game window
bottom_panel = 150
screen_width = 800
screen_height = 400 + bottom_panel
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption('Battle')
#define game variables
current_fighter = 1
total... | [
"random.randint",
"pygame.init",
"pygame.quit",
"pygame.event.get",
"pygame.time.get_ticks",
"pygame.display.set_mode",
"pygame.mouse.get_pos",
"pygame.time.Clock",
"pygame.mouse.set_visible",
"pygame.draw.rect",
"pygame.display.set_caption",
"pygame.image.load",
"pygame.display.update",
"... | [((29, 42), 'pygame.init', 'pygame.init', ([], {}), '()\n', (40, 42), False, 'import pygame\n'), ((52, 71), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (69, 71), False, 'import pygame\n'), ((178, 232), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(screen_width, screen_height)'], {}), '((scre... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Name: test_uidattr
# Purpose: Test driver for module 'uidattr'
#
# Author: <NAME> (<EMAIL>)
#
# Copyright: (c) 2018 <NAME>
# -------------------------------------------------... | [
"unittest.main",
"camd3.infrastructure.component.UniqueIdAttribute",
"camd3.infrastructure.component.idfactories.uuid_generator",
"uuid.uuid1"
] | [((972, 991), 'camd3.infrastructure.component.UniqueIdAttribute', 'UniqueIdAttribute', ([], {}), '()\n', (989, 991), False, 'from camd3.infrastructure.component import Component, register_utility, UniqueIdAttribute\n'), ((1606, 1621), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1619, 1621), False, 'import unit... |
#!//anaconda/envs/py36/bin/python
#
# File name: kmc_pld.py
# Date: 2018/08/03 09:07
# Author: <NAME>
#
# Description:
#
import numpy as np
from collections import Counter
class EventTree:
"""
Class maintaining a binary tree for random event type lookup
and arrays for choosing specific even... | [
"collections.Counter",
"numpy.array",
"numpy.random.random"
] | [((1264, 1305), 'collections.Counter', 'Counter', (["[e['type'] for e in self.events]"], {}), "([e['type'] for e in self.events])\n", (1271, 1305), False, 'from collections import Counter\n'), ((724, 741), 'numpy.array', 'np.array', (['e_ratio'], {}), '(e_ratio)\n', (732, 741), True, 'import numpy as np\n'), ((1958, 19... |
# -*- coding: utf-8 -*-
# Copyright (C) 2006-2007 <NAME>, European Environment Agency
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your op... | [
"odf.element.Element"
] | [((957, 1003), 'odf.element.Element', 'Element', ([], {'qname': "(METANS, 'auto-reload')"}), "(qname=(METANS, 'auto-reload'), **args)\n", (964, 1003), False, 'from odf.element import Element\n'), ((1043, 1091), 'odf.element.Element', 'Element', ([], {'qname': "(METANS, 'creation-date')"}), "(qname=(METANS, 'creation-da... |
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '2'
import torch
torch.rand(10)
import torch.nn as nn
import torch.nn.functional as F
import glob
from tqdm import tqdm, trange
print(torch.cuda.is_available())
print(torch.cuda.get_device_name())
print(torch.cuda.current_device())
device = torch.device('cuda' if torch.cu... | [
"torch.from_numpy",
"numpy.array",
"torch.cuda.is_available",
"matplotlib.pyplot.imshow",
"os.listdir",
"numpy.asarray",
"torch.cuda.memory_reserved",
"my_utils.xyxy_2_xyxyo",
"torch.cuda.current_device",
"glob.glob",
"random.choice",
"cv2.cvtColor",
"cv2.resize",
"cv2.imread",
"utils.to... | [((64, 78), 'torch.rand', 'torch.rand', (['(10)'], {}), '(10)\n', (74, 78), False, 'import torch\n'), ((1189, 1206), 'utils.torch_utils.select_device', 'select_device', (['""""""'], {}), "('')\n", (1202, 1206), False, 'from utils.torch_utils import select_device, load_classifier, time_synchronized\n'), ((2183, 2238), '... |
# Copyright 2015 Carnegie Mellon University
#
# Author: <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | [
"oslo.config.cfg.StrOpt",
"monasca.common.kafka_conn.KafkaConnection",
"monasca.openstack.common.log.getLogger",
"ast.literal_eval",
"oslo.config.cfg.CONF.register_group",
"monasca.common.email_sender.send_emails",
"oslo.config.cfg.CONF.register_opts",
"oslo.config.cfg.OptGroup",
"monasca.common.es_... | [((1954, 2009), 'oslo.config.cfg.OptGroup', 'cfg.OptGroup', ([], {'name': '"""notification"""', 'title': '"""notification"""'}), "(name='notification', title='notification')\n", (1966, 2009), False, 'from oslo.config import cfg\n'), ((2010, 2043), 'oslo.config.cfg.CONF.register_group', 'cfg.CONF.register_group', (['es_... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin
from django.contrib.auth.models import Group
from django.utils.translation import ugettext_lazy as _
from main.models import UserInfo, User, Child, Volunteer, Donor, Letter, Need, PurchaseForInstitute, PurchaseForNeed, ... | [
"django.contrib.admin.site.unregister",
"django.contrib.admin.register",
"django.utils.translation.ugettext_lazy",
"django.contrib.admin.site.register"
] | [((355, 375), 'django.contrib.admin.register', 'admin.register', (['User'], {}), '(User)\n', (369, 375), False, 'from django.contrib import admin\n'), ((1095, 1123), 'django.contrib.admin.site.unregister', 'admin.site.unregister', (['Group'], {}), '(Group)\n', (1116, 1123), False, 'from django.contrib import admin\n'),... |
import tdl
import time
import hunting.constants as c
class Renderer:
def __init__(self, main_console=None, level_display_width=c.SCREEN_WIDTH, level_display_height=c.SCREEN_HEIGHT):
if main_console is None:
self.main_console = tdl.init(level_display_width, level_display_height, 'From Renderer ... | [
"tdl.Console",
"tdl.init",
"time.sleep",
"tdl.flush"
] | [((2494, 2515), 'time.sleep', 'time.sleep', (['show_time'], {}), '(show_time)\n', (2504, 2515), False, 'import time\n'), ((543, 597), 'tdl.Console', 'tdl.Console', (['level_display_width', 'level_display_height'], {}), '(level_display_width, level_display_height)\n', (554, 597), False, 'import tdl\n'), ((1432, 1443), '... |
from zenslackchat.zendesk_base_webhook import BaseWebHook
from zenslackchat.zendesk_email_to_slack import email_from_zendesk
from zenslackchat.zendesk_comments_to_slack import comments_from_zendesk
class CommentsWebHook(BaseWebHook):
"""Handle Zendesk Comment Events.
"""
def handle_event(self, event, slac... | [
"zenslackchat.zendesk_email_to_slack.email_from_zendesk",
"zenslackchat.zendesk_comments_to_slack.comments_from_zendesk"
] | [((501, 559), 'zenslackchat.zendesk_comments_to_slack.comments_from_zendesk', 'comments_from_zendesk', (['event', 'slack_client', 'zendesk_client'], {}), '(event, slack_client, zendesk_client)\n', (522, 559), False, 'from zenslackchat.zendesk_comments_to_slack import comments_from_zendesk\n'), ((789, 844), 'zenslackcha... |
y_pred=ml.predict(x_test)
print(y_pred)
from sklearn.metrics import r2_score
r2_score(y_test,y_pred)
pred_y_df=pd.DataFrame({'Actual Value':y_test,'Predicted Value':y_pred, 'Difference': y_test-y_pred})
pred_y_df[0:20] | [
"sklearn.metrics.r2_score"
] | [((78, 102), 'sklearn.metrics.r2_score', 'r2_score', (['y_test', 'y_pred'], {}), '(y_test, y_pred)\n', (86, 102), False, 'from sklearn.metrics import r2_score\n')] |
import asyncio
import discord
from discord.ext import commands
import re
import sqlite3
from urllib.parse import quote as uriquote
import html
CURR = ["AUD", "BRL", "CAD", "CHF", "CLP", "CNY", "CZK", "DKK", "EUR",
"GBP", "HKD", "HUF", "IDR", "ILS", "INR", "JPY", "KRW", "MXN",
"MYR", "NOK", "NZD", "P... | [
"sqlite3.connect",
"urllib.parse.quote",
"html.unescape",
"discord.ext.commands.is_owner",
"discord.ext.commands.command",
"re.search"
] | [((487, 505), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (503, 505), False, 'from discord.ext import commands\n'), ((4741, 4770), 'discord.ext.commands.command', 'commands.command', ([], {'hidden': '(True)'}), '(hidden=True)\n', (4757, 4770), False, 'from discord.ext import commands\n'), ((47... |
import unittest
import unittest.mock as mock
import asyncio
import pyx.http as http
def create_dummy_message():
msg = http.HttpMessage(None)
msg.headers = [
http.HttpHeader('Server', 'Pyx'),
http.HttpHeader('Cookie', 'a'),
http.HttpHeader('Cookie', 'b'),
]
return msg
def crea... | [
"pyx.http.HttpResponse",
"unittest.mock.Mock",
"asyncio.StreamReader",
"pyx.http.HttpRequest",
"pyx.http.HttpRequest.parse",
"pyx.http.HttpConnection",
"pyx.http.UrlResource",
"pyx.http.HttpHeader",
"pyx.http.HttpMessage",
"asyncio.sleep",
"asyncio.get_event_loop",
"pyx.http.StaticRootResource... | [((124, 146), 'pyx.http.HttpMessage', 'http.HttpMessage', (['None'], {}), '(None)\n', (140, 146), True, 'import pyx.http as http\n'), ((354, 378), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (376, 378), False, 'import asyncio\n'), ((393, 424), 'asyncio.StreamReader', 'asyncio.StreamReader', ([... |
from stix_shifter_utils.stix_translation.src.json_to_stix import json_to_stix_translator
from stix_shifter_utils.stix_translation.src.utils.transformer_utils import get_module_transformers
from stix_shifter_modules.aws_athena.entry_point import EntryPoint
import unittest
MODULE = "aws_athena"
entry_point = EntryPoint(... | [
"stix_shifter_utils.stix_translation.src.utils.transformer_utils.get_module_transformers",
"stix_shifter_modules.aws_athena.entry_point.EntryPoint"
] | [((309, 321), 'stix_shifter_modules.aws_athena.entry_point.EntryPoint', 'EntryPoint', ([], {}), '()\n', (319, 321), False, 'from stix_shifter_modules.aws_athena.entry_point import EntryPoint\n'), ((6400, 6431), 'stix_shifter_utils.stix_translation.src.utils.transformer_utils.get_module_transformers', 'get_module_transf... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file was created using the DirectGUI Designer
from direct.gui import DirectGuiGlobals as DGG
from direct.gui.DirectFrame import DirectFrame
from direct.gui.DirectLabel import DirectLabel
from direct.gui.DirectButton import DirectButton
from direct.gui.DirectOptionMenu... | [
"panda3d.core.LVecBase3f",
"panda3d.core.LVecBase4f",
"panda3d.core.LPoint3f"
] | [((648, 667), 'panda3d.core.LVecBase3f', 'LVecBase3f', (['(0)', '(0)', '(0)'], {}), '(0, 0, 0)\n', (658, 667), False, 'from panda3d.core import LPoint3f, LVecBase3f, LVecBase4f, TextNode\n'), ((733, 750), 'panda3d.core.LPoint3f', 'LPoint3f', (['(0)', '(0)', '(0)'], {}), '(0, 0, 0)\n', (741, 750), False, 'from panda3d.c... |
# Advent of Code 2020
# Day 21
# Author: irobin591
import os
import doctest
import re
re_entry = re.compile(r'^([a-z ]+) \(contains ([a-z, ]*)\)$')
with open(os.path.join(os.path.dirname(__file__), "input.txt"), 'r') as input_file:
input_data = input_file.read().strip().split('\n')
def part1(input_data):
"... | [
"os.path.dirname",
"doctest.testmod",
"re.compile"
] | [((99, 150), 're.compile', 're.compile', (['"""^([a-z ]+) \\\\(contains ([a-z, ]*)\\\\)$"""'], {}), "('^([a-z ]+) \\\\(contains ([a-z, ]*)\\\\)$')\n", (109, 150), False, 'import re\n'), ((2887, 2904), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (2902, 2904), False, 'import doctest\n'), ((174, 199), 'os.path... |
"""
Test that escaping characters for HTML is disabled.
"""
import os, subprocess
def test_escape_singlequote(tmpdir):
# Define empty dictionaries
doc = {}
template = {}
# Prepare file names
doc['path'] = tmpdir.join("document.md")
template['path'] = tmpdir.join("template.yaml")
# Prepar... | [
"subprocess.check_output"
] | [((800, 930), 'subprocess.check_output', 'subprocess.check_output', (["['pandoc', doc['path'].strpath, '--filter', 'pandoc-mustache', '--to=plain']"], {'universal_newlines': '(True)'}), "(['pandoc', doc['path'].strpath, '--filter',\n 'pandoc-mustache', '--to=plain'], universal_newlines=True)\n", (823, 930), False, '... |
from flask import Flask, jsonify, request
from w3lib.html import get_base_url
import extruct
import requests
app = Flask(__name__)
def extract_osm_tags(data):
tags = {}
schema_org_type = data.get('@type')
if schema_org_type == 'Restaurant':
tags['amenity'] = 'restaurant'
serves_cuisine... | [
"flask.request.args.get",
"flask.Flask",
"requests.get",
"w3lib.html.get_base_url",
"extruct.extract",
"flask.jsonify"
] | [((116, 131), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (121, 131), False, 'from flask import Flask, jsonify, request\n'), ((1866, 1889), 'flask.request.args.get', 'request.args.get', (['"""url"""'], {}), "('url')\n", (1882, 1889), False, 'from flask import Flask, jsonify, request\n'), ((2036, 2053), ... |
"""
A simple Python DAG using the Taskflow API.
"""
import logging
import time
from datetime import datetime
from airflow import DAG
from airflow.decorators import task
log = logging.getLogger(__name__)
with DAG(
dag_id='simple_python_taskflow_api',
schedule_interval=None,
start_date=datetime(2021, 1, 1)... | [
"logging.getLogger",
"datetime.datetime",
"time.sleep",
"airflow.decorators.task"
] | [((177, 204), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (194, 204), False, 'import logging\n'), ((381, 410), 'airflow.decorators.task', 'task', ([], {'task_id': '"""hello_message"""'}), "(task_id='hello_message')\n", (385, 410), False, 'from airflow.decorators import task\n'), ((535,... |
from . import model
import numpy as np
from scipy import special, stats
class RoyleNicholsModel(model.UnmarkedModel):
def __init__(self, det_formula, abun_formula, data):
self.response = model.Response(data.y)
abun = model.Submodel("Abundance", "abun", abun_formula, np.exp, data.site_covs)
... | [
"numpy.tile",
"scipy.stats.poisson.pmf",
"numpy.random.poisson",
"numpy.exp",
"numpy.array",
"scipy.stats.binom.logpmf",
"numpy.empty",
"numpy.random.binomial"
] | [((522, 533), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (530, 533), True, 'import numpy as np\n'), ((1524, 1549), 'numpy.random.poisson', 'np.random.poisson', (['lam', 'N'], {}), '(lam, N)\n', (1541, 1549), True, 'import numpy as np\n'), ((1631, 1647), 'numpy.empty', 'np.empty', (['(N, J)'], {}), '((N, J))\n', (... |
#Contains the functions needed to process both chords and regularized beards
# proc_chords is used for chords
#proc_beard_regularize for generating beards
#proc_pdf saves pdfs of a variable below cloud base
#Both have a large overlap, but I split them in two to keep the one script from getting to confusing.
import nu... | [
"numpy.sqrt",
"math.floor",
"numpy.hstack",
"numpy.log",
"scipy.interpolate.interp1d",
"numpy.array",
"sys.exit",
"scipy.interpolate.interp2d",
"numpy.mean",
"numpy.savez",
"numpy.histogram",
"numpy.where",
"netCDF4.Dataset",
"numpy.asarray",
"numpy.max",
"numpy.exp",
"numpy.linspace... | [((2599, 2614), 'time.time', 'ttiimmee.time', ([], {}), '()\n', (2612, 2614), True, 'import time as ttiimmee\n'), ((2799, 2836), 'numpy.array', 'np.array', (['[5, 10, 35, 50, 65, 90, 95]'], {}), '([5, 10, 35, 50, 65, 90, 95])\n', (2807, 2836), True, 'import numpy as np\n'), ((4604, 4636), 'netCDF4.Dataset', 'Dataset', ... |
"""D. mel housekeeping genes based on tau.
Uses the intersection of w1118 and orgR to create a list of
D. mel housekeeping genes.
"""
import os
from functools import partial
import pandas as pd
from larval_gonad.io import pickle_load, pickle_dump
def main():
# Load mapping of YOgn to FBgn
annot = pickle_loa... | [
"larval_gonad.io.pickle_load",
"functools.partial",
"os.getenv"
] | [((310, 347), 'larval_gonad.io.pickle_load', 'pickle_load', (['snakemake.input.annot[0]'], {}), '(snakemake.input.annot[0])\n', (321, 347), False, 'from larval_gonad.io import pickle_load, pickle_dump\n'), ((912, 943), 'os.getenv', 'os.getenv', (['"""SNAKE_DEBUG"""', '(False)'], {}), "('SNAKE_DEBUG', False)\n", (921, 9... |
#!/usr/bin/env python3
"""
Usage::
usage: auth.py [-h] [{google,apple,github,jwt}] [jwt]
Login to your comma account
positional arguments:
{google,apple,github,jwt}
jwt
optional arguments:
-h, --help show this help message and exit
Examples::
./auth.py # Log in with google accou... | [
"argparse.ArgumentParser",
"tools.lib.auth_config.set_token",
"webbrowser.open",
"urllib.parse.parse_qs",
"tools.lib.api.CommaApi",
"tools.lib.auth_config.get_token",
"urllib.parse.urlencode",
"pprint.pprint"
] | [((2877, 2910), 'webbrowser.open', 'webbrowser.open', (['oauth_uri'], {'new': '(2)'}), '(oauth_uri, new=2)\n', (2892, 2910), False, 'import webbrowser\n'), ((3563, 3629), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Login to your comma account"""'}), "(description='Login to your comma ... |
#! /usr/bin/env python3
"""Parse through the simulated sequencing group specific kmer counts."""
import argparse as ap
from collections import OrderedDict
import glob
import gzip
import os
import sys
import time
import numpy as np
import multiprocessing as mp
SAMPLES = OrderedDict()
KMERS = {}
HAMMING = OrderedDict()
... | [
"os.path.exists",
"collections.OrderedDict",
"numpy.median",
"numpy.mean",
"argparse.ArgumentParser",
"gzip.open",
"numpy.array",
"os.path.basename"
] | [((271, 284), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (282, 284), False, 'from collections import OrderedDict\n'), ((306, 319), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (317, 319), False, 'from collections import OrderedDict\n'), ((1866, 1884), 'numpy.array', 'np.array', (['covera... |
from django.contrib import admin
from .models import Songs
admin.site.register(Songs)
# Register your models here.
| [
"django.contrib.admin.site.register"
] | [((60, 86), 'django.contrib.admin.site.register', 'admin.site.register', (['Songs'], {}), '(Songs)\n', (79, 86), False, 'from django.contrib import admin\n')] |
# -*- coding: utf-8 -*-
import os
import sys
import time
import subprocess
import wx
import ConfigParser
from wx.lib.mixins.listctrl import getListCtrlSelection
from wx.lib.pubsub import pub
from gui.RootGUI import RootGUI
from StepsDialog import StepsDialog
from PlotFrame import PlotFuncFrame, PlotCorrFrame
import i... | [
"sshutils.getRemoteDir",
"time.clock",
"interface.dataClasses",
"sshutils.getMount",
"StepsDialog.StepsDialog",
"ConfigParser.ConfigParser",
"sshutils.removeFile",
"os.sep.join",
"sys.exit",
"wx.lib.pubsub.pub.sendMessage",
"sshutils.copyFile",
"os.walk",
"PlotFrame.PlotCorrFrame",
"interf... | [((614, 637), 'interface.dataClasses', 'interface.dataClasses', ([], {}), '()\n', (635, 637), False, 'import interface\n'), ((1645, 1679), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.local/shs"""'], {}), "('~/.local/shs')\n", (1663, 1679), False, 'import os\n'), ((1702, 1741), 'os.path.join', 'os.path.join', (... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-06 10:07
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_prices.models
class Migration(migrations.Migration):
dependencies = [
... | [
"django.db.models.EmailField",
"django.db.models.ForeignKey",
"django.db.migrations.AlterModelOptions",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((392, 532), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""deliverygroup"""', 'options': "{'verbose_name': 'Delivery Group', 'verbose_name_plural': 'Delivery Groups'}"}), "(name='deliverygroup', options={'verbose_name':\n 'Delivery Group', 'verbose_name_plural': 'Delive... |
from llvmlite import ir
import xml.etree.ElementTree as et
int32 = ir.IntType(32)
int64 = ir.IntType(64)
int1 = ir.IntType(1)
void_type = ir.VoidType()
function_names = []
registers, functions, uniques, extracts = {}, {}, {}, {}
internal_functions = {}
memory = {}
flags = ["ZF", "CF", "OF", "SF"]
pointers = ["RSP", "R... | [
"llvmlite.ir.VoidType",
"xml.etree.ElementTree.parse",
"llvmlite.ir.Constant",
"llvmlite.ir.FunctionType",
"llvmlite.ir.IRBuilder",
"llvmlite.ir.IntType",
"llvmlite.ir.Function",
"llvmlite.ir.Module"
] | [((68, 82), 'llvmlite.ir.IntType', 'ir.IntType', (['(32)'], {}), '(32)\n', (78, 82), False, 'from llvmlite import ir\n'), ((91, 105), 'llvmlite.ir.IntType', 'ir.IntType', (['(64)'], {}), '(64)\n', (101, 105), False, 'from llvmlite import ir\n'), ((113, 126), 'llvmlite.ir.IntType', 'ir.IntType', (['(1)'], {}), '(1)\n', ... |
import wx
import wx.adv
import random
import util
import config
import time
import datetime
import threading
import requests
import json
from functools import partial
class ReqeusterThread(threading.Thread):
# https://www.oreilly.com/library/view/python-cookbook/0596001673/ch06s03.html
def __init__(self, ... | [
"requests.post",
"util.combine_datetime",
"wx.ListBox",
"threading.Thread.join",
"wx.Panel.__init__",
"datetime.timedelta",
"threading.Thread.__init__",
"wx.CheckBox",
"wx.SystemSettings.GetFont",
"wx.adv.TimePickerCtrl",
"random.randint",
"wx.adv.DatePickerCtrl",
"threading.currentThread",
... | [((364, 406), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {'name': 'name'}), '(self, name=name)\n', (389, 406), False, 'import threading\n'), ((442, 459), 'threading.Event', 'threading.Event', ([], {}), '()\n', (457, 459), False, 'import threading\n'), ((1280, 1316), 'threading.Thread.join', 't... |
import copy
import sys
PLAYER1, PLAYER2, EMPTY, BLOCKED = [0, 1, 2, 3]
S_PLAYER1, S_PLAYER2, S_EMPTY, S_BLOCKED, = ['0', '1', '.', 'x']
CHARTABLE = [(PLAYER1, S_PLAYER1), (PLAYER2, S_PLAYER2), (EMPTY, S_EMPTY), (BLOCKED, S_BLOCKED)]
DIRS = [
((-1, 0), "up"),
((1, 0), "down"),
((0, 1), "right"),
((0, ... | [
"sys.stderr.write",
"sys.stderr.flush"
] | [((3157, 3179), 'sys.stderr.write', 'sys.stderr.write', (['"""\n"""'], {}), "('\\n')\n", (3173, 3179), False, 'import sys\n'), ((3188, 3206), 'sys.stderr.flush', 'sys.stderr.flush', ([], {}), '()\n', (3204, 3206), False, 'import sys\n'), ((2931, 2952), 'sys.stderr.write', 'sys.stderr.write', (['"""!"""'], {}), "('!')\n... |
import sys
sys.setrecursionlimit(10000)
def dfs(r, c):
global visit
visit[r][c] = True
mov = [(-1, 0), (0, -1), (1, 0), (0, 1)]
for i in range(4):
dr, dc = mov[i]
nr, nc = r + dr, c + dc
if 0 <= nr < N and 0 <= nc < M and visit[nr][nc] == False and board[nr][nc] == 1:
... | [
"sys.setrecursionlimit"
] | [((12, 40), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10000)'], {}), '(10000)\n', (33, 40), False, 'import sys\n')] |
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PATH, CONF_USERNAME
DOMAIN = "vaddio_conferenceshot"
DATA_SCHEMA = vol.Schema(
{
vol.Required(CONF_HOST): cv.string,
vol.Required(CONF_USERNAME): cv.string,... | [
"voluptuous.Required"
] | [((237, 260), 'voluptuous.Required', 'vol.Required', (['CONF_HOST'], {}), '(CONF_HOST)\n', (249, 260), True, 'import voluptuous as vol\n'), ((281, 308), 'voluptuous.Required', 'vol.Required', (['CONF_USERNAME'], {}), '(CONF_USERNAME)\n', (293, 308), True, 'import voluptuous as vol\n'), ((329, 356), 'voluptuous.Required... |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) <NAME> <<EMAIL>>
# This program is published under a GPLv2 license
"""
Implementation of the configuration object.
"""
from __future__ import absolute_import
from __future__ import print_function
import functo... | [
"scapy.modules.six.iterkeys",
"scapy.error.log_scapy.warning",
"cryptography.hazmat.primitives.asymmetric.x25519.X25519PrivateKey.generate",
"scapy.error.warning",
"os.getenv",
"re.match",
"scapy.error.ScapyInvalidPlatformException",
"functools.partial",
"scapy.modules.six.iteritems",
"scapy.error... | [((11229, 11273), 're.match', 're.match', (['version_regexp', 'module.__version__'], {}), '(version_regexp, module.__version__)\n', (11237, 11273), False, 'import re\n'), ((16234, 16257), 'scapy.error.log_scapy.setLevel', 'log_scapy.setLevel', (['val'], {}), '(val)\n', (16252, 16257), False, 'from scapy.error import lo... |
import kopf
from .functions import global_logger, reconcile_secret
@kopf.on.event("", "v1", "secrets")
def injector_secret_event(type, event, logger, **_):
obj = event["object"]
namespace = obj["metadata"]["namespace"]
name = obj["metadata"]["name"]
# If secret already exists, indicated by type bein... | [
"kopf.on.event"
] | [((71, 105), 'kopf.on.event', 'kopf.on.event', (['""""""', '"""v1"""', '"""secrets"""'], {}), "('', 'v1', 'secrets')\n", (84, 105), False, 'import kopf\n')] |
from django.contrib import admin
from django.urls import path,include
from django.views.generic import TemplateView
from .views import Index,SignUp,UserDashboard,AdminDashboard,logout,showAdminData,deleteuser,activeUser,deactiveUser,UserDetailEdit,uploadImage
# from .views import Index,UserDashboard,SignUp,AdminDashboa... | [
"django.urls.path"
] | [((734, 825), 'django.urls.path', 'path', (['"""admindashboard/showuserdata/deleteuser/<userId>"""', 'deleteuser'], {'name': '"""deleteuser"""'}), "('admindashboard/showuserdata/deleteuser/<userId>', deleteuser, name=\n 'deleteuser')\n", (738, 825), False, 'from django.urls import path, include\n'), ((824, 915), 'dj... |
from datetime import datetime
with open('/home/neo4j/neo4j-community-3.5.1/logs/debug.log', 'r') as log:
begin = []
end = []
for line in log:
if 'Index population started' in line:
begin.append(line[:23])
elif 'Index creation finished' in line:
end.append(line[:23])
if len(begin) == 0 or le... | [
"datetime.datetime.strptime"
] | [((573, 624), 'datetime.datetime.strptime', 'datetime.strptime', (['begin[i]', '"""%Y-%m-%d %H:%M:%S.%f"""'], {}), "(begin[i], '%Y-%m-%d %H:%M:%S.%f')\n", (590, 624), False, 'from datetime import datetime\n'), ((641, 690), 'datetime.datetime.strptime', 'datetime.strptime', (['end[i]', '"""%Y-%m-%d %H:%M:%S.%f"""'], {})... |
#!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Train a new model on one or across multiple GPUs.
"""
import collections
import logging
import math
import os
im... | [
"logging.getLogger",
"fairseq.options.parse_args_and_arch",
"fairseq.logging.metrics.get_meter",
"fairseq.options.get_training_parser",
"fairseq.checkpoint_utils.checkpoint_paths",
"torch.autograd.profiler.record_function",
"fairseq.logging.metrics.reset",
"os.remove",
"os.path.lexists",
"torch.cu... | [((1010, 1048), 'logging.getLogger', 'logging.getLogger', (['"""fairseq_cli.train"""'], {}), "('fairseq_cli.train')\n", (1027, 1048), False, 'import logging\n'), ((9829, 9855), 'fairseq.logging.metrics.aggregate', 'metrics.aggregate', (['"""train"""'], {}), "('train')\n", (9846, 9855), False, 'from fairseq.logging impo... |
import torch
import torch.nn as nn
from torch.nn import functional as F
from PIL import Image
import cv2 as cv
from matplotlib import cm
import numpy as np
class GradCAM:
"""
#### Args:
layer_name: module name (not child name), if None,
will use the last layer befor... | [
"numpy.uint8",
"PIL.Image.fromarray",
"numpy.asarray",
"torch.nn.functional.relu",
"torch.no_grad",
"cv2.resize",
"matplotlib.cm.get_cmap"
] | [((1644, 1659), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1657, 1659), False, 'import torch\n'), ((2015, 2032), 'torch.nn.functional.relu', 'F.relu', (['cam', '(True)'], {}), '(cam, True)\n', (2021, 2032), True, 'from torch.nn import functional as F\n'), ((2200, 2245), 'cv2.resize', 'cv.resize', (['cam', 'im... |
"""Generates a random terrain at Minitaur gym environment reset."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os, inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(os.path... | [
"numpy.random.random_sample",
"inspect.currentframe",
"math.sqrt",
"numpy.linalg.norm",
"os.sys.path.insert",
"os.path.dirname",
"numpy.array",
"numpy.cos",
"numpy.random.uniform",
"numpy.sin"
] | [((398, 430), 'os.sys.path.insert', 'os.sys.path.insert', (['(0)', 'parentdir'], {}), '(0, parentdir)\n', (416, 430), False, 'import os, inspect\n'), ((313, 340), 'os.path.dirname', 'os.path.dirname', (['currentdir'], {}), '(currentdir)\n', (328, 340), False, 'import os, inspect\n'), ((370, 396), 'os.path.dirname', 'os... |
import asyncio
async def searchDomains(domain, q):
domains = []
proc = await asyncio.create_subprocess_shell(f"dnsrecon -d {domain} -t crt", stdout=asyncio.subprocess.PIPE)
line = True
while line:
line = (await proc.stdout.readline()).decode('utf-8')
fields = line.split()
if len... | [
"asyncio.create_subprocess_shell"
] | [((86, 186), 'asyncio.create_subprocess_shell', 'asyncio.create_subprocess_shell', (['f"""dnsrecon -d {domain} -t crt"""'], {'stdout': 'asyncio.subprocess.PIPE'}), "(f'dnsrecon -d {domain} -t crt', stdout=\n asyncio.subprocess.PIPE)\n", (117, 186), False, 'import asyncio\n'), ((541, 641), 'asyncio.create_subprocess_... |
"""Riemannian and pseudo-Riemannian metrics."""
import math
import warnings
import autograd
import geomstats.backend as gs
from geomstats.geometry.connection import Connection
EPSILON = 1e-4
N_CENTERS = 10
TOLERANCE = 1e-5
N_REPETITIONS = 20
N_MAX_ITERATIONS = 50000
N_STEPS = 10
def loss(y_pred, y_true, metric):... | [
"geomstats.backend.amax",
"geomstats.backend.sqrt",
"autograd.jacobian",
"geomstats.backend.transpose",
"geomstats.backend.shape",
"geomstats.backend.to_ndarray",
"geomstats.backend.maximum",
"geomstats.backend.argmin",
"geomstats.backend.allclose",
"geomstats.backend.ndim",
"geomstats.backend.c... | [((1052, 1096), 'geomstats.backend.transpose', 'gs.transpose', (['inner_prod_mat'], {'axes': '(0, 2, 1)'}), '(inner_prod_mat, axes=(0, 2, 1))\n', (1064, 1096), True, 'import geomstats.backend as gs\n'), ((2163, 2191), 'geomstats.backend.linalg.inv', 'gs.linalg.inv', (['metric_matrix'], {}), '(metric_matrix)\n', (2176, ... |
import pandas as pd
from bokeh.models import HoverTool
from bokeh.models.formatters import DatetimeTickFormatter
from bokeh.palettes import Plasma256
from bokeh.plotting import figure, ColumnDataSource
from app import db
from app.decorators import data_quality
# creates your plot
date_formatter = DatetimeTickFormatt... | [
"bokeh.plotting.ColumnDataSource",
"bokeh.plotting.figure",
"bokeh.models.formatters.DatetimeTickFormatter",
"app.decorators.data_quality",
"pandas.read_sql",
"bokeh.models.HoverTool"
] | [((301, 535), 'bokeh.models.formatters.DatetimeTickFormatter', 'DatetimeTickFormatter', ([], {'microseconds': "['%f']", 'milliseconds': "['%S.%2Ns']", 'seconds': "[':%Ss']", 'minsec': "[':%Mm:%Ss']", 'minutes': "['%H:%M:%S']", 'hourmin': "['%H:%M:']", 'hours': "['%H:%M']", 'days': "['%d %b']", 'months': "['%d %b %Y']",... |
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
path_results = '../results/images/'
# this function receives a dataset with binary target and it will graph a hist of values
def graph_target(data,name="target",figsize=(6,4),title_name=None,color_text="white",save=False,name... | [
"matplotlib.pyplot.hist",
"matplotlib.pyplot.figure",
"seaborn.countplot",
"matplotlib.pyplot.title",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((354, 381), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (364, 381), True, 'import matplotlib.pyplot as plt\n'), ((583, 615), 'seaborn.countplot', 'sns.countplot', ([], {'x': 'name', 'data': 'data'}), '(x=name, data=data)\n', (596, 615), True, 'import seaborn as sns\n... |
from django.core.exceptions import ValidationError
from django.utils.deconstruct import deconstructible
from django.utils.translation import ugettext_lazy as _
class BlacklistValidator:
blacklist = []
def __call__(self, value):
# Validation logic
if value in self.blacklist:
raise... | [
"django.utils.translation.ugettext_lazy"
] | [((354, 401), 'django.utils.translation.ugettext_lazy', '_', (['"""This slug has an invalid value: %(value)s."""'], {}), "('This slug has an invalid value: %(value)s.')\n", (355, 401), True, 'from django.utils.translation import ugettext_lazy as _\n')] |
import _winreg
import os
def get_shared_cache_folder():
"""
Look in the registry for the configured cache folder.
If there is no entry, then we create one.
:return:
"""
_winreg.aReg = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER)
try:
key = _winreg.OpenKey(_winreg.aReg, ... | [
"_winreg.CreateKey",
"os.makedirs",
"_winreg.QueryValueEx",
"_winreg.OpenKey",
"os.path.normpath",
"os.path.isdir",
"_winreg.ConnectRegistry",
"_winreg.SetValueEx"
] | [((210, 266), '_winreg.ConnectRegistry', '_winreg.ConnectRegistry', (['None', '_winreg.HKEY_CURRENT_USER'], {}), '(None, _winreg.HKEY_CURRENT_USER)\n', (233, 266), False, 'import _winreg\n'), ((779, 838), '_winreg.CreateKey', '_winreg.CreateKey', (['_winreg.aReg', '"""SOFTWARE\\\\CCP\\\\EVEONLINE"""'], {}), "(_winreg.a... |
#!/usr/bin/env python3
from setuptools import setup, find_packages
setup(name='awspk',
version='0.1',
description='A aws cli pen knife with loads of interested stuff',
author='<NAME>',
author_email='<EMAIL>',
py_modules=['awspk'],
license='LICENSE',
)
| [
"setuptools.setup"
] | [((69, 260), 'setuptools.setup', 'setup', ([], {'name': '"""awspk"""', 'version': '"""0.1"""', 'description': '"""A aws cli pen knife with loads of interested stuff"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'py_modules': "['awspk']", 'license': '"""LICENSE"""'}), "(name='awspk', version='0.1', des... |
# Xlib.display -- high level display object
#
# Copyright (C) 2000 <NAME> <<EMAIL>>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your o... | [
"six.create_unbound_method",
"types.MethodType"
] | [((8110, 8142), 'types.MethodType', 'types.MethodType', (['function', 'self'], {}), '(function, self)\n', (8126, 8142), False, 'import types\n'), ((9973, 10009), 'six.create_unbound_method', 'create_unbound_method', (['function', 'cls'], {}), '(function, cls)\n', (9994, 10009), False, 'from six import create_unbound_me... |
from xagents import a2c, acer, ddpg, dqn, ppo, td3, trpo
from xagents.a2c.agent import A2C
from xagents.acer.agent import ACER
from xagents.base import OffPolicy
from xagents.ddpg.agent import DDPG
from xagents.dqn.agent import DQN
from xagents.ppo.agent import PPO
from xagents.td3.agent import TD3
from xagents.trpo.ag... | [
"xagents.utils.common.register_models"
] | [((859, 882), 'xagents.utils.common.register_models', 'register_models', (['agents'], {}), '(agents)\n', (874, 882), False, 'from xagents.utils.common import register_models\n')] |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
from mmpt.utils import recursive_config
class BaseJob(object):
def __init__(self, yaml_file, dryrun=False):
self.yaml_... | [
"mmpt.utils.recursive_config",
"mmpt.utils.load_config"
] | [((359, 386), 'mmpt.utils.recursive_config', 'recursive_config', (['yaml_file'], {}), '(yaml_file)\n', (375, 386), False, 'from mmpt.utils import recursive_config\n'), ((2216, 2255), 'mmpt.utils.load_config', 'load_config', ([], {'config_file': 'self.yaml_file'}), '(config_file=self.yaml_file)\n', (2227, 2255), False, ... |
import os.path
from tron import g, hub
from tron.Hub.Command.Encoders.ASCIICmdEncoder import ASCIICmdEncoder
from tron.Hub.Nub.TCCShellNub import TCCShellNub
from tron.Hub.Reply.Decoders.ASCIIReplyDecoder import ASCIIReplyDecoder
name = 'tcc'
def start(poller):
stop()
initCmds = ('show version', 'show us... | [
"tron.Hub.Reply.Decoders.ASCIIReplyDecoder.ASCIIReplyDecoder",
"tron.hub.dropActor",
"tron.Hub.Command.Encoders.ASCIICmdEncoder.ASCIICmdEncoder",
"tron.hub.addActor",
"tron.hub.findActor"
] | [((547, 616), 'tron.Hub.Reply.Decoders.ASCIIReplyDecoder.ASCIIReplyDecoder', 'ASCIIReplyDecoder', ([], {'EOL': "'\\r'", 'stripChars': '"""\n"""', 'CIDfirst': '(False)', 'debug': '(1)'}), "(EOL='\\r', stripChars='\\n', CIDfirst=False, debug=1)\n", (564, 616), False, 'from tron.Hub.Reply.Decoders.ASCIIReplyDecoder import... |
# coding: utf-8
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
import filecmp
import json
import pytest
import oci
import services.object_storage.src.oci_cli_object_storage as oci_cli_object_storage
import os
import random
import shutil
import six
import string
from tests import util
fr... | [
"pytest.fixture",
"mimetypes.guess_type",
"os.walk",
"os.path.exists",
"tests.util.invoke_command",
"os.path.normpath",
"tests.util.random_number_string",
"random.randint",
"tests.util.create_large_file",
"json.loads",
"random.choice",
"tests.test_config_container.create_vcr",
"oci.object_st... | [((1582, 1626), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'autouse': '(True)'}), "(scope='module', autouse=True)\n", (1596, 1626), False, 'import pytest\n'), ((1882, 1929), 'oci.object_storage.models.CreateBucketDetails', 'oci.object_storage.models.CreateBucketDetails', ([], {}), '()\n', (1927,... |
#!/usr/bin/python3
import random
import string
import time
import subprocess
import os
import redis
import threading
def generate_string(string_size, size, dict):
'''
https://stackoverflow.com/questions/16308989/fastest-method-to-generate-big-random-string-with-lower-latin-letters
'''
for i in ran... | [
"random.getrandbits",
"threading.Thread",
"time.time",
"redis.StrictRedis"
] | [((934, 1009), 'threading.Thread', 'threading.Thread', ([], {'target': 'generate_string', 'args': '(string_size, partition, d1)'}), '(target=generate_string, args=(string_size, partition, d1))\n', (950, 1009), False, 'import threading\n'), ((1021, 1096), 'threading.Thread', 'threading.Thread', ([], {'target': 'generate... |
"""
VAE on the swirl task.
Basically, VAEs don't work. It's probably because the prior isn't very good
and/or because the learning signal is pretty weak when both the encoder and
decoder change quickly. However, I tried also alternating between the two,
and that didn't seem to help.
"""
from torch.distributions import... | [
"torch.nn.ReLU",
"matplotlib.pyplot.plot",
"railrl.torch.pytorch_util.np_to_var",
"numpy.array",
"numpy.random.randn",
"numpy.cos",
"torch.nn.Linear",
"numpy.random.uniform",
"numpy.sin",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"torch.randn",
"matplotlib.pyplot.legend",
"ma... | [((621, 670), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': 'batch_size', 'low': '(0)', 'high': 'T'}), '(size=batch_size, low=0, high=T)\n', (638, 670), True, 'import numpy as np\n'), ((3240, 3260), 'railrl.torch.pytorch_util.np_to_var', 'ptu.np_to_var', (['batch'], {}), '(batch)\n', (3253, 3260), True, 'i... |
class FoodClassifier:
#Class Attributes:
#model - the underlying keras model
#labels - the labels to be associated with the activation of each output neuron.
#Labels must be the same size as the output layer of the neural network.
def __init__(self, modelpath, labels, min_confidence =... | [
"keras.preprocessing.image.img_to_array",
"keras.preprocessing.image.ImageDataGenerator",
"keras.optimizers.SGD",
"numpy.save",
"os.path.exists",
"os.listdir",
"os.path.isdir",
"numpy.vstack",
"keras.callbacks.EarlyStopping",
"numpy.argmax",
"keras.models.Sequential",
"keras.applications.resne... | [((3487, 3507), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '()\n', (3505, 3507), False, 'from keras.preprocessing.image import ImageDataGenerator\n'), ((3656, 3673), 'os.listdir', 'listdir', (['location'], {}), '(location)\n', (3663, 3673), False, 'from os import listdir\n'), ((5158... |
from exchange_sockets.exchange_websocket import ExchangeWebSocket
from singletones.custom_logger import MyLogger
import websocket
import threading
from time import sleep
from time import time
import json
import ssl
logger = MyLogger()
class BitstampWebsocket(ExchangeWebSocket):
def __init__(self, pairs_n_stream... | [
"json.loads",
"websocket.enableTrace",
"json.dumps",
"websocket.WebSocketApp",
"time.sleep",
"time.time",
"singletones.custom_logger.MyLogger"
] | [((225, 235), 'singletones.custom_logger.MyLogger', 'MyLogger', ([], {}), '()\n', (233, 235), False, 'from singletones.custom_logger import MyLogger\n'), ((1003, 1030), 'websocket.enableTrace', 'websocket.enableTrace', (['(True)'], {}), '(True)\n', (1024, 1030), False, 'import websocket\n'), ((1050, 1212), 'websocket.W... |
from datetime import datetime
from airflow import DAG
from airflow.operators.python import PythonOperator
# v0.0.1
from oss_know.libs.base_dict.variable_key import NEED_INIT_GITHUB_ISSUES_TIMELINE_REPOS, GITHUB_TOKENS, \
OPENSEARCH_CONN_DATA, PROXY_CONFS
from oss_know.libs.util.proxy import KuaiProxyService, Prox... | [
"datetime.datetime",
"airflow.models.Variable.get",
"oss_know.libs.util.proxy.ProxyManager",
"oss_know.libs.util.token.TokenManager",
"oss_know.libs.github.init_issues_timeline.init_sync_github_issues_timeline",
"oss_know.libs.util.proxy.GithubTokenProxyAccommodator",
"airflow.operators.python.PythonOpe... | [((769, 894), 'airflow.operators.python.PythonOperator', 'PythonOperator', ([], {'task_id': '"""op_scheduler_init_github_issues_timeline"""', 'python_callable': 'scheduler_init_github_issues_timeline'}), "(task_id='op_scheduler_init_github_issues_timeline',\n python_callable=scheduler_init_github_issues_timeline)\n"... |
# -*- coding: utf-8 -*-
"""
Unit tests for the Person plugin and its model
"""
from django import forms
from django.conf import settings
from django.test import TestCase
from cms.api import add_plugin, create_page
from cmsplugin_plain_text.cms_plugins import PlaintextPlugin
from djangocms_picture.cms_plugins import Pi... | [
"cms.api.create_page",
"richie.apps.core.helpers.create_i18n_page",
"richie.apps.core.factories.FilerImageFactory",
"richie.apps.core.factories.UserFactory",
"richie.apps.persons.factories.PersonFactory",
"cms.api.add_plugin"
] | [((1176, 1191), 'richie.apps.persons.factories.PersonFactory', 'PersonFactory', ([], {}), '()\n', (1189, 1191), False, 'from richie.apps.persons.factories import PersonFactory\n'), ((1240, 1318), 'cms.api.create_page', 'create_page', (['other_page_title', '"""richie/fullwidth.html"""', 'settings.LANGUAGE_CODE'], {}), "... |
# cython: language_level=3
# -*- coding: utf-8 -*-
from mathics.core.expression import Expression
from mathics.core.symbols import Atom, Symbol
from mathics.core.atoms import Integer
from mathics.builtin.base import MessageException
"""
This module provides some infrastructure to deal with SubExpressions.
"""
def... | [
"mathics.core.atoms.Integer",
"mathics.builtin.base.MessageException"
] | [((611, 651), 'mathics.builtin.base.MessageException', 'MessageException', (['"""Part"""', '"""span"""', 'leaves'], {}), "('Part', 'span', leaves)\n", (627, 651), False, 'from mathics.builtin.base import MessageException\n'), ((1177, 1216), 'mathics.builtin.base.MessageException', 'MessageException', (['"""Part"""', '"... |
import zipfile
import random
RAND_INT_RANGE = (1,100)
def wrf(fname):
with open(fname, 'w') as f:
for i in range(100):
f.write(str(random.randint(*RAND_INT_RANGE)))
fnames = []
for i in range(10):
fname = 'file' + str(i) + '.txt'
wrf(fname)
fnames.append(fname)
dirpaths = set()
wi... | [
"random.randint",
"zipfile.ZipFile"
] | [((323, 390), 'zipfile.ZipFile', 'zipfile.ZipFile', (['"""myzip.zip"""', '"""w"""'], {'compression': 'zipfile.ZIP_DEFLATED'}), "('myzip.zip', 'w', compression=zipfile.ZIP_DEFLATED)\n", (338, 390), False, 'import zipfile\n'), ((457, 488), 'random.randint', 'random.randint', (['*RAND_INT_RANGE'], {}), '(*RAND_INT_RANGE)\... |
import unittest
from django.test import Client
from wagtail.core.models import Page
from wagtail_managed404.models import PageNotFoundEntry
class TestMiddleware(unittest.TestCase):
"""Tests for `wagtail_app_pages` package."""
def setUp(self):
self.client = Client()
self.invalid_url = '/defi... | [
"wagtail.core.models.Page.objects.get",
"wagtail_managed404.models.PageNotFoundEntry.objects.all",
"wagtail_managed404.models.PageNotFoundEntry.objects.filter",
"django.test.Client"
] | [((278, 286), 'django.test.Client', 'Client', ([], {}), '()\n', (284, 286), False, 'from django.test import Client\n'), ((430, 455), 'wagtail.core.models.Page.objects.get', 'Page.objects.get', ([], {'depth': '(2)'}), '(depth=2)\n', (446, 455), False, 'from wagtail.core.models import Page\n'), ((1154, 1208), 'wagtail_ma... |
"""
Kronos: A simple scheduler for graduate training programme
Entities: User, Schedule, Rotation
"""
from operator import itemgetter
from datetime import datetime, timedelta
def getRotationCapacity(rotationId, startDate, endDate, assignments):
""" Calculate number of users assigned to a particular rotation dur... | [
"datetime.datetime.strptime",
"operator.itemgetter",
"datetime.timedelta"
] | [((367, 405), 'datetime.datetime.strptime', 'datetime.strptime', (['startDate', '"""%d%m%Y"""'], {}), "(startDate, '%d%m%Y')\n", (384, 405), False, 'from datetime import datetime, timedelta\n'), ((416, 452), 'datetime.datetime.strptime', 'datetime.strptime', (['endDate', '"""%d%m%Y"""'], {}), "(endDate, '%d%m%Y')\n", (... |
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
import contextlib
import sys
from pylint.utils import utils
class ArgumentPreprocessingError(Exception):
"""Raised if an error occurs during argument prep... | [
"pylint.utils.utils.get_python_path"
] | [((1694, 1720), 'pylint.utils.utils.get_python_path', 'utils.get_python_path', (['arg'], {}), '(arg)\n', (1715, 1720), False, 'from pylint.utils import utils\n')] |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
# -*- coding: utf-8 -*-
from django.test.utils import override_settings
from django.urls import reverse
from myuw.test.api import MyuwApiTest
@override_settings(
RESTCLIENTS_ADMIN_AUTH_MODULE='rc_django.tests.can_proxy_restcli... | [
"django.test.utils.override_settings",
"django.urls.reverse"
] | [((233, 325), 'django.test.utils.override_settings', 'override_settings', ([], {'RESTCLIENTS_ADMIN_AUTH_MODULE': '"""rc_django.tests.can_proxy_restclient"""'}), "(RESTCLIENTS_ADMIN_AUTH_MODULE=\n 'rc_django.tests.can_proxy_restclient')\n", (250, 325), False, 'from django.test.utils import override_settings\n'), ((45... |
from copy import copy, deepcopy
import sqlite3
from hashlib import md5
import time
import os
import os.path as osp
from base64 import b64encode, b64decode
from zlib import compress, decompress
import itertools as it
import logging
# instead of pickle we use dill, so we can save dynamically defined
# classes
import dil... | [
"os.path.exists",
"logging.warn",
"logging.debug",
"sqlite3.connect",
"os.makedirs",
"hashlib.md5",
"wepy.util.kv.KV",
"wepy.sim_manager.Manager",
"wepy.util.kv.gen_uri",
"os.path.join",
"base64.b64decode",
"os.path.realpath",
"wepy.orchestration.snapshot.SimApparatus",
"pdb.set_trace",
... | [((1857, 1881), 'wepy.util.kv.gen_uri', 'gen_uri', (['orch_path', 'mode'], {}), '(orch_path, mode)\n', (1864, 1881), False, 'from wepy.util.kv import KV, SQLITE3_INMEMORY_URI, gen_uri\n'), ((2022, 2098), 'sqlite3.connect', 'sqlite3.connect', (['self.db_uri'], {'uri': '(True)', 'timeout': 'self.SQLITE3_DEFAULT_TIMEOUT'}... |
"""
Created on Thu Oct 26 14:19:44 2017
@author: <NAME> - github.com/utkuozbulak
"""
import os
import numpy as np
import torch
from torch.optim import SGD
from torchvision import models
from misc_functions import preprocess_image, recreate_image, save_image
class ClassSpecificImageGeneration():
"""
Pro... | [
"torch.optim.SGD",
"misc_functions.recreate_image",
"misc_functions.save_image",
"misc_functions.preprocess_image",
"torchvision.models.alexnet",
"numpy.random.uniform"
] | [((2551, 2582), 'torchvision.models.alexnet', 'models.alexnet', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (2565, 2582), False, 'from torchvision import models\n'), ((698, 738), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(255)', '(224, 224, 3)'], {}), '(0, 255, (224, 224, 3))\n', (715, 738), Tru... |
#!/usr/bin/env python
"""
@file visum_mapDistricts.py
@author <NAME>
@author <NAME>
@date 2007-10-25
@version $Id$
This script reads a network and a dump file and
draws the network, coloring it by the values
found within the dump-file.
SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
Copyright (... | [
"os.path.abspath",
"math.sqrt",
"optparse.OptionParser"
] | [((1262, 1276), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (1274, 1276), False, 'from optparse import OptionParser\n'), ((1020, 1048), 'math.sqrt', 'math.sqrt', (['(xd * xd + yd * yd)'], {}), '(xd * xd + yd * yd)\n', (1029, 1048), False, 'import math\n'), ((833, 858), 'os.path.abspath', 'os.path.abspath... |
#!/usr/bin/env python3
######
# General Detector
# 06.12.2018 / Last Update: 20.05.2021
# LRB
######
import numpy as np
import os
import sys
import tensorflow as tf
import hashlib
import cv2
import magic
import PySimpleGUI as sg
import csv
import imagehash
import face_recognition
import subprocess
from itertools impo... | [
"cv2.rectangle",
"PySimpleGUI.OneLineProgressMeter",
"numpy.argsort",
"numpy.array",
"face_recognition.load_image_file",
"tensorflow.gfile.GFile",
"PySimpleGUI.OK",
"sys.path.append",
"tensorflow.Graph",
"PySimpleGUI.Popup",
"PySimpleGUI.Slider",
"pathlib.Path",
"subprocess.Popen",
"tensor... | [((16564, 16598), 'pathlib.Path', 'Path', (['"""Models/OpenVINO/age-gender"""'], {}), "('Models/OpenVINO/age-gender')\n", (16568, 16598), False, 'from pathlib import Path\n'), ((16953, 16961), 'openvino.inference_engine.IECore', 'IECore', ([], {}), '()\n', (16959, 16961), False, 'from openvino.inference_engine import I... |
import io
import numpy as np
import torch.utils.model_zoo as model_zoo
import torch.onnx
import torch.nn as nn
import torch.nn.init as init
# ================================================================ #
# Building the Model #
# ====================================... | [
"torch.nn.ReLU",
"PIL.Image.open",
"torch.nn.PixelShuffle",
"onnxruntime.InferenceSession",
"torch.utils.model_zoo.load_url",
"torch.nn.Conv2d",
"torch.nn.init.orthogonal_",
"onnx.load",
"torchvision.transforms.Resize",
"torchvision.transforms.ToTensor",
"torch.nn.init.calculate_gain",
"onnx.c... | [((3603, 3637), 'onnx.load', 'onnx.load', (['"""super_resolution.onnx"""'], {}), "('super_resolution.onnx')\n", (3612, 3637), False, 'import onnx\n'), ((3638, 3674), 'onnx.checker.check_model', 'onnx.checker.check_model', (['onnx_model'], {}), '(onnx_model)\n', (3662, 3674), False, 'import onnx\n'), ((3690, 3743), 'onn... |
"""
Laplacian of a compressed-sparse graph
"""
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# License: BSD
import numpy as np
from scipy.sparse import isspmatrix, coo_matrix
###############################################################################
# Graph laplacian
def l... | [
"scipy.sparse.isspmatrix",
"numpy.sqrt",
"numpy.asarray",
"numpy.issubdtype",
"numpy.concatenate",
"scipy.sparse.coo_matrix"
] | [((2298, 2317), 'scipy.sparse.isspmatrix', 'isspmatrix', (['csgraph'], {}), '(csgraph)\n', (2308, 2317), False, 'from scipy.sparse import isspmatrix, coo_matrix\n'), ((3169, 3210), 'numpy.concatenate', 'np.concatenate', (['[lap.row, diagonal_holes]'], {}), '([lap.row, diagonal_holes])\n', (3183, 3210), True, 'import nu... |
from collections import defaultdict
f = open("input.txt")
d = f.read()
houses = defaultdict(int,{(0,0):1})
cur = [0,0]
for c in d:
if c == "<":
cur[0] -= 1
if c == ">":
cur[0] += 1
if c == "v":
cur[1] += 1
if c == "^":
cur[1] -= 1
houses[tuple(cur)]+=1
print(len(hou... | [
"collections.defaultdict"
] | [((80, 109), 'collections.defaultdict', 'defaultdict', (['int', '{(0, 0): 1}'], {}), '(int, {(0, 0): 1})\n', (91, 109), False, 'from collections import defaultdict\n')] |
from .base import Controller
from .base import Action
import numpy as np
import pandas as pd
import logging
from collections import namedtuple
from tqdm import tqdm
logger = logging.getLogger(__name__)
CONTROL_QUEST = 'simglucose/params/Quest.csv'
PATIENT_PARA_FILE = 'simglucose/params/vpatient_params.csv'
ParamTup = ... | [
"logging.getLogger",
"numpy.random.normal",
"collections.namedtuple",
"pandas.read_csv",
"numpy.stack",
"numpy.random.uniform",
"pandas.DataFrame"
] | [((175, 202), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (192, 202), False, 'import logging\n'), ((320, 365), 'collections.namedtuple', 'namedtuple', (['"""ParamTup"""', "['basal', 'cf', 'cr']"], {}), "('ParamTup', ['basal', 'cf', 'cr'])\n", (330, 365), False, 'from collections import... |
#
# Copyright 2013 Rackspace Hosting.
#
# 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... | [
"six.text_type",
"six.add_metaclass"
] | [((612, 642), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (629, 642), False, 'import six\n'), ((4093, 4124), 'six.text_type', 'six.text_type', (['match_list[0][1]'], {}), '(match_list[0][1])\n', (4106, 4124), False, 'import six\n')] |
import logging
from typing import Match, Any, Dict
import aiohttp
from discord import Message
from MoMMI import comm_event, command, MChannel, always_command
logger = logging.getLogger(__name__)
@comm_event("ss14")
async def ss14_nudge(channel: MChannel, message: Any, meta: str) -> None:
try:
config: Dict... | [
"logging.getLogger",
"MoMMI.comm_event",
"MoMMI.always_command",
"aiohttp.ClientSession"
] | [((168, 195), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (185, 195), False, 'import logging\n'), ((198, 216), 'MoMMI.comm_event', 'comm_event', (['"""ss14"""'], {}), "('ss14')\n", (208, 216), False, 'from MoMMI import comm_event, command, MChannel, always_command\n'), ((841, 882), 'Mo... |
from torch.utils.data import DataLoader
from dataset.wiki_dataset import BERTDataset
from models.bert_model import *
from tqdm import tqdm
import numpy as np
import pandas as pd
import os
config = {}
config['train_corpus_path'] = './corpus/train_wiki.txt'
config['test_corpus_path'] = './corpus/test_wiki.txt'
config[... | [
"pandas.read_pickle",
"os.path.exists",
"os.listdir",
"dataset.wiki_dataset.BERTDataset",
"pandas.DataFrame",
"numpy.power",
"os.path.isfile",
"numpy.sum",
"numpy.zeros",
"os.mkdir",
"torch.utils.data.DataLoader",
"numpy.sin"
] | [((1318, 1497), 'dataset.wiki_dataset.BERTDataset', 'BERTDataset', ([], {'corpus_path': "config['train_corpus_path']", 'word2idx_path': "config['word2idx_path']", 'seq_len': 'self.max_seq_len', 'hidden_dim': 'bertconfig.hidden_size', 'on_memory': '(False)'}), "(corpus_path=config['train_corpus_path'], word2idx_path=con... |
import array
import struct
import time
from fcntl import ioctl
from typing import IO
from platypush.backend import Backend
from platypush.message.event.joystick import JoystickConnectedEvent, JoystickDisconnectedEvent, \
JoystickButtonPressedEvent, JoystickButtonReleasedEvent, JoystickAxisEvent
class JoystickLin... | [
"platypush.message.event.joystick.JoystickAxisEvent",
"platypush.message.event.joystick.JoystickDisconnectedEvent",
"fcntl.ioctl",
"array.array",
"time.sleep",
"struct.unpack",
"platypush.message.event.joystick.JoystickConnectedEvent"
] | [((3326, 3352), 'array.array', 'array.array', (['"""B"""', '([0] * 64)'], {}), "('B', [0] * 64)\n", (3337, 3352), False, 'import array\n'), ((3552, 3573), 'array.array', 'array.array', (['"""B"""', '[0]'], {}), "('B', [0])\n", (3563, 3573), False, 'import array\n'), ((3582, 3609), 'fcntl.ioctl', 'ioctl', (['dev', '(214... |
from flask import Flask
app = Flask(_name_)
@app.route('/')
def hello():
return 'welcome to my watchlist' | [
"flask.Flask"
] | [((30, 43), 'flask.Flask', 'Flask', (['_name_'], {}), '(_name_)\n', (35, 43), False, 'from flask import Flask\n')] |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django_tablib.admin import TablibAdmin
from jazzpos.models import Customer, Patient, Store, CustomerType, StoreSettings
from jazzpos.models import UserProfile
class CustomerAdmin(TablibAd... | [
"django.contrib.admin.site.unregister",
"django.contrib.admin.site.register"
] | [((687, 731), 'django.contrib.admin.site.register', 'admin.site.register', (['Customer', 'CustomerAdmin'], {}), '(Customer, CustomerAdmin)\n', (706, 731), False, 'from django.contrib import admin\n'), ((732, 774), 'django.contrib.admin.site.register', 'admin.site.register', (['Patient', 'PatientAdmin'], {}), '(Patient,... |
# Basic training configuration file
from torch.optim import RMSprop
from torch.optim.lr_scheduler import MultiStepLR
from torchvision.transforms import RandomHorizontalFlip, Compose
from torchvision.transforms import RandomResizedCrop, RandomAffine, RandomApply
from torchvision.transforms import ColorJitter, ToTensor, ... | [
"torchvision.transforms.RandomAffine",
"torch.optim.lr_scheduler.MultiStepLR",
"models.inceptionresnetv2_ssd_like.FurnitureInceptionResNetV4350SSDLike_v3",
"common.data_loaders.get_data_loader",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.ColorJitter",
"torchvision.transforms.... | [((1033, 1096), 'common.dataset.FilesFromCsvDataset', 'FilesFromCsvDataset', (['"""output/unique_filtered_train_dataset.csv"""'], {}), "('output/unique_filtered_train_dataset.csv')\n", (1052, 1096), False, 'from common.dataset import FilesFromCsvDataset\n'), ((1112, 1251), 'common.data_loaders.get_data_loader', 'get_da... |
#!/usr/bin/env python
#
# Author: <NAME> <<EMAIL>>
#
'''
A simple example to run MCSCF with background charges.
'''
import numpy
from pyscf import gto, scf, mcscf, qmmm
mol = gto.M(atom='''
C 1.1879 -0.3829 0.0000
C 0.0000 0.5526 0.0000
O -1.1867 -0.2472 0.0000
H -1.9237 0.3850 0.0000
H ... | [
"pyscf.qmmm.mm_charge",
"pyscf.gto.M",
"numpy.random.random",
"pyscf.mcscf.CASSCF",
"pyscf.mcscf.CASCI",
"numpy.random.seed",
"pyscf.scf.RHF",
"numpy.arange"
] | [((178, 526), 'pyscf.gto.M', 'gto.M', ([], {'atom': '"""\nC 1.1879 -0.3829 0.0000\nC 0.0000 0.5526 0.0000\nO -1.1867 -0.2472 0.0000\nH -1.9237 0.3850 0.0000\nH 2.0985 0.2306 0.0000\nH 1.1184 -1.0093 0.8869\nH 1.1184 -1.0093 -0.8869\nH -0.0227 1.1812 0.8852\nH ... |
import datetime
from decimal import Decimal, ROUND_DOWN, ROUND_UP
import logging
import re
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator
from django.utils import formats
from django.utils.cache import patch_cache_control
from djang... | [
"logging.getLogger",
"django.utils.dateformat.format",
"django.utils.cache.patch_cache_control",
"mtp_common.auth.api_client.get_authenticated_api_session",
"re.compile",
"mtp_common.auth.urljoin",
"datetime.datetime.strptime",
"django.utils.translation.gettext_lazy",
"django.utils.encoding.force_te... | [((674, 698), 'logging.getLogger', 'logging.getLogger', (['"""mtp"""'], {}), "('mtp')\n", (691, 698), False, 'import logging\n'), ((720, 776), 're.compile', 're.compile', (['"""^[a-z]\\\\d\\\\d\\\\d\\\\d[a-z]{2}$"""', 're.IGNORECASE'], {}), "('^[a-z]\\\\d\\\\d\\\\d\\\\d[a-z]{2}$', re.IGNORECASE)\n", (730, 776), False, ... |
# -*- coding: UTF-8 -*-
import os
this_file_path = os.path.dirname(os.path.realpath(__file__))
MODELS_DIR = os.path.join(this_file_path, "models/")
| [
"os.path.realpath",
"os.path.join"
] | [((111, 150), 'os.path.join', 'os.path.join', (['this_file_path', '"""models/"""'], {}), "(this_file_path, 'models/')\n", (123, 150), False, 'import os\n'), ((69, 95), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (85, 95), False, 'import os\n')] |
from web.api import BaseAPI
from utils import mongo
import json
class DataApi(BaseAPI):
def __init__(self):
BaseAPI.__init__(self)
self._db = mongo.MongoInterface()
self.query = {}
self.fields = {
"donation_count": "$influences.electoral_commission.donation_count",
... | [
"web.api.BaseAPI.__init__",
"utils.mongo.MongoInterface"
] | [((122, 144), 'web.api.BaseAPI.__init__', 'BaseAPI.__init__', (['self'], {}), '(self)\n', (138, 144), False, 'from web.api import BaseAPI\n'), ((164, 186), 'utils.mongo.MongoInterface', 'mongo.MongoInterface', ([], {}), '()\n', (184, 186), False, 'from utils import mongo\n')] |
# 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... | [
"netaddr.IPNetwork",
"os.path.exists",
"neutron_lib.api.validators.is_attr_set",
"collections.namedtuple",
"re.search",
"oslo_utils.netutils.is_valid_ipv6",
"inspect.ismethod",
"neutron.common.ovn.exceptions.UnknownResourceType",
"neutron_lib.utils.net.is_port_trusted",
"os.path.join",
"neutron.... | [((1595, 1618), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (1608, 1618), False, 'from oslo_log import log\n'), ((1693, 1765), 'collections.namedtuple', 'collections.namedtuple', (['"""AddrPairsDiff"""', "['added', 'removed', 'changed']"], {}), "('AddrPairsDiff', ['added', 'removed', ... |
from django.urls import reverse
from consents.models import Consent, Term
from workshops.models import KnowledgeDomain, Person, Qualification
from workshops.tests.base import TestBase
class TestAutoUpdateProfile(TestBase):
def setUp(self):
self._setUpAirports()
self._setUpLessons()
self._... | [
"consents.models.Consent.objects.filter",
"workshops.models.Qualification.objects.create",
"consents.models.Term.objects.filter",
"django.urls.reverse",
"workshops.models.Person.objects.create_user",
"workshops.models.KnowledgeDomain.objects.create"
] | [((358, 470), 'workshops.models.Person.objects.create_user', 'Person.objects.create_user', ([], {'username': '"""user"""', 'personal': '""""""', 'family': '""""""', 'email': '"""<EMAIL>"""', 'password': '"""<PASSWORD>"""'}), "(username='user', personal='', family='', email=\n '<EMAIL>', password='<PASSWORD>')\n", (3... |
import numpy as np
import time
import cv2
import colorsys
import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras.layers import Activation, ReLU, Multiply
# Custom objects from backbones package https://github.com/david8862/keras-YOLOv3-model-set/tree/master/common/backbones
def mish(... | [
"cv2.rectangle",
"tensorflow.keras.layers.Activation",
"tensorflow.keras.layers.Multiply",
"tensorflow.keras.layers.ReLU",
"tensorflow.keras.backend.backend",
"colorsys.hsv_to_rgb",
"cv2.putText",
"numpy.array",
"tensorflow.keras.backend.sigmoid",
"numpy.random.seed",
"numpy.around",
"tensorfl... | [((1919, 1982), 'numpy.around', 'np.around', (['(base_anchors * target_shape[::-1] / base_shape[::-1])'], {}), '(base_anchors * target_shape[::-1] / base_shape[::-1])\n', (1928, 1982), True, 'import numpy as np\n'), ((2790, 2811), 'numpy.random.seed', 'np.random.seed', (['(10101)'], {}), '(10101)\n', (2804, 2811), True... |
import matplotlib.pyplot as plt
import numpy as np
import pickle
# import csv
# from collections import namedtuple
# from mpl_toolkits.mplot3d import Axes3D
# import matplotlib.animation as animation
# import matplotlib.colors as mc
class FEModel:
def __init__(self, name=None, hist_data=None):
self.name =... | [
"matplotlib.pyplot.plot",
"pickle.load",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.subplots"
] | [((9287, 9317), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(2)', 'ncols': '(3)'}), '(nrows=2, ncols=3)\n', (9299, 9317), True, 'import matplotlib.pyplot as plt\n'), ((9955, 9985), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(2)', 'ncols': '(3)'}), '(nrows=2, ncols=3)\n', (9967, 9985... |
#!/usr/bin/env python
import json
import sys
from gigamonkeys.spreadsheets import spreadsheets
spreadsheet_id = sys.argv[1]
ranges = sys.argv[2:]
data = spreadsheets().get(spreadsheet_id, include_grid_data=bool(ranges), ranges=ranges)
json.dump(data, sys.stdout, indent=2)
| [
"gigamonkeys.spreadsheets.spreadsheets",
"json.dump"
] | [((240, 277), 'json.dump', 'json.dump', (['data', 'sys.stdout'], {'indent': '(2)'}), '(data, sys.stdout, indent=2)\n', (249, 277), False, 'import json\n'), ((157, 171), 'gigamonkeys.spreadsheets.spreadsheets', 'spreadsheets', ([], {}), '()\n', (169, 171), False, 'from gigamonkeys.spreadsheets import spreadsheets\n')] |
import numpy as np
from sources import BaseSource
from sources.base import BaseSourceWrapper
from sources.preloaded import PreLoadedSource
import json
class WordsSource(BaseSource):
def __init__(self, source):
self._source = source
def __len__(self):
return len(self._source)
def _remove_... | [
"numpy.mean",
"json.loads",
"json.dumps",
"numpy.array",
"numpy.std"
] | [((2030, 2043), 'json.loads', 'json.loads', (['s'], {}), '(s)\n', (2040, 2043), False, 'import json\n'), ((2091, 2108), 'numpy.array', 'np.array', (["d['mu']"], {}), "(d['mu'])\n", (2099, 2108), True, 'import numpy as np\n'), ((2122, 2139), 'numpy.array', 'np.array', (["d['sd']"], {}), "(d['sd'])\n", (2130, 2139), True... |
"""
Defines the basic objects for CORE emulation: the PyCoreObj base class, along with PyCoreNode,
PyCoreNet, and PyCoreNetIf.
"""
import os
import shutil
import socket
import threading
from socket import AF_INET
from socket import AF_INET6
from core.data import NodeData, LinkData
from core.enumerations import LinkTy... | [
"core.misc.ipaddress.is_ipv4_address",
"os.makedirs",
"core.misc.ipaddress.IpAddress",
"threading.Lock",
"os.path.join",
"socket.inet_pton",
"core.data.NodeData",
"shutil.rmtree"
] | [((5487, 5814), 'core.data.NodeData', 'NodeData', ([], {'message_type': 'message_type', 'id': 'self.objid', 'node_type': 'self.apitype', 'name': 'self.name', 'emulation_id': 'self.objid', 'canvas': 'self.canvas', 'icon': 'self.icon', 'opaque': 'self.opaque', 'x_position': 'x', 'y_position': 'y', 'latitude': 'lat', 'lon... |
# External cracking script, part of https://github.com/mmmds/WirelessDiscoverCrackScan
import datetime
import subprocess
import os
### CONFIGURATION
HASHCAT_DIR = "C:\\hashcat-5.1.0"
HASHCAT_EXE = "hashcat64.exe"
LOG_FILE = "crack_log.txt"
DICT_DIR = "./dicts"
def load_dict_list():
for r,d,f in os.walk(DICT_DIR)... | [
"datetime.datetime.now",
"os.listdir",
"os.walk",
"os.getcwd"
] | [((303, 320), 'os.walk', 'os.walk', (['DICT_DIR'], {}), '(DICT_DIR)\n', (310, 320), False, 'import os\n'), ((946, 961), 'os.listdir', 'os.listdir', (['"""."""'], {}), "('.')\n", (956, 961), False, 'import os\n'), ((786, 809), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (807, 809), False, 'import... |
"""
Keep track of which LBRY Files are downloading and store their LBRY File specific metadata
"""
import logging
import os
from twisted.enterprise import adbapi
from twisted.internet import defer, task, reactor
from twisted.python.failure import Failure
from lbrynet.reflector.reupload import reflect_stream
from lbr... | [
"logging.getLogger",
"lbrynet.file_manager.EncryptedFileDownloader.ManagedEncryptedFileDownloaderFactory",
"twisted.internet.task.LoopingCall",
"twisted.internet.defer.returnValue",
"os.path.join",
"os.getcwd",
"os.path.isfile",
"lbrynet.reflector.reupload.reflect_stream",
"lbrynet.file_manager.Encr... | [((893, 920), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (910, 920), False, 'import logging\n'), ((1836, 1877), 'twisted.internet.task.LoopingCall', 'task.LoopingCall', (['self.reflect_lbry_files'], {}), '(self.reflect_lbry_files)\n', (1852, 1877), False, 'from twisted.internet import... |
# Copyright 2021, Yahoo
# Licensed under the terms of the Apache 2.0 license. See the LICENSE file in the project root for terms
import time
from typing import Dict, List, Optional, Type
from pydantic import validate_arguments
from ...app_logger import AppLogger
from ...testplan import SystemState
from ...testplan.... | [
"time.sleep"
] | [((5805, 5849), 'time.sleep', 'time.sleep', (['verification_plugin.delay_before'], {}), '(verification_plugin.delay_before)\n', (5815, 5849), False, 'import time\n'), ((7571, 7614), 'time.sleep', 'time.sleep', (['verification_plugin.delay_after'], {}), '(verification_plugin.delay_after)\n', (7581, 7614), False, 'import... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from vimeodl import __version__
from vimeodl.vimeo import VimeoLinkExtractor, VimeoDownloader
def test_version():
assert __version__ == '0.1.0'
def test_vimeo_link_extractor():
vm = VimeoLinkExtractor()
vm.extract()
| [
"vimeodl.vimeo.VimeoLinkExtractor"
] | [((239, 259), 'vimeodl.vimeo.VimeoLinkExtractor', 'VimeoLinkExtractor', ([], {}), '()\n', (257, 259), False, 'from vimeodl.vimeo import VimeoLinkExtractor, VimeoDownloader\n')] |
import numpy as np
import torch
import matplotlib.pyplot as plt
from torch import optim, nn
from pytorch.xor.multilayer_perceptron import MultilayerPerceptron
from pytorch.xor.utils import LABELS, get_toy_data, visualize_results, plot_intermediate_representations
input_size = 2
output_size = len(set(LABELS))
num_hidd... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"matplotlib.pyplot.savefig",
"torch.nn.CrossEntropyLoss",
"pytorch.xor.utils.get_toy_data",
"pytorch.xor.utils.plot_intermediate_representations",
"pytorch.xor.multilayer_perceptron.MultilayerPerceptron",
"pytorch.xor.utils.visualize_results",
"nump... | [((401, 424), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (418, 424), False, 'import torch\n'), ((425, 457), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['seed'], {}), '(seed)\n', (451, 457), False, 'import torch\n'), ((458, 478), 'numpy.random.seed', 'np.random.seed', (['seed... |
import pytest
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
@pytest.fixture(scope="function")
def browser():
options = webdriver.ChromeOptions()
options.add_argument('ignore-certificate-errors')
options.add_argument("--headless")
options.add_argument('--no-san... | [
"pytest.fixture",
"selenium.webdriver.ChromeOptions",
"webdriver_manager.chrome.ChromeDriverManager"
] | [((105, 137), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (119, 137), False, 'import pytest\n'), ((167, 192), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (190, 192), False, 'from selenium import webdriver\n'), ((496, 517), 'webdrive... |
import time
from datetime import date,datetime
from astral import LocationInfo
from astral.sun import sun
class CamLocation:
def __init__(self,lat,lon,info,country,timezone):
self.info = LocationInfo(info, country, timezone, lat, lon)
def is_night(self):
s = sun(self.info.observer, date=date.t... | [
"datetime.datetime.now",
"astral.LocationInfo",
"datetime.date.today"
] | [((200, 247), 'astral.LocationInfo', 'LocationInfo', (['info', 'country', 'timezone', 'lat', 'lon'], {}), '(info, country, timezone, lat, lon)\n', (212, 247), False, 'from astral import LocationInfo\n'), ((314, 326), 'datetime.date.today', 'date.today', ([], {}), '()\n', (324, 326), False, 'from datetime import date, d... |