code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import json
from trac.core import *
from trac.web.api import IRequestHandler, ITemplateStreamFilter
from trac.web.chrome import ITemplateProvider, add_script
from trac.ticket.query import Query, QueryModule
from trac.ticket.model import Ticket
from genshi.builder import tag
from genshi.filters import Transformer
from ... | [
"trac.ticket.query.QueryModule",
"genshi.filters.Transformer",
"trac.web.chrome.add_script",
"json.dumps",
"pkg_resources.resource_filename",
"genshi.input.HTML"
] | [((751, 772), 'trac.ticket.query.QueryModule', 'QueryModule', (['self.env'], {}), '(self.env)\n', (762, 772), False, 'from trac.ticket.query import Query, QueryModule\n'), ((1093, 1155), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""ticketrelation"""', '"""templates"""'], {}), "('ticketrel... |
from django.conf.urls import patterns, url
urlpatterns = patterns('news.views',
url(r'^$', 'news_list', name='list'),
url(r'^feed/(?P<slug>.*)/$',
'news_list', name='feed'),
url(r'^(?P<slug>.*)/$', 'news_item', name='item'... | [
"django.conf.urls.url"
] | [((105, 140), 'django.conf.urls.url', 'url', (['"""^$"""', '"""news_list"""'], {'name': '"""list"""'}), "('^$', 'news_list', name='list')\n", (108, 140), False, 'from django.conf.urls import patterns, url\n'), ((166, 219), 'django.conf.urls.url', 'url', (['"""^feed/(?P<slug>.*)/$"""', '"""news_list"""'], {'name': '"""f... |
import numpy as np
import matplotlib.pyplot as plt
from lib5c.util.plotting import plotter
@plotter
def plot_pvalue_histogram(data, xlabel='pvalue', **kwargs):
"""
Plots a p-value or q-value distribution.
Parameters
----------
data : np.ndarray
The p-values or q-values to plot.
kwarg... | [
"matplotlib.pyplot.ylabel",
"numpy.linspace"
] | [((492, 522), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""number of pixels"""'], {}), "('number of pixels')\n", (502, 522), True, 'import matplotlib.pyplot as plt\n'), ((465, 486), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(21)'], {}), '(0, 1, 21)\n', (476, 486), True, 'import numpy as np\n')] |
from flask_restplus import Namespace
from ..search.resources.search import SearchResource, SearchOptionsResource
from app.api.search.search.resources.simple_search import SimpleSearchResource
api = Namespace('search', description='Search related operations')
api.add_resource(SearchResource, '')
api.add_resource(Sear... | [
"flask_restplus.Namespace"
] | [((200, 260), 'flask_restplus.Namespace', 'Namespace', (['"""search"""'], {'description': '"""Search related operations"""'}), "('search', description='Search related operations')\n", (209, 260), False, 'from flask_restplus import Namespace\n')] |
from _util import *
############################################################################################################################################################################################################################################################################################################... | [
"IPython.display.display"
] | [((7053, 7065), 'IPython.display.display', 'display', (['res'], {}), '(res)\n', (7060, 7065), False, 'from IPython.display import display\n'), ((4440, 4451), 'IPython.display.display', 'display', (['df'], {}), '(df)\n', (4447, 4451), False, 'from IPython.display import display\n')] |
#PHDF_PATH = '/home/brryan/rpm/phoebus/external/parthenon/scripts/python/'
#PHDF_PATH = '/home/brryan/github/phoebus/external/parthenon/scripts/python/'
#DUMP_NAMES = '/home/brryan/builds/phoebus/torus.out1.*.phdf'
DUMP_NAMES = 'torus.out1.*.phdf'
import argparse
import numpy as np
import sys
import matplotlib.pyplot ... | [
"mpl_toolkits.axes_grid1.make_axes_locatable",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"numpy.zeros",
"numpy.sin",
"numpy.exp",
"numpy.cos",
"glob.glob",
"matplotlib.pyplot.Circle",
"sys.exit",
"parthenon_tools.phdf.phdf",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig... | [((644, 693), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Plot torus"""'}), "(description='Plot torus')\n", (667, 693), False, 'import argparse\n'), ((1092, 1112), 'parthenon_tools.phdf.phdf', 'phdf.phdf', (['dfnams[0]'], {}), '(dfnams[0])\n', (1101, 1112), False, 'from parthenon_tool... |
# Generated by Django 3.2.9 on 2021-11-18 11:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("podcasts", "0097_rename_schedule_modifier_podcast_frequency_modifier"),
]
operations = [
migrations.RemoveField(
model_name="podcast",
... | [
"django.db.migrations.RemoveField"
] | [((261, 326), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""podcast"""', 'name': '"""podcastindex"""'}), "(model_name='podcast', name='podcastindex')\n", (283, 326), False, 'from django.db import migrations\n')] |
import json
import hmac
import hashlib
import requests
import datetime
import uuid
from requests.auth import AuthBase
class NiceHashAuth(AuthBase):
def __init__(self, fname = None, api_secret = None, api_key = None, org_id = None):
if fname is not None:
with open(fname) as f:
... | [
"json.load",
"uuid.uuid4",
"datetime.timedelta",
"requests.get",
"datetime.datetime.fromtimestamp",
"datetime.datetime.now"
] | [((2460, 2525), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['nhtime'], {'tz': 'datetime.timezone.utc'}), '(nhtime, tz=datetime.timezone.utc)\n', (2491, 2525), False, 'import datetime\n'), ((2540, 2587), 'datetime.datetime.now', 'datetime.datetime.now', ([], {'tz': 'datetime.timezone.utc'}), ... |
import numpy as np
# Python3 program to find element
# closet to given target.
# Returns element closest to target in arr[]
def findClosest(arr, n, target):
# Corner cases
if (target <= arr[0][0]):
return 0
if (target >= arr[n - 1][0]):
return n - 1
# Doing binary search
i = 0
... | [
"numpy.zeros"
] | [((1791, 1803), 'numpy.zeros', 'np.zeros', (['(60)'], {}), '(60)\n', (1799, 1803), True, 'import numpy as np\n')] |
"""
Codemonk link: https://www.hackerearth.com/problem/algorithm/monk-and-fredo-cm-number-theory-97942213/
Given two weights of a and b units, in how many different ways you can achieve a weight of d units using only the given
weights? Any of the given weights can be used any number of times (including 0 number of tim... | [
"math.floor",
"sys.stdin.readline",
"math.ceil"
] | [((2800, 2816), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (2814, 2816), False, 'from sys import stdin, stdout\n'), ((3014, 3030), 'math.ceil', 'ceil', (['(-x * d / b)'], {}), '(-x * d / b)\n', (3018, 3030), False, 'from math import ceil, floor\n'), ((3042, 3058), 'math.floor', 'floor', (['(y * d / a)'],... |
import unittest
from signals.generators.ios.ios_template_methods import iOSTemplateMethods
from signals.parser.fields import Field
from signals.parser.api import GetAPI, API, PatchAPI
from tests.utils import create_dynamic_schema
class iOSTemplateMethodsTestCase(unittest.TestCase):
def test_get_url_name(self):
... | [
"signals.generators.ios.ios_template_methods.iOSTemplateMethods.content_type",
"signals.generators.ios.ios_template_methods.iOSTemplateMethods.get_url_name",
"signals.parser.fields.Field",
"tests.utils.create_dynamic_schema",
"signals.parser.api.GetAPI",
"signals.generators.ios.ios_template_methods.iOSTem... | [((468, 524), 'signals.parser.api.GetAPI', 'GetAPI', (['"""post/"""', "{'response': {'200+': '$postResponse'}}"], {}), "('post/', {'response': {'200+': '$postResponse'}})\n", (474, 524), False, 'from signals.parser.api import GetAPI, API, PatchAPI\n'), ((673, 733), 'signals.parser.api.GetAPI', 'GetAPI', (['"""post/:id/... |
import numpy as np
import tensorflow as tf
import tfops_short as Z
class model:
def __init__(self, sess, hps, train_iterator, data_init):
# === Define session
self.sess = sess
self.hps = hps
# === Input tensors
with tf.name_scope('input'):
s_shape = [None, hps.... | [
"tensorflow.zeros_like",
"tfops_short.f",
"tfops_short.squeeze",
"tfops_short.invertible_1x1_conv",
"tfops_short.unsplit",
"tfops_short.gaussian_diag",
"tensorflow.compat.v1.global_variables_initializer",
"tensorflow.compat.v1.variable_scope",
"tensorflow.compat.v1.placeholder",
"tensorflow.name_s... | [((3096, 3117), 'tfops_short.squeeze', 'Z.squeeze', (['(x - 0.5)', '(4)'], {}), '(x - 0.5, 4)\n', (3105, 3117), True, 'import tfops_short as Z\n'), ((5841, 5874), 'tensorflow.zeros_like', 'tf.zeros_like', (['z'], {'dtype': '"""float32"""'}), "(z, dtype='float32')\n", (5854, 5874), True, 'import tensorflow as tf\n'), ((... |
import random
from functools import wraps
from .ipa import Client
class IPAAdmin(object):
__WRAPPED_METHODS = ("user_add", "user_show", "user_mod", "group_add_member")
__WRAPPED_METHODS_TESTING = (
"user_del",
"group_add",
"group_del",
"group_add_member_manager",
"pwp... | [
"random.choice"
] | [((839, 890), 'random.choice', 'random.choice', (["self.__app.config['FREEIPA_SERVERS']"], {}), "(self.__app.config['FREEIPA_SERVERS'])\n", (852, 890), False, 'import random\n')] |
""" Test Object Tracking
This script receives a .tsv file as input which has already been labelled
and runs the four selected objects tracking algorithm on all videos.
The target object that is being gazed at by the person is presented in blue.
Parameters
----------
tsv_path : str, optional
Path to tsv file conta... | [
"numpy.random.seed",
"pandas.read_csv",
"os.path.isfile",
"adam_visual_perception.ObjectTracker",
"sacred.Experiment",
"sys.exit"
] | [((967, 979), 'sacred.Experiment', 'Experiment', ([], {}), '()\n', (977, 979), False, 'from sacred import Experiment\n'), ((1248, 1273), 'numpy.random.seed', 'np.random.seed', (['args.seed'], {}), '(args.seed)\n', (1262, 1273), True, 'import numpy as np\n'), ((1435, 1471), 'pandas.read_csv', 'pd.read_csv', (['args.tsv_... |
import os
def validate_helm_chart(helm_chart):
os.system(f'helm lint {helm_chart}') | [
"os.system"
] | [((52, 88), 'os.system', 'os.system', (['f"""helm lint {helm_chart}"""'], {}), "(f'helm lint {helm_chart}')\n", (61, 88), False, 'import os\n')] |
# -*- coding: utf-8 -*-
import os
from shutil import rmtree
from tempfile import mkdtemp
import unittest
from pelican import Pelican
from pelican.settings import read_settings
from pelican.tests.support import mute
from fontawesome_markdown import FontAwesomeExtension
import pelicanfly
CURRENT_DIR = os.path.dirname(... | [
"os.path.abspath",
"pelican.settings.read_settings",
"os.path.exists",
"pelican.tests.support.mute",
"tempfile.mkdtemp",
"pelican.Pelican",
"shutil.rmtree",
"os.path.split",
"os.path.join",
"os.listdir"
] | [((428, 464), 'os.path.join', 'os.path.join', (['CURRENT_DIR', '"""content"""'], {}), "(CURRENT_DIR, 'content')\n", (440, 464), False, 'import os\n'), ((320, 345), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (335, 345), False, 'import os\n'), ((377, 412), 'os.path.join', 'os.path.join', ([... |
#!/usr/bin/env python
from distutils.core import setup
setup(
name="onifw",
version="1.13",
description="pentest framework",
author="w0bos",
author_email="<EMAIL>",
packages=["packaging"]
)
| [
"distutils.core.setup"
] | [((57, 194), 'distutils.core.setup', 'setup', ([], {'name': '"""onifw"""', 'version': '"""1.13"""', 'description': '"""pentest framework"""', 'author': '"""w0bos"""', 'author_email': '"""<EMAIL>"""', 'packages': "['packaging']"}), "(name='onifw', version='1.13', description='pentest framework', author\n ='w0bos', au... |
"""
This is an example of how to add the occupancy into the model.
"""
from cobs import Model
Model.set_energyplus_folder("D:\\Software\\EnergyPlus\\")
mode = 1
model = Model(idf_file_name="../data/buildings/5ZoneAirCooled.idf",
weather_file="../data/weathers/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.e... | [
"cobs.Model",
"cobs.Model.set_energyplus_folder",
"cobs.OccupancyGenerator"
] | [((96, 153), 'cobs.Model.set_energyplus_folder', 'Model.set_energyplus_folder', (['"""D:\\\\Software\\\\EnergyPlus\\\\"""'], {}), "('D:\\\\Software\\\\EnergyPlus\\\\')\n", (123, 153), False, 'from cobs import Model\n'), ((173, 315), 'cobs.Model', 'Model', ([], {'idf_file_name': '"""../data/buildings/5ZoneAirCooled.idf"... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import hashlib
impor... | [
"psutil.process_iter",
"hashlib.sha1",
"pants.base.build_environment.get_buildroot",
"pants.util.dirutil.safe_open",
"time.time",
"threading.Lock",
"os.kill",
"time.sleep",
"os._exit",
"os.setsid",
"collections.namedtuple",
"os.fork",
"pants.java.executor.SubprocessExecutor",
"pants.java.n... | [((729, 756), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (746, 756), False, 'import logging\n'), ((1239, 1300), 'collections.namedtuple', 'namedtuple', (['"""Endpoint"""', "['exe', 'fingerprint', 'pid', 'port']"], {}), "('Endpoint', ['exe', 'fingerprint', 'pid', 'port'])\n", (1249, 13... |
from conans import ConanFile, CMake
from conans.tools import unzip, download
import os
import shutil
class WebsocketppConan(ConanFile):
name = "websocketpp"
boost_version = "1.68.0"
openssl_version = "1.1.1"
zlib_version = "1.2.11"
with open(os.path.join(os.path.dirname(os.path.realpath(
... | [
"os.unlink",
"os.path.realpath",
"conans.CMake",
"shutil.move",
"conans.tools.unzip"
] | [((1059, 1074), 'conans.tools.unzip', 'unzip', (['tar_file'], {}), '(tar_file)\n', (1064, 1074), False, 'from conans.tools import unzip, download\n'), ((1083, 1102), 'os.unlink', 'os.unlink', (['tar_file'], {}), '(tar_file)\n', (1092, 1102), False, 'import os\n'), ((1111, 1168), 'shutil.move', 'shutil.move', (['f"""web... |
#!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 4 15:45:33 2019
@author: ejreidelbach
:DESCRIPTION:
:REQUIRES:
:TODO:
"""
#==============================================================================
# Package Import
#==================================================================... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"pandas.read_csv",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"math.floor",
"pathlib.Path",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"os.chdir"
] | [((3421, 3484), 'pathlib.Path', 'pathlib.Path', (['"""/home/ejreidelbach/Projects/kagglePUBG/data/raw"""'], {}), "('/home/ejreidelbach/Projects/kagglePUBG/data/raw')\n", (3433, 3484), False, 'import pathlib\n'), ((3485, 3503), 'os.chdir', 'os.chdir', (['path_dir'], {}), '(path_dir)\n', (3493, 3503), False, 'import os\n... |
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.http import HttpResponse
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from django.urls import reverse, reverse_lazy
from django.utils.tran... | [
"views.FAQView.as_view",
"django.conf.urls.include",
"django.http.HttpResponse",
"django.utils.translation.gettext_lazy",
"django.urls.reverse_lazy",
"django.views.i18n.JavaScriptCatalog.as_view",
"user_admin.views.UserUpdateView.as_view",
"django.views.decorators.cache.cache_control",
"django.templ... | [((1690, 1723), 'django.conf.urls.url', 'url', (['"""^$"""', 'root_view'], {'name': '"""root"""'}), "('^$', root_view, name='root')\n", (1693, 1723), False, 'from django.conf.urls import include, url\n'), ((1998, 2039), 'django.conf.urls.url', 'url', (['"""^login/$"""', 'login_view'], {'name': '"""login"""'}), "('^logi... |
#! /usr/bin/env python
"""
Copyright 2015-2018 <NAME> <<EMAIL>>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or... | [
"numpy.stack",
"os.path.exists",
"numpy.array"
] | [((1231, 1251), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (1245, 1251), False, 'import os\n'), ((3132, 3148), 'numpy.stack', 'np.stack', (['frames'], {}), '(frames)\n', (3140, 3148), True, 'import numpy as np\n'), ((3174, 3194), 'numpy.array', 'np.array', (['frames_idx'], {}), '(frames_idx)\n', (3... |
#!/usr/bin/env python3
# Copyright (c) 2019-2021 The EDID JSON Tools authors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
# We need this stub of a script to be able to handle `pip install --editable .`
import setuptools
setuptools.setup()
| [
"setuptools.setup"
] | [((241, 259), 'setuptools.setup', 'setuptools.setup', ([], {}), '()\n', (257, 259), False, 'import setuptools\n')] |
import os
import sys
from distutils.core import setup
from Cython.Build import cythonize
CYTHON_DEBUG = bool(os.getenv('CYTHON_DEBUG', ''))
build_dir = sys.argv.pop()
script_name = sys.argv.pop()
setup(
ext_modules=cythonize(
script_name,
build_dir=build_dir,
quiet=not CYTHON_DEBUG,
... | [
"Cython.Build.cythonize",
"os.getenv",
"sys.argv.pop"
] | [((156, 170), 'sys.argv.pop', 'sys.argv.pop', ([], {}), '()\n', (168, 170), False, 'import sys\n'), ((185, 199), 'sys.argv.pop', 'sys.argv.pop', ([], {}), '()\n', (197, 199), False, 'import sys\n'), ((112, 141), 'os.getenv', 'os.getenv', (['"""CYTHON_DEBUG"""', '""""""'], {}), "('CYTHON_DEBUG', '')\n", (121, 141), Fals... |
# (c) 2012-2019, Ansible by Red Hat
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
... | [
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.urls.reverse",
"logging.getLogger"
] | [((859, 886), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (876, 886), False, 'import logging\n'), ((1067, 1161), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['settings.AUTH_USER_MODEL'], {'related_name': '"""namespaces"""', 'editable': '(True)'}), "(settings.AUTH_USE... |
#!/usr/bin/env python3
if __name__ == '__main__':
from cassandra.rockets import RandomRocket
from cassandra.simulation import Simulation
from cassandra.physics.integrators import RK4
SIM_TIME = 8
SIM_TIMESTEP = 0.01
rocket = RandomRocket()
integrator = RK4()
simulation = Simulation(rocket, integrat... | [
"cassandra.rockets.RandomRocket",
"cassandra.physics.integrators.RK4",
"cassandra.simulation.Simulation"
] | [((241, 255), 'cassandra.rockets.RandomRocket', 'RandomRocket', ([], {}), '()\n', (253, 255), False, 'from cassandra.rockets import RandomRocket\n'), ((271, 276), 'cassandra.physics.integrators.RK4', 'RK4', ([], {}), '()\n', (274, 276), False, 'from cassandra.physics.integrators import RK4\n'), ((293, 323), 'cassandra.... |
import os
import random
import torch
# from torch.autograd import Variable
from torchvision import transforms as T
from PIL import Image, ImageDraw, ImageFont
class IMGProcess(object):
def __init__(self, source,
use_cuda=True,
img_path="imgs",
batch_size=100,
... | [
"os.listdir",
"torch.unique",
"torch.FloatTensor",
"torch.cat",
"random.choice",
"torchvision.transforms.ToTensor",
"PIL.ImageFont.truetype",
"PIL.Image.open",
"torch.nonzero",
"torch.max",
"torch.sort",
"PIL.ImageDraw.Draw",
"torch.no_grad",
"os.path.join",
"torch.min",
"torchvision.t... | [((763, 798), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['"""arial.ttf"""', '(15)'], {}), "('arial.ttf', 15)\n", (781, 798), False, 'from PIL import Image, ImageDraw, ImageFont\n'), ((5356, 5375), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['img'], {}), '(img)\n', (5370, 5375), False, 'from PIL import Image, Image... |
import re
def asSeconds(data, default=None):
r"""
Convert string to seconds. The following input is accepted:
* A humanly readable time (e.g. "1d").
* A SLURM time string (e.g. "1-00:00:00").
* A time string (e.g. "24:00:00").
* ``int`` or ``float``: interpreted as seconds.
:argu... | [
"re.match"
] | [((1059, 1112), 're.match', 're.match', (['"""^[0-9]*\\\\-[0-9]*\\\\:[0-9]*\\\\:[0-9]*$"""', 'data'], {}), "('^[0-9]*\\\\-[0-9]*\\\\:[0-9]*\\\\:[0-9]*$', data)\n", (1067, 1112), False, 'import re\n'), ((1727, 1771), 're.match', 're.match', (['"""^[0-9]*\\\\:[0-9]*\\\\:[0-9]*$"""', 'data'], {}), "('^[0-9]*\\\\:[0-9]*\\\... |
#!/usr/bin/env python
import spider_base_selenium
class MySpider(spider_base_selenium.Spider):
def __init__(self):
self.urls = [
'http://www.baidu.com',
'http://www.bing.com',
'http://www.weibo.com',
]
def parse(self, response):
print(response.get_r... | [
"spider_base_selenium.Engine"
] | [((405, 434), 'spider_base_selenium.Engine', 'spider_base_selenium.Engine', ([], {}), '()\n', (432, 434), False, 'import spider_base_selenium\n')] |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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
from ... import _utilities, _tables
from... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set"
] | [((1688, 1727), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""clientApplication"""'}), "(name='clientApplication')\n", (1701, 1727), False, 'import pulumi\n'), ((2101, 2141), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""clusterApplication"""'}), "(name='clusterApplication')\n", (2114, 2141), False, 'import... |
from package import redact_ex
from package import solve_explicit_ode
import numpy as np
EXERCISE_01 = """\
Make a program that is able to graphically solve the equation
\u2202T/\u2202t = \u03B1 \u2202\u00B2T/\u2202x\u00B2 = 0 using the Forward in Time, Centered in Space (FTCS)
scheme with Dirichlet boundary conditi... | [
"package.solve_explicit_ode",
"package.redact_ex",
"numpy.zeros",
"numpy.cos"
] | [((487, 512), 'package.redact_ex', 'redact_ex', (['EXERCISE_01', '(1)'], {}), '(EXERCISE_01, 1)\n', (496, 512), False, 'from package import redact_ex\n'), ((772, 792), 'numpy.zeros', 'np.zeros', (['(slices + 1)'], {}), '(slices + 1)\n', (780, 792), True, 'import numpy as np\n'), ((801, 821), 'numpy.zeros', 'np.zeros', ... |
import itertools
import regex as re
import numpy as np
# seed is fixed for reproducibility
np.random.seed(7)
from tensorflow import set_random_seed
set_random_seed(7)
from unidecode import unidecode
from delft.utilities.Tokenizer import tokenizeAndFilterSimple
from delft.utilities.bert.run_classifier_delft import Data... | [
"unidecode.unidecode",
"numpy.random.seed",
"regex.compile",
"numpy.zeros",
"tensorflow.set_random_seed",
"regex.sub",
"numpy.where",
"delft.utilities.bert.tokenization.convert_to_unicode",
"delft.utilities.bert.run_classifier_delft.InputExample"
] | [((91, 108), 'numpy.random.seed', 'np.random.seed', (['(7)'], {}), '(7)\n', (105, 108), True, 'import numpy as np\n'), ((148, 166), 'tensorflow.set_random_seed', 'set_random_seed', (['(7)'], {}), '(7)\n', (163, 166), False, 'from tensorflow import set_random_seed\n'), ((483, 546), 'regex.compile', 're.compile', (['"""[... |
import dlib
if dlib.cuda.get_num_devices()>=1:
print("Enabeling CUDA")
dlib.DLIB_USE_CUDA = True
dlib.USE_AVX_INSTRUCTIONS = True
dlib.DLIB_USE_BLAS, dlib.DLIB_USE_LAPACK, dlib.USE_NEON_INSTRUCTIONS = True, True, True
print(dlib.DLIB_USE_CUDA, dlib.USE_AVX_INSTRUCTIONS, dlib.DLIB_USE_BLAS, dlib.DLIB_USE... | [
"os.remove",
"face_recognition.compare_faces",
"cv2.cvtColor",
"face_recognition.face_encodings",
"dlib.cuda.get_num_devices",
"face_recognition.face_locations",
"face_recognition.load_image_file",
"os.listdir"
] | [((15, 42), 'dlib.cuda.get_num_devices', 'dlib.cuda.get_num_devices', ([], {}), '()\n', (40, 42), False, 'import dlib\n'), ((1085, 1112), 'os.listdir', 'os.listdir', (['KNOWN_FACES_DIR'], {}), '(KNOWN_FACES_DIR)\n', (1095, 1112), False, 'import os\n'), ((2109, 2147), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLO... |
from discord.ext import commands
bot = commands.Bot(command_prefix=',')
@bot.command()
async def react(ctx, id, emoji):
message = await ctx.fetch_message(id)
await message.add_reaction(emoji)
# Usage: ,react [MESSAGE_ID] [EMOJI] | [
"discord.ext.commands.Bot"
] | [((41, 73), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': '""","""'}), "(command_prefix=',')\n", (53, 73), False, 'from discord.ext import commands\n')] |
# Princeton University licenses this file to You 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 writin... | [
"numpy.atleast_2d",
"copy.deepcopy",
"ctypes.c_int",
"numpy.ctypeslib.as_ctypes",
"ctypes.byref",
"ctypes.sizeof",
"numpy.asfarray",
"collections.defaultdict",
"numpy.int32",
"ctypes.POINTER"
] | [((2832, 2851), 'ctypes.sizeof', 'ctypes.sizeof', (['data'], {}), '(data)\n', (2845, 2851), False, 'import copy, ctypes\n'), ((3008, 3025), 'ctypes.sizeof', 'ctypes.sizeof', (['ty'], {}), '(ty)\n', (3021, 3025), False, 'import copy, ctypes\n'), ((3899, 3920), 'numpy.asfarray', 'np.asfarray', (['variable'], {}), '(varia... |
import cv2
import argparse
import os
data={"label_name":[],"no_of_video":[], "overall_fps":[]}
def TrainingVideoFiles(video_location, video_name):
files = [f for f in os.listdir(video_location)]
data['label_name'].append(video_name)
data['no_of_video'].append(len(files))
fps=0
try:
os... | [
"cv2.VideoCapture",
"os.mkdir",
"os.listdir",
"cv2.imwrite"
] | [((949, 981), 'os.listdir', 'os.listdir', (['"""./offline_training"""'], {}), "('./offline_training')\n", (959, 981), False, 'import os\n'), ((318, 359), 'os.mkdir', 'os.mkdir', (["('tf_files/mudras/' + video_name)"], {}), "('tf_files/mudras/' + video_name)\n", (326, 359), False, 'import os\n'), ((477, 522), 'cv2.Video... |
from unidecode import unidecode
def compare_name(name_1, name_2):
name_1 = unidecode(name_1).lower()
name_2 = unidecode(name_2).lower()
return name_1 == name_2
| [
"unidecode.unidecode"
] | [((85, 102), 'unidecode.unidecode', 'unidecode', (['name_1'], {}), '(name_1)\n', (94, 102), False, 'from unidecode import unidecode\n'), ((128, 145), 'unidecode.unidecode', 'unidecode', (['name_2'], {}), '(name_2)\n', (137, 145), False, 'from unidecode import unidecode\n')] |
from django.conf.urls import url
from . import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
url('^$',views.index,name='index'),
url('^image/',views.single_image,name='single_image'),
url('^location/',views.images_by_location,name='location'),
url('^c... | [
"django.conf.urls.static.static",
"django.conf.urls.url"
] | [((150, 186), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.index'], {'name': '"""index"""'}), "('^$', views.index, name='index')\n", (153, 186), False, 'from django.conf.urls import url\n'), ((190, 245), 'django.conf.urls.url', 'url', (['"""^image/"""', 'views.single_image'], {'name': '"""single_image"""'}), "('... |
"""
---
title: Generative Adversarial Networks (GAN)
summary: A simple PyTorch implementation/tutorial of Generative Adversarial Networks (GAN) loss functions.
---
# Generative Adversarial Networks (GAN)
This is an implementation of
[Generative Adversarial Networks](https://arxiv.org/abs/1406.2661).
The generator, $... | [
"torch.nn.BCEWithLogitsLoss",
"torch.empty"
] | [((2434, 2456), 'torch.nn.BCEWithLogitsLoss', 'nn.BCEWithLogitsLoss', ([], {}), '()\n', (2454, 2456), True, 'import torch.nn as nn\n'), ((2483, 2505), 'torch.nn.BCEWithLogitsLoss', 'nn.BCEWithLogitsLoss', ([], {}), '()\n', (2503, 2505), True, 'import torch.nn as nn\n'), ((4081, 4103), 'torch.nn.BCEWithLogitsLoss', 'nn.... |
# Generated by Django 3.0.8 on 2021-02-25 08:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Gallery', '0010_pickedimage'),
]
operations = [
migrations.RemoveField(
model_name='pickedimage',
name='cover_image'... | [
"django.db.migrations.RemoveField",
"django.db.models.ManyToManyField"
] | [((228, 296), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""pickedimage"""', 'name': '"""cover_image"""'}), "(model_name='pickedimage', name='cover_image')\n", (250, 296), False, 'from django.db import migrations, models\n'), ((450, 499), 'django.db.models.ManyToManyField', 'mode... |
# -*- coding: utf-8 -*-
# file: DetectronModelMeta.py
# date: 2021-09-23
from multipledispatch import dispatch
from detectron2 import model_zoo
from .. import common
class DetectronModelMeta(common.ModelMeta):
def __init__(self,
dataset: str, task: str, model: str, backbone: str
):
se... | [
"detectron2.model_zoo.get_checkpoint_url"
] | [((1286, 1334), 'detectron2.model_zoo.get_checkpoint_url', 'model_zoo.get_checkpoint_url', (["(sub_path + '.yaml')"], {}), "(sub_path + '.yaml')\n", (1314, 1334), False, 'from detectron2 import model_zoo\n')] |
import fresh_tomatoes
import media
# Create a data structure
alien = media.Movie(
"Alien",
"During its return to the earth, commercial spaceship\
Nostromo intercepts a distress signal from a distant planet.",
"https://image.tmdb.org/t/p/w640/2h00HrZs89SL3tXB4nbkiM7BKHs.jpg",
"https://www.youtube.c... | [
"fresh_tomatoes.open_movies_page",
"media.Movie"
] | [((71, 338), 'media.Movie', 'media.Movie', (['"""Alien"""', '"""During its return to the earth, commercial spaceship Nostromo intercepts a distress signal from a distant planet."""', '"""https://image.tmdb.org/t/p/w640/2h00HrZs89SL3tXB4nbkiM7BKHs.jpg"""', '"""https://www.youtube.com/watch?v=jQ5lPt9edzQ"""'], {}), "(... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: entry_meta.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _re... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.descriptor_pb2.FileOptions",
"google.protobuf.descriptor_pb2.MessageOptions"
] | [((483, 509), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (507, 509), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((6039, 6067), 'google.protobuf.descriptor_pb2.FileOptions', 'descriptor_pb2.FileOptions', ([], {}), '()\n', (6065, 6067), False,... |
import gimp
from gimp import pdb
from settings import *
from network import *
from image import *
from utils import *
from draw import *
from paint import *
from collections import Counter
import TwitterAPI
from random import randrange, choice, shuffle
from string import letters
import datetime as dt
from time import... | [
"gimp.pdb.gimp_image_get_active_layer",
"random.shuffle",
"gimp.pdb.plug_in_plasma",
"random.choice",
"gimp.pdb.gimp_image_active_drawable",
"time.sleep",
"gimp.pdb.gimp_layer_set_opacity",
"TwitterAPI.TwitterAPI",
"gimp.pdb.gimp_layer_set_mode",
"gimp.pdb.plug_in_apply_canvas",
"gimp.pdb.gimp_i... | [((2575, 2592), 'datetime.datetime.now', 'dt.datetime.now', ([], {}), '()\n', (2590, 2592), True, 'import datetime as dt\n'), ((3868, 3963), 'TwitterAPI.TwitterAPI', 'TwitterAPI.TwitterAPI', (['CONSUMER_KEY', 'CONSUMER_SECRET', 'ACCESS_TOKEN_KEY', 'ACCESS_TOKEN_SECRET'], {}), '(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOK... |
import asyncio
from email.mime.text import MIMEText
from random import random, choice
from aiosmtplib import SMTP
class CheckerEmail:
"""
class for check email
use :
from CheckerMailPy import CheckerEmail
from email.mime.text import MIMEText
async def async_start() ->... | [
"asyncio.get_event_loop",
"aiosmtplib.SMTP",
"email.mime.text.MIMEText",
"random.choice",
"random.random"
] | [((1348, 1398), 'aiosmtplib.SMTP', 'SMTP', ([], {'password': 'password', 'username': 'login', 'loop': 'loop'}), '(password=password, username=login, loop=loop)\n', (1352, 1398), False, 'from aiosmtplib import SMTP\n'), ((2040, 2054), 'email.mime.text.MIMEText', 'MIMEText', (['text'], {}), '(text)\n', (2048, 2054), Fals... |
import torch
import torch.nn.functional as F
import mxnet as mx
def get_mma_loss(weight):
'''
MMA regularization in PyTorch
:param weight: parameter of a layer in model, out_features * in_features
:return: mma loss
'''
# for convolutional layers, flatten
if weight.dim() > 2:
weigh... | [
"mxnet.symbol.linalg.syrk",
"mxnet.symbol.eye",
"mxnet.symbol.mean",
"torch.diag",
"mxnet.symbol.L2Normalization",
"mxnet.symbol.max",
"torch.nn.functional.normalize"
] | [((447, 478), 'torch.nn.functional.normalize', 'F.normalize', (['weight'], {'p': '(2)', 'dim': '(1)'}), '(weight, p=2, dim=1)\n', (458, 478), True, 'import torch.nn.functional as F\n'), ((1362, 1412), 'mxnet.symbol.L2Normalization', 'mx.symbol.L2Normalization', (['weight'], {'mode': '"""instance"""'}), "(weight, mode='... |
import json
import math
from datetime import datetime, timedelta
from decimal import Decimal
from typing import Any, Dict, List
import boto3
import boto3.dynamodb.types
from boto3.dynamodb.conditions import Attr
from logzero import logger
def send_messages(messages: List[Dict[str, str]], queue_name: str,
... | [
"boto3.client",
"decimal.Decimal",
"json.dumps",
"boto3.resource",
"datetime.timedelta",
"boto3.dynamodb.conditions.Attr",
"boto3.dynamodb.types.TypeDeserializer",
"datetime.datetime.now"
] | [((368, 389), 'boto3.resource', 'boto3.resource', (['"""sqs"""'], {}), "('sqs')\n", (382, 389), False, 'import boto3\n'), ((403, 422), 'boto3.client', 'boto3.client', (['"""sqs"""'], {}), "('sqs')\n", (415, 422), False, 'import boto3\n'), ((949, 970), 'boto3.resource', 'boto3.resource', (['"""sqs"""'], {}), "('sqs')\n"... |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.template import loader
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView
# from geelweb.django... | [
"django.shortcuts.render"
] | [((2028, 2087), 'django.shortcuts.render', 'render', (['request', '"""awwardapp/about.html"""', "{'title': 'About'}"], {}), "(request, 'awwardapp/about.html', {'title': 'About'})\n", (2034, 2087), False, 'from django.shortcuts import render\n')] |
# (c)2020 TeleBot
# You may not use this file without proper authorship and consent from @TeleBotSupport
#
"""
Available command(s)
.sticklol
Generates a. random laughing sticker.
"""
import random
from telethon import functions, types, utils
from telebot.utils import admin_cmd
def choser(cmd, pack, blacklist=None)... | [
"telethon.types.InputStickerSetShortName",
"random.choice",
"telethon.utils.get_input_document",
"telebot.utils.admin_cmd"
] | [((404, 446), 'telebot.utils.admin_cmd', 'admin_cmd', ([], {'pattern': 'f"""{cmd}"""', 'outgoing': '(True)'}), "(pattern=f'{cmd}', outgoing=True)\n", (413, 446), False, 'from telebot.utils import admin_cmd\n'), ((593, 620), 'telethon.utils.get_input_document', 'utils.get_input_document', (['x'], {}), '(x)\n', (617, 620... |
import dash
import os
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import json
import requests
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
from selenium import webdriver
chrome... | [
"pandas.DataFrame",
"json.loads",
"dash_html_components.H2",
"dash_bootstrap_components.Row",
"dash_html_components.Div",
"dash_html_components.Button",
"dash.dependencies.Input",
"dash_bootstrap_components.Col",
"dash_html_components.P",
"pickle.load",
"selenium.webdriver.ChromeOptions",
"num... | [((377, 402), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (400, 402), False, 'from selenium import webdriver\n'), ((523, 594), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'executable_path': 'chrome_exec_shim', 'chrome_options': 'opts'}), '(executable_path=chrome_exec_shim... |
from framework.utils.common_utils import by_css
from testdata.test_data import url
USERNAME = 'username'
PASSWORD = 'password'
VALID_CREDENTIALS = {USERNAME: "<EMAIL>",
PASSWORD: "<PASSWORD>"}
DATA_WINNERS_ACCOUNT_PAGE = url("/account/")
ORGANIZATION_SECTOR_DROP_DOWN_LIST = by_css("select#id_sect... | [
"testdata.test_data.url",
"framework.utils.common_utils.by_css"
] | [((244, 260), 'testdata.test_data.url', 'url', (['"""/account/"""'], {}), "('/account/')\n", (247, 260), False, 'from testdata.test_data import url\n'), ((298, 324), 'framework.utils.common_utils.by_css', 'by_css', (['"""select#id_sector"""'], {}), "('select#id_sector')\n", (304, 324), False, 'from framework.utils.comm... |
# Copied from https://github.com/Athesdrake/aiotfm/blob/master/aiotfm/client.py
import sys
import asyncio
import traceback
class InvalidEvent(Exception):
"""Exception thrown when you added an invalid event to the client.
An event is valid only if its name begin by 'on_' and it is coroutine.
"""
class EventBased... | [
"asyncio.wait_for",
"traceback.format_exc",
"asyncio.iscoroutinefunction"
] | [((1665, 1698), 'asyncio.wait_for', 'asyncio.wait_for', (['future', 'timeout'], {}), '(future, timeout)\n', (1681, 1698), False, 'import asyncio\n'), ((3722, 3752), 'traceback.format_exc', 'traceback.format_exc', ([], {'limit': '(-3)'}), '(limit=-3)\n', (3742, 3752), False, 'import traceback\n'), ((628, 661), 'asyncio.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 17 21:24:37 2019
@author: anilosmantur
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 17 20:43:41 2019
@author: anilosmantur
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomFore... | [
"sklearn.ensemble.RandomForestClassifier",
"sklearn.model_selection.GridSearchCV",
"numpy.concatenate",
"sklearn.metrics.accuracy_score",
"sklearn.preprocessing.MinMaxScaler",
"numpy.ones",
"numpy.arange",
"numpy.array",
"numpy.random.shuffle"
] | [((1575, 1595), 'numpy.arange', 'np.arange', (['n_samples'], {}), '(n_samples)\n', (1584, 1595), True, 'import numpy as np\n'), ((1608, 1660), 'numpy.concatenate', 'np.concatenate', (['[nums[:5], nums[10:15], nums[20:25]]'], {}), '([nums[:5], nums[10:15], nums[20:25]])\n', (1622, 1660), True, 'import numpy as np\n'), (... |
from __future__ import absolute_import, print_function
from numpy.testing import TestCase, dec, assert_, run_module_suite
from scipy.weave import inline_tools
class TestInline(TestCase):
"""These are long running tests...
Would be useful to benchmark these things somehow.
"""
@dec.slow
def test... | [
"scipy.weave.inline_tools.inline",
"numpy.testing.assert_",
"numpy.testing.run_module_suite"
] | [((1475, 1493), 'numpy.testing.run_module_suite', 'run_module_suite', ([], {}), '()\n', (1491, 1493), False, 'from numpy.testing import TestCase, dec, assert_, run_module_suite\n'), ((632, 664), 'scipy.weave.inline_tools.inline', 'inline_tools.inline', (['code', "['a']"], {}), "(code, ['a'])\n", (651, 664), False, 'fro... |
import os
import subprocess
import re
BIN_FFMPEG = 'ffmpeg'
def convert(srcfile, outfile, bit_rate, channels, sample_rate, codec, tags, volume=None, verbose=False):
"""
Converts the source file to the outfile with the proper transformations.
Includes the additional tags.
"""
if srcfile == outfil... | [
"subprocess.run",
"os.path.isfile",
"os.unlink",
"re.compile"
] | [((1942, 2041), 're.compile', 're.compile', (['"""\\\\[Parsed_volumedetect_\\\\d+ @ ([^\\\\]]+)\\\\] mean_volume: (-?\\\\d+\\\\.?\\\\d*) dB"""'], {}), "(\n '\\\\[Parsed_volumedetect_\\\\d+ @ ([^\\\\]]+)\\\\] mean_volume: (-?\\\\d+\\\\.?\\\\d*) dB'\n )\n", (1952, 2041), False, 'import re\n'), ((2050, 2148), 're.co... |
import os
ENVIRONMENT = os.environ.get("ENVIRONMENT")
SECRET_KEY = os.environ.get("SECRET_KEY")
ORDNANCE_SURVEY_PLACES_API_KEY = os.environ.get("ORDNANCE_SURVEY_PLACES_API_KEY")
PERMANENT_SESSION_LIFETIME = int(os.environ.get("PERMANENT_SESSION_LIFETIME"))
GA_TRACKING_ID = os.environ.get("GA_TRACKING_ID")
GA_CROSS_DOM... | [
"os.environ.get"
] | [((25, 54), 'os.environ.get', 'os.environ.get', (['"""ENVIRONMENT"""'], {}), "('ENVIRONMENT')\n", (39, 54), False, 'import os\n'), ((68, 96), 'os.environ.get', 'os.environ.get', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (82, 96), False, 'import os\n'), ((130, 178), 'os.environ.get', 'os.environ.get', (['"""ORDNAN... |
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from django.core.paginator import Paginator
from django.db.models import Q, Count, Max
from django.views.generic import ListView, DetailView, TemplateView
from django_filters.views import ... | [
"django.db.models.Max",
"django_filters.rest_framework.CharFilter",
"django_filters.rest_framework.NumberFilter",
"django.db.models.Q",
"django.db.models.Count",
"django_filters.rest_framework.BooleanFilter",
"logging.getLogger",
"django_filters.rest_framework.ChoiceFilter"
] | [((741, 768), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (758, 768), False, 'import logging\n'), ((1456, 1490), 'django_filters.rest_framework.NumberFilter', 'filters.NumberFilter', (['"""author__id"""'], {}), "('author__id')\n", (1476, 1490), True, 'from django_filters import rest_fr... |
import tensorflow as tf
from tensorflow.python.framework import ops
import os
dot_slash = os.path.dirname(__file__)
# Making roi_pooling_layer available for import as a library
roi_location = os.path.join(dot_slash, "rpl.so")
op_module = tf.load_op_library(roi_location)
roi_pooling_layer = op_module.roi_pooler
# Mak... | [
"tensorflow.load_op_library",
"os.path.dirname",
"os.path.join",
"tensorflow.python.framework.ops.RegisterGradient"
] | [((91, 116), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (106, 116), False, 'import os\n'), ((194, 227), 'os.path.join', 'os.path.join', (['dot_slash', '"""rpl.so"""'], {}), "(dot_slash, 'rpl.so')\n", (206, 227), False, 'import os\n'), ((240, 272), 'tensorflow.load_op_library', 'tf.load_op... |
from django.views.generic import ListView, DetailView
from eventex.core.models import Speaker, Talk
home = ListView.as_view(template_name='index.html', model=Speaker)
speaker_detail = DetailView.as_view(model=Speaker)
talk_list = ListView.as_view(model=Talk)
| [
"django.views.generic.ListView.as_view",
"django.views.generic.DetailView.as_view"
] | [((109, 168), 'django.views.generic.ListView.as_view', 'ListView.as_view', ([], {'template_name': '"""index.html"""', 'model': 'Speaker'}), "(template_name='index.html', model=Speaker)\n", (125, 168), False, 'from django.views.generic import ListView, DetailView\n'), ((187, 220), 'django.views.generic.DetailView.as_vie... |
from skfda.representation.basis import (
FDataBasis, Monomial, BSpline, Fourier, Constant, VectorValued, Tensor)
import unittest
import numpy as np
class TestBasisEvaluationFourier(unittest.TestCase):
def test_evaluation_simple_fourier(self):
"""Test the evaluation of FDataBasis"""
fourier ... | [
"unittest.main",
"skfda.representation.basis.BSpline",
"numpy.testing.assert_raises",
"skfda.representation.basis.Fourier",
"skfda.representation.basis.Constant",
"skfda.representation.basis.VectorValued",
"numpy.array",
"skfda.representation.basis.Monomial",
"numpy.linspace",
"numpy.testing.asser... | [((18780, 18795), 'unittest.main', 'unittest.main', ([], {}), '()\n', (18793, 18795), False, 'import unittest\n'), ((322, 361), 'skfda.representation.basis.Fourier', 'Fourier', ([], {'domain_range': '(0, 2)', 'n_basis': '(5)'}), '(domain_range=(0, 2), n_basis=5)\n', (329, 361), False, 'from skfda.representation.basis i... |
import tensorflow as tf
import time
from IPython.display import display
from utils.label_generator import classifier_label_generator
def frcnn_train_step(model, train_dataset, train_stage, epochs=1, valid_dataset=None, change_lr=False, rpn_lr=None, cls_lr=None):
if change_lr:
if rpn_lr:
tf.kera... | [
"tensorflow.keras.backend.set_value",
"utils.label_generator.classifier_label_generator",
"IPython.display.display",
"time.time"
] | [((1330, 1341), 'time.time', 'time.time', ([], {}), '()\n', (1339, 1341), False, 'import time\n'), ((1408, 1463), 'IPython.display.display', 'display', (['"""Training loss at step 0 : 0"""'], {'display_id': '(True)'}), "('Training loss at step 0 : 0', display_id=True)\n", (1415, 1463), False, 'from IPython.display impo... |
from time import time, strftime, sleep
import praw
source = 'the_donald'
dest = 'td_uncensored'
log_file = 'td_bot_log.txt'
reddit = praw.Reddit(
client_id='client_id',
client_secret='client_secret',
password='password',
username='username',
user_agent='linux:td_uncensored:0.1 (by /u/username)'
)
... | [
"time.sleep",
"praw.Reddit",
"time.strftime",
"time.time"
] | [((135, 307), 'praw.Reddit', 'praw.Reddit', ([], {'client_id': '"""client_id"""', 'client_secret': '"""client_secret"""', 'password': '"""password"""', 'username': '"""username"""', 'user_agent': '"""linux:td_uncensored:0.1 (by /u/username)"""'}), "(client_id='client_id', client_secret='client_secret', password=\n '... |
import pandas as pd
averages_df = employee.groupby(by='department').mean()[['salary']]
merged_df = pd.merge(employee, averages_df, how='inner',
left_on='department', right_on=averages_df.index)
merged_df[['department', 'first_name', 'salary_x', 'salary_y']]
| [
"pandas.merge"
] | [((101, 200), 'pandas.merge', 'pd.merge', (['employee', 'averages_df'], {'how': '"""inner"""', 'left_on': '"""department"""', 'right_on': 'averages_df.index'}), "(employee, averages_df, how='inner', left_on='department', right_on\n =averages_df.index)\n", (109, 200), True, 'import pandas as pd\n')] |
# Fichier permettant de moduler les differentes methodes de clustering
try:
# Import generaux
import numpy as np
import pylab
import sys
import platform
import matplotlib.pyplot as plt
import re
# Import locaux
import kmeans
import rkde
except:
exit(1)
... | [
"matplotlib.pyplot.xlim",
"pylab.show",
"re.split",
"matplotlib.pyplot.ioff",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"numpy.array",
"pylab.figure",
"pylab.ylim",
"platform.system",
"pylab.xlim",
"matplotlib.pyplot.savefig"
] | [((2035, 2049), 'pylab.figure', 'pylab.figure', ([], {}), '()\n', (2047, 2049), False, 'import pylab\n'), ((2159, 2183), 'pylab.xlim', 'pylab.xlim', (['[mini, maxi]'], {}), '([mini, maxi])\n', (2169, 2183), False, 'import pylab\n'), ((2189, 2213), 'pylab.ylim', 'pylab.ylim', (['[mini, maxi]'], {}), '([mini, maxi])\n', ... |
import os
import time
import subprocess
SOURCE_IMAP_HOST=os.getenv('SOURCE_IMAP_HOST', '')
SOURCE_IMAP_PORT=os.getenv('SOURCE_IMAP_PORT', None)
TARGET_AUTH_FILE=os.getenv('TARGET_AUTH_FILE')
_example_out = r"""
Here is imapsync 1.983 on host 39eb9c59f7a5, a linux system with 0.6/1.9 free GiB of RAM
with Perl 5.28.1 ... | [
"os.getenv",
"time.sleep"
] | [((58, 91), 'os.getenv', 'os.getenv', (['"""SOURCE_IMAP_HOST"""', '""""""'], {}), "('SOURCE_IMAP_HOST', '')\n", (67, 91), False, 'import os\n'), ((109, 144), 'os.getenv', 'os.getenv', (['"""SOURCE_IMAP_PORT"""', 'None'], {}), "('SOURCE_IMAP_PORT', None)\n", (118, 144), False, 'import os\n'), ((162, 191), 'os.getenv', '... |
# Generated by Django 2.2.4 on 2020-04-18 20:10
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0004_event'),
]
operations = [
migrations.CreateModel(
... | [
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.EmailField",
"django.db.models.AutoField",
"django.db.models.DateField"
] | [((381, 474), '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", (397, 474), False, 'from django.db import migrations, models\... |
#!/usr/bin/python3
import ctypes
import os
import sys
import argparse
import json
from PIL import Image, ImageFont, ImageDraw
org_wall = 'wall.jpg'
new_wall = 'task_wall.jpg'
try:
rf = open('data.json', 'r')
# Initial usage of the script will create a json file with all the default settings and a list to store ta... | [
"json.dump",
"os.remove",
"json.load",
"argparse.ArgumentParser",
"os.getcwd",
"PIL.Image.open",
"PIL.ImageFont.truetype",
"os.path.isfile",
"PIL.ImageDraw.Draw",
"ctypes.windll.user32.SystemParametersInfoW"
] | [((662, 675), 'json.load', 'json.load', (['rf'], {}), '(rf)\n', (671, 675), False, 'import json\n'), ((1155, 1175), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['wall'], {}), '(wall)\n', (1169, 1175), False, 'from PIL import Image, ImageFont, ImageDraw\n'), ((1224, 1265), 'PIL.ImageFont.truetype', 'ImageFont.truetype', ([... |
from bubblesort import bubblesort
from heapsort import heapsort
from insertionsort import insertionsort
from mergesort import mergesort
from quicksort import quicksort
from radixsort import radixsort
from selectionsort import selectionsort
from timsort import timsort
from timeit import default_timer as timer
# Bubble... | [
"insertionsort.insertionsort",
"heapsort.heapsort",
"timeit.default_timer",
"timsort.timsort",
"bubblesort.bubblesort",
"selectionsort.selectionsort",
"mergesort.mergesort",
"radixsort.radixsort",
"quicksort.quicksort"
] | [((333, 340), 'timeit.default_timer', 'timer', ([], {}), '()\n', (338, 340), True, 'from timeit import default_timer as timer\n'), ((341, 353), 'bubblesort.bubblesort', 'bubblesort', ([], {}), '()\n', (351, 353), False, 'from bubblesort import bubblesort\n'), ((360, 367), 'timeit.default_timer', 'timer', ([], {}), '()\... |
import json
import os
from classes.firebase import InitFirebaseConnection
from firebase_admin import db
from classes.google_maps import GoogleMaps
from classes.pharma_consults import PharmaConsults
from datetime import datetime
from sys import argv
print(argv)
if not argv[1] in ["-fo", "-fa"]:
raise BaseException... | [
"classes.pharma_consults.PharmaConsults.getCurrentlyOpenPharmacies",
"classes.google_maps.GoogleMaps.get_meta_links",
"os.path.exists",
"firebase_admin.db.reference",
"classes.firebase.InitFirebaseConnection",
"datetime.datetime.now"
] | [((374, 398), 'classes.firebase.InitFirebaseConnection', 'InitFirebaseConnection', ([], {}), '()\n', (396, 398), False, 'from classes.firebase import InitFirebaseConnection\n'), ((480, 523), 'classes.pharma_consults.PharmaConsults.getCurrentlyOpenPharmacies', 'PharmaConsults.getCurrentlyOpenPharmacies', ([], {}), '()\n... |
import json
import os
import random
import subprocess
import time
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import List, Optional
import docker
import pytest
from determined.common.api import bindings
from tests import config as conf
from tests import experiment as exp
from ..clust... | [
"docker.from_env",
"subprocess.run",
"tempfile.NamedTemporaryFile",
"tests.config.make_master_url",
"tests.experiment.wait_for_experiment_state",
"subprocess.check_output",
"pytest.fail",
"os.path.exists",
"random.choice",
"time.sleep",
"tests.config.fixtures_path",
"pathlib.Path",
"random.s... | [((7445, 7483), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""steps"""', '[10]'], {}), "('steps', [10])\n", (7468, 7483), False, 'import pytest\n'), ((7485, 7530), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""num_agents"""', '[3, 5]'], {}), "('num_agents', [3, 5])\n", (7508, 7530), False, '... |
from models2 import Department, Employee, db
from app2 import app
db.drop_all()
db.create_all()
d1 = Department(dept_code="mktg", dept_name="Marketing",phone="897-9999")
d2 = Department(dept_code="acct", dept_name="Accounting",phone="111-5429")
river = Employee(name="<NAME>", state="NY", dept_code="mktg")
summer = Em... | [
"models2.Employee",
"models2.db.session.add",
"models2.db.drop_all",
"models2.db.create_all",
"models2.Department",
"models2.db.session.commit"
] | [((67, 80), 'models2.db.drop_all', 'db.drop_all', ([], {}), '()\n', (78, 80), False, 'from models2 import Department, Employee, db\n'), ((81, 96), 'models2.db.create_all', 'db.create_all', ([], {}), '()\n', (94, 96), False, 'from models2 import Department, Employee, db\n'), ((103, 172), 'models2.Department', 'Departmen... |
# -*- coding: utf-8 -*-
"""
Flatten mesh using conformal mapping
=============================================
Map 3D mesh to a 2D (complex) plane with angle-preserving (conformal) mapping
Based on these course notes
https://www.cs.cmu.edu/~kmcrane/Projects/DDG/
section 7.4.
"""
import numpy as np
fro... | [
"bfieldtools.mesh_calculus.gradient",
"numpy.meshgrid",
"numpy.sum",
"mayavi.mlab.quiver3d",
"bfieldtools.flatten_mesh.flatten_mesh",
"bfieldtools.viz.plot_data_on_faces",
"mayavi.mlab.points3d",
"bfieldtools.utils.load_example_mesh",
"bfieldtools.viz.plot_data_on_vertices",
"numpy.linspace",
"b... | [((712, 758), 'bfieldtools.utils.load_example_mesh', 'load_example_mesh', (['"""meg_helmet"""'], {'process': '(False)'}), "('meg_helmet', process=False)\n", (729, 758), False, 'from bfieldtools.utils import load_example_mesh\n'), ((775, 806), 'bfieldtools.flatten_mesh.flatten_mesh', 'flatten_mesh', (['mesh'], {'_lambda... |
import re
from smartsearch.matcher import field_matcher, phrase_matcher, zip_matcher
from smartsearch.model import extractions, nlp
from smartsearch.referencer import extract_references
def static_args(**kwargs):
"""This decorator method is used to add static arguments to another method.
The reason we are d... | [
"smartsearch.matcher.zip_matcher",
"re.compile",
"smartsearch.model.extractions.get",
"smartsearch.matcher.phrase_matcher",
"smartsearch.matcher.field_matcher",
"smartsearch.model.extractions.clear",
"re.sub",
"smartsearch.referencer.extract_references"
] | [((922, 944), 're.sub', 're.sub', (['""","""', '""""""', 'match'], {}), "(',', '', match)\n", (928, 944), False, 'import re\n'), ((2047, 2066), 'smartsearch.model.extractions.clear', 'extractions.clear', ([], {}), '()\n', (2064, 2066), False, 'from smartsearch.model import extractions, nlp\n'), ((2437, 2453), 'smartsea... |
import os
import sqlite3
import logging
from esd_process import scrape_variables
class BaseBackend:
"""
Base class for backends, must be inherited to use
"""
def __init__(self):
self.output_folder = None
# these attributes are populated during scrape and saved to the backend (databas... | [
"os.path.exists",
"sqlite3.connect",
"os.path.join",
"logging.getLogger"
] | [((653, 713), 'logging.getLogger', 'logging.getLogger', (["(scrape_variables.logger_name + '_backend')"], {}), "(scrape_variables.logger_name + '_backend')\n", (670, 713), False, 'import logging\n'), ((2356, 2415), 'os.path.join', 'os.path.join', (['self.output_folder', '"""survey_database.sqlite3"""'], {}), "(self.out... |
import random
class Utils():
@classmethod
def _get_random_alphanumeric_string(cls):
return ''.join(random.choice('ABCDSFGEHIJK123456') for i in range(5))
@classmethod
def _get_random_numeric_string(cls):
return ''.join(random.choice('1234567890') for i in range(10))
@classmethod
... | [
"random.choice"
] | [((116, 151), 'random.choice', 'random.choice', (['"""ABCDSFGEHIJK123456"""'], {}), "('ABCDSFGEHIJK123456')\n", (129, 151), False, 'import random\n'), ((253, 280), 'random.choice', 'random.choice', (['"""1234567890"""'], {}), "('1234567890')\n", (266, 280), False, 'import random\n'), ((387, 413), 'random.choice', 'rand... |
from __future__ import unicode_literals
import requests
import time
import mimetypes
from bs4 import BeautifulSoup
from datetime import datetime, timedelta
from decimal import Decimal
from .exceptions import (
PageError, DisambiguationError, RedirectError, HTTPTimeoutError,
WikiaException, ODD_ERROR_MESSAGE)
from... | [
"mimetypes.init",
"time.time",
"datetime.timedelta",
"requests.get",
"datetime.datetime.now",
"mimetypes.guess_type"
] | [((401, 417), 'mimetypes.init', 'mimetypes.init', ([], {}), '()\n', (415, 417), False, 'import mimetypes\n'), ((1267, 1293), 'datetime.timedelta', 'timedelta', ([], {'milliseconds': '(50)'}), '(milliseconds=50)\n', (1276, 1293), False, 'from datetime import datetime, timedelta\n'), ((15421, 15474), 'requests.get', 'req... |
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import rubik_solver
from rubik_solver.defs import available_moves | [
"os.path.dirname"
] | [((71, 96), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (86, 96), False, 'import os\n')] |
"""
*********************************************************
* *
* Project Name: Recursive Fibonacci Sequence *
* Author: github.com/kirigaine *
* Description: A simple program to put in how many *
* numbers of the Fibonac... | [
"re.search"
] | [((1175, 1215), 're.search', 're.search', (['"""^(([0-9]*)|(-1))$"""', 'temp_nth'], {}), "('^(([0-9]*)|(-1))$', temp_nth)\n", (1184, 1215), False, 'import re\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-06 07:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('transactions', '0004_auto_20170606_0638'),
]
operations = [
migrations.AddF... | [
"django.db.models.DateTimeField",
"django.db.models.BooleanField"
] | [((411, 470), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'verbose_name': '"""balanced"""'}), "(default=False, verbose_name='balanced')\n", (430, 470), False, 'from django.db import migrations, models\n'), ((600, 671), 'django.db.models.DateTimeField', 'models.DateTimeField', ([]... |
import os, uuid, sys
from azure.mgmt.iotcentral import IotCentralClient
from azure.mgmt.iotcentral.models import App, AppSkuInfo, AppPatch
from msrestazure.azure_active_directory import MSIAuthentication
from azure.common.credentials import UserPassCredentials, get_azure_cli_credentials
# login with az login
creds = g... | [
"azure.mgmt.iotcentral.IotCentralClient",
"azure.common.credentials.get_azure_cli_credentials",
"azure.mgmt.iotcentral.models.AppPatch",
"azure.mgmt.iotcentral.models.AppSkuInfo"
] | [((319, 346), 'azure.common.credentials.get_azure_cli_credentials', 'get_azure_cli_credentials', ([], {}), '()\n', (344, 346), False, 'from azure.common.credentials import UserPassCredentials, get_azure_cli_credentials\n'), ((486, 519), 'azure.mgmt.iotcentral.IotCentralClient', 'IotCentralClient', (['creds[0]', 'subId'... |
import numpy as np
from tqdm import tqdm
from typing import Dict, Union
import torch
import gtimer as gt
import matplotlib
from matplotlib import pyplot as plt
import self_supervised.utils.typed_dicts as td
from self_supervised.base.data_collector.data_collector import \
PathCollectorSelfSupervised
from self_sup_c... | [
"rlkit.torch.pytorch_util.get_numpy",
"rlkit.core.rl_algorithm._get_epoch_timings",
"rlkit.torch.pytorch_util.from_numpy",
"matplotlib.use",
"numpy.array",
"numpy.random.randint",
"torch.Size",
"gtimer.stamp",
"rlkit.core.logger.record_tabular",
"rlkit.core.logger.dump_tabular"
] | [((1535, 1556), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (1549, 1556), False, 'import matplotlib\n'), ((3585, 3623), 'numpy.random.randint', 'np.random.randint', (['(self.num_skills - 1)'], {}), '(self.num_skills - 1)\n', (3602, 3623), True, 'import numpy as np\n'), ((4117, 4326), 'numpy.ar... |
import cadquery as cq
import numpy as np
from OCP.Standard import Standard_ConstructionError
def linear_milling_vol(cut, start_point, end_point, mill_diameter):
"""creates the volume that gets milled from linear move
Keyword arguments:
start_point -- [x,y,z] toolcentrepoint mm
end_point -- [x,y,z] to... | [
"numpy.sin",
"numpy.arctan2",
"cadquery.Workplane",
"numpy.cos"
] | [((478, 550), 'numpy.arctan2', 'np.arctan2', (['(end_point[1] - start_point[1])', '(end_point[0] - start_point[0])'], {}), '(end_point[1] - start_point[1], end_point[0] - start_point[0])\n', (488, 550), True, 'import numpy as np\n'), ((2469, 2490), 'cadquery.Workplane', 'cq.Workplane', (['"""front"""'], {}), "('front')... |
import sqlite3
with sqlite3.connect('new.db') as conn:
cursor = conn.cursor()
cursor.execute(
"""
SELECT population.city, population.population, regions.region
FROM population, regions
WHERE population.city = regions.city
"""
)
rows = cursor.fetchall()
for... | [
"sqlite3.connect"
] | [((21, 46), 'sqlite3.connect', 'sqlite3.connect', (['"""new.db"""'], {}), "('new.db')\n", (36, 46), False, 'import sqlite3\n')] |
"""
2-input XOR example -- this is most likely the simplest possible example.
"""
from __future__ import print_function
import neat
import multiprocessing
# 2-input XOR inputs and expected outputs.
xor_inputs = [(0.0, 0.0), (0.0, 1.0), (1.0, 0.0), (1.0, 1.0)]
xor_outputs = [ (0.0,), (1.0,), (1.0,), (0.0... | [
"neat.Config",
"neat.StdOutReporter",
"neat.nn.FeedForwardNetwork.create",
"neat.Population",
"multiprocessing.cpu_count"
] | [((697, 746), 'neat.nn.FeedForwardNetwork.create', 'neat.nn.FeedForwardNetwork.create', (['genome', 'config'], {}), '(genome, config)\n', (730, 746), False, 'import neat\n'), ((940, 1071), 'neat.Config', 'neat.Config', (['neat.SharedGenome', 'neat.DefaultReproduction', 'neat.DefaultSpeciesSet', 'neat.DefaultStagnation'... |
#!/usr/bin/env python
import requests
import argparse
from colorama import Fore
DEFAULT_URL = "https://automatetheboringstuff.com/files/rj.txt"
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--url", default=DEFAULT_URL, type=str)
parser.add_argument("--verbose", default=False)
... | [
"argparse.ArgumentParser",
"requests.get"
] | [((173, 198), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (196, 198), False, 'import argparse\n'), ((358, 380), 'requests.get', 'requests.get', (['args.url'], {}), '(args.url)\n', (370, 380), False, 'import requests\n')] |
# -*- coding: utf-8 -*-
"""Support Vector Machine (SVM) classification for machine learning.
SVM is a binary classifier. The objective of the SVM is to find the best
separating hyperplane in vector space which is also referred to as the
decision boundary. And it decides what separating hyperplane is the 'best'
because... | [
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.array",
"sklearn.svm.SVC"
] | [((778, 821), 'pandas.read_csv', 'pd.read_csv', (['"""breast-cancer-wisconsin.data"""'], {}), "('breast-cancer-wisconsin.data')\n", (789, 821), True, 'import pandas as pd\n'), ((1013, 1034), 'numpy.array', 'np.array', (["df['class']"], {}), "(df['class'])\n", (1021, 1034), True, 'import numpy as np\n'), ((1081, 1118), ... |
from app.functions.firestore import is_doc_exist
from app.models.firestore import AnnotationTypeEnum
from typing import Any, Dict, List
from pydantic import BaseModel, ValidationError, root_validator, validator
from app.models.firestore import annot_cls_dict
class RequestTaskUpload(BaseModel):
task_id: str
an... | [
"pydantic.validator",
"app.functions.firestore.is_doc_exist"
] | [((441, 461), 'pydantic.validator', 'validator', (['"""task_id"""'], {}), "('task_id')\n", (450, 461), False, 'from pydantic import BaseModel, ValidationError, root_validator, validator\n'), ((620, 640), 'pydantic.validator', 'validator', (['"""task_id"""'], {}), "('task_id')\n", (629, 640), False, 'from pydantic impor... |
import torch
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
import dataLoader as dl
"""
A function which creates train and valid dataloaders that can be iterated over.
To do so, you need to structure your data as follows:
root_dir
|_train
|_class_1
|_xxx.... | [
"torch.utils.data.DataLoader",
"torchvision.transforms.ToTensor",
"torchvision.datasets.ImageFolder",
"torchvision.transforms.Grayscale",
"torch.utils.data.random_split",
"torchvision.transforms.Resize"
] | [((974, 1019), 'torchvision.datasets.ImageFolder', 'datasets.ImageFolder', (["(root_dir + '/New_train')"], {}), "(root_dir + '/New_train')\n", (994, 1019), False, 'from torchvision import datasets, transforms\n'), ((1036, 1080), 'torchvision.datasets.ImageFolder', 'datasets.ImageFolder', (["(root_dir + '/New_test')"], ... |
from rest_framework import viewsets
from socialpy.server.rest.serializers import CategorySerializer, PostSerializer, PostSerializerUrl
from socialpy.server.data.models import Category, Post
class CategoryViewSet(viewsets.ModelViewSet):
"""
Returns a list of all categorys in the db.
"""
queryset = Categ... | [
"socialpy.server.data.models.Post.objects.all",
"socialpy.server.data.models.Category.objects.all"
] | [((315, 337), 'socialpy.server.data.models.Category.objects.all', 'Category.objects.all', ([], {}), '()\n', (335, 337), False, 'from socialpy.server.data.models import Category, Post\n'), ((490, 508), 'socialpy.server.data.models.Post.objects.all', 'Post.objects.all', ([], {}), '()\n', (506, 508), False, 'from socialpy... |
# Generated by Django 2.1.7 on 2019-04-05 22:00
import uuid
import django.contrib.auth.validators
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import athena.authentication.models
class Migration(migrations.Migration):
initial = True
dependenci... | [
"django.db.models.OneToOneField",
"django.db.models.ManyToManyField",
"django.db.models.UUIDField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.DateTimeField"
] | [((4909, 4979), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'related_name': '"""users"""', 'to': '"""authentication.Role"""'}), "(related_name='users', to='authentication.Role')\n", (4931, 4979), False, 'from django.db import migrations, models\n'), ((478, 535), 'django.db.models.CharField', 'mo... |
from src.mnist import load_mnist_data
from src.Model import Model
import matplotlib.pyplot as plt
def test_prediction(index, data, model:Model):
current_image = data["inputs"][index]
y_predict = model.predict(current_image)[0]
prediction = (y_predict == y_predict.max()).astype(int)
guess = list(predict... | [
"matplotlib.pyplot.gray",
"matplotlib.pyplot.show",
"src.mnist.load_mnist_data",
"src.Model.Model",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.xticks"
] | [((698, 708), 'matplotlib.pyplot.gray', 'plt.gray', ([], {}), '()\n', (706, 708), True, 'import matplotlib.pyplot as plt\n'), ((879, 893), 'matplotlib.pyplot.xticks', 'plt.xticks', (['[]'], {}), '([])\n', (889, 893), True, 'import matplotlib.pyplot as plt\n'), ((896, 911), 'matplotlib.pyplot.yticks', 'plt.yticks', (['[... |
from django.db import models
class SampleKeyword(models.Model):
"""An ontology term associated with a sample in our database"""
name = models.ForeignKey("OntologyTerm", on_delete=models.CASCADE, related_name="+")
sample = models.ForeignKey("Sample", on_delete=models.CASCADE, related_name="keywords")
... | [
"django.db.models.ForeignKey"
] | [((146, 223), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""OntologyTerm"""'], {'on_delete': 'models.CASCADE', 'related_name': '"""+"""'}), "('OntologyTerm', on_delete=models.CASCADE, related_name='+')\n", (163, 223), False, 'from django.db import models\n'), ((237, 315), 'django.db.models.ForeignKey', 'mod... |
import numpy as np
import nudged
from scipy.linalg import eig, sqrtm, norm
from .utils import adjust
def find_linear_projections(X, d, objective, iters=20):
n = X.shape[1]
objective.X = X
XBXT = adjust(objective.XBXT)
sqrtXBXT = np.real(sqrtm(XBXT))
projections = []
selected = []
C = np... | [
"numpy.zeros",
"scipy.linalg.eig",
"numpy.argsort",
"scipy.linalg.sqrtm",
"scipy.linalg.norm",
"numpy.real"
] | [((318, 352), 'numpy.zeros', 'np.zeros', (['(X.shape[0], X.shape[0])'], {}), '((X.shape[0], X.shape[0]))\n', (326, 352), True, 'import numpy as np\n'), ((257, 268), 'scipy.linalg.sqrtm', 'sqrtm', (['XBXT'], {}), '(XBXT)\n', (262, 268), False, 'from scipy.linalg import eig, sqrtm, norm\n'), ((594, 609), 'scipy.linalg.ei... |
# coding: utf-8
from __future__ import unicode_literals
import pytest
@pytest.mark.parametrize("text", ["(Ma'arif)"])
def test_id_tokenizer_splits_no_special(id_tokenizer, text):
tokens = id_tokenizer(text)
assert len(tokens) == 3
@pytest.mark.parametrize("text", ["Ma'arif"])
def test_id_tokenizer_splits_n... | [
"pytest.mark.parametrize"
] | [((74, 120), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""text"""', '["(Ma\'arif)"]'], {}), '(\'text\', ["(Ma\'arif)"])\n', (97, 120), False, 'import pytest\n'), ((245, 289), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""text"""', '["Ma\'arif"]'], {}), '(\'text\', ["Ma\'arif"])\n', (268, 28... |
"""Implementation of the Gated PixelCNN [1].
Gated PixelCNN extends the original PixelCNN [2] by incorporating ideas
motivated by the more effective PixelRNNs. The first extension is to use
GatedActivations (instead of ReLUs) to mimic the gated functions in RNN. The
second extension is to use a two-stream architectur... | [
"torch.optim.lr_scheduler.MultiplicativeLR",
"torch.distributions.Bernoulli",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.functional.binary_cross_entropy_with_logits",
"pytorch_generative.trainer.Trainer",
"pytorch_generative.models.GatedPixelCNN",
"pytorch_generative.nn.GatedActivation",
"torchvi... | [((9106, 9211), 'pytorch_generative.models.GatedPixelCNN', 'models.GatedPixelCNN', ([], {'in_channels': '(1)', 'out_channels': '(1)', 'n_gated': '(10)', 'gated_channels': '(128)', 'head_channels': '(32)'}), '(in_channels=1, out_channels=1, n_gated=10,\n gated_channels=128, head_channels=32)\n', (9126, 9211), False, ... |
"""
Module to work with objects, specifically dealing with ca_extension functions
"""
import logging
from ctypes import byref, cast, c_ubyte
from _ctypes import POINTER
from pycryptoki.attributes import to_byte_array
from pycryptoki.ca_extensions.session import ca_get_session_info_ex
from pycryptoki.cryptoki import C... | [
"pycryptoki.exceptions.make_error_handle_function",
"pycryptoki.common_utils.AutoCArray",
"pycryptoki.ca_extensions.session.ca_get_session_info_ex",
"pycryptoki.cryptoki.CK_SLOT_ID",
"ctypes.byref",
"_ctypes.POINTER",
"pycryptoki.cryptoki.CK_ULONG",
"logging.getLogger"
] | [((541, 568), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (558, 568), False, 'import logging\n'), ((1518, 1566), 'pycryptoki.exceptions.make_error_handle_function', 'make_error_handle_function', (['ca_get_object_handle'], {}), '(ca_get_object_handle)\n', (1544, 1566), False, 'from pycr... |
"""
Export pickled dictionary
"""
import pickle
from source.database.database_entry import Entry
def export():
dictionary = set()
with open('final_dictionary.txt', 'r') as source, open('dictionary', 'wb') as destination:
for line in source:
word, frequency = line.split()
frequ... | [
"pickle.dump",
"source.database.database_entry.Entry"
] | [((408, 444), 'pickle.dump', 'pickle.dump', (['dictionary', 'destination'], {}), '(dictionary, destination)\n', (419, 444), False, 'import pickle\n'), ((374, 396), 'source.database.database_entry.Entry', 'Entry', (['word', 'frequency'], {}), '(word, frequency)\n', (379, 396), False, 'from source.database.database_entry... |
#!/usr/bin/env python2
import common_pl
if __name__ == '__main__':
common_pl.main()
| [
"common_pl.main"
] | [((74, 90), 'common_pl.main', 'common_pl.main', ([], {}), '()\n', (88, 90), False, 'import common_pl\n')] |
#!usr/bin/python
# -*- coding:utf8 -*-
"""
@pytest.fixture注册成为一个fixture函数,来为测试用例
提供一个fixture对象
"""
import pytest
import make_warning
class TestWarns():
def test_make_warn(self):
with pytest.warns(DeprecationWarning):
make_warning.make_warn()
def test_not_warn(self):
with pytest.wa... | [
"pytest.warns",
"make_warning.not_warn",
"make_warning.make_warn"
] | [((197, 229), 'pytest.warns', 'pytest.warns', (['DeprecationWarning'], {}), '(DeprecationWarning)\n', (209, 229), False, 'import pytest\n'), ((243, 267), 'make_warning.make_warn', 'make_warning.make_warn', ([], {}), '()\n', (265, 267), False, 'import make_warning\n'), ((311, 338), 'pytest.warns', 'pytest.warns', (['Syn... |