code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import openpyxl
import sys
from googleSentiment import Google
def main():
fileName = 'Ranking30.xlsx'
# Select which lines of the input sentences you wish to use
input_selection = [1, 18976]
google = Google()
try:
file = openpyxl.load_workbook(fileName)
except:
file = openpyxl.Wo... | [
"googleSentiment.Google",
"openpyxl.load_workbook",
"openpyxl.Workbook"
] | [((216, 224), 'googleSentiment.Google', 'Google', ([], {}), '()\n', (222, 224), False, 'from googleSentiment import Google\n'), ((249, 281), 'openpyxl.load_workbook', 'openpyxl.load_workbook', (['fileName'], {}), '(fileName)\n', (271, 281), False, 'import openpyxl\n'), ((309, 328), 'openpyxl.Workbook', 'openpyxl.Workbo... |
# -*- coding: utf-8 -*-
# Generated by Hand
from __future__ import unicode_literals, print_function
from sentry.utils.query import RangeQuerySetWrapperWithProgressBar
from django.db import migrations
# SearchVisitor.numeric_keys + SearchVisitor.date_keys
OPERATOR_KEYS = set(
[
"project_id",
"projec... | [
"django.db.migrations.RunPython",
"sentry.utils.query.RangeQuerySetWrapperWithProgressBar"
] | [((5828, 5873), 'sentry.utils.query.RangeQuerySetWrapperWithProgressBar', 'RangeQuerySetWrapperWithProgressBar', (['queryset'], {}), '(queryset)\n', (5863, 5873), False, 'from sentry.utils.query import RangeQuerySetWrapperWithProgressBar\n'), ((6996, 7081), 'django.db.migrations.RunPython', 'migrations.RunPython', (['m... |
import pandas as pd
import cx_Oracle
def query(code):
conn = cx_Oracle.connect('SOC_READ', 'soc_read', 'ossam-cluster-scan.robi.com.bd:1721/RBPB.robi.com.bd')
print(conn)
qry1 = """Select * from (select distinct Summary AlarmText,(Case when Summary like '%2G%' then '2G' when
Summary like '%3G%' then '... | [
"cx_Oracle.connect",
"pandas.read_sql"
] | [((66, 167), 'cx_Oracle.connect', 'cx_Oracle.connect', (['"""SOC_READ"""', '"""soc_read"""', '"""ossam-cluster-scan.robi.com.bd:1721/RBPB.robi.com.bd"""'], {}), "('SOC_READ', 'soc_read',\n 'ossam-cluster-scan.robi.com.bd:1721/RBPB.robi.com.bd')\n", (83, 167), False, 'import cx_Oracle\n'), ((1033, 1060), 'pandas.read... |
#!/usr/bin/python
"""
To use, please type in:
python concatenate.py
The script will only look at files that are within
folders that are one level below the directory supplied
to the script. For example, if no argument is given to
the script, script will parse all folders within the
current working directory as s... | [
"os.walk",
"os.path.join",
"os.listdir",
"sys.exit",
"re.compile"
] | [((567, 594), 'os.path.join', 'os.path.join', (['"""data"""', '"""raw"""'], {}), "('data', 'raw')\n", (579, 594), False, 'import os\n'), ((2790, 2800), 'sys.exit', 'sys.exit', ([], {}), '()\n', (2798, 2800), False, 'import sys\n'), ((2948, 2971), 're.compile', 're.compile', (['""".*?[http]"""'], {}), "('.*?[http]')\n",... |
from TexGen.Core import *
import numpy as np
from os import path
def export_weave_vtu(filename, weave, domain, max_dim_nvox, round_vox_up=True, export_orientation=True):
""" Exporting weave to vtu, to be read by pumapy
:param filename: filepath and name
:type filename: string
:param weave... | [
"numpy.zeros",
"numpy.max",
"os.path.split",
"numpy.array"
] | [((1491, 1593), 'numpy.array', 'np.array', (['[max_bounds.x - min_bounds.x, max_bounds.y - min_bounds.y, max_bounds.z -\n min_bounds.z]'], {}), '([max_bounds.x - min_bounds.x, max_bounds.y - min_bounds.y, \n max_bounds.z - min_bounds.z])\n', (1499, 1593), True, 'import numpy as np\n'), ((1603, 1618), 'numpy.max',... |
# Generated by Django 3.1.1 on 2020-09-11 04:47
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
atomic = False
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('auth', '0012_alter_user_first_name_max_length'... | [
"django.db.migrations.swappable_dependency",
"django.db.migrations.RenameField",
"django.db.migrations.RenameModel"
] | [((205, 262), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (236, 262), False, 'from django.db import migrations\n'), ((462, 526), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""Cos... |
import requests
import _main
import _pk as p
import _x86 as j
import os
import logging
class _Service():
# Instrumentation
def _apk_cache_i(self):
try:
logging.debug("Download instrumentation apk {}".format(p._apk()))
url = 'https://github.com/snakx/x86-uiautomator2-server/... | [
"_pk._apk",
"logging.error",
"logging.debug",
"_pk._apk2",
"requests.get",
"_x86._jar"
] | [((366, 384), 'logging.debug', 'logging.debug', (['url'], {}), '(url)\n', (379, 384), False, 'import logging\n'), ((401, 440), 'requests.get', 'requests.get', (['url'], {'allow_redirects': '(True)'}), '(url, allow_redirects=True)\n', (413, 440), False, 'import requests\n'), ((613, 681), 'logging.debug', 'logging.debug'... |
from django.db import models
class IMG(models.Model):
img = models.ImageField(upload_to='img') # upload_to 指定图片存储的文件夹名称,上传文件后自动创建
name = models.CharField(max_length=100)
| [
"django.db.models.ImageField",
"django.db.models.CharField"
] | [((66, 100), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""img"""'}), "(upload_to='img')\n", (83, 100), False, 'from django.db import models\n'), ((148, 180), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (164, 180), False, 'from djan... |
import os
import os.path
import logging
import subprocess
from .base import (
SourceControl,
STATE_NEW, STATE_MODIFIED, STATE_COMMITTED)
try:
import pygit2
SUPPORTS_GIT = True
except ImportError:
SUPPORTS_GIT = False
logger = logging.getLogger(__name__)
class GitBaseSourceControl(Source... | [
"pygit2.Repository",
"subprocess.check_output",
"os.path.isfile",
"os.path.relpath",
"os.path.join",
"logging.getLogger",
"pygit2.init_repository"
] | [((257, 284), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (274, 284), False, 'import logging\n'), ((736, 773), 'os.path.join', 'os.path.join', (['self.root', '""".gitignore"""'], {}), "(self.root, '.gitignore')\n", (748, 773), False, 'import os\n'), ((1543, 1571), 'subprocess.check_out... |
from django.db import models
from tinymce.models import HTMLField
# Create your models here.
class Agreement(models.Model):
english = HTMLField()
korean = HTMLField()
class LoginError(models.Model):
email = models.EmailField()
| [
"django.db.models.EmailField",
"tinymce.models.HTMLField"
] | [((142, 153), 'tinymce.models.HTMLField', 'HTMLField', ([], {}), '()\n', (151, 153), False, 'from tinymce.models import HTMLField\n'), ((167, 178), 'tinymce.models.HTMLField', 'HTMLField', ([], {}), '()\n', (176, 178), False, 'from tinymce.models import HTMLField\n'), ((225, 244), 'django.db.models.EmailField', 'models... |
import torch
from torch import nn
from torchviz import make_dot
from torchvision.models import AlexNet
from cnn_flower import CNNNet
model = CNNNet()
x = torch.randn(1, 3, 32, 32).requires_grad_(True)
y = model(x)
vis_graph = make_dot(y, params=dict(list(model.named_parameters()) + [('x', x)]))
vis_graph.view()
# ... | [
"cnn_flower.CNNNet",
"torch.randn"
] | [((143, 151), 'cnn_flower.CNNNet', 'CNNNet', ([], {}), '()\n', (149, 151), False, 'from cnn_flower import CNNNet\n'), ((156, 181), 'torch.randn', 'torch.randn', (['(1)', '(3)', '(32)', '(32)'], {}), '(1, 3, 32, 32)\n', (167, 181), False, 'import torch\n')] |
import cv2
import numpy as np
#script que simula o jogo, pra testar um frame
#se apertar esc ele fecha, se apertar espaço alterna entre uma tela preta e um frame
print("Aperte espaço para mudar frame/tela preta")
print("Pressione uma tecla pra selecionar a resolução:")
print("A->1280x720 zoom = 75%")
print("B->1280x720... | [
"cv2.waitKey",
"cv2.destroyAllWindows",
"numpy.zeros",
"cv2.imread",
"cv2.imshow"
] | [((939, 952), 'cv2.waitKey', 'cv2.waitKey', ([], {}), '()\n', (950, 952), False, 'import cv2\n'), ((3298, 3331), 'cv2.imshow', 'cv2.imshow', (['"""Stardew Valley"""', 'img'], {}), "('Stardew Valley', img)\n", (3308, 3331), False, 'import cv2\n'), ((916, 934), 'numpy.zeros', 'np.zeros', (['[20, 20]'], {}), '([20, 20])\n... |
from datetime import datetime, timedelta
from django_elasticsearch_dsl.registries import registry
from celery.decorators import periodic_task
from celery.task.schedules import crontab
from django.apps import apps
from django.http.request import HttpRequest
from django.core.cache import cache
from rest_framework.reques... | [
"django.apps.apps.get_model",
"django.core.cache.cache.set",
"rest_framework.request.Request",
"researchhub_document.related_models.constants.document_type.POSTS.lower",
"researchhub_document.views.ResearchhubUnifiedDocumentViewSet",
"researchhub_document.serializers.DynamicUnifiedDocumentSerializer",
"... | [((1046, 1060), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1058, 1060), False, 'from datetime import datetime, timedelta\n'), ((3186, 3221), 'researchhub_document.views.ResearchhubUnifiedDocumentViewSet', 'ResearchhubUnifiedDocumentViewSet', ([], {}), '()\n', (3219, 3221), False, 'from researchhub_docu... |
# Copyright 2017 The Oppia Authors. 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 by applicable ... | [
"core.platform.models.Registry.import_models",
"utils.get_random_int",
"google.appengine.ext.ndb.IntegerProperty",
"google.appengine.ext.ndb.StringProperty",
"google.appengine.ext.ndb.JsonProperty"
] | [((759, 815), 'core.platform.models.Registry.import_models', 'models.Registry.import_models', (['[models.NAMES.base_model]'], {}), '([models.NAMES.base_model])\n', (788, 815), False, 'from core.platform import models\n'), ((1503, 1550), 'google.appengine.ext.ndb.StringProperty', 'ndb.StringProperty', ([], {'required': ... |
from tensorflow.keras.models import load_model
import tensorflow as tf
def PSNR(y_true, y_pred):
max_pixel = 1.0
return tf.image.psnr(y_true, y_pred, max_val =max_pixel)
def ssim(y_true, y_pred):
max_val = 1.0
return tf.image.ssim(y_true, y_pred, max_val = max_val, filter_s... | [
"tensorflow.keras.models.load_model",
"tensorflow.image.psnr",
"tensorflow.image.ssim",
"tensorflow.keras.Sequential",
"tensorflow.image.ssim_multiscale",
"tensorflow.keras.losses.mean_absolute_error"
] | [((145, 193), 'tensorflow.image.psnr', 'tf.image.psnr', (['y_true', 'y_pred'], {'max_val': 'max_pixel'}), '(y_true, y_pred, max_val=max_pixel)\n', (158, 193), True, 'import tensorflow as tf\n'), ((263, 366), 'tensorflow.image.ssim', 'tf.image.ssim', (['y_true', 'y_pred'], {'max_val': 'max_val', 'filter_size': '(11)', '... |
import numpy as np
def conv(f, g):
def h(x):
"""Input x has to be equidistant!
"""
# If the support of f or g extends outside x,
# we have to evaluate the functions also outside x
# to get the values of the convolution for all x.
n = len(x)
d = x[1] - x[0]
... | [
"numpy.interp",
"numpy.tile",
"numpy.concatenate"
] | [((336, 386), 'numpy.concatenate', 'np.concatenate', (['[x[-n:] - n * d, x, x[:n] + n * d]'], {}), '([x[-n:] - n * d, x, x[:n] + n * d])\n', (350, 386), True, 'import numpy as np\n'), ((433, 455), 'numpy.tile', 'np.tile', (['x_ext', '(m, 1)'], {}), '(x_ext, (m, 1))\n', (440, 455), True, 'import numpy as np\n'), ((898, ... |
#!/usr/bin/env python
import numpy as np
import rospy
import time
from sensor_msgs.msg import LaserScan
from geometry_msgs.msg import Twist
from nav_msgs.msg import Odometry
from geometry_msgs.msg import PoseWithCovarianceStamped, PointStamped
from tutoriales_basicos.msg import Histogram
from tf.transformations import... | [
"numpy.size",
"rospy.Subscriber",
"numpy.amin",
"tutoriales_basicos.msg.Histogram",
"numpy.zeros",
"rospy.Publisher",
"rospy.init_node",
"rospy.spin"
] | [((558, 602), 'numpy.amin', 'np.amin', (['[c1 - c2, c1 - c2 - s, c1 - c2 + s]'], {}), '([c1 - c2, c1 - c2 - s, c1 - c2 + s])\n', (565, 602), True, 'import numpy as np\n'), ((673, 749), 'rospy.Subscriber', 'rospy.Subscriber', (['"""/tb3_0/scan"""', 'LaserScan', 'self.scan_callback'], {'queue_size': '(1)'}), "('/tb3_0/sc... |
"""Add abbreviations
Revision ID: 164efab664ba
Revises: <KEY>
Create Date: 2016-03-14 01:27:28.956379
"""
# revision identifiers, used by Alembic.
revision = '164efab664ba'
down_revision = '<KEY>'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
### comma... | [
"alembic.op.drop_column",
"sqlalchemy.dialects.postgresql.JSONB"
] | [((583, 625), 'alembic.op.drop_column', 'op.drop_column', (['"""cde_job"""', '"""abbreviations"""'], {}), "('cde_job', 'abbreviations')\n", (597, 625), False, 'from alembic import op\n'), ((427, 445), 'sqlalchemy.dialects.postgresql.JSONB', 'postgresql.JSONB', ([], {}), '()\n', (443, 445), False, 'from sqlalchemy.diale... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import logging
from types import FrameType
from typing import cast
from loguru import logger
from datetime import timedelta
class InterceptHandler(logging.Handler):
def emit(self, record: logging.LogRecord) -> None: # pragma: no cover
# Get corres... | [
"loguru.logger.opt",
"loguru.logger.level",
"typing.cast",
"datetime.timedelta",
"logging.currentframe",
"logging.getLogger"
] | [((968, 987), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (985, 987), False, 'import logging\n'), ((1069, 1099), 'logging.getLogger', 'logging.getLogger', (['logger_name'], {}), '(logger_name)\n', (1086, 1099), False, 'import logging\n'), ((577, 599), 'logging.currentframe', 'logging.currentframe', ([],... |
from Cryptodome.Random import get_random_bytes
from Cryptodome.Cipher import AES
from Cryptodome.Hash import SHA256
from Cryptodome.Signature import PKCS1_v1_5
import rsa
FILES_DIR = 'files/'
STANDARD_FILE_PATH = f'{FILES_DIR}standard_file.txt'
ENCRYPTED_FILE_PATH = f'{FILES_DIR}encrypted_file.txt'
DECRYPTED_FILE_PAT... | [
"Cryptodome.Cipher.AES.new",
"Cryptodome.Signature.PKCS1_v1_5.new",
"Cryptodome.Random.get_random_bytes",
"rsa.decrypt",
"rsa.encrypt"
] | [((597, 619), 'Cryptodome.Random.get_random_bytes', 'get_random_bytes', (['size'], {}), '(size)\n', (613, 619), False, 'from Cryptodome.Random import get_random_bytes\n'), ((2527, 2554), 'Cryptodome.Signature.PKCS1_v1_5.new', 'PKCS1_v1_5.new', (['private_key'], {}), '(private_key)\n', (2541, 2554), False, 'from Cryptod... |
# coding: utf-8
"""
metal-api
API to manage and control plane resources like machines, switches, operating system images, machine sizes, networks, IP addresses and more # noqa: E501
OpenAPI spec version: v0.15.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __futur... | [
"six.iteritems",
"metal_python.api_client.ApiClient"
] | [((2811, 2842), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (2824, 2842), False, 'import six\n'), ((7084, 7115), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (7097, 7115), False, 'import six\n'), ((11115, 11146), 'six.iteritems', 'six.it... |
# Lint as: python3
# coding=utf-8
# Copyright 2019 The TensorFlow Authors. 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-... | [
"csv.reader",
"os.makedirs",
"os.path.exists",
"json.dumps",
"random.random"
] | [((6397, 6421), 'os.path.exists', 'os.path.exists', (['"""./data"""'], {}), "('./data')\n", (6411, 6421), False, 'import os\n'), ((6427, 6448), 'os.makedirs', 'os.makedirs', (['"""./data"""'], {}), "('./data')\n", (6438, 6448), False, 'import os\n'), ((1768, 1781), 'csv.reader', 'csv.reader', (['f'], {}), '(f)\n', (177... |
def interpret(mem):
pc = 0
reg = [0]*10
ins_commited = 0
halted = False
while not halted:
ir = mem[pc]
opcode = ir[0]
op1 = int(ir[1])
op2 = int(ir[2])
ins_commited += 1
pc = ( pc + 1 ) % 1000
if opcode == "1": # Halt
halted = True
elif opcode == "2": # Load imm
r... | [
"sys.stdout.write",
"sys.stdin.readline"
] | [((1350, 1368), 'sys.stdout.write', 'stdout.write', (['"""\n"""'], {}), "('\\n')\n", (1362, 1368), False, 'from sys import stdin, stdout\n'), ((1155, 1171), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (1169, 1171), False, 'from sys import stdin, stdout\n'), ((1248, 1264), 'sys.stdin.readline', 'stdin.read... |
from django.contrib.auth.models import User
from userroles.models import set_user_role
from userroles import roles
# Read in some file with usersnames, emails, etc.
username = "tmp"
email = "<EMAIL>"
password = "<PASSWORD>"
user = User.objects.create_user(username, email, password)
# At this point, user is a User obj... | [
"userroles.models.set_user_role",
"django.contrib.auth.models.User.objects.create_user"
] | [((232, 283), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', (['username', 'email', 'password'], {}), '(username, email, password)\n', (256, 283), False, 'from django.contrib.auth.models import User\n'), ((472, 514), 'userroles.models.set_user_role', 'set_user_role', (['user', 'roles... |
from django.http import HttpResponse
from django.shortcuts import render
import pandas_gbq
from google.oauth2 import service_account
import os
# Make sure you have installed pandas-gbq at first;
# You can use the other way to query BigQuery.
# please have a look at
# https://cloud.google.com/bigquery/docs/reference/li... | [
"google.oauth2.service_account.Credentials.from_service_account_file",
"os.path.dirname",
"django.shortcuts.render",
"pandas_gbq.read_gbq",
"os.path.join"
] | [((395, 420), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (410, 420), False, 'import os\n'), ((436, 500), 'os.path.join', 'os.path.join', (['app_dir', '"""static/eecs-e6895-edu-591e4a34fcda.json"""'], {}), "(app_dir, 'static/eecs-e6895-edu-591e4a34fcda.json')\n", (448, 500), False, 'import... |
"""CFNgin init action."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Any, Optional, Union, cast
from ...compat import cached_property
from ...config.models.cfngin import CfnginStackDefinitionModel
from ...core.providers.aws.s3 import Bucket
from ..exceptions import CfnginBucke... | [
"logging.getLogger"
] | [((594, 621), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (611, 621), False, 'import logging\n')] |
import numpy as np
from collections import deque
import gym
import os
import gym.spaces as spaces
import cv2
import datalib.trajectories as trajectories
cv2.ocl.setUseOpenCL(False)
class NoopResetEnv(gym.Wrapper):
def __init__(self, env, noop_max=30):
"""Sample initial states by taking random number of n... | [
"gym.Wrapper.__init__",
"datalib.trajectories.load_trajectories_by_score",
"numpy.load",
"gym.make",
"gym.RewardWrapper.__init__",
"numpy.concatenate",
"cv2.cvtColor",
"collections.deque",
"numpy.zeros",
"cv2.ocl.setUseOpenCL",
"numpy.random.RandomState",
"gym.ObservationWrapper.__init__",
"... | [((155, 182), 'cv2.ocl.setUseOpenCL', 'cv2.ocl.setUseOpenCL', (['(False)'], {}), '(False)\n', (175, 182), False, 'import cv2\n'), ((13187, 13203), 'gym.make', 'gym.make', (['env_id'], {}), '(env_id)\n', (13195, 13203), False, 'import gym\n'), ((13377, 13393), 'gym.make', 'gym.make', (['env_id'], {}), '(env_id)\n', (133... |
import os
import sys
import time
import json
import h5py
import argparse
import numpy as np
from tqdm import tqdm
from spectra_utils import load_radionuclide_nndc, generate_spectrum, plot_spectrum
def load_nndc_tables(nndc_dir, radionuclides):
nndc_tables = {}
for rn in radionuclides:
keV, intensit... | [
"h5py.File",
"json.load",
"os.makedirs",
"argparse.ArgumentParser",
"os.path.dirname",
"spectra_utils.load_radionuclide_nndc",
"time.time",
"spectra_utils.generate_spectrum",
"os.path.join",
"spectra_utils.plot_spectrum"
] | [((1631, 1642), 'time.time', 'time.time', ([], {}), '()\n', (1640, 1642), False, 'import time\n'), ((1657, 1682), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1680, 1682), False, 'import argparse\n'), ((2568, 2596), 'os.path.dirname', 'os.path.dirname', (['arg.outfile'], {}), '(arg.outfile)\... |
from django.template.defaultfilters import title # noqa
from django.template.loader import render_to_string # noqa
from horizon.utils import filters
def stack_info(stack, stack_image):
stack.stack_status_desc = title(
filters.replace_underscores(stack.stack_status))
if stack.stack_status_reason:
... | [
"horizon.utils.filters.replace_underscores",
"django.template.loader.render_to_string"
] | [((536, 596), 'django.template.loader.render_to_string', 'render_to_string', (['"""project/stacks/_stack_info.html"""', 'context'], {}), "('project/stacks/_stack_info.html', context)\n", (552, 596), False, 'from django.template.loader import render_to_string\n'), ((1002, 1065), 'django.template.loader.render_to_string'... |
import os
import io
from .utils import *
from .exceptions import *
class JsonClient:
"""
JsonClient object constructor.
@param api_token:
The API Token to be used for authentication with the SendSecure service
@param user_id:
The user id of the current user
@param en... | [
"os.path.getsize"
] | [((3213, 3241), 'os.path.getsize', 'os.path.getsize', (['source.name'], {}), '(source.name)\n', (3228, 3241), False, 'import os\n')] |
#!/usr/bin/env python3
# coding=utf-8
"""
@author: guoyanfeng
@software: PyCharm
@time: 18-7-1 上午10:08
"""
import atexit
from typing import Dict
import requests as sync_requests
from requests.exceptions import ConnectTimeout, ConnectionError, HTTPError, RequestException, Timeout
from eclients.err_msg import http_msg... | [
"requests.Session",
"eclients.utils.verify_message"
] | [((2736, 2769), 'eclients.utils.verify_message', 'verify_message', (['http_msg', 'message'], {}), '(http_msg, message)\n', (2750, 2769), False, 'from eclients.utils import verify_message\n'), ((2869, 2892), 'requests.Session', 'sync_requests.Session', ([], {}), '()\n', (2890, 2892), True, 'import requests as sync_reque... |
from apistar import validators
from apistar_mongoengine.types import Type
class PostType(Type):
message = validators.String()
| [
"apistar.validators.String"
] | [((112, 131), 'apistar.validators.String', 'validators.String', ([], {}), '()\n', (129, 131), False, 'from apistar import validators\n')] |
#!/usr/bin/python
#-*- coding: utf-8 -*-
from SpeakerNet import *
from utils import *
from DatasetLoader import loadWAV
import sys, time, os, argparse, socket
import yaml
import numpy
import pdb
import torch
import glob
import zipfile
import datetime
import os
import random
import subprocess
import torch.distributed ... | [
"numpy.load",
"os.remove",
"argparse.ArgumentParser",
"random.randint",
"flask.Flask",
"werkzeug.utils.secure_filename",
"flask.jsonify",
"numpy.mean",
"subprocess.call",
"torch.nn.functional.normalize"
] | [((638, 689), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Prepare Data"""'}), "(description='Prepare Data')\n", (661, 689), False, 'import sys, time, os, argparse, socket\n'), ((4073, 4088), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (4078, 4088), False, 'from flask i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_calc
----------------------------------
Acceptance tests for MVP.
"""
import sys, os
import pytest
import logging
from time import sleep
from assertpy import assert_that
from pytest_bdd import scenario, given, when, then
from concurrent import futures
#SUT
from s... | [
"resources.test_support.controls.set_telescope_to_running",
"resources.test_support.sync_decorators.sync_restart",
"resources.test_support.controls.take_subarray",
"pytest_bdd.then",
"ska.scripting.domain.SubArray",
"pytest_bdd.given",
"resources.test_support.controls.telescope_is_in_standby",
"os.env... | [((887, 922), 'os.environ.get', 'os.environ.get', (['"""DISABLE_DEV_TESTS"""'], {}), "('DISABLE_DEV_TESTS')\n", (901, 922), False, 'import sys, os\n'), ((1057, 1084), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1074, 1084), False, 'import logging\n'), ((1822, 1893), 'pytest_bdd.scenar... |
#!/usr/bin/env python
import cairo
import rsvg
import gtk
class View:
def __init__(self):
self.string = """<svg width="800" height="600"></svg>"""
s... | [
"gtk.Window",
"gtk.main_quit",
"gtk.DrawingArea",
"rsvg.Handle"
] | [((330, 359), 'rsvg.Handle', 'rsvg.Handle', ([], {'data': 'self.string'}), '(data=self.string)\n', (341, 359), False, 'import rsvg\n'), ((374, 386), 'gtk.Window', 'gtk.Window', ([], {}), '()\n', (384, 386), False, 'import gtk\n'), ((400, 417), 'gtk.DrawingArea', 'gtk.DrawingArea', ([], {}), '()\n', (415, 417), False, '... |
from gpiozero import LightSensor
from time import sleep
pulseCount = 0
def lightPulse():
global pulseCount
pulseCount = pulseCount + 1
print("Pulse ", pulseCount)
ldr = LightSensor(19,queue_len=1)
ldr.when_light = lightPulse
ldr.threshold = 0.1
while True:
#print(ldr.value)
sleep(1)
| [
"gpiozero.LightSensor",
"time.sleep"
] | [((184, 212), 'gpiozero.LightSensor', 'LightSensor', (['(19)'], {'queue_len': '(1)'}), '(19, queue_len=1)\n', (195, 212), False, 'from gpiozero import LightSensor\n'), ((299, 307), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (304, 307), False, 'from time import sleep\n')] |
from django.contrib.auth.decorators import login_required, permission_required
from django.shortcuts import render
from ..models import Contract
@login_required
@permission_required("buybacks.basic_access")
def my_stats(request):
contracts = Contract.objects.filter(
character__user=request.user,
)
... | [
"django.shortcuts.render",
"django.contrib.auth.decorators.permission_required"
] | [((165, 209), 'django.contrib.auth.decorators.permission_required', 'permission_required', (['"""buybacks.basic_access"""'], {}), "('buybacks.basic_access')\n", (184, 209), False, 'from django.contrib.auth.decorators import login_required, permission_required\n'), ((474, 518), 'django.contrib.auth.decorators.permission... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
# Copyright (C) 2020 Northwestern University.
#
# Invenio-Records-Resources is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""Service tests."""
import json
import pytest
from in... | [
"mock_module.api.Record.index.refresh",
"pytest.fixture",
"json.dumps"
] | [((416, 432), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (430, 432), False, 'import pytest\n'), ((1192, 1214), 'mock_module.api.Record.index.refresh', 'Record.index.refresh', ([], {}), '()\n', (1212, 1214), False, 'from mock_module.api import Record\n'), ((1863, 1885), 'mock_module.api.Record.index.refresh',... |
from configs.meta_params import get_db_list
from utils.parser.bib_parser import bib_gen
def export_exec(paper_id):
for item in get_db_list():
if item['id'] == paper_id:
print(bib_gen(item))
break
| [
"utils.parser.bib_parser.bib_gen",
"configs.meta_params.get_db_list"
] | [((133, 146), 'configs.meta_params.get_db_list', 'get_db_list', ([], {}), '()\n', (144, 146), False, 'from configs.meta_params import get_db_list\n'), ((201, 214), 'utils.parser.bib_parser.bib_gen', 'bib_gen', (['item'], {}), '(item)\n', (208, 214), False, 'from utils.parser.bib_parser import bib_gen\n')] |
from functools import singledispatch
import json
import fsspec
from toolz import groupby
from loguru import logger
from typing import Any, List, Union
from pydantic.datetime_parse import datetime_re
from pydantic.validators import parse_datetime
import numpy as np
from ..types import Interval
from ..indexes import ... | [
"pydantic.datetime_parse.datetime_re.match",
"loguru.logger.debug",
"json.load",
"numpy.abs",
"numpy.flatnonzero",
"toolz.groupby",
"numpy.array",
"rframe.schema.UpdateError",
"pydantic.validators.parse_datetime",
"fsspec.open"
] | [((9844, 9866), 'pydantic.datetime_parse.datetime_re.match', 'datetime_re.match', (['obj'], {}), '(obj)\n', (9861, 9866), False, 'from pydantic.datetime_parse import datetime_re\n'), ((9935, 9954), 'pydantic.validators.parse_datetime', 'parse_datetime', (['obj'], {}), '(obj)\n', (9949, 9954), False, 'from pydantic.vali... |
#Follow GameText array and auto assign names and enums
#@author
#@category StarFox
#@keybinding
#@menupath
#@toolbar
import jarray
from array import array
import re
listing = currentProgram.getListing()
AF = currentProgram.getAddressFactory()
DT = currentProgram.getDataTypeManager()
mem = currentProgram.getMemory(... | [
"jarray.zeros",
"array.array",
"re.compile"
] | [((336, 364), 're.compile', 're.compile', (['"""[^a-zA-Z0-9_]+"""'], {}), "('[^a-zA-Z0-9_]+')\n", (346, 364), False, 'import re\n'), ((1079, 1099), 'jarray.zeros', 'jarray.zeros', (['(4)', '"""b"""'], {}), "(4, 'b')\n", (1091, 1099), False, 'import jarray\n'), ((1609, 1625), 'array.array', 'array', (['"""B"""', 'data']... |
from rest_framework.generics import ListCreateAPIView, UpdateAPIView
from rest_framework.permissions import IsAuthenticated
from ..models import Profile, User
from ..serializers import ProfileSerializer
from rest_framework.response import Response
from django.shortcuts import get_object_or_404
class ListCreate(ListCr... | [
"django.shortcuts.get_object_or_404",
"rest_framework.response.Response"
] | [((624, 649), 'rest_framework.response.Response', 'Response', (['serializer.data'], {}), '(serializer.data)\n', (632, 649), False, 'from rest_framework.response import Response\n'), ((1029, 1064), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['User'], {'pk': 'user_id'}), '(User, pk=user_id)\n', (1046, 10... |
import os
from io import TextIOWrapper
from typing import List
import protogen.util as util
from protogen.compiler import Compiler
from protogen.compiler import tab as tab
from protogen.library.python.std import ACCEPTED_TYPES, PYTHON_TYPES
from protogen.util import PGFile, PyClass
class PythonCompiler(Compiler):
... | [
"protogen.util.inferParentClass",
"os.path.dirname",
"protogen.util.inferShortName"
] | [((534, 559), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (549, 559), False, 'import os\n'), ((1590, 1617), 'protogen.util.inferParentClass', 'util.inferParentClass', (['item'], {}), '(item)\n', (1611, 1617), True, 'import protogen.util as util\n'), ((1661, 1686), 'protogen.util.inferShort... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-10-13 20:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('financialaid', '0016_load_country_income_thresholds'),
]
operations = [
mig... | [
"django.db.models.CharField"
] | [((440, 483), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(2)', 'unique': '(True)'}), '(max_length=2, unique=True)\n', (456, 483), False, 'from django.db import migrations, models\n')] |
import pytest
import knot_injector
class TestInjector(object):
@pytest.fixture()
def provider(self):
def test_provider(container=None):
return {'name': 'test'}
return test_provider
@pytest.fixture()
def container(self):
return knot_injector.Container()
def te... | [
"pytest.raises",
"pytest.fixture",
"knot_injector.Container"
] | [((71, 87), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (85, 87), False, 'import pytest\n'), ((226, 242), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (240, 242), False, 'import pytest\n'), ((283, 308), 'knot_injector.Container', 'knot_injector.Container', ([], {}), '()\n', (306, 308), False, 'import... |
from bisect import bisect_left,bisect
def binsearchright(a,k):
c = bisect(a, k)
return c
def binsearchleft(a,k):
b = bisect_left(a,k)
return b
a = [1,1,2,2,2,4,4,4,4,4,4,8,8]
k = int(8)
res = binsearchleft(a, k)
res1 = binsearchright(a,k)
print("{} is present {} times in the array".format(k,abs(r... | [
"bisect.bisect",
"bisect.bisect_left"
] | [((72, 84), 'bisect.bisect', 'bisect', (['a', 'k'], {}), '(a, k)\n', (78, 84), False, 'from bisect import bisect_left, bisect\n'), ((131, 148), 'bisect.bisect_left', 'bisect_left', (['a', 'k'], {}), '(a, k)\n', (142, 148), False, 'from bisect import bisect_left, bisect\n')] |
from django.conf.urls import url
from django.urls import path, include
from apps.users.api.views import CustomConfirmEmailView
from django.urls import path, include
from . import views as acc_views
urlpatterns = [
path("", include('rest_auth.urls')),
# The django-rest-passwordreset urls to request a token a... | [
"apps.users.api.views.CustomConfirmEmailView.as_view",
"django.urls.include"
] | [((230, 255), 'django.urls.include', 'include', (['"""rest_auth.urls"""'], {}), "('rest_auth.urls')\n", (237, 255), False, 'from django.urls import path, include\n'), ((368, 437), 'django.urls.include', 'include', (['"""django_rest_passwordreset.urls"""'], {'namespace': '"""password_reset"""'}), "('django_rest_password... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset = pd.read_csv('Market_Basket_Optimisation.csv', header=None)
transactions = []
for i in range(0,7501):
transactions.append([str(dataset.values[i,j]) for j in range(0,20)])
from apyori import apriori
rules = apriori(transactions,min_s... | [
"pandas.read_csv",
"apyori.apriori"
] | [((82, 140), 'pandas.read_csv', 'pd.read_csv', (['"""Market_Basket_Optimisation.csv"""'], {'header': 'None'}), "('Market_Basket_Optimisation.csv', header=None)\n", (93, 140), True, 'import pandas as pd\n'), ((294, 384), 'apyori.apriori', 'apriori', (['transactions'], {'min_support': '(0.003)', 'min_confidence': '(0.2)'... |
import mysql.connector
from mysql.connector import errorcode
import time
import calendar
import datetime
class MysqlConnection:
def __init__(self):
self.mysql_connection()
self.cnx
self.cursor
def mysql_connection(self):
self.cnx = mysql.connector.connect(user='root', password=... | [
"time.gmtime"
] | [((17168, 17181), 'time.gmtime', 'time.gmtime', ([], {}), '()\n', (17179, 17181), False, 'import time\n')] |
import uuid
from typing import Literal
from chaosiqagent.types import Job
def create_job(target_type: Literal["experiment", "verification"] = None):
target_id = uuid.uuid4()
if not target_type:
target_type = "experiment"
return Job(
id=uuid.uuid4(),
agent_id=uuid.uuid4(),
... | [
"uuid.uuid4"
] | [((168, 180), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (178, 180), False, 'import uuid\n'), ((267, 279), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (277, 279), False, 'import uuid\n'), ((298, 310), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (308, 310), False, 'import uuid\n'), ((327, 339), 'uuid.uuid4', 'uui... |
from __future__ import absolute_import, division
import cv2
import numpy as np
import time
from ..utils.viz import show_frame
class Tracker(object):
def __init__(self, name):
self.name = name
def init(self, image, init_rect):
raise NotImplementedError()
def update(self, image):
... | [
"cv2.cvtColor",
"cv2.imread",
"numpy.zeros",
"time.time"
] | [((465, 489), 'numpy.zeros', 'np.zeros', (['(frame_num, 4)'], {}), '((frame_num, 4))\n', (473, 489), True, 'import numpy as np\n'), ((545, 564), 'numpy.zeros', 'np.zeros', (['frame_num'], {}), '(frame_num)\n', (553, 564), True, 'import numpy as np\n'), ((635, 655), 'cv2.imread', 'cv2.imread', (['img_file'], {}), '(img_... |
from unittest import TestCase
from pyfibre.model.objects.segments import (
FibreSegment, CellSegment
)
from pyfibre.tests.probe_classes.objects import (
ProbeFibreNetwork, generate_probe_segment)
from pyfibre.pyfibre_runner import PyFibreRunner
LOAD_NETWORK_PATH = "networkx.read_gpickle"
SAVE_NETWORK_PATH =... | [
"pyfibre.tests.probe_classes.objects.ProbeFibreNetwork",
"pyfibre.pyfibre_runner.PyFibreRunner",
"pyfibre.tests.probe_classes.objects.generate_probe_segment"
] | [((647, 662), 'pyfibre.pyfibre_runner.PyFibreRunner', 'PyFibreRunner', ([], {}), '()\n', (660, 662), False, 'from pyfibre.pyfibre_runner import PyFibreRunner\n'), ((694, 713), 'pyfibre.tests.probe_classes.objects.ProbeFibreNetwork', 'ProbeFibreNetwork', ([], {}), '()\n', (711, 713), False, 'from pyfibre.tests.probe_cla... |
"""
Code that goes along with the Airflow located at:
http://airflow.readthedocs.org/en/latest/tutorial.html
"""
from datetime import datetime, timedelta
from airflow import DAG
from airflow.contrib.kubernetes.pod import Port
from airflow.contrib.operators.kubernetes_pod_operator import KubernetesPodOperator
from airf... | [
"airflow.contrib.kubernetes.pod.Port",
"airflow.contrib.operators.kubernetes_pod_operator.KubernetesPodOperator",
"datetime.datetime",
"datetime.timedelta",
"airflow.operators.bash_operator.BashOperator"
] | [((437, 453), 'airflow.contrib.kubernetes.pod.Port', 'Port', (['"""http"""', '(80)'], {}), "('http', 80)\n", (441, 453), False, 'from airflow.contrib.kubernetes.pod import Port\n'), ((1215, 1279), 'airflow.operators.bash_operator.BashOperator', 'BashOperator', ([], {'task_id': '"""print_date"""', 'bash_command': '"""da... |
#!/usr/bin/env python
#
# This file is part of snmpclitools software.
#
# Copyright (c) 2005-2019, <NAME> <<EMAIL>>
# License: http://snmplabs.com/snmpclitools/license.html
#
# Notificaton Originator
#
import os
import socket
import sys
import traceback
from pysnmp import error
from pysnmp.entity import engine
from py... | [
"pysnmp.proto.api.v2c.apiPDU.setDefaults",
"snmpclitools.cli.msgmod.getUsage",
"pysnmp.proto.api.v2c.apiPDU.getVarBinds",
"pysnmp.proto.api.v1.apiTrapPDU.setTimeStamp",
"sys.exc_info",
"snmpclitools.cli.mibview.getUsage",
"snmpclitools.cli.main.generator",
"pysnmp.proto.proxy.rfc2576.v1ToV2",
"pysnm... | [((6597, 6616), 'pysnmp.entity.engine.SnmpEngine', 'engine.SnmpEngine', ([], {}), '()\n', (6614, 6616), False, 'from pysnmp.entity import engine\n'), ((6058, 6088), 'pysnmp.proto.api.v2c.apiPDU.getErrorStatus', 'v2c.apiPDU.getErrorStatus', (['pdu'], {}), '(pdu)\n', (6083, 6088), False, 'from pysnmp.proto.api import v1,... |
# Copyright 2019 DeepMind Technologies Limited. 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 by ... | [
"absl.testing.absltest.main",
"numpy.ones",
"jax.random.PRNGKey",
"numpy.mean",
"numpy.arange",
"numpy.testing.assert_array_almost_equal",
"numpy.full",
"numpy.zeros_like",
"numpy.std",
"jax.local_device_count",
"numpy.empty_like",
"haiku._src.batch_norm.BatchNorm",
"numpy.testing.assert_all... | [((6809, 6840), 'os.environ.get', 'os.environ.get', (['"""XLA_FLAGS"""', '""""""'], {}), "('XLA_FLAGS', '')\n", (6823, 6840), False, 'import os\n'), ((6960, 6975), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (6973, 6975), False, 'from absl.testing import absltest\n'), ((1117, 1154), 'haiku._src.bat... |
import cv2
import numpy as np
def canny(image):
gray = cv2.cvtColor(lane_image, cv2.COLOR_RGB2GRAY)
blur = cv2.GaussianBlur(gray, (5, 5), 0)
canny = cv2.Canny(blur, 50, 150)
return canny
def display_lines(image, lines):
line_image = np.zeros_like(image)
if lines is not None:
for line... | [
"cv2.line",
"cv2.GaussianBlur",
"cv2.Canny",
"numpy.zeros_like",
"numpy.copy",
"cv2.bitwise_and",
"cv2.waitKey",
"cv2.cvtColor",
"cv2.addWeighted",
"cv2.fillPoly",
"cv2.imread",
"numpy.array",
"cv2.imshow"
] | [((776, 804), 'cv2.imread', 'cv2.imread', (['"""test_image.jpg"""'], {}), "('test_image.jpg')\n", (786, 804), False, 'import cv2\n'), ((818, 832), 'numpy.copy', 'np.copy', (['image'], {}), '(image)\n', (825, 832), True, 'import numpy as np\n'), ((1065, 1115), 'cv2.addWeighted', 'cv2.addWeighted', (['lane_image', '(0.8)... |
import unittest
from src.pipeline.question_category import QuestionCategory, GetCategoryFromQuestionStructure
from src.unpack_data import QuestionAnswerRecipe, Recipe, Q_A
class TestQuestionCategory(unittest.TestCase):
def test_determine_description(self):
qc = QuestionCategory("counting_times")
... | [
"src.pipeline.question_category.QuestionCategory",
"src.unpack_data.Q_A",
"src.pipeline.question_category.GetCategoryFromQuestionStructure"
] | [((278, 312), 'src.pipeline.question_category.QuestionCategory', 'QuestionCategory', (['"""counting_times"""'], {}), "('counting_times')\n", (294, 312), False, 'from src.pipeline.question_category import QuestionCategory, GetCategoryFromQuestionStructure\n'), ((440, 474), 'src.pipeline.question_category.QuestionCategor... |
import math
ang = float(input('Digite o ângulo:'))
angr = math.radians(ang)
sen = math.sin(angr)
cos = math.cos(angr)
tan = math.tan(angr)
print('Dado o ângulo {}\nO Seno é {:.2f} \nO Cosseno é {:.2f}\nA Tangente é {:.2f}'.format(ang, sen, cos, tan))
| [
"math.radians",
"math.tan",
"math.cos",
"math.sin"
] | [((58, 75), 'math.radians', 'math.radians', (['ang'], {}), '(ang)\n', (70, 75), False, 'import math\n'), ((82, 96), 'math.sin', 'math.sin', (['angr'], {}), '(angr)\n', (90, 96), False, 'import math\n'), ((103, 117), 'math.cos', 'math.cos', (['angr'], {}), '(angr)\n', (111, 117), False, 'import math\n'), ((124, 138), 'm... |
from django.contrib import admin
from .models import User
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
class CustomUser(UserAdmin):
add_form = UserCreationForm
form = UserChangeForm
model = User
add_fieldsets = UserAdmin.add_fie... | [
"django.contrib.admin.site.register"
] | [((523, 560), 'django.contrib.admin.site.register', 'admin.site.register', (['User', 'CustomUser'], {}), '(User, CustomUser)\n', (542, 560), False, 'from django.contrib import admin\n')] |
####################################################################################
# Default addresses for use in testing.
#
# These addresses are unique, and providing them names makes tests easier to read
# and reason about.
####################################################################################
impor... | [
"smartpy.address"
] | [((405, 455), 'smartpy.address', 'sp.address', (['"""tz1VmiY38m3y95HqQLjMwqnMS7sdMfGomzKi"""'], {}), "('tz1VmiY38m3y95HqQLjMwqnMS7sdMfGomzKi')\n", (415, 455), True, 'import smartpy as sp\n'), ((559, 609), 'smartpy.address', 'sp.address', (['"""tz1abmz7jiCV2GH2u81LRrGgAFFgvQgiDiaf"""'], {}), "('tz1abmz7jiCV2GH2u81LRrGgA... |
# importing required modules
from zipfile import ZipFile
import os
def get_all_file_paths(directory):
# initializing empty file paths list
file_paths = []
# crawling through directory and subdirectories
for root, directories, files in os.walk(directory):
for filename in files:
# join the two strings in orde... | [
"os.walk",
"zipfile.ZipFile",
"os.path.join"
] | [((242, 260), 'os.walk', 'os.walk', (['directory'], {}), '(directory)\n', (249, 260), False, 'import os\n'), ((688, 717), 'zipfile.ZipFile', 'ZipFile', (['"""All files.zip"""', '"""w"""'], {}), "('All files.zip', 'w')\n", (695, 717), False, 'from zipfile import ZipFile\n'), ((363, 391), 'os.path.join', 'os.path.join', ... |
import pytest
from pydantic import ValidationError
from tests.odm.models import DocumentWithValidationOnSave
async def test_validate_on_insert():
doc = DocumentWithValidationOnSave(num_1=1, num_2=2)
doc.num_1 = "wrong_value"
with pytest.raises(ValidationError):
await doc.insert()
async def test... | [
"pytest.raises",
"tests.odm.models.DocumentWithValidationOnSave"
] | [((159, 205), 'tests.odm.models.DocumentWithValidationOnSave', 'DocumentWithValidationOnSave', ([], {'num_1': '(1)', 'num_2': '(2)'}), '(num_1=1, num_2=2)\n', (187, 205), False, 'from tests.odm.models import DocumentWithValidationOnSave\n'), ((354, 400), 'tests.odm.models.DocumentWithValidationOnSave', 'DocumentWithVal... |
import discord
from discord.ext import commands
from discord.utils import get
class c216(commands.Cog, name="c216"):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.command(name='Automaton_Doll_&_Winter_Lights', aliases=['c216'])
async def example_embed(self, ctx):
embed = ... | [
"discord.ext.commands.command",
"discord.Embed"
] | [((190, 263), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""Automaton_Doll_&_Winter_Lights"""', 'aliases': "['c216']"}), "(name='Automaton_Doll_&_Winter_Lights', aliases=['c216'])\n", (206, 263), False, 'from discord.ext import commands\n'), ((320, 389), 'discord.Embed', 'discord.Embed', ([], {'... |
import wicked as w
import pytest
def test_orbital_space():
w.reset_space()
w.add_space("c", "fermion", "occupied", ["m", "n"])
w.add_space("a", "fermion", "general", ["u", "v", "w", "x", "y", "z"])
w.add_space("v", "fermion", "unoccupied", ["e", "f"])
assert w.num_spaces() == 3
def test_orbital_... | [
"wicked.num_spaces",
"wicked.reset_space",
"wicked.add_space",
"pytest.raises"
] | [((65, 80), 'wicked.reset_space', 'w.reset_space', ([], {}), '()\n', (78, 80), True, 'import wicked as w\n'), ((85, 136), 'wicked.add_space', 'w.add_space', (['"""c"""', '"""fermion"""', '"""occupied"""', "['m', 'n']"], {}), "('c', 'fermion', 'occupied', ['m', 'n'])\n", (96, 136), True, 'import wicked as w\n'), ((141, ... |
import math
import rospy
from bitbots_animation_server.animation import Keyframe, Animation
from bitbots_splines.smooth_spline import SmoothSpline
class SplineAnimator:
def __init__(self, animation, current_joint_states):
self.anim = animation
self.start_time = rospy.get_time()
self.animat... | [
"rospy.logwarn",
"rospy.get_time",
"math.degrees",
"bitbots_splines.smooth_spline.SmoothSpline"
] | [((284, 300), 'rospy.get_time', 'rospy.get_time', ([], {}), '()\n', (298, 300), False, 'import rospy\n'), ((836, 940), 'rospy.logwarn', 'rospy.logwarn', (['"""No current joint positions. Will play animation starting from first keyframe."""'], {}), "(\n 'No current joint positions. Will play animation starting from f... |
'''
@since: 5 Feb 2016
@author: <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
@license: Lenovo License
@copyright: Copyright 2016, Lenovo
@organization: Lenovo
@summary: This module provides scriptable interfaces and scriptable python shell.
'''
import code
import logging
import sys
from pylxca import __version__
from pylxca.py... | [
"pylxca.pylxca_cmd.lxca_ishell.InteractiveShell",
"code.interact",
"sys._getframe",
"logging.getLogger"
] | [((452, 479), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (469, 479), False, 'import logging\n'), ((500, 530), 'pylxca.pylxca_cmd.lxca_ishell.InteractiveShell', 'lxca_ishell.InteractiveShell', ([], {}), '()\n', (528, 530), False, 'from pylxca.pylxca_cmd import lxca_ishell\n'), ((1878, ... |
import discord
from discord.ext import commands
import asyncio
# configuration files
import configparser
import sys, traceback
# grammar check
import language_check
grammar_en = language_check.LanguageTool('en-US')
# https://www.geeksforgeeks.org/get-synonymsantonyms-nltk-wordnet-python/
import nltk
from nltk.corpus ... | [
"re.split",
"discord.File",
"language_check.LanguageTool",
"nltk.corpus.wordnet.synsets",
"PIL.Image.open",
"PIL.ImageFont.truetype",
"PIL.ImageDraw.Draw",
"configparser.ConfigParser",
"discord.Client"
] | [((179, 215), 'language_check.LanguageTool', 'language_check.LanguageTool', (['"""en-US"""'], {}), "('en-US')\n", (206, 215), False, 'import language_check\n'), ((454, 481), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (479, 481), False, 'import configparser\n'), ((651, 667), 'discord.Cli... |
from django.contrib import admin
from .models import Order, OrderedItem
@admin.register(Order)
class ItemAdmin(admin.ModelAdmin):
pass
@admin.register(OrderedItem)
class ItemAdmin(admin.ModelAdmin):
pass
| [
"django.contrib.admin.register"
] | [((79, 100), 'django.contrib.admin.register', 'admin.register', (['Order'], {}), '(Order)\n', (93, 100), False, 'from django.contrib import admin\n'), ((153, 180), 'django.contrib.admin.register', 'admin.register', (['OrderedItem'], {}), '(OrderedItem)\n', (167, 180), False, 'from django.contrib import admin\n')] |
from setuptools import setup, find_packages
setup(
name='myapp',
version='0.1',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/clozinski/grok.install',
description="""\
Simple Part of the Install package.
""",
packages=find_packages('.'),
package_dir={'': '.'},
in... | [
"setuptools.find_packages"
] | [((267, 285), 'setuptools.find_packages', 'find_packages', (['"""."""'], {}), "('.')\n", (280, 285), False, 'from setuptools import setup, find_packages\n')] |
# Generated by Django 2.2.3 on 2019-07-04 07:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('DjangoGraphs', '0003_auto_20190704_0628'),
]
operations = [
migrations.AddField(
model_name='type',
name='unit',
... | [
"django.db.models.CharField"
] | [((335, 387), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '""""""', 'default': '""""""', 'max_length': '(4)'}), "(blank='', default='', max_length=4)\n", (351, 387), False, 'from django.db import migrations, models\n')] |
import unittest
from mock import patch
from src.backup.datastore.Backup import Backup
from src.retention.should_perform_retention_predicate import \
ShouldPerformRetentionPredicate
from src.commons.error_reporting import ErrorReporting
class TestShouldPerformRetentionPredicate(unittest.TestCase):
def setUp(... | [
"mock.patch.object",
"src.retention.should_perform_retention_predicate.ShouldPerformRetentionPredicate.test",
"mock.patch",
"src.backup.datastore.Backup.Backup",
"mock.patch.stopall"
] | [((1178, 1222), 'mock.patch.object', 'patch.object', (['ErrorReporting', '"""_create_http"""'], {}), "(ErrorReporting, '_create_http')\n", (1190, 1222), False, 'from mock import patch\n'), ((1228, 1266), 'mock.patch.object', 'patch.object', (['ErrorReporting', '"""report"""'], {}), "(ErrorReporting, 'report')\n", (1240... |
from typing import Dict, List, Set
from random import choice
class RandomizedSet:
def __init__(self):
self.vals: List[int] = []
self.indices: Dict[int, int] = {}
def insert(self, val: int) -> bool:
if val in self.indices.keys():
return False
self.indices[val] = l... | [
"random.choice"
] | [((770, 787), 'random.choice', 'choice', (['self.vals'], {}), '(self.vals)\n', (776, 787), False, 'from random import choice\n')] |
# -*- coding: UTF-8 -*-
"""
此脚本用于展示如何利用神经网络解决分类问题
"""
import os
from mlp import ANN
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs, make_circles, make_moons
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing import StandardScaler, OneHotEncod... | [
"sklearn.datasets.make_circles",
"numpy.meshgrid",
"sklearn.preprocessing.StandardScaler",
"numpy.random.seed",
"matplotlib.pyplot.show",
"mlp.ANN",
"sklearn.preprocessing.OneHotEncoder",
"sklearn.datasets.make_blobs",
"sklearn.datasets.make_moons",
"sklearn.linear_model.LogisticRegression",
"ma... | [((366, 387), 'numpy.random.seed', 'np.random.seed', (['(12046)'], {}), '(12046)\n', (380, 387), True, 'import numpy as np\n'), ((400, 451), 'sklearn.datasets.make_blobs', 'make_blobs', ([], {'n_samples': 'n', 'centers': '[[-2, -2], [2, 2]]'}), '(n_samples=n, centers=[[-2, -2], [2, 2]])\n', (410, 451), False, 'from skl... |
#!/usr/bin/env python
# (C) Copyright 2018, Intel Corporation
# SPDX-License-Identifier: MIT
import mraa
import time
# TODO Ensure you are running this sample on a Linux system with;
# * python-mraa bindings installed
# * Permissions to write to the aio system, this often requires root
# The following should read a ... | [
"mraa.Aio"
] | [((548, 559), 'mraa.Aio', 'mraa.Aio', (['(2)'], {}), '(2)\n', (556, 559), False, 'import mraa\n')] |
# 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
# distributed under th... | [
"retworkx.generators.directed_mesh_graph",
"copy.deepcopy",
"retworkx.is_isomorphic",
"retworkx.digraph_vf2_mapping",
"retworkx.PyDiGraph",
"retworkx.generators.directed_path_graph",
"retworkx.PyDAG",
"retworkx.generators.directed_grid_graph"
] | [((686, 702), 'retworkx.PyDAG', 'retworkx.PyDAG', ([], {}), '()\n', (700, 702), False, 'import retworkx\n'), ((719, 735), 'retworkx.PyDAG', 'retworkx.PyDAG', ([], {}), '()\n', (733, 735), False, 'import retworkx\n'), ((983, 999), 'retworkx.PyDAG', 'retworkx.PyDAG', ([], {}), '()\n', (997, 999), False, 'import retworkx\... |
import arcade
GAME_TITLE = 'Drawing Example'
WINDOW_HEIGHT = 600
WINDOW_WIDTH = 600
def on_draw(delta_time):
arcade.start_render()
arcade.draw_text(GAME_TITLE, 200, 300, arcade.color.BLACK, 12)
def main():
arcade.open_window(WINDOW_WIDTH, WINDOW_HEIGHT, GAME_TITLE)
arcade.set_background_color(arcad... | [
"arcade.run",
"arcade.open_window",
"arcade.schedule",
"arcade.start_render",
"arcade.set_background_color",
"arcade.draw_text",
"arcade.finish_render"
] | [((116, 137), 'arcade.start_render', 'arcade.start_render', ([], {}), '()\n', (135, 137), False, 'import arcade\n'), ((142, 204), 'arcade.draw_text', 'arcade.draw_text', (['GAME_TITLE', '(200)', '(300)', 'arcade.color.BLACK', '(12)'], {}), '(GAME_TITLE, 200, 300, arcade.color.BLACK, 12)\n', (158, 204), False, 'import a... |
from functools import reduce
from math import gcd
def lcm(a, b):
return a * (b // gcd(a, b))
result = reduce(lcm, range(1, 21), 20)
print(result)
assert result == 232792560
| [
"math.gcd"
] | [((88, 97), 'math.gcd', 'gcd', (['a', 'b'], {}), '(a, b)\n', (91, 97), False, 'from math import gcd\n')] |
import numpy as np
import cv2
import tensorflow as tf
import argparse
import time
from PIL import Image
import tf1st
if __name__ == "__main__":
# Argument parse
parser = argparse.ArgumentParser(description='Neural Style Transfer with OpenCV and Tensorflow')
parser.add_argument('--input-image', default="./images... | [
"argparse.ArgumentParser",
"tensorflow.clip_by_value",
"tf1st.gram_matrix",
"tensorflow.executing_eagerly",
"tensorflow.Variable",
"tf1st.get_model",
"cv2.imshow",
"cv2.imwrite",
"cv2.waitKey",
"time.sleep",
"tensorflow.enable_eager_execution",
"tf1st.load_and_process_img",
"tf1st.deprocess_... | [((176, 268), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Neural Style Transfer with OpenCV and Tensorflow"""'}), "(description=\n 'Neural Style Transfer with OpenCV and Tensorflow')\n", (199, 268), False, 'import argparse\n'), ((947, 974), 'tensorflow.enable_eager_execution', 'tf.... |
'''MobileNetV1 in PyTorch.
See the paper "MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications"
for more details.
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils import Swish, _make_divisible
class MbBlock(nn.Module):
'''Depthwise conv + Pointwise c... | [
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.nn.functional.avg_pool2d",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d",
"utils.Swish",
"torch.nn.Linear"
] | [((464, 570), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'in_planes'], {'kernel_size': '(3)', 'stride': 'stride', 'padding': '(1)', 'groups': 'in_planes', 'bias': '(False)'}), '(in_planes, in_planes, kernel_size=3, stride=stride, padding=1,\n groups=in_planes, bias=False)\n', (473, 570), True, 'import torch.nn a... |
import logging
from typing import Optional
from django.conf import settings
from django.db.models.query import QuerySet
from rest_framework.exceptions import ValidationError
import subscriptions.interfaces as interface
from .models import Subscription
from .serializers import SubscriptionsSerializer
from utils.base_s... | [
"subscriptions.interfaces.RecipesInrerface",
"django.conf.settings.ERROR_MESSAGE.get",
"logging.getLogger",
"subscriptions.interfaces.UsersAdminInterface",
"subscriptions.interfaces.UserInterface"
] | [((357, 384), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (374, 384), False, 'import logging\n'), ((1339, 1364), 'subscriptions.interfaces.UserInterface', 'interface.UserInterface', ([], {}), '()\n', (1362, 1364), True, 'import subscriptions.interfaces as interface\n'), ((2362, 2390), ... |
import os
import numpy as np
import pandas as pd
from datetime import datetime, timedelta
import re
date_now = datetime.now()
#
# data = pd.read_csv('/home/haishuowang/spider_data/2019-07-17/兰格钢铁网', sep='|', header=None)
# data.columns = ['Title', 'w_time', 'n_time', 'Link', 'Info']
# data = data[~data['Title'].duplic... | [
"os.listdir",
"pandas.read_csv",
"os.path.exists",
"pandas.to_datetime",
"datetime.timedelta",
"datetime.datetime.now",
"pandas.concat"
] | [((112, 126), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (124, 126), False, 'from datetime import datetime, timedelta\n'), ((7761, 7851), 'pandas.concat', 'pd.concat', (["[info_data['Title'], mid, buy, sell, mid_info, buy_info, sell_info]"], {'axis': '(1)'}), "([info_data['Title'], mid, buy, sell, mid_i... |
"""This module provides base class of [Node](mkapi.core.node.Node) and
[Module](mkapi.core.module.Module)."""
from dataclasses import dataclass, field
from typing import Any, Iterator, List, Union
from mkapi.core.base import Base, Type
from mkapi.core.docstring import Docstring, get_docstring
from mkapi.core.object im... | [
"mkapi.core.signature.get_signature",
"mkapi.core.object.get_origin",
"mkapi.core.linker.link",
"mkapi.core.docstring.get_docstring",
"dataclasses.field",
"mkapi.core.object.get_qualname",
"mkapi.core.object.split_prefix_and_name",
"mkapi.core.object.get_sourcefile_and_lineno"
] | [((1059, 1091), 'dataclasses.field', 'field', ([], {'default_factory': 'Signature'}), '(default_factory=Signature)\n', (1064, 1091), False, 'from dataclasses import dataclass, field\n'), ((1110, 1127), 'dataclasses.field', 'field', ([], {'init': '(False)'}), '(init=False)\n', (1115, 1127), False, 'from dataclasses impo... |
from functools import partial
import importlib
import pytest
from pathlib import Path
import zarr
import dask.array as dsa
import dask
import dask.core
import xarray
import numpy
from rechunker import api
_DIMENSION_KEY = "_ARRAY_DIMENSIONS"
def requires_import(module, *args):
try:
importlib.import_mo... | [
"dask.array.equal",
"rechunker.api.rechunk",
"numpy.ones",
"pathlib.Path",
"pytest.mark.skipif",
"rechunker.executors.pywren.pywren_local_function_executor",
"dask.core.istask",
"pytest.mark.parametrize",
"zarr.Blosc",
"numpy.prod",
"rechunker.api._get_executor",
"zarr.open",
"dask.array.one... | [((534, 573), 'functools.partial', 'partial', (['requires_import', '"""apache_beam"""'], {}), "(requires_import, 'apache_beam')\n", (541, 573), False, 'from functools import partial\n'), ((593, 628), 'functools.partial', 'partial', (['requires_import', '"""prefect"""'], {}), "(requires_import, 'prefect')\n", (600, 628)... |
# -*- coding: utf-8 -*-
"""
@project : WechatTogether
@Time : 2020/9/9 14:21
@Auth : AJay13
@File :interface_article_list.py
@IDE :PyCharm
@Motto:ABC(Always Be Coding)
"""
# 分类管理接口: 分类列表、删除分类、修改分离、添加分类
__all__ = ['InterFaceWechtTagList','InterfaceArticleFlag']
from flask import views
from sqlalchemy import and_
impo... | [
"exts.db.session.commit",
"apis.common.response_code.LayuiSuccess",
"apis.common.response_code.ParameterException",
"apis.v1.tags.verify_tag.TagListForm",
"apis.v1.tags.verify_tag.ArticleFlagForm",
"apps.admin.models.WechatArticle.query.get"
] | [((1408, 1479), 'apis.common.response_code.LayuiSuccess', 'response_code.LayuiSuccess', ([], {'message': '"""查询成功!"""', 'data': 'tag_data', 'count': 'total'}), "(message='查询成功!', data=tag_data, count=total)\n", (1434, 1479), False, 'from apis.common import response_code\n'), ((1793, 1820), 'apps.admin.models.WechatArti... |
#! /usr/bin/python3
from gpiozero import LEDBoard
from time import sleep
redLEDs = LEDBoard(15, 18, 17, 27)
greLEDs = LEDBoard(14, 2, 3, 4)
bluLEDs = LEDBoard(23, 24, 22, 25)
while True:
redLEDs.on()
sleep(0.5)
greLEDs.on()
sleep(0.5)
bluLEDs.on()
sleep(0.5)
redLEDs.off()
sleep(0.5)
... | [
"gpiozero.LEDBoard",
"time.sleep"
] | [((84, 108), 'gpiozero.LEDBoard', 'LEDBoard', (['(15)', '(18)', '(17)', '(27)'], {}), '(15, 18, 17, 27)\n', (92, 108), False, 'from gpiozero import LEDBoard\n'), ((119, 140), 'gpiozero.LEDBoard', 'LEDBoard', (['(14)', '(2)', '(3)', '(4)'], {}), '(14, 2, 3, 4)\n', (127, 140), False, 'from gpiozero import LEDBoard\n'), (... |
from app import apfell, db_objects, auth
from sanic.response import json
from app.database_models.model import Operator
from sanic import response
from sanic.exceptions import abort
from app import crypto
from sanic_auth import User
# ------------ OPERATORS ------------------------
@apfell.route("/api/v1.0/operators/... | [
"sanic.exceptions.abort",
"app.db_objects.get",
"app.database_models.model.Operator.select",
"app.db_objects.delete",
"app.crypto.hash_SHA512",
"app.db_objects.create",
"app.db_objects.update",
"sanic.response.json",
"app.apfell.route"
] | [((286, 339), 'app.apfell.route', 'apfell.route', (['"""/api/v1.0/operators/"""'], {'methods': "['GET']"}), "('/api/v1.0/operators/', methods=['GET'])\n", (298, 339), False, 'from app import apfell, db_objects, auth\n'), ((479, 533), 'app.apfell.route', 'apfell.route', (['"""/api/v1.0/operators/"""'], {'methods': "['PO... |
#!/usr/bin/env python3
"""The main entry point to the PDP trainer/tester/predictor."""
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file
# in the project root for full license information.
import numpy as np
import torch
import torch.optim as optim
import ... | [
"yaml.load",
"os.path.abspath",
"numpy.random.seed",
"csv.writer",
"argparse.ArgumentParser",
"logging.basicConfig",
"os.makedirs",
"torch.manual_seed",
"os.path.isdir",
"os.path.exists",
"os.path.relpath",
"pdp.trainer.SatFactorGraphTrainer",
"os.path.join",
"os.listdir",
"logging.getLo... | [((1884, 1939), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': 'format'}), '(level=logging.DEBUG, format=format)\n', (1903, 1939), False, 'import logging\n'), ((1958, 2030), 'logging.getLogger', 'logging.getLogger', (["(config['model_name'] + ' (' + config['version'] + ')')"], {... |
# Copyright 2000-2007 <NAME> <<EMAIL>>
# <NAME>
#
# All Rights Reserved
#
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appear in all copie... | [
"pyrepl.completer.get_class_members"
] | [((2397, 2431), 'pyrepl.completer.get_class_members', 'completer.get_class_members', (['klass'], {}), '(klass)\n', (2424, 2431), False, 'from pyrepl import completing_reader as cr, reader, completer\n')] |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 29 10:58:31 2016
@author: <EMAIL>
"""
import numpy as np
import scipy
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.patches import Ellipse
def plot_cov_ellipse(cov, pos, nstd=2, ax=None, **kwargs):
"""
Plots an `nstd` sigma error ellips... | [
"numpy.arctan2",
"numpy.linalg.eigh",
"matplotlib.pyplot.gca",
"matplotlib.patches.Ellipse",
"numpy.sqrt"
] | [((1407, 1473), 'matplotlib.patches.Ellipse', 'Ellipse', ([], {'xy': 'pos', 'width': 'width', 'height': 'height', 'angle': 'theta'}), '(xy=pos, width=width, height=height, angle=theta, **kwargs)\n', (1414, 1473), False, 'from matplotlib.patches import Ellipse\n'), ((1068, 1087), 'numpy.linalg.eigh', 'np.linalg.eigh', (... |
import time
import pytest
from freiner.limits import RateLimitItemPerMinute, RateLimitItemPerSecond
from freiner.storage.memory import MemoryStorage
from freiner.strategies.fixed_window import FixedWindowRateLimiter
from freiner.strategies.fixed_window_elastic import FixedWindowElasticExpiryRateLimiter
from freiner.s... | [
"freiner.strategies.moving_window.MovingWindowRateLimiter",
"freiner.limits.RateLimitItemPerMinute",
"freiner.strategies.fixed_window.FixedWindowRateLimiter",
"time.time",
"freiner.strategies.fixed_window_elastic.FixedWindowElasticExpiryRateLimiter",
"freiner.storage.memory.MemoryStorage",
"freiner.limi... | [((468, 483), 'freiner.storage.memory.MemoryStorage', 'MemoryStorage', ([], {}), '()\n', (481, 483), False, 'from freiner.storage.memory import MemoryStorage\n'), ((554, 585), 'freiner.strategies.fixed_window.FixedWindowRateLimiter', 'FixedWindowRateLimiter', (['storage'], {}), '(storage)\n', (576, 585), False, 'from f... |
import re
def str_contains_numbers(str):
"""
Check if a string contains at least one number.
:param str: the string to check.
:return: true if the string contains at least one number, false else.
"""
return bool(re.search(r'\d', str))
def str_is_num_version(str):
"""
Check if a strin... | [
"re.search"
] | [((1715, 1770), 're.search', 're.search', (['"""\\\\.(?P<extension>\\\\w+)"""', 'vulnerability_file'], {}), "('\\\\.(?P<extension>\\\\w+)', vulnerability_file)\n", (1724, 1770), False, 'import re\n'), ((238, 259), 're.search', 're.search', (['"""\\\\d"""', 'str'], {}), "('\\\\d', str)\n", (247, 259), False, 'import re\... |
# coding: utf-8
"""
Cloudbreak API
Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloud... | [
"six.iteritems"
] | [((3993, 4020), 'six.iteritems', 'iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (4002, 4020), False, 'from six import iteritems\n'), ((8457, 8484), 'six.iteritems', 'iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (8466, 8484), False, 'from six import iteritems\n'), ((12827, 12854), 's... |
#!/usr/bin/env python
from __future__ import print_function
from parcon import *
from collections import namedtuple
hexchars = '0123456789abcdefABCDEF'
Reg = namedtuple("Reg", ["num"])
Imm = namedtuple("Imm", ["value"])
MemRef = namedtuple("MemRef", ["reg", "offset"])
def keywords(vs):
return First(*[Keyword(Sig... | [
"collections.namedtuple",
"argparse.ArgumentParser",
"argparse.FileType"
] | [((160, 186), 'collections.namedtuple', 'namedtuple', (['"""Reg"""', "['num']"], {}), "('Reg', ['num'])\n", (170, 186), False, 'from collections import namedtuple\n'), ((193, 221), 'collections.namedtuple', 'namedtuple', (['"""Imm"""', "['value']"], {}), "('Imm', ['value'])\n", (203, 221), False, 'from collections impo... |
# Copyright 2018 DeepMind Technologies Limited. 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 by ... | [
"absl.testing.absltest.main",
"chex.fake_pmap_and_jit",
"optax.adam",
"acme.types.Transition",
"acme.jax.networks.NormalTanhDistribution",
"jax.random.PRNGKey",
"jax.nn.one_hot",
"acme.testing.fakes.transition_dataset",
"numpy.prod",
"acme.testing.fakes.DiscreteEnvironment",
"acme.agents.jax.bc.... | [((1951, 1986), 'acme.jax.utils.zeros_like', 'utils.zeros_like', (['spec.observations'], {}), '(spec.observations)\n', (1967, 1986), False, 'from acme.jax import utils\n'), ((2001, 2031), 'acme.jax.utils.add_batch_dim', 'utils.add_batch_dim', (['dummy_obs'], {}), '(dummy_obs)\n', (2020, 2031), False, 'from acme.jax imp... |
import os
import string
from .Gasteiger import getGasteiger_parameters, getGasteigerCharge
from .getForcefield import *
from .handleAtoms import Atomtypes, AtomsInfo, AtomLink
from .handleBonds import *
from .PCFF import (
PCFF_getAngletypes,
PCFF_getDihstypes,
PCFF_getImpstypes,
PCFF_getAtommass,
... | [
"os.path.exists",
"os.system"
] | [((24493, 24532), 'os.path.exists', 'os.path.exists', (['"""Datafile_warnings.txt"""'], {}), "('Datafile_warnings.txt')\n", (24507, 24532), False, 'import os\n'), ((24607, 24647), 'os.path.exists', 'os.path.exists', (['"""Datafile_warnings1.txt"""'], {}), "('Datafile_warnings1.txt')\n", (24621, 24647), False, 'import o... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('services', '0005_auto_20150901_1253'),
]
operations = [
migrations.AlterField(
model_name='story',
n... | [
"django.db.models.CharField",
"django.db.models.DateField"
] | [((358, 476), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(1)', 'null': '(True)', 'choices': "[(b'T', b'text'), (b'U', b'url'), (b'I', b'image')]"}), "(blank=True, max_length=1, null=True, choices=[(b'T',\n b'text'), (b'U', b'url'), (b'I', b'image')])\n", (374, 476), Fal... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2020, <NAME> & QuatroPe
# License: BSD-3-Clause
# Full Text: https://github.com/quatrope/djmpl/blob/master/LICENSE
# =============================================================================
# DOCS
# ==================================================... | [
"pyquery.PyQuery",
"django_matplotlib.core.template_by_alias",
"django_matplotlib.subplots",
"pytest.raises",
"matplotlib.pyplot.rcParams.update",
"pytest.mark.parametrize"
] | [((1055, 1106), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'figure.max_open_warning': 0}"], {}), "({'figure.max_open_warning': 0})\n", (1074, 1106), True, 'import matplotlib.pyplot as plt\n'), ((1279, 1395), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""engine, safe_type"""', "[('djan... |
# Created by <NAME> on 10/7/2019, 12:53 AM
import sys
import os
project_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
sys.path.append(project_path)
from detectors.relative_entropy_detector import RelativeEntropyDetector
from common.dataset import CSVDataset
from u... | [
"sys.path.append",
"utils.analysis.draw_array",
"os.path.abspath",
"common.dataset.CSVDataset",
"detectors.relative_entropy_detector.RelativeEntropyDetector"
] | [((173, 202), 'sys.path.append', 'sys.path.append', (['project_path'], {}), '(project_path)\n', (188, 202), False, 'import sys\n'), ((728, 753), 'detectors.relative_entropy_detector.RelativeEntropyDetector', 'RelativeEntropyDetector', ([], {}), '()\n', (751, 753), False, 'from detectors.relative_entropy_detector import... |
###############################################################################
#
# Purpose: Use VisIt CLI to iterate over Curves in a material database and
# compute and plot some common difference curves and output the results
# to either a curve or image file format.
#
# Programmer: <NAME>
# Date: Wed ... | [
"sys.stderr.write",
"sys.exit",
"glob.glob"
] | [((5446, 5457), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (5454, 5457), False, 'import sys, re, os, glob\n'), ((5908, 5925), 'glob.glob', 'glob.glob', (['dbname'], {}), '(dbname)\n', (5917, 5925), False, 'import sys, re, os, glob\n'), ((6114, 6125), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (6122, 6125), Fa... |
import flask
import flask_restx
import flask.testing
import layabauth.flask
from layabauth.testing import *
@pytest.fixture
def app() -> flask.Flask:
application = flask.Flask(__name__)
application.testing = True
api = flask_restx.Api(application)
@api.route("/requires_scopes")
class RequiresSco... | [
"flask.Flask",
"flask_restx.Api"
] | [((171, 192), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (182, 192), False, 'import flask\n'), ((234, 262), 'flask_restx.Api', 'flask_restx.Api', (['application'], {}), '(application)\n', (249, 262), False, 'import flask_restx\n')] |