code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from httmock import urlmatch
free_proxy_expected = ['192.168.127.12:3128', '172.16.58.3:8080']
proxy_for_eu_expected = ['172.16.17.32:80', '172.16.58.3:8115']
rebro_weebly_expected = ['192.168.127.12:8080', '172.16.17.32:8080']
samair_expected = ['172.16.17.32:80', '192.168.3.11:8080', '172.16.17.32:8080']
@urlmatch... | [
"httmock.urlmatch"
] | [((312, 361), 'httmock.urlmatch', 'urlmatch', ([], {'netloc': '"""(.*\\\\.)?free-proxy-list\\\\.net$"""'}), "(netloc='(.*\\\\.)?free-proxy-list\\\\.net$')\n", (320, 361), False, 'from httmock import urlmatch\n'), ((1405, 1445), 'httmock.urlmatch', 'urlmatch', ([], {'netloc': '"""(.*\\\\.)?proxyfor\\\\.eu"""'}), "(netlo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/2/10 21:53
# @Author : DaiPuWei
# E-Mail : <EMAIL>
# blog : https://blog.csdn.net/qq_30091945
# @Site : ไธญๅฝๆฐ่ชๅคงๅญฆๅๆ25-506ๅฎ้ชๅฎค
# @File : GMM.py
# @Software: PyCharm
"""
่ฟๆฏ้ซๆฏๆททๅๆจกๅ็Python็ฑปไปฃ็ ๏ผ่ฟไปฝไปฃ็ ไฝฟ็จEM็ฎๆณ่ฟ่ก
ๆฑ่งฃๆจกๅๅๆฐ,ๅฏนไบ้ซๆฏๅๅธ็ๅๅผๅ้ๅฉ็จK-Means่็ฑป็ฎๆณ
็ๆ... | [
"numpy.abs",
"numpy.eye",
"numpy.power",
"numpy.argmax",
"numpy.linalg.det",
"numpy.array",
"numpy.sum",
"numpy.linalg.inv",
"numpy.cov",
"numpy.zeros",
"numpy.dot",
"numpy.shape",
"KMeansCluster.KMeansCluster.KMeansCluster"
] | [((880, 899), 'numpy.shape', 'np.shape', (['self.Data'], {}), '(self.Data)\n', (888, 899), True, 'import numpy as np\n'), ((1992, 2011), 'KMeansCluster.KMeansCluster.KMeansCluster', 'KMeansCluster', (['data'], {}), '(data)\n', (2005, 2011), False, 'from KMeansCluster.KMeansCluster import KMeansCluster\n'), ((1298, 1331... |
#Forms
from django.forms import ModelForm, Textarea
from .forms import NewsForm
# Models
from .models import News
from django.db import models
# Routing
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
from django.urls import reverse_lazy
from AprendeAyudando.views import h... | [
"AprendeAyudando.views.has_group",
"django.urls.reverse_lazy"
] | [((1053, 1083), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""news:news-list"""'], {}), "('news:news-list')\n", (1065, 1083), False, 'from django.urls import reverse_lazy\n'), ((1711, 1741), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""news:news-list"""'], {}), "('news:news-list')\n", (1723, 1741), False, 'fro... |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Here we create all the models required for SSL. The default model is
BaseSSLMultiInputOutputModel, however users can create their own model... | [
"classy_vision.generic.registry_utils.import_all_modules",
"pathlib.Path"
] | [((2183, 2228), 'classy_vision.generic.registry_utils.import_all_modules', 'import_all_modules', (['FILE_ROOT', '"""vissl.models"""'], {}), "(FILE_ROOT, 'vissl.models')\n", (2201, 2228), False, 'from classy_vision.generic.registry_utils import import_all_modules\n'), ((2161, 2175), 'pathlib.Path', 'Path', (['__file__']... |
"""
Auxiliarry functions for the pointwise gravity spherical harmonics expansion.
"""
import warnings
import numpy as np
from joblib import Parallel, delayed
from .legendre import lplm, lplm_d1
np.seterr(over='raise')
def expand_parallel(x, q, *args):
nlat = x.shape[0]
# parallel only if there are more than... | [
"numpy.atleast_2d",
"numpy.tile",
"numpy.allclose",
"numpy.all",
"numpy.power",
"numpy.asarray",
"numpy.any",
"joblib.Parallel",
"numpy.sum",
"numpy.cos",
"numpy.sin",
"joblib.delayed",
"warnings.warn",
"numpy.seterr",
"warnings.filterwarnings",
"numpy.arange"
] | [((196, 219), 'numpy.seterr', 'np.seterr', ([], {'over': '"""raise"""'}), "(over='raise')\n", (205, 219), True, 'import numpy as np\n'), ((1082, 1100), 'numpy.atleast_2d', 'np.atleast_2d', (['lat'], {}), '(lat)\n', (1095, 1100), True, 'import numpy as np\n'), ((1111, 1129), 'numpy.atleast_2d', 'np.atleast_2d', (['lon']... |
"""Script to perform a simple at-home yes/no experiment and analyze the resulting data
using signal detection theory.
"""
import numpy as np
from scipy.stats import norm
import prettytable as pt
import sounddevice as sd
def trial(signal, n=None):
"""Performs a trial in the experiment.
Args:
signal (... | [
"prettytable.PrettyTable",
"numpy.sqrt",
"scipy.stats.norm.ppf",
"numpy.sin",
"numpy.arange",
"numpy.random.shuffle"
] | [((790, 818), 'numpy.arange', 'np.arange', (['(0)', '(0.1)', '(1 / 44100)'], {}), '(0, 0.1, 1 / 44100)\n', (799, 818), True, 'import numpy as np\n'), ((1594, 1614), 'numpy.random.shuffle', 'np.random.shuffle', (['X'], {}), '(X)\n', (1611, 1614), True, 'import numpy as np\n'), ((3582, 3598), 'prettytable.PrettyTable', '... |
# Generated by Django 2.0.3 on 2018-07-11 16:46
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('prod... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.PositiveIntegerField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency"
] | [((247, 304), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (278, 304), False, 'from django.db import migrations, models\n'), ((490, 583), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
import PIL.Image
from converter.grayscale_converter import GrayscaleConverter
from converter.image_resizer import ImageResizer
from confirmation_messages.success_messages import SuccessMessages
from confirmation_messages.error_messages import ErrorMessages
class ASCIIConverter(GrayscaleConverter, ImageResizer):
"... | [
"confirmation_messages.success_messages.SuccessMessages",
"confirmation_messages.error_messages.ErrorMessages"
] | [((704, 721), 'confirmation_messages.success_messages.SuccessMessages', 'SuccessMessages', ([], {}), '()\n', (719, 721), False, 'from confirmation_messages.success_messages import SuccessMessages\n'), ((752, 767), 'confirmation_messages.error_messages.ErrorMessages', 'ErrorMessages', ([], {}), '()\n', (765, 767), False... |
import sys
if __name__ == "__main__":
arguments = sys.argv
if len(arguments) != 6:
print("Invalid number of arguments used!")
print("Usage: streaming_clip_obj.py <input OBJ file> <minX> <minY> <maxX> <maxY> > <output OBJ file>")
sys.exit()
input_file = sys.argv[1]
clip_box = [
... | [
"sys.stdout.write",
"sys.exit"
] | [((262, 272), 'sys.exit', 'sys.exit', ([], {}), '()\n', (270, 272), False, 'import sys\n'), ((1040, 1062), 'sys.stdout.write', 'sys.stdout.write', (['line'], {}), '(line)\n', (1056, 1062), False, 'import sys\n')] |
import pytest
import pandas as pd
from faker import Factory
import random
import testing.postgresql
from ratschlab_common.db.utils import PostgresDBParams
df_row_nr = 100
@pytest.fixture(scope='session')
def a_df():
fake = Factory.create()
fake.seed_instance(420)
records = []
for _ in range(df_row_n... | [
"pandas.DataFrame.from_records",
"ratschlab_common.db.utils.PostgresDBParams",
"pytest.fixture",
"faker.Factory.create",
"random.random",
"random.randint"
] | [((175, 206), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (189, 206), False, 'import pytest\n'), ((745, 775), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (759, 775), False, 'import pytest\n'), ((230, 246), 'faker.Factory.cre... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-09 10:06
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('threads', '0001_initial'),
]
operations = [
migrations.RenameField(
mod... | [
"django.db.migrations.RenameField"
] | [((281, 369), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""thread"""', 'old_name': '"""Subject"""', 'new_name': '"""subject"""'}), "(model_name='thread', old_name='Subject', new_name=\n 'subject')\n", (303, 369), False, 'from django.db import migrations\n')] |
#!/usr/bin/env python
#
# Copyright 2019 DFKI GmbH.
#
# 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, merg... | [
"collections.OrderedDict",
"numpy.average",
"anim_utils.utilities.log.write_message_to_log",
"numpy.array",
"anim_utils.animation_data.MotionVector",
"json.dump",
"anim_utils.animation_data.motion_concatenation.align_and_concatenate_frames"
] | [((4124, 4188), 'anim_utils.animation_data.MotionVector', 'MotionVector', (['self.motion_state_graph.skeleton', 'algorithm_config'], {}), '(self.motion_state_graph.skeleton, algorithm_config)\n', (4136, 4188), False, 'from anim_utils.animation_data import MotionVector, align_quaternion_frames\n'), ((9588, 9653), 'anim_... |
# Standard imports
import cv2
import argparse
import numpy as np
ap = argparse.ArgumentParser()
ap.add_argument('-i', '--image', required=False, help='Path to the image')
args = vars(ap.parse_args())
# Read image
image = cv2.imread(args['image'])
# image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
dim = (320, 240)
... | [
"cv2.rectangle",
"argparse.ArgumentParser",
"numpy.hstack",
"cv2.inRange",
"cv2.bitwise_and",
"numpy.array",
"cv2.waitKey",
"cv2.resize",
"cv2.GaussianBlur",
"cv2.imread",
"cv2.boundingRect"
] | [((72, 97), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (95, 97), False, 'import argparse\n'), ((225, 250), 'cv2.imread', 'cv2.imread', (["args['image']"], {}), "(args['image'])\n", (235, 250), False, 'import cv2\n'), ((328, 380), 'cv2.resize', 'cv2.resize', (['image', 'dim'], {'interpolatio... |
import math
import os
import pygame
from pygamerogue.game_object import GameObject
class Bullet(GameObject):
def __init__(self, position, angle):
path = os.path.join('resources', 'bullet.png')
image = pygame.image.load(path).convert()
rect = image.get_rect().move(position)
super().... | [
"pygame.Surface",
"os.path.join",
"math.degrees",
"math.cos",
"pygame.image.load",
"math.sin",
"pygame.Rect"
] | [((167, 206), 'os.path.join', 'os.path.join', (['"""resources"""', '"""bullet.png"""'], {}), "('resources', 'bullet.png')\n", (179, 206), False, 'import os\n'), ((497, 517), 'math.cos', 'math.cos', (['self.angle'], {}), '(self.angle)\n', (505, 517), False, 'import math\n'), ((560, 580), 'math.sin', 'math.sin', (['self.... |
import requests
from bs4 import BeautifulSoup
def show_quote(self):
res = requests.get('https://www.brainyquote.com/quotes_of_the_day.html')
soup = BeautifulSoup(res.text, 'lxml')
quote = soup.find('img', {'class': 'p-qotd'})
print(quote['alt'])
| [
"bs4.BeautifulSoup",
"requests.get"
] | [((80, 146), 'requests.get', 'requests.get', (['"""https://www.brainyquote.com/quotes_of_the_day.html"""'], {}), "('https://www.brainyquote.com/quotes_of_the_day.html')\n", (92, 146), False, 'import requests\n'), ((158, 189), 'bs4.BeautifulSoup', 'BeautifulSoup', (['res.text', '"""lxml"""'], {}), "(res.text, 'lxml')\n"... |
import argparse
from keras.models import load_model
import make_dataset
import numpy as np
import matplotlib.pyplot as plt
# load the model
import tkinter as tk
from tkinter import filedialog
def main():
parser = argparse.ArgumentParser()
parser.add_argument("base", help="base directory where dataset data i... | [
"keras.models.load_model",
"argparse.ArgumentParser",
"numpy.argmax",
"make_dataset.load_data",
"numpy.zeros",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show"
] | [((221, 246), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (244, 246), False, 'import argparse\n'), ((454, 487), 'make_dataset.load_data', 'make_dataset.load_data', (['args.base'], {}), '(args.base)\n', (476, 487), False, 'import make_dataset\n'), ((665, 699), 'keras.models.load_model', 'load... |
from pyspark import SparkContext
from pyspark.sql import SparkSession
from asammdf import MDF
import io
import sys
spark = SparkSession\
.builder\
.appName("mdf4")\
.getOrCreate()
sc = spark.sparkContext
def decodeBinary(val):
file_stream = io.BytesIO(val)
mdf = MDF(file_stream)
l... | [
"asammdf.MDF",
"io.BytesIO",
"pyspark.sql.SparkSession.builder.appName"
] | [((272, 287), 'io.BytesIO', 'io.BytesIO', (['val'], {}), '(val)\n', (282, 287), False, 'import io\n'), ((298, 314), 'asammdf.MDF', 'MDF', (['file_stream'], {}), '(file_stream)\n', (301, 314), False, 'from asammdf import MDF\n'), ((124, 160), 'pyspark.sql.SparkSession.builder.appName', 'SparkSession.builder.appName', ([... |
import json
import lxml.objectify
import zeit.cms.workingcopy.interfaces
import zeit.edit.testing
import zeit.edit.tests.fixture
import zope.component
import zope.publisher.browser
class LandingZone(zeit.edit.testing.FunctionalTestCase):
def setUp(self):
super(LandingZone, self).setUp()
wc = zeit... | [
"json.dumps"
] | [((2001, 2045), 'json.dumps', 'json.dumps', (["{'example_amount': 'nonnumeric'}"], {}), "({'example_amount': 'nonnumeric'})\n", (2011, 2045), False, 'import json\n'), ((2450, 2478), 'json.dumps', 'json.dumps', (["{'__name__': ''}"], {}), "({'__name__': ''})\n", (2460, 2478), False, 'import json\n'), ((2778, 2794), 'jso... |
import hydra
from omegaconf import DictConfig
from pathlib import Path
import pytorch_lightning as pl
import logging
import sys
sys.path.append('src')
from datasets.celeba.classification_dataloader import Classification_Dataloader
from nets.cnn_net import Classification_Net
logger = logging.getLogger(__name__)
@hydr... | [
"logging.getLogger",
"hydra.main",
"pathlib.Path",
"nets.cnn_net.Classification_Net.load_from_checkpoint",
"datasets.celeba.classification_dataloader.Classification_Dataloader",
"pytorch_lightning.Trainer",
"sys.path.append"
] | [((128, 150), 'sys.path.append', 'sys.path.append', (['"""src"""'], {}), "('src')\n", (143, 150), False, 'import sys\n'), ((286, 313), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (303, 313), False, 'import logging\n'), ((316, 378), 'hydra.main', 'hydra.main', ([], {'config_path': '""".... |
import os
import numpy as np
from PIL import Image
data_path = './data/LINEMOD/renders/'
target = 'nihonbashi'
save_pose_dir = '/home/doors/workspace/darwin/dataset/LINEMOD/nihonbashi/pose'
save_mask_dir = '/home/doors/workspace/darwin/dataset/LINEMOD/nihonbashi/mask'
def read_linemod_mask(path):
return (np.asa... | [
"PIL.Image.fromarray",
"os.listdir",
"os.path.join",
"PIL.Image.open"
] | [((388, 434), 'os.listdir', 'os.listdir', (['f"""./data/LINEMOD/renders/{target}"""'], {}), "(f'./data/LINEMOD/renders/{target}')\n", (398, 434), False, 'import os\n'), ((487, 523), 'os.path.join', 'os.path.join', (['data_path', 'target', 'asd'], {}), '(data_path, target, asd)\n', (499, 523), False, 'import os\n'), ((5... |
# Defines the Experiment as a class
# @ <NAME> - <NAME> June 2021
# import libraries
import os
import pandas as pd
import numpy as np
import math
import glob
import sys
from psychopy import visual, core, event, gui # data, logging
import experiment_code.constants as consts
from experiment_code.task_blocks import TA... | [
"psychopy.core.quit",
"pandas.read_csv",
"psychopy.gui.Dlg",
"sys.exit",
"pandas.DataFrame",
"experiment_code.screen.Screen",
"psychopy.event.waitKeys",
"psychopy.core.Clock",
"os.path.isfile",
"psychopy.visual.TextStim",
"experiment_code.ttl.ttl.reset",
"experiment_code.constants.dircheck",
... | [((4014, 4075), 'pandas.read_csv', 'pd.read_csv', (['(consts.run_dir / self.study_name / self.run_name)'], {}), '(consts.run_dir / self.study_name / self.run_name)\n', (4025, 4075), True, 'import pandas as pd\n'), ((6971, 7073), 'pandas.read_csv', 'pd.read_csv', (["(consts.target_dir / self.study_name / task_name / tas... |
import asyncio
from aiohttp import web
async def handle(request):
await asyncio.sleep(0.01)
return web.Response(text="OK")
app = web.Application()
app.add_routes([web.get('/', handle)])
web.run_app(app, port=2000)
| [
"aiohttp.web.run_app",
"aiohttp.web.Response",
"aiohttp.web.Application",
"asyncio.sleep",
"aiohttp.web.get"
] | [((141, 158), 'aiohttp.web.Application', 'web.Application', ([], {}), '()\n', (156, 158), False, 'from aiohttp import web\n'), ((199, 226), 'aiohttp.web.run_app', 'web.run_app', (['app'], {'port': '(2000)'}), '(app, port=2000)\n', (210, 226), False, 'from aiohttp import web\n'), ((110, 133), 'aiohttp.web.Response', 'we... |
"""
Thanks to <NAME>
"""
from __future__ import division, print_function
import sys
import math
import numba
from numba import jit, autojit, size_t
import numpy as np
import numpy.testing as npt
try:
from skimage import img_as_float
except ImportError as e:
print("skimage not available, skipping")
sys.exi... | [
"numba.autojit",
"sys.exit",
"math.sqrt",
"skimage.img_as_float",
"numpy.asarray",
"numpy.zeros",
"numba.jit",
"numpy.empty_like",
"numpy.linalg.norm",
"numpy.testing.assert_array_equal"
] | [((1164, 1178), 'math.sqrt', 'math.sqrt', (['(3.0)'], {}), '(3.0)\n', (1173, 1178), False, 'import math\n'), ((880, 892), 'math.sqrt', 'math.sqrt', (['s'], {}), '(s)\n', (889, 892), False, 'import math\n'), ((1061, 1073), 'math.sqrt', 'math.sqrt', (['s'], {}), '(s)\n', (1070, 1073), False, 'import math\n'), ((1120, 115... |
import streamlit as st
from streamlit_webrtc import webrtc_streamer
webrtc_streamer(key="Example") | [
"streamlit_webrtc.webrtc_streamer"
] | [((69, 99), 'streamlit_webrtc.webrtc_streamer', 'webrtc_streamer', ([], {'key': '"""Example"""'}), "(key='Example')\n", (84, 99), False, 'from streamlit_webrtc import webrtc_streamer\n')] |
#!/usr/bin/python
# -*-coding: utf-8 -*-
from itertools import chain
import re
from pycsvschema import exceptions
from pycsvschema import defaults, _utilities
# Validators for root options
# Each validator should be a generator, accepting three parameters:
# :param header: csv header
# :param cell: cell data in dict ... | [
"pycsvschema._utilities.find_row_validators",
"pycsvschema.exceptions.ValidationError",
"re.match"
] | [((1550, 1637), 'pycsvschema._utilities.find_row_validators', '_utilities.find_row_validators', ([], {'column_info': 'column_info', 'field_schema': 'field_schema'}), '(column_info=column_info, field_schema=\n field_schema)\n', (1580, 1637), False, 'from pycsvschema import defaults, _utilities\n'), ((3215, 3302), 'py... |
from simple_settings import settings
from simple_settings.utils import settings_stub
# Stub examples
with settings_stub(SOME_SETTING='foo'):
assert settings.SOME_SETTING == 'foo'
assert settings.SOME_SETTING == 'bar'
@settings_stub(SOME_SETTING='foo')
def get_some_setting():
return settings.SOME_SETTING
ass... | [
"simple_settings.utils.settings_stub"
] | [((225, 258), 'simple_settings.utils.settings_stub', 'settings_stub', ([], {'SOME_SETTING': '"""foo"""'}), "(SOME_SETTING='foo')\n", (238, 258), False, 'from simple_settings.utils import settings_stub\n'), ((107, 140), 'simple_settings.utils.settings_stub', 'settings_stub', ([], {'SOME_SETTING': '"""foo"""'}), "(SOME_S... |
import datetime
import os
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.core.files.storage import FileSystemStorage
from django.conf import settings
from osc_bge.agent import models as ... | [
"django.db.models.OneToOneField",
"django.db.models.ForeignKey",
"os.path.splitext",
"datetime.datetime.now",
"django.db.models.ImageField",
"django.urls.reverse",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((1003, 1026), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1024, 1026), False, 'import datetime\n'), ((1738, 1781), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'null': '(True)'}), '(max_length=255, null=True)\n', (1754, 1781), False, 'from django.db import mo... |
"""
GT Utilities
@<NAME> - <EMAIL> - 2020-09-13
Functions were named with a "gtu" (GT Utilities) prefix to avoid conflicts.
1.1 - 2020-10-17
Added move pivot to bottom/top
Added copy/paste material
Added move to origin
1.2 - 2020-10-21
Updated reset transform to better handle translate
Added... | [
"maya.cmds.hyperShade",
"maya.cmds.columnLayout",
"maya.cmds.rowColumnLayout",
"maya.cmds.move",
"maya.cmds.setAttr",
"maya.cmds.separator",
"maya.cmds.makeIdentity",
"maya.cmds.namespaceInfo",
"maya.cmds.rename",
"maya.cmds.xform",
"maya.cmds.connectAttr",
"maya.cmds.showWindow",
"maya.cmds... | [((2928, 2962), 'maya.cmds.file', 'cmds.file', ([], {'query': '(True)', 'exists': '(True)'}), '(query=True, exists=True)\n', (2937, 2962), True, 'import maya.cmds as cmds\n'), ((3677, 3731), 'maya.cmds.undoInfo', 'cmds.undoInfo', ([], {'openChunk': '(True)', 'chunkName': 'function_name'}), '(openChunk=True, chunkName=f... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Initialization module for tpDcc-libs-options
"""
from __future__ import print_function, division, absolute_import
import os
import logging.config
from tpDcc.core import library
LIB_ID = 'tpDcc-libs-options'
LIB_ENV = LIB_ID.replace('-', '_').upper()
LOGGER = logg... | [
"os.path.expanduser",
"os.getenv",
"os.makedirs",
"os.path.dirname",
"os.path.isdir",
"tpDcc.core.library.DccLibrary.config_dict"
] | [((1519, 1546), 'os.getenv', 'os.getenv', (['"""TPDCC_DEV"""', 'dev'], {}), "('TPDCC_DEV', dev)\n", (1528, 1546), False, 'import os\n'), ((590, 641), 'tpDcc.core.library.DccLibrary.config_dict', 'library.DccLibrary.config_dict', ([], {'file_name': 'file_name'}), '(file_name=file_name)\n', (620, 641), False, 'from tpDcc... |
import json
import os
import requests
import sqlite3
from time import sleep
import credentials
def generate_request_payload(page):
with open(os.path.join(PROJECT_PATH, 'request_payload.json')) as json_file:
data = json.load(json_file)
if page != 1:
data['pagina'] = page
return json.dum... | [
"json.dumps",
"os.path.join",
"requests.get",
"time.sleep",
"json.load",
"os.path.abspath"
] | [((312, 328), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (322, 328), False, 'import json\n'), ((729, 762), 'requests.get', 'requests.get', (['url'], {'params': 'payload'}), '(url, params=payload)\n', (741, 762), False, 'import requests\n'), ((1374, 1399), 'os.path.abspath', 'os.path.abspath', (['__file__']... |
from bs4 import BeautifulSoup
from flask_misaka import markdown
def html2text(html: str) -> str:
""" Extract plain text from
markdown generated html description."""
b = BeautifulSoup(html, 'lxml')
b.a.decompose() if b.a else ''
b.img.decompose() if b.img else ''
b.table.decompose() if b.table ... | [
"bs4.BeautifulSoup",
"flask_misaka.markdown"
] | [((183, 210), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""lxml"""'], {}), "(html, 'lxml')\n", (196, 210), False, 'from bs4 import BeautifulSoup\n'), ((770, 798), 'flask_misaka.markdown', 'markdown', (['text'], {'options': 'opts'}), '(text, options=opts)\n', (778, 798), False, 'from flask_misaka import markdown\... |
import json
from tabulate import tabulate
from koro.dataset import CsvLoader, JsonLoader
from koro.manipulation import dataset_path
def end_trip():
reader = CsvLoader(delimiter=",")
format_of_file = "od/mangled/BY_TAPIN_transport_node_train_2020{}.csv"
final = {}
list_for_tabulate = []
for mont... | [
"koro.manipulation.dataset_path",
"tabulate.tabulate",
"json.dump",
"koro.dataset.CsvLoader"
] | [((165, 189), 'koro.dataset.CsvLoader', 'CsvLoader', ([], {'delimiter': '""","""'}), "(delimiter=',')\n", (174, 189), False, 'from koro.dataset import CsvLoader, JsonLoader\n'), ((1830, 1896), 'tabulate.tabulate', 'tabulate', (['list_for_tabulate'], {'headers': '"""firstrow"""', 'tablefmt': '"""pretty"""'}), "(list_for... |
import pytest
from regolith.dates import (month_to_str_int, day_to_str_int)
@pytest.mark.parametrize(
"input,expected",
[
(1, "01"),
(10, "10"),
("Oct", "10"),
("Jan", "01"),
],
)
def test_month_to_str(input, expected):
assert month_to_str_int(input) == expected
@pytes... | [
"regolith.dates.month_to_str_int",
"pytest.mark.parametrize",
"regolith.dates.day_to_str_int"
] | [((79, 179), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""input,expected"""', "[(1, '01'), (10, '10'), ('Oct', '10'), ('Jan', '01')]"], {}), "('input,expected', [(1, '01'), (10, '10'), ('Oct',\n '10'), ('Jan', '01')])\n", (102, 179), False, 'import pytest\n'), ((315, 381), 'pytest.mark.parametrize', '... |
#!/usr/bin/env python3
from alsa_midi import SequencerClient
def main():
client = SequencerClient("list_clients.py")
client_info = client.query_next_client()
while client_info:
print(f"Client {client_info.client_id}: {client_info.name!r}")
assert client_info.type is not None
prin... | [
"alsa_midi.SequencerClient"
] | [((89, 123), 'alsa_midi.SequencerClient', 'SequencerClient', (['"""list_clients.py"""'], {}), "('list_clients.py')\n", (104, 123), False, 'from alsa_midi import SequencerClient\n')] |
from deepspeed.amp import query_amp_topo
orca_cluster = "../orca_resource_1.yml"
gpt2_model_config = {"name": "gpt2", "sequence_length": 1024, "hidden_size": 768, "num_layers": 12, "vocab_size": 50512}
ret = query_amp_topo(orca_cluster, gpt2_model_config, 50)
| [
"deepspeed.amp.query_amp_topo"
] | [((210, 261), 'deepspeed.amp.query_amp_topo', 'query_amp_topo', (['orca_cluster', 'gpt2_model_config', '(50)'], {}), '(orca_cluster, gpt2_model_config, 50)\n', (224, 261), False, 'from deepspeed.amp import query_amp_topo\n')] |
#c0conut 2020.12.21
#Generate random bit stream to implement batch png lsbhiding
#Embedding rate 80%
#Coverimage : 512*512 png
import numpy as np
import base64, json, random, os
from bitstring import BitArray
from cv2 import cv2 as cv
def genEmbedBinStream():
#generate random bit stream
s = random.randint(0, ... | [
"random.sample",
"cv2.cv2.imread",
"os.walk",
"os.path.join",
"random.randint",
"json.dump"
] | [((302, 335), 'random.randint', 'random.randint', (['(0)', '(2 ** 20000 - 1)'], {}), '(0, 2 ** 20000 - 1)\n', (316, 335), False, 'import base64, json, random, os\n'), ((2514, 2558), 'cv2.cv2.imread', 'cv.imread', (['imgCoverPath', 'cv.IMREAD_GRAYSCALE'], {}), '(imgCoverPath, cv.IMREAD_GRAYSCALE)\n', (2523, 2558), True,... |
# Generated by Django 3.0.6 on 2020-09-27 00:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('MMcalendar', '0009_auto_20200921_2228'),
]
operations = [
migrations.AlterField(
model_name='calendar',
name='name',... | [
"django.db.models.Q",
"django.db.models.CharField"
] | [((339, 371), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)'}), '(max_length=128)\n', (355, 371), False, 'from django.db import migrations, models\n'), ((507, 535), 'django.db.models.Q', 'models.Q', ([], {'status': '"""CONFIRMED"""'}), "(status='CONFIRMED')\n", (515, 535), False, 'from dj... |
from testing_config import BaseTestConfig
from application.models import *
import json
from application.utils import *
class TestEvent(BaseTestConfig):
test_event = {
"room_id": 1,
"event_name": "test_event",
"location": "test_location",
"start_time": "2021-03-27 07:32:00",
... | [
"json.dumps"
] | [((518, 545), 'json.dumps', 'json.dumps', (['self.test_event'], {}), '(self.test_event)\n', (528, 545), False, 'import json\n'), ((889, 916), 'json.dumps', 'json.dumps', (['self.test_event'], {}), '(self.test_event)\n', (899, 916), False, 'import json\n'), ((1139, 1166), 'json.dumps', 'json.dumps', (['self.test_event']... |
import PIL
import numpy as np
from covid.metrics import VQMTMetrics
from covid.video_reader import PlaybackPosition, FfmsReader, NonBlockingPairReader
def test_playback():
pos = PlaybackPosition(10, 100)
assert pos.get_playback_frame_position() == 9
pos.shift_playback_frame_position(-100)
assert pos... | [
"covid.video_reader.FfmsReader",
"numpy.array",
"covid.video_reader.PlaybackPosition",
"covid.video_reader.NonBlockingPairReader"
] | [((185, 210), 'covid.video_reader.PlaybackPosition', 'PlaybackPosition', (['(10)', '(100)'], {}), '(10, 100)\n', (201, 210), False, 'from covid.video_reader import PlaybackPosition, FfmsReader, NonBlockingPairReader\n'), ((579, 624), 'covid.video_reader.FfmsReader', 'FfmsReader', (['"""samples/foreman_crf30_short.mp4""... |
from typing import Any, Optional
import numpy as np
from joblib import Parallel, delayed
from budgetcb.base import MAB
from budgetcb.helper import _get_ALP_predict, _LinUCBnTSSingle, _sherman_morrison_update
class LinUCB(MAB):
"""
Constrained LinUCB
References:
Li, Lihong, et al. "A contextual-b... | [
"numpy.eye",
"numpy.ones",
"numpy.log",
"numpy.argmax",
"numpy.max",
"joblib.Parallel",
"numpy.array",
"numpy.zeros",
"numpy.dot",
"joblib.delayed",
"numpy.random.uniform",
"budgetcb.helper._sherman_morrison_update",
"budgetcb.helper._LinUCBnTSSingle"
] | [((3153, 3201), 'budgetcb.helper._sherman_morrison_update', '_sherman_morrison_update', (['self.AaI[arm]', 'context'], {}), '(self.AaI[arm], context)\n', (3177, 3201), False, 'from budgetcb.helper import _get_ALP_predict, _LinUCBnTSSingle, _sherman_morrison_update\n'), ((4270, 4300), 'numpy.zeros', 'np.zeros', (['(self... |
####################################
# Developed by xeroxxhah
# A simple Web Enumeration Script
# Report any Bug at <EMAIL>
####################################
import requests
import sys
import urllib.request
import ssl
from certifier import CertInfo
import dns.resolver
import whois
from rich import print,pretty
from... | [
"time.sleep",
"requests.get",
"ssl.get_server_certificate",
"rich.pretty.install",
"rich.print",
"certifier.CertInfo",
"whois.whois"
] | [((373, 389), 'rich.pretty.install', 'pretty.install', ([], {}), '()\n', (387, 389), False, 'from rich import print, pretty\n'), ((3481, 3526), 'rich.print', 'print', (['f"""[green]Host:{formated_host}[/green]"""'], {}), "(f'[green]Host:{formated_host}[/green]')\n", (3486, 3526), False, 'from rich import print, pretty\... |
# List of default files for mapping
import os
from os import path
import pathlib
# Default support files packaged with metgem
# For genus assignment
_project_dir = path.dirname(path.abspath(__file__))
# # Initialize reaction mapfiles for converting AGORA reaction into other type
map_dir = path.join(_project_dir, "d... | [
"os.path.abspath",
"os.path.splitext",
"os.path.join",
"pathlib.Path"
] | [((294, 347), 'os.path.join', 'path.join', (['_project_dir', '"""default_files"""', '"""map_files"""'], {}), "(_project_dir, 'default_files', 'map_files')\n", (303, 347), False, 'from os import path\n'), ((492, 542), 'os.path.join', 'path.join', (['_project_dir', '"""default_files"""', '"""models"""'], {}), "(_project_... |
from chaindnsd import TTL_1W, Qtype
from chaindnsd.chaindns import exceptions
class Zone:
def __init__(self, *subdomains, ttl=TTL_1W):
self._subdomains = set(subdomains) or set()
self._ttl = ttl
self._resolvers = {v: {} for v in Qtype}
self._exceptions_handlers = {}
def add_ex... | [
"chaindnsd.chaindns.exceptions.MissingZoneException",
"chaindnsd.chaindns.exceptions.MissingQueryTypeException"
] | [((1017, 1055), 'chaindnsd.chaindns.exceptions.MissingQueryTypeException', 'exceptions.MissingQueryTypeException', ([], {}), '()\n', (1053, 1055), False, 'from chaindnsd.chaindns import exceptions\n'), ((1147, 1180), 'chaindnsd.chaindns.exceptions.MissingZoneException', 'exceptions.MissingZoneException', ([], {}), '()\... |
import json
import pickle
import ast
import math
import operator
def get_lang_prior(pomdp_to_map_fp, lang_dict_fp):
"""
Convert the lang prior dictionary to a format usable by pomdp
"""
pomdp_to_map = {}
with open(pomdp_to_map_fp, 'r') as fin:
pomdp_to_map = json.load(fin)
lang_dict =... | [
"json.load",
"ast.literal_eval",
"pickle.load"
] | [((289, 303), 'json.load', 'json.load', (['fin'], {}), '(fin)\n', (298, 303), False, 'import json\n'), ((386, 402), 'pickle.load', 'pickle.load', (['fin'], {}), '(fin)\n', (397, 402), False, 'import pickle\n'), ((1733, 1747), 'json.load', 'json.load', (['fin'], {}), '(fin)\n', (1742, 1747), False, 'import json\n'), ((1... |
# Copyright 2017 Internap.
#
# 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, so... | [
"tests.cisco.configuring_interface_vlan",
"tests.cisco.create_interface_vlan",
"tests.cisco.enable",
"tests.cisco.assert_interface_configuration",
"tests.cisco.configuring"
] | [((959, 968), 'tests.cisco.enable', 'enable', (['t'], {}), '(t)\n', (965, 968), False, 'from tests.cisco import enable, create_interface_vlan, configuring, configuring_interface_vlan, assert_interface_configuration\n'), ((978, 1010), 'tests.cisco.create_interface_vlan', 'create_interface_vlan', (['t', '"""2999"""'], {}... |
import numpy as np
import sys, os, os.path, time, gc
from astropy.table import Table, vstack, join
import matplotlib.pyplot as plt
from astropy import units as u
from scipy.optimize import curve_fit, minimize
from astropy.time import Time
import astropy.coordinates as coords
from astropy.stats import sigma_clip
from ma... | [
"numpy.sqrt",
"astropy.table.Table",
"matplotlib.pyplot.ylabel",
"numpy.hstack",
"Register_Frames.GetRegistrators",
"numpy.log",
"emcee.EnsembleSampler",
"matplotlib.pyplot.fill_between",
"numpy.argsort",
"numpy.array",
"astropy.coordinates.solar_system_ephemeris.set",
"numpy.isfinite",
"ast... | [((728, 756), 'matplotlib.pyplot.rc', 'plt.rc', (['"""xtick"""'], {'labelsize': '(8)'}), "('xtick', labelsize=8)\n", (734, 756), True, 'import matplotlib.pyplot as plt\n'), ((757, 785), 'matplotlib.pyplot.rc', 'plt.rc', (['"""ytick"""'], {'labelsize': '(8)'}), "('ytick', labelsize=8)\n", (763, 785), True, 'import matpl... |
# -*- coding: utf-8 -*-
import hashlib
from humanize import intcomma, naturalsize
import click
from codetiming import Timer
import fastcdc
from fastcdc.utils import DefaultHelp, iter_files, supported_hashes
@click.command(cls=DefaultHelp)
@click.argument(
"paths", type=click.Path(exists=True, file_okay=False, re... | [
"click.option",
"codetiming.Timer",
"fastcdc.utils.supported_hashes",
"humanize.naturalsize",
"fastcdc.utils.iter_files",
"fastcdc.fastcdc",
"codetiming.Timer.timers.mean",
"click.echo",
"click.Path",
"click.progressbar",
"click.BadOptionUsage",
"click.command"
] | [((211, 241), 'click.command', 'click.command', ([], {'cls': 'DefaultHelp'}), '(cls=DefaultHelp)\n', (224, 241), False, 'import click\n'), ((351, 443), 'click.option', 'click.option', (['"""-r"""', '"""--recursive"""'], {'help': '"""Scan directory tree recursively."""', 'is_flag': '(True)'}), "('-r', '--recursive', hel... |
"""
# Problem: roulette_wheel_selection.py
# Description:
# Created by ngocjr7 on [2020-03-31 14:55:40]
"""
from __future__ import absolute_import
from .selection import Selection
from ...individual import Individual
from geneticpython.utils.validation import check_random_state
from typing import List, Un... | [
"itertools.accumulate",
"geneticpython.utils.validation.check_random_state"
] | [((670, 702), 'geneticpython.utils.validation.check_random_state', 'check_random_state', (['random_state'], {}), '(random_state)\n', (688, 702), False, 'from geneticpython.utils.validation import check_random_state\n'), ((905, 946), 'itertools.accumulate', 'accumulate', (['[(i / sum_fit) for i in fits]'], {}), '([(i / ... |
import mult999.second.nn1.model as model
import mult999.trainer_utils
import tensorflow as tf
BATCH_SIZE = 200
BUFFER_SIZE = 200
MODEL_ID = "mult999_second_nn1"
REPEAT = 10
def gather_second(in_chars, out_chars):
return (in_chars, tf.gather(out_chars, [1], axis = 1))
if __name__ == "__main__":
mult999.traine... | [
"tensorflow.gather"
] | [((237, 270), 'tensorflow.gather', 'tf.gather', (['out_chars', '[1]'], {'axis': '(1)'}), '(out_chars, [1], axis=1)\n', (246, 270), True, 'import tensorflow as tf\n')] |
from setuptools import setup
from support.version import version, main_version
from support.classifiers import classifiers
name = 'omuse'
author = 'The AMUSE/ OMUSE team'
author_email = '<EMAIL>'
license_ = "Apache License 2.0"
url = 'https://github.com/omuse-geoscience/omuse'
install_requires = [
'omuse-framewor... | [
"setuptools.setup"
] | [((643, 968), 'setuptools.setup', 'setup', ([], {'name': 'name', 'version': 'version', 'classifiers': 'classifiers', 'url': 'url', 'author_email': 'author_email', 'author': 'author', 'license': 'license_', 'description': 'description', 'long_description': 'long_description', 'long_description_content_type': 'long_descr... |
from discord.ext.commands import Bot
from utils.format import info
import discord
import json
with open("utils/config.json", "r") as c:
config = json.load(c)
class Krumelur(Bot):
def __init__(self):
super().__init__(command_prefix=config["krumelur_prefix"], owner_id=config["owner_id"])
self.r... | [
"json.load",
"utils.format.info"
] | [((150, 162), 'json.load', 'json.load', (['c'], {}), '(c)\n', (159, 162), False, 'import json\n'), ((574, 602), 'utils.format.info', 'info', (['f"""Loaded {extension}!"""'], {}), "(f'Loaded {extension}!')\n", (578, 602), False, 'from utils.format import info\n')] |
import inspect
from .type import Type
from .misc import RawByte
from .util import prepare_types
class Array(Type):
elem_type = None
size = None
@classmethod
def is_raw_byte(cls):
return cls.elem_type is RawByte
@classmethod
def is_fixed_size(cls):
return isinstance(cls.s... | [
"inspect.isfunction"
] | [((520, 548), 'inspect.isfunction', 'inspect.isfunction', (['cls.size'], {}), '(cls.size)\n', (538, 548), False, 'import inspect\n')] |
#!/usr/bin/env python
# coding: utf-8
# In[5]:
import time as tm
import os, cx_Oracle
from datetime import *
import numpy as np
import pandas as pd
pt = os.getcwd() + "\\book1.csv"
df = pd.read_csv(pt)
df = df.astype (str)
df = df.rename (columns=str.upper)
df1 = df[['SERIAL','SUMMARY','CUSTOMATTR15','CUSTOMATTR... | [
"pandas.to_datetime",
"pandas.read_csv",
"os.getcwd"
] | [((193, 208), 'pandas.read_csv', 'pd.read_csv', (['pt'], {}), '(pt)\n', (204, 208), True, 'import pandas as pd\n'), ((160, 171), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (169, 171), False, 'import os, cx_Oracle\n'), ((402, 452), 'pandas.to_datetime', 'pd.to_datetime', (["x['LASTOCCURRENCE']"], {'dayfirst': '(True)'}... |
import unittest
from user import User
class TestUser(unittest.TestCase):
'''
Test class that defines test cases for users class behaviour
'''
def setUp(self):
'''
setup method to run before each test case
'''
self.new_user = User("eddah", "<PASSWORD>")
def tearDown(self):
'''
... | [
"unittest.main",
"user.User"
] | [((1488, 1503), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1501, 1503), False, 'import unittest\n'), ((250, 277), 'user.User', 'User', (['"""eddah"""', '"""<PASSWORD>"""'], {}), "('eddah', '<PASSWORD>')\n", (254, 277), False, 'from user import User\n'), ((1030, 1054), 'user.User', 'User', (['"""Test"""', '"""... |
# pylint: skip-file
'''variants.py: A module to normalize font variants.'''
import re
import sys
from collections import namedtuple
from enum import Enum
Data = namedtuple('Data', 'name, id, css, hidden')
class FONT_WEIGHT(Enum):
THIN = Data(name='Thin', id='100', css='100', hidden=False)
EXTRALIG... | [
"collections.namedtuple",
"re.match",
"sys.stdout.write"
] | [((162, 205), 'collections.namedtuple', 'namedtuple', (['"""Data"""', '"""name, id, css, hidden"""'], {}), "('Data', 'name, id, css, hidden')\n", (172, 205), False, 'from collections import namedtuple\n'), ((2819, 2845), 'sys.stdout.write', 'sys.stdout.write', (["(s + '\\n')"], {}), "(s + '\\n')\n", (2835, 2845), False... |
#!/usr/bin/env python
# Python Network Programming Cookbook, Second Edition -- Chapter - 3
# This program is optimized for Python 2.7.12 and Python 3.5.2.
# It may run on any other version with/without modifications.
import socket
import os
import time
SERVER_PATH = "/tmp/python_unix_socket_server"
def run_unix_do... | [
"os.path.exists",
"socket.socket",
"os.remove"
] | [((349, 376), 'os.path.exists', 'os.path.exists', (['SERVER_PATH'], {}), '(SERVER_PATH)\n', (363, 376), False, 'import os\n'), ((480, 528), 'socket.socket', 'socket.socket', (['socket.AF_UNIX', 'socket.SOCK_DGRAM'], {}), '(socket.AF_UNIX, socket.SOCK_DGRAM)\n', (493, 528), False, 'import socket\n'), ((923, 945), 'os.re... |
"""add officer age & years of service to SRPD incidents
Revision ID: <KEY>
Revises: c5e276c0d67f
Create Date: 2017-02-02 16:31:22.915785
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = 'c5e276c0d67f'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('c... | [
"sqlalchemy.String",
"alembic.op.drop_column"
] | [((1250, 1323), 'alembic.op.drop_column', 'op.drop_column', (['"""use_of_force_incidents_srpd"""', '"""officer_years_of_service"""'], {}), "('use_of_force_incidents_srpd', 'officer_years_of_service')\n", (1264, 1323), False, 'from alembic import op\n'), ((1328, 1388), 'alembic.op.drop_column', 'op.drop_column', (['"""u... |
import requests
from bs4 import BeautifulSoup
from pypresence import Presence
import time
import sys
import os
import json
import re
def connect_to_console(console_ip):
url = f"http://{console_ip}/cpursx.ps3?/sman.ps3"
is_connected = False
try:
html = requests.get(url).text
is_connected = T... | [
"pypresence.Presence",
"requests.get",
"time.sleep",
"bs4.BeautifulSoup",
"json.load",
"os.system"
] | [((559, 593), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (572, 593), False, 'from bs4 import BeautifulSoup\n'), ((793, 827), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (806, 827), False, 'from bs4 impor... |
import sys
from argparse import ArgumentParser
from typing import List, Union, Tuple, Optional
from rlai.meta import rl_text
from rlai.runners import trainer, agent_in_environment
from rlai.utils import parse_arguments, get_argument_parser
@rl_text(chapter='Training and Running Agents', page=1)
def run(
args... | [
"rlai.utils.get_argument_parser",
"rlai.utils.parse_arguments",
"rlai.meta.rl_text",
"argparse.ArgumentParser"
] | [((244, 298), 'rlai.meta.rl_text', 'rl_text', ([], {'chapter': '"""Training and Running Agents"""', 'page': '(1)'}), "(chapter='Training and Running Agents', page=1)\n", (251, 298), False, 'from rlai.meta import rl_text\n'), ((577, 607), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'add_help': '(False)'}), '(add_... |
import RPi.GPIO as GPIO
import time
import math
import sys
import signal
if(len(sys.argv) < 3):
print("USAGE: python3 softstart.py physpin intensity%");
sys.exit(1); # Exit with general error code
quit = False;
def signal_handler(sig, frame):
global quit
print('Received SIGINT')
quit = True;
sig... | [
"signal.signal",
"RPi.GPIO.cleanup",
"math.ceil",
"RPi.GPIO.setup",
"time.sleep",
"RPi.GPIO.PWM",
"sys.exit",
"RPi.GPIO.setmode"
] | [((317, 361), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'signal_handler'], {}), '(signal.SIGINT, signal_handler)\n', (330, 361), False, 'import signal\n'), ((416, 440), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BOARD'], {}), '(GPIO.BOARD)\n', (428, 440), True, 'import RPi.GPIO as GPIO\n'), ((441, 466), 'RP... |
# -*- coding: utf-8 -*-
#
# ***********************************************************************************
# MIT License
#
# Copyright (c) 2020 <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
# i... | [
"sys.platform.startswith",
"ctypes.sizeof"
] | [((4344, 4374), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (4367, 4374), False, 'import sys\n'), ((4383, 4413), 'ctypes.sizeof', 'ctypes.sizeof', (['ctypes.c_void_p'], {}), '(ctypes.c_void_p)\n', (4396, 4413), False, 'import ctypes\n')] |
#!/usr/bin/env python
# coding:utf8
"""
@Time : 2019/09/15
@Author : fls
@Contact : <EMAIL>
@Desc : darkripplesๆปๅนณๅฐ็ธๅ
ณ-ๅบ็จๅ
utils
@Modify Time @Author @Version @Desciption
------------ ------- -------- -----------
2019/09/15 08:43 fls 1.0 create
"""
from uu... | [
"json.loads",
"ez_utils.ParamsVerifyError",
"json.dumps",
"ez_utils.RedisCtrl",
"uuid.uuid1",
"ez_utils.get_ip"
] | [((1440, 1451), 'ez_utils.RedisCtrl', 'RedisCtrl', ([], {}), '()\n', (1449, 1451), False, 'from ez_utils import RedisCtrl, ParamsVerifyError, get_ip\n'), ((1783, 1794), 'ez_utils.RedisCtrl', 'RedisCtrl', ([], {}), '()\n', (1792, 1794), False, 'from ez_utils import RedisCtrl, ParamsVerifyError, get_ip\n'), ((599, 610), ... |
from .base_reward_function import BaseRewardFunction
import torch
class HalfCheetahBackwardsRewardFunction(BaseRewardFunction):
OBS_DIM = 18
def get_reward(self, observation: torch.Tensor, action: torch.Tensor,
device: str):
reward_ctrl = -0.1 * torch.sum(torch.square(action), dim=... | [
"torch.square"
] | [((294, 314), 'torch.square', 'torch.square', (['action'], {}), '(action)\n', (306, 314), False, 'import torch\n')] |
# Generated by Django 3.0.3 on 2020-03-11 13:29
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('employee', '0004_auto_20200303_1409'),
]
operations = [
migrations.AlterModelOptions(
name='department',
options={'ordering'... | [
"django.db.migrations.AlterModelOptions"
] | [((228, 505), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""department"""', 'options': "{'ordering': ['name', '-updated_at'], 'permissions': ((\n 'can_create_department', 'Can create department'), (\n 'can_edit_department', 'Can edit department'), ('can_delete_departm... |
import os
from django.core.wsgi import get_wsgi_application
try:
import newrelic.agent
newrelic.agent.initialize("/home/openstates/newrelic.ini")
newrelic.agent.capture_request_params()
except Exception as e:
print("newrelic couldn't be initialized:", e)
os.environ.setdefault("DJANGO_SETTINGS_MODULE... | [
"os.environ.setdefault",
"django.core.wsgi.get_wsgi_application"
] | [((275, 345), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""openstates.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'openstates.settings')\n", (296, 345), False, 'import os\n'), ((361, 383), 'django.core.wsgi.get_wsgi_application', 'get_wsgi_application', ([], {}), '()\n', (... |
import torch
from abc import abstractmethod
from numpy import inf
import numpy as np
class BaseTrainer:
"""
Base class for all trainers
"""
def __init__(self, model, criterion, metric_ftns, optimizer, config, fold_id):
self.config = config
self.logger = config.get_logger('trainer', conf... | [
"sklearn.metrics.confusion_matrix",
"sklearn.metrics.classification_report",
"torch.load",
"os.walk",
"os.path.join",
"torch.cuda.device_count",
"sklearn.metrics.cohen_kappa_score",
"torch.nn.DataParallel",
"numpy.array",
"torch.save",
"pandas.DataFrame",
"numpy.load",
"sklearn.metrics.accur... | [((3964, 4016), 'numpy.save', 'np.save', (['(self.config._save_dir / outs_name)', 'all_outs'], {}), '(self.config._save_dir / outs_name, all_outs)\n', (3971, 4016), True, 'import numpy as np\n'), ((4025, 4077), 'numpy.save', 'np.save', (['(self.config._save_dir / trgs_name)', 'all_trgs'], {}), '(self.config._save_dir /... |
import numpy as np
def hist_to_xy(array, bins):
hist = np.histogram(array, bins=bins)
y, x = [hist[0], 0.5 * (hist[1][1:] + hist[1][:-1])]
return x, y
def find_nearest(array, values):
indices = np.abs(np.subtract.outer(array, values)).argmin(0)
return indices
def check_for_completeness(list):
... | [
"numpy.histogram",
"numpy.subtract.outer"
] | [((61, 91), 'numpy.histogram', 'np.histogram', (['array'], {'bins': 'bins'}), '(array, bins=bins)\n', (73, 91), True, 'import numpy as np\n'), ((221, 253), 'numpy.subtract.outer', 'np.subtract.outer', (['array', 'values'], {}), '(array, values)\n', (238, 253), True, 'import numpy as np\n')] |
import scrapy
from scrapy.http import JsonRequest, Request
from scrapy import Selector
import time
class LotteryRuleSpider(scrapy.Spider):
name = "lotteryrule"
start_urls = ["https://www.caipiaokong.com/wanfa/",
"https://www.caipiaokong.com/shuyu/",
"https://www.caipiaokong.com/jiqiao... | [
"scrapy.Selector",
"scrapy.http.Request"
] | [((639, 657), 'scrapy.Selector', 'Selector', (['response'], {}), '(response)\n', (647, 657), False, 'from scrapy import Selector\n'), ((926, 944), 'scrapy.Selector', 'Selector', (['response'], {}), '(response)\n', (934, 944), False, 'from scrapy import Selector\n'), ((494, 591), 'scrapy.http.Request', 'Request', ([], {... |
from re import compile, finditer
REGEX = compile(r'\{\{([a-zA-Z]+)\}\}')
REPLS = ('{{', '{'), ('}}', '}')
def create_template(s):
def my_template(**kwargs):
keys = {a.group(1): '' for a in finditer(REGEX, s)}
keys.update(kwargs)
return reduce(lambda a, kv: a.replace(*kv), REPLS, s).format... | [
"re.finditer",
"re.compile"
] | [((42, 76), 're.compile', 'compile', (['"""\\\\{\\\\{([a-zA-Z]+)\\\\}\\\\}"""'], {}), "('\\\\{\\\\{([a-zA-Z]+)\\\\}\\\\}')\n", (49, 76), False, 'from re import compile, finditer\n'), ((204, 222), 're.finditer', 'finditer', (['REGEX', 's'], {}), '(REGEX, s)\n', (212, 222), False, 'from re import compile, finditer\n')] |
from rvb import application
from rvb.models import *
from flask import Flask, request, json
from rvb.controllers.helpers import authenticate, parse_data, validate_data
from rvb.exceptions import ResourceMissing, InvalidUsage, Unauthenticated
@application.route('/agent', methods=['GET','POST'])
def agent():
agent_i... | [
"flask.request.args.get",
"rvb.controllers.helpers.authenticate",
"flask.json.jsonify",
"rvb.exceptions.ResourceMissing",
"rvb.application.route",
"rvb.exceptions.Unauthenticated",
"rvb.controllers.helpers.validate_data",
"rvb.controllers.helpers.parse_data",
"rvb.exceptions.InvalidUsage"
] | [((244, 296), 'rvb.application.route', 'application.route', (['"""/agent"""'], {'methods': "['GET', 'POST']"}), "('/agent', methods=['GET', 'POST'])\n", (261, 296), False, 'from rvb import application\n'), ((324, 352), 'flask.request.args.get', 'request.args.get', (['"""agent_id"""'], {}), "('agent_id')\n", (340, 352),... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>
File for performing operations on a resource.
This file consists of a class: **UnixResource**, which can connect to the remote
UNIX Machine, using SSH via Paramiko.
The instance of this class can be used to perform various operations on a machine, like,
#. Check if ... | [
"paramiko.AutoAddPolicy",
"subprocess.run",
"time.sleep",
"os.path.isfile",
"os.path.basename",
"os.path.abspath",
"paramiko.SSHClient"
] | [((3496, 3516), 'paramiko.SSHClient', 'paramiko.SSHClient', ([], {}), '()\n', (3514, 3516), False, 'import paramiko\n'), ((3612, 3636), 'paramiko.AutoAddPolicy', 'paramiko.AutoAddPolicy', ([], {}), '()\n', (3634, 3636), False, 'import paramiko\n'), ((4867, 4889), 'os.path.isfile', 'os.path.isfile', (['script'], {}), '(... |
import unittest
from walky.utils import *
from walky.objects import *
from walky.connection import *
from walky.registry import *
from _common import *
class Test(unittest.TestCase):
def test_registry(self):
""" Can finally test the the registry handling abilities of
the connection object
... | [
"unittest.main"
] | [((1696, 1711), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1709, 1711), False, 'import unittest\n')] |
from selenium import webdriver
from time import sleep
def open_browser():
teamnumber = 3751
PATH = r"D:\python\Space ac\US-cansat\chromedriver.exe"
driver = webdriver.Chrome(PATH)
driver.get("http://cansat.info/plot.html")
driver.find_element_by_id("team").send_keys(teamnumber)
drive... | [
"selenium.webdriver.Chrome",
"time.sleep"
] | [((178, 200), 'selenium.webdriver.Chrome', 'webdriver.Chrome', (['PATH'], {}), '(PATH)\n', (194, 200), False, 'from selenium import webdriver\n'), ((383, 395), 'time.sleep', 'sleep', (['(10000)'], {}), '(10000)\n', (388, 395), False, 'from time import sleep\n')] |
# -*- coding=utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE ่้ฒธๅบ็ก่ฎก็ฎๅนณๅฐ available.
Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may ob... | [
"django.utils.translation.ugettext_lazy"
] | [((976, 989), 'django.utils.translation.ugettext_lazy', '_', (['"""ๆฐๆฎๅนณๅฐๆ้ๆจกๅ"""'], {}), "('ๆฐๆฎๅนณๅฐๆ้ๆจกๅ')\n", (977, 989), True, 'from django.utils.translation import ugettext_lazy as _\n')] |
import sublime_plugin, sublime
import sys
import os
import re
try:
from factory.Cells import Cells
except ImportError:
try:
from .factory.Cells import Cells
except ImportError as e:
if str( e ).find( 'bad magic number' ) != -1:
need_package_control_upgrade = True
else:
... | [
"re.escape"
] | [((811, 823), 're.escape', 're.escape', (['k'], {}), '(k)\n', (820, 823), False, 'import re\n')] |
__copyright__ = "Copyright 2013-2016, http://radical.rutgers.edu"
__license__ = "MIT"
import radical.utils as ru
from ... import states as rps
from .base import UMGRSchedulingComponent
# ------------------------------------------------------------------------------
#
class RoundRobin(UMGRSchedulingComponent)... | [
"radical.utils.RLock"
] | [((717, 727), 'radical.utils.RLock', 'ru.RLock', ([], {}), '()\n', (725, 727), True, 'import radical.utils as ru\n')] |
# Copyright (c) 2012 <NAME> <<EMAIL>> and
# CARET, University of Cambridge http://www.caret.cam.ac.uk/
#
# 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 restrictio... | [
"django.conf.settings.__getattr__"
] | [((1670, 1696), 'django.conf.settings.__getattr__', 'settings.__getattr__', (['name'], {}), '(name)\n', (1690, 1696), False, 'from django.conf import settings\n')] |
import torch.nn as nn
import torch
class Embedding(nn.Module):
def __init__(self, char_emb_size, ch_dropout, w_dropout, word_emb_size, model_dim):
super(Embedding, self).__init__()
self.ch_dropout = ch_dropout
self.w_dropout = w_dropout
self.highway = Highway(2, model_dim, w_dropou... | [
"torch.max",
"torch.nn.init.kaiming_normal_",
"torch.nn.functional.dropout",
"torch.nn.Conv2d",
"torch.nn.init.xavier_normal_",
"torch.nn.functional.relu",
"torch.nn.Conv1d",
"torch.cat"
] | [((346, 423), 'torch.nn.Conv2d', 'nn.Conv2d', (['char_emb_size', 'model_dim'], {'kernel_size': '(1, 5)', 'padding': '(0)', 'bias': '(True)'}), '(char_emb_size, model_dim, kernel_size=(1, 5), padding=0, bias=True)\n', (355, 423), True, 'import torch.nn as nn\n'), ((432, 497), 'torch.nn.init.kaiming_normal_', 'nn.init.ka... |
"""
@package graphlab
...
GraphLab Create is a machine learning platform that enables data scientists and
app developers to easily create intelligent applications at scale. Building an
intelligent, predictive application involves iterating over multiple steps:
cleaning the data, developing features, training a model, a... | [
"warnings.warn",
"os.path.dirname",
"logging.warning"
] | [((4377, 4403), 'os.path.dirname', '_os.path.dirname', (['__file__'], {}), '(__file__)\n', (4393, 4403), True, 'import os as _os\n'), ((2886, 3026), 'warnings.warn', 'warnings.warn', (['"""Graph has been renamed to SGraph. The Graph class will be removed in the next release."""', 'PendingDeprecationWarning'], {}), "(\n... |
import os
import sys
from shutil import copyfile
import pandas as pd
def get_tag_from_name(rec):
tag= f"{rec['first_name'][0]}{rec['last_name']}"
return(tag.lower())
def open_file(tag,rec):
if(rec['current']):
file = open(f'../_members/{tag}.md', 'w+')
print(file.name)
file.write... | [
"pandas.read_csv"
] | [((713, 734), 'pandas.read_csv', 'pd.read_csv', (['ppl_file'], {}), '(ppl_file)\n', (724, 734), True, 'import pandas as pd\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File : demo1.py
# Author: MuNian
# Date : 2020-01-08
'''
Python็ฌ่ซๅ่ฃ
ๆต่งๅจ
'''
import requests
proxie = {
'http':'http://localhost:5555/random'
}
print(proxie)
url = 'https://www.baidu.com'
response = requests.get(url, proxies=proxie)
print(response) | [
"requests.get"
] | [((259, 292), 'requests.get', 'requests.get', (['url'], {'proxies': 'proxie'}), '(url, proxies=proxie)\n', (271, 292), False, 'import requests\n')] |
#!/usr/bin/env python
#########################################################
#
# Main file for parallel mesh testing.
#
# This is a modification of the run_parallel_advection.py
# file.
#
#
# *) The (new) files that have been added to manage the
# grid partitioning are
# +) pmesh_divide_metis.py: subdivide a pm... | [
"anuga.interface.Reflective_boundary",
"anuga.interface.Transmissive_boundary",
"parallel_shallow_water.Parallel_domain",
"anuga.abstract_2d_finite_volumes.pmesh2domain.pmesh_to_domain_instance",
"distribute_mesh.send_submesh",
"distribute_mesh.pmesh_divide_metis",
"distribute_mesh.build_submesh",
"nu... | [((2128, 2151), 'numpy.zeros', 'num.zeros', (['(4)', 'num.float'], {}), '(4, num.float)\n', (2137, 2151), True, 'import numpy as num\n'), ((4666, 4777), 'parallel_shallow_water.Parallel_domain', 'Parallel_domain', (['points', 'vertices', 'boundary'], {'full_send_dict': 'full_send_dict', 'ghost_recv_dict': 'ghost_recv_d... |
from anthill.platform.services import PlainService, ControllerRole
from anthill.platform.api.internal import as_internal
from psutil import virtual_memory, cpu_percent
class Service(ControllerRole, PlainService):
"""Anthill default service."""
master = 'game_master'
@staticmethod
def setup_internal_a... | [
"psutil.cpu_percent",
"anthill.platform.api.internal.as_internal",
"psutil.virtual_memory"
] | [((335, 348), 'anthill.platform.api.internal.as_internal', 'as_internal', ([], {}), '()\n', (346, 348), False, 'from anthill.platform.api.internal import as_internal\n'), ((497, 510), 'psutil.cpu_percent', 'cpu_percent', ([], {}), '()\n', (508, 510), False, 'from psutil import virtual_memory, cpu_percent\n'), ((448, 46... |
import discord
from discord import Webhook
from discord.ext import commands
import json
import aiohttp
with open ('././config/webhooks.json', 'r') as f:
data = json.load(f)
webhookUrl = data['welcoming']
class welcomer(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async d... | [
"discord.ext.commands.Cog.listener",
"aiohttp.ClientSession",
"json.load",
"discord.Webhook.from_url",
"discord.Color.red"
] | [((163, 175), 'json.load', 'json.load', (['f'], {}), '(f)\n', (172, 175), False, 'import json\n'), ((287, 310), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (308, 310), False, 'from discord.ext import commands\n'), ((437, 456), 'discord.Color.red', 'discord.Color.red', ([], {}), '()\n... |
import itertools
from cirq import ops
from cirq.qutrit import raw_types
from cirq.qutrit import common_gates
import math, numpy as np
class ControlledTernaryGate(raw_types.TernaryLogicGate,
ops.CompositeGate,
ops.ReversibleEffect,
o... | [
"itertools.product",
"math.cos",
"numpy.array",
"math.sin",
"cirq.ops.TextDiagramInfo"
] | [((3523, 3625), 'cirq.ops.TextDiagramInfo', 'ops.TextDiagramInfo', (['(c_syms + base_info.wire_symbols)'], {'exponent': 'base_info.exponent', 'connected': '(True)'}), '(c_syms + base_info.wire_symbols, exponent=base_info.\n exponent, connected=True)\n', (3542, 3625), False, 'from cirq import ops\n'), ((8244, 8528), ... |
######################################################################
######################################################################
# Copyright <NAME>, Cambridge Dialogue Systems Group, 2017 #
######################################################################
#############################################... | [
"random.choice",
"random.shuffle"
] | [((4636, 4657), 'random.shuffle', 'random.shuffle', (['slots'], {}), '(slots)\n', (4650, 4657), False, 'import random\n'), ((6115, 6136), 'random.shuffle', 'random.shuffle', (['slots'], {}), '(slots)\n', (6129, 6136), False, 'import random\n'), ((6559, 6580), 'random.shuffle', 'random.shuffle', (['slots'], {}), '(slots... |
from pylayers.antprop.antenna import *
from pylayers.antprop.antvsh import *
import matplotlib.pylab as plt
from numpy import *
import pdb
"""
This test :
1 : loads a measured antenna
2 : applies an electrical delay obtained from data with getdelay method
3 : evaluate the antenna vsh coefficient with a d... | [
"matplotlib.pylab.subplot",
"matplotlib.pylab.plot",
"matplotlib.pylab.figure"
] | [((964, 976), 'matplotlib.pylab.figure', 'plt.figure', ([], {}), '()\n', (974, 976), True, 'import matplotlib.pylab as plt\n'), ((977, 993), 'matplotlib.pylab.subplot', 'plt.subplot', (['(221)'], {}), '(221)\n', (988, 993), True, 'import matplotlib.pylab as plt\n'), ((994, 1007), 'matplotlib.pylab.plot', 'plt.plot', ([... |
import dataclasses
import pandas as pd
from core.simple_transaction import SimpleTransaction
from core.typings import TransactionType, Balance, BalanceData
from dataclasses import dataclass
from datetime import datetime
from decimal import Decimal
from piecash.core.transaction import ScheduledTransaction, Transaction
... | [
"core.typings.BalanceData",
"core.simple_transaction.SimpleTransaction.simplify_scheduled_record",
"core.simple_transaction.SimpleTransaction.from_series",
"pandas.concat",
"pandas.DataFrame",
"core.simple_transaction.SimpleTransaction.simplify_record",
"dataclasses.field",
"decimal.Decimal"
] | [((513, 552), 'dataclasses.field', 'dataclasses.field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (530, 552), False, 'import dataclasses\n'), ((2660, 2729), 'core.typings.BalanceData', 'BalanceData', ([], {'checkings': 'checkings_balance', 'liability': 'liability_balance'}), '(checkings=checkings_b... |
import pygame
import fisica
import screen
def cria_projetil(posicao, direcao):
projetil = {}
projetil["contador"] = 0
projetil["corpo"] = fisica.cria_corpo(posicao[0], posicao[1])
projetil["corpo"]["massa"] = 0.05
forca = fisica.cria_vetor_unitario(direcao)
projetil["corpo"] = fisica.aplica... | [
"pygame.draw.circle",
"screen.corrige_posicao",
"fisica.cria_vetor_unitario",
"fisica.cria_corpo",
"pygame.surface.Surface",
"fisica.aplica_forca",
"fisica.atualiza_corpo"
] | [((155, 196), 'fisica.cria_corpo', 'fisica.cria_corpo', (['posicao[0]', 'posicao[1]'], {}), '(posicao[0], posicao[1])\n', (172, 196), False, 'import fisica\n'), ((247, 282), 'fisica.cria_vetor_unitario', 'fisica.cria_vetor_unitario', (['direcao'], {}), '(direcao)\n', (273, 282), False, 'import fisica\n'), ((307, 352), ... |
from django.contrib import admin
from django.contrib import admin
from products.models import Products
from products.models import MainCategory
from products.models import SubCategory
class ProductsAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("title",)}
class MainCategoryAdmin(admin.ModelAdmin):
... | [
"django.contrib.admin.site.register"
] | [((487, 531), 'django.contrib.admin.site.register', 'admin.site.register', (['Products', 'ProductsAdmin'], {}), '(Products, ProductsAdmin)\n', (506, 531), False, 'from django.contrib import admin\n'), ((532, 584), 'django.contrib.admin.site.register', 'admin.site.register', (['MainCategory', 'MainCategoryAdmin'], {}), ... |
'''
Changes over regular jinja2:
* support for arbitrary relative imports, example:
{% include '../common/cluster_update.j2' %}
* implemented filters
* quote: escape string for POSIX shell
* implemented tests:
* contains: checks if iterable contains an element;
similar to built-in "in" but works vice-versa
... | [
"os.path.dirname",
"os.path.getmtime",
"jinja2.TemplateNotFound",
"os.path.join"
] | [((1090, 1116), 'jinja2.TemplateNotFound', 'TemplateNotFound', (['template'], {}), '(template)\n', (1106, 1116), False, 'from jinja2 import FileSystemLoader, Environment, TemplateNotFound\n'), ((582, 616), 'os.path.join', 'os.path.join', (['searchpath', 'template'], {}), '(searchpath, template)\n', (594, 616), False, '... |
#!/usr/bin/env python
from setuptools import setup, find_packages
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(name='CoSpecPy',
version='0.5',
author = "<NAME>",
author_email = "<EMAIL>",
description = "Python Package for SDSS Composite Spectra"... | [
"setuptools.find_packages"
] | [((605, 620), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (618, 620), False, 'from setuptools import setup, find_packages\n')] |
"""
@Time : 2021/11/27 16:19
@File : misc.py
@Software: PyCharm
@Desc :
"""
import random
import warnings
import numpy as np
import torch
def setup_manual_seed(seed):
warnings.warn(f'You have chosen to seed ({seed}) training. This will turn on the CUDNN deterministic setting, '
f'whic... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"random.seed",
"torch.cuda.is_available",
"numpy.random.seed",
"warnings.warn"
] | [((184, 419), 'warnings.warn', 'warnings.warn', (['f"""You have chosen to seed ({seed}) training. This will turn on the CUDNN deterministic setting, which can slow down your training considerably! You may see unexpected behavior when restarting from checkpoints."""'], {}), "(\n f'You have chosen to seed ({seed}) tra... |
#!/usr/bin/env python
import csv
from sys import stdout
import alcazar
def main():
scraper = alcazar.Scraper(
cache_root_path='cache',
)
page = scraper.fetch('http://www.ucmp.berkeley.edu/fosrec/Olson2.html')
table = page.one('p[./a[@name="TABLE2"]]/following-sibling::table')
writer = cs... | [
"csv.writer",
"alcazar.Scraper"
] | [((101, 141), 'alcazar.Scraper', 'alcazar.Scraper', ([], {'cache_root_path': '"""cache"""'}), "(cache_root_path='cache')\n", (116, 141), False, 'import alcazar\n'), ((318, 336), 'csv.writer', 'csv.writer', (['stdout'], {}), '(stdout)\n', (328, 336), False, 'import csv\n')] |
'''
Created on July 1, 2020
csv_parsers.py
last updated: July 22, 2020
@author: calebwan
'''
import csv
import json
from pprint import pprint
debug = True
def generic_csv_parser(path, resource_name):
"""Return a lookup table after parsing the input CSV file"""
if debug:
print('generic_csv_parser:... | [
"csv.DictReader",
"pprint.pprint"
] | [((424, 453), 'csv.DictReader', 'csv.DictReader', (['csv_data_file'], {}), '(csv_data_file)\n', (438, 453), False, 'import csv\n'), ((515, 532), 'pprint.pprint', 'pprint', (['json_list'], {}), '(json_list)\n', (521, 532), False, 'from pprint import pprint\n')] |
from webcamlib.Config import Config, ConfigTemperature
import logging
from pathlib import PosixPath
from abc import ABC, abstractproperty
from webcamlib.Exceptions import DeviceError, ConfigError
class AbstractTemperatureSensor(ABC):
""" Base class for the temperature sensor """
def __init__(self, temperature_... | [
"pathlib.PosixPath",
"webcamlib.Exceptions.DeviceError",
"doctest.testmod",
"webcamlib.Exceptions.ConfigError"
] | [((8915, 8932), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (8930, 8932), False, 'import doctest\n'), ((2281, 2315), 'webcamlib.Exceptions.DeviceError', 'DeviceError', (['self.temperature_path'], {}), '(self.temperature_path)\n', (2292, 2315), False, 'from webcamlib.Exceptions import DeviceError, ConfigErro... |
import autograd.numpy as np
from matplotlib import pyplot, cm
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from numba import njit, prange
import numba
import time
from autograd import grad, elementwise_grad, jacobian
def feed_forward(X, Y, W0, W1, W2, W3, W4, return_loss=True):
... | [
"autograd.elementwise_grad",
"autograd.numpy.zeros_like",
"autograd.numpy.exp",
"autograd.numpy.array",
"autograd.numpy.meshgrid",
"autograd.numpy.dot",
"autograd.numpy.linspace",
"autograd.numpy.random.random",
"autograd.numpy.shape",
"matplotlib.pyplot.figure",
"autograd.numpy.sqrt",
"autogr... | [((2065, 2184), 'autograd.numpy.array', 'np.array', (['[[-1, -1], [1, -1], [1, 1], [-1, 1], [0.5, 0.5], [0.5, -0.5], [-0.5, 0.5],\n [-0.5, -0.5], [0, 0], [0, 0]]'], {}), '([[-1, -1], [1, -1], [1, 1], [-1, 1], [0.5, 0.5], [0.5, -0.5], [-\n 0.5, 0.5], [-0.5, -0.5], [0, 0], [0, 0]])\n', (2073, 2184), True, 'import a... |
"""<https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm>"""
import heapq
import sys
import numba as nb
import numpy as np
input = sys.stdin.readline
# NOTE: Dijkstra algorithm with priority queue (this is slow for dense graphs)
# 1. SciPy
# 2. Python
# 3. Numba
def solve1(N, A, B, T):
from scipy.sparse import... | [
"numba.njit",
"scipy.sparse.csgraph.dijkstra",
"numpy.max",
"numpy.zeros",
"heapq.heappop",
"heapq.heappush",
"scipy.sparse.csr_matrix"
] | [((1360, 1400), 'numba.njit', 'nb.njit', (['"""i8(i8,i8,i8[:,:])"""'], {'cache': '(True)'}), "('i8(i8,i8,i8[:,:])', cache=True)\n", (1367, 1400), True, 'import numba as nb\n'), ((393, 430), 'scipy.sparse.csr_matrix', 'csr_matrix', (['(T, (A, B))'], {'shape': '(N, N)'}), '((T, (A, B)), shape=(N, N))\n', (403, 430), Fals... |
import Level
import MACROS
def find_value(lvl:list): # Backtracking algorithm
playground = Level.level(lvl)#this is the main class that we will work on since this is a recursive function it will
#form different classes in each run
open_arr = playground.get_open() #Gets all the available positions for... | [
"Level.level"
] | [((100, 116), 'Level.level', 'Level.level', (['lvl'], {}), '(lvl)\n', (111, 116), False, 'import Level\n')] |
from typing import List, Dict, Any
import json
from spinta import commands
from spinta.accesslog import AccessLog
from spinta.components import Context, Store
class PythonAccessLog(AccessLog):
stream: list
def log(self, **kwargs):
message = self.create_message(**kwargs)
# `message` must be ... | [
"json.dumps",
"spinta.commands.load.register"
] | [((406, 461), 'spinta.commands.load.register', 'commands.load.register', (['Context', 'PythonAccessLog', 'Store'], {}), '(Context, PythonAccessLog, Store)\n', (428, 461), False, 'from spinta import commands\n'), ((347, 366), 'json.dumps', 'json.dumps', (['message'], {}), '(message)\n', (357, 366), False, 'import json\n... |