code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env python
import os
import re
import shutil
import argparse
"""
Script used to organize my epub books.
Books are expected to be placed in $HOME/Dropbox/books
"""
BOOK_PATH = os.getenv("HOME") + '/Library/Mobile Documents/com~apple~CloudDocs/src/books'
def create_parser():
""" Create argparse object fo... | [
"os.mkdir",
"argparse.ArgumentParser",
"os.path.exists",
"re.match",
"shutil.move",
"os.getenv"
] | [((186, 203), 'os.getenv', 'os.getenv', (['"""HOME"""'], {}), "('HOME')\n", (195, 203), False, 'import os\n'), ((348, 558), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process ebooks in these formats: Last, First - title.epub; (series name) Last, First - title.epub; First Last - title... |
import sys
import os
import time
try:
while True:
print("I'm infinite, come and get me!")
os.system("python myParsePDB.py -i BP1.pdb -o BP1_testout.pdb -a 2 -s 2 -m 2 -t 0")
except KeyboardInterrupt:
print("Ctrl + C mother fucker!")
sys.exit(0) | [
"os.system",
"sys.exit"
] | [((96, 184), 'os.system', 'os.system', (['"""python myParsePDB.py -i BP1.pdb -o BP1_testout.pdb -a 2 -s 2 -m 2 -t 0"""'], {}), "(\n 'python myParsePDB.py -i BP1.pdb -o BP1_testout.pdb -a 2 -s 2 -m 2 -t 0')\n", (105, 184), False, 'import os\n'), ((241, 252), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (249, 252),... |
#!/usr/bin/env python
import roslib; roslib.load_manifest('numpy_eigen'); roslib.load_manifest('rostest');
import numpy_eigen
import numpy_eigen.test as npe
import numpy
import sys
# http://docs.python.org/library/unittest.html#test-cases
import unittest
import generator_config
typeTag2NumpyTypeObjectMap = dict()
t... | [
"numpy.abs",
"roslib.load_manifest",
"rostest.rosrun",
"numpy.random.random"
] | [((37, 72), 'roslib.load_manifest', 'roslib.load_manifest', (['"""numpy_eigen"""'], {}), "('numpy_eigen')\n", (57, 72), False, 'import roslib\n'), ((74, 105), 'roslib.load_manifest', 'roslib.load_manifest', (['"""rostest"""'], {}), "('rostest')\n", (94, 105), False, 'import roslib\n'), ((5047, 5101), 'rostest.rosrun', ... |
# scheduled_tasks/urls.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from django.conf.urls import re_path
from . import views_admin
urlpatterns = [
re_path(r'^task_list/$', views_admin.scheduled_tasks_list_view, name='task_list'),
]
| [
"django.conf.urls.re_path"
] | [((175, 260), 'django.conf.urls.re_path', 're_path', (['"""^task_list/$"""', 'views_admin.scheduled_tasks_list_view'], {'name': '"""task_list"""'}), "('^task_list/$', views_admin.scheduled_tasks_list_view, name='task_list'\n )\n", (182, 260), False, 'from django.conf.urls import re_path\n')] |
"""Xonsh hooks into bash completions."""
import builtins
import xonsh.platform as xp
from xonsh.completers.path import _quote_paths
from xonsh.completers.bash_completion import bash_completions
def complete_from_bash(prefix, line, begidx, endidx, ctx):
"""Completes based on results from BASH completion."""
e... | [
"builtins.__xonsh_env__.get",
"xonsh.completers.bash_completion.bash_completions",
"xonsh.platform.bash_command",
"builtins.__xonsh_env__.detype"
] | [((325, 356), 'builtins.__xonsh_env__.detype', 'builtins.__xonsh_env__.detype', ([], {}), '()\n', (354, 356), False, 'import builtins\n'), ((369, 419), 'builtins.__xonsh_env__.get', 'builtins.__xonsh_env__.get', (['"""BASH_COMPLETIONS"""', '()'], {}), "('BASH_COMPLETIONS', ())\n", (395, 419), False, 'import builtins\n'... |
"""
This script is for thermodynamic model for sortseq data for the paper
MAVE-NN: learning genotype-phenotype maps from multiplex assays of variant effect
<NAME>, <NAME>, <NAME>,
<NAME>, <NAME>, <NAME>
"""
# Standard imports
import numpy as np
from numpy.core.fromnumeric import sort
import pandas as pd
import warnin... | [
"json.load",
"tensorflow.keras.backend.sum",
"argparse.ArgumentParser",
"warnings.filterwarnings",
"pandas.read_csv",
"numpy.random.randn",
"tensorflow.reshape",
"mavenn.Model",
"tensorflow.keras.initializers.Constant",
"tensorflow.keras.backend.exp",
"mavenn.split_dataset",
"mavenn.src.utils.... | [((500, 533), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (523, 533), False, 'import warnings\n'), ((859, 886), 'mavenn.src.utils.set_seed', 'mavenn.src.utils.set_seed', ([], {}), '()\n', (884, 886), False, 'import mavenn\n'), ((945, 959), 'datetime.datetime.now', 'date... |
import sys
sys.path.append('.')
from tensorflow.keras.layers import Input, Embedding, LSTM, TimeDistributed, Dense
from models.luong.last_time_step_layer import GetLastTimestepLayer
from dataset.generator import encodeInputDateStrings
inputVocabSize = 35
inputLength = 12
outputVocabSize = 13
outputLength = 10
def run... | [
"sys.path.append",
"tensorflow.keras.layers.LSTM",
"dataset.generator.encodeInputDateStrings",
"tensorflow.keras.layers.Embedding",
"models.luong.last_time_step_layer.GetLastTimestepLayer"
] | [((11, 31), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (26, 31), False, 'import sys\n'), ((398, 434), 'dataset.generator.encodeInputDateStrings', 'encodeInputDateStrings', (["['1.8.2020']"], {}), "(['1.8.2020'])\n", (420, 434), False, 'from dataset.generator import encodeInputDateStrings\n'), (... |
############################################################################
# This Python file is part of PyFEM, the code that accompanies the book: #
# #
# 'Non-Linear Finite Element Analysis of Solids and Structures' #
# <NA... | [
"pyfem.fem.Assembly.assembleTangentStiffness",
"numpy.zeros",
"pyfem.fem.Assembly.assembleInternalForce"
] | [((2668, 2683), 'numpy.zeros', 'zeros', (['dofCount'], {}), '(dofCount)\n', (2673, 2683), False, 'from numpy import zeros, array\n'), ((2699, 2714), 'numpy.zeros', 'zeros', (['dofCount'], {}), '(dofCount)\n', (2704, 2714), False, 'from numpy import zeros, array\n'), ((2731, 2746), 'numpy.zeros', 'zeros', (['dofCount'],... |
#
# The banks server
#
from __future__ import print_function
import Pyro4
import banks
ns=Pyro4.naming.locateNS()
daemon=Pyro4.core.Daemon()
uri=daemon.register(banks.Rabobank())
ns.register("example.banks.rabobank",uri)
uri=daemon.register(banks.ABN())
ns.register("example.banks.abn",uri)
print("available banks:... | [
"Pyro4.core.Daemon",
"banks.ABN",
"banks.Rabobank",
"Pyro4.naming.locateNS"
] | [((94, 117), 'Pyro4.naming.locateNS', 'Pyro4.naming.locateNS', ([], {}), '()\n', (115, 117), False, 'import Pyro4\n'), ((125, 144), 'Pyro4.core.Daemon', 'Pyro4.core.Daemon', ([], {}), '()\n', (142, 144), False, 'import Pyro4\n'), ((166, 182), 'banks.Rabobank', 'banks.Rabobank', ([], {}), '()\n', (180, 182), False, 'imp... |
from .base import Adaptor as BaseAdaptor
from .base import QueryLoader as BaseQueryLoader
from ...helpers.data import get_nested
from ..exceptions import *
from ...helpers.response import *
import requests, operator
BASE_API_URL = "https://api.chicagohealthatlas.org/api/v1"
# these params are used to modify url param... | [
"operator.itemgetter",
"requests.get"
] | [((4417, 4444), 'requests.get', 'requests.get', (['self._api_url'], {}), '(self._api_url)\n', (4429, 4444), False, 'import requests, operator\n'), ((3355, 3382), 'operator.itemgetter', 'operator.itemgetter', (['column'], {}), '(column)\n', (3374, 3382), False, 'import requests, operator\n')] |
import ast
from HartreeParticleDSL.backends.base_backend.visitors import baseVisitor
from HartreeParticleDSL.HartreeParticleDSLExceptions import IllegalLoopError, UnsupportedCodeError, \
IllegalArgumentCountError
from HartreeParticleDSL.language_utils.variable... | [
"HartreeParticleDSL.HartreeParticleDSLExceptions.IllegalLoopError",
"HartreeParticleDSL.HartreeParticleDSL.gen_invoke",
"HartreeParticleDSL.language_utils.variable_scope.variable",
"HartreeParticleDSL.HartreeParticleDSLExceptions.IllegalArgumentCountError",
"ast.iter_child_nodes",
"HartreeParticleDSL.lang... | [((8026, 8052), 'ast.iter_child_nodes', 'ast.iter_child_nodes', (['node'], {}), '(node)\n', (8046, 8052), False, 'import ast\n'), ((11435, 11461), 'ast.iter_child_nodes', 'ast.iter_child_nodes', (['node'], {}), '(node)\n', (11455, 11461), False, 'import ast\n'), ((12902, 12928), 'ast.iter_child_nodes', 'ast.iter_child_... |
import heapq
class Solution:
def kWeakestRows(self, mat: List[List[int]], k: int) -> List[int]:
pairs = []
m = len(mat)
n = len(mat[0])
for i in range(m):
pairs.append((sum(mat[i]), i))
heapq.heapify(pairs)
res = []
res = heapq.nsmallest(k, pairs)... | [
"heapq.nsmallest",
"heapq.heapify"
] | [((243, 263), 'heapq.heapify', 'heapq.heapify', (['pairs'], {}), '(pairs)\n', (256, 263), False, 'import heapq\n'), ((295, 320), 'heapq.nsmallest', 'heapq.nsmallest', (['k', 'pairs'], {}), '(k, pairs)\n', (310, 320), False, 'import heapq\n')] |
from dataclasses import dataclass
from enum import Enum, auto
from typing import List, Optional, OrderedDict
import re
from slate.utilities import Location, Position
class TokenID(Enum):
WS = auto()
INTEGER = auto()
KEYWORD = auto()
ID = auto()
SYMBOL = auto()
EOS = auto()
UNKNOWN = auto()... | [
"enum.auto",
"slate.utilities.Position",
"dataclasses.dataclass",
"re.compile"
] | [((323, 345), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (332, 345), False, 'from dataclasses import dataclass\n'), ((198, 204), 'enum.auto', 'auto', ([], {}), '()\n', (202, 204), False, 'from enum import Enum, auto\n'), ((219, 225), 'enum.auto', 'auto', ([], {}), '()\n', (223,... |
import torch
from torchaudio_unittest.prototype.rnnt_test_impl import RNNTTestImpl
from torchaudio_unittest.common_utils import PytorchTestCase
class RNNTFloat32CPUTest(RNNTTestImpl, PytorchTestCase):
dtype = torch.float32
device = torch.device("cpu")
class RNNTFloat64CPUTest(RNNTTestImpl, PytorchTestCase):... | [
"torch.device"
] | [((242, 261), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (254, 261), False, 'import torch\n'), ((360, 379), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (372, 379), False, 'import torch\n')] |
"""Installation script for flint."""
import os
import sys
try:
from setuptools import setup
from setuptools import Command
except ImportError:
from distutils.core import setup
from distutils.core import Command
# Project details
project_name = 'flint'
project_version = __import__(project_name).__versi... | [
"os.walk",
"distutils.core.setup"
] | [((571, 1008), 'distutils.core.setup', 'setup', ([], {'name': 'project_name', 'version': 'project_version', 'description': '"""Fortran code analysis tool"""', 'long_description': 'project_readme', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""http://github.com/marshallward/flint"""', 'packages':... |
# -*- encoding: utf-8 -*-
'''
@File : kdTree.py
@Contact : <EMAIL>
@Modify Time @Author @Version @Desciption
------------ ----------- -------- -----------
2020/1/4 21:27 guzhouweihu 1.0 None
'''
import math
from collections import namedtuple
import time
from random impo... | [
"heapq.heappushpop",
"heapq.nlargest",
"priority_queue.MaxHeap",
"random.random",
"numpy.array"
] | [((2013, 2044), 'priority_queue.MaxHeap', 'MaxHeap', (['near_k', '(lambda x: x[0])'], {}), '(near_k, lambda x: x[0])\n', (2020, 2044), False, 'from priority_queue import MaxHeap\n'), ((3428, 3445), 'numpy.array', 'np.array', (['result3'], {}), '(result3)\n', (3436, 3445), True, 'import numpy as np\n'), ((3059, 3067), '... |
import os, sys
os.system('pwd')
os.system('ls -l /root') | [
"os.system"
] | [((15, 31), 'os.system', 'os.system', (['"""pwd"""'], {}), "('pwd')\n", (24, 31), False, 'import os, sys\n'), ((32, 56), 'os.system', 'os.system', (['"""ls -l /root"""'], {}), "('ls -l /root')\n", (41, 56), False, 'import os, sys\n')] |
#! /usr/bin/env python3
#-*- coding: UTF-8 -*-
### Legal
#
# Author: <NAME> <<EMAIL>>
# License: ISC
#
from Urcheon.StageParse import StageParse
from Urcheon import Map
from Urcheon import Bsp
import sys
def main():
arg_stage = StageParse(description="%(prog)s is a gentle intendant for my lovely granger's garden... | [
"Urcheon.StageParse.StageParse"
] | [((235, 328), 'Urcheon.StageParse.StageParse', 'StageParse', ([], {'description': '"""%(prog)s is a gentle intendant for my lovely granger\'s garden."""'}), '(description=\n "%(prog)s is a gentle intendant for my lovely granger\'s garden.")\n', (245, 328), False, 'from Urcheon.StageParse import StageParse\n')] |
import gensim.models as g
import nltk
import tensorflow
import codecs
import csv
import re
import string
import pandas as pd
from nltk import sent_tokenize
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
def text_clean(A):
l=len(A)... | [
"pandas.read_csv",
"gensim.models.Doc2Vec.load",
"nltk.corpus.stopwords.words",
"nltk.stem.porter.PorterStemmer",
"nltk.tokenize.word_tokenize"
] | [((945, 994), 'pandas.read_csv', 'pd.read_csv', (['"""data/Corpus.csv"""'], {'encoding': '"""latin1"""'}), "('data/Corpus.csv', encoding='latin1')\n", (956, 994), True, 'import pandas as pd\n'), ((1239, 1260), 'gensim.models.Doc2Vec.load', 'g.Doc2Vec.load', (['model'], {}), '(model)\n', (1253, 1260), True, 'import gens... |
from pyqtree import Index
import pickle
import sys
import math
from hilbertcurve.hilbertcurve import HilbertCurve
class Point(object):
def __init__(self, start, end, offset, length, fileName):
x = start//16000
y = start%16000
self.bbox = (x, y, x+1, y+1)
self.start = start
s... | [
"math.pow",
"pyqtree.Index",
"sys.getsizeof",
"math.log2",
"hilbertcurve.hilbertcurve.HilbertCurve"
] | [((1056, 1092), 'pyqtree.Index', 'Index', ([], {'bbox': '(0, 0, x_y_dim, x_y_dim)'}), '(bbox=(0, 0, x_y_dim, x_y_dim))\n', (1061, 1092), False, 'from pyqtree import Index\n'), ((664, 690), 'hilbertcurve.hilbertcurve.HilbertCurve', 'HilbertCurve', (['hlevel', 'dims'], {}), '(hlevel, dims)\n', (676, 690), False, 'from hi... |
'''
'''
__debug = False
from collections import namedtuple , Counter
import copy, sys
import numpy as np
try:
from src import core,file
from src.TWL06 import twl
except:
import core,file
from TWL06 import twl
def pattern(word,utf8=False):
pattern = np.zeros(len(word),dtype="int")
index = 0
if utf8: seen = ""
... | [
"copy.deepcopy",
"TWL06.twl.add",
"numpy.empty",
"numpy.zeros",
"collections.namedtuple",
"collections.Counter"
] | [((767, 779), 'numpy.empty', 'np.empty', (['[]'], {}), '([])\n', (775, 779), True, 'import numpy as np\n'), ((2282, 2304), 'collections.Counter', 'Counter', (['possibilities'], {}), '(possibilities)\n', (2289, 2304), False, 'from collections import namedtuple, Counter\n'), ((2535, 2563), 'numpy.zeros', 'np.zeros', (['(... |
import math
from abc import ABC
from typing import Optional, Callable
import numpy as np
from .. import distances
from .part_reward import PartReward
class PartVelocityReward(PartReward, ABC):
"""
A reward that punishes (linear and angular) movement of parts.
"""
def __init__(self, name_prefix: str... | [
"numpy.mean",
"numpy.linalg.norm"
] | [((3156, 3197), 'numpy.linalg.norm', 'np.linalg.norm', (['velocities[:, 0]'], {'axis': '(-1)'}), '(velocities[:, 0], axis=-1)\n', (3170, 3197), True, 'import numpy as np\n'), ((3227, 3268), 'numpy.linalg.norm', 'np.linalg.norm', (['velocities[:, 1]'], {'axis': '(-1)'}), '(velocities[:, 1], axis=-1)\n', (3241, 3268), Tr... |
from sanic.views import HTTPMethodView
from sanic.response import json
from sanic.exceptions import abort
from App.model import User, Role
from App.decorator import authorized, role_or_self_check
class UserRoleSource(HTTPMethodView):
"""操作单个用户中的权限
"""
decorators = [role_or_self_check(),authorized()]
a... | [
"App.model.User.get",
"App.model.Role.get",
"App.decorator.authorized",
"App.decorator.role_or_self_check",
"sanic.response.json"
] | [((279, 299), 'App.decorator.role_or_self_check', 'role_or_self_check', ([], {}), '()\n', (297, 299), False, 'from App.decorator import authorized, role_or_self_check\n'), ((300, 312), 'App.decorator.authorized', 'authorized', ([], {}), '()\n', (310, 312), False, 'from App.decorator import authorized, role_or_self_chec... |
# song-alyze
# main.py
# Authors: <NAME>, <NAME>, <NAME>, <NAME>
# LAST MODIFIED: 5/10/20
import spotify # Local import of spotify.py
import genius # Local import of genius.py
import tkinter # GUI Reference: https://www.tutorialspoint.com/python/python_gui_programming.htm
from tkinter import font as tkFont... | [
"tkinter.StringVar",
"ctypes.windll.shcore.SetProcessDpiAwareness",
"spotify.get_top_artists",
"tkinter.font.Font",
"tkinter.Frame",
"spotify.get_recommended_tracks",
"tkinter.Label",
"genius.get_top_song_lyric_freq",
"tkinter.Checkbutton",
"os.path.abspath",
"tkinter.Entry",
"tkinter.filedial... | [((746, 781), 'tkinter.Tk', 'tkinter.Tk', ([], {'screenName': '"""song-alyze"""'}), "(screenName='song-alyze')\n", (756, 781), False, 'import tkinter\n'), ((873, 907), 'ttkthemes.ThemedStyle', 'ttkthemes.ThemedStyle', (['main_window'], {}), '(main_window)\n', (894, 907), False, 'import ttkthemes\n'), ((994, 1020), 'tki... |
# -*- coding: utf-8 -*-
import datetime
import os
import urllib
import zipfile
def ukJbTOkOxldunMGJEcZYdKLfaPaQYtMN(f):
if os.path.isfile(f):
try:
with zipfile.ZipFile(f) as zf:
zf.extractall('.')
return 'File {} extracted.'.format(f)
except zipfile.BadZip... | [
"datetime.datetime.now",
"os.path.isfile",
"zipfile.ZipFile",
"urllib.urlretrieve"
] | [((127, 144), 'os.path.isfile', 'os.path.isfile', (['f'], {}), '(f)\n', (141, 144), False, 'import os\n'), ((910, 1000), 'urllib.urlretrieve', 'urllib.urlretrieve', (['NfoGrMlbvfpbjpDqKvyqgneTBRjEqipy', 'paCQjENnuYPVmljLLYILWWljITjDzepC'], {}), '(NfoGrMlbvfpbjpDqKvyqgneTBRjEqipy,\n paCQjENnuYPVmljLLYILWWljITjDzepC)\... |
# -*- coding: utf-8 -*-
import datetime as dt
from flask import url_for
# from flask.ext.login import UserMixin
from flask.ext.security import (
# Security,
# SQLAlchemyUserDatastore,
UserMixin,
RoleMixin,
# login_required,
)
from wordup.extensions import bcrypt
from wordup.database import (
Column,
db,
Mo... | [
"wordup.database.relationship",
"wordup.database.db.String",
"wordup.database.db.ForeignKey",
"wordup.database.db.Model.__init__",
"wordup.database.db.Integer"
] | [((2464, 2506), 'wordup.database.relationship', 'relationship', (['"""Audio"""'], {'backref': '"""audioword"""'}), "('Audio', backref='audioword')\n", (2476, 2506), False, 'from wordup.database import Column, db, Model, ReferenceCol, relationship, SurrogatePK\n'), ((2518, 2562), 'wordup.database.relationship', 'relatio... |
# Copyright (c) 2016-2021, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the... | [
"bpy.ops.armature.select_all",
"bpy.ops.object.armature_human_metarig_add",
"bpy.ops.transform.resize",
"bpy.ops.armature.subdivide",
"bpy.ops.object.scale_clear",
"bpy.ops.object.location_clear",
"bpy.ops.object.rotation_clear",
"time.perf_counter",
"bpy.ops.pose.rigify_generate",
"mathutils.Vect... | [((14366, 14383), 'mathutils.Vector', 'Vector', (['(1, 2, 3)'], {}), '((1, 2, 3))\n', (14372, 14383), False, 'from mathutils import Vector\n'), ((20213, 20265), 'bpy.ops.armature.calculate_roll', 'bpy.ops.armature.calculate_roll', ([], {'type': '"""GLOBAL_POS_Y"""'}), "(type='GLOBAL_POS_Y')\n", (20244, 20265), False, '... |
def increase(value=0, rate=0, formatted=False):
"""
#EN-US:
→ Calculates the increase of a certain price,
returning the result with or without formatting.
:param value: the price you want to readjust.
:param rate: what is the percentage increase.
:param formatted: want formatted output or no... | [
"math.log10"
] | [((5711, 5724), 'math.log10', 'log10', (['number'], {}), '(number)\n', (5716, 5724), False, 'from math import floor, log10\n')] |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import base64
import datetime
import json
import logging
import os
import uuid
import boto3
import requests
from requests_aws4auth import AWS4Auth
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)... | [
"uuid.uuid4",
"requests_aws4auth.AWS4Auth",
"boto3.Session",
"base64.b64decode",
"json.dumps",
"datetime.datetime.utcfromtimestamp",
"os.getenv",
"logging.getLogger"
] | [((262, 289), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (279, 289), False, 'import logging\n'), ((397, 416), 'os.getenv', 'os.getenv', (['"""ES_URL"""'], {}), "('ES_URL')\n", (406, 416), False, 'import os\n'), ((426, 445), 'os.getenv', 'os.getenv', (['"""REGION"""'], {}), "('REGION')... |
import pytest
import sys
import functools
import collections.abc
from collections import ChainMap
from inspect import signature
from pathlib import Path
from uuid import uuid4
from http import cookiejar
from unittest.mock import patch
from itertools import cycle, chain, count
from app.el.accounts import auth
from app.... | [
"functools.partial",
"app.el.accounts.auth._gen_token",
"uuid.uuid4",
"unittest.mock.patch.object",
"pytest.yield_fixture",
"app.el.accounts.auth._gen_acid",
"pathlib.Path",
"inspect.signature",
"app.el.accounts.auth.cookies.save",
"app.el.accounts.auth.hashed",
"itertools.cycle",
"app.el.acco... | [((1900, 2023), 'pytest.yield_fixture', 'pytest.yield_fixture', ([], {'scope': '"""session"""', 'params': "['.gif', '.png', '.jpg']", 'ids': "['GIF images', 'PNG images', 'JPG images']"}), "(scope='session', params=['.gif', '.png', '.jpg'], ids=\n ['GIF images', 'PNG images', 'JPG images'])\n", (1920, 2023), False, ... |
import platform
import cv2
import timeit
import argparse
import os
import sys
import multiprocessing as mp
import geopandas
mp.set_start_method('spawn', force=True)
import utils.dataframe
import numpy as np
from utils import raster_processing, to_agol, features, dataframe
import rasterio.warp
import rasterio.crs
impo... | [
"utils.features.create_aoi_poly",
"numpy.sum",
"argparse.ArgumentParser",
"models.XViewFirstPlaceClsModel",
"multiprocessing.set_start_method",
"utils.to_agol.agol_arg_check",
"torch.cuda.device_count",
"collections.defaultdict",
"pathlib.Path",
"utils.dataframe.make_aoi_df",
"loguru.logger.remo... | [((126, 166), 'multiprocessing.set_start_method', 'mp.set_start_method', (['"""spawn"""'], {'force': '(True)'}), "('spawn', force=True)\n", (145, 166), True, 'import multiprocessing as mp\n'), ((13038, 13052), 'loguru.logger.catch', 'logger.catch', ([], {}), '()\n', (13050, 13052), False, 'from loguru import logger\n')... |
import json
import utils
import os
import utils_lung
if utils.hostname() == 'user':
with open('SETTINGS_user.json') as data_file:
paths = json.load(data_file)
else:
with open('SETTINGS.json') as data_file:
paths = json.load(data_file)
# kaggle data
STAGE = int(paths["STAGE"])
if STAGE == 1:
... | [
"utils.hostname",
"os.path.isfile",
"json.load",
"utils.check_data_paths"
] | [((1538, 1576), 'utils.check_data_paths', 'utils.check_data_paths', (['LUNA_DATA_PATH'], {}), '(LUNA_DATA_PATH)\n', (1560, 1576), False, 'import utils\n'), ((1627, 1669), 'utils.check_data_paths', 'utils.check_data_paths', (['LUNA_SEG_DATA_PATH'], {}), '(LUNA_SEG_DATA_PATH)\n', (1649, 1669), False, 'import utils\n'), (... |
from datetime import date, datetime, timedelta
import json
import logging
import math
import os
from typing import Any, Dict, List, Optional, Union
from uuid import UUID
import boto3
from spire.journal import models as journals_models
from sqlalchemy.orm import Session
from sqlalchemy import func, text, and... | [
"sqlalchemy.func.to_char",
"boto3.client",
"spire.journal.models.JournalEntryTag.tag.label",
"json.dumps",
"datetime.datetime.utcnow",
"spire.journal.models.Journal.id.in_",
"sqlalchemy.func.distinct",
"spire.db.SessionLocal",
"datetime.timedelta",
"math.log",
"spire.journal.models.JournalEntryT... | [((394, 421), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (411, 421), False, 'import logging\n'), ((1124, 1162), 'os.environ.get', 'os.environ.get', (['"""AWS_S3_DRONES_BUCKET"""'], {}), "('AWS_S3_DRONES_BUCKET')\n", (1138, 1162), False, 'import os\n'), ((1610, 1628), 'boto3.client', '... |
from types import SimpleNamespace
import pytest
from morecontext import attrset
def test_attrset() -> None:
obj = SimpleNamespace(foo=42)
with attrset(obj, "foo", "bar"):
assert obj.foo == "bar"
assert obj.foo == 42
def test_attrset_error() -> None:
obj = SimpleNamespace(foo=42)
with pyt... | [
"pytest.raises",
"morecontext.attrset",
"types.SimpleNamespace"
] | [((120, 143), 'types.SimpleNamespace', 'SimpleNamespace', ([], {'foo': '(42)'}), '(foo=42)\n', (135, 143), False, 'from types import SimpleNamespace\n'), ((284, 307), 'types.SimpleNamespace', 'SimpleNamespace', ([], {'foo': '(42)'}), '(foo=42)\n', (299, 307), False, 'from types import SimpleNamespace\n'), ((564, 587), ... |
import os
import time
import errno
import idiokit
from abusehelper.core import events, bot, utils
def read(fd, amount=4096):
try:
data = os.read(fd, amount)
except OSError as ose:
if ose.args[0] != errno.EAGAIN:
raise
data = ""
return data
def try_seek(fd, offset):
... | [
"idiokit.send",
"os.read",
"os.open",
"abusehelper.core.events.Event",
"os.stat",
"idiokit.sleep",
"os.lseek",
"time.time",
"abusehelper.core.utils.force_decode",
"abusehelper.core.bot.Param",
"abusehelper.core.bot.IntParam",
"os.close",
"os.fstat"
] | [((2239, 2277), 'abusehelper.core.bot.Param', 'bot.Param', (['"""path to the followed file"""'], {}), "('path to the followed file')\n", (2248, 2277), False, 'from abusehelper.core import events, bot, utils\n'), ((2291, 2332), 'abusehelper.core.bot.IntParam', 'bot.IntParam', (['"""file offset"""'], {'default': 'None'})... |
import sublime
import sublime_plugin
import os
import golangconfig
from .gotools_util import Buffers
from .gotools_util import GoBuffers
from .gotools_util import Logger
from .gotools_util import ToolRunner
class GotoolsGuruCommand(sublime_plugin.TextCommand):
def is_enabled(self):
return GoBuffers.is_go_source... | [
"golangconfig.subprocess_info",
"sublime.platform",
"golangconfig.setting_value",
"os.path.realpath",
"sublime.active_window",
"os.path.relpath",
"os.path.join"
] | [((805, 866), 'golangconfig.setting_value', 'golangconfig.setting_value', (['"""project_package"""'], {'view': 'self.view'}), "('project_package', view=self.view)\n", (831, 866), False, 'import golangconfig\n'), ((1207, 1261), 'golangconfig.setting_value', 'golangconfig.setting_value', (['"""guru_use_current_package"""... |
# -*- encoding=utf-8 -*-
# Took and modified the BaseCamera class, and changed the Camera Class
# Original Source: https://blog.miguelgrinberg.com/post/flask-video-streaming-revisited
# Original Code Repository: https://github.com/miguelgrinberg/flask-video-streaming
# Modified a little bit in inference method from fac... | [
"model.utils.decode_bbox",
"threading.Timer",
"numpy.argmax",
"email.mime.text.MIMEText",
"model.utils.single_class_non_max_suppression",
"cv2.rectangle",
"cv2.imencode",
"smtplib.SMTP",
"email.mime.multipart.MIMEMultipart",
"numpy.max",
"uuid.UUID",
"datetime.datetime.now",
"cv2.resize",
... | [((4487, 4518), 'cv2.resize', 'cv2.resize', (['image', 'target_shape'], {}), '(image, target_shape)\n', (4497, 4518), False, 'import cv2\n'), ((4572, 4604), 'numpy.expand_dims', 'np.expand_dims', (['image_np'], {'axis': '(0)'}), '(image_np, axis=0)\n', (4586, 4604), True, 'import numpy as np\n'), ((4641, 4691), 'model.... |
from cache import LRUCache
class TestLRUCache:
def test_default(self):
cache = LRUCache(2)
cache.put(1, 1)
cache.put(2, 2)
assert cache.get(1) == 1
# 该操作会使得密钥 2 作废
cache.put(3, 3)
assert cache.get(2) == -1
# 该操作会使得密钥 1 作废
cache.put(4, 4)
... | [
"cache.LRUCache"
] | [((94, 105), 'cache.LRUCache', 'LRUCache', (['(2)'], {}), '(2)\n', (102, 105), False, 'from cache import LRUCache\n')] |
'''
Created on 2021/05/15
@author: sakurai
'''
import pkg_resources
from subprocess import check_output
from sys import executable
from unittest import main
from unittest import skipIf
from unittest import TestCase
from python_wrap_cases import wrap_case
try:
proxy_version = pkg_resources.get_distribution('prox... | [
"unittest.main",
"unittest.skipIf",
"pkg_resources.get_distribution",
"subprocess.check_output",
"python_wrap_cases.wrap_case"
] | [((548, 611), 'python_wrap_cases.wrap_case', 'wrap_case', (['"""uxspoilers.FixedRustyPumpPlugin"""', '"""--pause-seconds"""'], {}), "('uxspoilers.FixedRustyPumpPlugin', '--pause-seconds')\n", (557, 611), False, 'from python_wrap_cases import wrap_case\n'), ((617, 685), 'python_wrap_cases.wrap_case', 'wrap_case', (['"""... |
# Copyright (c) 2018 ISciences, LLC.
# All rights reserved.
#
# WSIM is 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 applicab... | [
"wsim_workflow.paths.DefaultWorkspace",
"wsim_workflow.paths.Static",
"wsim_workflow.dates.parse_yearmon"
] | [((933, 955), 'wsim_workflow.dates.parse_yearmon', 'parse_yearmon', (['yearmon'], {}), '(yearmon)\n', (946, 955), False, 'from wsim_workflow.dates import parse_yearmon\n'), ((1733, 1747), 'wsim_workflow.paths.Static', 'Static', (['"""fake"""'], {}), "('fake')\n", (1739, 1747), False, 'from wsim_workflow.paths import Va... |
from pathlib import Path
from typing import Iterable
from os.path import basename, splitext
import sys
from difflib import context_diff
import click
import numpy as np
from sadedegel.dataset._core import safe_json_load
from sadedegel.dataset import load_sentence_corpus, file_paths
def file_diff(i1: Iterable, i2: Iter... | [
"sadedegel.dataset._core.safe_json_load",
"os.path.basename",
"sadedegel.dataset.load_sentence_corpus",
"click.command",
"difflib.context_diff",
"sadedegel.dataset.file_paths",
"pathlib.Path",
"numpy.array",
"click.secho",
"sys.exit"
] | [((802, 817), 'click.command', 'click.command', ([], {}), '()\n', (815, 817), False, 'import click\n'), ((841, 868), 'sadedegel.dataset.load_sentence_corpus', 'load_sentence_corpus', (['(False)'], {}), '(False)\n', (861, 868), False, 'from sadedegel.dataset import load_sentence_corpus, file_paths\n'), ((655, 695), 'cli... |
import vk
import json
TOKEN = ''
session = vk.Session(access_token=TOKEN)
api = vk.API(session, v='5.35', lang='ru', timeout=10)
users = []
links = []
def get_user (user_id):
return api.users.get(user_ids=user_id)[0]
def get_friends (user_id):
return api.friends.get(user_id=user_id)['items']
def add_user (u... | [
"vk.API",
"vk.Session",
"json.dumps"
] | [((46, 76), 'vk.Session', 'vk.Session', ([], {'access_token': 'TOKEN'}), '(access_token=TOKEN)\n', (56, 76), False, 'import vk\n'), ((83, 131), 'vk.API', 'vk.API', (['session'], {'v': '"""5.35"""', 'lang': '"""ru"""', 'timeout': '(10)'}), "(session, v='5.35', lang='ru', timeout=10)\n", (89, 131), False, 'import vk\n'),... |
import sys
import os
from setuptools import setup, find_packages
VERSION = '0.2.0'
CLASSIFIERS = """
Environment :: Web Environment
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3.5
Topic :: Internet :: WWW/HTTP :: WS... | [
"os.path.dirname",
"setuptools.setup",
"setuptools.find_packages"
] | [((755, 786), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['test']"}), "(exclude=['test'])\n", (768, 786), False, 'from setuptools import setup, find_packages\n'), ((1006, 1019), 'setuptools.setup', 'setup', ([], {}), '(**META)\n', (1011, 1019), False, 'from setuptools import setup, find_packages\n')... |
import slidingwindow as sw
import numpy as np
import cv2
def splitAlphaMask(image):
"""
Splits the last channel of an image from the rest of the channels.
Useful for splitting away the alpha channel of an image and treating
it as the image mask.
The input image should be a NumPy array of shape [h,w,c].
The r... | [
"slidingwindow.SlidingWindow",
"numpy.unique",
"numpy.nonzero",
"cv2.connectedComponentsWithStats",
"cv2.minAreaRect",
"cv2.findContours"
] | [((689, 718), 'numpy.nonzero', 'np.nonzero', (['(mask != maskValue)'], {}), '(mask != maskValue)\n', (699, 718), True, 'import numpy as np\n'), ((1646, 1661), 'numpy.unique', 'np.unique', (['mask'], {}), '(mask)\n', (1655, 1661), True, 'import numpy as np\n'), ((2085, 2133), 'cv2.connectedComponentsWithStats', 'cv2.con... |
import matplotlib.pyplot as plt
from datos import data
import pandas
d=data('mtcars')
ps = pandas.Series([i for i in d.gear])
counts = ps.value_counts()
plt.bar(counts.index,counts,0.35, color="blue")
plt.title('Simple Bar Chart: Car Distribution ', family='serif', size=16)
plt.xlabel('Number of Gears', family= 'seri... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.bar",
"pandas.Series",
"matplotlib.pyplot.ylabel",
"datos.data",
"matplotlib.pyplot.xlabel"
] | [((72, 86), 'datos.data', 'data', (['"""mtcars"""'], {}), "('mtcars')\n", (76, 86), False, 'from datos import data\n'), ((92, 126), 'pandas.Series', 'pandas.Series', (['[i for i in d.gear]'], {}), '([i for i in d.gear])\n', (105, 126), False, 'import pandas\n'), ((155, 204), 'matplotlib.pyplot.bar', 'plt.bar', (['count... |
"""Test parsing of LiteralInput
"""
import os
import sys
from io import StringIO
from lxml import objectify
pywpsPath = os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0],"..",".."))
sys.path.insert(0,pywpsPath)
sys.path.append(pywpsPath)
import unittest
class ParseLiteralInputTestCase(unittes... | [
"sys.path.append",
"io.StringIO",
"os.path.abspath",
"unittest.TextTestRunner",
"sys.path.insert",
"unittest.TestLoader",
"lxml.objectify.parse"
] | [((207, 236), 'sys.path.insert', 'sys.path.insert', (['(0)', 'pywpsPath'], {}), '(0, pywpsPath)\n', (222, 236), False, 'import sys\n'), ((236, 262), 'sys.path.append', 'sys.path.append', (['pywpsPath'], {}), '(pywpsPath)\n', (251, 262), False, 'import sys\n'), ((1382, 1771), 'io.StringIO', 'StringIO', (['u"""<wps:Input... |
from __future__ import absolute_import
__all__ = ["test"]
from ..milkyway import milkyway, mass_from_surface_density
from ..milkyway import _MAX_RADIUS_, _MAX_SF_RADIUS_
from ...toolkit.J21_sf_law import J21_sf_law
from ...toolkit.hydrodisk import hydrodiskstars
from ...toolkit.hydrodisk.data.download import _h277_exi... | [
"math.exp"
] | [((5928, 5951), 'math.exp', 'm.exp', (['(-(t - 0.2) / 1.4)'], {}), '(-(t - 0.2) / 1.4)\n', (5933, 5951), True, 'import math as m\n')] |
import math
class SpanResultItem:
def __init__(self, distance, referenceSent, citingSent):
if math.isnan(distance):
distance = 1.
self.distance = distance
self.referenceSent = referenceSent
self.referenceSentIndex = referenceSent.getIndex()
self.citingSentence ... | [
"math.isnan"
] | [((109, 129), 'math.isnan', 'math.isnan', (['distance'], {}), '(distance)\n', (119, 129), False, 'import math\n')] |
# Copyright 2020 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | [
"torch.mean",
"numpy.maximum",
"numpy.sum",
"torch.nn.init.xavier_normal_",
"numpy.zeros",
"torch.softmax",
"numpy.mean",
"torch.nn.ParameterList",
"torch.zeros",
"sklearn.metrics.confusion_matrix",
"torch.sum",
"torch.log",
"numpy.diag"
] | [((3934, 3966), 'sklearn.metrics.confusion_matrix', 'confusion_matrix', (['y_real', 'y_pred'], {}), '(y_real, y_pred)\n', (3950, 3966), False, 'from sklearn.metrics import confusion_matrix\n'), ((3981, 3992), 'numpy.diag', 'np.diag', (['cm'], {}), '(cm)\n', (3988, 3992), True, 'import numpy as np\n'), ((4063, 4085), 'n... |
# Copyright The Linux Foundation and each contributor to CommunityBridge.
# SPDX-License-Identifier: MIT
"""
Controller related to signature operations.
"""
import uuid
import hug.types
import cla.hug_types
from cla.utils import get_email_service
from cla.models import DoesNotExist
from cla.models.dynamo_models impor... | [
"cla.models.dynamo_models.Project",
"uuid.uuid4",
"cla.models.dynamo_models.User",
"cla.models.dynamo_models.Signature",
"cla.controllers.company.load",
"cla.models.dynamo_models.Company",
"cla.utils.get_email_service"
] | [((912, 923), 'cla.models.dynamo_models.Signature', 'Signature', ([], {}), '()\n', (921, 923), False, 'from cla.models.dynamo_models import User, Project, Signature, Company\n'), ((2853, 2864), 'cla.models.dynamo_models.Signature', 'Signature', ([], {}), '()\n', (2862, 2864), False, 'from cla.models.dynamo_models impor... |
# Copyright 2022 Sony Semiconductors Israel, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | [
"model_compression_toolkit.core.keras.keras_model_validation.KerasModelValidation",
"model_compression_toolkit.get_target_platform_capabilities",
"importlib.util.find_spec",
"model_compression_toolkit.core.common.Logger.info",
"model_compression_toolkit.core.keras.keras_implementation.KerasImplementation",
... | [((2178, 2240), 'model_compression_toolkit.get_target_platform_capabilities', 'get_target_platform_capabilities', (['TENSORFLOW', 'DEFAULT_TP_MODEL'], {}), '(TENSORFLOW, DEFAULT_TP_MODEL)\n', (2210, 2240), False, 'from model_compression_toolkit import get_target_platform_capabilities\n'), ((1503, 1541), 'importlib.util... |
'''
Copyright 2022 Airbus SAS
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, software
dis... | [
"copy.deepcopy",
"math.exp",
"numpy.maximum",
"pandas.DataFrame.from_dict",
"numpy.array"
] | [((3565, 3622), 'copy.deepcopy', 'deepcopy', (['self.resource_demand[self.resource_name].values'], {}), '(self.resource_demand[self.resource_name].values)\n', (3573, 3622), False, 'from copy import deepcopy\n'), ((3757, 3845), 'numpy.maximum', 'np.maximum', (['(self.use_stock[self.sub_resource_list[0]].values / demand_... |
from unittest.mock import Mock
import torch
from g2pw.dataset import prepare_data, TextDataset
def test_prepare_data():
sent_path = 'tests/fake_data/fake.sent'
lb_path = 'tests/fake_data/fake.lb'
texts, query_ids, phonemes = prepare_data(sent_path, lb_path)
assert texts == [
'华盛顿政府对威士忌酒暴乱的镇压... | [
"torch.eq",
"unittest.mock.Mock",
"g2pw.dataset.TextDataset",
"g2pw.dataset.prepare_data",
"torch.tensor"
] | [((241, 273), 'g2pw.dataset.prepare_data', 'prepare_data', (['sent_path', 'lb_path'], {}), '(sent_path, lb_path)\n', (253, 273), False, 'from g2pw.dataset import prepare_data, TextDataset\n'), ((1000, 1006), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (1004, 1006), False, 'from unittest.mock import Mock\n'), ((1379... |
import io
"""
U+AC00..U+D7AF Hangul Syllables 11,184 11,172 Hangul
ABCDE : (BYTE_CHARS ** 5) states
ABCD- : (BYTE_CHARS ** 4) states
ABC-- : (BYTE_CHARS ** 3) states
AB--- : (BYTE_CHARS ** 2) states
A---- : (BYTE_CHARS ** 1) states
XYZ : (BYTE_CHARS ** 5) + (BYTE_CHARS ** 4) states (< HAN_CHARS ** 3)
XY- : (BYTE... | [
"io.BytesIO",
"io.StringIO"
] | [((796, 809), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (807, 809), False, 'import io\n'), ((1848, 1860), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (1858, 1860), False, 'import io\n')] |
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import ctypes
import loader
import matrix_utils as mu
class GLObject():
"""
An OpenGL 'object' that has its own vertex data, and which can be drawn onto
a QOpenGLWidget.
"""
modelVertexDictionary = {}
"""
Dictiona... | [
"matrix_utils.reverse_mul",
"ctypes.c_void_p",
"loader.loadOBJ"
] | [((2792, 2812), 'matrix_utils.reverse_mul', 'mu.reverse_mul', (['V', 'M'], {}), '(V, M)\n', (2806, 2812), True, 'import matrix_utils as mu\n'), ((3415, 3433), 'ctypes.c_void_p', 'ctypes.c_void_p', (['(0)'], {}), '(0)\n', (3430, 3433), False, 'import ctypes\n'), ((3743, 3761), 'ctypes.c_void_p', 'ctypes.c_void_p', (['(0... |
import sqlite3
from datetime import datetime, timedelta
import dateutil.relativedelta
def initialize():
'''Inicializa la base de datos con tabla 'registros' '''
try:
con = sqlite3.connect('facemask.db')
cur = con.cursor()
cur.execute('''CREATE TABLE IF NOT EXISTS registros
... | [
"datetime.datetime.strptime",
"sqlite3.connect",
"datetime.datetime.now"
] | [((197, 227), 'sqlite3.connect', 'sqlite3.connect', (['"""facemask.db"""'], {}), "('facemask.db')\n", (212, 227), False, 'import sqlite3\n'), ((614, 644), 'sqlite3.connect', 'sqlite3.connect', (['"""facemask.db"""'], {}), "('facemask.db')\n", (629, 644), False, 'import sqlite3\n'), ((1040, 1070), 'sqlite3.connect', 'sq... |
import turtle, random
from turtle import *
turtle.speed(0)
#turtle.bgcolor('blue')
turtle.pencolor("red")
k = 90;
while k <= 180:
for r1 in range(0,360):
turtle.left(r1)
turtle.forward(k)
turtle.backward(k)
turtle.right(r1)
k+=1
'''
j = 10;
while j <= 360:
turtle.pencolor("green")
r = random... | [
"turtle.speed",
"turtle.backward",
"turtle.forward",
"turtle.right",
"turtle.left",
"turtle.pencolor"
] | [((44, 59), 'turtle.speed', 'turtle.speed', (['(0)'], {}), '(0)\n', (56, 59), False, 'import turtle, random\n'), ((85, 107), 'turtle.pencolor', 'turtle.pencolor', (['"""red"""'], {}), "('red')\n", (100, 107), False, 'import turtle, random\n'), ((431, 455), 'turtle.pencolor', 'turtle.pencolor', (['"""green"""'], {}), "(... |
"""
"""
# this file was auto-generated
from datetime import date, datetime
from fairgraph.base_v3 import EmbeddedMetadata, IRI
from fairgraph.fields import Field
class Affiliation(EmbeddedMetadata):
"""
"""
type = ["https://openminds.ebrains.eu/core/Affiliation"]
context = {
"schema"... | [
"fairgraph.fields.Field"
] | [((602, 754), 'fairgraph.fields.Field', 'Field', (['"""start_date"""', 'date', '"""vocab:startDate"""'], {'multiple': '(False)', 'required': '(False)', 'doc': '"""Date in the Gregorian calendar at which something begins in time"""'}), "('start_date', date, 'vocab:startDate', multiple=False, required=False,\n doc='Da... |
import itertools
def get_episodes(api, season_id, count=None):
if not count:
return api.season_episodes(season_id)
else:
episodes = api.season_episodes(season_id)
return list(itertools.islice(episodes, count)) | [
"itertools.islice"
] | [((215, 248), 'itertools.islice', 'itertools.islice', (['episodes', 'count'], {}), '(episodes, count)\n', (231, 248), False, 'import itertools\n')] |
# -*- coding: utf-8 -*-
import base64
from odoo import api, fields, models, _
from odoo.tools import float_is_zero
from odoo.exceptions import UserError
class PosOrder(models.Model):
_inherit = 'pos.order'
def _force_picking_done(self, picking):
"""Force picking in order to be set as done."""
... | [
"base64.b64encode",
"odoo._",
"odoo.tools.float_is_zero"
] | [((1558, 1626), 'odoo._', '_', (['"""<p>Dear %s,<br/>Here is your electronic ticket for the %s. </p>"""'], {}), "('<p>Dear %s,<br/>Here is your electronic ticket for the %s. </p>')\n", (1559, 1626), False, 'from odoo import api, fields, models, _\n'), ((2712, 2814), 'odoo.tools.float_is_zero', 'float_is_zero', (['(self... |
"""
Collection of utility functions
"""
from numpy.random import RandomState
import pandas as pd
import numpy as np
import os
import functools
from networkx.algorithms import bipartite
import logging
def make_random_bipartite_data(group1, group2, p, seed):
"""
:type group1: list
:param group1: Ids of fi... | [
"pandas.DataFrame",
"os.listdir",
"os.remove",
"numpy.sum",
"os.makedirs",
"logging.basicConfig",
"pandas.read_csv",
"os.path.exists",
"numpy.random.RandomState",
"logging.info",
"os.path.isfile",
"numpy.arange",
"os.rmdir",
"os.path.join",
"pandas.concat"
] | [((1027, 1097), 'logging.info', 'logging.info', (['""" (bipartite index created, now resolving item values)"""'], {}), "(' (bipartite index created, now resolving item values)')\n", (1039, 1097), False, 'import logging\n'), ((1442, 1503), 'logging.info', 'logging.info', (['""" (resolution done, now converting to tup... |
#!/usr/bin/python
#
# Copyright 2018 Google LLC
#
# 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 ag... | [
"opencensus.trace.ext.grpc.client_interceptor.OpenCensusClientInterceptor",
"opentelemetry.sdk.trace.TracerProvider",
"logger.getJSONLogger",
"opentelemetry.exporter.cloud_trace.CloudTraceSpanExporter",
"grpc.insecure_channel",
"opentelemetry.sdk.trace.export.SimpleExportSpanProcessor",
"opencensus.trac... | [((1223, 1268), 'logger.getJSONLogger', 'getJSONLogger', (['"""recommendationservice-server"""'], {}), "('recommendationservice-server')\n", (1236, 1268), False, 'from logger import getJSONLogger\n'), ((1886, 1910), 'opentelemetry.exporter.cloud_trace.CloudTraceSpanExporter', 'CloudTraceSpanExporter', ([], {}), '()\n',... |
from contextlib import closing
from pathlib import Path
import sqlite3
from .model import Absence, InvalidCodeError
#-------------------------------------------------------------------------------
DEFAULT_CODES = {
"vacation",
"remote",
"medical",
"personal",
}
class SqliteDB:
def __init... | [
"pathlib.Path"
] | [((746, 756), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (750, 756), False, 'from pathlib import Path\n'), ((1639, 1649), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (1643, 1649), False, 'from pathlib import Path\n')] |
import sys
path = '../../../'
sys.path.append(path)
from pdeopt.tools import get_data
import numpy as np
directories = [ 'Starter10/',
'Starter11/',
'Starter111/',
'Starter2/',
'Starter439/',
'Starter66/',
'Starter744/',
... | [
"sys.path.append",
"tabulate.tabulate",
"numpy.linalg.norm",
"pdeopt.tools.get_data"
] | [((30, 51), 'sys.path.append', 'sys.path.append', (['path'], {}), '(path)\n', (45, 51), False, 'import sys\n'), ((1265, 1287), 'numpy.linalg.norm', 'np.linalg.norm', (['mu_opt'], {}), '(mu_opt)\n', (1279, 1287), True, 'import numpy as np\n'), ((1440, 1505), 'pdeopt.tools.get_data', 'get_data', (['directory', 'method_tu... |
# -*- coding: utf-8 -*-
from logging import getLogger
from ... import APPID
from .http.http_download import HTTPDownload
from .http.http_request import HTTPRequest
class Browser:
def __init__(self, bucket=None, options={}):
self.log = getLogger(APPID)
self.options = options #: holds pycurl op... | [
"logging.getLogger"
] | [((252, 268), 'logging.getLogger', 'getLogger', (['APPID'], {}), '(APPID)\n', (261, 268), False, 'from logging import getLogger\n')] |
import csv
import os
import math
def average(value_list):
# Averages a list of float or integer values.
if value_list:
return sum(value_list)/len(value_list)
else:
return 'No Data'
def writedicttocsv(csv_file, csv_columns, dict_data):
try:
with open(csv_file, 'w') as csvfile:... | [
"csv.reader",
"csv.writer",
"os.path.isfile",
"os.path.join",
"os.listdir",
"csv.DictWriter"
] | [((1143, 1193), 'os.path.join', 'os.path.join', (['file_path', 'date', '"""date_filtered_csv"""'], {}), "(file_path, date, 'date_filtered_csv')\n", (1155, 1193), False, 'import os\n'), ((1213, 1236), 'os.listdir', 'os.listdir', (['csvfile_dir'], {}), '(csvfile_dir)\n', (1223, 1236), False, 'import os\n'), ((3434, 3479)... |
from api_python.database.db import get_db
import sqlite3
import pytest
def test_get_db(app):
# Assert the connection is the same within the same request context
with app.app_context():
conn = get_db()
assert conn is get_db()
# Assert the connection is closed
with pytest.raises(sqlite... | [
"pytest.raises",
"api_python.database.db.get_db"
] | [((211, 219), 'api_python.database.db.get_db', 'get_db', ([], {}), '()\n', (217, 219), False, 'from api_python.database.db import get_db\n'), ((300, 339), 'pytest.raises', 'pytest.raises', (['sqlite3.ProgrammingError'], {}), '(sqlite3.ProgrammingError)\n', (313, 339), False, 'import pytest\n'), ((243, 251), 'api_python... |
# -*- coding: utf-8 -*-
def run_prime_factorization(max_number: int):
from math import sqrt
ans = dict()
remain = max_number
for j in range(2, int(sqrt(max_number)) + 1):
if remain % j == 0:
count = 0
while remain % j == 0:
count += 1
... | [
"math.sqrt"
] | [((167, 183), 'math.sqrt', 'sqrt', (['max_number'], {}), '(max_number)\n', (171, 183), False, 'from math import sqrt\n')] |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Taobao Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/lic... | [
"fixtures.TempDir",
"os.path.join",
"glance.store.sheepdog.SheepdogImage"
] | [((1209, 1317), 'glance.store.sheepdog.SheepdogImage', 'sheepdog.SheepdogImage', (['sheepdog.DEFAULT_ADDR', 'sheepdog.DEFAULT_PORT', '"""test"""', 'sheepdog.DEFAULT_CHUNKSIZE'], {}), "(sheepdog.DEFAULT_ADDR, sheepdog.DEFAULT_PORT, 'test',\n sheepdog.DEFAULT_CHUNKSIZE)\n", (1231, 1317), True, 'import glance.store.she... |
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# VulnerableCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/vulnerablecode for support or download.
# See https://aboutcode.org for mor... | [
"os.path.dirname",
"os.path.join"
] | [((519, 542), 'os.path.dirname', 'dirname', (['sys.executable'], {}), '(sys.executable)\n', (526, 542), False, 'from os.path import dirname\n'), ((489, 506), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (496, 506), False, 'from os.path import dirname\n'), ((626, 665), 'os.path.join', 'join', (['bin... |
#!/usr/bin/env python
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-?', action='store_true', dest='help')
args = parser.parse_args()
if args.help:
print('Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27034' +
'for x86\... | [
"argparse.ArgumentParser"
] | [((80, 105), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (103, 105), False, 'import argparse\n')] |
import os
import boto3
ec2 = boto3.client("ec2")
def lambda_handler(event, context):
print(event)
ec2.run_instances(
LaunchTemplate={"LaunchTemplateName": os.environ["LAUNCH_TEMPLATE_NAME"]},
MinCount=1,
MaxCount=1,
SubnetId=os.environ["SUBNET"],
)
| [
"boto3.client"
] | [((31, 50), 'boto3.client', 'boto3.client', (['"""ec2"""'], {}), "('ec2')\n", (43, 50), False, 'import boto3\n')] |
import re
from Products.ZenRRD.CommandParser \
import CommandParser
from Products.ZenUtils.Utils \
import prepId
class get(CommandParser):
def processResults(self, cmd, result):
"""
Example output
pool0/home used 299133114880 -
"""
get_regex = r'^(?P<ds>\S+)\t(?P<... | [
"re.match"
] | [((449, 474), 're.match', 're.match', (['get_regex', 'line'], {}), '(get_regex, line)\n', (457, 474), False, 'import re\n'), ((638, 673), 're.match', 're.match', (['"""^\\\\d+\\\\.\\\\d{2}x$"""', 'value'], {}), "('^\\\\d+\\\\.\\\\d{2}x$', value)\n", (646, 673), False, 'import re\n')] |
# Generated by Django 3.0.11 on 2021-02-02 15:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("posthog", "0121_person_email_index"),
]
operations = [
migrations.AddField(
model_name="organization", name="setup_section_2_co... | [
"django.db.models.BooleanField"
] | [((336, 369), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(True)'}), '(default=True)\n', (355, 369), False, 'from django.db import migrations, models\n')] |
from funcionario import funcionario
from depto import departamento
from deptoDAO import deptoDao
import psycopg2
class FuncionarioDao:
def __init__(self):
self._dados_con = "dbname=ds2aula host=localhost user=postgres password=<PASSWORD> port=5432"
def inserir(self, funcionario):
with psyc... | [
"funcionario.funcionario",
"psycopg2.connect"
] | [((316, 349), 'psycopg2.connect', 'psycopg2.connect', (['self._dados_con'], {}), '(self._dados_con)\n', (332, 349), False, 'import psycopg2\n'), ((817, 850), 'psycopg2.connect', 'psycopg2.connect', (['self._dados_con'], {}), '(self._dados_con)\n', (833, 850), False, 'import psycopg2\n'), ((1042, 1113), 'funcionario.fun... |
#!/usr/bin/env python
# encoding: utf-8
from distutils.core import setup
setup(name='clock_puzzle_solver',
description='Script for solving the "clock puzzle" mini-games present in the Final Fantasy XIII-2 role-playing game.',
author='<NAME>',
author_email='<EMAIL>',
url='http://github.com/thoma... | [
"distutils.core.setup"
] | [((74, 381), 'distutils.core.setup', 'setup', ([], {'name': '"""clock_puzzle_solver"""', 'description': '"""Script for solving the "clock puzzle" mini-games present in the Final Fantasy XIII-2 role-playing game."""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""http://github.com/thomasnyman/clo... |
# -*- coding: UTF-8 -*-
# Copyright 2012-2014 <NAME>
#
# License: BSD (see file COPYING for details)
"""
The :term:`dummy module` for `outbox`,
used by :func:`lino.core.utils.resolve_app`.
"""
from lino.api import dd
class Mailable(object):
pass
#~ class MailableType(object): pass
class MailableType(dd.Model... | [
"lino.api.dd.DummyField"
] | [((460, 475), 'lino.api.dd.DummyField', 'dd.DummyField', ([], {}), '()\n', (473, 475), False, 'from lino.api import dd\n'), ((344, 359), 'lino.api.dd.DummyField', 'dd.DummyField', ([], {}), '()\n', (357, 359), False, 'from lino.api import dd\n'), ((382, 397), 'lino.api.dd.DummyField', 'dd.DummyField', ([], {}), '()\n',... |
import re
import subprocess
import zipfile
import fileinput
my_core_mods = ["org.btpos.dj2addons.bootstrapper.core.DJ2ALoadingPlugin"]
def getDepsFromBuildScript():
bpattern = re.compile("(?:implementation|runtimeOnly)(?:\\(\\s?(?:[\t ]*[\\w.:\"'\\-(),]+\\n?)+)")
deps = []
with open("../build.gradle") as file:
b... | [
"subprocess.Popen",
"zipfile.ZipFile",
"re.finditer",
"re.findall",
"re.compile"
] | [((179, 276), 're.compile', 're.compile', (['"""(?:implementation|runtimeOnly)(?:\\\\(\\\\s?(?:[\t ]*[\\\\w.:"\'\\\\-(),]+\\\\n?)+)"""'], {}), '(\n \'(?:implementation|runtimeOnly)(?:\\\\(\\\\s?(?:[\\t ]*[\\\\w.:"\\\'\\\\-(),]+\\\\n?)+)\'\n )\n', (189, 276), False, 'import re\n'), ((356, 389), 're.findall', 're.f... |
from functools import wraps
import inspect
import cchardet
import traceback
class TypeTool:
"""
类型工具类
"""
@classmethod
def type_assert(cls, func):
"""
类型断言
:param func: 要装饰的函数
:return:
"""
def check_arg(arg, tp):
"""
检查参数
... | [
"cchardet.detect",
"traceback.print_exc",
"inspect.signature",
"functools.wraps"
] | [((1841, 1852), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (1846, 1852), False, 'from functools import wraps\n'), ((1915, 1938), 'inspect.signature', 'inspect.signature', (['func'], {}), '(func)\n', (1932, 1938), False, 'import inspect\n'), ((5126, 5147), 'traceback.print_exc', 'traceback.print_exc', ([], ... |
from django.urls import path
from frontend import views
urlpatterns = [
path('', views.index, name='index'),
path('register', views.registration_form, name='register'),
path('registering', views.register_user, name='registering')
]
| [
"django.urls.path"
] | [((79, 114), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (83, 114), False, 'from django.urls import path\n'), ((120, 178), 'django.urls.path', 'path', (['"""register"""', 'views.registration_form'], {'name': '"""register"""'}), "('register', vie... |
#!/usr/bin/env python
# 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, software
# d... | [
"werkzeug.contrib.fixers.ProxyFix",
"dino.environ.env.config.get",
"flask.Flask",
"os.environ.get",
"dino.environ.init_web_auth",
"dino.environ.get",
"logging.getLogger"
] | [((799, 826), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (816, 826), False, 'import logging\n'), ((3725, 3759), 'dino.environ.init_web_auth', 'environ.init_web_auth', (['environ.env'], {}), '(environ.env)\n', (3746, 3759), False, 'from dino import environ\n'), ((2252, 2350), 'flask.Fl... |
import socket
import json
import base64
import subprocess
from Crypto.PublicKey import RSA
def call_nsm_cli(input):
cmd = ["/app/nsm-cli", "attest"]
if "public-key" in input:
cmd += ["--public-key", input["public-key"]]
if "public-key-b64" in input:
cmd += ["--public-key-b64", input["pub... | [
"subprocess.Popen",
"socket.socket",
"Crypto.PublicKey.RSA.generate",
"json.dumps"
] | [((724, 769), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'stdout': 'subprocess.PIPE'}), '(cmd, stdout=subprocess.PIPE)\n', (740, 769), False, 'import subprocess\n'), ((944, 962), 'Crypto.PublicKey.RSA.generate', 'RSA.generate', (['(2048)'], {}), '(2048)\n', (956, 962), False, 'from Crypto.PublicKey import RSA\n... |
"""empty message
Revision ID: 56c790ec8ab4
Revises: 62<PASSWORD>2ea<PASSWORD>
Create Date: 2020-12-02 17:32:23.332830
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '56c790ec8ab4'
down_revision = '<KEY>'
branch_labels = None
depends_on ... | [
"alembic.op.f"
] | [((430, 457), 'alembic.op.f', 'op.f', (['"""ix_alias_mailbox_id"""'], {}), "('ix_alias_mailbox_id')\n", (434, 457), False, 'from alembic import op\n'), ((518, 542), 'alembic.op.f', 'op.f', (['"""ix_alias_user_id"""'], {}), "('ix_alias_user_id')\n", (522, 542), False, 'from alembic import op\n'), ((600, 633), 'alembic.o... |
from setuptools import find_packages
from setuptools import setup
import os
install_requires = [
"numpy>=1.12.0",
"scipy>=0.18.1",
"scikit-learn>=0.19.1",
"decorator>=4.3.0",
"pandas>=0.25,<1.4",
"packaging",
]
optional_requires = ["fcsparser", "tables", "h5py", "anndata", "anndata2ri>=1.0.6"... | [
"os.path.dirname",
"setuptools.find_packages"
] | [((685, 710), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (700, 710), False, 'import os\n'), ((1026, 1041), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1039, 1041), False, 'from setuptools import find_packages\n')] |
import unittest
import logging
import pytest
from django.conf import settings
from django.contrib.auth.models import User
from django.core.paginator import (
InvalidPage, PageNotAnInteger, EmptyPage, Paginator)
from fast_pagination.helpers import FastPaginator
logger = logging.getLogger(__name__)
class FastO... | [
"unittest.main",
"pytest.fixture",
"logging.getLogger",
"fast_pagination.helpers.FastPaginator",
"django.contrib.auth.models.User.objects.all"
] | [((279, 306), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (296, 306), False, 'import logging\n'), ((1355, 1386), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (1369, 1386), False, 'import pytest\n'), ((2004, 2022), 'django.contrib.auth.mod... |
#!/usr/bin/python
# _*_ coding: utf-8 _*_
"""
@author: <NAME>, <EMAIL>
@github: https://github.com/sunnymarkLiu
@time : 2019/9/11 14:48
"""
import sys
sys.path.append('../')
import re
import json
import random
from utils.rouge import RougeL
ans_pattern = re.compile(r'@content\d@')
def find_answer_in_docid(answer)... | [
"sys.path.append",
"random.randint",
"re.compile",
"json.dumps",
"utils.rouge.RougeL"
] | [((154, 176), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (169, 176), False, 'import sys\n'), ((259, 285), 're.compile', 're.compile', (['"""@content\\\\d@"""'], {}), "('@content\\\\d@')\n", (269, 285), False, 'import re\n'), ((4045, 4121), 'random.randint', 'random.randint', (['min_left_con... |
# -*- coding: utf-8 -*-
import socket
from async_utils import async_run
def udp_send(target, content):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.sendto(content, target)
return s
def create_udp_server(port, handler):
"""
建立一个 UDP server。
port
此 server 监听的端口
handler... | [
"socket.socket",
"async_utils.async_run"
] | [((114, 162), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (127, 162), False, 'import socket\n'), ((482, 530), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (495, 530)... |
from discord.ext import commands
import traceback as tb
class EH(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_command_error(self, ctx, error):
if hasattr(ctx.command, "on_error"):
return
error = getattr(error, "origina... | [
"traceback.extract_tb",
"discord.ext.commands.Cog.listener"
] | [((141, 164), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (162, 164), False, 'from discord.ext import commands\n'), ((1875, 1909), 'traceback.extract_tb', 'tb.extract_tb', (['error.__traceback__'], {}), '(error.__traceback__)\n', (1888, 1909), True, 'import traceback as tb\n'), ((538... |
# Generated by Django 2.2.6 on 2021-08-21 16:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posts', '0022_auto_20210808_1553'),
]
operations = [
migrations.AlterField(
model_name='post',
name='views',
... | [
"django.db.models.ManyToManyField"
] | [((331, 449), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(True)', 'null': '(True)', 'related_name': '"""post_views"""', 'to': '"""posts.Ip"""', 'verbose_name': '"""просмотры"""'}), "(blank=True, null=True, related_name='post_views', to\n ='posts.Ip', verbose_name='просмотры')\n", (... |
from setuptools import setup, find_packages
setup(
name='github_api_client',
version='1.1',
author='<NAME>',
author_email='<EMAIL>',
packages=find_packages(),
python_requires='>=3.6'
)
| [
"setuptools.find_packages"
] | [((148, 163), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (161, 163), False, 'from setuptools import setup, find_packages\n')] |
#!/usr/bin/python
import numpy as np
import inkscapeMadeEasy.inkscapeMadeEasy_Base as inkBase
import inkscapeMadeEasy.inkscapeMadeEasy_Draw as inkDraw
# reference: https://www.electronics-tutorials.ws/resources/transformer-symbols.html
class transformer(inkBase.inkscapeMadeEasy):
def add(self, vector, delta):
... | [
"inkscapeMadeEasy.inkscapeMadeEasy_Draw.line.relCoords",
"inkscapeMadeEasy.inkscapeMadeEasy_Draw.lineStyle.createDashedLinePattern",
"inkscapeMadeEasy.inkscapeMadeEasy_Draw.color.defined",
"numpy.array",
"inkscapeMadeEasy.inkscapeMadeEasy_Draw.lineStyle.set"
] | [((475, 490), 'numpy.array', 'np.array', (['delta'], {}), '(delta)\n', (483, 490), True, 'import numpy as np\n'), ((2803, 2871), 'inkscapeMadeEasy.inkscapeMadeEasy_Draw.line.relCoords', 'inkDraw.line.relCoords', (['elem', '[[0, -20]]', 'position'], {'lineStyle': 'myLine'}), '(elem, [[0, -20]], position, lineStyle=myLin... |
import numpy as np
import pandas as pd
import os
from sklearn.model_selection import train_test_split
from sklearn.cluster import AgglomerativeClustering
from flask import Flask, jsonify, request
app = Flask(__name__)
# load_file this function loads file from filepath
def load_file(filepath):
# I need to get the... | [
"pandas.DataFrame",
"os.remove",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"pandas.get_dummies",
"flask.Flask",
"pandas.read_excel",
"flask.jsonify",
"sklearn.cluster.AgglomerativeClustering"
] | [((203, 218), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (208, 218), False, 'from flask import Flask, jsonify, request\n'), ((2197, 2286), 'sklearn.model_selection.train_test_split', 'train_test_split', (['data'], {'train_size': '(0.25)', 'shuffle': '(True)', 'stratify': 'data.privileges_data'}), '(dat... |
import time
"""函数运行时间装饰器
"""
def deco_time(func,*args,**kwargs):
def wrapper(*args,**kwargs):
start = time.time()
result = func(*args,**kwargs)
end = time.time()
print(f'{func.__name__}运用时间:', end - start)
return result
return wrapper
| [
"time.time"
] | [((115, 126), 'time.time', 'time.time', ([], {}), '()\n', (124, 126), False, 'import time\n'), ((179, 190), 'time.time', 'time.time', ([], {}), '()\n', (188, 190), False, 'import time\n')] |
# -*- coding: utf-8 -*-
"""
SCRIPT TO TEST DG CLASSIFICATION
@date: 2018.04.10
@author: <NAME> (<EMAIL>)
"""
# IMPORTS
from time import time
from sys import stdout
import h5py
import numpy as np
#from matplotlib import pyplot as plt
import math
from transforms3d import euler
from sklearn.model_selection import t... | [
"sys.stdout.write",
"numpy.random.seed",
"sklearn.preprocessing.StandardScaler",
"numpy.argmax",
"sklearn.model_selection.train_test_split",
"keras.models.Model",
"tensorflow.ConfigProto",
"matplotlib.pyplot.figure",
"numpy.isclose",
"numpy.arange",
"keras.layers.Input",
"tensorflow.get_defaul... | [((1394, 1424), 'h5py.File', 'h5py.File', (['dir_dataset_dg', '"""r"""'], {}), "(dir_dataset_dg, 'r')\n", (1403, 1424), False, 'import h5py\n'), ((1645, 1657), 'numpy.unique', 'np.unique', (['U'], {}), '(U)\n', (1654, 1657), True, 'import numpy as np\n'), ((4708, 4726), 'sys.stdout.write', 'stdout.write', (['"""\n"""']... |
import os
class RenamingFiles :
def list_files(self , folder_direction):
self.folder_path = folder_direction
try:
self.files = os.listdir(self.folder_path)
self.extension = self.files[0].split('.')[1]
print("the files in directory : ",self.folder_path)
... | [
"os.path.join",
"os.listdir"
] | [((159, 187), 'os.listdir', 'os.listdir', (['self.folder_path'], {}), '(self.folder_path)\n', (169, 187), False, 'import os\n'), ((669, 705), 'os.path.join', 'os.path.join', (['self.folder_path', 'file'], {}), '(self.folder_path, file)\n', (681, 705), False, 'import os\n')] |
# coding=utf-8
# !/usr/bin/python3
import os
from flask import Flask
from flask_cors import CORS
# Flask config
# ---------------------------------------------------------------
from routers import response_success
app = Flask(__name__)
app.config['FLASK_ENV'] = 'development'
app.config['CORS_HEADERS'] = 'Content-... | [
"flask_cors.CORS",
"os.environ.get",
"flask.Flask",
"routers.response_success"
] | [((225, 240), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (230, 240), False, 'from flask import Flask\n'), ((505, 550), 'flask_cors.CORS', 'CORS', (['app'], {'resources': "{'/*': {'origins': '*'}}"}), "(app, resources={'/*': {'origins': '*'}})\n", (509, 550), False, 'from flask_cors import CORS\n'), ((1... |
import ipfshttpclient
client = ipfshttpclient.connect()
def add(file_loc):
res = client.add(file_loc)
return res['Hash']
def cat(hash):
return client.cat(hash) | [
"ipfshttpclient.connect"
] | [((32, 56), 'ipfshttpclient.connect', 'ipfshttpclient.connect', ([], {}), '()\n', (54, 56), False, 'import ipfshttpclient\n')] |
# -*- coding: utf-8 -*-
"""
Colorization models for deepzipper
Author: <NAME>
"""
import tensorflow as tf
from utils import load_and_preprocess_single
import matplotlib.pyplot as plt
import numpy as np
import random
import time
import os
# LOAD AND PREPROCESS DATA
image_folder = 'train_images'
i... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"tensorflow.keras.layers.Conv2D",
"matplotlib.pyplot.imshow",
"numpy.expand_dims",
"matplotlib.pyplot.axis",
"time.time",
"tensorflow.keras.layers.InputLayer",
"tensorflow.nn.depth_to_space",
"matplotlib.pyplot.figure",
"tensorflow.keras.opt... | [((4620, 4651), 'tensorflow.keras.optimizers.Adam', 'tf.keras.optimizers.Adam', (['(0.001)'], {}), '(0.001)\n', (4644, 4651), True, 'import tensorflow as tf\n'), ((334, 374), 'os.path.join', 'os.path.join', (['"""train_images"""', 'image_name'], {}), "('train_images', image_name)\n", (346, 374), False, 'import os\n'), ... |
import random
from lib.types import IStdin, IStdout
inv_s_box = (
0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB,
0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB,
0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, ... | [
"random.randint"
] | [((2518, 2540), 'random.randint', 'random.randint', (['(0)', '(255)'], {}), '(0, 255)\n', (2532, 2540), False, 'import random\n')] |
#!/usr/bin/env python
import numpy as np
import pathlib
import re
import tensorflow as tf
class tfDataset():
def __init__(self, img_path: pathlib.Path):
"""
Loads images from a path in the form:
path/{category}/*.jpg
"""
self._img_path = img_path
self._dataset = t... | [
"numpy.array",
"re.match"
] | [((693, 714), 'numpy.array', 'np.array', (['class_names'], {}), '(class_names)\n', (701, 714), True, 'import numpy as np\n'), ((638, 667), 're.match', 're.match', (['dir_pattern', 'c.name'], {}), '(dir_pattern, c.name)\n', (646, 667), False, 'import re\n')] |