code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from time import strftime, localtime
def NowTime():
return strftime("%m%d%H%M%S", localtime())
def TimeDiff(Timestring1, Timestring2): # Timestring1
m = int(Timestring1[0:2]) - int(Timestring2[0:2])
d = int(Timestring1[2:4]) - int(Timestring2[2:4])
h = int(Timestring1[4:6]) - int(Timestring2[4:6])
... | [
"time.localtime"
] | [((87, 98), 'time.localtime', 'localtime', ([], {}), '()\n', (96, 98), False, 'from time import strftime, localtime\n'), ((675, 686), 'time.localtime', 'localtime', ([], {}), '()\n', (684, 686), False, 'from time import strftime, localtime\n'), ((729, 740), 'time.localtime', 'localtime', ([], {}), '()\n', (738, 740), F... |
# coding=UTF-8
# ex:ts=4:sw=4:et=on
# Copyright (c) 2013, <NAME>
# All rights reserved.
# Complete license can be found in the LICENSE file.
import numpy as np
from scipy.special import erf
from math import sqrt
from .math_tools import sqrt2pi, sqrt8
def get_S(soller1, soller2):
_S = sqrt((soller1 * 0.5) ** 2 ... | [
"numpy.radians",
"math.sqrt",
"numpy.exp",
"scipy.special.erf",
"numpy.cos",
"numpy.sin"
] | [((294, 343), 'math.sqrt', 'sqrt', (['((soller1 * 0.5) ** 2 + (soller2 * 0.5) ** 2)'], {}), '((soller1 * 0.5) ** 2 + (soller2 * 0.5) ** 2)\n', (298, 343), False, 'from math import sqrt\n'), ((547, 566), 'numpy.sin', 'np.sin', (['range_theta'], {}), '(range_theta)\n', (553, 566), True, 'import numpy as np\n'), ((1247, 1... |
from PINN_Base.base_v1 import PINN_Base
import tensorflow as tf
import numpy as np
class Soft_Mesh(PINN_Base):
def __init__(self,
lower_bound,
upper_bound,
layers_approx,
layers_mesh,
**kwargs
):
assert... | [
"tensorflow.reduce_sum",
"numpy.abs",
"tensorflow.nn.softmax"
] | [((898, 919), 'tensorflow.nn.softmax', 'tf.nn.softmax', (['scores'], {}), '(scores)\n', (911, 919), True, 'import tensorflow as tf\n'), ((1610, 1656), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['(basis_functions * probs)'], {'axis': '(1)'}), '(basis_functions * probs, axis=1)\n', (1623, 1656), True, 'import tensorflow... |
import requests
from bs4 import BeautifulSoup
# Get a list of module urls from Ansible module list
def get_module_urls():
module_list_url_root = 'https://docs.ansible.com/ansible/latest/modules/'
module_list_url = f'{module_list_url_root}list_of_all_modules.html'
all_modules_page = requests.get(module_list... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((296, 325), 'requests.get', 'requests.get', (['module_list_url'], {}), '(module_list_url)\n', (308, 325), False, 'import requests\n'), ((338, 389), 'bs4.BeautifulSoup', 'BeautifulSoup', (['all_modules_page.text', '"""html.parser"""'], {}), "(all_modules_page.text, 'html.parser')\n", (351, 389), False, 'from bs4 impor... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.getter",
"pulumi.set",
"pulumi.ResourceOptions",
"pulumi.get"
] | [((5785, 5819), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""sparkVersion"""'}), "(name='sparkVersion')\n", (5798, 5819), False, 'import pulumi\n'), ((6372, 6416), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""autoterminationMinutes"""'}), "(name='autoterminationMinutes')\n", (6385, 6416), False, 'import p... |
# Copyright (c) 2020-2022 by Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel, and University of Kassel. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
import os
import numpy as np
import pandapipes as pp
i... | [
"numpy.abs",
"numpy.all",
"pandapipes.create_fluid_from_lib",
"os.path.join",
"pandapipes.create_junction",
"pandapipes.create_ext_grid",
"numpy.concatenate",
"pandapipes.create_pipe_from_parameters",
"pandapipes.pipeflow",
"pandapipes.create_empty_network",
"pandapipes.create_sink"
] | [((637, 690), 'os.path.join', 'os.path.join', (['test_path', '"""pipeflow_internals"""', '"""data"""'], {}), "(test_path, 'pipeflow_internals', 'data')\n", (649, 690), False, 'import os\n'), ((772, 802), 'pandapipes.create_empty_network', 'pp.create_empty_network', (['"""net"""'], {}), "('net')\n", (795, 802), True, 'i... |
# encoding: utf-8
"""
@author: sherlock
@contact: <EMAIL>
"""
from torch import nn
def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False)
| [
"torch.nn.Conv2d"
] | [((144, 233), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': '(3)', 'stride': 'stride', 'padding': '(1)', 'bias': '(False)'}), '(in_planes, out_planes, kernel_size=3, stride=stride, padding=1,\n bias=False)\n', (153, 233), False, 'from torch import nn\n')] |
from helium._impl import TextImpl
from helium._impl.selenium_wrappers import WebDriverWrapper
from tests.api import BrowserAT
class TextImplTest(BrowserAT):
def get_page(self):
return 'test_text_impl.html'
def test_empty_search_text_xpath(self):
xpath = TextImpl(WebDriverWrapper(self.driver))._get_search_text_xp... | [
"helium._impl.selenium_wrappers.WebDriverWrapper"
] | [((270, 299), 'helium._impl.selenium_wrappers.WebDriverWrapper', 'WebDriverWrapper', (['self.driver'], {}), '(self.driver)\n', (286, 299), False, 'from helium._impl.selenium_wrappers import WebDriverWrapper\n')] |
import json
import sys
from collections import defaultdict
from LifFileParser import LifFileParser
import copy
import re
# Split the tokens containing hyphen inside into separate tokens
# Return a new annotation list for LIF file
def split_hyphen(annotations):
update_annotations = []
current_id = 0
for ann ... | [
"LifFileParser.LifFileParser",
"re.split",
"json.load",
"copy.deepcopy"
] | [((3757, 3830), 're.split', 're.split', (['"""(\\\\^|\\\\?|-|#|\\\\+|\'|~|\\\\\\\\"|\\\\&|\\\\|)"""', "ann['features']['word']"], {}), '(\'(\\\\^|\\\\?|-|#|\\\\+|\\\'|~|\\\\\\\\"|\\\\&|\\\\|)\', ann[\'features\'][\'word\'])\n', (3765, 3830), False, 'import re\n'), ((7245, 7272), 'LifFileParser.LifFileParser', 'LifFileP... |
from django.contrib import admin
from .models import Variable, Importer
from .utils import import_mvl
class VariableAdmin(admin.ModelAdmin):
list_display = ('long_name', 'year', 'code', 'short_name', 'category',
'is_derived', 'is_revised', 'favorite', )
list_filter = ('code', 'short_name', 'year', 'f... | [
"datetime.datetime.now",
"django.contrib.admin.site.register"
] | [((1428, 1472), 'django.contrib.admin.site.register', 'admin.site.register', (['Variable', 'VariableAdmin'], {}), '(Variable, VariableAdmin)\n', (1447, 1472), False, 'from django.contrib import admin\n'), ((1847, 1891), 'django.contrib.admin.site.register', 'admin.site.register', (['Importer', 'ImporterAdmin'], {}), '(... |
## @file item.py
# @title Consumable Items
# @author <NAME>, <NAME>, <NAME>
# @date November 6 2018
import pygame
import random
from .spritesheet import *
from .constants import *
## @brief Consumable Item Class
# @detail This class is used for the creation of a random consumable item, spawned once an enemy has been ... | [
"pygame.mixer.Channel",
"pygame.Surface",
"pygame.mixer.pre_init",
"pygame.mixer.Sound",
"pygame.image.load",
"pygame.mixer.init",
"random.randint",
"pygame.transform.scale"
] | [((935, 959), 'pygame.Surface', 'pygame.Surface', (['[20, 15]'], {}), '([20, 15])\n', (949, 959), False, 'import pygame\n'), ((3016, 3057), 'pygame.mixer.pre_init', 'pygame.mixer.pre_init', (['(32000)', '(-16)', '(2)', '(512)'], {}), '(32000, -16, 2, 512)\n', (3037, 3057), False, 'import pygame\n'), ((3066, 3085), 'pyg... |
# -*- coding: utf-8 -*-
import setuptools
__version__ = "1.8.0+dd.2"
# read the contents of your readme file
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, "README.md"), "rb") as f:
long_description = f.read().decode("utf-8")
setuptools.setup(
... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((163, 185), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (175, 185), False, 'from os import path\n'), ((197, 235), 'os.path.join', 'path.join', (['this_directory', '"""README.md"""'], {}), "(this_directory, 'README.md')\n", (206, 235), False, 'from os import path\n'), ((632, 673), 'setuptool... |
from hijri_converter import helpers
def test_julian_to_ordinal():
assert helpers.jdn_to_ordinal(2447977) == 726552
def test_ordinal_to_julian():
assert helpers.ordinal_to_jdn(726552) == 2447977
def test_julian_to_reduced_julian():
assert helpers.jdn_to_rjd(2456087) == 56087
def test_reduced_julian_t... | [
"hijri_converter.helpers.ordinal_to_jdn",
"hijri_converter.helpers.jdn_to_rjd",
"hijri_converter.helpers.rjd_to_jdn",
"hijri_converter.helpers.jdn_to_ordinal"
] | [((79, 110), 'hijri_converter.helpers.jdn_to_ordinal', 'helpers.jdn_to_ordinal', (['(2447977)'], {}), '(2447977)\n', (101, 110), False, 'from hijri_converter import helpers\n'), ((164, 194), 'hijri_converter.helpers.ordinal_to_jdn', 'helpers.ordinal_to_jdn', (['(726552)'], {}), '(726552)\n', (186, 194), False, 'from hi... |
import ctypes
import pytest
import pyradamsa
import sys
import unittest
def test_lib_present():
assert len(pyradamsa.Radamsa.lib_path()) > 0, 'library not found'
def test_lib_symbols():
lib = ctypes.CDLL(pyradamsa.Radamsa.lib_path())
assert hasattr(lib, 'init')
assert hasattr(lib, 'radamsa')
asser... | [
"pyradamsa.Radamsa",
"pyradamsa.Radamsa.lib_path"
] | [((440, 467), 'pyradamsa.Radamsa', 'pyradamsa.Radamsa', (['(17)', '(2048)'], {}), '(17, 2048)\n', (457, 467), False, 'import pyradamsa\n'), ((533, 565), 'pyradamsa.Radamsa', 'pyradamsa.Radamsa', ([], {'mut_offset': '(19)'}), '(mut_offset=19)\n', (550, 565), False, 'import pyradamsa\n'), ((875, 894), 'pyradamsa.Radamsa'... |
"""
Definition of views.
"""
from datetime import datetime
from django.shortcuts import render
from django.http import HttpRequest
from . import models
import numpy as np
from . import predict_model as pm
import time
import random
def home(request):
"""Renders the home page."""
assert isinstance(request, Http... | [
"django.shortcuts.render",
"datetime.datetime.now",
"numpy.hstack"
] | [((27989, 28019), 'django.shortcuts.render', 'render', (['request', 'template_name'], {}), '(request, template_name)\n', (27995, 28019), False, 'from django.shortcuts import render\n'), ((28096, 28126), 'django.shortcuts.render', 'render', (['request', 'template_name'], {}), '(request, template_name)\n', (28102, 28126)... |
#!/usr/bin/env python
import os, time, select
from walt.common.tools import fd_copy, set_non_blocking
from walt.common.tty import set_tty_size, \
acquire_controlling_tty, tty_disable_echoctl
from walt.node.logs.flow import LogsFlowToServer
# See comments in node/sh/walt-monitor.
# This ... | [
"walt.node.logs.flow.LogsFlowToServer",
"os.open",
"walt.common.tools.set_non_blocking",
"os.fork",
"walt.common.tty.set_tty_size",
"walt.common.tools.fd_copy",
"os.setgid",
"select.select",
"os.close",
"os.openpty",
"walt.common.tty.tty_disable_echoctl",
"os.setuid",
"time.time",
"os.dup2... | [((802, 822), 'os.chdir', 'os.chdir', (["env['PWD']"], {}), "(env['PWD'])\n", (810, 822), False, 'import os, time, select\n'), ((827, 851), 'os.dup2', 'os.dup2', (['tty_slave_fd', '(0)'], {}), '(tty_slave_fd, 0)\n', (834, 851), False, 'import os, time, select\n'), ((856, 880), 'os.dup2', 'os.dup2', (['tty_slave_fd', '(... |
# -*- coding: utf-8 -*-
import math
import torch
from torch import nn
def build_activation(activation: str):
""" Builder function that returns a nn.module activation function.
:param activation: string defining the name of the activation function.
Activations available:
GELU, Swish + e... | [
"torch.sigmoid",
"math.sqrt",
"torch.pow"
] | [((793, 813), 'torch.sigmoid', 'torch.sigmoid', (['input'], {}), '(input)\n', (806, 813), False, 'import torch\n'), ((1670, 1692), 'math.sqrt', 'math.sqrt', (['(2 / math.pi)'], {}), '(2 / math.pi)\n', (1679, 1692), False, 'import math\n'), ((1711, 1726), 'torch.pow', 'torch.pow', (['x', '(3)'], {}), '(x, 3)\n', (1720, ... |
#!/usr/bin/python3
# Copyright 2022. FastyBird s.r.o.
#
# 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 re... | [
"logging.getLogger",
"fastybird_modbus_connector.types.DeviceAttribute.has_value",
"fastybird_modbus_connector.types.DeviceAttribute",
"re.compile",
"kink.inject",
"asyncio.sleep"
] | [((2241, 2265), 'kink.inject', 'inject', ([], {'alias': 'IConnector'}), '(alias=IConnector)\n', (2247, 2265), False, 'from kink import inject\n'), ((3274, 3300), 'logging.getLogger', 'logging.getLogger', (['"""dummy"""'], {}), "('dummy')\n", (3291, 3300), False, 'import logging\n'), ((14108, 14162), 're.compile', 're.c... |
import os
import argparse
import time
import gc
# spark imports
from pyspark.sql import SparkSession, Row
from pyspark.sql.functions import col, lower
from pyspark.ml.evaluation import RegressionEvaluator
from pyspark.ml.recommendation import ALS
class AlsRecommender:
"""
This a collaborative filtering recom... | [
"argparse.ArgumentParser",
"pyspark.ml.recommendation.ALS",
"pyspark.ml.evaluation.RegressionEvaluator",
"os.path.join",
"pyspark.sql.functions.col",
"gc.collect",
"pyspark.sql.SparkSession.builder.appName",
"time.time"
] | [((10676, 10771), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""Movie Recommender"""', 'description': '"""Run ALS Movie Recommender"""'}), "(prog='Movie Recommender', description=\n 'Run ALS Movie Recommender')\n", (10699, 10771), False, 'import argparse\n'), ((795, 885), 'pyspark.ml.recomm... |
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
ecalBarrelSimHitsValidation = DQMEDAnalyzer("EcalBarrelSimHitsValidation",
moduleLabelG4 = cms.string('g4SimHits'),
verbose = cms.untracked.bool(False),
ValidationCollection = cms.string('EcalValidInfo'),
... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.untracked.bool"
] | [((194, 217), 'FWCore.ParameterSet.Config.string', 'cms.string', (['"""g4SimHits"""'], {}), "('g4SimHits')\n", (204, 217), True, 'import FWCore.ParameterSet.Config as cms\n'), ((233, 258), 'FWCore.ParameterSet.Config.untracked.bool', 'cms.untracked.bool', (['(False)'], {}), '(False)\n', (251, 258), True, 'import FWCore... |
# Author: <NAME> (<EMAIL>), <NAME> (<EMAIL>)
# GitHub: https://github.com/chhwang/cmcl
# ==============================================================================
import tensorflow as tf
def feature_sharing(features):
"""Feature sharing operation.
Args:
features: List of hidden features from models.... | [
"tensorflow.random_uniform",
"tensorflow.variable_scope"
] | [((365, 401), 'tensorflow.variable_scope', 'tf.variable_scope', (['"""feature_sharing"""'], {}), "('feature_sharing')\n", (382, 401), True, 'import tensorflow as tf\n'), ((824, 848), 'tensorflow.random_uniform', 'tf.random_uniform', (['shape'], {}), '(shape)\n', (841, 848), True, 'import tensorflow as tf\n')] |
import fileinput
import math
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
import re
from scipy import interpolate # strait up linear interpolation, nothing fancy
import scipy.signal as signal
yaw_interp = None
pitch_interp = None
roll_interp = None
north_interp = None
east_interp = None
... | [
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"scipy.signal.filtfilt",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"scipy.signal.butter",
"scipy.interpolate.interp1d",
"numpy.array",
"matplotlib.pyplot.figure",
"fileinput.input",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
... | [((429, 450), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (440, 450), True, 'import pandas as pd\n'), ((839, 873), 'scipy.signal.butter', 'signal.butter', (['(2)', 'cutoff_hz'], {'fs': 'hz'}), '(2, cutoff_hz, fs=hz)\n', (852, 873), True, 'import scipy.signal as signal\n'), ((919, 970), 'scipy.... |
from typing import Optional
from django.db.models import QuerySet
from pydantic import BaseModel
# To convert from a django ORM model to a pydantic Model, provide a BaseModel with from_django() method to map fields
# from django to pydantic
from fastapi_pagination import resolve_params, create_page
from fastapi_pagi... | [
"fastapi_pagination.resolve_params",
"fastapi_pagination.create_page"
] | [((491, 513), 'fastapi_pagination.resolve_params', 'resolve_params', (['params'], {}), '(params)\n', (505, 513), False, 'from fastapi_pagination import resolve_params, create_page\n'), ((766, 799), 'fastapi_pagination.create_page', 'create_page', (['items', 'total', 'params'], {}), '(items, total, params)\n', (777, 799... |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2017, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | [
"numpy.prod",
"numpy.arange",
"htmresearch.algorithms.location_modules.SensorToBodyModule2D",
"numpy.append",
"numpy.array",
"collections.defaultdict",
"random.randint",
"htmresearch.algorithms.location_modules.BodyToSpecificObjectModule2D"
] | [((2479, 2507), 'numpy.array', 'np.array', (['[]'], {'dtype': '"""uint32"""'}), "([], dtype='uint32')\n", (2487, 2507), True, 'import numpy as np\n'), ((13192, 13220), 'collections.defaultdict', 'collections.defaultdict', (['int'], {}), '(int)\n', (13215, 13220), False, 'import collections\n'), ((2606, 2665), 'numpy.ap... |
"""
The system trains BERT (or any other transformer model like RoBERTa, DistilBERT etc.) on the SNLI + MultiNLI (AllNLI) dataset
with softmax loss function. At every 1000 training steps, the model is evaluated on the
STS benchmark dataset
Usage:
python training_nli.py
OR
python training_nli.py pretrained_transformer... | [
"os.path.exists",
"csv.DictReader",
"sentence_transformers.SentenceTransformer",
"sentence_transformers.util.http_get",
"sentence_transformers.models.Transformer",
"gzip.open",
"sentence_transformers.LoggingHandler",
"datetime.datetime.now",
"torch.utils.data.DataLoader",
"sentence_transformers.ev... | [((1877, 1907), 'sentence_transformers.models.Transformer', 'models.Transformer', (['model_name'], {}), '(model_name)\n', (1895, 1907), False, 'from sentence_transformers import models, losses\n'), ((2247, 2313), 'sentence_transformers.SentenceTransformer', 'SentenceTransformer', ([], {'modules': '[word_embedding_model... |
from django.contrib import admin, messages
from django.contrib.auth.admin import UserAdmin
from django.http import HttpResponse, HttpResponseRedirect
from django.urls import reverse
from django.utils.html import format_html
from django.utils.translation import gettext as _
from researcher_workspace.models import Permi... | [
"django.http.HttpResponseRedirect",
"django.utils.translation.gettext",
"django.urls.reverse",
"django.contrib.admin.site.register",
"django.contrib.admin.register",
"researcher_workspace.models.AROWhitelist.objects.is_username_whitelisted",
"researcher_workspace.models.remove_username_from_whitelist",
... | [((460, 493), 'django.contrib.admin.register', 'admin.register', (['PermissionRequest'], {}), '(PermissionRequest)\n', (474, 493), False, 'from django.contrib import admin, messages\n'), ((2140, 2163), 'django.contrib.admin.register', 'admin.register', (['Project'], {}), '(Project)\n', (2154, 2163), False, 'from django... |
import os
import tempfile
import subprocess
import logging
import uuid
import time
import socket
import numpy as np
import cclib
import rdkit
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import PeriodicTable
from rdkit.Chem.rdMolTransforms import GetBondLength
logging.getLogger("cclib").setL... | [
"logging.getLogger",
"numpy.clip",
"rdkit.Chem.AllChem.CalcNumRotatableBonds",
"cclib.io.ccread",
"subprocess.run",
"rdkit.Chem.AllChem.MMFFGetMoleculeProperties",
"socket.gethostname",
"rdkit.Chem.AllChem.AddHs",
"rdkit.Chem.GetPeriodicTable",
"rdkit.Chem.PeriodicTable.GetRcovalent",
"rdkit.Che... | [((289, 315), 'logging.getLogger', 'logging.getLogger', (['"""cclib"""'], {}), "('cclib')\n", (306, 315), False, 'import logging\n'), ((2400, 2431), 'rdkit.Chem.MolFromSmiles', 'Chem.MolFromSmiles', (['self.smiles'], {}), '(self.smiles)\n', (2418, 2431), False, 'from rdkit import Chem\n'), ((2446, 2470), 'rdkit.Chem.rd... |
# -*- coding: utf-8 -*-
from cleanup import cleaner
def main():
cleaner.books("data/scraper/book.csv")
cleaner.sections("data/scraper/section.csv")
cleaner.articles("data/scraper/article.csv",
"data/scraper/article_version.csv")
# cleaner.article_versions("data/scraper/article_ve... | [
"cleanup.cleaner.sections",
"cleanup.cleaner.books",
"cleanup.cleaner.articles"
] | [((71, 109), 'cleanup.cleaner.books', 'cleaner.books', (['"""data/scraper/book.csv"""'], {}), "('data/scraper/book.csv')\n", (84, 109), False, 'from cleanup import cleaner\n'), ((114, 158), 'cleanup.cleaner.sections', 'cleaner.sections', (['"""data/scraper/section.csv"""'], {}), "('data/scraper/section.csv')\n", (130, ... |
from werkzeug.security import generate_password_hash,check_password_hash
from . import db
from flask_login import UserMixin
from . import login_manager
from datetime import datetime
from dataclasses import dataclass
@login_manager.user_loader
def load_user(pitch_id):
return User.query.get(int(pitch_id))
# class... | [
"werkzeug.security.generate_password_hash",
"werkzeug.security.check_password_hash"
] | [((2407, 2439), 'werkzeug.security.generate_password_hash', 'generate_password_hash', (['password'], {}), '(password)\n', (2429, 2439), False, 'from werkzeug.security import generate_password_hash, check_password_hash\n'), ((2505, 2554), 'werkzeug.security.check_password_hash', 'check_password_hash', (['self.password_h... |
from rest_framework import serializers
from groups.models import AppGroup
from django.contrib.auth import get_user_model
User = get_user_model()
class AppGroupSerializer(serializers.ModelSerializer):
class Meta:
model = AppGroup
fields = (
'id', 'owner', 'name', 'group_category',
... | [
"django.contrib.auth.get_user_model"
] | [((130, 146), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (144, 146), False, 'from django.contrib.auth import get_user_model\n')] |
# smartmirror.py
from utils.display import displayWindow
from utils.weather import Weather
# from utils.train import Wmata
# from utils.clock import Clock
# weather = Weather()
# train = Wmata()
w = displayWindow()
w.root.mainloop()
| [
"utils.display.displayWindow"
] | [((203, 218), 'utils.display.displayWindow', 'displayWindow', ([], {}), '()\n', (216, 218), False, 'from utils.display import displayWindow\n')] |
from subject import *
from data_structure import *
import json as js
import networkx as nx
from graphviz import Digraph as dg
from draw_graph import *
from sys import exit, argv
from main import write_all_data_for_major
dataStructure = Data_structure()
graph = dataStructure.getGraph()
data = dataStructure... | [
"json.load",
"main.write_all_data_for_major"
] | [((3063, 3093), 'main.write_all_data_for_major', 'write_all_data_for_major', (['code'], {}), '(code)\n', (3087, 3093), False, 'from main import write_all_data_for_major\n'), ((1692, 1710), 'json.load', 'js.load', (['json_file'], {}), '(json_file)\n', (1699, 1710), True, 'import json as js\n'), ((2039, 2056), 'json.load... |
from typing import Generator
from itertools import product
from copy import deepcopy
from .utils.validation import validate_type
class Struct(dict):
"""Dictionary like container object exposing keys as attributes.
The Struct container enables values to be accessed both via __getitem__,
i.e. by key, and ... | [
"copy.deepcopy"
] | [((3024, 3044), 'copy.deepcopy', 'deepcopy', (['self.fixed'], {}), '(self.fixed)\n', (3032, 3044), False, 'from copy import deepcopy\n')] |
# Generated by Django 2.2.24 on 2022-03-19 19:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('appearance', '0019_auto_20220319_1818'),
]
operations = [
migrations.RemoveField(
model_name='theme',
name='import_file',
... | [
"django.db.migrations.RemoveField"
] | [((231, 293), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""theme"""', 'name': '"""import_file"""'}), "(model_name='theme', name='import_file')\n", (253, 293), False, 'from django.db import migrations\n')] |
import torch
import os
import itertools
import random
import itertools
from pathlib import Path
from typing import Tuple
# TorchBench imports
from torchbenchmark.util.model import BenchmarkModel
from torchbenchmark.tasks import COMPUTER_VISION
# setup environment variable
CURRENT_DIR = Path(os.path.dirname(os.path.re... | [
"os.path.exists",
"itertools.islice",
"os.path.join",
"detectron2.model_zoo.get_config",
"os.path.realpath",
"torch.no_grad",
"detectron2.config.instantiate",
"detectron2.utils.events.EventStorage"
] | [((350, 426), 'os.path.join', 'os.path.join', (['CURRENT_DIR.parent.parent', '"""data"""', '""".data"""', '"""coco2017-minimal"""'], {}), "(CURRENT_DIR.parent.parent, 'data', '.data', 'coco2017-minimal')\n", (362, 426), False, 'import os\n'), ((434, 458), 'os.path.exists', 'os.path.exists', (['DATA_DIR'], {}), '(DATA_D... |
import os
import unittest
from uavcan.dsdl import common
class TestCRC16FromBytes(unittest.TestCase):
def test_str(self):
self.assertEqual(common.crc16_from_bytes('123456789'), 0x29B1)
def test_bytes(self):
self.assertEqual(common.crc16_from_bytes(b'123456789'), 0x29B1)
def test_bytearra... | [
"unittest.main",
"uavcan.dsdl.common.crc16_from_bytes",
"uavcan.dsdl.common.bytes_from_crc64"
] | [((828, 843), 'unittest.main', 'unittest.main', ([], {}), '()\n', (841, 843), False, 'import unittest\n'), ((153, 189), 'uavcan.dsdl.common.crc16_from_bytes', 'common.crc16_from_bytes', (['"""123456789"""'], {}), "('123456789')\n", (176, 189), False, 'from uavcan.dsdl import common\n'), ((251, 288), 'uavcan.dsdl.common... |
"""
Package for ``requests_mock_flask``.
"""
from __future__ import annotations
import re
from functools import partial
from typing import Any, Dict, Tuple, Union
from urllib.parse import urljoin
import werkzeug
from flask import Flask
from requests import PreparedRequest
from requests_mock.request import _RequestOb... | [
"re.compile",
"werkzeug.http.parse_cookie",
"functools.partial",
"urllib.parse.urljoin",
"re.sub"
] | [((865, 914), 'functools.partial', 'partial', (['_responses_callback'], {'flask_app': 'flask_app'}), '(_responses_callback, flask_app=flask_app)\n', (872, 914), False, 'from functools import partial\n'), ((941, 995), 'functools.partial', 'partial', (['mock_obj.add_callback'], {'callback': 'resp_callback'}), '(mock_obj.... |
import json
from functools import wraps
from django.contrib.auth import SESSION_KEY
from django.contrib.messages import api, constants
from django.db import models
from django.utils import timezone
from django.utils.functional import SimpleLazyObject
def _positional(count):
"""
Only allows ``count`` position... | [
"json.dumps",
"django.utils.functional.SimpleLazyObject",
"django.contrib.messages.api.get_messages",
"functools.wraps",
"django.utils.timezone.now",
"user_messages.models.Message.objects.filter"
] | [((2148, 2171), 'django.utils.functional.SimpleLazyObject', 'SimpleLazyObject', (['fetch'], {}), '(fetch)\n', (2164, 2171), False, 'from django.utils.functional import SimpleLazyObject\n'), ((457, 466), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (462, 466), False, 'from functools import wraps\n'), ((1084, 1106... |
# coding: utf-8
import pprint
import re
import six
class BackupReplicateRespBody:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the ... | [
"six.iteritems"
] | [((7439, 7472), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (7452, 7472), False, 'import six\n')] |
from django.db import models
from django.utils.safestring import mark_safe
from cyder.base.utils import classproperty
class BaseModel(models.Model):
"""
Base class for models to abstract some common features.
* Adds automatic created and modified fields to the model.
"""
created = models.DateTim... | [
"django.db.models.DateTimeField",
"django.utils.safestring.mark_safe"
] | [((306, 356), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)', 'null': '(True)'}), '(auto_now_add=True, null=True)\n', (326, 356), False, 'from django.db import models\n'), ((372, 418), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)', 'null':... |
import player
import json
class BG(object):
def __init__(self):
self.id = 0
self.players = []
self.chosen = []
def load(self, file):
with open(file) as data_file:
data = json.load(data_file)
self.id = data['id']
for datum in data['players']:... | [
"json.load",
"player.Player"
] | [((225, 245), 'json.load', 'json.load', (['data_file'], {}), '(data_file)\n', (234, 245), False, 'import json\n'), ((349, 364), 'player.Player', 'player.Player', ([], {}), '()\n', (362, 364), False, 'import player\n')] |
import datetime as dt
# from env import OWM_KEY
from googletrans import Translator
# from pyowm import OWM
from telegram.ext import Updater, Dispatcher, CommandHandler
owm = OWM(OWM_KEY)
mgr = owm.weather_manager()
observation = mgr.weather_at_place("Sao Carlos, BR")
w = observation.weather
translator = Translator(... | [
"datetime.datetime.today",
"googletrans.Translator"
] | [((309, 321), 'googletrans.Translator', 'Translator', ([], {}), '()\n', (319, 321), False, 'from googletrans import Translator\n'), ((534, 553), 'datetime.datetime.today', 'dt.datetime.today', ([], {}), '()\n', (551, 553), True, 'import datetime as dt\n')] |
from django.views.generic.base import View
from django.utils.decorators import method_decorator
from rest_framework.decorators import api_view
from rest_framework.permissions import (
IsAdminUser,
AllowAny
)
from rest_framework.views import APIView
@method_decorator(api_view(['DELETE', 'GET', 'POST', 'PUT']), ... | [
"rest_framework.decorators.api_view"
] | [((276, 318), 'rest_framework.decorators.api_view', 'api_view', (["['DELETE', 'GET', 'POST', 'PUT']"], {}), "(['DELETE', 'GET', 'POST', 'PUT'])\n", (284, 318), False, 'from rest_framework.decorators import api_view\n')] |
import discord
import discord.ext.commands as commands
from .game_die import GameDie
from .sessions.rock_paper_scissors import RockPaperScissorsSession
from .sessions.cards_against_humanity.cards_against_humanity import CardsAgainstHumanitySession
games = {"rock-paper-scissors": RockPaperScissorsSession,
"rps... | [
"discord.ext.commands.Cog.listener",
"discord.Embed",
"discord.ext.commands.command"
] | [((579, 608), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""roll"""'}), "(name='roll')\n", (595, 608), True, 'import discord.ext.commands as commands\n'), ((744, 773), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""game"""'}), "(name='game')\n", (760, 773), True, 'import d... |
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... | [
"numpy.zeros",
"copy.copy"
] | [((4311, 4350), 'numpy.zeros', 'np.zeros', (['param.shape'], {'dtype': 'np.float32'}), '(param.shape, dtype=np.float32)\n', (4319, 4350), True, 'import numpy as np\n'), ((6995, 7008), 'copy.copy', 'copy.copy', (['st'], {}), '(st)\n', (7004, 7008), False, 'import copy\n')] |
#!/usr/bin/env python
__author__ = '<NAME>'
#========================================================================
import os, sys
import copy
import time
import uuid
import pickle
import subprocess
import numpy as np
import tensorflow as tf
from gryffin.utilities import Logger
from gryffin.uti... | [
"numpy.abs",
"os.path.getsize",
"pickle.dump",
"numpy.where",
"pickle.load",
"time.sleep",
"uuid.uuid4",
"os.path.isfile",
"numpy.array",
"numpy.empty",
"subprocess.call",
"copy.deepcopy",
"time.time",
"os.remove"
] | [((1834, 1909), 'subprocess.call', 'subprocess.call', (["('python %s %s' % (self.exec_name, config_name))"], {'shell': '(True)'}), "('python %s %s' % (self.exec_name, config_name), shell=True)\n", (1849, 1909), False, 'import subprocess\n'), ((2320, 2335), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (2330, ... |
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | [
"logging.getLogger",
"cloudify.workflows.tasks.SendNodeEventTask",
"cloudify.logs.CloudifyWorkflowLoggingHandler",
"cloudify.error_handling.deserialize_known_exception",
"cloudify.logs.init_cloudify_logger",
"cloudify.context.update",
"cloudify.context.BlueprintContext",
"proxy_tools.proxy",
"copy.d... | [((11836, 11886), 'cloudify.logs.init_cloudify_logger', 'init_cloudify_logger', (['logging_handler', 'logger_name'], {}), '(logging_handler, logger_name)\n', (11856, 11886), False, 'from cloudify.logs import CloudifyWorkflowLoggingHandler, CloudifyWorkflowNodeLoggingHandler, SystemWideWorkflowLoggingHandler, init_cloud... |
import json
import os
import tempfile
import click
from prettytable import PrettyTable
from nexuscli import utils
from nexuscli.cli import cli
@cli.group()
def resources():
"""Resources operations"""
@resources.command(name='create', help='Create a new resource')
@click.option('_org_label', '--org', '-o', hel... | [
"prettytable.PrettyTable",
"nexuscli.utils.get_organization_label",
"click.argument",
"json.loads",
"nexuscli.utils.format_json_field",
"nexuscli.utils.print_json",
"click.option",
"json.dumps",
"nexuscli.utils.generate_nexus_payload_checksum",
"os.remove",
"nexuscli.utils.error",
"click.edit"... | [((148, 159), 'nexuscli.cli.cli.group', 'cli.group', ([], {}), '()\n', (157, 159), False, 'from nexuscli.cli import cli\n'), ((275, 397), 'click.option', 'click.option', (['"""_org_label"""', '"""--org"""', '"""-o"""'], {'help': '"""Organization to work on (overrides selection made via orgs command)"""'}), "('_org_labe... |
# JANKENPOOP
import nextcord
import config
from nextcord.ext import commands
client = commands.Bot(command_prefix = 'janken ')
game = nextcord.Game("Legacy Code Course")
@client.event
async def on_ready():
await client.change_presence(status=nextcord.Status.idle, activity=game)
print("JANKENPOPP IS HERE HAHAH... | [
"nextcord.ext.commands.Bot",
"nextcord.Game"
] | [((87, 125), 'nextcord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': '"""janken """'}), "(command_prefix='janken ')\n", (99, 125), False, 'from nextcord.ext import commands\n'), ((135, 170), 'nextcord.Game', 'nextcord.Game', (['"""Legacy Code Course"""'], {}), "('Legacy Code Course')\n", (148, 170), False,... |
import unittest
from sourcehold import compression
class TestCompression(unittest.TestCase):
def test_equality(self):
with open("resources/map/crusader/MxM_unseen_1.map", 'rb') as f:
data = f.read()[20:20 + 10217]
self.assertEqual(data, compression.COMPRESSION.compress(compression.C... | [
"sourcehold.compression.COMPRESSION.decompress"
] | [((307, 347), 'sourcehold.compression.COMPRESSION.decompress', 'compression.COMPRESSION.decompress', (['data'], {}), '(data)\n', (341, 347), False, 'from sourcehold import compression\n')] |
import importlib
from fastapi.testclient import TestClient
from docs_src.conditional_openapi import tutorial001
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/": {
"get": {
"summary": "Root",
"opera... | [
"fastapi.testclient.TestClient",
"importlib.reload"
] | [((654, 681), 'fastapi.testclient.TestClient', 'TestClient', (['tutorial001.app'], {}), '(tutorial001.app)\n', (664, 681), False, 'from fastapi.testclient import TestClient\n'), ((1036, 1065), 'importlib.reload', 'importlib.reload', (['tutorial001'], {}), '(tutorial001)\n', (1052, 1065), False, 'import importlib\n'), (... |
# -*- coding: utf-8 -*-
from CmdInter import CmdClient
import Audio
import PluginsManager
import WordParse
import Chrome
import os
# import Safari
class Jarvis():
def __init__(self):
self.pm = PluginsManager.Platform()
self.action_list = self.pm.get_all_plugin()
self.driver = Chrome.Ch... | [
"PluginsManager.Platform",
"WordParse.WordParse",
"os.system",
"Chrome.Chrome"
] | [((210, 235), 'PluginsManager.Platform', 'PluginsManager.Platform', ([], {}), '()\n', (233, 235), False, 'import PluginsManager\n'), ((311, 326), 'Chrome.Chrome', 'Chrome.Chrome', ([], {}), '()\n', (324, 326), False, 'import Chrome\n'), ((1363, 1384), 'WordParse.WordParse', 'WordParse.WordParse', ([], {}), '()\n', (138... |
import sys
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
sys.path.append('..')
from datasets import dataloaders
from tqdm import tqdm
def get_score(acc_list):
mean = np.mean(acc_list)
interval = 1.96*np.sqrt(np.var(acc_list)/len(acc_list))
return mean,interval
d... | [
"numpy.mean",
"torch.eq",
"numpy.array",
"datasets.dataloaders.meta_test_dataloader",
"sys.path.append",
"numpy.var"
] | [((97, 118), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (112, 118), False, 'import sys\n'), ((213, 230), 'numpy.mean', 'np.mean', (['acc_list'], {}), '(acc_list)\n', (220, 230), True, 'import numpy as np\n'), ((442, 595), 'datasets.dataloaders.meta_test_dataloader', 'dataloaders.meta_test_dat... |
# Maze Problem
import turtle
PART_OF_PATH = 'O'
TRIED = '.'
OBSTACLE = '+'
DEAD_END = '-'
class Maze:
def __init__(self, maze_file_name):
rows_in_maze = 0
columns_in_maze = 0
self.maze_list = []
maze_file = open(maze_file_name, 'r')
rows_in_maze = 0
... | [
"turtle.Screen",
"turtle.Turtle"
] | [((955, 970), 'turtle.Turtle', 'turtle.Turtle', ([], {}), '()\n', (968, 970), False, 'import turtle\n'), ((1022, 1037), 'turtle.Screen', 'turtle.Screen', ([], {}), '()\n', (1035, 1037), False, 'import turtle\n')] |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from os.path import dirname, abspath
import unittest
from pykit.configuration import config
from pykit.parsing import from_c
__version__ = '0.1'
# ______________________________________________________________________
# pykit.t... | [
"os.path.abspath",
"unittest.TextTestRunner",
"unittest.TestLoader"
] | [((342, 359), 'os.path.abspath', 'abspath', (['__file__'], {}), '(__file__)\n', (349, 359), False, 'from os.path import dirname, abspath\n'), ((545, 570), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (568, 570), False, 'import unittest\n'), ((478, 499), 'unittest.TestLoader', 'unittest.TestLo... |
from RoboPy import *
import RoboPy as rp
import numpy as np
from numpy import pi
from john_radlab.Jacobian_Orthogonality.source import AIM, findY
# dh = [[0, 0, 2, 0], [0, 0, 1, 0], [0, 0, 0.3, 0], [0, 0, 1, 0]]
# dh = [[0, 0, 2.41497930, 0], [0, 0, 1.71892394e+00, 0], [0, 0, 1.38712293e-03, 0], [0, 0, 3.89431195e-01,... | [
"john_radlab.Jacobian_Orthogonality.source.AIM",
"john_radlab.Jacobian_Orthogonality.source.findY",
"numpy.random.random_sample",
"numpy.array",
"numpy.set_printoptions"
] | [((394, 425), 'numpy.random.random_sample', 'np.random.random_sample', (['(4, 4)'], {}), '((4, 4))\n', (417, 425), True, 'import numpy as np\n'), ((500, 537), 'numpy.array', 'np.array', (['[0, pi / 2, pi / 2, pi / 2]'], {}), '([0, pi / 2, pi / 2, pi / 2])\n', (508, 537), True, 'import numpy as np\n'), ((554, 562), 'joh... |
import json
import pafy
import os
from datetime import datetime
DOWNLOAD_DIRECTORY = "download"
class YoutubeDownloader():
def __init__(self, youtube_id: str) -> None:
# first find if the audio has already been downloaded
self.music_information_file: str = "%s/%s.txt" % (
DOWNLOAD_DIR... | [
"os.path.isfile",
"pafy.new",
"datetime.datetime.now",
"json.load",
"json.dump"
] | [((351, 394), 'os.path.isfile', 'os.path.isfile', (['self.music_information_file'], {}), '(self.music_information_file)\n', (365, 394), False, 'import os\n'), ((635, 655), 'pafy.new', 'pafy.new', (['youtube_id'], {}), '(youtube_id)\n', (643, 655), False, 'import pafy\n'), ((1446, 1468), 'json.dump', 'json.dump', (['js'... |
from django.core.cache import cache
from django import template
from django.conf import settings
from django.contrib.comments.templatetags.comments import CommentCountNode
from comment_counter.utils import get_counter_cache_key
from comment_counter.settings import COMMENT_COUNTER_CACHE_TIMEOUT
register = template.Lib... | [
"django.core.cache.cache.set",
"comment_counter.utils.get_counter_cache_key",
"django.template.Library",
"django.core.cache.cache.get"
] | [((308, 326), 'django.template.Library', 'template.Library', ([], {}), '()\n', (324, 326), False, 'from django import template\n'), ((634, 694), 'comment_counter.utils.get_counter_cache_key', 'get_counter_cache_key', (['settings.SITE_ID', 'ctype.id', 'object_pk'], {}), '(settings.SITE_ID, ctype.id, object_pk)\n', (655,... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-14 21:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('songs', '0002_auto_20171111_1257'),
]
operations = [
migrations.AddField(
... | [
"django.db.models.FileField"
] | [((402, 456), 'django.db.models.FileField', 'models.FileField', ([], {'blank': '(True)', 'null': '(True)', 'upload_to': "b''"}), "(blank=True, null=True, upload_to=b'')\n", (418, 456), False, 'from django.db import migrations, models\n')] |
from vntree import EmbedNode as Node
from vntree.utilities import turn_on_logging
turn_on_logging()
rootnode = Node('root EmbedNode')
Node("first child", parent=rootnode)
child2 = Node("2nd child", rootnode)
Node("grand-child1 (leaf node)", child2)
Node("grand-child2 (leaf node)", child2)
child3 = Node("3rd child", ... | [
"vntree.utilities.turn_on_logging",
"vntree.EmbedNode"
] | [((82, 99), 'vntree.utilities.turn_on_logging', 'turn_on_logging', ([], {}), '()\n', (97, 99), False, 'from vntree.utilities import turn_on_logging\n'), ((114, 136), 'vntree.EmbedNode', 'Node', (['"""root EmbedNode"""'], {}), "('root EmbedNode')\n", (118, 136), True, 'from vntree import EmbedNode as Node\n'), ((137, 17... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-07-20 06:27
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateMode... | [
"django.db.models.DateTimeField",
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((392, 485), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (408, 485), False, 'from django.db import migrations, models\... |
from django import forms
class PaymentHiddenInputsPostForm(forms.Form):
def __init__(self, fields, *args, **kwargs):
super().__init__(*args, **kwargs)
for key in fields:
self.fields[key] = forms.CharField(
initial=fields[key], widget=forms.HiddenInput
)
| [
"django.forms.CharField"
] | [((224, 286), 'django.forms.CharField', 'forms.CharField', ([], {'initial': 'fields[key]', 'widget': 'forms.HiddenInput'}), '(initial=fields[key], widget=forms.HiddenInput)\n', (239, 286), False, 'from django import forms\n')] |
import argparse
import json
parser = argparse.ArgumentParser(description="Parse the tabular data from Mturk and save to csv.")
parser.add_argument("json", type=str, help="path to json file")
parser.add_argument("--save_path", type=str, default="./")
args = parser.parse_args()
with open(args.json, "r") as f:
tmp =... | [
"argparse.ArgumentParser"
] | [((38, 132), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Parse the tabular data from Mturk and save to csv."""'}), "(description=\n 'Parse the tabular data from Mturk and save to csv.')\n", (61, 132), False, 'import argparse\n')] |
"""
A collection of function that detect and analyse an article
"""
import json
import sys
import re
import os
def features_detection(word):
"""
Detect features in a word. Features come from the pattern.json in the resources directory
:param word: the word to operate on.
:return: the list of features... | [
"json.load",
"os.path.dirname",
"re.finditer",
"re.search"
] | [((506, 525), 'json.load', 'json.load', (['patterns'], {}), '(patterns)\n', (515, 525), False, 'import json\n'), ((608, 634), 're.finditer', 're.finditer', (['pattern', 'word'], {}), '(pattern, word)\n', (619, 634), False, 'import re\n'), ((1390, 1420), 're.search', 're.search', (['keyword_rules', 'word'], {}), '(keywo... |
import sublime
import sublime_plugin
import re
def panel_window(view):
for w in sublime.windows():
for panel in w.panels():
v = w.find_output_panel(panel.replace("output.", ""))
if v and v.id() == view.id():
return w
return None
def panel_is_visible(view):
... | [
"sublime.windows",
"sublime.Region",
"sublime.load_settings"
] | [((87, 104), 'sublime.windows', 'sublime.windows', ([], {}), '()\n', (102, 104), False, 'import sublime\n'), ((1026, 1076), 'sublime.load_settings', 'sublime.load_settings', (['"""Terminus.sublime-settings"""'], {}), "('Terminus.sublime-settings')\n", (1047, 1076), False, 'import sublime\n'), ((2104, 2132), 'sublime.Re... |
import pytest
from tests.end_to_end.helpers.env import E2EEnv
from tests.end_to_end.target_snowflake import TargetSnowflake
@pytest.mark.skipif(not E2EEnv.env['TAP_S3_CSV']['is_configured'], reason='S3 not configured.')
class TapS3(TargetSnowflake):
"""
Base class for E2E tests for tap S3 -> target snowflake... | [
"pytest.mark.skipif"
] | [((128, 227), 'pytest.mark.skipif', 'pytest.mark.skipif', (["(not E2EEnv.env['TAP_S3_CSV']['is_configured'])"], {'reason': '"""S3 not configured."""'}), "(not E2EEnv.env['TAP_S3_CSV']['is_configured'], reason=\n 'S3 not configured.')\n", (146, 227), False, 'import pytest\n')] |
from mongoengine import (
Document,
EmbeddedDocument,
EmbeddedDocumentField,
StringField,
DateTimeField,
BooleanField,
IntField,
ListField, DictField, DynamicField
)
from mongoengine.errors import ValidationError
from datetime import datetime
from validators import ValidationFailure, ur... | [
"kairon.shared.actions.utils.ActionUtility.is_empty",
"mongoengine.EmbeddedDocumentField",
"kairon.shared.actions.utils.ActionUtility.validate_zendesk_credentials",
"kairon.shared.actions.utils.ActionUtility.validate_jira_action",
"mongoengine.errors.ValidationError",
"mongoengine.DynamicField",
"mongoe... | [((12359, 12476), 'mongoengine.signals.pre_save_post_validation.connect', 'signals.pre_save_post_validation.connect', (['GoogleSearchAction.pre_save_post_validation'], {'sender': 'GoogleSearchAction'}), '(GoogleSearchAction.\n pre_save_post_validation, sender=GoogleSearchAction)\n', (12399, 12476), False, 'from mong... |
import pandas as pd
reddit_df = pd.read_csv('./Dataset/cleanedRedditSuicide.csv')
twitter_df = pd.read_csv('./Dataset/cleanedTwitterSuicide.csv')
genral_df = pd.read_csv('./Dataset/cleanedRedditNonSuicide.csv')
suicide_text = []
suicide_label = []
for text in reddit_df['cleaned']:
suicide_text.append(text)
su... | [
"pandas.DataFrame",
"pandas.concat",
"pandas.read_csv"
] | [((33, 82), 'pandas.read_csv', 'pd.read_csv', (['"""./Dataset/cleanedRedditSuicide.csv"""'], {}), "('./Dataset/cleanedRedditSuicide.csv')\n", (44, 82), True, 'import pandas as pd\n'), ((96, 146), 'pandas.read_csv', 'pd.read_csv', (['"""./Dataset/cleanedTwitterSuicide.csv"""'], {}), "('./Dataset/cleanedTwitterSuicide.cs... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
__doc__ == """Primer3 Classes"""
__author__ = "<NAME>"
__license__ = "MIT"
# __version__ = "2.3.4"
#from zippy import __version__
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Production"
import sys, os, re, datetime... | [
"logging.getLogger",
"os.path.exists",
"re.search",
"primer3.calcHeterodimerTm",
"re.escape",
"primer3.bindings.designPrimers",
"os.getuid",
"re.match",
"collections.Counter",
"datetime.datetime.now",
"collections.defaultdict",
"os.unlink",
"pysam.TabixFile",
"pysam.Samfile",
"re.sub",
... | [((587, 614), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (604, 614), False, 'import sys, os, re, datetime, pwd, logging\n'), ((5408, 5435), 'pysam.Samfile', 'pysam.Samfile', (['mapfile', '"""r"""'], {}), "(mapfile, 'r')\n", (5421, 5435), False, 'import pysam\n'), ((5469, 5478), 'colle... |
from time import sleep
import threading
import tkinter
from tkinter import ttk
import random
time_v=0
def main():
tkinter._test()
def testWindow():
pass
def StringVar():
pass
root = tkinter.Tk()
root.title("Sample Window")
root.geometry("800x600")
t = StringVar()
Frame1 = ttk.Frame(root, padding=16)
B... | [
"tkinter.ttk.Button",
"tkinter.ttk.Entry",
"tkinter.ttk.Frame",
"tkinter.Tk",
"tkinter._test"
] | [((200, 212), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (210, 212), False, 'import tkinter\n'), ((291, 318), 'tkinter.ttk.Frame', 'ttk.Frame', (['root'], {'padding': '(16)'}), '(root, padding=16)\n', (300, 318), False, 'from tkinter import ttk\n'), ((326, 357), 'tkinter.ttk.Button', 'ttk.Button', (['Frame1'], {'tex... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for alternative extrapolation"""
import solvency2_data
import numpy as np
import pandas as pd
import unittest
from collections import OrderedDict
from datetime import datetime
class TestAltExtra(unittest.TestCase):
def test_1(self):
assert solvency2_data.Dis... | [
"pandas.Series",
"datetime.datetime",
"solvency2_data.forwardstruct2termstruct",
"solvency2_data.FromParToForwards",
"solvency2_data.create_swap_struct",
"solvency2_data.DiscountedValue4par2forwards",
"pandas.testing.assert_series_equal"
] | [((1120, 1266), 'solvency2_data.create_swap_struct', 'solvency2_data.create_swap_struct', ([], {'rfr': "d['RFR_spot_no_VA']['Euro']", 'additional_swaps': '{(25): 0.00522, (30): 0.00476, (40): 0.004, (50): 0.0034}'}), "(rfr=d['RFR_spot_no_VA']['Euro'],\n additional_swaps={(25): 0.00522, (30): 0.00476, (40): 0.004, (5... |
import FWCore.ParameterSet.Config as cms
from HLTriggerOffline.Higgs.hltHiggsValidator_cfi import *
HiggsValidationSequence = cms.Sequence(
hltHiggsValidator
)
#HLTHiggsVal_FastSim = cms.Sequence(
# recoHiggsValidationHLTFastSim_seq +
# hltHiggsValidator
# )
| [
"FWCore.ParameterSet.Config.Sequence"
] | [((128, 159), 'FWCore.ParameterSet.Config.Sequence', 'cms.Sequence', (['hltHiggsValidator'], {}), '(hltHiggsValidator)\n', (140, 159), True, 'import FWCore.ParameterSet.Config as cms\n')] |
from PyQt5.QtWidgets import QVBoxLayout, QDialog, QLineEdit, QDialogButtonBox
from app.extensions.custom_gui import PropertyBox, Dialog
class NewGameDialog(Dialog):
def __init__(self, parent=None):
super().__init__(parent)
self.setWindowTitle("New Game")
self.window = parent
layout... | [
"PyQt5.QtWidgets.QVBoxLayout",
"app.extensions.custom_gui.PropertyBox"
] | [((323, 336), 'PyQt5.QtWidgets.QVBoxLayout', 'QVBoxLayout', ([], {}), '()\n', (334, 336), False, 'from PyQt5.QtWidgets import QVBoxLayout, QDialog, QLineEdit, QDialogButtonBox\n'), ((393, 439), 'app.extensions.custom_gui.PropertyBox', 'PropertyBox', (['"""Unique Game ID"""', 'QLineEdit', 'self'], {}), "('Unique Game ID... |
import numpy as np
from landlab import Component
_VALID_METHODS = set(["Grid"])
def _assert_method_is_valid(method):
if method not in _VALID_METHODS:
raise ValueError("%s: Invalid method name" % method)
class Radiation(Component):
"""Compute 1D and 2D total incident shortwave radiation.
Land... | [
"numpy.radians",
"numpy.tan",
"numpy.floor",
"numpy.cos",
"numpy.sin",
"numpy.arctan"
] | [((6172, 6198), 'numpy.radians', 'np.radians', (['self._latitude'], {}), '(self._latitude)\n', (6182, 6198), True, 'import numpy as np\n'), ((6277, 6323), 'numpy.cos', 'np.cos', (['(2 * np.pi / 365 * (172 - self._julian))'], {}), '(2 * np.pi / 365 * (172 - self._julian))\n', (6283, 6323), True, 'import numpy as np\n'),... |
from mltoolkit.mldp.steps.transformers import BaseTransformer
import numpy as np
from logging import getLogger
import os
logger_name = os.path.basename(__file__)
logger = getLogger(logger_name)
class RatingProp(BaseTransformer):
"""Computes the rating deviation property for reviews. And
that each batch conta... | [
"logging.getLogger",
"numpy.mean",
"os.path.basename"
] | [((136, 162), 'os.path.basename', 'os.path.basename', (['__file__'], {}), '(__file__)\n', (152, 162), False, 'import os\n'), ((172, 194), 'logging.getLogger', 'getLogger', (['logger_name'], {}), '(logger_name)\n', (181, 194), False, 'from logging import getLogger\n'), ((1031, 1051), 'numpy.mean', 'np.mean', (['refs_rat... |
import csv
from django.contrib import admin
from django.http import HttpResponse
# Register your models here.
from .models import Subscriber, SubscriptionRequest
class SubscriberAdmin(admin.ModelAdmin):
list_display = ('email', 'created_at')
list_per_page = 10
actions = ["export_as_csv"]
def export_... | [
"django.http.HttpResponse",
"django.contrib.admin.site.register",
"csv.writer"
] | [((1121, 1169), 'django.contrib.admin.site.register', 'admin.site.register', (['Subscriber', 'SubscriberAdmin'], {}), '(Subscriber, SubscriberAdmin)\n', (1140, 1169), False, 'from django.contrib import admin\n'), ((1170, 1236), 'django.contrib.admin.site.register', 'admin.site.register', (['SubscriptionRequest', 'Subsc... |
# Copyright 2017 reinforce.io. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | [
"inspect.currentframe",
"numpy.asarray",
"tensorforce.util.get_object",
"copy.deepcopy",
"tensorforce.TensorforceError"
] | [((2501, 2522), 'copy.deepcopy', 'deepcopy', (['states_spec'], {}), '(states_spec)\n', (2509, 2522), False, 'from copy import deepcopy\n'), ((3075, 3097), 'copy.deepcopy', 'deepcopy', (['actions_spec'], {}), '(actions_spec)\n', (3083, 3097), False, 'from copy import deepcopy\n'), ((11654, 11744), 'tensorforce.util.get_... |
import random
import torch
from torch.autograd import Variable
class TensorPool():
def __init__(self, pool_size):
self.pool_size = pool_size
if self.pool_size > 0:
self.num_imgs = 0
self.images = []
def query(self, tensors):
if self.pool_size == 0:
re... | [
"torch.unsqueeze",
"random.uniform",
"random.randint",
"torch.cat"
] | [((418, 444), 'torch.unsqueeze', 'torch.unsqueeze', (['tensor', '(0)'], {}), '(tensor, 0)\n', (433, 444), False, 'import torch\n'), ((1047, 1075), 'torch.cat', 'torch.cat', (['return_tensors', '(0)'], {}), '(return_tensors, 0)\n', (1056, 1075), False, 'import torch\n'), ((669, 689), 'random.uniform', 'random.uniform', ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-27 03:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('store', '0008_auto_20170527_0312'),
]... | [
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((445, 538), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (461, 538), False, 'from django.db import migrations, models\... |
from PIL import Image
import sys
import struct
import re
import os
def decode(im):
try:
setting=open(r".\setting.ini", mode='r')
except FileNotFoundError:
new_setting=open(r".\setting.ini", mode='w')
new_setting.write("null_range=<start>5000<end>\n")
new_setting.close(... | [
"PIL.Image.open"
] | [((1220, 1248), 'PIL.Image.open', 'Image.open', (['sys.argv[1]', '"""r"""'], {}), "(sys.argv[1], 'r')\n", (1230, 1248), False, 'from PIL import Image\n')] |
import os
import logging
import yaml
from astroapiserver import API
from flask import Flask, abort, jsonify, render_template, request
from pathlib import Path
from database_handler import authenticate, authorize, get_admin_database
PROJECT_PATH = Path(__file__).parents[1].resolve()
# Flask App and API
app = Flask(__n... | [
"logging.basicConfig",
"flask.request.args.get",
"flask.render_template",
"flask.abort",
"pathlib.Path",
"os.environ.get",
"flask.request.form.get",
"astroapiserver.API",
"yaml.safe_load",
"database_handler.get_admin_database",
"flask.jsonify"
] | [((402, 430), 'os.environ.get', 'os.environ.get', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (416, 430), False, 'import os\n'), ((437, 493), 'astroapiserver.API', 'API', (['app'], {'authenticate': 'authenticate', 'authorize': 'authorize'}), '(app, authenticate=authenticate, authorize=authorize)\n', (440, 493), Fal... |
from random import choice
from CybORG.Shared import Observation
from .Monitor import Monitor
from CybORG.Shared.Actions import Action
from CybORG.Shared.Actions.ConcreteActions.StopProcess import StopProcess
from CybORG.Simulator.Session import VelociraptorServer
from CybORG.Simulator.State import State
class Remove... | [
"random.choice",
"CybORG.Shared.Actions.ConcreteActions.StopProcess.StopProcess",
"CybORG.Shared.Observation"
] | [((1009, 1025), 'random.choice', 'choice', (['sessions'], {}), '(sessions)\n', (1015, 1025), False, 'from random import choice\n'), ((1044, 1061), 'CybORG.Shared.Observation', 'Observation', (['(True)'], {}), '(True)\n', (1055, 1061), False, 'from CybORG.Shared import Observation\n'), ((1496, 1514), 'CybORG.Shared.Obse... |
import random
from kf_lib.kung_fu import styles, style_gen
from kf_lib.ui import get_int_from_user, menu
from kf_lib.utils import rnd, rndint
from . import names
from .fighter import Fighter, Challenger, Master, Thug
from .human_controlled_fighter import HumanControlledFighter
# levels
BEGGAR_LV = (8, 12)
BODYGUARD_... | [
"kf_lib.kung_fu.style_gen.get_new_randomly_generated_style",
"random.choice",
"kf_lib.utils.rnd",
"kf_lib.utils.rndint",
"kf_lib.kung_fu.styles.all_styles.values",
"kf_lib.ui.get_int_from_user",
"kf_lib.ui.menu"
] | [((1711, 1729), 'kf_lib.utils.rndint', 'rndint', (['*BEGGAR_LV'], {}), '(*BEGGAR_LV)\n', (1717, 1729), False, 'from kf_lib.utils import rnd, rndint\n'), ((2309, 2328), 'kf_lib.utils.rndint', 'rndint', (['*BRAWLER_LV'], {}), '(*BRAWLER_LV)\n', (2315, 2328), False, 'from kf_lib.utils import rnd, rndint\n'), ((2425, 2444)... |
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from tos.compat import get_runtime_user_model
from tos.models import TermsOfService, UserAgreement, has_user_agreed_latest_tos
class TestViews(TestCase):
def setUp(self):
# User that has agreed... | [
"tos.models.UserAgreement.objects.create",
"tos.models.UserAgreement.objects.filter",
"tos.models.TermsOfService.objects.create",
"django.core.urlresolvers.reverse",
"tos.models.has_user_agreed_latest_tos",
"tos.compat.get_runtime_user_model"
] | [((601, 697), 'tos.models.TermsOfService.objects.create', 'TermsOfService.objects.create', ([], {'content': '"""first edition of the terms of service"""', 'active': '(True)'}), "(content=\n 'first edition of the terms of service', active=True)\n", (630, 697), False, 'from tos.models import TermsOfService, UserAgreem... |
from pathlib import Path
from bidict import bidict
from os.path import join as J
import torch
from itertools import cycle
from collections import namedtuple
import re
import random
import os
data = namedtuple('data',['frames','label'])
datapath = "/data/keshav/ucf/jpegs_256/"
idx = "/data/keshav/ucf/ucflist/classIn... | [
"re.sub",
"collections.namedtuple"
] | [((201, 240), 'collections.namedtuple', 'namedtuple', (['"""data"""', "['frames', 'label']"], {}), "('data', ['frames', 'label'])\n", (211, 240), False, 'from collections import namedtuple\n'), ((457, 477), 're.sub', 're.sub', (['"""\\\\D"""', '""""""', 'x'], {}), "('\\\\D', '', x)\n", (463, 477), False, 'import re\n')... |
import setuptools
with open("README.md", "r") as readme_file:
long_description = readme_file.read()
setuptools.setup(
name="nrdash",
description="New Relic Dashboard Builder",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/gatkin/nrd... | [
"setuptools.find_packages"
] | [((434, 460), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (458, 460), False, 'import setuptools\n')] |
import requests
import urllib
import XDCCFile
from bs4 import BeautifulSoup
from urlparse import urlparse
from collections import namedtuple
Series = namedtuple("Series", "name url")
class GoodDramaScraper(object):
def __init__(self):
self.url = "http://www.gooddrama.net/drama/search"
self.params = {
"key"... | [
"bs4.BeautifulSoup",
"collections.namedtuple",
"requests.get"
] | [((151, 183), 'collections.namedtuple', 'namedtuple', (['"""Series"""', '"""name url"""'], {}), "('Series', 'name url')\n", (161, 183), False, 'from collections import namedtuple\n'), ((422, 464), 'requests.get', 'requests.get', (['self.url'], {'params': 'self.params'}), '(self.url, params=self.params)\n', (434, 464), ... |
# Implementing Gates
#----------------------------------
#
# This function shows how to implement
# various gates in TensorFlow
#
# One gate will be one operation with
# a variable and a placeholder.
# We will ask TensorFlow to change the
# variable based on our loss function
import tensorflow as tf
from t... | [
"tensorflow.python.framework.ops.reset_default_graph",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.multiply",
"tensorflow.global_variables_initializer",
"tensorflow.train.GradientDescentOptimizer",
"tensorflow.constant",
"tensorflow.subtract"
] | [((359, 384), 'tensorflow.python.framework.ops.reset_default_graph', 'ops.reset_default_graph', ([], {}), '()\n', (382, 384), False, 'from tensorflow.python.framework import ops\n'), ((418, 430), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (428, 430), True, 'import tensorflow as tf\n'), ((650, 682), 'tensorfl... |
from setuptools import setup
# use softlinks to make the various "board-support-package" submodules
# look like subpackages. Then __init__.py will modify
# sys.path so that the correct "local" versions of surf etc. are
# picked up. A better approach would be using relative imports
# in the submodules, but that's mor... | [
"setuptools.setup"
] | [((334, 2325), 'setuptools.setup', 'setup', ([], {'name': '"""epix_hr_single_10k"""', 'description': '"""Epix HR package"""', 'packages': "['epix_hr_single_10k', 'epix_hr_single_10k.ePixAsics',\n 'epix_hr_single_10k.ePixFpga', 'epix_hr_single_10k.ePixViewer',\n 'epix_hr_single_10k.XilinxKcu1500Pgp3', 'epix_hr_sin... |
import random
def printRules():
print("""The rules of the game are as follows:
Players take turns to throw a dice.
If the throw is a 'Double', i.e. two 2's, two 3's, ect.
The player's score reverts to zero and their turn ends""")
main()
def playerTurn(player,score):
print("Your turn {0}!".fo... | [
"random.randint"
] | [((443, 463), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (457, 463), False, 'import random\n'), ((479, 499), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (493, 499), False, 'import random\n')] |
from ot_receiver import OTReceiver
import socket
import random
def peq_test_receiver(num, port):
result = 0
receiver_s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
receiver_s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
receiver_s.bind(('127.0.0.1', port))
receiver_s.listen()
p... | [
"ot_receiver.OTReceiver",
"socket.socket"
] | [((131, 180), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (144, 180), False, 'import socket\n'), ((487, 514), 'ot_receiver.OTReceiver', 'OTReceiver', (['bit', 'receiver_s'], {}), '(bit, receiver_s)\n', (497, 514), False, 'from ot_receiver i... |
import pytest
from bot.state import State
@pytest.fixture
def fixture_farm_state() -> State:
yield State(debug=True, current_tick=0)
@pytest.fixture(autouse=True)
def mock_left_click(mocker):
import pyautogui
mocker.patch.object(pyautogui, 'mouseUp', return_value=None)
mocker.patch.object(pyautogu... | [
"pytest.fixture",
"bot.state.State"
] | [((143, 171), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (157, 171), False, 'import pytest\n'), ((106, 139), 'bot.state.State', 'State', ([], {'debug': '(True)', 'current_tick': '(0)'}), '(debug=True, current_tick=0)\n', (111, 139), False, 'from bot.state import State\n')] |
import os
from PIL import Image
import numpy as np
import json
import logging
import torch
import torchvision
#from .coco import coco
#from maskrcnn_benchmark.data.datasets.coco import COCODataset #as coco
from maskrcnn_benchmark.structures.bounding_box import BoxList
#from maskrcnn_benchmark.structures.segmentation_m... | [
"logging.getLogger",
"os.listdir",
"PIL.Image.open",
"os.path.join",
"numpy.array"
] | [((1181, 1208), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1198, 1208), False, 'import logging\n'), ((3513, 3533), 'numpy.array', 'np.array', (['i.shape[1]'], {}), '(i.shape[1])\n', (3521, 3533), True, 'import numpy as np\n'), ((3575, 3595), 'numpy.array', 'np.array', (['i.shape[0]']... |
import click
@click.group()
def cli():
pass
@cli.command()
@click.option('--host', default='localhost')
@click.option('--port', default=5000)
@click.option('--debug', is_flag=True)
def run(host, port, debug):
from flooky.app import create_app
from flooky import config
app = create_app(config=config... | [
"click.group",
"click.option",
"flooky.app.create_app"
] | [((16, 29), 'click.group', 'click.group', ([], {}), '()\n', (27, 29), False, 'import click\n'), ((68, 111), 'click.option', 'click.option', (['"""--host"""'], {'default': '"""localhost"""'}), "('--host', default='localhost')\n", (80, 111), False, 'import click\n'), ((113, 149), 'click.option', 'click.option', (['"""--p... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | [
"pandas.Series",
"apache_beam.dataframe.expressions.Session",
"apache_beam.dataframe.frame_base.args_to_kwargs",
"apache_beam.dataframe.frames.DeferredSeries",
"apache_beam.dataframe.frame_base.populate_defaults",
"unittest.main",
"apache_beam.dataframe.frame_base._elementwise_function",
"apache_beam.... | [((4428, 4443), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4441, 4443), False, 'import unittest\n'), ((1038, 1058), 'pandas.Series', 'pd.Series', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (1047, 1058), True, 'import pandas as pd\n'), ((1067, 1093), 'pandas.Series', 'pd.Series', (['[100, 200, 300]'], {}), '([100, ... |
# encoding: utf-8
# todo 01-12.py简化版
import xlwt
from selenium import webdriver
driver = webdriver.Chrome()
driver.maximize_window()
driver.get('https://s.weibo.com/')
keyword = '<PASSWORD>'
driver.find_element_by_css_selector('div[class="search-input"] > input[type="text"]').send_keys(keyword)
driver.find_ele... | [
"selenium.webdriver.Chrome",
"xlwt.Workbook"
] | [((93, 111), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (109, 111), False, 'from selenium import webdriver\n'), ((536, 551), 'xlwt.Workbook', 'xlwt.Workbook', ([], {}), '()\n', (549, 551), False, 'import xlwt\n')] |
#!/usr/bin/env python3
"""
priority generator for a specific taskset
Usage:
priority_generator [-t FILE] [options]
Options:
--taskset FILE, -t FILE taskset csv file [default: taskset-0.csv]
--method=N, -m N priority assigning method (0: Rate-monotonic,1: Deadline-mon... | [
"csv.DictReader",
"math.gcd",
"csv.writer",
"lib.job.job",
"os.path.basename",
"sys.exit",
"docopt.docopt"
] | [((3536, 3568), 'docopt.docopt', 'docopt', (['__doc__'], {'version': '"""0.5.0"""'}), "(__doc__, version='0.5.0')\n", (3542, 3568), False, 'from docopt import docopt\n'), ((804, 813), 'math.gcd', 'gcd', (['a', 'b'], {}), '(a, b)\n', (807, 813), False, 'from math import ceil, floor, gcd\n'), ((2462, 2486), 'csv.DictRead... |
"""Decorators that enable easy modifications to function behavior."""
import logging
import time
from functools import wraps
from typing import Callable
LOG = logging.getLogger("svc_tools")
def timer(log_level: Callable):
"""Time a function and log the time it took to execute.
If you want to know how long a... | [
"logging.getLogger",
"time.time",
"functools.wraps"
] | [((160, 190), 'logging.getLogger', 'logging.getLogger', (['"""svc_tools"""'], {}), "('svc_tools')\n", (177, 190), False, 'import logging\n'), ((964, 975), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (969, 975), False, 'from functools import wraps\n'), ((1079, 1090), 'time.time', 'time.time', ([], {}), '()\n... |
import setuptools
name = 'gumo-task'
version = '0.3.2'
description = 'Gumo Task Library'
dependencies = [
'gumo-core >= 0.1.0',
'gumo-datastore >= 0.1.0, >= 0.2.0',
'google-cloud-tasks >= 1.1.0',
]
with open("README.md", "r") as fh:
long_description = fh.read()
packages = [
package for package i... | [
"setuptools.find_packages",
"setuptools.setup"
] | [((409, 878), 'setuptools.setup', 'setuptools.setup', ([], {'name': 'name', 'version': 'version', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': 'description', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', 'url': '"""https://github.com/gumo-py... |
"""
Hawkes process with exponential kernel.
"""
import numpy as np
def hawkes1(n_samples):
"""Hawkes1 model from Omi et al. 2019."""
mu = 0.2
alpha = [0.8, 0.0]
beta = [1.0, 20.0]
arrival_times, loglike = _sample_and_nll(n_samples, mu, alpha, beta)
nll = -loglike.mean()
return arrival_time... | [
"numpy.random.rand",
"numpy.log",
"numpy.random.exponential",
"numpy.exp",
"numpy.array"
] | [((1205, 1228), 'numpy.exp', 'np.exp', (['(-beta[0] * step)'], {}), '(-beta[0] * step)\n', (1211, 1228), True, 'import numpy as np\n'), ((1245, 1268), 'numpy.exp', 'np.exp', (['(-beta[1] * step)'], {}), '(-beta[1] * step)\n', (1251, 1268), True, 'import numpy as np\n'), ((1702, 1713), 'numpy.array', 'np.array', (['T'],... |