code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
import uuid
import random
import string
from django.utils.text import slugify
def product_image_file_path(instance, filename):
"""Generate file path for new product image"""
ext = filename.split('.')[-1]
filename = f'{uuid.uuid4()}.{ext}'
return os.path.join('uploads/product/', filename)
... | [
"django.utils.text.slugify",
"random.choice",
"os.path.join",
"uuid.uuid4",
"random.randint"
] | [((276, 318), 'os.path.join', 'os.path.join', (['"""uploads/product/"""', 'filename'], {}), "('uploads/product/', filename)\n", (288, 318), False, 'import os\n'), ((506, 549), 'os.path.join', 'os.path.join', (['"""uploads/category/"""', 'filename'], {}), "('uploads/category/', filename)\n", (518, 549), False, 'import o... |
# -*- coding: utf-8 -*-
from django.http.request import QueryDict
from rest_framework import status
from rest_framework.response import Response
from rest_framework.settings import api_settings
class CreateModelMixin(object):
"""
Create a model instance.
"""
def create(self, request, *args, **kwargs)... | [
"rest_framework.response.Response"
] | [((1223, 1311), 'rest_framework.response.Response', 'Response', (['retrieve_serializer.data'], {'status': 'status.HTTP_201_CREATED', 'headers': 'headers'}), '(retrieve_serializer.data, status=status.HTTP_201_CREATED, headers=\n headers)\n', (1231, 1311), False, 'from rest_framework.response import Response\n'), ((22... |
from django.conf.urls import url
from homepage import views
urlpatterns = [
url(r'^$', views.homepage_index, name="homepage_index"),
# url(r'^$', views.HomePageIndex.as_view(), name="homepage_index"),
]
| [
"django.conf.urls.url"
] | [((81, 135), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.homepage_index'], {'name': '"""homepage_index"""'}), "('^$', views.homepage_index, name='homepage_index')\n", (84, 135), False, 'from django.conf.urls import url\n')] |
import numpy as np
from sklearn.utils import class_weight
from sklearn.metrics import accuracy_score
from sklearn.model_selection import KFold
from sklearn.base import clone
import optuna
from pathlib import Path
import os
class Objective:
def __init__(self, classifier, parameter_distributions, cv, x, y, class_... | [
"numpy.unique",
"pathlib.Path",
"sklearn.base.clone",
"sklearn.utils.class_weight.compute_class_weight",
"numpy.array",
"sklearn.model_selection.KFold",
"sklearn.metrics.accuracy_score",
"optuna.create_study",
"os.remove"
] | [((2589, 2612), 'pathlib.Path', 'Path', (['file_storage_name'], {}), '(file_storage_name)\n', (2593, 2612), False, 'from pathlib import Path\n'), ((2725, 2810), 'optuna.create_study', 'optuna.create_study', ([], {'study_name': 'study_name', 'load_if_exists': '(True)', 'storage': 'storage'}), '(study_name=study_name, lo... |
import numpy as np
from sacred import Ingredient
config_ingredient = Ingredient("cfg")
@config_ingredient.config
def cfg():
# Base configuration
model_config = {"musdb_path" : "/home/daniel/Datasets/MUSDB18", # SET MUSDB PATH HERE, AND SET CCMIXTER PATH IN CCMixter.xml
"estimates_path" : "... | [
"numpy.random.randint",
"sacred.Ingredient"
] | [((70, 87), 'sacred.Ingredient', 'Ingredient', (['"""cfg"""'], {}), "('cfg')\n", (80, 87), False, 'from sacred import Ingredient\n'), ((3676, 3705), 'numpy.random.randint', 'np.random.randint', (['(0)', '(1000000)'], {}), '(0, 1000000)\n', (3693, 3705), True, 'import numpy as np\n')] |
from practicum import McuBoard, find_mcu_boards, PeriBoard
from time import sleep
devices = find_mcu_boards()
mcu = McuBoard(devices[0])
print("*** Practicum board found")
# print("*** Manufacturer: %s" % \
# mcu.handle.getString(mcu.device.iManufacturer, 256))
print("*** Product: %s" % \
mcu.handle.g... | [
"practicum.find_mcu_boards",
"practicum.McuBoard",
"practicum.PeriBoard",
"time.sleep"
] | [((93, 110), 'practicum.find_mcu_boards', 'find_mcu_boards', ([], {}), '()\n', (108, 110), False, 'from practicum import McuBoard, find_mcu_boards, PeriBoard\n'), ((117, 137), 'practicum.McuBoard', 'McuBoard', (['devices[0]'], {}), '(devices[0])\n', (125, 137), False, 'from practicum import McuBoard, find_mcu_boards, P... |
import torch
import torch.nn as nn
from fpconv.pointnet2.pointnet2_modules import PointnetFPModule, PointnetSAModule
import fpconv.pointnet2.pytorch_utils as pt_utils
from fpconv.base import AssemRes_BaseBlock
from fpconv.fpconv import FPConv4x4_BaseBlock, FPConv6x6_BaseBlock
NPOINTS = [8192, 2048, 512, 128]
RADIUS =... | [
"torch.nn.Dropout",
"fpconv.pointnet2.pytorch_utils.Conv2d",
"torch.nn.ModuleList",
"torch.nn.Sequential",
"fpconv.base.AssemRes_BaseBlock",
"fpconv.pointnet2.pointnet2_modules.PointnetFPModule"
] | [((867, 882), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (880, 882), True, 'import torch.nn as nn\n'), ((904, 1071), 'fpconv.base.AssemRes_BaseBlock', 'AssemRes_BaseBlock', ([], {'CONV_BASE': 'FPConv6x6_BaseBlock', 'npoint': 'None', 'radius': 'RADIUS[0]', 'nsample': 'NSAMPLE[0]', 'channel_list': '([input... |
import fractions
for s in ['0.5', '1.5', '2.0', '5e-1']:
f = fractions.Fraction(s)
print('{0:>4} = {1}'.format(s, f))
| [
"fractions.Fraction"
] | [((66, 87), 'fractions.Fraction', 'fractions.Fraction', (['s'], {}), '(s)\n', (84, 87), False, 'import fractions\n')] |
# Copyright 2010-2012 Opera Software ASA
#
# 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 ... | [
"probedb.certs.models.CertAttributes.objects.all",
"probedb.certs.certhandler.Certificate",
"django.shortcuts.render_to_response"
] | [((869, 903), 'probedb.certs.models.CertAttributes.objects.all', 'Certs.CertAttributes.objects.all', ([], {}), '()\n', (901, 903), True, 'import probedb.certs.models as Certs\n'), ((1953, 2000), 'django.shortcuts.render_to_response', 'render_to_response', (['"""certsummary.html"""', 'results'], {}), "('certsummary.html... |
import click
from ghutil.types import Repository
@click.command()
@Repository.argument('repo')
@click.pass_obj
def cli(gh, repo):
""" List releases for a repository """
for rel in repo.releases.get():
click.echo(str(gh.release(rel)))
| [
"ghutil.types.Repository.argument",
"click.command"
] | [((53, 68), 'click.command', 'click.command', ([], {}), '()\n', (66, 68), False, 'import click\n'), ((70, 97), 'ghutil.types.Repository.argument', 'Repository.argument', (['"""repo"""'], {}), "('repo')\n", (89, 97), False, 'from ghutil.types import Repository\n')] |
# Reverse photography
##h3D-II sensor size
# 36 * 48 mm, 0.036 x 0.048m
## focal length
# 28mm, 0.028m
## multiplier
# 1.0
from skimage import io
import matplotlib.pyplot as plt
import numpy as np
import cv2
from scipy.spatial import distance
import shapefile as shp
def buildshape(corners, filename):
"""build ... | [
"numpy.hstack",
"numpy.array",
"numpy.sin",
"numpy.genfromtxt",
"numpy.mean",
"numpy.cross",
"numpy.max",
"numpy.vstack",
"numpy.min",
"numpy.arctan",
"numpy.ceil",
"cv2.getPerspectiveTransform",
"numpy.floor",
"skimage.io.imread",
"numpy.cos",
"numpy.savetxt",
"numpy.int",
"cv2.im... | [((9338, 9387), 'numpy.hstack', 'np.hstack', (['[topleft, topright, botright, botleft]'], {}), '([topleft, topright, botright, botleft])\n', (9347, 9387), True, 'import numpy as np\n'), ((9747, 9777), 'numpy.genfromtxt', 'np.genfromtxt', (['trajectory_file'], {}), '(trajectory_file)\n', (9760, 9777), True, 'import nump... |
#!/usr/bin/env python
from flask import session, g, flash
from core.model import User
from flask_peewee.utils import check_password
class UserHandler(object):
def authenticate(self, username, password):
active = User.select().where(User.active == True)
try:
user = active.where(User.use... | [
"flask_peewee.utils.check_password",
"flask.session.get",
"flask.flash",
"core.model.User.select",
"flask.session.clear"
] | [((706, 756), 'flask.flash', 'flash', (["('You are logged in as %s' % user)", '"""success"""'], {}), "('You are logged in as %s' % user, 'success')\n", (711, 756), False, 'from flask import session, g, flash\n'), ((793, 808), 'flask.session.clear', 'session.clear', ([], {}), '()\n', (806, 808), False, 'from flask impor... |
from setuptools import setup
setup(name='mshow',
version = '7.0',
__version__='7.0',
description='Sample Message Showing Library',
url='https://github.com/nishantsinghdev/mshow',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['mshow'],
zip_safe=F... | [
"setuptools.setup"
] | [((30, 283), 'setuptools.setup', 'setup', ([], {'name': '"""mshow"""', 'version': '"""7.0"""', '__version__': '"""7.0"""', 'description': '"""Sample Message Showing Library"""', 'url': '"""https://github.com/nishantsinghdev/mshow"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT"""', 'p... |
import argparse, os
import malmoenv
from pathlib import Path
from gameai.utils.wrappers import DownsampleObs
def parse_args():
parser = argparse.ArgumentParser(description='malmoenv arguments')
parser.add_argument('--mission', type=str, default='../MalmoEnv/missions/mobchase_single_agent.xml',
... | [
"os.path.realpath",
"malmoenv.make",
"argparse.ArgumentParser",
"pathlib.Path"
] | [((141, 198), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""malmoenv arguments"""'}), "(description='malmoenv arguments')\n", (164, 198), False, 'import argparse, os\n'), ((1975, 2005), 'os.path.realpath', 'os.path.realpath', (['args.mission'], {}), '(args.mission)\n', (1991, 2005), Fal... |
"""App"""
import logging
import sys
from django.apps import AppConfig
logger = logging.getLogger(__name__)
class CamerasConfig(AppConfig):
"""App Config"""
name = 'vision_on_edge.cameras'
def ready(self):
"""App ready
Import signals and create some demo objects.
"""
... | [
"logging.getLogger",
"vision_on_edge.cameras.models.Camera.objects.update_or_create"
] | [((82, 109), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (99, 109), False, 'import logging\n'), ((683, 809), 'vision_on_edge.cameras.models.Camera.objects.update_or_create', 'Camera.objects.update_or_create', ([], {'name': '"""Demo Video"""', 'is_demo': '(True)', 'defaults': "{'rtsp': ... |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import attr
from construct import Container
from tls import _constructs... | [
"tls._constructs.TLSCompressed.parse",
"tls._constructs.TLSCiphertext.parse",
"tls._constructs.TLSPlaintext.parse",
"construct.Container",
"tls._common.enums.ContentType",
"attr.ib"
] | [((474, 483), 'attr.ib', 'attr.ib', ([], {}), '()\n', (481, 483), False, 'import attr\n'), ((496, 505), 'attr.ib', 'attr.ib', ([], {}), '()\n', (503, 505), False, 'import attr\n'), ((621, 630), 'attr.ib', 'attr.ib', ([], {}), '()\n', (628, 630), False, 'import attr\n'), ((645, 654), 'attr.ib', 'attr.ib', ([], {}), '()\... |
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import streamlit as st
@st.cache
def infer_dtypes(df):
dtype_dict = dict()
for col_name in df.columns:
series = df[col_name]
dtype_dict[col_name] = 'categorical'
nunique = df[col_name].nunique()
if nuniqu... | [
"streamlit.checkbox",
"plotly.graph_objects.Histogram",
"streamlit.markdown",
"numpy.ones",
"streamlit.container",
"pandas.api.types.is_numeric_dtype",
"streamlit.expander",
"pandas.api.types.is_bool_dtype",
"numpy.append",
"numpy.count_nonzero",
"streamlit.json",
"streamlit.plotly_chart",
"... | [((1833, 1860), 'numpy.ones', 'np.ones', (['num_numerical_cols'], {}), '(num_numerical_cols)\n', (1840, 1860), True, 'import numpy as np\n'), ((1887, 1942), 'numpy.append', 'np.append', (['numerical_cols_spec', '[chart_col_width_scale]'], {}), '(numerical_cols_spec, [chart_col_width_scale])\n', (1896, 1942), True, 'imp... |
"""Pareto tail indices plot."""
import matplotlib.pyplot as plt
from matplotlib.colors import to_rgba_array
import matplotlib.cm as cm
import numpy as np
from xarray import DataArray
from .plot_utils import (
_scale_fig_size,
get_coords,
color_from_dim,
format_coords_as_labels,
get_plotting_functio... | [
"matplotlib.colors.to_rgba_array",
"numpy.full",
"numpy.arange"
] | [((5047, 5071), 'numpy.arange', 'np.arange', (['n_data_points'], {}), '(n_data_points)\n', (5056, 5071), True, 'import numpy as np\n'), ((6060, 6080), 'matplotlib.colors.to_rgba_array', 'to_rgba_array', (['color'], {}), '(color)\n', (6073, 6080), False, 'from matplotlib.colors import to_rgba_array\n'), ((5962, 5991), '... |
''' Agents: stop/random/shortest/seq2seq '''
import json
import sys
import numpy as np
import random
from collections import namedtuple
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
import torch.distributions as D
from utils import vocab_pad_idx, vocab_eos_id... | [
"itertools.chain",
"torch.nn.CrossEntropyLoss",
"torch.distributions.Categorical",
"torch.LongTensor",
"utils.flatten",
"torch.from_numpy",
"numpy.array",
"sys.exit",
"torch.nn.functional.softmax",
"numpy.arange",
"numpy.concatenate",
"torch.autograd.Variable",
"collections.namedtuple",
"h... | [((578, 756), 'collections.namedtuple', 'namedtuple', (['"""InferenceState"""', '"""prev_inference_state, world_state, observation, flat_index, last_action, last_action_embedding, action_count, score, h_t, c_t, last_alpha"""'], {}), "('InferenceState',\n 'prev_inference_state, world_state, observation, flat_index, l... |
import os
import math
import ffmpeg
import numpy as np
from vispy import scene, app, io, geometry
from vispy.color import Color
from vispy.visuals import transforms
from vispy.scene.cameras import TurntableCamera
from .. import util as util
CF_MESH_PATH = os.path.join(os.path.dirname(__file__), "crazyflie2.obj.gz")... | [
"vispy.scene.visuals.Line",
"numpy.eye",
"numpy.ones",
"vispy.scene.cameras.TurntableCamera",
"vispy.visuals.transforms.MatrixTransform",
"numpy.array",
"os.path.dirname",
"vispy.scene.visuals.XYZAxis",
"numpy.zeros",
"vispy.io.read_mesh",
"vispy.geometry.create_sphere",
"numpy.dot",
"vispy.... | [((778, 805), 'vispy.color.Color', 'Color', (['"""#11FF22"""'], {'alpha': '(0.1)'}), "('#11FF22', alpha=0.1)\n", (783, 805), False, 'from vispy.color import Color\n'), ((835, 862), 'vispy.color.Color', 'Color', (['"""#FF0000"""'], {'alpha': '(0.1)'}), "('#FF0000', alpha=0.1)\n", (840, 862), False, 'from vispy.color imp... |
import pytest
from httpx import AsyncClient
from api.models import Role, UserRole
from api.models.permissions import ManageRoles
@pytest.fixture
async def manage_roles_role(db):
query = """
INSERT INTO roles (id, name, color, permissions, position)
VALUES (create_snowflake(), $1, $2, $3, (SEL... | [
"api.models.Role",
"api.models.permissions.ManageRoles",
"api.models.UserRole.create",
"api.models.Role.fetch",
"pytest.mark.parametrize",
"api.models.Role.pool.fetchrow"
] | [((623, 1173), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('data', 'status')", "[({}, 422), ({'name': ''}, 422), ({'permissions': -1}, 422), ({'name':\n 'test1', 'color': '0xffffff'}, 422), ({'name': 'test1', 'color':\n '-0x000001'}, 422), ({'name': 'test2', 'color': '0x000000',\n 'permissions': ... |
import time, datetime
from collections import namedtuple
clock_name = 'perf_counter'
# Get the information on
# the specified clock name
clock_info = time.get_clock_info(clock_name)
# Print the information
print("\nInformation on '% s':" % clock_name)
print(clock_info)
| [
"time.get_clock_info"
] | [((152, 183), 'time.get_clock_info', 'time.get_clock_info', (['clock_name'], {}), '(clock_name)\n', (171, 183), False, 'import time, datetime\n')] |
#!/usr/bin/env python3
'''
MIT License
Copyright (c) 2020 Futurewei Cloud
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, cop... | [
"fabric.Connection",
"parse.parseConfig",
"argparse.ArgumentParser"
] | [((1174, 1270), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Utility script to start/stop/kill cluster components"""'}), "(description=\n 'Utility script to start/stop/kill cluster components')\n", (1197, 1270), False, 'import argparse\n'), ((2103, 2156), 'parse.parseConfig', 'parse... |
import os
from ._base import PyconizrTestCase
EXPECTED_PATH = os.path.join(os.path.dirname(__file__), 'expected')
class OutputTests(PyconizrTestCase):
"""
Base output tests class
"""
def setUp(self):
super(OutputTests, self).setUp()
# optimize SVGs, generate sprite and... | [
"os.path.dirname",
"os.path.join"
] | [((81, 106), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (96, 106), False, 'import os\n'), ((680, 735), 'os.path.join', 'os.path.join', (['self.iconizr.temp_dir', '"""out"""', '"""icons.css"""'], {}), "(self.iconizr.temp_dir, 'out', 'icons.css')\n", (692, 735), False, 'import os\n'), ((755... |
import pytest
from tests.utils.device_mock import DeviceMock
@pytest.fixture()
def device():
dev = DeviceMock({
0x10: bytes.fromhex('59')
})
return dev
class TestEncryptionTemperature:
def test_read_battery(self, device):
assert device.battery == 89
def test_write_battery(self,... | [
"pytest.fixture",
"pytest.raises"
] | [((65, 81), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (79, 81), False, 'import pytest\n'), ((343, 372), 'pytest.raises', 'pytest.raises', (['AttributeError'], {}), '(AttributeError)\n', (356, 372), False, 'import pytest\n')] |
from django.urls import reverse
from rest_framework.test import APITestCase
from rest_framework import status
class AuthenticationTest(APITestCase):
base_url_register = reverse("api-users:register-list")
base_url_login = reverse("api-users:login-list")
base_url_logout = reverse("api-users:logout-list")
... | [
"django.urls.reverse"
] | [((175, 209), 'django.urls.reverse', 'reverse', (['"""api-users:register-list"""'], {}), "('api-users:register-list')\n", (182, 209), False, 'from django.urls import reverse\n'), ((231, 262), 'django.urls.reverse', 'reverse', (['"""api-users:login-list"""'], {}), "('api-users:login-list')\n", (238, 262), False, 'from d... |
import json
import os
from typing import Any
import attr
from glom import glom
from config.cloudfoundry import default_vcap_application, default_vcap_services
@attr.s(slots=True)
class CFenv:
vcap_service_prefix = attr.ib(
type=str,
default=os.getenv("VCAP_SERVICE_PREFIX", "p-config-server"),
... | [
"attr.validators.instance_of",
"attr.s",
"glom.glom",
"os.getenv"
] | [((164, 182), 'attr.s', 'attr.s', ([], {'slots': '(True)'}), '(slots=True)\n', (170, 182), False, 'import attr\n'), ((1176, 1229), 'glom.glom', 'glom', (['self.vcap_application', '"""space_name"""'], {'default': '""""""'}), "(self.vcap_application, 'space_name', default='')\n", (1180, 1229), False, 'from glom import gl... |
import pytest
def spy_cloud_led(mocker, pytenki_init, func_name, weather):
spy = mocker.spy(pytenki_init._leds.cloud, func_name)
pytenki_init._forecast = {'weather': weather}
pytenki_init._operate_cloud_led()
return spy
@pytest.mark.parametrize(
'weather', [
'曇り',
'曇のち晴',
... | [
"pytest.param"
] | [((323, 368), 'pytest.param', 'pytest.param', (['"""晴のち曇"""'], {'marks': 'pytest.mark.xfail'}), "('晴のち曇', marks=pytest.mark.xfail)\n", (335, 368), False, 'import pytest\n'), ((378, 423), 'pytest.param', 'pytest.param', (['"""晴時々曇"""'], {'marks': 'pytest.mark.xfail'}), "('晴時々曇', marks=pytest.mark.xfail)\n", (390, 423), ... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set",
"pulumi.InvokeOptions",
"pulumi.runtime.invoke"
] | [((2194, 2228), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""dropletLimit"""'}), "(name='dropletLimit')\n", (2207, 2228), False, 'import pulumi\n'), ((2437, 2472), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""emailVerified"""'}), "(name='emailVerified')\n", (2450, 2472), False, 'import pulumi\n'), ((2581,... |
import unittest
from ray.rllib.agents.ppo import PPOTrainer, DEFAULT_CONFIG
import ray
class LocalModeTest(unittest.TestCase):
def testLocal(self):
ray.init(local_mode=True)
cf = DEFAULT_CONFIG.copy()
agent = PPOTrainer(cf, "CartPole-v0")
print(agent.train())
if __name__ == "__m... | [
"unittest.main",
"ray.rllib.agents.ppo.PPOTrainer",
"ray.init",
"ray.rllib.agents.ppo.DEFAULT_CONFIG.copy"
] | [((332, 358), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (345, 358), False, 'import unittest\n'), ((163, 188), 'ray.init', 'ray.init', ([], {'local_mode': '(True)'}), '(local_mode=True)\n', (171, 188), False, 'import ray\n'), ((202, 223), 'ray.rllib.agents.ppo.DEFAULT_CONFIG.copy',... |
from dataclasses import dataclass
import discord
@dataclass(init=False)
class TwitchProfile:
def __init__(self, **kwargs):
self.id = kwargs.get("id")
self.login = kwargs.get("login")
self.display_name = kwargs.get("display_name")
self.acc_type = kwargs.get("acc_type")
self... | [
"dataclasses.dataclass"
] | [((53, 74), 'dataclasses.dataclass', 'dataclass', ([], {'init': '(False)'}), '(init=False)\n', (62, 74), False, 'from dataclasses import dataclass\n'), ((1312, 1333), 'dataclasses.dataclass', 'dataclass', ([], {'init': '(False)'}), '(init=False)\n', (1321, 1333), False, 'from dataclasses import dataclass\n')] |
import os
import time
def prepar_data():
if not os.path.exists('data'):
os.mkdir('data')
# SNLI
if not (os.path.exists('data/SNLI/train.txt')
and os.path.exists('data/SNLI/dev.txt')
and os.path.exists('data/SNLI/test.txt')):
if not os.path.exists('data/snli_1.0.zip... | [
"os.system",
"os.path.exists",
"time.time",
"os.mkdir"
] | [((2993, 3004), 'time.time', 'time.time', ([], {}), '()\n', (3002, 3004), False, 'import time\n'), ((54, 76), 'os.path.exists', 'os.path.exists', (['"""data"""'], {}), "('data')\n", (68, 76), False, 'import os\n'), ((86, 102), 'os.mkdir', 'os.mkdir', (['"""data"""'], {}), "('data')\n", (94, 102), False, 'import os\n'),... |
import scipy.integrate as intg
import numpy as np
import matplotlib.pyplot as plt
#Physical Constants
#Everything is in MKS units
h = 6.6261e-34 #Planck constant [J/s]
kB = 1.3806e-23 #Boltzmann constant [J/K]
c = 299792458.0 #Speed of light [m/s]
PI = np.pi #Pi
eps0 = 8.85e-12 #Vacuum Permitivity
rho=2.417e-8 ... | [
"numpy.trapz",
"numpy.sqrt",
"numpy.power",
"numpy.exp",
"numpy.cos"
] | [((1028, 1049), 'numpy.trapz', 'np.trapz', (['spec', 'freqs'], {}), '(spec, freqs)\n', (1036, 1049), True, 'import numpy as np\n'), ((1401, 1412), 'numpy.cos', 'np.cos', (['chi'], {}), '(chi)\n', (1407, 1412), True, 'import numpy as np\n'), ((1438, 1471), 'numpy.sqrt', 'np.sqrt', (['(4 * PI * eps0 * rho * nu)'], {}), '... |
import pickle
import pathlib
import numpy as np
from bci3wads.utils import constants
class Epoch:
def __init__(self, signals, flashing, stimulus_codes, stimulus_types,
target_char):
self.n_channels = signals.shape[1]
self.signals = signals
self.flashing = flashing
... | [
"pickle.dump",
"numpy.unique",
"pathlib.Path",
"pickle.load",
"numpy.array",
"numpy.nonzero",
"bci3wads.utils.constants.INTER_DATA_PATH.joinpath"
] | [((920, 983), 'numpy.array', 'np.array', (['[channel_signals[i:i + window_size] for i in indices]'], {}), '([channel_signals[i:i + window_size] for i in indices])\n', (928, 983), True, 'import numpy as np\n'), ((1664, 1719), 'numpy.array', 'np.array', (['[samples[position] for position in positions]'], {}), '([samples[... |
from django.shortcuts import render, redirect
from django.template import loader, RequestContext
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseBadRequest
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from direct.models import Message
... | [
"django.http.HttpResponseBadRequest",
"django.shortcuts.redirect",
"direct.models.Message.send_message",
"django.db.models.Q",
"django.contrib.auth.models.User.objects.get",
"direct.models.Message.objects.filter",
"django.template.loader.get_template",
"direct.models.Message.get_messages",
"django.c... | [((470, 509), 'direct.models.Message.get_messages', 'Message.get_messages', ([], {'user': 'request.user'}), '(user=request.user)\n', (490, 509), False, 'from direct.models import Message\n'), ((955, 996), 'django.template.loader.get_template', 'loader.get_template', (['"""direct/direct.html"""'], {}), "('direct/direct.... |
import random
from BaseClasses import Dungeon
from Bosses import BossFactory
from Fill import fill_restrictive
from Items import ItemFactory
def create_dungeons(world, player):
def make_dungeon(name, id, default_boss, dungeon_regions, big_key, small_keys, dungeon_items):
dungeon = Dungeon(name, dungeon_r... | [
"Items.ItemFactory",
"random.shuffle",
"Bosses.BossFactory",
"BaseClasses.Dungeon"
] | [((3586, 3622), 'Bosses.BossFactory', 'BossFactory', (['"""Armos Knights"""', 'player'], {}), "('Armos Knights', player)\n", (3597, 3622), False, 'from Bosses import BossFactory\n'), ((3649, 3680), 'Bosses.BossFactory', 'BossFactory', (['"""Lanmolas"""', 'player'], {}), "('Lanmolas', player)\n", (3660, 3680), False, 'f... |
#!/usr/bin/env python3
# coding=utf-8
import os
import time
from utils.commonfun import Common
__author__ = 'tony'
class Remedy(object):
def __init__(self):
self.path = os.path.dirname(os.path.abspath(__file__))
self.error_type = ["latest", "data_app_anr", "data_app_crash"]
self.device_... | [
"os.path.exists",
"utils.commonfun.Common.adb",
"time.strptime",
"utils.commonfun.Common.confirm_path",
"os.path.join",
"utils.commonfun.Common.gen_device_info",
"utils.commonfun.Common.gen_devices_id",
"os.path.abspath",
"utils.commonfun.Common.adb_shell"
] | [((574, 620), 'os.path.join', 'os.path.join', (['self.path', "*['Log', device_info]"], {}), "(self.path, *['Log', device_info])\n", (586, 620), False, 'import os\n'), ((2832, 2861), 'os.path.join', 'os.path.join', (['path', 'file_name'], {}), '(path, file_name)\n', (2844, 2861), False, 'import os\n'), ((4869, 4906), 'u... |
import pandas as pd
from pandas_datareader import data
start_date = '2014-01-01'
end_date = '2018-01-01'
SRC_DATA_FILENAME = 'goog_data.pkl'
try:
goog_data2 = pd.read_pickle(SRC_DATA_FILENAME)
except FileNotFoundError:
goog_data2 = data.DataReader('GOOG', 'yahoo', start_date, end_date)
goog_data2.to_pickle(SRC... | [
"pandas.read_pickle",
"statistics.mean",
"pandas.Series",
"pandas_datareader.data.DataReader",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show"
] | [((2021, 2033), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2031, 2033), True, 'import matplotlib.pyplot as plt\n'), ((2297, 2307), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2305, 2307), True, 'import matplotlib.pyplot as plt\n'), ((164, 197), 'pandas.read_pickle', 'pd.read_pickle', (['S... |
'''
Unit test of the wrapper for the connected ls mask creation c++ code
Created on May 25, 2016
@author: thomasriddick
'''
import unittest
import numpy as np
from Dynamic_HD_Scripts.interface.cpp_interface.libs \
import create_connected_lsmask_wrapper as cc_lsmask_wrapper #@UnresolvedImport
class Test(unittes... | [
"unittest.main",
"numpy.asarray",
"Dynamic_HD_Scripts.interface.cpp_interface.libs.create_connected_lsmask_wrapper.create_connected_ls_mask",
"numpy.testing.assert_array_equal"
] | [((5148, 5163), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5161, 5163), False, 'import unittest\n'), ((466, 842), 'numpy.asarray', 'np.asarray', (['[[0, 0, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 1, 0, 1, 1, 1], [0, 0, 0, \n 1, 1, 1, 1, 1, 1, 0], [0, 0, 1, 0, 1, 0, 0, 1, 1, 1], [0, 0, 0, 1, 0, 0,\n 0, ... |
import sys
from typing import Collection, Tuple, Optional
import numba
import pandas as pd
import numpy as np
from numpy import linalg as la
from scipy.sparse import issparse
from anndata import AnnData
from .. import logging as logg
from ..utils import sanitize_anndata
def _design_matrix(
model: pd.DataFram... | [
"numpy.sqrt",
"numpy.ones",
"scipy.sparse.issparse",
"numpy.any",
"numpy.array",
"numpy.dot",
"numpy.sum",
"numpy.isnan",
"pandas.DataFrame",
"pandas.concat"
] | [((3100, 3151), 'numpy.dot', 'np.dot', (['(n_batches / n_array).T', 'B_hat[:n_batch, :]'], {}), '((n_batches / n_array).T, B_hat[:n_batch, :])\n', (3106, 3151), True, 'import numpy as np\n'), ((3949, 4009), 'pandas.DataFrame', 'pd.DataFrame', (['s_data'], {'index': 'data.index', 'columns': 'data.columns'}), '(s_data, i... |
# import hashlib
import argparse
import luigi
from pset_4.cli import main
from pset_4.tasks.stylize import Stylize
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument("-i", "--image", default='luigi.jpg' , action="store_true")
parser.add_... | [
"pset_4.tasks.stylize.Stylize",
"argparse.ArgumentParser"
] | [((159, 220), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process some integers."""'}), "(description='Process some integers.')\n", (182, 220), False, 'import argparse\n'), ((621, 664), 'pset_4.tasks.stylize.Stylize', 'Stylize', ([], {'image': 'args.image', 'model': 'args.model'}), '(... |
import re
def load_input(filename):
p = re.compile(r'\n')
with open(filename, 'r') as f:
return f.read().split('\n\n')
def get_unique_question_sets(input_file):
answered_questions = [[e for e in line if e != '\n']
for line in input_file]
return [list(set(question))... | [
"re.compile"
] | [((46, 63), 're.compile', 're.compile', (['"""\\\\n"""'], {}), "('\\\\n')\n", (56, 63), False, 'import re\n')] |
# coding: utf-8
from __future__ import annotations
from datetime import date, datetime # noqa: F401
import re # noqa: F401
from typing import Any, Dict, List, Optional, Union, Literal # noqa: F401
from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra # noqa: F401
class V20CredExRecordLDPro... | [
"re.match",
"pydantic.validator"
] | [((1770, 1793), 'pydantic.validator', 'validator', (['"""created_at"""'], {}), "('created_at')\n", (1779, 1793), False, 'from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra\n'), ((2207, 2230), 'pydantic.validator', 'validator', (['"""updated_at"""'], {}), "('updated_at')\n", (2216, 2230), False, '... |
# 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.
"""Fuzz test for LlvmEnv.validate()."""
import numpy as np
import pytest
from compiler_gym.envs import LlvmEnv
from compiler_gym.errors import... | [
"numpy.testing.assert_array_almost_equal",
"tests.pytest_plugins.random_util.apply_random_trajectory",
"numpy.testing.assert_almost_equal",
"tests.test_main.main",
"pytest.mark.timeout"
] | [((580, 604), 'pytest.mark.timeout', 'pytest.mark.timeout', (['(600)'], {}), '(600)\n', (599, 604), False, 'import pytest\n'), ((1132, 1228), 'tests.pytest_plugins.random_util.apply_random_trajectory', 'apply_random_trajectory', (['env'], {'random_trajectory_length_range': 'RANDOM_TRAJECTORY_LENGTH_RANGE'}), '(env, ran... |
r"""
The Elliptic Curve Factorization Method
The elliptic curve factorization method (ECM) is the fastest way to
factor a **known composite** integer if one of the factors is
relatively small (up to approximately 80 bits / 25 decimal digits). To
factor an arbitrary integer it must be combined with a primality
test. Th... | [
"re.compile",
"subprocess.Popen",
"sage.rings.integer_ring.ZZ",
"os.system",
"six.iteritems"
] | [((9493, 9567), 're.compile', 're.compile', (['"""Using B1=(\\\\d+), B2=(\\\\d+), polynomial ([^,]+), sigma=(\\\\d+)"""'], {}), "('Using B1=(\\\\d+), B2=(\\\\d+), polynomial ([^,]+), sigma=(\\\\d+)')\n", (9503, 9567), False, 'import re\n'), ((9597, 9631), 're.compile', 're.compile', (['"""Found input number N"""'], {})... |
# coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import unittest
import sys
import os
from datetime import datetime
from asn1crypto import ocsp, util
from ._unittest_compat import patch
patch()
if sys.version_info < (3,):
byte_cls = str
else:
byte_cls = byte... | [
"datetime.datetime",
"os.path.dirname",
"os.path.join"
] | [((337, 362), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (352, 362), False, 'import os\n'), ((378, 414), 'os.path.join', 'os.path.join', (['tests_root', '"""fixtures"""'], {}), "(tests_root, 'fixtures')\n", (390, 414), False, 'import os\n'), ((3176, 3234), 'datetime.datetime', 'datetime',... |
import random
import pecan
from pecan import expose, response, request
_body = pecan.x_test_body
_headers = pecan.x_test_headers
class TestController:
def __init__(self, account_id):
self.account_id = account_id
@expose(content_type='text/plain')
def test(self):
user_agent = request.he... | [
"pecan.response.headers.update",
"pecan.expose",
"pecan.request.params.get"
] | [((235, 268), 'pecan.expose', 'expose', ([], {'content_type': '"""text/plain"""'}), "(content_type='text/plain')\n", (241, 268), False, 'from pecan import expose, response, request\n'), ((500, 508), 'pecan.expose', 'expose', ([], {}), '()\n', (506, 508), False, 'from pecan import expose, response, request\n'), ((638, 6... |
import unittest
from trulioo_sdk.model.business_result import BusinessResult
from trulioo_sdk.model.service_error import ServiceError
globals()["BusinessResult"] = BusinessResult
globals()["ServiceError"] = ServiceError
from trulioo_sdk.model.business_record import BusinessRecord
from trulioo_sdk.exceptions import Ap... | [
"trulioo_sdk.model.business_result.BusinessResult",
"trulioo_sdk.model.service_error.ServiceError",
"trulioo_sdk.model.business_record.BusinessRecord",
"unittest.main",
"trulioo_sdk.configuration.Configuration"
] | [((1193, 1208), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1206, 1208), False, 'import unittest\n'), ((868, 890), 'trulioo_sdk.model.business_record.BusinessRecord', 'BusinessRecord', (['"""test"""'], {}), "('test')\n", (882, 890), False, 'from trulioo_sdk.model.business_record import BusinessRecord\n'), ((10... |
#!/usr/bin/env python
import sys
import argparse
from heaphopper.analysis.tracer.tracer import trace
from heaphopper.analysis.identify_bins.identifier import identify
from heaphopper.gen.gen_zoo import gen_zoo
from heaphopper.gen.gen_pocs import gen_pocs
def run_identifier(config):
ret = identify(config)
sys... | [
"heaphopper.analysis.identify_bins.identifier.identify",
"argparse.ArgumentParser",
"heaphopper.gen.gen_zoo.gen_zoo",
"heaphopper.analysis.tracer.tracer.trace",
"sys.exit",
"heaphopper.gen.gen_pocs.gen_pocs"
] | [((296, 312), 'heaphopper.analysis.identify_bins.identifier.identify', 'identify', (['config'], {}), '(config)\n', (304, 312), False, 'from heaphopper.analysis.identify_bins.identifier import identify\n'), ((317, 330), 'sys.exit', 'sys.exit', (['ret'], {}), '(ret)\n', (325, 330), False, 'import sys\n'), ((375, 396), 'h... |
########################################################################################################
## pyFAST - Fingerprint and Similarity Thresholding in python
##
## <NAME>
## 11/14/2016
##
## (see Yoon et. al. 2015, Sci. Adv. for algorithm details)
##
############################################################... | [
"numpy.mean",
"numpy.median",
"numpy.reshape",
"pywt.wavedec2",
"pywt.Wavelet",
"numpy.argsort",
"numpy.array",
"numpy.zeros",
"numpy.sign",
"scipy.misc.imresize",
"numpy.std",
"numpy.concatenate",
"numpy.shape"
] | [((4642, 4655), 'numpy.shape', 'np.shape', (['Sxx'], {}), '(Sxx)\n', (4650, 4655), True, 'import numpy as np\n'), ((4770, 4810), 'numpy.zeros', 'np.zeros', (['[nWindows, nFreq, self.fp_len]'], {}), '([nWindows, nFreq, self.fp_len])\n', (4778, 4810), True, 'import numpy as np\n'), ((4975, 5000), 'numpy.shape', 'np.shape... |
import cv2 as cv
import matplotlib.pyplot as plt
import numpy as np
def show_image(image_path,type = "matplotlib"):
image = cv.imread(image_path, 0)
if type == "cv":
cv.imshow("original",image)
cv.waitKey(0)
cv.destroyWindow()
else:
plt.imshow(image,cmap = 'gray', interpola... | [
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.xticks",
"cv2.destroyWindow",
"cv2.line",
"cv2.imshow",
"numpy.zeros",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"matplotlib.pyplot.yticks",
"cv2.cvtColor",
"cv2.imread",
"matplotlib.pyplot.show"
] | [((130, 154), 'cv2.imread', 'cv.imread', (['image_path', '(0)'], {}), '(image_path, 0)\n', (139, 154), True, 'import cv2 as cv\n'), ((435, 453), 'cv2.VideoCapture', 'cv.VideoCapture', (['(0)'], {}), '(0)\n', (450, 453), True, 'import cv2 as cv\n'), ((689, 711), 'cv2.destroyAllWindows', 'cv.destroyAllWindows', ([], {}),... |
from app import app, db
from flask import request
from app.models import User, Course, Test, Question, Result, enrolments, Submission
from app.forms import LoginForm, RegistrationForm, NewTestForm, NewCourseForm, RenameTestForm, QuestionForm, QuestionSubmissionForm, AddStudentToCourseForm, MarkTestForm, FeedbackForm
fr... | [
"flask.render_template",
"app.db.session.commit",
"app.forms.QuestionSubmissionForm",
"app.forms.MarkTestForm",
"flask_login.current_user.courses.append",
"app.forms.QuestionForm",
"app.models.Submission.query.filter_by",
"app.models.User",
"app.models.Question.query.filter_by",
"app.forms.NewCour... | [((525, 536), 'app.forms.LoginForm', 'LoginForm', ([], {}), '()\n', (534, 536), False, 'from app.forms import LoginForm, RegistrationForm, NewTestForm, NewCourseForm, RenameTestForm, QuestionForm, QuestionSubmissionForm, AddStudentToCourseForm, MarkTestForm, FeedbackForm\n'), ((1154, 1194), 'flask.render_template', 're... |
# -*-coding:utf-8-*-
"""
相关配置配置读写解析
@author <NAME>
"""
import configparser
import os
import re
import urllib.parse
import win32con
import const_config
import mylogger
import utils
from utils import create_dialog_w
log = mylogger.default_loguru
def get_bg_abspaths():
"""
获取壁纸目录下的绝对路径列表
不包括子目录
:... | [
"os.listdir",
"utils.create_dialog_w",
"os.path.join",
"os.path.isfile",
"utils.list_deduplication",
"os.path.isdir",
"os._exit",
"os.getpid",
"os.cpu_count",
"os.path.abspath",
"configparser.RawConfigParser"
] | [((488, 515), 'os.path.abspath', 'os.path.abspath', (['bg_srcpath'], {}), '(bg_srcpath)\n', (503, 515), False, 'import os\n'), ((530, 556), 'os.listdir', 'os.listdir', (['bg_src_abspath'], {}), '(bg_src_abspath)\n', (540, 556), False, 'import os\n'), ((826, 856), 'configparser.RawConfigParser', 'configparser.RawConfigP... |
#!/usr/bin/env python3
"""
Get a response from the ingests API. Usage:
python ss_get_ingest.py <INGEST_ID>
The script will attempt to find the ingest ID in both the prod and staging APIs.
For most use cases, you can use the web inspector:
https://wellcome-ingest-inspector.glitch.me/
This script is useful if yo... | [
"json.dumps",
"wellcome_storage_service.prod_client",
"wellcome_storage_service.staging_client",
"sys.exit"
] | [((869, 923), 'sys.exit', 'sys.exit', (['f"""Could not find {ingest_id} in either API!"""'], {}), "(f'Could not find {ingest_id} in either API!')\n", (877, 923), False, 'import sys\n'), ((661, 677), 'wellcome_storage_service.staging_client', 'staging_client', ([], {}), '()\n', (675, 677), False, 'from wellcome_storage_... |
#!/usr/bin/env python
from __future__ import print_function
from setuptools import setup
description = "Git commit message linter written in python, checks your commit messages for style."
long_description = """
Great for use as a commit-msg git hook or as part of your gating script in a CI pipeline (e.g. jenkins, git... | [
"setuptools.setup"
] | [((1266, 2426), 'setuptools.setup', 'setup', ([], {'name': '"""gitlint"""', 'version': 'version', 'description': 'description', 'long_description': 'long_description', 'classifiers': "['Development Status :: 5 - Production/Stable',\n 'Operating System :: OS Independent', 'Programming Language :: Python',\n 'Progr... |
from django.conf.urls import url
from addons.urls import ADDON_ID
from . import views
# All URLs under /editors/
urlpatterns = (
url(r'^$', views.home, name='editors.home'),
url(r'^queue$', views.queue, name='editors.queue'),
url(r'^queue/nominated$', views.queue_nominated,
name='editors.queue_no... | [
"django.conf.urls.url"
] | [((136, 178), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.home'], {'name': '"""editors.home"""'}), "('^$', views.home, name='editors.home')\n", (139, 178), False, 'from django.conf.urls import url\n'), ((185, 234), 'django.conf.urls.url', 'url', (['"""^queue$"""', 'views.queue'], {'name': '"""editors.queue"""'}... |
import csv
import os
def remove_if_exist(path):
if os.path.exists(path):
os.remove(path)
def load_metadata(path):
res = {}
headers = None
with open(path, newline='') as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='"')
for row in reader:
if head... | [
"os.path.exists",
"csv.reader",
"os.remove"
] | [((57, 77), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (71, 77), False, 'import os\n'), ((87, 102), 'os.remove', 'os.remove', (['path'], {}), '(path)\n', (96, 102), False, 'import os\n'), ((224, 273), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""","""', 'quotechar': '"""\\""""'}), '(c... |
"""
Use the ``RelocationModel`` class to choose movers based on
relocation rates.
"""
import logging
import numpy as np
import pandas as pd
from . import util
logger = logging.getLogger(__name__)
def find_movers(choosers, rates, rate_column):
"""
Returns an array of the indexes of the `choosers` that are ... | [
"logging.getLogger"
] | [((172, 199), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (189, 199), False, 'import logging\n')] |
from django.contrib import admin
from ww.api.models import Watch, Ping, Flare, Launch
@admin.register(Watch)
class WatchAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'created', 'word', 'state', 'status', 'last_ping',)
@admin.register(Ping)
class PingAdmin(admin.ModelAdmin):
list_display = ('id', 'cr... | [
"django.contrib.admin.register"
] | [((89, 110), 'django.contrib.admin.register', 'admin.register', (['Watch'], {}), '(Watch)\n', (103, 110), False, 'from django.contrib import admin\n'), ((235, 255), 'django.contrib.admin.register', 'admin.register', (['Ping'], {}), '(Ping)\n', (249, 255), False, 'from django.contrib import admin\n'), ((448, 469), 'djan... |
from __future__ import unicode_literals
import frappe
from frappe import _
import io
import openpyxl
from frappe.utils import cint, get_site_url, get_url
from art_collections.controllers.excel import write_xlsx, attach_file
def on_submit_sales_invoice(doc, method=None):
_make_excel_attachment(doc.doctype, doc.nam... | [
"frappe.whitelist",
"io.BytesIO",
"frappe.utils.get_url",
"frappe._",
"openpyxl.Workbook"
] | [((326, 344), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (342, 344), False, 'import frappe\n'), ((2779, 2798), 'openpyxl.Workbook', 'openpyxl.Workbook', ([], {}), '()\n', (2796, 2798), False, 'import openpyxl\n'), ((3008, 3020), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (3018, 3020), False, 'import i... |
import pytest
from antu.io.token_indexers.single_id_token_indexer import SingleIdTokenIndexer
from antu.io.fields.text_field import TextField
from collections import Counter
from antu.io.vocabulary import Vocabulary
class TestSingleIdTokenIndexer:
def test_single_id_token_indexer(self):
sentence = ['This'... | [
"collections.Counter",
"antu.io.token_indexers.single_id_token_indexer.SingleIdTokenIndexer",
"antu.io.vocabulary.Vocabulary",
"antu.io.fields.text_field.TextField"
] | [((421, 433), 'antu.io.vocabulary.Vocabulary', 'Vocabulary', ([], {}), '()\n', (431, 433), False, 'from antu.io.vocabulary import Vocabulary\n'), ((579, 621), 'antu.io.token_indexers.single_id_token_indexer.SingleIdTokenIndexer', 'SingleIdTokenIndexer', (["['my_word', 'glove']"], {}), "(['my_word', 'glove'])\n", (599, ... |
import sys
import csv
from matplotlib import image as mpimg
import numpy as np
import scipy.misc
import cv2
vert_filename = sys.argv[1]
edge_filename = sys.argv[2]
img_filename = sys.argv[3]
output_img_filename = sys.argv[4]
thresh = int(sys.argv[5])
print('reading in verts...')
verts = []
with open(vert_filename, '... | [
"cv2.imwrite",
"matplotlib.image.imread",
"numpy.asarray",
"csv.reader"
] | [((815, 841), 'matplotlib.image.imread', 'mpimg.imread', (['img_filename'], {}), '(img_filename)\n', (827, 841), True, 'from matplotlib import image as mpimg\n'), ((986, 1004), 'numpy.asarray', 'np.asarray', (['output'], {}), '(output)\n', (996, 1004), True, 'import numpy as np\n'), ((1662, 1702), 'cv2.imwrite', 'cv2.i... |
from __future__ import (division, print_function, absolute_import)
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import scipy.integrate as integrate
import scipy.optimize as optimize
from datetime import datetime
from elecsus.goal_functions import *
import time
import sys... | [
"numpy.radians",
"time.clock",
"scipy.optimize.differential_evolution",
"numpy.argmax",
"numpy.array",
"numpy.linspace",
"numpy.dot",
"numpy.array_equal",
"numpy.cos",
"numpy.concatenate",
"numpy.sin",
"elecsus.elecsus_methods_NEW.calculate",
"numpy.round"
] | [((1844, 1863), 'numpy.array', 'np.array', (['[1, 0, 0]'], {}), '([1, 0, 0])\n', (1852, 1863), True, 'import numpy as np\n'), ((2152, 2179), 'numpy.array', 'np.array', (['(J_out * E_out[:2])'], {}), '(J_out * E_out[:2])\n', (2160, 2179), True, 'import numpy as np\n'), ((5867, 5895), 'numpy.round', 'np.round', (['params... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sqlite3 as lite
import sys
from datetime import datetime, timedelta
con = None
try:
con = lite.connect('temperature.db', detect_types=lite.PARSE_DECLTYPES)
cur = con.cursor()
cur.execute('SELECT SQLITE_VERSION()')
data = cur.fetchone()
pr... | [
"datetime.datetime.strptime",
"sqlite3.connect",
"sys.exit"
] | [((151, 216), 'sqlite3.connect', 'lite.connect', (['"""temperature.db"""'], {'detect_types': 'lite.PARSE_DECLTYPES'}), "('temperature.db', detect_types=lite.PARSE_DECLTYPES)\n", (163, 216), True, 'import sqlite3 as lite\n'), ((1594, 1605), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1602, 1605), False, 'import sys... |
#! /usr/bin/env python3
"""
usage: bactopia citations [-h] [--bactopia STR] [--version] STR
bactopia citations - Prints the citations of datasets and tools used by Bactopia
optional arguments:
-h, --help show this help message and exit
--bactopia STR Directory where Bactopia repository is stored.
--versio... | [
"os.path.exists",
"argparse.ArgumentParser",
"yaml.safe_load",
"textwrap.fill",
"sys.exit"
] | [((1397, 1569), 'argparse.ArgumentParser', 'ap.ArgumentParser', ([], {'prog': 'PROGRAM', 'conflict_handler': '"""resolve"""', 'description': 'f"""{PROGRAM} (v{VERSION}) - {DESCRIPTION}"""', 'formatter_class': 'ap.RawDescriptionHelpFormatter'}), "(prog=PROGRAM, conflict_handler='resolve', description=\n f'{PROGRAM} (... |
import torch
from hypothesis import given
from hypothesis import strategies as st
from subset_samplers import ConstructiveRandomSampler
from subset_samplers import ExhaustiveSubsetSampler
from subset_samplers import ProportionalConstructiveRandomSampler
from subset_samplers import RandomProportionSubsetSampler
from su... | [
"subset_samplers.ConstructiveRandomSampler",
"subset_samplers.ProportionalConstructiveRandomSampler",
"hypothesis.strategies.integers",
"hypothesis.strategies.data",
"hypothesis.strategies.floats",
"subset_samplers.RandomSubsetSampler",
"subset_samplers.ExhaustiveSubsetSampler",
"tensor_ops.compute_su... | [((677, 686), 'hypothesis.strategies.data', 'st.data', ([], {}), '()\n', (684, 686), True, 'from hypothesis import strategies as st\n'), ((1029, 1038), 'hypothesis.strategies.data', 'st.data', ([], {}), '()\n', (1036, 1038), True, 'from hypothesis import strategies as st\n'), ((1671, 1696), 'subset_samplers.ExhaustiveS... |
from typing import Optional, Union, List, Type
from rest_framework import serializers
from django_basket.models import get_basket_model, BaseBasket
from django_basket.models.item import DynamicBasketItem
from ..settings import basket_settings
from ..utils import load_module
def get_basket_item_serializer_class() ->... | [
"django_basket.models.get_basket_model",
"rest_framework.serializers.SerializerMethodField"
] | [((1514, 1563), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {'read_only': '(True)'}), '(read_only=True)\n', (1547, 1563), False, 'from rest_framework import serializers\n'), ((1975, 2024), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethod... |
import logging
from sym_api_client_python.clients.sym_bot_client import SymBotClient
from sym_api_client_python.listeners.im_listener import IMListener
from sym_api_client_python.processors.sym_message_parser import SymMessageParser
class IMListenerImpl(IMListener):
def __init__(self, sym_bot_client):
sel... | [
"logging.debug",
"sym_api_client_python.processors.sym_message_parser.SymMessageParser"
] | [((380, 398), 'sym_api_client_python.processors.sym_message_parser.SymMessageParser', 'SymMessageParser', ([], {}), '()\n', (396, 398), False, 'from sym_api_client_python.processors.sym_message_parser import SymMessageParser\n'), ((455, 491), 'logging.debug', 'logging.debug', (['"""IM Message Received"""'], {}), "('IM ... |
import sys
sys.setrecursionlimit(20000) # to allow the e2wrn28_10R model to be exported as a torch.nn.Module
import os.path
from typing import Tuple
import torch.nn.functional as F
from e2cnn import nn
from e2cnn import gspaces
from e2cnn.nn import init
import torch
import math
import numpy as np
STORE_PATH = "./mo... | [
"sys.setrecursionlimit",
"e2cnn.gspaces.Rot2dOnR2",
"e2cnn.nn.RestrictionModule",
"e2cnn.nn.GroupPooling",
"e2cnn.nn.ReLU",
"e2cnn.nn.DisentangleModule",
"e2cnn.nn.R2Conv",
"e2cnn.nn.init.deltaorthonormal_init",
"e2cnn.nn.SequentialModule",
"math.sqrt",
"torch.nn.functional.avg_pool2d",
"e2cnn... | [((11, 39), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(20000)'], {}), '(20000)\n', (32, 39), False, 'import sys\n'), ((645, 808), 'e2cnn.nn.R2Conv', 'nn.R2Conv', (['in_type', 'out_type', '(7)'], {'stride': 'stride', 'padding': 'padding', 'dilation': 'dilation', 'bias': 'bias', 'sigma': 'sigma', 'frequencies_... |
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-Sdstor
GUID : afe654eb-0a83-4eb4-948f-d4510ec39c30
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import Sid
from etl.pars... | [
"construct.Bytes",
"construct.Struct",
"etl.parsers.etw.core.guid"
] | [((968, 1033), 'construct.Struct', 'Struct', (["('PackedCommandCount' / Int32ul)", "('NumIrpsPacked' / Int32ul)"], {}), "('PackedCommandCount' / Int32ul, 'NumIrpsPacked' / Int32ul)\n", (974, 1033), False, 'from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32... |
# python3 imports
from os.path import abspath, dirname, join
from sys import path as python_path
from unittest import TestCase
from re import compile
# determine where we are running (needed to patch PYTHON_PATH)
TEST_CASE_PATH = abspath( __file__ )
TEST_CASE_DIRECTORY = dirname( TEST_CASE_PATH )
PROJECT_ROOT_DIRECTOR... | [
"os.path.exists",
"sys.path.insert",
"wintersdeep_postcode.postcode_parser.PostcodeParser",
"re.compile",
"wintersdeep_postcode.postcode_parser.PostcodeParser._build_input_translater",
"os.path.join",
"unittest.main",
"os.path.dirname",
"wintersdeep_postcode.postcode_parser.PostcodeParser._get_white... | [((231, 248), 'os.path.abspath', 'abspath', (['__file__'], {}), '(__file__)\n', (238, 248), False, 'from os.path import abspath, dirname, join\n'), ((273, 296), 'os.path.dirname', 'dirname', (['TEST_CASE_PATH'], {}), '(TEST_CASE_PATH)\n', (280, 296), False, 'from os.path import abspath, dirname, join\n'), ((333, 364), ... |
import tensorflow as tf
import numpy as np
def batches(l, n):
"""Yield successive n-sized batches from l, the last batch is the left indexes."""
for i in range(0, l, n):
yield range(i,min(l,i+n))
class Deep_Autoencoder(object):
def __init__(self, sess, input_dim_list=[7,64,64,7],transfer_function... | [
"numpy.sqrt",
"tensorflow.transpose",
"tensorflow.placeholder",
"tensorflow.global_variables_initializer",
"tensorflow.random_uniform",
"numpy.negative",
"tensorflow.matmul",
"tensorflow.subtract",
"tensorflow.train.AdamOptimizer"
] | [((1466, 1518), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, self.dim_list[0]]'], {}), '(tf.float32, [None, self.dim_list[0]])\n', (1480, 1518), True, 'import tensorflow as tf\n'), ((2317, 2350), 'tensorflow.global_variables_initializer', 'tf.global_variables_initializer', ([], {}), '()\n', (2348... |
from pymilvus_orm import *
# from milvus_tool.config import MILVUS_HOST, MILVUS_PORT, schema, index_param
from milvus_tool.config import *
class VecToMilvus():
def __init__(self):
try:
connections.connect(host=MILVUS_HOST, port=MILVUS_PORT)
collection = None
except Except... | [
"random.random",
"random.randint"
] | [((3593, 3616), 'random.randint', 'random.randint', (['(0)', '(1000)'], {}), '(0, 1000)\n', (3607, 3616), False, 'import random\n'), ((3657, 3672), 'random.random', 'random.random', ([], {}), '()\n', (3670, 3672), False, 'import random\n')] |
#!/usr/bin/env python3
'''
This Script Loads the Existing Scenario and Run the Simultaenous Throughput over time and Generate Report and Plot the Graph
This Scrip has three classes :
1. LoadScenario : It will load the existing saved scenario to the Lanforge (Here used for Loading Bridged VAP)
2... | [
"bokeh.io.show",
"bokeh.plotting.figure",
"argparse.ArgumentParser",
"paramiko.SSHClient",
"paramiko.AutoAddPolicy",
"bokeh.models.Range1d",
"time.sleep",
"bokeh.models.LinearAxis",
"realm.Realm",
"logging.exception",
"datetime.datetime.now",
"time.time",
"sys.path.append",
"xlsxwriter.Wor... | [((1481, 1510), 'sys.path.append', 'sys.path.append', (['"""../py-json"""'], {}), "('../py-json')\n", (1496, 1510), False, 'import sys\n'), ((4043, 4068), 'xlsxwriter.Workbook', 'xlsxwriter.Workbook', (['name'], {}), '(name)\n', (4062, 4068), False, 'import xlsxwriter\n'), ((5808, 5848), 'bokeh.plotting.figure', 'figur... |
#!/usr/bin/env python3
import os, platform, shutil, sys, subprocess
from distutils.command.bdist import bdist as _bdist
from distutils.command.sdist import sdist as _sdist
from distutils.command.build import build as _build
from distutils.command.clean import clean as _clean
from setuptools.command.egg_info import egg... | [
"plumbum.local.cwd",
"distutils.command.clean.clean.run",
"distutils.command.sdist.sdist.finalize_options",
"distutils.command.build.build.initialize_options",
"setuptools.find_packages",
"os.getcwd",
"setuptools.command.egg_info.egg_info.initialize_options",
"os.path.dirname",
"distutils.command.bd... | [((546, 557), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (555, 557), False, 'import os, platform, shutil, sys, subprocess\n'), ((940, 956), 'distutils.command.clean.clean.run', '_clean.run', (['self'], {}), '(self)\n', (950, 956), True, 'from distutils.command.clean import clean as _clean\n'), ((965, 990), 'shutil.rmt... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pyatv/protocols/mrp/protobuf/SendButtonEventMessage.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.p... | [
"google.protobuf.descriptor_pool.Default",
"google.protobuf.reflection.GeneratedProtocolMessageType",
"google.protobuf.symbol_database.Default",
"pyatv.protocols.mrp.protobuf.ProtocolMessage_pb2.ProtocolMessage.RegisterExtension"
] | [((520, 546), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (544, 546), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((1338, 1548), 'google.protobuf.reflection.GeneratedProtocolMessageType', '_reflection.GeneratedProtocolMessageType', (['"""SendB... |
import random
random.seed(666)
import dynet as dy
import numpy as np
np.random.seed(666)
import heapq
from utils.helper import *
class LSTMDecoder(object):
def __init__(self, model, x_dims, h_dims, ccg_dims, LSTMBuilder, n_tag):
pc = model.add_subcollection()
input_dim = x_dims + ccg_dims
#... | [
"dynet.pickneglogsoftmax_batch",
"dynet.lookup_batch",
"dynet.inputTensor",
"numpy.array",
"dynet.esum",
"dynet.pick_batch",
"dynet.cmult",
"dynet.softmax",
"numpy.random.binomial",
"numpy.reshape",
"numpy.max",
"numpy.exp",
"numpy.random.seed",
"dynet.concatenate_cols",
"numpy.argmax",
... | [((14, 30), 'random.seed', 'random.seed', (['(666)'], {}), '(666)\n', (25, 30), False, 'import random\n'), ((69, 88), 'numpy.random.seed', 'np.random.seed', (['(666)'], {}), '(666)\n', (83, 88), True, 'import numpy as np\n'), ((1234, 1287), 'numpy.reshape', 'np.reshape', (['masks_batch', '(mask_dim[0] * mask_dim[1],)']... |
from medcon.medcon import Medcon
def main():
chris_app = Medcon()
chris_app.launch()
if __name__ == "__main__":
main()
| [
"medcon.medcon.Medcon"
] | [((63, 71), 'medcon.medcon.Medcon', 'Medcon', ([], {}), '()\n', (69, 71), False, 'from medcon.medcon import Medcon\n')] |
"""unit tests for utils.py"""
import os
from xdfile import utils
TEST_DIRECTORY = os.path.abspath(os.path.dirname(__file__))
def test_find_files():
mygen = utils.find_files(TEST_DIRECTORY)
for fullfn, contents in mygen:
# It should throw out anything starting with '.'
assert not fullfn.start... | [
"os.path.dirname",
"xdfile.utils.find_files"
] | [((100, 125), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (115, 125), False, 'import os\n'), ((164, 196), 'xdfile.utils.find_files', 'utils.find_files', (['TEST_DIRECTORY'], {}), '(TEST_DIRECTORY)\n', (180, 196), False, 'from xdfile import utils\n')] |
# %% Packages
import os
os.chdir('/Users/czarrar/Dropbox/Circle/Jerb/recipe_rec/scripts')
import recipe_rec
import importlib
recipe_rec = importlib.reload(recipe_rec)
# %% Read in ingredients
recipe_file = '../data/30_ingredients+ave_ratings.csv'
recs = recipe_rec.RecipeRec()
recs.load_from_csv(recipe_file, index_col... | [
"recipe_rec.RecipeRec",
"os.chdir",
"importlib.reload",
"numpy.all",
"recipe_rec.RecipeRec.load_model"
] | [((24, 89), 'os.chdir', 'os.chdir', (['"""/Users/czarrar/Dropbox/Circle/Jerb/recipe_rec/scripts"""'], {}), "('/Users/czarrar/Dropbox/Circle/Jerb/recipe_rec/scripts')\n", (32, 89), False, 'import os\n'), ((139, 167), 'importlib.reload', 'importlib.reload', (['recipe_rec'], {}), '(recipe_rec)\n', (155, 167), False, 'impo... |
from typing import Union
from functools import lru_cache
import torch
import os.path
class DiagonaledMM(torch.autograd.Function):
'''Class to encapsulate tvm code for compiling a diagonal_mm function, in addition to calling
this function from PyTorch
'''
function_dict = {} # save a list of function... | [
"tvm.create_schedule",
"tvm.compute",
"tvm.module.load",
"torch.stack",
"tvm.var",
"tvm.thread_axis",
"tvm.all",
"tvm.build",
"torch.zeros",
"tvm.contrib.nvcc.compile_cuda",
"tvm.contrib.dlpack.to_pytorch_func",
"tvm.reduce_axis",
"functools.lru_cache",
"tvm.lower",
"tvm.placeholder"
] | [((15719, 15730), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (15728, 15730), False, 'from functools import lru_cache\n'), ((1367, 1379), 'tvm.var', 'tvm.var', (['"""b"""'], {}), "('b')\n", (1374, 1379), False, 'import tvm\n'), ((1406, 1418), 'tvm.var', 'tvm.var', (['"""n"""'], {}), "('n')\n", (1413, 1418), F... |
from cms.cms_menus import CMSMenu
from cms.models import Page
from menus.base import Modifier
from menus.menu_pool import menu_pool
# Menu nodes which represent real CMS Page objects (vs. some node
# synthesized by a CMS app, such as a "page" for items in a FAQ
# category) have this namespace.
CMS_PAGE_NODE_NAMESPACE ... | [
"cms.models.Page.objects.get",
"menus.menu_pool.menu_pool.register_modifier"
] | [((985, 1034), 'menus.menu_pool.menu_pool.register_modifier', 'menu_pool.register_modifier', (['AddIconNameExtension'], {}), '(AddIconNameExtension)\n', (1012, 1034), False, 'from menus.menu_pool import menu_pool\n'), ((584, 612), 'cms.models.Page.objects.get', 'Page.objects.get', ([], {'pk': 'node.id'}), '(pk=node.id)... |
import random
loc = 0
HOME = 100
S1H = 98
S1T = 22
S2H = 76
S2T = 62
L1S = 5
L1E = 75
L2S = 24
L2E = 38
COUNTER = 0
while 1:
#print('Press Any Key to dice! ')
input('Press Any Key to dice! ')
r = random.randrange(1,7)
loc = loc + r
if loc == S1H:
print('Ohh... big snake!!')
loc = S1T
elif loc == S2H:... | [
"random.randrange"
] | [((207, 229), 'random.randrange', 'random.randrange', (['(1)', '(7)'], {}), '(1, 7)\n', (223, 229), False, 'import random\n')] |
# import packages here
import copy
import cv2
import numpy as np
import matplotlib.pyplot as plt
import glob
import random
import time
import torch
import torchvision
import torchvision.transforms as transforms
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
# my imports
fro... | [
"torch.nn.Dropout",
"torch.nn.CrossEntropyLoss",
"numpy.hstack",
"torch.LongTensor",
"torch.max",
"torch.from_numpy",
"numpy.array",
"torch.cuda.is_available",
"matplotlib.pyplot.imshow",
"torch.nn.BatchNorm2d",
"numpy.flip",
"numpy.reshape",
"torch.set_grad_enabled",
"numpy.asarray",
"n... | [((7361, 7367), 'time.time', 'time', ([], {}), '()\n', (7365, 7367), False, 'from time import time\n'), ((7465, 7471), 'time.time', 'time', ([], {}), '()\n', (7469, 7471), False, 'from time import time\n'), ((11884, 11890), 'time.time', 'time', ([], {}), '()\n', (11888, 11890), False, 'from time import time\n'), ((1196... |
"""
Base Model for different segmentation backbone encoders and decoders
This is inspired by https://github.com/qubvel/segmentation_models/blob/master/examples/binary%20segmentation%20(camvid).ipynb & modified to suit my requirements
"""
import segmentation_models as sm
import keras
import os
import json
class Mod... | [
"keras.optimizers.Adam",
"segmentation_models.metrics.FScore",
"segmentation_models.metrics.IOUScore",
"segmentation_models.losses.DiceLoss",
"os.path.dirname",
"segmentation_models.losses.BinaryFocalLoss",
"segmentation_models.losses.CategoricalFocalLoss",
"json.load",
"segmentation_models.Unet"
] | [((1528, 1548), 'segmentation_models.losses.DiceLoss', 'sm.losses.DiceLoss', ([], {}), '()\n', (1546, 1548), True, 'import segmentation_models as sm\n'), ((3441, 3557), 'segmentation_models.Unet', 'sm.Unet', (['self.backbone'], {'classes': 'self.n_classes', 'activation': 'self.activation', 'input_shape': '(self.h, self... |
from conans import ConanFile, tools
import os
required_conan_version = ">=1.33.0"
class BitmagicConan(ConanFile):
name = "bitmagic"
description = "BitMagic Library helps to develop high-throughput intelligent search systems, " \
"promote combination of hardware optimizations and on the fly ... | [
"conans.tools.check_min_cppstd",
"conans.tools.get",
"os.path.join"
] | [((1180, 1291), 'conans.tools.get', 'tools.get', ([], {'destination': 'self._source_subfolder', 'strip_root': '(True)'}), "(**self.conan_data['sources'][self.version], destination=self.\n _source_subfolder, strip_root=True)\n", (1189, 1291), False, 'from conans import ConanFile, tools\n'), ((1057, 1089), 'conans.too... |
#!/usr/bin/env python3
from dataclasses import dataclass, asdict
from termux_hardware_stats.stats import termux_cpu, termux_mem
import argparse
import ujson as json
def run():
# create the top-level parser
parser = argparse.ArgumentParser(prog='Termux Hardware Stats')
subparsers = parser.add_subparser... | [
"termux_hardware_stats.stats.termux_mem.MemInfoReader",
"termux_hardware_stats.stats.termux_cpu.CPUGlobalStateReader",
"argparse.ArgumentParser",
"termux_hardware_stats.stats.termux_cpu.CPUFrequencyReader"
] | [((229, 282), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""Termux Hardware Stats"""'}), "(prog='Termux Hardware Stats')\n", (252, 282), False, 'import argparse\n'), ((1047, 1081), 'termux_hardware_stats.stats.termux_cpu.CPUGlobalStateReader', 'termux_cpu.CPUGlobalStateReader', (['(8)'], {}), ... |
from time import time
import os
from random import gauss
import sys
import numpy as np
from keras.models import Sequential, load_model
from keras.layers import Dense, Activation
from Bio.SeqIO import SeqRecord
from Bio import SeqIO, Seq
from advntr.sam_utils import get_id_of_reads_mapped_to_vntr_in_bamfile, make_bam... | [
"blast_wrapper.get_blast_matched_ids",
"advntr.sam_utils.get_id_of_reads_mapped_to_vntr_in_bamfile",
"Bio.Seq.Seq",
"numpy.array",
"advntr.advntr_commands.get_tested_vntrs",
"keras.layers.Activation",
"keras.layers.Dense",
"os.path.exists",
"Bio.SeqIO.write",
"advntr.models.load_unique_vntrs_data"... | [((3485, 3502), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (3496, 3502), False, 'import random\n'), ((5971, 6039), 'blast_wrapper.make_blast_database', 'make_blast_database', (['fasta_file', "(blast_dir + 'blast_db_%s' % vntr_id)"], {}), "(fasta_file, blast_dir + 'blast_db_%s' % vntr_id)\n", (5990, 6039)... |
from __future__ import absolute_import, division, print_function, unicode_literals
import torch
def is_available():
return hasattr(torch._C, "_c10d_init")
if is_available() and not torch._C._c10d_init():
raise RuntimeError("Failed to initialize torch.distributed")
if is_available():
from .distributed... | [
"torch._C._c10d_init"
] | [((190, 211), 'torch._C._c10d_init', 'torch._C._c10d_init', ([], {}), '()\n', (209, 211), False, 'import torch\n')] |
# coding=utf-8
# Copyright 2018 Google LLC & <NAME>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"six.add_metaclass",
"tensorflow.contrib.tpu.TPUEstimator"
] | [((837, 867), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (854, 867), False, 'import six\n'), ((1326, 1447), 'tensorflow.contrib.tpu.TPUEstimator', 'tf.contrib.tpu.TPUEstimator', ([], {'config': 'run_config', 'use_tpu': 'use_tpu', 'model_fn': 'self.model_fn', 'train_batch_size': ... |
from tensorflow.keras.models import load_model
from time import sleep
from keras.preprocessing.image import img_to_array
from keras.preprocessing import image
import cv2
import numpy as np
import os
from mtcnn import MTCNN
# Importing the MTCNN detector to detect faces
detector = MTCNN()
# Path to the emotion detecti... | [
"cv2.rectangle",
"keras.preprocessing.image.img_to_array",
"mtcnn.MTCNN",
"os.path.join",
"cv2.putText",
"numpy.sum",
"tensorflow.keras.models.load_model",
"cv2.VideoCapture",
"cv2.VideoWriter_fourcc",
"cv2.cvtColor",
"numpy.expand_dims",
"cv2.resize"
] | [((282, 289), 'mtcnn.MTCNN', 'MTCNN', ([], {}), '()\n', (287, 289), False, 'from mtcnn import MTCNN\n'), ((342, 381), 'os.path.join', 'os.path.join', (['"""model"""', '"""accuracy_80.h5"""'], {}), "('model', 'accuracy_80.h5')\n", (354, 381), False, 'import os\n'), ((393, 415), 'tensorflow.keras.models.load_model', 'loa... |
import re
from passwdformats import FILE_FORMAT # FILE_FORMAT['smbpasswd'] = ['name', 'uid', 'LM_hash', 'NTLM_hash', 'Account Flags', 'Last Change Time']
file = 'target.passwd'
file_format = 'custom'
userlist = {}
pattern = r'(.*)(:)(.*)(:)(.*)(:)(.*)(:)(.*)(:)'
f = open(file)
for line in f:
match = re.match(patt... | [
"re.match"
] | [((307, 330), 're.match', 're.match', (['pattern', 'line'], {}), '(pattern, line)\n', (315, 330), False, 'import re\n')] |
from collections import defaultdict
import discord
from discord.ext import commands
from discord.ext.commands import Command
from sqlalchemy import select
from common import conf, db
from common.db import session
from common.logging import logger
from datamodels import Base
from datamodels.guild_settings import Guild... | [
"datamodels.Base.metadata.create_all",
"utils.unified_context.UnifiedContext",
"scheduling.dispatcher.Dispatcher",
"discord.Game",
"discord.ext.commands.Bot",
"discord.ext.commands.Command",
"discord.ext.commands.when_mentioned",
"common.logging.logger.exception",
"collections.defaultdict",
"sqlal... | [((524, 560), 'collections.defaultdict', 'defaultdict', (['(lambda : DEFAULT_PREFIX)'], {}), '(lambda : DEFAULT_PREFIX)\n', (535, 560), False, 'from collections import defaultdict\n'), ((848, 887), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': 'get_prefix'}), '(command_prefix=get_prefix)\n', (860,... |
#
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# 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, merge,... | [
"os.path.join",
"gt4sd.training_pipelines.TRAINING_PIPELINE_MAPPING.get",
"pkg_resources.resource_filename",
"tempfile.mkdtemp",
"shutil.rmtree"
] | [((1377, 1446), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""gt4sd"""', '"""training_pipelines/tests/"""'], {}), "('gt4sd', 'training_pipelines/tests/')\n", (1408, 1446), False, 'import pkg_resources\n'), ((1801, 1855), 'gt4sd.training_pipelines.TRAINING_PIPELINE_MAPPING.get', 'TRAINING_P... |
#! /usr/bin/python3
import os
import random
from gi.repository import Gio
class wallpaperChanger(object):
settings = {"background": "org.gnome.desktop.background",
"locksreen" : "org.gnome.desktop.screensaver"}
def __init__(self, folder=None, user=None, setting="background"):
self.folde... | [
"random.choice",
"os.listdir",
"gi.repository.Gio.Settings.new",
"os.path.join",
"os.path.expanduser"
] | [((385, 425), 'gi.repository.Gio.Settings.new', 'Gio.Settings.new', (['self.settings[setting]'], {}), '(self.settings[setting])\n', (401, 425), False, 'from gi.repository import Gio\n'), ((692, 715), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (710, 715), False, 'import os\n'), ((828, 851)... |
import discord
from discord.ext import commands
import requests
from box import Box
from core.paginator import EmbedPaginatorSession
class RedditScroller(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(aliases = ['memescroll'])
async def memescroller(self, ctx, max=30):... | [
"requests.get",
"box.Box",
"core.paginator.EmbedPaginatorSession",
"discord.Embed",
"discord.ext.commands.command"
] | [((231, 271), 'discord.ext.commands.command', 'commands.command', ([], {'aliases': "['memescroll']"}), "(aliases=['memescroll'])\n", (247, 271), False, 'from discord.ext import commands\n'), ((714, 855), 'requests.get', 'requests.get', (['f"""https://api.reddit.com/r/{subreddit}/top.json?sort=top&t=day&limit={max}"""']... |
import tempfile
import sys
sys.path.append('../../ts_scripts')
from ts_scripts.shell_utils import rm_dir, rm_file, download_save
import os
import shutil
import subprocess
TMP_DIR = tempfile.gettempdir()
rm_file("torchhub.zip")
rm_dir(os.path.join(TMP_DIR, "DeepLearningExamples-torchhub"))
rm_dir("PyTorch")
download_sa... | [
"ts_scripts.shell_utils.rm_dir",
"shutil.make_archive",
"subprocess.run",
"os.path.join",
"tempfile.gettempdir",
"ts_scripts.shell_utils.download_save",
"ts_scripts.shell_utils.rm_file",
"sys.path.append"
] | [((27, 62), 'sys.path.append', 'sys.path.append', (['"""../../ts_scripts"""'], {}), "('../../ts_scripts')\n", (42, 62), False, 'import sys\n'), ((182, 203), 'tempfile.gettempdir', 'tempfile.gettempdir', ([], {}), '()\n', (201, 203), False, 'import tempfile\n'), ((204, 227), 'ts_scripts.shell_utils.rm_file', 'rm_file', ... |
from panda3d.core import Vec3, NodePath, LineSegs, Vec4, Shader
from panda3d.core import OmniBoundingVolume, Mat4
from panda3d.core import PTAInt
from Code.LightType import LightType
from Code.DebugObject import DebugObject
from Code.ShaderStructArray import ShaderStructElement
class Light(ShaderStructElement):
... | [
"panda3d.core.PTAInt.emptyArray",
"panda3d.core.NodePath",
"panda3d.core.Vec4",
"panda3d.core.LineSegs",
"panda3d.core.Mat4",
"panda3d.core.OmniBoundingVolume",
"panda3d.core.Vec3",
"Code.DebugObject.DebugObject.__init__",
"Code.ShaderStructArray.ShaderStructElement.__init__"
] | [((632, 675), 'Code.DebugObject.DebugObject.__init__', 'DebugObject.__init__', (['self', '"""AbstractLight"""'], {}), "(self, 'AbstractLight')\n", (652, 675), False, 'from Code.DebugObject import DebugObject\n'), ((684, 718), 'Code.ShaderStructArray.ShaderStructElement.__init__', 'ShaderStructElement.__init__', (['self... |
'''
Runs the XYZA axes for 24-hours, and every 10 cycles will test to see if
any of the axes have skipped by >0.5 mm
Run through an SSH session by calling with "nohup" to keep it running after
disconnecting the terminal
Example of calling this script:
nohup python -m opentrons.tools.overnight_test &
'''
import... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.Formatter",
"logging.FileHandler",
"time.time"
] | [((905, 933), 'logging.getLogger', 'logging.getLogger', (['"""qc-test"""'], {}), "('qc-test')\n", (922, 933), False, 'import logging\n'), ((1035, 1069), 'logging.FileHandler', 'logging.FileHandler', (['"""qc-test.log"""'], {}), "('qc-test.log')\n", (1054, 1069), False, 'import logging\n'), ((1163, 1186), 'logging.Strea... |
# Credit for this code goes to "natbett" of the Raspberry Pi Forum 18/02/13
# Editied by <NAME> for full-stack-chess program
from lcddriver import i2c_lib
from time import *
from multiprocessing import Process, Manager
import ctypes
import sys
# LCD Address
# Usually you will have to use one of the two provided valu... | [
"multiprocessing.Manager",
"multiprocessing.Process",
"lcddriver.i2c_lib.i2c_device"
] | [((1553, 1580), 'lcddriver.i2c_lib.i2c_device', 'i2c_lib.i2c_device', (['ADDRESS'], {}), '(ADDRESS)\n', (1571, 1580), False, 'from lcddriver import i2c_lib\n'), ((1605, 1614), 'multiprocessing.Manager', 'Manager', ([], {}), '()\n', (1612, 1614), False, 'from multiprocessing import Process, Manager\n'), ((2149, 2174), '... |