code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
"""This module defines various layout objects one can add and manipulate in a template.
"""
from typing import TYPE_CHECKING, Union, List, Tuple, Optional, Dict, Any, Iterator, Iterable, \
Generator
import abc
import numpy as np
from copy import deepcopy
from .util import transform_table,... | [
"numpy.absolute",
"copy.deepcopy",
"numpy.linalg.norm",
"numpy.array",
"numpy.dot"
] | [((37893, 37921), 'numpy.array', 'np.array', (['pt_list'], {'dtype': 'int'}), '(pt_list, dtype=int)\n', (37901, 37921), True, 'import numpy as np\n'), ((41007, 41025), 'numpy.array', 'np.array', (['[dx, dy]'], {}), '([dx, dy])\n', (41015, 41025), True, 'import numpy as np\n'), ((41396, 41414), 'numpy.array', 'np.array'... |
# Generated by Django 3.0.5 on 2020-04-22 15:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0002_auto_20200422_1514'),
]
operations = [
migrations.RenameField(
model_name='user',
old_name='profilePic',
... | [
"django.db.migrations.RenameField"
] | [((225, 318), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""user"""', 'old_name': '"""profilePic"""', 'new_name': '"""profile_pic"""'}), "(model_name='user', old_name='profilePic', new_name=\n 'profile_pic')\n", (247, 318), False, 'from django.db import migrations\n')] |
from .models import Client
from import_export.admin import ImportExportModelAdmin
from django.contrib import admin
@admin.register(Client)
class ClientAdmin(ImportExportModelAdmin):
pass
| [
"django.contrib.admin.register"
] | [((118, 140), 'django.contrib.admin.register', 'admin.register', (['Client'], {}), '(Client)\n', (132, 140), False, 'from django.contrib import admin\n')] |
#!/usr/bin/env python
# $Id$
"""
1795 solutions total:
* 72 solutions omitting H
* 382 omitting J
* 607 omitting L
* 530 omitting N
* 204 omitting Y
All are perfect solutions (i.e. no pieces cross).
"""
import puzzler
from puzzler.puzzles.tetrasticks import Tetrasticks6x6
puzzler.run(Tetrasticks6x6)
| [
"puzzler.run"
] | [((278, 305), 'puzzler.run', 'puzzler.run', (['Tetrasticks6x6'], {}), '(Tetrasticks6x6)\n', (289, 305), False, 'import puzzler\n')] |
import numpy as np
def calculate(list):
if (len(list)<9):
raise ValueError('List must contain nine numbers.')
else :
arr = np.asarray(list)
arr = arr.reshape(3,3)
calculations = {'mean':[],'variance':[] ,'standard deviation':[],'max':[],'min':[],'sum':[]}
t1 = np.mean(arr, axis = 0)
t1 =... | [
"numpy.sum",
"numpy.std",
"numpy.asarray",
"numpy.max",
"numpy.mean",
"numpy.min",
"numpy.var"
] | [((138, 154), 'numpy.asarray', 'np.asarray', (['list'], {}), '(list)\n', (148, 154), True, 'import numpy as np\n'), ((289, 309), 'numpy.mean', 'np.mean', (['arr'], {'axis': '(0)'}), '(arr, axis=0)\n', (296, 309), True, 'import numpy as np\n'), ((342, 362), 'numpy.mean', 'np.mean', (['arr'], {'axis': '(1)'}), '(arr, axi... |
#!/usr/bin/env python3
from __future__ import print_function
from ROOT import TFile, gStyle,gPad ,TObject, TCanvas, TH1, TH1F, TH2F, TLegend, TPaletteAxis, TList, TLine, TAttLine, TF1,TAxis
import re
import sys, string
def getRunNumber(filename):
global runNumber
pos=filename.find("__")
runNumber=int(filen... | [
"ROOT.TFile"
] | [((5938, 5950), 'ROOT.TFile', 'TFile', (['fname'], {}), '(fname)\n', (5943, 5950), False, 'from ROOT import TFile, gStyle, gPad, TObject, TCanvas, TH1, TH1F, TH2F, TLegend, TPaletteAxis, TList, TLine, TAttLine, TF1, TAxis\n')] |
# The MIT License (MIT)
#
# Copyright (c) 2013 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | [
"mail.sendMail",
"chat.sendMsg",
"logging.getLogger"
] | [((1219, 1253), 'logging.getLogger', 'logging.getLogger', (['"""fserver.alert"""'], {}), "('fserver.alert')\n", (1236, 1253), False, 'import logging\n'), ((1625, 1661), 'chat.sendMsg', 'sendMsg', (['"""alerts"""', "('INFO. %s.' % msg)"], {}), "('alerts', 'INFO. %s.' % msg)\n", (1632, 1661), False, 'from chat import sen... |
from __future__ import unicode_literals
from django.contrib.auth.models import User
import datetime
from django.utils import timezone
from taggit.managers import TaggableManager
from taggit.models import TaggedItemBase
from django.db import models
class PostTag(TaggedItemBase):
content_object = models.ForeignKey... | [
"django.db.models.FileField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.SlugField",
"taggit.managers.TaggableManager",
"django.db.models.DateTimeField"
] | [((303, 328), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""Post"""'], {}), "('Post')\n", (320, 328), False, 'from django.db import models\n'), ((548, 580), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (564, 580), False, 'from django.db import models... |
import falcon
import pytest
from ebl.fragmentarium.application.fragment_info_schema import ApiFragmentInfoSchema
from ebl.fragmentarium.domain.fragment_info import FragmentInfo
from ebl.tests.factories.bibliography import ReferenceFactory, BibliographyEntryFactory
from ebl.tests.factories.fragment import (
Fragmen... | [
"ebl.tests.factories.bibliography.ReferenceFactory.build",
"ebl.tests.factories.bibliography.BibliographyEntryFactory.build",
"ebl.transliteration.domain.museum_number.MuseumNumber",
"ebl.tests.factories.fragment.FragmentFactory.build",
"ebl.fragmentarium.application.fragment_info_schema.ApiFragmentInfoSche... | [((7823, 8028), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""parameters"""', "[{}, {'random': True, 'interesting': True}, {'random': True, 'interesting':\n True, 'pages': '254'}, {'invalid': 'parameter'}, {'a': 'a', 'b': 'b',\n 'c': 'c'}]"], {}), "('parameters', [{}, {'random': True, 'interesting':... |
#!/usr/bin/env python
import pytest
from blastsight.model.parsers.gslibparser import GSLibParser as Parser
from tests.globals import *
class TestGSLibParser:
def test_load(self):
info = Parser.load_file(f'{TEST_FILES_FOLDER_PATH}/mini.out')
data = info.get('data')
assert data is not None
... | [
"blastsight.model.parsers.gslibparser.GSLibParser.save_file",
"pytest.raises",
"blastsight.model.parsers.gslibparser.GSLibParser.load_file"
] | [((201, 255), 'blastsight.model.parsers.gslibparser.GSLibParser.load_file', 'Parser.load_file', (['f"""{TEST_FILES_FOLDER_PATH}/mini.out"""'], {}), "(f'{TEST_FILES_FOLDER_PATH}/mini.out')\n", (217, 255), True, 'from blastsight.model.parsers.gslibparser import GSLibParser as Parser\n'), ((602, 662), 'blastsight.model.pa... |
from django.db import models
from django.utils import timezone
class EventIcon(models.Model):
Name = models.CharField(max_length = 50)
Image = models.FileField(upload_to = "icon_images/")
def __str__(self):
return self.Name
def convertHours(Hours):
ReturnUnit = "hour"
ReturnValue = Ho... | [
"django.db.models.FileField",
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.utils.timezone.now",
"django.db.models.DateTimeField"
] | [((106, 137), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (122, 137), False, 'from django.db import models\n'), ((152, 194), 'django.db.models.FileField', 'models.FileField', ([], {'upload_to': '"""icon_images/"""'}), "(upload_to='icon_images/')\n", (168, 194), F... |
"""Device that implements a ball save."""
import asyncio
from typing import Optional
from mpf.core.delays import DelayManager
from mpf.core.device_monitor import DeviceMonitor
from mpf.core.events import event_handler
from mpf.core.mode import Mode
from mpf.core.mode_device import ModeDevice
from mpf.core.system_wide_... | [
"mpf.core.device_monitor.DeviceMonitor",
"mpf.core.delays.DelayManager",
"mpf.core.events.event_handler"
] | [((602, 671), 'mpf.core.device_monitor.DeviceMonitor', 'DeviceMonitor', (['"""saves_remaining"""', '"""enabled"""', '"""timer_started"""', '"""state"""'], {}), "('saves_remaining', 'enabled', 'timer_started', 'state')\n", (615, 671), False, 'from mpf.core.device_monitor import DeviceMonitor\n'), ((3726, 3742), 'mpf.cor... |
from sqlalchemy import create_engine
from redata import settings
from sqlalchemy.orm import sessionmaker
from redata.backends.postgrsql import Postgres
from redata.backends.mysql import MySQL
from redata.backends.bigquery import BigQuery
from redata.backends.exasol import Exasol, ExasolEngine
from redata import setting... | [
"redata.backends.mysql.MySQL",
"redata.backends.postgrsql.Postgres",
"redata.backends.exasol.ExasolEngine",
"redata.backends.bigquery.BigQuery",
"sqlalchemy.create_engine",
"sqlalchemy.orm.sessionmaker"
] | [((1358, 1387), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {'bind': 'metrics_db'}), '(bind=metrics_db)\n', (1370, 1387), False, 'from sqlalchemy.orm import sessionmaker\n'), ((699, 720), 'sqlalchemy.create_engine', 'create_engine', (['db_url'], {}), '(db_url)\n', (712, 720), False, 'from sqlalchemy import crea... |
#!/usr/bin/env python
# Author: <NAME>
# Purpose: svgwrite examples
# Created: 2012/5/31
# Copyright (C) 2012, <NAME>
# License: LGPL
# Python version 2.7
import math, sys
import random
import svgwrite
# globals
PROGNAME = sys.argv[0].rstrip('.py')
file_log = ''
dwg = ''
def gen_colour(start_p,... | [
"math.fmod",
"random.randint",
"random.uniform",
"svgwrite.Drawing",
"math.sin",
"math.cos"
] | [((10138, 10207), 'svgwrite.Drawing', 'svgwrite.Drawing', (['name', '(svg_size_width, svg_size_height)'], {'debug': '(True)'}), '(name, (svg_size_width, svg_size_height), debug=True)\n', (10154, 10207), False, 'import svgwrite\n'), ((3853, 3882), 'math.fmod', 'math.fmod', (['p_val', '(2 * math.pi)'], {}), '(p_val, 2 * ... |
import snappy
from snappy import (ProductIO, GPF, jpy)
import os, re
import glob
import imp,sys
import math
from scipy.io import loadmat
import config
import time
import warnings
import datetime
import logging
warnings.filterwarnings("ignore")
logger = logging.getLogger()
home = os.getcwd()
name_of_area = config.name... | [
"imp.reload",
"warnings.filterwarnings",
"os.getcwd",
"snappy.jpy.get_type",
"os.path.exists",
"snappy.ProductIO.readProduct",
"math.floor",
"time.sleep",
"datetime.datetime.strptime",
"re.findall",
"glob.glob",
"snappy.PixelPos",
"logging.getLogger"
] | [((210, 243), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (233, 243), False, 'import warnings\n'), ((254, 273), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (271, 273), False, 'import logging\n'), ((282, 293), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (... |
import numpy as np
import pandas as pd
from requests.exceptions import HTTPError
import xarray as xr
from toffy.mibitracker_utils import MibiRequests
from toffy import qc_comp
from toffy import settings
import ark.utils.io_utils as io_utils
import ark.utils.misc_utils as misc_utils
import ark.utils.test_utils as test_... | [
"os.mkdir",
"toffy.qc_comp.visualize_qc_metrics",
"pandas.read_csv",
"numpy.allclose",
"toffy.qc_comp.download_mibitracker_data",
"pathlib.Path",
"toffy.qc_comp.compute_nonzero_mean_intensity",
"numpy.arange",
"pytest.mark.parametrize",
"os.path.join",
"pandas.DataFrame",
"tempfile.TemporaryDi... | [((1974, 2093), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""test_fovs,test_chans,test_sub_folder,actual_points,actual_ids"""', 'FOVS_CHANS_TEST_MIBI'], {}), "(\n 'test_fovs,test_chans,test_sub_folder,actual_points,actual_ids',\n FOVS_CHANS_TEST_MIBI)\n", (1997, 2093), False, 'import pytest\n'), ((... |
### CoronAlert Scanner for CLUE
### Listen to Contact Tracing message and display the number phones nearby simultaneous in 3 different ways:
### (1) CLUE graphic mode with 16 big square pixels
### (2) NeoPixel connected to the CLUE P2 (like on a SnowPi RGB)
### (3) NeoTrellis connected to the CLUE (connected over I2C)
... | [
"board.I2C",
"displayio.Group",
"displayio.Bitmap",
"displayio.Palette",
"time.monotonic_ns",
"time.sleep",
"adafruit_ble.BLERadio",
"displayio.TileGrid",
"neopixel.NeoPixel",
"adafruit_neotrellis.neotrellis.NeoTrellis"
] | [((3230, 3286), 'neopixel.NeoPixel', 'neopixel.NeoPixel', (['board.P2', 'rows'], {'brightness': 'BRIGHTNESS'}), '(board.P2, rows, brightness=BRIGHTNESS)\n', (3247, 3286), False, 'import neopixel\n'), ((3713, 3732), 'time.monotonic_ns', 'time.monotonic_ns', ([], {}), '()\n', (3730, 3732), False, 'import time\n'), ((4131... |
from scanner.functions.unix.mount_parser import MountFinditer
def test_simple_case():
text = 'sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)'
result = list(MountFinditer(text=text))
assert len(result) == 1
item = result[0]
assert item.Device == 'sysfs'
assert item.Path == '/sys'
... | [
"scanner.functions.unix.mount_parser.MountFinditer"
] | [((178, 202), 'scanner.functions.unix.mount_parser.MountFinditer', 'MountFinditer', ([], {'text': 'text'}), '(text=text)\n', (191, 202), False, 'from scanner.functions.unix.mount_parser import MountFinditer\n')] |
# -*- coding: utf-8 -*
from django.core.urlresolvers import reverse
from django.test import TestCase
from dials.models import Dial
class DialTestCase(TestCase):
def test_dial_pages(self):
Dial.objects.create(slug="dial", precent="42",
description="ככה")
ret = self.client.get(reve... | [
"dials.models.Dial.objects.create",
"django.core.urlresolvers.reverse"
] | [((204, 269), 'dials.models.Dial.objects.create', 'Dial.objects.create', ([], {'slug': '"""dial"""', 'precent': '"""42"""', 'description': '"""ככה"""'}), "(slug='dial', precent='42', description='ככה')\n", (223, 269), False, 'from dials.models import Dial\n'), ((316, 360), 'django.core.urlresolvers.reverse', 'reverse',... |
import json
from helpers.event_manipulator import EventManipulator
from helpers.memcache.memcache_webcast_flusher import MemcacheWebcastFlusher
class EventWebcastAdder(object):
@classmethod
def add_webcast(cls, event, webcast):
"""Takes a webcast dictionary and adds it to an event"""
if eve... | [
"helpers.event_manipulator.EventManipulator.createOrUpdate",
"json.dumps",
"helpers.memcache.memcache_webcast_flusher.MemcacheWebcastFlusher.flushEvent"
] | [((655, 693), 'helpers.event_manipulator.EventManipulator.createOrUpdate', 'EventManipulator.createOrUpdate', (['event'], {}), '(event)\n', (686, 693), False, 'from helpers.event_manipulator import EventManipulator\n'), ((702, 751), 'helpers.memcache.memcache_webcast_flusher.MemcacheWebcastFlusher.flushEvent', 'Memcach... |
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import core, automation
from esphome.automation import maybe_simple_id
from esphome.const import (
CONF_AUTO_CLEAR_ENABLED,
CONF_ID,
CONF_LAMBDA,
CONF_PAGES,
CONF_PAGE_ID,
CONF_ROTATION,
CONF_FROM,
CONF_TO,
... | [
"esphome.config_validation.Length",
"esphome.codegen.templatable",
"esphome.config_validation.use_id",
"esphome.config_validation.declare_id",
"esphome.automation.build_automation",
"esphome.config_validation.string",
"esphome.config_validation.Required",
"esphome.codegen.add_global",
"esphome.codeg... | [((436, 470), 'esphome.codegen.esphome_ns.namespace', 'cg.esphome_ns.namespace', (['"""display"""'], {}), "('display')\n", (459, 470), True, 'import esphome.codegen as cg\n'), ((5822, 5852), 'esphome.core.coroutine_with_priority', 'coroutine_with_priority', (['(100.0)'], {}), '(100.0)\n', (5845, 5852), False, 'from esp... |
"""Comparison of RBF and polynomial kernels for SVM"""
import numpy as np
from pmlb import classification_dataset_names, fetch_data
from sklearn.dummy import DummyClassifier, DummyRegressor
from sklearn.model_selection import (GridSearchCV, cross_val_score,
train_test_split)
from sk... | [
"sklearn.dummy.DummyClassifier",
"sklearn.preprocessing.StandardScaler",
"sklearn.model_selection.cross_val_score",
"numpy.logspace",
"pmlb.fetch_data",
"numpy.mean",
"sklearn.svm.SVC",
"numpy.round"
] | [((1183, 1208), 'pmlb.fetch_data', 'fetch_data', (['dataset', '(True)'], {}), '(dataset, True)\n', (1193, 1208), False, 'from pmlb import classification_dataset_names, fetch_data\n'), ((1433, 1477), 'sklearn.model_selection.cross_val_score', 'cross_val_score', (['poly', 'X', 'y'], {'cv': '(5)', 'n_jobs': '(-1)'}), '(po... |
import matplotlib.pyplot as plt
import ccxt
pair = 'XRP/BTC'
gateways = [ccxt.cex(), ccxt.poloniex(), ccxt.binance(), ccxt.kraken(), ccxt.bitfinex2()]
def percentage(percent, whole) -> float:
return (percent * whole) / 100.0
def display_ticker(g, p):
bid = 0
volume = 0
try:
t = g.fetch_tick... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.annotate",
"matplotlib.pyplot.scatter",
"ccxt.binance",
"matplotlib.pyplot.axis",
"ccxt.kraken",
"ccxt.poloniex",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"ccxt.cex",
"ccxt.bitfinex2"
] | [((74, 84), 'ccxt.cex', 'ccxt.cex', ([], {}), '()\n', (82, 84), False, 'import ccxt\n'), ((86, 101), 'ccxt.poloniex', 'ccxt.poloniex', ([], {}), '()\n', (99, 101), False, 'import ccxt\n'), ((103, 117), 'ccxt.binance', 'ccxt.binance', ([], {}), '()\n', (115, 117), False, 'import ccxt\n'), ((119, 132), 'ccxt.kraken', 'cc... |
'''
Author: <NAME>
Python: 3.6.0
Date: 24/6/2017
'''
import pandas as pd
import numpy as np
from nltk.corpus import stopwords
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cross_validation import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.m... | [
"pandas.DataFrame",
"pandas.read_csv",
"sklearn.feature_extraction.text.TfidfVectorizer",
"sklearn.model_selection.cross_val_score",
"sklearn.ensemble.RandomForestRegressor",
"pandas.to_datetime",
"nltk.corpus.stopwords.words"
] | [((590, 625), 'pandas.read_csv', 'pd.read_csv', (['TEXT_PATH'], {'index_col': '(0)'}), '(TEXT_PATH, index_col=0)\n', (601, 625), True, 'import pandas as pd\n'), ((637, 666), 'pandas.read_csv', 'pd.read_csv', (['DATA_OUTPUT_PATH'], {}), '(DATA_OUTPUT_PATH)\n', (648, 666), True, 'import pandas as pd\n'), ((714, 745), 'pa... |
# !/usr/bin/env python
# -*- coding: UTF-8 -*-
# /Users/kristen/_tmp/Ontospy/ontospy/core/__init__.py
import logging
import os
import sys
from ..VERSION import VERSION
from ..VERSION import __version__
from .ontospy import Ontospy
from .utils import printDebug
logging.basicConfig()
try:
from configparser impor... | [
"os.path.abspath",
"os.path.expanduser",
"logging.basicConfig"
] | [((265, 286), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (284, 286), False, 'import logging\n'), ((831, 856), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (846, 856), False, 'import os\n'), ((917, 940), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~... |
# -*- coding: utf-8 -*-
"""The Windows Restore Point (rp.log) file event formatter."""
from __future__ import unicode_literals
from plaso.formatters import interface
from plaso.formatters import manager
class RestorePointInfoFormatter(interface.ConditionalEventFormatter):
"""Formatter for a Windows Restore Point ... | [
"plaso.formatters.interface.EnumerationEventFormatterHelper",
"plaso.formatters.manager.FormattersManager.RegisterFormatter"
] | [((1689, 1759), 'plaso.formatters.manager.FormattersManager.RegisterFormatter', 'manager.FormattersManager.RegisterFormatter', (['RestorePointInfoFormatter'], {}), '(RestorePointInfoFormatter)\n', (1732, 1759), False, 'from plaso.formatters import manager\n'), ((1203, 1401), 'plaso.formatters.interface.EnumerationEvent... |
import inspect
from types import FunctionType
def filter_kwargs(func: FunctionType, kwarg_dict: dict) -> dict:
"""Abstraction to ignore unexpected keyword arguments."""
sign = inspect.signature(func).parameters.values()
sign = set([val.name for val in sign])
common_args = sign.intersection(kwarg_dict... | [
"inspect.signature"
] | [((186, 209), 'inspect.signature', 'inspect.signature', (['func'], {}), '(func)\n', (203, 209), False, 'import inspect\n')] |
import numpy as np
import sys
'''
v0.2 Nov. 23, 2017
- add test_circumcenterSphTri()
v0.1 Nov. 23, 2017
- add calc_xc()
- add calc_gamma()
- add calc_beta()
- add calc_denom()
- add calc_alpha()
- add calc_dotProduct_2d()
- add calc_verticesDistance()
- add circumcenterSphTri()
'''
def calc_dotProd... | [
"numpy.sum",
"numpy.cross",
"numpy.array",
"numpy.tile",
"numpy.dot"
] | [((503, 516), 'numpy.array', 'np.array', (['res'], {}), '(res)\n', (511, 516), True, 'import numpy as np\n'), ((1087, 1105), 'numpy.cross', 'np.cross', (['lhs', 'rhs'], {}), '(lhs, rhs)\n', (1095, 1105), True, 'import numpy as np\n'), ((1156, 1175), 'numpy.array', 'np.array', (['(crs * crs)'], {}), '(crs * crs)\n', (11... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import os
import url... | [
"pants.cache.local_artifact_cache.LocalArtifactCache",
"pants.cache.local_artifact_cache.TempLocalArtifactCache",
"urlparse.urlparse",
"pants.cache.pinger.Pinger",
"pants.cache.restful_artifact_cache.RESTfulArtifactCache",
"os.path.join"
] | [((3222, 3251), 'os.path.join', 'os.path.join', (['spec', 'task_name'], {}), '(spec, task_name)\n', (3234, 3251), False, 'import os\n'), ((3352, 3404), 'pants.cache.local_artifact_cache.LocalArtifactCache', 'LocalArtifactCache', (['artifact_root', 'path', 'compression'], {}), '(artifact_root, path, compression)\n', (33... |
from kivy.properties import ListProperty, ObjectProperty, StringProperty, \
NumericProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.lang import Builder
from kivy.graphics import Color, Line
from kivy.app import App
import numpy as np
im... | [
"kivy.properties.ListProperty",
"kivy.graphics.Line",
"kivy.lang.Builder.load_string",
"numpy.random.randn",
"kivy.properties.StringProperty",
"kivy.uix.button.Button",
"kivy.uix.boxlayout.BoxLayout",
"random.random",
"kivy.graphics.Color",
"kivy.properties.ObjectProperty"
] | [((411, 1693), 'kivy.lang.Builder.load_string', 'Builder.load_string', (['"""\n#: import platform sys.platform\n<LegendLabel>:\n orientation: \'horizontal\'\n Label:\n size_hint_x: 0.25\n canvas.before:\n Color:\n hsv: root.hsv + [1]\n Line:\n widt... |
from io import StringIO
import os
import shlex
import subprocess
import tempfile
from typing import Optional, Union
from loguru import logger
from commandfrog.config import Config
from commandfrog.drivers.driver import Driver
from commandfrog.operations.files import directory
from commandfrog.utils import set_env
fr... | [
"subprocess.run",
"tempfile.NamedTemporaryFile",
"os.path.dirname",
"shlex.quote",
"commandfrog.utils.set_env",
"loguru.logger.debug",
"os.path.expanduser"
] | [((3007, 3099), 'subprocess.run', 'subprocess.run', (['f"""docker commit {self.container_id}"""'], {'stdout': 'subprocess.PIPE', 'shell': '(True)'}), "(f'docker commit {self.container_id}', stdout=subprocess.PIPE,\n shell=True)\n", (3021, 3099), False, 'import subprocess\n'), ((1789, 1810), 'os.path.dirname', 'os.pa... |
from flask import Flask, request, jsonify
from datetime import *;
from dateutil.relativedelta import *
import requests
import json
app = Flask(__name__, static_folder="./static")
# re-deploy
# az webapp up
@app.route('/')
def index():
return app.send_static_file("index.html")
@app.route('/search', methods=['GET... | [
"requests.get",
"flask.Flask",
"json.loads",
"flask.request.args.get"
] | [((137, 178), 'flask.Flask', 'Flask', (['__name__'], {'static_folder': '"""./static"""'}), "(__name__, static_folder='./static')\n", (142, 178), False, 'from flask import Flask, request, jsonify\n'), ((375, 401), 'flask.request.args.get', 'request.args.get', (['"""symbol"""'], {}), "('symbol')\n", (391, 401), False, 'f... |
import pymesh
import json
import pathlib
import copy
import math
import itertools
import numpy
from scipy.spatial.transform import Rotation
import context
from fixture_utils import save_fixture, get_fixture_dir_path, get_meshes_dir_path
scale = 1
barring = {
"mesh": "507-movements/227-chain-pully/barring.obj",... | [
"copy.deepcopy",
"fixture_utils.get_meshes_dir_path",
"pymesh.form_mesh",
"numpy.arctan2",
"scipy.spatial.transform.Rotation.from_euler",
"fixture_utils.get_fixture_dir_path",
"numpy.empty",
"numpy.zeros",
"numpy.hstack",
"numpy.sin",
"numpy.linalg.norm",
"numpy.array",
"numpy.cos",
"numpy... | [((1068, 1093), 'numpy.zeros', 'numpy.zeros', (['angles.shape'], {}), '(angles.shape)\n', (1079, 1093), False, 'import numpy\n'), ((1105, 1128), 'numpy.hstack', 'numpy.hstack', (['[x, y, z]'], {}), '([x, y, z])\n', (1117, 1128), False, 'import numpy\n'), ((1184, 1215), 'numpy.empty', 'numpy.empty', (['(num_links + 1, 3... |
import numpy as np
import pandas as pd
from neural_network import Neural_Network
from sklearn.metrics import accuracy_score
from sklearn.linear_model import LogisticRegression
from visualization import plot_decision_boundary
def read_data(x_file, y_file):
data = []
labels = []
with open(x_file, "r") as x_... | [
"pandas.read_csv",
"sklearn.metrics.accuracy_score",
"numpy.zeros",
"sklearn.linear_model.LogisticRegression",
"numpy.array"
] | [((610, 640), 'pandas.read_csv', 'pd.read_csv', (['file'], {'header': 'None'}), '(file, header=None)\n', (621, 640), True, 'import pandas as pd\n'), ((938, 958), 'sklearn.linear_model.LogisticRegression', 'LogisticRegression', ([], {}), '()\n', (956, 958), False, 'from sklearn.linear_model import LogisticRegression\n')... |
import streamlit as st
import pandas as pd
import numpy as np
import plotly.express as px
from plotly.subplots import make_subplots
import plotly.graph_objects as go
import matplotlib.pyplot as plt
import seaborn as sns
import pickle
from PIL import Image
import os
from fastai.vision.all import *
st.sidebar.image("./p... | [
"streamlit.balloons",
"streamlit.sidebar.header",
"streamlit.columns",
"streamlit.image",
"streamlit.error",
"streamlit.title",
"streamlit.file_uploader",
"streamlit.write",
"PIL.Image.open",
"streamlit.sidebar.selectbox",
"streamlit.button",
"streamlit.info",
"streamlit.text",
"streamlit.... | [((299, 440), 'streamlit.sidebar.image', 'st.sidebar.image', (['"""./pics/superai.png"""'], {'caption': 'None', 'width': '(300)', 'use_column_width': 'None', 'clamp': '(False)', 'channels': '"""RGB"""', 'output_format': '"""auto"""'}), "('./pics/superai.png', caption=None, width=300,\n use_column_width=None, clamp=F... |
#!/usr/bin/env python3
""" Installs any required third party libs for faceswap.py
Checks for installed Conda / Pip packages and updates accordingly
"""
from setup import Environment, Install, Output
_LOGGER = None
def output(msg):
""" Output to print or logger """
if _LOGGER is not None:
_LOGGE... | [
"setup.Output",
"setup.Environment",
"setup.Install"
] | [((602, 642), 'setup.Environment', 'Environment', ([], {'logger': 'logger', 'updater': '(True)'}), '(logger=logger, updater=True)\n', (613, 642), False, 'from setup import Environment, Install, Output\n'), ((647, 662), 'setup.Install', 'Install', (['update'], {}), '(update)\n', (654, 662), False, 'from setup import Env... |
from django.utils import timezone
from datetime import datetime, timedelta
from django.db import transaction
from django.contrib.auth.models import User
from django.utils import translation
from django_tenants.test.cases import TenantTestCase
from django_tenants.test.client import TenantClient
from rest_framework.test ... | [
"foundation_public.utils.latest_date_between",
"django.utils.timezone.now",
"foundation_public.utils.latest_date_in",
"foundation_public.utils.get_pretty_formatted_date",
"datetime.timedelta",
"foundation_public.utils.random_text",
"foundation_public.utils.get_unique_username_from_email"
] | [((1269, 1310), 'foundation_public.utils.get_unique_username_from_email', 'get_unique_username_from_email', (['"""<EMAIL>"""'], {}), "('<EMAIL>')\n", (1299, 1310), False, 'from foundation_public.utils import get_unique_username_from_email\n'), ((1444, 1458), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n'... |
import datetime
from enum import Enum
from gaea.log import logger
from gaea.models import (
SwarmHealthStatuses,
HiveConditions,
HoneyTypes,
EventStatuses,
Owners,
EventTypes,
)
from gaea.webapp.utils import get_session
from fastapi import APIRouter, Depends, Cookie, HTTPException
from pydantic ... | [
"gaea.log.logger.exception",
"gaea.log.logger.info",
"fastapi.Cookie",
"fastapi.HTTPException",
"datetime.datetime.utcnow",
"gaea.helpers.auth.get_logged_in_user",
"fastapi.Depends",
"fastapi.APIRouter"
] | [((559, 570), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (568, 570), False, 'from fastapi import APIRouter, Depends, Cookie, HTTPException\n'), ((974, 986), 'fastapi.Cookie', 'Cookie', (['None'], {}), '(None)\n', (980, 986), False, 'from fastapi import APIRouter, Depends, Cookie, HTTPException\n'), ((1011, 103... |
import os
from os.path import join, dirname, abspath, isdir
def in_tst_dir(filename):
return join(dirname(abspath(__file__)), filename)
def in_tst_output_dir(filename):
output_dir = join(dirname(abspath(__file__)), 'output')
if not isdir(output_dir):
os.mkdir(output_dir, 0o755)
return join(out... | [
"os.path.isdir",
"os.mkdir",
"os.path.abspath",
"os.path.join"
] | [((312, 338), 'os.path.join', 'join', (['output_dir', 'filename'], {}), '(output_dir, filename)\n', (316, 338), False, 'from os.path import join, dirname, abspath, isdir\n'), ((246, 263), 'os.path.isdir', 'isdir', (['output_dir'], {}), '(output_dir)\n', (251, 263), False, 'from os.path import join, dirname, abspath, is... |
import numpy as np
import pytest
from pyinfraformat.core.utils import (
custom_float,
custom_int,
info_fi,
is_number,
print_info,
)
@pytest.mark.parametrize(
"nums",
[
(1, True),
("1", True),
("1.1", True),
("1j", True),
("1.j", True),
("-",... | [
"pyinfraformat.core.utils.is_number",
"pyinfraformat.core.utils.print_info",
"numpy.isnan",
"pytest.raises",
"pyinfraformat.core.utils.custom_int",
"pytest.mark.parametrize",
"pyinfraformat.core.utils.info_fi",
"pyinfraformat.core.utils.custom_float"
] | [((156, 304), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""nums"""', "[(1, True), ('1', True), ('1.1', True), ('1j', True), ('1.j', True), ('-', \n True), ('a', False), ('1a', False)]"], {}), "('nums', [(1, True), ('1', True), ('1.1', True), (\n '1j', True), ('1.j', True), ('-', True), ('a', False)... |
import os
import shutil
# 读取annotations中所有文件
# 读取images中所有文件
# 将
anns = os.listdir('annotations')
images = os.listdir('images')
train_file_txt = ''
wd = os.getcwd()
def moverecursively(source_folder, destination_folder):
basename = os.path.basename(source_folder)
dest_dir = os.path.join(destination_folder, b... | [
"os.remove",
"os.path.basename",
"os.getcwd",
"os.walk",
"os.path.exists",
"shutil.move",
"os.path.join",
"os.listdir"
] | [((73, 98), 'os.listdir', 'os.listdir', (['"""annotations"""'], {}), "('annotations')\n", (83, 98), False, 'import os\n'), ((108, 128), 'os.listdir', 'os.listdir', (['"""images"""'], {}), "('images')\n", (118, 128), False, 'import os\n'), ((155, 166), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (164, 166), False, 'impo... |
from typing import Any, Dict, List, Type, Union
from django import template
from django.forms import BooleanField, BoundField, CharField, Field, ImageField, ModelChoiceField
from django.template import Context
from django.template.loader import get_template
from django.utils.safestring import SafeText, mark_safe
from ... | [
"django.template.Library",
"django.template.loader.get_template"
] | [((929, 947), 'django.template.Library', 'template.Library', ([], {}), '()\n', (945, 947), False, 'from django import template\n'), ((1738, 1765), 'django.template.loader.get_template', 'get_template', (['template_path'], {}), '(template_path)\n', (1750, 1765), False, 'from django.template.loader import get_template\n'... |
#!/usr/bin/env python3
#
################################################################################
# Name: fibonacci_hashtest.py
# Author: <NAME> <<EMAIL>>
# Created On: April 25, 2018
# Last Changed: August 8, 2018
# Purpose: Generate Fibonacci numbers and hash them against randomly
# generated salts
########... | [
"os.remove",
"uuid.uuid4",
"gzip.open",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.isdir",
"time.strftime",
"time.time",
"os.path.isfile",
"shutil.move",
"shutil.copyfileobj"
] | [((441, 452), 'time.time', 'time.time', ([], {}), '()\n', (450, 452), False, 'import time\n'), ((465, 494), 'time.strftime', 'time.strftime', (['"""%S%M%H%d%m%Y"""'], {}), "('%S%M%H%d%m%Y')\n", (478, 494), False, 'import time\n'), ((711, 833), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '... |
# encoding: utf-8
"""
@author: sherlock
@contact: <EMAIL>
add by chenyifan
<EMAIL>
"""
import glob
import re
import os.path as osp
from .bases import BaseImageDataset
class PartialREID(BaseImageDataset):
"""
Partial_REID
Reference:
@inproceedings{zheng2015partial,
title={Partial person re... | [
"os.path.join",
"os.path.exists",
"re.compile"
] | [((933, 978), 'os.path.join', 'osp.join', (['root', 'self.Partial_REID_dataset_dir'], {}), '(root, self.Partial_REID_dataset_dir)\n', (941, 978), True, 'import os.path as osp\n'), ((1018, 1062), 'os.path.join', 'osp.join', (['root', 'self.Market_1501_dataset_dir'], {}), '(root, self.Market_1501_dataset_dir)\n', (1026, ... |
"""
eZmax API Definition (Full)
This API expose all the functionnalities for the eZmax and eZsign applications. # noqa: E501
The version of the OpenAPI document: 1.1.7
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from eZmaxA... | [
"eZmaxApi.api_client.ApiClient",
"eZmaxApi.api_client.Endpoint"
] | [((4172, 5294), 'eZmaxApi.api_client.Endpoint', '_Endpoint', ([], {'settings': "{'response_type': (EzsigndocumentApplyEzsigntemplateV1Response,), 'auth': [\n 'Authorization'], 'endpoint_path':\n '/1/object/ezsigndocument/{pkiEzsigndocumentID}/applyezsigntemplate',\n 'operation_id': 'ezsigndocument_apply_ezsign... |
#!/usr/bin/env python
import sys
import time
import subprocess
import random
import threading
import requests
import json
import uuid
from command_args import get_args, get_mandatory_arg, get_optional_arg, is_true
from KafkaProducer import KafkaProducer
from KafkaConsumer import KafkaConsumer
from ChaosExecutor import... | [
"threading.Thread",
"printer.console_out",
"ConsumerManager.ConsumerManager",
"command_args.get_args",
"time.sleep",
"command_args.get_optional_arg",
"BrokerManager.BrokerManager",
"KafkaProducer.KafkaProducer",
"subprocess.call",
"uuid.uuid1",
"MessageMonitor.MessageMonitor",
"command_args.ge... | [((517, 535), 'command_args.get_args', 'get_args', (['sys.argv'], {}), '(sys.argv)\n', (525, 535), False, 'from command_args import get_args, get_mandatory_arg, get_optional_arg, is_true\n'), ((688, 722), 'command_args.get_mandatory_arg', 'get_mandatory_arg', (['args', '"""--topic"""'], {}), "(args, '--topic')\n", (705... |
import random
R = []
for i in range(10):
alea = random.randint(1, 20)
R.append(alea)
long = len(R)
print("[", end="")
for i in range(long):
print(R[i], end=": ")
print(f"]")
print("[", end="")
for Ri in R:
print(Ri, end=": ")
print(f"]")
somme = 0
for Ri in R:
somme = somme + Ri
print(f"So... | [
"random.randint"
] | [((54, 75), 'random.randint', 'random.randint', (['(1)', '(20)'], {}), '(1, 20)\n', (68, 75), False, 'import random\n')] |
"""
## Cloud Executable API
<!--BEGIN STABILITY BANNER-->---

> The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backwa... | [
"jsii.data_type",
"jsii.invoke",
"jsii.create",
"jsii.member",
"jsii.enum",
"jsii.get",
"jsii.interface",
"jsii.sget",
"jsii.sinvoke",
"publication.publish"
] | [((963, 1099), 'jsii.data_type', 'jsii.data_type', ([], {'jsii_type': '"""@aws-cdk/cx-api.AssemblyBuildOptions"""', 'jsii_struct_bases': '[]', 'name_mapping': "{'runtime_info': 'runtimeInfo'}"}), "(jsii_type='@aws-cdk/cx-api.AssemblyBuildOptions',\n jsii_struct_bases=[], name_mapping={'runtime_info': 'runtimeInfo'})... |
from __future__ import print_function
from .cmseq import CMSEQ_DEFAULTS
from .cmseq import BamFile
import pandas as pd
import numpy as np
import argparse
def bd_from_file():
parser = argparse.ArgumentParser(description="calculate the Breadth and Depth of coverage of BAMFILE.")
parser.add_argument('BAMFILE', hel... | [
"numpy.nanmean",
"argparse.ArgumentParser",
"numpy.isnan",
"numpy.nanmedian"
] | [((189, 288), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""calculate the Breadth and Depth of coverage of BAMFILE."""'}), "(description=\n 'calculate the Breadth and Depth of coverage of BAMFILE.')\n", (212, 288), False, 'import argparse\n'), ((2596, 2625), 'numpy.isnan', 'np.isnan'... |
from typing import Iterator, List
from words.token_types.lexer_token import LexerToken
from words.parser.parse_util import Program
class Parser:
"""
The Parser class is used to for parsing lexer tokens into a program the interpreter can interpret.
"""
@staticmethod
def parse(tokens: Iterator[Lexe... | [
"words.parser.parse_util.Program"
] | [((709, 731), 'words.parser.parse_util.Program', 'Program', (['parsed_tokens'], {}), '(parsed_tokens)\n', (716, 731), False, 'from words.parser.parse_util import Program\n')] |
from pyspider.libs.base_handler import *
from my import My
from bs4 import BeautifulSoup
'''云浮'''
class Handler(My):
name = "YF"
@every(minutes=24 * 60)
def on_start(self):
url = 'http://gtzy.yunfu.gov.cn/website/newdeptemps/gtzy/news.jsp?columnid=009001056011&ipage=1'
# 爬取 url 网页,回调i... | [
"bs4.BeautifulSoup"
] | [((778, 821), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response.text', '"""html.parser"""'], {}), "(response.text, 'html.parser')\n", (791, 821), False, 'from bs4 import BeautifulSoup\n'), ((1943, 1986), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response.text', '"""html.parser"""'], {}), "(response.text, 'html.parser')\... |
from __future__ import print_function
import pickle
import os.path
import shutil
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from argparse import ArgumentParser, Namespace
from zope.interface import implementer
from quickmail.commands import ICommand
from... | [
"pickle.dump",
"google.auth.transport.requests.Request",
"zope.interface.implementer",
"shutil.copy2",
"pickle.load",
"google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file"
] | [((604, 625), 'zope.interface.implementer', 'implementer', (['ICommand'], {}), '(ICommand)\n', (615, 625), False, 'from zope.interface import implementer\n'), ((1649, 1690), 'shutil.copy2', 'shutil.copy2', (['path', 'quick_mail_creds_file'], {}), '(path, quick_mail_creds_file)\n', (1661, 1690), False, 'import shutil\n'... |
"""
Author : <NAME> (<EMAIL>)
Institution : Vrije Universiteit Brussel (VUB)
Date : November 2019
Main script for heat calculation and plotting
"""
#%%
# -------------------------------------------------------------------------
# PYTHON PACKAGES
# ---------------------------------------------------------... | [
"os.getcwd",
"cdo.Cdo",
"numpy.load"
] | [((417, 422), 'cdo.Cdo', 'Cdo', ([], {}), '()\n', (420, 422), False, 'from cdo import Cdo\n'), ((2078, 2089), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2087, 2089), False, 'import os\n'), ((377, 388), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (386, 388), False, 'import os\n'), ((5760, 5821), 'numpy.load', 'np.load... |
from pyomo.environ import Block, Expression, NonNegativeReals, Var, units as pyunits
from watertap3.utils import financials
from watertap3.wt_units.wt_unit import WT3UnitProcess
## REFERENCE:
## CAPITAL
# Developed from <NAME> and produced water case study data
module_name = 'deep_well_injection'
basis_year = 2011
tp... | [
"pyomo.environ.Var",
"watertap3.utils.financials.get_complete_costing",
"pyomo.environ.units.convert",
"watertap3.utils.financials.create_costing_block"
] | [((979, 1085), 'pyomo.environ.Var', 'Var', (['time'], {'initialize': '(400)', 'domain': 'NonNegativeReals', 'units': 'pyunits.ft', 'doc': '"""Lift height for pump [ft]"""'}), "(time, initialize=400, domain=NonNegativeReals, units=pyunits.ft, doc=\n 'Lift height for pump [ft]')\n", (982, 1085), False, 'from pyomo.env... |
from django.contrib import admin
from django.contrib.auth.models import User
from .models import Orgao
from .models import Lotacao
from .models import TipoLotacao
#from .models import Pessoa
class OrgaoAdmin(admin.ModelAdmin):
list_display = ('id', 'nomeOrgao', 'descricao', 'emailOrgao', 'nomeResponsavelOrgao'... | [
"django.contrib.admin.site.register"
] | [((699, 737), 'django.contrib.admin.site.register', 'admin.site.register', (['Orgao', 'OrgaoAdmin'], {}), '(Orgao, OrgaoAdmin)\n', (718, 737), False, 'from django.contrib import admin\n'), ((737, 787), 'django.contrib.admin.site.register', 'admin.site.register', (['TipoLotacao', 'TipoLotacaoAdmin'], {}), '(TipoLotacao,... |
from django.db import models
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
# Create your models here.
class Problem(models.Model):
oj_id = models.IntegerField()
@property
def share_url(self):
return reverse('problem:share', kwargs={'oj_id': self.oj_id})
... | [
"django.db.models.TextField",
"django.core.urlresolvers.reverse",
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"django.db.models.IntegerField"
] | [((188, 209), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (207, 209), False, 'from django.db import models\n'), ((464, 487), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {}), '(User)\n', (481, 487), False, 'from django.db import models\n'), ((502, 528), 'django.db.models.... |
# Entry point
from coloring.cli import main
if __name__ == "__main__":
main()
| [
"coloring.cli.main"
] | [((76, 82), 'coloring.cli.main', 'main', ([], {}), '()\n', (80, 82), False, 'from coloring.cli import main\n')] |
from copy import deepcopy
from django.shortcuts import get_object_or_404, render, redirect, Http404, HttpResponse
from django.forms.models import (
formset_factory,
modelformset_factory,
inlineformset_factory,
)
from django.forms import HiddenInput
from django.http import JsonResponse, HttpResponseBadReques... | [
"copy.deepcopy",
"django.shortcuts.Http404",
"django.shortcuts.redirect",
"json.dumps",
"django.shortcuts.get_object_or_404",
"django.shortcuts.render",
"logging.getLogger"
] | [((628, 654), 'logging.getLogger', 'logging.getLogger', (['"""cegov"""'], {}), "('cegov')\n", (645, 654), False, 'import logging\n'), ((1525, 1589), 'django.shortcuts.render', 'render', (['request', '"""govtrack/index.html"""', "{'countries': countries}"], {}), "(request, 'govtrack/index.html', {'countries': countries}... |
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.layers import *
from tensorflow.keras import backend as K
def res_block(input, out_channels, downsample_start=False, use_skip_conv=False):
"""Implementation of residual block
:param downsample_start: flag that indicates whether the fir... | [
"tensorflow.keras.Model",
"tensorflow.keras.activations.relu"
] | [((625, 650), 'tensorflow.keras.activations.relu', 'keras.activations.relu', (['x'], {}), '(x)\n', (647, 650), False, 'from tensorflow import keras\n'), ((1276, 1303), 'tensorflow.keras.activations.relu', 'keras.activations.relu', (['res'], {}), '(res)\n', (1298, 1303), False, 'from tensorflow import keras\n'), ((2393,... |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of... | [
"primaires.interpreteur.masque.parametre.Parametre.__init__"
] | [((1842, 1888), 'primaires.interpreteur.masque.parametre.Parametre.__init__', 'Parametre.__init__', (['self', '"""relâcher"""', '"""unlead"""'], {}), "(self, 'relâcher', 'unlead')\n", (1860, 1888), False, 'from primaires.interpreteur.masque.parametre import Parametre\n')] |
# This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
__name__ = "biotite.sequence.graphics"
__author__ = "<NAME>"
__all__ = ["plot_sequence_logo"]
import numpy as np
from ...visualize import set_font_size_in_coord
fr... | [
"numpy.sum",
"numpy.log2",
"numpy.zeros",
"numpy.argsort",
"warnings.warn"
] | [((2665, 2700), 'numpy.argsort', 'np.argsort', (['symbols_heights'], {'axis': '(1)'}), '(symbols_heights, axis=1)\n', (2675, 2700), True, 'import numpy as np\n'), ((3801, 3821), 'numpy.zeros', 'np.zeros', (['freq.shape'], {}), '(freq.shape)\n', (3809, 3821), True, 'import numpy as np\n'), ((1818, 1935), 'warnings.warn'... |
from moonfire_tokenomics.data_types import Allocation, AllocationRecord, Blockchain, Category, CommonType, Sector, Token
dydx = Token(
name="DYDX",
project="dYdX",
sector=Sector.DEFI,
blockchain=[Blockchain.ETH],
category=[Category.GOV],
capped=False,
allocations=[
Allocation(
... | [
"moonfire_tokenomics.data_types.AllocationRecord"
] | [((374, 470), 'moonfire_tokenomics.data_types.AllocationRecord', 'AllocationRecord', ([], {'type': '"""User Trading Rewards"""', 'common_type': 'CommonType.ECOSYSTEM', 'share': '(0.25)'}), "(type='User Trading Rewards', common_type=CommonType.\n ECOSYSTEM, share=0.25)\n", (390, 470), False, 'from moonfire_tokenomics... |
from env_suite.envs import controlTableLine
import time
import numpy as np
global isWindows
isWindows = False
try:
from win32api import STD_INPUT_HANDLE
from win32console import GetStdHandle, KEY_EVENT, ENABLE_ECHO_INPUT, ENABLE_LINE_INPUT, ENABLE_PROCESSED_INPUT
isWindows = True
except ImportError as e:
... | [
"sys.stdin.read",
"termios.tcgetattr",
"env_suite.envs.controlTableLine",
"win32console.GetStdHandle",
"numpy.zeros",
"termios.tcsetattr",
"time.sleep",
"select.select",
"numpy.array",
"sys.stdin.fileno"
] | [((2464, 2482), 'env_suite.envs.controlTableLine', 'controlTableLine', ([], {}), '()\n', (2480, 2482), False, 'from env_suite.envs import controlTableLine\n'), ((495, 525), 'win32console.GetStdHandle', 'GetStdHandle', (['STD_INPUT_HANDLE'], {}), '(STD_INPUT_HANDLE)\n', (507, 525), False, 'from win32console import GetSt... |
"""Overwrite pytorch DenseNet for CIFAR-10 and additional scripting options."""
import torch
import torchvision
from collections import OrderedDict
# densenet hints
from typing import Tuple
from torch import Tensor
from .utils import get_layer_functions
def densenet_depths_to_config(depth):
"""Lookup DenseNet ... | [
"torch.flatten",
"torch.nn.init.kaiming_normal_",
"torch.cat",
"torch.nn.functional.adaptive_avg_pool2d",
"torch.nn.init.constant_",
"torch.nn.Module.__init__",
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"torch.nn.AvgPool2d"
] | [((6476, 6518), 'torch.nn.Linear', 'torch.nn.Linear', (['num_features', 'num_classes'], {}), '(num_features, num_classes)\n', (6491, 6518), False, 'import torch\n'), ((7087, 7139), 'torch.nn.functional.adaptive_avg_pool2d', 'torch.nn.functional.adaptive_avg_pool2d', (['out', '(1, 1)'], {}), '(out, (1, 1))\n', (7126, 71... |
from django.contrib.auth.models import AnonymousUser
from rest_framework import exceptions
from rest_framework.authentication import TokenAuthentication
from pretix.base.models import Device
class DeviceTokenAuthentication(TokenAuthentication):
model = Device
keyword = 'Device'
def authenticate_credenti... | [
"django.contrib.auth.models.AnonymousUser",
"rest_framework.exceptions.AuthenticationFailed"
] | [((621, 688), 'rest_framework.exceptions.AuthenticationFailed', 'exceptions.AuthenticationFailed', (['"""Device has not been initialized."""'], {}), "('Device has not been initialized.')\n", (652, 688), False, 'from rest_framework import exceptions\n'), ((741, 807), 'rest_framework.exceptions.AuthenticationFailed', 'ex... |
from reachability import ReachabilityObserver, Reachability
class ObserverA(ReachabilityObserver):
def reachability_update(self, isonline: bool) -> None:
if isonline:
print("ObserverA: We are online")
else:
print("ObserverA: We are offline")
class ObserverB(ReachabilityOb... | [
"reachability.Reachability"
] | [((588, 602), 'reachability.Reachability', 'Reachability', ([], {}), '()\n', (600, 602), False, 'from reachability import ReachabilityObserver, Reachability\n')] |
from sys import exit
import numpy as np
import h5py
from .plot import Plot
from .utils import load_posteriors, create_templates
from .conf import set_plot_params
class Validation:
"""
Internal class for performing validation on the univariate and/or multivariate posterior PDFs of the test samples
generate... | [
"numpy.stack",
"h5py.File",
"numpy.sum",
"numpy.empty",
"numpy.zeros",
"numpy.min",
"numpy.max",
"numpy.arange",
"numpy.linspace",
"sys.exit"
] | [((2339, 2458), 'h5py.File', 'h5py.File', (["(self.path + self.validation_folder + 'validation.h5')", '"""w"""'], {'driver': '"""core"""', 'backing_store': 'save_validation'}), "(self.path + self.validation_folder + 'validation.h5', 'w', driver\n ='core', backing_store=save_validation)\n", (2348, 2458), False, 'impo... |
# -*- coding: utf-8 -*-
from MaterialPlanning import MaterialPlanning
#from MaterialPlanningRaw import MaterialPlanning as MPR
#from utils import required_dctCN, owned_dct
required_dctCN = {'D32钢': 382, '双极纳米片': 454, 'D32钢': 382, '聚合剂': 378, '白马醇': 476, '扭转醇': 339, '三水锰矿': 399, '轻锰矿': 229, '五水研磨石': 458, '研磨石': 237, '... | [
"MaterialPlanning.MaterialPlanning"
] | [((2131, 2551), 'MaterialPlanning.MaterialPlanning', 'MaterialPlanning', ([], {'filter_stages': "(['荒芜行动物资补给', '罗德岛物资补给', '岁过华灯', '32h战略配给', '感谢庆典物资补给', '应急理智小样',\n '黄铁行动物资补给', '利刃行动物资补给', '燃灰行动物资补给'] + ['S4-4', 'S6-4', 'S4-9'])", 'filter_freq': '(100)', 'update': 'update', 'banned_stages': '{}', 'printSetting': 'pr... |
import copy
import os
import numpy as np
import matplotlib
matplotlib.use('Agg')
try:
from sklearn.model_selection import train_test_split
except ImportError:
from sklearn.cross_validation import train_test_split
from libact.base.dataset import Dataset, import_libsvm_sparse
from libact.query_strategies.random_s... | [
"matplotlib.pyplot.title",
"sklearn.cross_validation.train_test_split",
"copy.deepcopy",
"numpy.load",
"matplotlib.pyplot.show",
"libact.labelers.ideal_labeler.IdealLabeler",
"libact.base.dataset.Dataset",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"os.path.realpath",
"matplotlib.use"... | [((59, 80), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (73, 80), False, 'import matplotlib\n'), ((1458, 1501), 'sklearn.cross_validation.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': 'test_size'}), '(X, y, test_size=test_size)\n', (1474, 1501), False, 'from sklearn.cross_v... |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='src',
version='0.0.1',
description='Non-Autoregressive Task-Oriented System',
author='Yen-Ting (Adam), Lin',
author_email='<EMAIL>',
url='https://github.com/adamlin120/NATODS',
install_requires=[
... | [
"setuptools.find_packages"
] | [((388, 403), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (401, 403), False, 'from setuptools import setup, find_packages\n')] |
import unittest
import pandas as pd
from dataversioner.committree import CommitTree
class TestCommitTree(unittest.TestCase):
def setUp(self):
name, message = "Initial dataframe", "Data at initialization"
self.df = pd.DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 9]], columns=["a", "b", "c"])
... | [
"pandas.DataFrame"
] | [((239, 311), 'pandas.DataFrame', 'pd.DataFrame', (['[[1, 2, 3], [4, 5, 6], [7, 8, 9]]'], {'columns': "['a', 'b', 'c']"}), "([[1, 2, 3], [4, 5, 6], [7, 8, 9]], columns=['a', 'b', 'c'])\n", (251, 311), True, 'import pandas as pd\n')] |
import numpy as np
import xarray as xr
# from concurrent.futures import ProcessPoolExecutor
# pool = ProcessPoolExecutor()
from functools import partial
import logging
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
double_array = partial(np.asarray, dtype='f8')
def gen_sq_mean(sq):
sqa =... | [
"functools.partial",
"numpy.dtype",
"numpy.einsum",
"xarray.Dataset.from_dict",
"logging.NullHandler",
"numpy.fromiter",
"logging.getLogger"
] | [((176, 203), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (193, 203), False, 'import logging\n'), ((258, 289), 'functools.partial', 'partial', (['np.asarray'], {'dtype': '"""f8"""'}), "(np.asarray, dtype='f8')\n", (265, 289), False, 'from functools import partial\n'), ((219, 240), 'log... |
#!/usr/bin/env python
# encoding: utf-8
"""
@author: zhanghe
@software: PyCharm
@file: catalogue.py
@time: 2018-04-16 21:54
"""
from __future__ import unicode_literals
from copy import copy
from flask import (
request,
flash,
render_template,
abort,
Blueprint,
)
from flask_babel import gettext a... | [
"app_backend.api.production.get_distinct_production_brand",
"flask.flash",
"flask.Blueprint",
"app_backend.api.catalogue.get_catalogue_pagination",
"copy.copy",
"flask.abort",
"app_backend.api.production.get_production_rows",
"app_backend.forms.production.ProductionSearchForm",
"flask.render_templat... | [((1101, 1158), 'flask.Blueprint', 'Blueprint', (['"""catalogue"""', '__name__'], {'url_prefix': '"""/catalogue"""'}), "('catalogue', __name__, url_prefix='/catalogue')\n", (1110, 1158), False, 'from flask import request, flash, render_template, abort, Blueprint\n'), ((1183, 1218), 'app_backend.app.config.get', 'app.co... |
import csv
import sys
import urllib3
import json
from urllib.parse import quote
METAMAP = 'https://knowledge.ncats.io/ks/umls/metamap'
DISAPI = 'https://disease-knowledge.ncats.io/api'
DISEASE = DISAPI + '/search'
def parse_disease_map (codes, data):
if len(data) > 0:
for d in data:
if 'I_CODE... | [
"csv.reader",
"json.dumps",
"urllib.parse.quote",
"urllib3.PoolManager",
"sys.exit"
] | [((751, 772), 'urllib3.PoolManager', 'urllib3.PoolManager', ([], {}), '()\n', (770, 772), False, 'import urllib3\n'), ((1571, 1592), 'urllib3.PoolManager', 'urllib3.PoolManager', ([], {}), '()\n', (1590, 1592), False, 'import urllib3\n'), ((4160, 4181), 'urllib3.PoolManager', 'urllib3.PoolManager', ([], {}), '()\n', (4... |
# Copyright (c) 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"collections.defaultdict"
] | [((891, 907), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (902, 907), False, 'from collections import defaultdict\n')] |
import logging
from django.core.management.base import BaseCommand
from django.utils import timezone
from apps.core.models import UserProfile
logger = logging.getLogger('sso.account')
class Command(BaseCommand):
help = 'Remove expired users'
def handle(self, *args, **options):
profiles = UserProf... | [
"django.utils.timezone.now",
"logging.getLogger"
] | [((155, 187), 'logging.getLogger', 'logging.getLogger', (['"""sso.account"""'], {}), "('sso.account')\n", (172, 187), False, 'import logging\n'), ((429, 443), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (441, 443), False, 'from django.utils import timezone\n')] |
import json
import logging
import os
import shutil
import wave
import zipfile
from pathlib import Path
import requests
from halo import Halo
from vosk import KaldiRecognizer, Model, SetLogLevel
logging.basicConfig(level=logging.ERROR)
logger = logging.getLogger(__name__)
SetLogLevel(-1)
MODEL_PATH = os.path.join(Pat... | [
"os.mkdir",
"wave.open",
"zipfile.ZipFile",
"json.loads",
"logging.basicConfig",
"os.path.exists",
"logging.info",
"halo.Halo",
"vosk.SetLogLevel",
"pathlib.Path",
"requests.get",
"os.listdir",
"logging.getLogger",
"vosk.Model"
] | [((196, 236), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.ERROR'}), '(level=logging.ERROR)\n', (215, 236), False, 'import logging\n'), ((246, 273), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (263, 273), False, 'import logging\n'), ((274, 289), 'vosk.SetLogLev... |
"""Create initial database tables
Revision ID: 37f73a9d15d5
Revises:
Create Date: 2022-04-02 10:42:18.076326+00:00
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "3<PASSWORD>"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ##... | [
"alembic.op.drop_table",
"sqlalchemy.DateTime",
"sqlalchemy.Date",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.JSON",
"sqlalchemy.Boolean",
"sqlalchemy.Text",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.Numeric",
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.BigInteger",
"sqlalchemy.SmallIn... | [((18005, 18044), 'alembic.op.drop_table', 'op.drop_table', (['"""activitiesUsersWeapons"""'], {}), "('activitiesUsersWeapons')\n", (18018, 18044), False, 'from alembic import op\n'), ((18049, 18081), 'alembic.op.drop_table', 'op.drop_table', (['"""activitiesUsers"""'], {}), "('activitiesUsers')\n", (18062, 18081), Fal... |
from flask import Flask
from app.db import db
from app.api import api
from app.util import SignedIntConverter
def create_app(dbConnection):
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = dbConnection
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db.init_app(app)
app.url_map.c... | [
"app.db.db.init_app",
"flask.Flask"
] | [((152, 167), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (157, 167), False, 'from flask import Flask\n'), ((286, 302), 'app.db.db.init_app', 'db.init_app', (['app'], {}), '(app)\n', (297, 302), False, 'from app.db import db\n')] |
from logging import getLogger
from io import BytesIO
from disco.bot import Plugin
import requests
from utils.common import SHIBE_CHANNEL
from utils.db import Database, CodeDatabase
from utils.deco import admin_only, ensure_other, ensure_profile
class AdminPlug(Plugin):
def load(self, config):
self.db =... | [
"io.BytesIO",
"disco.bot.Plugin.listen",
"utils.db.CodeDatabase",
"utils.db.Database",
"requests.get",
"disco.bot.Plugin.command",
"logging.getLogger"
] | [((541, 563), 'disco.bot.Plugin.listen', 'Plugin.listen', (['"""Ready"""'], {}), "('Ready')\n", (554, 563), False, 'from disco.bot import Plugin\n'), ((980, 1065), 'disco.bot.Plugin.command', 'Plugin.command', (['"""set shibe"""', '"""<other_user:str> <amount:int> <shibe_name:str...>"""'], {}), "('set shibe', '<other_u... |
from twitter import Twitter, OAuth
import pickle
from authcred import token, token_secret
from authcred import consumer_key, consumer_secret
import os
def get_emoji(score):
if score >= 2:
return u'\U0001F4AF \n'
elif score >= 0.2:
return u'\U0001F525 \n'
elif score >= 0.02: return u'... | [
"twitter.OAuth",
"pickle.load",
"os.path.expanduser"
] | [((1498, 1512), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (1509, 1512), False, 'import pickle\n'), ((1208, 1317), 'twitter.OAuth', 'OAuth', ([], {'token': 'token', 'token_secret': 'token_secret', 'consumer_key': 'consumer_key', 'consumer_secret': 'consumer_secret'}), '(token=token, token_secret=token_secret, ... |
from JumpScale import j
from .AgentControllerFactory import AgentControllerFactory
j.base.loader.makeAvailable(j, 'clients')
j.clients.agentcontroller = AgentControllerFactory()
| [
"JumpScale.j.base.loader.makeAvailable"
] | [((83, 124), 'JumpScale.j.base.loader.makeAvailable', 'j.base.loader.makeAvailable', (['j', '"""clients"""'], {}), "(j, 'clients')\n", (110, 124), False, 'from JumpScale import j\n')] |
import coverage
from django.core.exceptions import ImproperlyConfigured
try:
from discover_runner import DiscoverRunner
except (ImportError, ImproperlyConfigured):
from django.test.runner import DiscoverRunner
from discoverage.settings import (COVERAGE_OMIT_MODULES,
COVERAGE_... | [
"discoverage.utils.find_coverage_apps",
"discoverage.utils.get_all_modules",
"coverage.coverage"
] | [((1048, 1093), 'coverage.coverage', 'coverage.coverage', ([], {'omit': 'COVERAGE_OMIT_MODULES'}), '(omit=COVERAGE_OMIT_MODULES)\n', (1065, 1093), False, 'import coverage\n'), ((1402, 1427), 'discoverage.utils.find_coverage_apps', 'find_coverage_apps', (['suite'], {}), '(suite)\n', (1420, 1427), False, 'from discoverag... |
"""
This modules defines the board of the game based on the configuration the user has requested
"""
import numpy as np
import pawn
import math
##DIRECTIONS##
NORTHWEST = "northwest"
NORTHEAST = "northeast"
SOUTHWEST = "southwest"
SOUTHEAST = "southeast"
# Constant for Obstacle in the game, 21 because max pawn_id in ... | [
"pawn.Pawn",
"numpy.random.randint",
"numpy.zeros",
"math.ceil"
] | [((510, 548), 'numpy.zeros', 'np.zeros', (['(numOfSquares, numOfSquares)'], {}), '((numOfSquares, numOfSquares))\n', (518, 548), True, 'import numpy as np\n'), ((1448, 1484), 'math.ceil', 'math.ceil', (['(num_of_pawns / (cols / 2))'], {}), '(num_of_pawns / (cols / 2))\n', (1457, 1484), False, 'import math\n'), ((17954,... |
from functools import wraps
from flask import abort
from flask_login import current_user
from .models import Permission
def permission_required(permission):
def decorator(f):
@wraps(f)
def decorated_function(*args,**kwargs):
if not current_user.can(permission):
abort(40... | [
"flask_login.current_user.can",
"flask.abort",
"functools.wraps"
] | [((190, 198), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (195, 198), False, 'from functools import wraps\n'), ((266, 294), 'flask_login.current_user.can', 'current_user.can', (['permission'], {}), '(permission)\n', (282, 294), False, 'from flask_login import current_user\n'), ((312, 322), 'flask.abort', 'abort',... |
from pathlib import Path
import numpy as np
import joblib
from keras.preprocessing import image
from keras.applications import vgg16
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
# Path to folders with training data
dog_path = Path("img") / "dogs"
not_dog_path = Path("img") / "n... | [
"keras.models.Sequential",
"keras.layers.Dropout",
"keras.layers.Flatten",
"numpy.expand_dims",
"keras.preprocessing.image.img_to_array",
"keras.preprocessing.image.load_img",
"pathlib.Path",
"numpy.array",
"keras.layers.Dense",
"keras.applications.vgg16.VGG16",
"keras.applications.vgg16.preproc... | [((1161, 1177), 'numpy.array', 'np.array', (['images'], {}), '(images)\n', (1169, 1177), True, 'import numpy as np\n'), ((1232, 1248), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (1240, 1248), True, 'import numpy as np\n'), ((1299, 1330), 'keras.applications.vgg16.preprocess_input', 'vgg16.preprocess_inp... |
#!/usr/bin/env python3
"""Move files to another folder."""
import sys
import os
import shutil
import logging
logging.basicConfig(level=logging.DEBUG)
def move(srcdir, dstdir):
"""Move files from Source Directory to Destination Directory."""
files = os.listdir(srcdir)
for file_ in files:
shuti... | [
"os.path.join",
"logging.debug",
"os.listdir",
"logging.basicConfig"
] | [((113, 153), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (132, 153), False, 'import logging\n'), ((263, 281), 'os.listdir', 'os.listdir', (['srcdir'], {}), '(srcdir)\n', (273, 281), False, 'import os\n'), ((372, 416), 'logging.debug', 'logging.debug', (['f... |
from rest_framework import serializers
from .models import *
class UserSerializer(serializers.Serializer):
username = serializers.CharField(required=True)
email = serializers.CharField(required=True)
first_name = serializers.CharField()
last_name = serializers.CharField()
class UserLoginSerializer(... | [
"rest_framework.serializers.SerializerMethodField",
"rest_framework.serializers.IntegerField",
"rest_framework.serializers.CharField",
"rest_framework.serializers.BooleanField",
"rest_framework.serializers.FloatField"
] | [((125, 161), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'required': '(True)'}), '(required=True)\n', (146, 161), False, 'from rest_framework import serializers\n'), ((174, 210), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'required': '(True)'}), '(required=True)\n... |
from pathlib import Path
import subprocess
from typing import Union
JAVA_DIR = Path("maxent")
MAX_ENT_JAR = JAVA_DIR / "maxent-3.0.0.jar"
TROVE_JAR = JAVA_DIR / "trove.jar"
ME_TRAIN_PATH = JAVA_DIR / "MEtrain.java"
ME_TAG_PATH = JAVA_DIR / "MEtag.java"
def _compile_java_file(file: Union[Path, str]) -> None:
r""... | [
"pathlib.Path",
"subprocess.Popen"
] | [((80, 94), 'pathlib.Path', 'Path', (['"""maxent"""'], {}), "('maxent')\n", (84, 94), False, 'from pathlib import Path\n'), ((370, 380), 'pathlib.Path', 'Path', (['file'], {}), '(file)\n', (374, 380), False, 'from pathlib import Path\n'), ((631, 664), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'shell': '(True)'... |
from __future__ import print_function, division, absolute_import
import os
import shutil
from odin.utils import get_all_files
from odin.preprocessing import textgrid
inpath = "/Volumes/backup/digisami_data/sami_read/trans_textgrid"
audiopath = "/Volumes/backup/digisami_data/sami_read/audio"
outpath = "/Volumes/backup... | [
"odin.utils.get_all_files",
"os.path.join",
"odin.preprocessing.textgrid.TextGrid",
"os.path.basename"
] | [((365, 426), 'odin.utils.get_all_files', 'get_all_files', (['inpath'], {'filter_func': "(lambda x: '.TextGrid' in x)"}), "(inpath, filter_func=lambda x: '.TextGrid' in x)\n", (378, 426), False, 'from odin.utils import get_all_files\n'), ((435, 494), 'odin.utils.get_all_files', 'get_all_files', (['audiopath'], {'filter... |
# Generated by Django 3.2.8 on 2021-11-18 17:46
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.UUIDField",
"django.db.models.TimeField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.FloatField",
"django.db.models.BooleanField",
"django.db.mo... | [((6173, 6270), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.DO_NOTHING', 'to': '"""users.role"""'}), "(null=True, on_delete=django.db.models.deletion.DO_NOTHING,\n to='users.role')\n", (6190, 6270), False, 'from django.db import migrations, mode... |
import re
import mysql.connector
def check_email(email):
reg = r"^[a-zA-Z0-9_.+-]+@[a-zA-Z]+\.[a-zA-Z]+$"
if re.match(reg, email):
return True
else:
return False
def check_password(password):
reg = r"^[a-zA-Z0-9]+$"
if re.match(reg, password):
return True
else:
... | [
"re.match"
] | [((118, 138), 're.match', 're.match', (['reg', 'email'], {}), '(reg, email)\n', (126, 138), False, 'import re\n'), ((257, 280), 're.match', 're.match', (['reg', 'password'], {}), '(reg, password)\n', (265, 280), False, 'import re\n')] |
from django.test import TestCase
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
LIST_USER_URL = reverse("user:list")
# REG_USER_URL = reverse("core:list")
class TestPrivateUserApi(TestCase):
def setUp(self):
self.client = APIClient()
def... | [
"django.urls.reverse",
"rest_framework.test.APIClient"
] | [((159, 179), 'django.urls.reverse', 'reverse', (['"""user:list"""'], {}), "('user:list')\n", (166, 179), False, 'from django.urls import reverse\n'), ((300, 311), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (309, 311), False, 'from rest_framework.test import APIClient\n')] |
import inspect
import types
from ..five import getfullargspec, full_qualname, raise_from, update_wrapper, wraps
from ..utils import class_property
from .view_class_decorator import view_class_decorator
class ViewDecoratorBase(object):
""" Base class for view decorators that can be applied to both regular view fu... | [
"inspect.isclass",
"inspect.isroutine",
"types.MethodType"
] | [((9649, 9675), 'inspect.isroutine', 'inspect.isroutine', (['wrapped'], {}), '(wrapped)\n', (9666, 9675), False, 'import inspect\n'), ((10863, 10907), 'types.MethodType', 'types.MethodType', (['wrapper', '(instance or owner)'], {}), '(wrapper, instance or owner)\n', (10879, 10907), False, 'import types\n'), ((5684, 571... |
# noinspection PyUnresolvedReferences
import inspect
import re
from urllib.parse import urlsplit
from django.db.models import ManyToManyField
from django.http import HttpResponseNotFound, HttpResponseNotAllowed
from rest_framework import renderers, serializers
from rest_framework.decorators import detail_route, list_r... | [
"django.http.HttpResponseNotFound",
"rest_framework.response.Response",
"rest_framework.decorators.action",
"django.http.HttpResponseNotAllowed",
"re.sub",
"inspect.getmembers"
] | [((1210, 1359), 'rest_framework.decorators.action', 'action', ([], {'detail': '(True)', 'renderer_classes': '[renderers.JSONRenderer]', 'url_path': '"""foreign-autocomplete/(?P<autocomplete_id>.*)"""', 'methods': "['get', 'post']"}), "(detail=True, renderer_classes=[renderers.JSONRenderer], url_path=\n 'foreign-auto... |
"""get the connection object from sqlite db"""
import datetime
import sqlite3
# import psycopg2 as pg
# import psycopg2.extras as pge
def load_date(content):
"""convert loaded string to date"""
string = content.decode()
date = datetime.datetime.strptime(string,
'%Y-... | [
"datetime.datetime.strptime",
"sqlite3.connect",
"sqlite3.register_converter"
] | [((243, 301), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['string', '"""%Y-%m-%d %H:%M:%S.%f"""'], {}), "(string, '%Y-%m-%d %H:%M:%S.%f')\n", (269, 301), False, 'import datetime\n'), ((621, 666), 'sqlite3.register_converter', 'sqlite3.register_converter', (['"""date"""', 'load_date'], {}), "('date', l... |
import setuptools
# Read the contents of the README file
import io
from os import path
this_directory = path.abspath(path.dirname(__file__))
with io.open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
setuptools.setup(
name="mcpt",
version="0.1.8",
descrip... | [
"os.path.dirname",
"os.path.join",
"setuptools.find_packages"
] | [((119, 141), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (131, 141), False, 'from os import path\n'), ((156, 194), 'os.path.join', 'path.join', (['this_directory', '"""README.md"""'], {}), "(this_directory, 'README.md')\n", (165, 194), False, 'from os import path\n'), ((614, 640), 'setuptool... |
from pathlib import Path
from os.path import normpath
import os
def default_base_dir():
"""Return absolute path to current directory. If PWD environment variable is
set correctly return that, note that PWD might be set to "symlinked"
path instead of "real" path.
Only return PWD instead of cw... | [
"os.environ.get",
"pathlib.Path",
"os.path.normpath"
] | [((598, 619), 'os.environ.get', 'os.environ.get', (['"""PWD"""'], {}), "('PWD')\n", (612, 619), False, 'import os\n'), ((670, 679), 'pathlib.Path', 'Path', (['pwd'], {}), '(pwd)\n', (674, 679), False, 'from pathlib import Path\n'), ((1241, 1248), 'pathlib.Path', 'Path', (['p'], {}), '(p)\n', (1245, 1248), False, 'from ... |
import sys
import click
import pkg_resources
from botocore.exceptions import ClientError
from .command import S3Fetch
from .exceptions import S3FetchError
__version__ = pkg_resources.get_distribution("s3fetch").version
@click.command()
@click.argument("s3_uri", type=str)
@click.option(
"--region",
type=str... | [
"pkg_resources.get_distribution",
"click.argument",
"click.option",
"click.command",
"sys.exit"
] | [((225, 240), 'click.command', 'click.command', ([], {}), '()\n', (238, 240), False, 'import click\n'), ((242, 276), 'click.argument', 'click.argument', (['"""s3_uri"""'], {'type': 'str'}), "('s3_uri', type=str)\n", (256, 276), False, 'import click\n'), ((278, 386), 'click.option', 'click.option', (['"""--region"""'], ... |
import tensorflow as tf
from basic_model import ModelParams, DataConfig, TrainLoss, TrainRun
class ModelParams(ModelParams):
def __init__(self):
super(ModelParams, self).__init__()
self.name = 'autoencoder'
self.dense_decode = tf.layers.Dense(self.flat_size)
def embed(self, img, noi... | [
"tensorflow.layers.Dense",
"basic_model.TrainLoss",
"tensorflow.not_equal",
"tensorflow.clip_by_value",
"tensorflow.argmax",
"tensorflow.layers.dropout",
"tensorflow.layers.flatten",
"tensorflow.Session",
"basic_model.TrainRun",
"tensorflow.shape",
"tensorflow.exp",
"tensorflow.to_float",
"b... | [((3034, 3044), 'basic_model.TrainRun', 'TrainRun', ([], {}), '()\n', (3042, 3044), False, 'from basic_model import ModelParams, DataConfig, TrainLoss, TrainRun\n'), ((3056, 3068), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (3066, 3068), True, 'import tensorflow as tf\n'), ((259, 290), 'tensorflow.layers.Den... |