code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# coding=utf-8
from tornado.web import authenticated, RequestHandler, HTTPError
from tornado.gen import coroutine
from bson.json_util import dumps, loads
__author__ = '<EMAIL>'
__date__ = "2018/12/17 下午5:54:00"
# TODO: 有时间需要做 json_schema 验证
class AuthBaseHandler(RequestHandler):
bson = None
offset = 0
... | [
"bson.json_util.loads",
"bson.json_util.dumps"
] | [((1184, 1196), 'bson.json_util.dumps', 'dumps', (['chunk'], {}), '(chunk)\n', (1189, 1196), False, 'from bson.json_util import dumps, loads\n'), ((1074, 1098), 'bson.json_util.loads', 'loads', (['self.request.body'], {}), '(self.request.body)\n', (1079, 1098), False, 'from bson.json_util import dumps, loads\n')] |
import tensorflow as tf
from wacky_rl import losses
from itertools import count
class SoftValueLoss(losses.WackyLoss):
_ids = count(0)
def __init__(self, logger=None):
super().__init__()
self.logger = logger
self.id = next(self._ids)
def __call__(self, prediction, log_probs, q):
... | [
"tensorflow.keras.losses.MSE",
"itertools.count",
"tensorflow.squeeze",
"tensorflow.reshape"
] | [((132, 140), 'itertools.count', 'count', (['(0)'], {}), '(0)\n', (137, 140), False, 'from itertools import count\n'), ((652, 660), 'itertools.count', 'count', (['(0)'], {}), '(0)\n', (657, 660), False, 'from itertools import count\n'), ((851, 878), 'tensorflow.reshape', 'tf.reshape', (['target', '[-1, 1]'], {}), '(tar... |
from django.db import models
from airtech.apps.authentication.models import User
from airtech.apps.flights.models import Flight
from airtech.helpers.id_generator import id_gen
from airtech.models import BaseModel
class Ticket(BaseModel):
'''
Handles creation of tickets
'''
flight = models.ForeignKey(... | [
"django.db.models.DateField",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.ForeignKey"
] | [((302, 377), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Flight'], {'related_name': '"""tickets"""', 'on_delete': 'models.CASCADE'}), "(Flight, related_name='tickets', on_delete=models.CASCADE)\n", (319, 377), False, 'from django.db import models\n'), ((403, 476), 'django.db.models.ForeignKey', 'models.Fore... |
import logging
import os
from collections import namedtuple
import googleapiclient.discovery
import neo4j
from googleapiclient.discovery import Resource
from oauth2client.client import ApplicationDefaultCredentialsError
from oauth2client.client import GoogleCredentials
from cartography.config import Config
from carto... | [
"logging.getLogger",
"collections.namedtuple",
"cartography.intel.gsuite.api.sync_gsuite_groups",
"os.environ.get",
"cartography.intel.gsuite.api.sync_gsuite_users",
"oauth2client.client.GoogleCredentials.from_stream"
] | [((516, 556), 'os.environ.get', 'os.environ.get', (['"""GSUITE_DELEGATED_ADMIN"""'], {}), "('GSUITE_DELEGATED_ADMIN')\n", (530, 556), False, 'import os\n'), ((572, 627), 'os.environ.get', 'os.environ.get', (['"""GSUITE_GOOGLE_APPLICATION_CREDENTIALS"""'], {}), "('GSUITE_GOOGLE_APPLICATION_CREDENTIALS')\n", (586, 627), ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `allocine` package."""
# To be tested with : python3 -m pytest -vs tests/test_allocine.py
import pytest
from allocine import Allocine
def test_class_Cinema():
allocine = Allocine()
cinema = allocine.get_cinema(allocine_cinema_id="P0645")
assert... | [
"pytest.raises",
"allocine.Allocine"
] | [((238, 248), 'allocine.Allocine', 'Allocine', ([], {}), '()\n', (246, 248), False, 'from allocine import Allocine\n'), ((519, 529), 'allocine.Allocine', 'Allocine', ([], {}), '()\n', (527, 529), False, 'from allocine import Allocine\n'), ((539, 564), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueError... |
from protocolbuffers import Dialog_pb2
from distributor.shared_messages import create_icon_info_msg, IconInfoData
from interactions.utils.tunable_icon import TunableIcon
from sims4.localization import TunableLocalizedStringFactory
from sims4.tuning.tunable import TunableList
from ui.ui_dialog import UiDialogOk
import s... | [
"sims4.localization.TunableLocalizedStringFactory",
"distributor.shared_messages.create_icon_info_msg",
"protocolbuffers.Dialog_pb2.UiDialogRowData",
"protocolbuffers.Dialog_pb2.UiDialogInfoInColumns",
"distributor.shared_messages.IconInfoData"
] | [((1127, 1161), 'protocolbuffers.Dialog_pb2.UiDialogInfoInColumns', 'Dialog_pb2.UiDialogInfoInColumns', ([], {}), '()\n', (1159, 1161), False, 'from protocolbuffers import Dialog_pb2\n'), ((1344, 1372), 'protocolbuffers.Dialog_pb2.UiDialogRowData', 'Dialog_pb2.UiDialogRowData', ([], {}), '()\n', (1370, 1372), False, 'f... |
from fastapi import FastAPI, APIRouter, HTTPException
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
from fastapi_utils.tasks import repeat_every
from pydantic import BaseModel, Field, validator
import pandas as pd
import praw
import os
import requests
from bs4 import BeautifulSoup
import re
import p... | [
"psycopg2.connect",
"fastapi.FastAPI",
"uvicorn.run",
"spacy.load",
"os.environ.get",
"requests.get",
"dotenv.load_dotenv",
"datetime.datetime.today",
"pandas.DataFrame",
"fastapi_utils.tasks.repeat_every",
"pandas.to_datetime"
] | [((1033, 1061), 'spacy.load', 'spacy.load', (['"""en_core_web_sm"""'], {}), "('en_core_web_sm')\n", (1043, 1061), False, 'import spacy\n'), ((1063, 1076), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (1074, 1076), False, 'from dotenv import load_dotenv\n'), ((1184, 1353), 'fastapi.FastAPI', 'FastAPI', ([], {'... |
import unittest
import os
from rastervision2.pipeline import rv_config
from rastervision2.pipeline.file_system import file_to_json
from rastervision2.core.data import (
ClassConfig, ChipClassificationLabelSourceConfig, GeoJSONVectorSourceConfig,
ChipClassificationGeoJSONStoreConfig, RasterioSourceConfig, Scene... | [
"rastervision2.pipeline.rv_config.get_tmp_dir",
"rastervision2.core.data.RasterioSourceConfig",
"rastervision2.pipeline.file_system.file_to_json",
"rastervision2.core.evaluation.ChipClassificationEvaluatorConfig",
"os.path.join",
"rastervision2.core.data.SceneConfig",
"rastervision2.core.data.GeoJSONVec... | [((1964, 1979), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1977, 1979), False, 'import unittest\n'), ((563, 615), 'rastervision2.core.data.ClassConfig', 'ClassConfig', ([], {'names': "['car', 'building', 'background']"}), "(names=['car', 'building', 'background'])\n", (574, 615), False, 'from rastervision2.co... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A Python implementation of the method described in [#a]_ and [#b]_ for
calculating Fourier coefficients for characterizing
closed contours.
References
----------
.. [#a] <NAME> and <NAME>, “Elliptic Fourier Features of a
Closed Contour," Computer Vision, Graphics ... | [
"numpy.insert",
"numpy.abs",
"numpy.ceil",
"numpy.ones",
"numpy.delete",
"numpy.diff",
"numpy.append",
"numpy.stack",
"numpy.linspace",
"numpy.sum",
"numpy.arctan2",
"numpy.cos",
"numpy.array",
"numpy.sin",
"numpy.cumsum",
"matplotlib.pyplot.subplot2grid",
"numpy.arange",
"matplotl... | [((1317, 1341), 'numpy.diff', 'np.diff', (['contour'], {'axis': '(0)'}), '(contour, axis=0)\n', (1324, 1341), True, 'import numpy as np\n'), ((1490, 1513), 'numpy.arange', 'np.arange', (['(1)', '(order + 1)'], {}), '(1, order + 1)\n', (1499, 1513), True, 'import numpy as np\n'), ((3806, 3844), 'numpy.arctan2', 'np.arct... |
from rest_framework import serializers
from dataprocessing.serializers import userProfileSerializer
#from workprogramsapp.educational_program.serializers import EducationalProgramSerializer
from workprogramsapp.expertise.models import UserExpertise, Expertise, ExpertiseComments
from workprogramsapp.serializers import ... | [
"workprogramsapp.expertise.models.UserExpertise.objects.create",
"workprogramsapp.serializers.WorkProgramShortForExperiseSerializer",
"dataprocessing.serializers.userProfileSerializer",
"workprogramsapp.expertise.models.Expertise.objects.create"
] | [((2815, 2848), 'dataprocessing.serializers.userProfileSerializer', 'userProfileSerializer', ([], {'many': '(False)'}), '(many=False)\n', (2836, 2848), False, 'from dataprocessing.serializers import userProfileSerializer\n'), ((566, 599), 'dataprocessing.serializers.userProfileSerializer', 'userProfileSerializer', ([],... |
import feedparser
import urllib
from lxml import etree as ET
import re
contents = urllib.request.urlopen("https://www.sec.gov/Archives/edgar/usgaap.rss.xml", )
tree = ET.parse(contents)
# get root elememen
root = tree.getroot()
URLset = []
for child in root.iter('{http://www.sec.gov/Archives/edg... | [
"lxml.etree.parse",
"urllib.request.urlopen"
] | [((90, 165), 'urllib.request.urlopen', 'urllib.request.urlopen', (['"""https://www.sec.gov/Archives/edgar/usgaap.rss.xml"""'], {}), "('https://www.sec.gov/Archives/edgar/usgaap.rss.xml')\n", (112, 165), False, 'import urllib\n'), ((178, 196), 'lxml.etree.parse', 'ET.parse', (['contents'], {}), '(contents)\n', (186, 196... |
import os
import unittest
os.environ['ENABLE_FAKE_GEOCODER'] = 'YES'
from src.app import main
class FakeGeocoderTests(unittest.TestCase):
def setUp(self):
main.app.config['TESTING'] = True
self.client = main.app.test_client()
def test_itCanSeedGeocodes(self):
response = self.client.... | [
"src.app.main.app.test_client"
] | [((227, 249), 'src.app.main.app.test_client', 'main.app.test_client', ([], {}), '()\n', (247, 249), False, 'from src.app import main\n')] |
import sys
_str = sys.argv[1]
import coopihc
from coopihc.space import StateElement, Space, State
import numpy
x = StateElement(
values=1,
spaces=Space([numpy.array([-1.0]).reshape(1, 1), numpy.array([1.0]).reshape(1, 1)]),
)
y = StateElement(values=2, spaces=Space(numpy.array([1, 2, 3], dtype=numpy.int)))... | [
"collections.OrderedDict",
"numpy.ones",
"coopihc.space.State",
"numpy.array",
"numpy.zeros",
"copy.deepcopy",
"copy.copy",
"time.time"
] | [((430, 477), 'coopihc.space.State', 'State', ([], {'substate_x': 'x', 'substate_y': 'y', 'substate_z': 'z'}), '(substate_x=x, substate_y=y, substate_z=z)\n', (435, 477), False, 'from coopihc.space import StateElement, Space, State\n'), ((882, 929), 'coopihc.space.State', 'State', ([], {}), "(**{'substate_xx': xx, 'sub... |
# Generated by Django 2.2 on 2019-07-02 02:36
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('streams', '0001_initial'),
]
o... | [
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey"
] | [((212, 269), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (243, 269), False, 'from django.db import migrations, models\n'), ((446, 536), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'n... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import sys
import yaml
from sort_yaml import sort_yaml_data
def add_devel_repository(yaml_file, name, vcs_type, url, version=None):
data = yaml.safe_load(open(yaml_file, 'r'))
if data['type'] == 'gbp':
add_devel_repository_f... | [
"rosdistro.verify._yaml_header_lines",
"rosdistro.verify._to_yaml",
"argparse.ArgumentParser",
"yaml.dump",
"sort_yaml.sort_yaml_data"
] | [((974, 988), 'rosdistro.verify._to_yaml', '_to_yaml', (['data'], {}), '(data)\n', (982, 988), False, 'from rosdistro.verify import _to_yaml, _yaml_header_lines\n'), ((1890, 1910), 'sort_yaml.sort_yaml_data', 'sort_yaml_data', (['data'], {}), '(data)\n', (1904, 1910), False, 'from sort_yaml import sort_yaml_data\n'), (... |
import datetime
def isodt_to_date(isodt):
try:
date = datetime.datetime.strptime(isodt, "%Y-%m-%d")
except:
date = None
return date
def date_to_isodt(date):
return date.strftime("%Y-%m-%d")
def dateparts_to_isodt(year, month, day):
date = datetime.date(year, month, day)
retu... | [
"datetime.datetime.strptime",
"datetime.datetime.now",
"datetime.date"
] | [((280, 311), 'datetime.date', 'datetime.date', (['year', 'month', 'day'], {}), '(year, month, day)\n', (293, 311), False, 'import datetime\n'), ((67, 112), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['isodt', '"""%Y-%m-%d"""'], {}), "(isodt, '%Y-%m-%d')\n", (93, 112), False, 'import datetime\n'), ((3... |
from collections import OrderedDict
from decimal import Decimal, ROUND_DOWN
from models import models
def get_results(name):
results = models.Result.select(
models.Result,
models.Call.accept_ap,
models.Call.override_winner
).where(
(models.Result.level == 'state') | (models.Res... | [
"collections.OrderedDict",
"models.models.db.connect",
"models.models.db.close",
"models.models.Result.select",
"decimal.Decimal"
] | [((684, 697), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (695, 697), False, 'from collections import OrderedDict\n'), ((1779, 1796), 'models.models.db.close', 'models.db.close', ([], {}), '()\n', (1794, 1796), False, 'from models import models\n'), ((1013, 1027), 'decimal.Decimal', 'Decimal', (['value'... |
import matplotlib.pyplot as plt
import matplotlib
name_dict = {'1': 1, '32': 2, '64': 3, '128': 4, '256': 5}
threads = [1, 2, 3, 4, 5]
# threads = [1, 32, 64, 128, 256]
a = [0.363213,0.351147,0.350840,0.349051,0.346477]
b = [0.364184, 0.342212, 0.345006, 0.344206, 0.344719]
c=[0.353136, 0.353382, 0.347007, 0.349023, ... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((440, 477), 'matplotlib.pyplot.plot', 'plt.plot', (['threads', 'a'], {'label': '"""1 block"""'}), "(threads, a, label='1 block')\n", (448, 477), True, 'import matplotlib.pyplot as plt\n'), ((478, 517), 'matplotlib.pyplot.plot', 'plt.plot', (['threads', 'b'], {'label': '"""32 blocks"""'}), "(threads, b, label='32 bloc... |
def test_window():
import arcade
width = 800
height = 600
title = "My Title"
resizable = True
arcade.open_window(width, height, title, resizable)
arcade.set_background_color(arcade.color.AMAZON)
w = arcade.get_window()
assert w is not None
arcade.set_window(w)
p = arcade.ge... | [
"arcade.get_projection",
"arcade.set_window",
"arcade.open_window",
"arcade.get_viewport",
"arcade.get_window",
"arcade.close_window",
"arcade.schedule",
"arcade.pause",
"arcade.start_render",
"arcade.set_background_color",
"arcade.quick_run",
"arcade.finish_render"
] | [((118, 169), 'arcade.open_window', 'arcade.open_window', (['width', 'height', 'title', 'resizable'], {}), '(width, height, title, resizable)\n', (136, 169), False, 'import arcade\n'), ((175, 223), 'arcade.set_background_color', 'arcade.set_background_color', (['arcade.color.AMAZON'], {}), '(arcade.color.AMAZON)\n', (2... |
from pascal.scanner import Scanner
from pascal.token_lookup import *
reserved_words = {
'program': TK_PROGRAM,
'var': TK_VAR,
'procedure': TK_PROCEDURE,
'function': TK_FUNCTION,
'const': TK_CONSTANT,
'begin': TK_BEGIN,
'end': TK_END,
'if': TK_IF,
'then': TK_THEN,
'else': TK_ELS... | [
"pascal.scanner.Scanner"
] | [((1435, 1452), 'pascal.scanner.Scanner', 'Scanner', (['filename'], {}), '(filename)\n', (1442, 1452), False, 'from pascal.scanner import Scanner\n')] |
"""
PDBe web services
"""
from __future__ import division
from iotbx.pdb.web_service_api import FTPService, RESTService
from iotbx.pdb.download import openurl, NotFound
import json
class configurable_get_request(object):
def __init__(self, opener):
self.opener = opener
def __call__(self, url, identifie... | [
"libtbx.object_oriented_patterns.lazy_initialization",
"iotbx.pdb.web_service_api.RESTService",
"itertools.izip",
"json.load",
"iotbx.pdb.web_service_api.FTPService"
] | [((1826, 1923), 'iotbx.pdb.web_service_api.FTPService', 'FTPService', ([], {'url': '"""http://www.ebi.ac.uk/pdbe/entry-files/"""', 'namer': 'identifier_to_pdb_entry_name'}), "(url='http://www.ebi.ac.uk/pdbe/entry-files/', namer=\n identifier_to_pdb_entry_name)\n", (1836, 1923), False, 'from iotbx.pdb.web_service_api... |
import unittest
from itertools import zip_longest
from rl.old_lib.UCB import UCB
class UCBTest(unittest.TestCase):
def test_select_action_explores(self):
policy = UCB()
states = list(range(5))
estimates = [0]*5
indices = []
estimates_new = []
for _ in range(len(st... | [
"rl.old_lib.UCB.UCB",
"itertools.zip_longest"
] | [((178, 183), 'rl.old_lib.UCB.UCB', 'UCB', ([], {}), '()\n', (181, 183), False, 'from rl.old_lib.UCB import UCB\n'), ((373, 407), 'itertools.zip_longest', 'zip_longest', (['[]', 'states', 'estimates'], {}), '([], states, estimates)\n', (384, 407), False, 'from itertools import zip_longest\n')] |
#!/usr/bin/python3
"""This script that takes in a URL, sends a request to the URL and displays
the value of the X-Request-Id variable found in the header of the response.
"""
from urllib.request import Request, urlopen
from sys import argv
def get_headers(header):
"""Displays the value of the specified header... | [
"urllib.request.Request",
"urllib.request.urlopen"
] | [((516, 532), 'urllib.request.Request', 'Request', (['argv[1]'], {}), '(argv[1])\n', (523, 532), False, 'from urllib.request import Request, urlopen\n'), ((407, 419), 'urllib.request.urlopen', 'urlopen', (['req'], {}), '(req)\n', (414, 419), False, 'from urllib.request import Request, urlopen\n')] |
# Copyright 2018 <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 in writing, soft... | [
"jsonmodels.fields.FloatField",
"jsonmodels.fields.IntField",
"jsonmodels.fields.StringField"
] | [((661, 700), 'jsonmodels.fields.StringField', 'fields.StringField', ([], {'help_text': '"""Version"""'}), "(help_text='Version')\n", (679, 700), False, 'from jsonmodels import models, fields\n'), ((1279, 1318), 'jsonmodels.fields.StringField', 'fields.StringField', ([], {'help_text': '"""Version"""'}), "(help_text='Ve... |
import time
import os
import torch
from utils.utils import NanError
def depth2class(depth, depth_start, depth_interval, depth_num, inv=False):
if not inv:
return (depth - depth_start) / (depth_interval + 1e-9)
else:
depth_end = depth_start + (depth_num-1) * depth_interval
inv_interv =... | [
"torch.nn.functional.grid_sample",
"torch.ones_like",
"torch.eye",
"torch.stack",
"torch.no_grad",
"torch.arange"
] | [((3205, 3229), 'torch.ones_like', 'torch.ones_like', (['x_coord'], {}), '(x_coord)\n', (3220, 3229), False, 'import torch\n'), ((3649, 3765), 'torch.nn.functional.grid_sample', 'torch.nn.functional.grid_sample', (['image', 'warped_coord'], {'mode': '"""bilinear"""', 'padding_mode': '"""zeros"""', 'align_corners': '(Fa... |
from epypes.queue import Queue
def create_queues():
q_in = Queue()
q_images = Queue()
q_out = Queue()
return q_in, q_images, q_out
def dispatch_images(images):
n = len(images)
if n == 1:
return {'image': images[0]}
return {'image_{:d}'.format(i+1) : images[i] for i in range(... | [
"epypes.queue.Queue"
] | [((66, 73), 'epypes.queue.Queue', 'Queue', ([], {}), '()\n', (71, 73), False, 'from epypes.queue import Queue\n'), ((89, 96), 'epypes.queue.Queue', 'Queue', ([], {}), '()\n', (94, 96), False, 'from epypes.queue import Queue\n'), ((109, 116), 'epypes.queue.Queue', 'Queue', ([], {}), '()\n', (114, 116), False, 'from epyp... |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import logging
from unittest import skipIf, TestCase
from uw_bookstore import Bookstore
from uw_sws.term import get_current_term,\
get_term_by_year_and_quarter
from uw_sws.registration import get_schedule_by_regid_and_term
from ... | [
"uw_sws.term.get_current_term",
"uw_bookstore.Bookstore",
"uw_sws.term.get_term_by_year_and_quarter",
"uw_sws.registration.get_schedule_by_regid_and_term"
] | [((602, 613), 'uw_bookstore.Bookstore', 'Bookstore', ([], {}), '()\n', (611, 613), False, 'from uw_bookstore import Bookstore\n'), ((1063, 1074), 'uw_bookstore.Bookstore', 'Bookstore', ([], {}), '()\n', (1072, 1074), False, 'from uw_bookstore import Bookstore\n'), ((1090, 1108), 'uw_sws.term.get_current_term', 'get_cur... |
import numpy as np
from linear_models.logistic_regression import LogisticRegression
class Perceptron(LogisticRegression):
"""A simple (binary classification) perceptron. Uses binary cross-entropy loss for updating weights.
>>NOTE: it inherits most of the code from logistic regression for simplicity.<<
Pa... | [
"numpy.dot"
] | [((1468, 1488), 'numpy.dot', 'np.dot', (['x', 'self.coef'], {}), '(x, self.coef)\n', (1474, 1488), True, 'import numpy as np\n')] |
# http://sites.nd.edu/munira-syed/2019/10/25/word2vec-implementation-with-keras-2-0/
# https://zhuanlan.zhihu.com/p/42651829
from keras.layers import dot
from keras.layers.core import Dense, Reshape
from keras.layers.embeddings import Embedding
from keras.models import Sequential
word_model = Sequential()
word_model... | [
"keras.layers.core.Reshape",
"keras.models.Sequential",
"keras.layers.embeddings.Embedding",
"keras.layers.dot",
"keras.layers.core.Dense"
] | [((296, 308), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (306, 308), False, 'from keras.models import Sequential\n'), ((508, 520), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (518, 520), False, 'from keras.models import Sequential\n'), ((729, 800), 'keras.layers.dot', 'dot', (['[word_mode... |
# -*- coding: utf-8 -*-
"""----------------------------------------------------------------------------
Author:
<NAME> (wo1fSea)
<EMAIL>
Date:
2017/10/29
Description:
redis_object.py
----------------------------------------------------------------------------"""
import time
from . import db_connection
... | [
"_pickle.dumps",
"msgpack.packb",
"_pickle.loads",
"msgpack.unpackb",
"time.time"
] | [((723, 741), 'msgpack.packb', 'msgpack.packb', (['obj'], {}), '(obj)\n', (736, 741), False, 'import msgpack\n'), ((788, 829), 'msgpack.unpackb', 'msgpack.unpackb', (['packed'], {'encoding': '"""utf-8"""'}), "(packed, encoding='utf-8')\n", (803, 829), False, 'import msgpack\n'), ((900, 917), '_pickle.dumps', 'pickle.du... |
if '__file__' in globals():
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import dezero as dz
import numpy as np
_NUM_ITER = 10
def f(x: dz.Variable) -> dz.Variable:
y = x ** 4 - 2 * x ** 2
return y
def gx2(x: np.ndarray) -> np.ndarray:
return 12 * x *... | [
"os.path.dirname",
"numpy.array"
] | [((377, 390), 'numpy.array', 'np.array', (['(2.0)'], {}), '(2.0)\n', (385, 390), True, 'import numpy as np\n'), ((90, 115), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (105, 115), False, 'import os\n')] |
#
# Copyright 2019 - <EMAIL> <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 in w... | [
"auth0_login.util.get_listen_port_from_url",
"click.command",
"auth0_login.fatal",
"webbrowser.open",
"http.server.HTTPServer",
"auth0_login.util.assert_listen_port_is_available"
] | [((2491, 2557), 'click.command', 'click.command', (['"""get-token"""'], {'help': 'SAMLGetAccessTokenCommand.__doc__'}), "('get-token', help=SAMLGetAccessTokenCommand.__doc__)\n", (2504, 2557), False, 'import click\n'), ((1643, 1686), 'auth0_login.util.get_listen_port_from_url', 'get_listen_port_from_url', (['self.callb... |
#!/usr/bin/env python3
from termcolor import colored, cprint
import threading
import requests
import argparse
import signal
import time
import sys
import os
import re
logo = """
___ _____ _ _ __
| _ \___ ____ __ ___ _ _ _____|_ _| |_ (_)___ / _|
| / -_(_-| '_ / _ | ' \(_-/... | [
"signal.signal",
"termcolor.colored",
"argparse.ArgumentParser",
"threading.Lock",
"time.sleep",
"re.findall",
"os.path.abspath",
"sys.stdout.flush",
"termcolor.cprint",
"os.remove"
] | [((626, 642), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (640, 642), False, 'import threading\n'), ((656, 672), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (670, 672), False, 'import threading\n'), ((854, 872), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (870, 872), False, 'import sys... |
from gevent import monkey
_PATCHED = False
if not _PATCHED:
monkey.patch_all(thread=False, select=False)
_PATCHED = True
from ._version import VERSION as __version__ # noqa: F401
from .functional import pipeline, stop # noqa: F401
from .reactive import * # noqa: F401, F403
| [
"gevent.monkey.patch_all"
] | [((64, 108), 'gevent.monkey.patch_all', 'monkey.patch_all', ([], {'thread': '(False)', 'select': '(False)'}), '(thread=False, select=False)\n', (80, 108), False, 'from gevent import monkey\n')] |
import argparse
import json
from bart_score import BARTScorer
def main(args):
instances = []
with open(args.input_file, "r") as f:
for line in f:
data = json.loads(line)
instances.append(data)
sources = []
targets = []
for instance in instances:
candidate ... | [
"json.loads",
"json.dumps",
"bart_score.BARTScorer",
"argparse.ArgumentParser"
] | [((1481, 1506), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1504, 1506), False, 'import argparse\n'), ((618, 677), 'bart_score.BARTScorer', 'BARTScorer', ([], {'device': 'device', 'checkpoint': '"""facebook/bart-large"""'}), "(device=device, checkpoint='facebook/bart-large')\n", (628, 677),... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # S_Di... | [
"matplotlib.pyplot.grid",
"numpy.sqrt",
"numpy.log",
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.imshow",
"numpy.atleast_2d",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.yticks",
"ConditionalFP.ConditionalFP",
"matplotlib.pyplot.ylim",
"numpy.abs",
"collections.namedtuple",
"nu... | [((1037, 1061), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn"""'], {}), "('seaborn')\n", (1050, 1061), True, 'import matplotlib.pyplot as plt\n'), ((1414, 1440), 'ARPM_utils.struct_to_dict', 'struct_to_dict', (["db['Data']"], {}), "(db['Data'])\n", (1428, 1440), False, 'from ARPM_utils import struct_to... |
import traceback
try:
from .Polygonize_action import PolygonizePluginAction
PolygonizePluginAction().register()
except Exception as e:
print(traceback.format_exc()) | [
"traceback.format_exc"
] | [((158, 180), 'traceback.format_exc', 'traceback.format_exc', ([], {}), '()\n', (178, 180), False, 'import traceback\n')] |
# Filename: BotCore.py
# Author: mfwass
# Date: January 8th, 2017
#
# The Legend of Pirates Online Software
# Copyright (c) The Legend of Pirates Online. All rights reserved.
#
# All use of this software is subject to the terms of the revised BSD
# license. You should have received a copy of this license along
# with ... | [
"bot.tasks.BotTasks.BotTasks",
"bot.core.BotSettings.BotSettings",
"bot.commands.Commands.Commands.__init__",
"os.path.exists"
] | [((952, 977), 'bot.core.BotSettings.BotSettings', 'BotSettings.BotSettings', ([], {}), '()\n', (975, 977), False, 'from bot.core import BotGlobals, BotSettings\n'), ((1154, 1204), 'os.path.exists', 'os.path.exists', (['BotGlobals.LOCAL_SETTINGS_FILENAME'], {}), '(BotGlobals.LOCAL_SETTINGS_FILENAME)\n', (1168, 1204), Fa... |
import numpy as np
from .utils import memo, validate_tuple
__all__ = ['binary_mask', 'r_squared_mask', 'cosmask', 'sinmask',
'theta_mask']
@memo
def binary_mask(radius, ndim):
"Elliptical mask in a rectangular array"
radius = validate_tuple(radius, ndim)
points = [np.arange(-rad, rad + 1) for ... | [
"numpy.atleast_2d",
"numpy.fromfunction",
"numpy.round",
"numpy.asarray",
"numpy.any",
"numpy.indices",
"numpy.exp",
"numpy.array",
"numpy.sum",
"numpy.arctan2",
"numpy.meshgrid",
"numpy.all",
"numpy.arange"
] | [((1551, 1585), 'numpy.asarray', 'np.asarray', (['(coords ** 2)'], {'dtype': 'int'}), '(coords ** 2, dtype=int)\n', (1561, 1585), True, 'import numpy as np\n'), ((2371, 2431), 'numpy.fromfunction', 'np.fromfunction', (['tan_of_coord', '[(r * 2 + 1) for r in radius]'], {}), '(tan_of_coord, [(r * 2 + 1) for r in radius])... |
"""
This module defines a client for the plotting server
"""
import zmq
from zmpl import options
class Client(object):
"""
Client class to connect to the plotting server
"""
def __init__(self):
"""
Initializes the client and connects to the default address
"""
self.cont... | [
"zmq.Context"
] | [((326, 339), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (337, 339), False, 'import zmq\n')] |
"""
Knauer pump control.
"""
import asyncio
import warnings
from enum import Enum
from typing import List
from loguru import logger
from flowchem.components.devices.Knauer.Knauer_common import KnauerEthernetDevice
from flowchem.components.stdlib import Pump
from flowchem.exceptions import DeviceError
from flowchem.un... | [
"flowchem.exceptions.DeviceError",
"loguru.logger.debug",
"loguru.logger.info",
"asyncio.WindowsSelectorEventLoopPolicy",
"flowchem.units.flowchem_ureg.parse_expression",
"flowchem.units.flowchem_ureg",
"fastapi.APIRouter",
"asyncio.sleep",
"warnings.warn"
] | [((3077, 3119), 'flowchem.units.flowchem_ureg.parse_expression', 'flowchem_ureg.parse_expression', (['"""0 ml/min"""'], {}), "('0 ml/min')\n", (3107, 3119), False, 'from flowchem.units import flowchem_ureg\n'), ((5210, 5255), 'warnings.warn', 'warnings.warn', (['f"""Unrecognized reply: {reply}"""'], {}), "(f'Unrecogniz... |
# Copyright 2018 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-2.0
#
# Unless required by applica... | [
"tensorflow.python.autograph.pyct.static_analysis.activity.resolve",
"tensorflow.python.autograph.pyct.naming.Namer",
"tensorflow.python.autograph.pyct.qual_names.resolve",
"tensorflow.python.autograph.pyct.parser.parse_entity",
"tensorflow.python.autograph.pyct.cfg.build",
"tensorflow.python.autograph.py... | [((2260, 2271), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (2269, 2271), False, 'from tensorflow.python.platform import test\n'), ((1598, 1646), 'tensorflow.python.autograph.pyct.parser.parse_entity', 'parser.parse_entity', (['test_fn'], {'future_features': '()'}), '(test_fn, future_features... |
import textwrap
from itertools import groupby
from pathlib import Path
import shutil
import os
from snakemake.logging import logger
from snakemake import __version__
class RuleTest:
def __init__(self, job, basedir):
self.name = job.rule.name
self.output = job.output
self.path = basedir / ... | [
"itertools.groupby",
"os.makedirs",
"pathlib.Path",
"shutil.copytree",
"snakemake.logging.logger.info",
"shutil.copy",
"snakemake.logging.logger.warning",
"jinja2.PackageLoader"
] | [((705, 758), 'snakemake.logging.logger.info', 'logger.info', (['"""Generating unit tests for each rule..."""'], {}), "('Generating unit tests for each rule...')\n", (716, 758), False, 'from snakemake.logging import logger\n'), ((1132, 1142), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (1136, 1142), False, 'fro... |
"""
Entry point for CLI. CLI code is in the scripts/ folder.
See
https://stackoverflow.com/a/39228156
https://github.com/drorata/mwe-subcommands-click
for how to separate a click CLI into subfiles
"""
import click
from usgs_topo_tiler.scripts import list_s3, metadata, mosaic, mosaic_bulk
@click.group()
def main()... | [
"click.group"
] | [((296, 309), 'click.group', 'click.group', ([], {}), '()\n', (307, 309), False, 'import click\n')] |
from functools import reduce
import operator
import math
def calculateDistance(pointA, pointB):
distance = math.sqrt((pointA[0] - pointB[0])**2 + (pointA[1] - pointB[1])**2)
return distance
def orderCoordinates(*coords):
if len(coords) == 0 or coords is None:
return
center = tuple(map(ope... | [
"math.sqrt"
] | [((113, 183), 'math.sqrt', 'math.sqrt', (['((pointA[0] - pointB[0]) ** 2 + (pointA[1] - pointB[1]) ** 2)'], {}), '((pointA[0] - pointB[0]) ** 2 + (pointA[1] - pointB[1]) ** 2)\n', (122, 183), False, 'import math\n')] |
import os
from setuptools import find_packages
from distutils.core import setup
def main():
limited_deps = os.environ.get("PARSONS_LIMITED_DEPENDENCIES", "")
if limited_deps.strip().upper() in ("1", "YES", "TRUE", "ON"):
install_requires = [
"petl",
"python-dateutil",
... | [
"os.path.join",
"os.path.dirname",
"setuptools.find_packages",
"os.environ.get"
] | [((114, 164), 'os.environ.get', 'os.environ.get', (['"""PARSONS_LIMITED_DEPENDENCIES"""', '""""""'], {}), "('PARSONS_LIMITED_DEPENDENCIES', '')\n", (128, 164), False, 'import os\n'), ((1881, 1906), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1896, 1906), False, 'import os\n'), ((2378, 239... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME> Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in c... | [
"backend.templatesets.legacy_apps.configuration.models.K8sService.perform_create",
"backend.templatesets.legacy_apps.configuration.models.ShowVersion.objects.create",
"backend.templatesets.legacy_apps.configuration.models.ResourceFile.objects.create",
"backend.templatesets.legacy_apps.configuration.models.K8s... | [((1042, 1152), 'backend.templatesets.legacy_apps.configuration.models.K8sDeployment.perform_create', 'models.K8sDeployment.perform_create', ([], {'name': '"""nginx-deployment1"""', 'config': 'res_manifest.NGINX_DEPLOYMENT1_JSON'}), "(name='nginx-deployment1', config=\n res_manifest.NGINX_DEPLOYMENT1_JSON)\n", (1077... |
from django.conf import settings
from django.core import validators
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_better_admin_arrayfield.models.fields import ArrayField
from common.models import Region
from core.db.base import BaseAbstractModel
class GlobalSetting(... | [
"django.core.validators.MinValueValidator",
"django.utils.translation.ugettext_lazy",
"django.core.validators.MaxValueValidator"
] | [((818, 837), 'django.utils.translation.ugettext_lazy', '_', (['"""Global setting"""'], {}), "('Global setting')\n", (819, 837), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((868, 888), 'django.utils.translation.ugettext_lazy', '_', (['"""Global settings"""'], {}), "('Global settings')\n", (869,... |
from rest_framework import serializers
from .models import MetaBusinessUnit
class MetaBusinessUnitSerializer(serializers.ModelSerializer):
api_enrollment_enabled = serializers.BooleanField(required=False)
class Meta:
model = MetaBusinessUnit
fields = ("id", "name", "api_enrollment_enabled")
... | [
"rest_framework.serializers.ValidationError",
"rest_framework.serializers.BooleanField"
] | [((170, 210), 'rest_framework.serializers.BooleanField', 'serializers.BooleanField', ([], {'required': '(False)'}), '(required=False)\n', (194, 210), False, 'from rest_framework import serializers\n'), ((530, 590), 'rest_framework.serializers.ValidationError', 'serializers.ValidationError', (['"""Cannot disable API enr... |
# Uses the encoder to search for input images matching the encoded features
from tensorflow.keras.models import load_model
from tensorflow.keras.models import Model
from tensorflow.keras.preprocessing.image import load_img
from tensorflow.keras.preprocessing.image import img_to_array
from imutils import build_montages... | [
"tensorflow.keras.preprocessing.image.load_img",
"argparse.ArgumentParser",
"sklearn.model_selection.train_test_split",
"numpy.random.choice",
"numpy.asarray",
"tensorflow.keras.models.load_model",
"imutils.paths.list_images",
"numpy.linalg.norm",
"imutils.build_montages",
"tensorflow.keras.prepro... | [((549, 570), 'numpy.linalg.norm', 'np.linalg.norm', (['(a - b)'], {}), '(a - b)\n', (563, 570), True, 'import numpy as np\n'), ((874, 899), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (897, 899), False, 'import argparse\n'), ((1511, 1527), 'numpy.asarray', 'np.asarray', (['data'], {}), '(da... |
# coding=UTF-8
"""
--------------------------------------------------------
Copyright (c) ****-2018 ESR, Inc. All rights reserved.
--------------------------------------------------------
Author: <NAME>
Date: 2018/10/29
Design Name: The user interface of the DDS software
Purpose: Design an interface softwar... | [
"ctypes.c_byte",
"ctypes.c_long",
"os.path.exists",
"random.choice",
"ctypes.cdll.LoadLibrary",
"ctypes.c_ubyte",
"time.sleep",
"numpy.array",
"platform.architecture",
"ctypes.pointer",
"ctypes.c_char_p",
"traceback.print_exc"
] | [((26491, 26508), 'ctypes.c_ubyte', 'ctypes.c_ubyte', (['(0)'], {}), '(0)\n', (26505, 26508), False, 'import ctypes\n'), ((27284, 27300), 'time.sleep', 'time.sleep', (['(0.01)'], {}), '(0.01)\n', (27294, 27300), False, 'import time\n'), ((27343, 27359), 'time.sleep', 'time.sleep', (['(0.01)'], {}), '(0.01)\n', (27353, ... |
from django.conf.urls import url, include
from kitsune.groups import views
group_patterns = [
url(r"^$", views.profile, name="groups.profile"),
url(r"^/edit$", views.edit, name="groups.edit"),
url(r"^/avatar$", views.edit_avatar, name="groups.edit_avatar"),
url(r"^/avatar/delete$", views.delete_avata... | [
"django.conf.urls.include",
"django.conf.urls.url"
] | [((101, 148), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.profile'], {'name': '"""groups.profile"""'}), "('^$', views.profile, name='groups.profile')\n", (104, 148), False, 'from django.conf.urls import url, include\n'), ((155, 201), 'django.conf.urls.url', 'url', (['"""^/edit$"""', 'views.edit'], {'name': '"""... |
# -*- coding: utf-8 -*-
"""
Dateish Plugin for Pelican
==========================
This plugin adds the ability to treat arbitrary metadata fields as datetime
objects.
"""
from pelican import signals
from pelican.utils import get_date
def dateish(generator):
if 'DATEISH_PROPERTIES' not in generator.settings:
... | [
"pelican.utils.get_date",
"pelican.signals.article_generator_finalized.connect"
] | [((741, 793), 'pelican.signals.article_generator_finalized.connect', 'signals.article_generator_finalized.connect', (['dateish'], {}), '(dateish)\n', (784, 793), False, 'from pelican import signals\n'), ((703, 718), 'pelican.utils.get_date', 'get_date', (['value'], {}), '(value)\n', (711, 718), False, 'from pelican.uti... |
from django.http import JsonResponse, Http404
from rest_framework import viewsets, mixins
from rest_framework.response import Response
from django.utils.translation import get_language_from_request
from stuff7.settings import LANGUAGES
from .serializers import UserSerializer
from .models import User
# ViewSets define... | [
"django.utils.translation.get_language_from_request",
"rest_framework.response.Response",
"django.http.JsonResponse"
] | [((2538, 2642), 'django.http.JsonResponse', 'JsonResponse', (["{'status_code': 404, 'error': 'Not Found', 'message': 'No such endpoint.'}"], {'status': '(404)'}), "({'status_code': 404, 'error': 'Not Found', 'message':\n 'No such endpoint.'}, status=404)\n", (2550, 2642), False, 'from django.http import JsonResponse... |
#!/usr/bin/env python3
import tornado.autoreload
import tornado.ioloop
import tornado.web
import json
import subprocess
import os
import miami_api
import html_functions
class OpenLocationHandler(tornado.web.RequestHandler):
def get(self):
response = miami_api.get_open()
json_response = json.dumps(response, inde... | [
"html_functions.get_open_for_html",
"json.dumps",
"miami_api.get_open",
"os.path.join",
"miami_api.get_today_hours",
"subprocess.call",
"miami_api.get_status",
"miami_api.get_person_info"
] | [((2193, 2215), 'os.path.join', 'os.path.join', (['"""static"""'], {}), "('static')\n", (2205, 2215), False, 'import os\n'), ((2235, 2260), 'os.path.join', 'os.path.join', (['"""templates"""'], {}), "('templates')\n", (2247, 2260), False, 'import os\n'), ((256, 276), 'miami_api.get_open', 'miami_api.get_open', ([], {})... |
"""
Migration script to add the dynamic_tool table.
"""
import datetime
import logging
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, MetaData, Table, Unicode
from galaxy.model.custom_types import JSONType, UUIDType
from galaxy.model.migrate.versions.util import add_column, create_table, drop_... | [
"logging.getLogger",
"galaxy.model.migrate.versions.util.create_table",
"galaxy.model.migrate.versions.util.drop_column",
"galaxy.model.migrate.versions.util.drop_table",
"galaxy.model.migrate.versions.util.add_column",
"sqlalchemy.Unicode",
"sqlalchemy.ForeignKey",
"sqlalchemy.MetaData",
"galaxy.mo... | [((346, 373), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (363, 373), False, 'import logging\n'), ((416, 426), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (424, 426), False, 'from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, MetaData, Table, Unicode\n'), (... |
from asyncio import set_event_loop_policy
from aiogram import Bot, Dispatcher, types
from aiogram.contrib.fsm_storage.redis import RedisStorage2
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from sqlalchemy.ext.declarative import declarative... | [
"loguru.logger.add",
"sqlalchemy.ext.asyncio.create_async_engine",
"aiogram.Dispatcher",
"apscheduler.jobstores.sqlalchemy.SQLAlchemyJobStore",
"uvloop.EventLoopPolicy",
"sqlalchemy.ext.declarative.declarative_base",
"aiogram.Bot",
"apscheduler.schedulers.asyncio.AsyncIOScheduler",
"config.bot_confi... | [((618, 709), 'aiogram.Bot', 'Bot', ([], {'token': 'bot_config.BOT_TOKEN', 'parse_mode': 'types.ParseMode.HTML', 'connections_limit': '(100)'}), '(token=bot_config.BOT_TOKEN, parse_mode=types.ParseMode.HTML,\n connections_limit=100)\n', (621, 709), False, 'from aiogram import Bot, Dispatcher, types\n'), ((711, 743),... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | [
"msrest.Serializer",
"azure.mgmt.core.AsyncARMPipelineClient",
"msrest.Deserializer"
] | [((27928, 28000), 'azure.mgmt.core.AsyncARMPipelineClient', 'AsyncARMPipelineClient', ([], {'base_url': 'base_url', 'config': 'self._config'}), '(base_url=base_url, config=self._config, **kwargs)\n', (27950, 28000), False, 'from azure.mgmt.core import AsyncARMPipelineClient\n'), ((28118, 28143), 'msrest.Serializer', 'S... |
import os
import subprocess
import json
def render(template, data):
current_dirname = os.path.dirname(os.path.realpath(__file__))
handlebarsjs = os.path.join(current_dirname, "handlebars.js")
proc = subprocess.Popen(
["node", handlebarsjs, template, json.dumps(data)],
stdout=subprocess.PIP... | [
"os.path.realpath",
"json.dumps",
"os.path.join"
] | [((155, 201), 'os.path.join', 'os.path.join', (['current_dirname', '"""handlebars.js"""'], {}), "(current_dirname, 'handlebars.js')\n", (167, 201), False, 'import os\n'), ((108, 134), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (124, 134), False, 'import os\n'), ((272, 288), 'json.dumps'... |
#
# Measure Activity
#
# <NAME>, July 11, 2019
#
# Measure the activity in a run using ideas from Bedau and Packard
#
import golly as g
import model_classes as mclass
import model_functions as mfunc
import model_parameters as mparam
import numpy as np
import pickle
import os
import sys
import glob
#
# ... | [
"golly.getdir",
"os.path.join",
"pickle.load"
] | [((353, 368), 'golly.getdir', 'g.getdir', (['"""app"""'], {}), "('app')\n", (361, 368), True, 'import golly as g\n'), ((1517, 1574), 'os.path.join', 'os.path.join', (['"""Experiments"""', '"""exper189"""', "(version + '.txt')"], {}), "('Experiments', 'exper189', version + '.txt')\n", (1529, 1574), False, 'import os\n')... |
# uniform content loss + adaptive threshold + per_class_input + recursive G
# improvement upon cqf37
from __future__ import division
import os, scipy.io, scipy.misc, cv2
import torch
import numpy as np
import glob
import utils
from unet import UNet
from torch.utils.data import DataLoader
from dataset.SID import SIDFuj... | [
"os.makedirs",
"unet.UNet",
"dataset.SID.SIDFujiTestDataset",
"torch.load",
"os.path.isdir",
"torch.cuda.is_available",
"os.path.basename",
"torch.utils.data.DataLoader",
"numpy.maximum",
"torch.no_grad",
"cv2.resize",
"glob.glob"
] | [((633, 665), 'glob.glob', 'glob.glob', (["(test_gt_dir + '*.png')"], {}), "(test_gt_dir + '*.png')\n", (642, 665), False, 'import glob\n'), ((819, 825), 'unet.UNet', 'UNet', ([], {}), '()\n', (823, 825), False, 'from unet import UNet\n'), ((897, 968), 'dataset.SID.SIDFujiTestDataset', 'SIDFujiTestDataset', ([], {'list... |
from torch.nn.functional import fractional_max_pool2d
from similar_words import similar
from visualize import display_pca_scatterplot
from PIL import Image
from gensim.models import KeyedVectors
import numpy as np
import moviepy.editor as mpe
import os
import cv2
import glob
def add_audio(path, theme, m... | [
"moviepy.editor.AudioFileClip",
"moviepy.editor.CompositeAudioClip",
"os.listdir",
"PIL.Image.open",
"similar_words.similar",
"os.path.join",
"cv2.VideoWriter",
"os.chdir",
"cv2.destroyAllWindows",
"cv2.VideoWriter_fourcc",
"numpy.concatenate",
"moviepy.editor.VideoFileClip"
] | [((629, 658), 'moviepy.editor.VideoFileClip', 'mpe.VideoFileClip', (['video_name'], {}), '(video_name)\n', (646, 658), True, 'import moviepy.editor as mpe\n'), ((683, 712), 'moviepy.editor.AudioFileClip', 'mpe.AudioFileClip', (['audio_name'], {}), '(audio_name)\n', (700, 712), True, 'import moviepy.editor as mpe\n'), (... |
# -*- coding: utf-8 -*-
"""
Created on August 08 08:44:25 2018
@author: <NAME>
This script is a part of the Watershed Planning Tool development project,
which is developed by Lockwood Andrews & Newnam Inc (LAN) for Harris
County Flood Control District (HCFCD).
The VB_Mgmt.py Files functions as a method fo... | [
"UtiltyMgmt.kras",
"os.path.exists",
"UtiltyMgmt.on_error",
"random.uniform",
"json.loads",
"traceback.format_exc",
"pandas.DataFrame.from_csv",
"os.path.join",
"UtiltyMgmt.clean_active_process_files",
"time.sleep",
"Config.WPTConfig.init",
"os.path.dirname",
"UtiltyMgmt.get_active_process",... | [((952, 968), 'Config.WPTConfig.init', 'WPTConfig.init', ([], {}), '()\n', (966, 968), False, 'from Config import WPTConfig\n'), ((986, 1011), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1001, 1011), False, 'import os, sys\n'), ((1061, 1067), 'UtiltyMgmt.kras', 'kras', ([], {}), '()\n', (... |
"""The badges view set.
"""
from django.db.models import QuerySet, Count
from drf_spectacular.utils import extend_schema_view, extend_schema
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.request import Request
from rest_framework.response import Response
from stac... | [
"django.db.models.Count",
"stackexchange.models.UserBadge.objects.select_related",
"stackexchange.models.UserBadge.objects.filter",
"stackexchange.models.Badge.objects.filter",
"drf_spectacular.utils.extend_schema",
"rest_framework.decorators.action"
] | [((2621, 2658), 'rest_framework.decorators.action', 'action', ([], {'detail': '(False)', 'url_path': '"""name"""'}), "(detail=False, url_path='name')\n", (2627, 2658), False, 'from rest_framework.decorators import action\n'), ((2916, 2959), 'rest_framework.decorators.action', 'action', ([], {'detail': '(False)', 'url_p... |
from Merge import merge
from MergeSort import merge_sort
# Tests for merge routine
assert(merge([], []) == [])
assert(merge([1], []) == [1])
assert(merge([], [1]) == [1])
assert(merge([1], [1]) == [1,1])
assert(merge([1,2], [3]) == [1,2,3])
assert(merge([3], [1,2]) == [1,2,3])
assert(merge([1,2,3,4,4,5,6,7,7,8... | [
"MergeSort.merge_sort",
"Merge.merge"
] | [((93, 106), 'Merge.merge', 'merge', (['[]', '[]'], {}), '([], [])\n', (98, 106), False, 'from Merge import merge\n'), ((122, 136), 'Merge.merge', 'merge', (['[1]', '[]'], {}), '([1], [])\n', (127, 136), False, 'from Merge import merge\n'), ((153, 167), 'Merge.merge', 'merge', (['[]', '[1]'], {}), '([], [1])\n', (158, ... |
import os
import numpy as np
import pandas as pd
import geopandas as gpd
from shapely.geometry import Point
from S2TruckDetect.src.S2TD.array_utils.points import rasterize
from OSMPythonTools.overpass import Overpass
from OSMPythonTools.overpass import overpassQueryBuilder
def buffer_bbox(bbox_osm):
"""
Buffe... | [
"os.path.exists",
"numpy.int8",
"S2TruckDetect.src.S2TD.array_utils.points.rasterize",
"geopandas.read_file",
"os.path.join",
"shapely.geometry.Point",
"OSMPythonTools.overpass.overpassQueryBuilder",
"numpy.isfinite",
"pandas.concat",
"OSMPythonTools.overpass.Overpass",
"geopandas.GeoDataFrame",... | [((3513, 3554), 'os.path.join', 'os.path.join', (['dir_out', "(filename + '.gpkg')"], {}), "(dir_out, filename + '.gpkg')\n", (3525, 3554), False, 'import os\n'), ((3570, 3603), 'os.path.join', 'os.path.join', (['dir_out', '"""tmp.gpkg"""'], {}), "(dir_out, 'tmp.gpkg')\n", (3582, 3603), False, 'import os\n'), ((3647, 3... |
#/usr/bin/env python
#coding:utf-8
# Author : tuxpy
# Email : <EMAIL>
# Last modified : 2015-05-19 17:09:43
# Filename : utils.py
# Description :
from __future__ import unicode_literals, print_function
import os
def get_tmp_filepath(_file):
"""生成一个针对_file的临时文件名"""
_path = os.path.dirname... | [
"os.path.dirname",
"os.path.exists",
"os.path.join",
"os.path.basename"
] | [((305, 327), 'os.path.dirname', 'os.path.dirname', (['_file'], {}), '(_file)\n', (320, 327), False, 'import os\n'), ((348, 371), 'os.path.basename', 'os.path.basename', (['_file'], {}), '(_file)\n', (364, 371), False, 'import os\n'), ((510, 544), 'os.path.join', 'os.path.join', (['_path', '_tmp_filename'], {}), '(_pat... |
import pytest
from .util import toListNode, toList
from .Day24_MergeKSortedLists import Solution
s = Solution()
@pytest.mark.parametrize(
"lists,expected",
[([[1, 4, 5], [1, 3, 4], [2, 6]], [1, 1, 2, 3, 4, 4, 5, 6]), ([], []), ([[]], [])],
)
def test_merge_k_lists(lists, expected):
assert toList(s.mergeK... | [
"pytest.mark.parametrize"
] | [((116, 245), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""lists,expected"""', '[([[1, 4, 5], [1, 3, 4], [2, 6]], [1, 1, 2, 3, 4, 4, 5, 6]), ([], []), ([[]\n ], [])]'], {}), "('lists,expected', [([[1, 4, 5], [1, 3, 4], [2, 6]],\n [1, 1, 2, 3, 4, 4, 5, 6]), ([], []), ([[]], [])])\n", (139, 245), Fal... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Retrieves information about the node"
class Input:
TYPES = "types"
class Output:
RESPONSE = "response"
class NodeInput(komand.Input):
schema = json.loads("""
{
"type": "object",
"titl... | [
"json.loads"
] | [((273, 561), 'json.loads', 'json.loads', (['"""\n {\n "type": "object",\n "title": "Variables",\n "properties": {\n "types": {\n "type": "string",\n "title": "Types",\n "description": "Comma-separated list of types of node info to return: pipeline, os, jvm",\n "order": 1\n }\n }\n}\n ... |
import googleapiclient
import googleapiclient.discovery
from django.conf import settings
from google.oauth2 import service_account
from googleapiclient.http import MediaFileUpload
class Gdrive:
def __init__(self) -> None:
"""Initalize clients."""
scopes = ["https://www.googleapis.com/auth/drive"]
... | [
"google.oauth2.service_account.Credentials.from_service_account_info",
"googleapiclient.discovery.build",
"googleapiclient.http.MediaFileUpload"
] | [((416, 524), 'google.oauth2.service_account.Credentials.from_service_account_info', 'service_account.Credentials.from_service_account_info', (['settings.GCP_SERVICE_ACCOUNT_JSON'], {'scopes': 'scopes'}), '(settings.\n GCP_SERVICE_ACCOUNT_JSON, scopes=scopes)\n', (469, 524), False, 'from google.oauth2 import service... |
import socket
host_1 = '127.0.0.1'
host_2 = '127.0.0.1'
port_1 = 8000
port_2 = 8001
# Server 1 must serve client 1
ServerSock1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ServerSock1.bind(('', serverport1)) # connect server 1 to port 1
ServerSock1.listen(1)
print('(*) Server 1 started on ('+str(host_1)+':'+s... | [
"socket.socket"
] | [((132, 181), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (145, 181), False, 'import socket\n'), ((351, 400), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (364, ... |
'''
Pequeno exemplo de uso do Flask-Bootstrap
https://pythonhosted.org/Flask-Bootstrap/
https://pythonhosted.org/flask-nav/
Exemplos com Bootstrap - https://getbootstrap.com/docs/3.3/getting-started/#examples
Veja mais detalhes nesse tutorial: https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xi-f... | [
"flask_nav.Nav",
"flask.render_template",
"flask_nav.elements.Navbar",
"meusforms.FormDeRegistro",
"flask.Flask",
"meusforms.LoginForm",
"flask_nav.elements.View",
"flask_bootstrap.Bootstrap",
"flask_nav.elements.Link"
] | [((632, 647), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (637, 647), False, 'from flask import Flask, render_template\n'), ((688, 702), 'flask_bootstrap.Bootstrap', 'Bootstrap', (['app'], {}), '(app)\n', (697, 702), False, 'from flask_bootstrap import Bootstrap\n'), ((756, 761), 'flask_nav.Nav', 'Nav',... |
from ScopeFoundry import Measurement
from ScopeFoundry.scanning.base_raster_scan import BaseRaster2DScan
import time
import numpy as np
class BaseNonRaster2DScan(BaseRaster2DScan):
name = "base_non_raster_2Dscan"
def gen_raster_scan(self, gen_arrays=True):
self.Npixels = self.Nh.val*self.Nv.val
... | [
"numpy.cos",
"numpy.sin",
"numpy.meshgrid",
"time.time",
"numpy.arange"
] | [((1151, 1162), 'time.time', 'time.time', ([], {}), '()\n', (1160, 1162), False, 'import time\n'), ((1196, 1235), 'numpy.meshgrid', 'np.meshgrid', (['self.h_array', 'self.v_array'], {}), '(self.h_array, self.v_array)\n', (1207, 1235), True, 'import numpy as np\n'), ((2636, 2647), 'time.time', 'time.time', ([], {}), '()... |
from unittest import TestCase
from cms.test_utils.util.static_analysis import pyflakes
class AboveStaticAnalysisCodeTest(TestCase):
"""
Name is pretty lame, but ensure it's executed before every other test
"""
def test_pyflakes(self):
import cms
import menus
errors, message = ... | [
"cms.test_utils.util.static_analysis.pyflakes"
] | [((320, 342), 'cms.test_utils.util.static_analysis.pyflakes', 'pyflakes', (['(cms, menus)'], {}), '((cms, menus))\n', (328, 342), False, 'from cms.test_utils.util.static_analysis import pyflakes\n')] |
import copy
import pytest
import math
import numpy as np
import pandas as pd
from hyperactive import Hyperactive
search_space = {
"x1": list(np.arange(-100, 100, 1)),
}
def test_catch_0():
def objective_function(access):
x = y
return 0
hyper = Hyperactive()
hyper.add_search(
... | [
"math.isnan",
"math.sqrt",
"numpy.arange",
"hyperactive.Hyperactive"
] | [((279, 292), 'hyperactive.Hyperactive', 'Hyperactive', ([], {}), '()\n', (290, 292), False, 'from hyperactive import Hyperactive\n'), ((553, 566), 'hyperactive.Hyperactive', 'Hyperactive', ([], {}), '()\n', (564, 566), False, 'from hyperactive import Hyperactive\n'), ((828, 841), 'hyperactive.Hyperactive', 'Hyperactiv... |
from django.conf.urls.defaults import url, patterns
from django.contrib import admin
from django.shortcuts import render_to_response
from django.template import RequestContext
from django_histograms.utils import Histogram
class HistogramAdmin(admin.ModelAdmin):
histogram_field = None
histogram_months = 2
... | [
"django.template.RequestContext"
] | [((1158, 1215), 'django.template.RequestContext', 'RequestContext', (['request'], {'current_app': 'self.admin_site.name'}), '(request, current_app=self.admin_site.name)\n', (1172, 1215), False, 'from django.template import RequestContext\n')] |
#!/usr/bin/env python3
# pylint: disable=pointless-string-statement
"""
SpotiQuote: An automatic ad silencer combined with spottily played quotes.
Spotify is queried by an AppleScript to report its status and when found to be
presenting an advertisement, automatically muted. Once an advertisement concludes the
volume ... | [
"subprocess.check_output",
"os.path.exists",
"sys.exit",
"argparse.ArgumentParser",
"fcntl.flock",
"fcntl.lockf",
"os.remove"
] | [((1441, 1775), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""SpotiQuote: An automatic ad silencer combined with spottily played quotes. Spotify is queried by an AppleScript to report its status and when found to be presenting an advertisement, automatically muted. Once the an advertise... |
import numpy as np
from config import clusters # from . = problem in archivedir
cluster = clusters.vsc # change cluster configuration here
class ExperimentConfiguration(object):
def __init__(self):
pass
exp = ExperimentConfiguration()
exp.expname = "exp_v1.19_wb-random_Radar_zero"
exp.model_dx = 2000
ex... | [
"numpy.arange"
] | [((2156, 2184), 'numpy.arange', 'np.arange', (['(1000)', '(15001)', '(1000)'], {}), '(1000, 15001, 1000)\n', (2165, 2184), True, 'import numpy as np\n'), ((2393, 2420), 'numpy.arange', 'np.arange', (['(1000)', '(15001)', '(500)'], {}), '(1000, 15001, 500)\n', (2402, 2420), True, 'import numpy as np\n')] |
"""
Processor to transform the Question Classification task by <NAME> (2002) into a Jiant Probing Task.
The Question Type Probing Task takes as input a question. The task is to classify the question type into one of 500
fine-grained types, e.g. entity:animal.
Example question in input format:
ENTY:animal What was the... | [
"task_processors_replicated.output_task_in_jiant_format",
"argparse.ArgumentParser"
] | [((1744, 1769), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1767, 1769), False, 'import argparse\n'), ((1972, 2008), 'task_processors_replicated.output_task_in_jiant_format', 'output_task_in_jiant_format', (['samples'], {}), '(samples)\n', (1999, 2008), False, 'from task_processors_replicat... |
###### MIT License ######
###### Copyright (c) 2018 <NAME> ######
######## MAKE SURE THAT THE SCRIPTS/ DIRECTORY IS ########
########## IN THE SAME DIRECTORY AS THIS SCRIPT ##########
# coding=utf-8
import os
import re
import time
import sys
def error(s):
if e != 0:
print('\n\n\t\t'+s+'\n\n')
... | [
"os.chdir",
"os.system",
"re.findall",
"re.split"
] | [((1083, 1112), 'os.system', 'os.system', (["('mkdir %s' % exper)"], {}), "('mkdir %s' % exper)\n", (1092, 1112), False, 'import os\n'), ((1113, 1128), 'os.chdir', 'os.chdir', (['exper'], {}), '(exper)\n', (1121, 1128), False, 'import os\n'), ((1293, 1335), 'os.system', 'os.system', (['"""mkdir correction_interm_files"... |
from bs4 import BeautifulSoup
from requests import get
from aol_db import *
import sys
import os
import re
def downloadMedia(url, file_name):
print(f"\nDownloading {url} as {file_name}")
with open(file_name, "wb") as file:
response = get(url)
file.write(response.content)
print(f"Download S... | [
"os.path.exists",
"os.makedirs",
"sys.stderr.flush",
"requests.get",
"os.chdir",
"sys.stderr.write",
"bs4.BeautifulSoup",
"re.search"
] | [((2213, 2232), 'os.chdir', 'os.chdir', (['directory'], {}), '(directory)\n', (2221, 2232), False, 'import os\n'), ((469, 507), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response', '"""html.parser"""'], {}), "(response, 'html.parser')\n", (482, 507), False, 'from bs4 import BeautifulSoup\n'), ((1235, 1273), 'bs4.Beautif... |
#!/usr/bin/python
__author__ = '<NAME>'
import sys
#sys.path.insert(0, '../lib')
import numpy as np
import dynesty
class CustomNestedSampler(dynesty.NestedSampler):
def convert_to_samples(self):
self.samples = self.results.samples
def unique_rows(self):
'''
Given an arr... | [
"numpy.mean",
"numpy.hstack",
"numpy.where",
"numpy.diff",
"numpy.argmax",
"numpy.lexsort",
"numpy.fmod",
"numpy.mod"
] | [((467, 495), 'numpy.lexsort', 'np.lexsort', (['self.flatchain.T'], {}), '(self.flatchain.T)\n', (477, 495), True, 'import numpy as np\n'), ((801, 830), 'numpy.hstack', 'np.hstack', (['self.lnprobability'], {}), '(self.lnprobability)\n', (810, 830), True, 'import numpy as np\n'), ((967, 986), 'numpy.argmax', 'np.argmax... |
import sys, os
from lxml import etree
import urllib
from edx_gen import _edx_consts
from edx_gen import _css_settings
import __SETTINGS__
#--------------------------------------------------------------------------------------------------
# Text strings
WARNING = " WARNING:"
#------------------------------------... | [
"lxml.etree.Element"
] | [((1722, 1745), 'lxml.etree.Element', 'etree.Element', (['"""iframe"""'], {}), "('iframe')\n", (1735, 1745), False, 'from lxml import etree\n'), ((2338, 2358), 'lxml.etree.Element', 'etree.Element', (['"""div"""'], {}), "('div')\n", (2351, 2358), False, 'from lxml import etree\n'), ((2402, 2420), 'lxml.etree.Element', ... |
# Step 0: Add NRPy's directory to the path
# https://stackoverflow.com/questions/16780014/import-file-from-parent-directory
import os,sys
nrpy_dir_path = os.path.join("..")
if nrpy_dir_path not in sys.path:
sys.path.append(nrpy_dir_path)
import cmdline_helper as cmd # NRPy+: Multi-platform Python command-line ... | [
"GiRaFFE_NRPy.GiRaFFE_NRPy_Characteristic_Speeds.find_cmax_cmin",
"os.path.join",
"sympy.sympify",
"indexedexp.declarerank1",
"indexedexp.declarerank2",
"outputC.outputC",
"sys.path.append",
"cmdline_helper.mkdir"
] | [((154, 172), 'os.path.join', 'os.path.join', (['""".."""'], {}), "('..')\n", (166, 172), False, 'import os, sys\n'), ((211, 241), 'sys.path.append', 'sys.path.append', (['nrpy_dir_path'], {}), '(nrpy_dir_path)\n', (226, 241), False, 'import os, sys\n'), ((385, 408), 'os.path.join', 'os.path.join', (['Ccodesdir'], {}),... |
# coding: utf-8
# 2020/1/3 @ tongshiwei
from longling import config_logging
config_logging(logger="CangJie", console_log_level="info")
# These constants are from gluonnlp
UNK_TOKEN = '<unk>'
BOS_TOKEN = '<bos>'
EOS_TOKEN = '<eos>'
PAD_TOKEN = '<pad>'
| [
"longling.config_logging"
] | [((78, 136), 'longling.config_logging', 'config_logging', ([], {'logger': '"""CangJie"""', 'console_log_level': '"""info"""'}), "(logger='CangJie', console_log_level='info')\n", (92, 136), False, 'from longling import config_logging\n')] |
from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref
from sqlalchemy import create_engine
Base = declarative_base()
class User(Base):
__tablename__ = "user"
id = Column(Integer, primary_key = True)
name ... | [
"sqlalchemy.orm.relationship",
"sqlalchemy.create_engine",
"sqlalchemy.ForeignKey",
"sqlalchemy.String",
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.Column"
] | [((209, 227), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (225, 227), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((1331, 1372), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///itemCatalog.db"""'], {}), "('sqlite:///itemCatalog.db')\n", (134... |
'''
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, ... | [
"helpers.utils.catch_error.client_error_retry",
"helpers.utils.session.Session",
"json.dumps",
"helpers.utils.convertor.arn_to_name"
] | [((2172, 2236), 'helpers.utils.catch_error.client_error_retry', 'client_error_retry', (['"""LimitExceeded"""', 'delete_non_default_versions'], {}), "('LimitExceeded', delete_non_default_versions)\n", (2190, 2236), False, 'from helpers.utils.catch_error import client_error_retry\n'), ((2520, 2570), 'helpers.utils.catch_... |
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2017 Mag. <NAME>. All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. <EMAIL>
# ****************************************************************************
# This file is part of the package _MOM.
#
# This module is licensed under the terms of the BSD 3-Clause Li... | [
"_TFL.Package_Namespace.Package_Namespace"
] | [((2229, 2248), '_TFL.Package_Namespace.Package_Namespace', 'Package_Namespace', ([], {}), '()\n', (2246, 2248), False, 'from _TFL.Package_Namespace import Package_Namespace\n')] |
from collections import defaultdict
from contextlib import closing
from datetime import datetime
from pathlib import Path
from typing import Dict, List, Optional
import numpy as np # type: ignore
import pandas as pd # type: ignore
from tables import Filters # type: ignore
from tables import open_file
from pullfram... | [
"pandas.DataFrame",
"numpy.searchsorted",
"tables.open_file",
"collections.defaultdict",
"tables.Filters",
"pandas.concat",
"pandas.to_datetime"
] | [((3939, 3960), 'pandas.to_datetime', 'pd.to_datetime', (['index'], {}), '(index)\n', (3953, 3960), True, 'import pandas as pd\n'), ((5189, 5206), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (5200, 5206), False, 'from collections import defaultdict\n'), ((2383, 2438), 'tables.Filters', 'Filter... |
"""Test module for model-based class metafeatures."""
import pytest
from pymfe.mfe import MFE
from tests.utils import load_xy
import numpy as np
GNAME = "model-based"
class TestModelBased:
"""TestClass dedicated to test model-based metafeatures."""
@pytest.mark.parametrize(
"dt_id, ft_name, exp_val... | [
"pymfe.mfe.MFE",
"pytest.mark.parametrize",
"numpy.allclose",
"tests.utils.load_xy"
] | [((263, 4535), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dt_id, ft_name, exp_value, precompute"""', "[(0, 'leaves', 13, True), (0, 'leaves_branch', [4.6153846, 1.4455945], True\n ), (0, 'leaves_corrob', [0.07692308, 0.058791243], True), (0,\n 'leaves_homo', [84.933334, 41.648125], True), (0, 'le... |
from django.views.generic.edit import FormView
from django.views.generic import DetailView
from django.core.urlresolvers import reverse
from .models import VideoCategory, Video
from .forms import UploadVideoForm
class HomeView(FormView):
template_name = 'home.html'
form_class = UploadVideoForm
success_u... | [
"django.core.urlresolvers.reverse"
] | [((649, 695), 'django.core.urlresolvers.reverse', 'reverse', (['"""video_detail"""'], {'kwargs': "{'slug': slug}"}), "('video_detail', kwargs={'slug': slug})\n", (656, 695), False, 'from django.core.urlresolvers import reverse\n')] |
from functools import singledispatch
from functools import update_wrapper
class singledispatchmethod:
"""Single-dispatch generic method descriptor.
Supports wrapping existing descriptors and handles non-descriptor
callables as instance methods.
"""
def __init__(self, func):
if not callabl... | [
"functools.singledispatch",
"functools.update_wrapper"
] | [((462, 482), 'functools.singledispatch', 'singledispatch', (['func'], {}), '(func)\n', (476, 482), False, 'from functools import singledispatch\n'), ((1075, 1109), 'functools.update_wrapper', 'update_wrapper', (['_method', 'self.func'], {}), '(_method, self.func)\n', (1089, 1109), False, 'from functools import update_... |
import coc
import disnake
from utils.clash import client, coc_client
usafam = client.usafam
server = usafam.server
clans = usafam.clans
donations = usafam.donations
from disnake.ext import commands
class Donations(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
coc_client.a... | [
"coc.ClanEvents.member_donations",
"utils.clash.coc_client.add_events",
"disnake.Embed",
"disnake.ext.commands.slash_command",
"coc.ClientEvents.new_season_start",
"utils.clash.coc_client.get_clans"
] | [((394, 495), 'disnake.ext.commands.slash_command', 'commands.slash_command', ([], {'name': '"""donations"""', 'description': '"""Leaderboard of top 50 donators in family"""'}), "(name='donations', description=\n 'Leaderboard of top 50 donators in family')\n", (416, 495), False, 'from disnake.ext import commands\n')... |
from charm.toolbox.pairinggroup import PairingGroup,ZR,G1,G2,GT,pair
from Ours import CD_ABACE
# type of pairing
groupObj = PairingGroup('BN254')
cpabe = CD_ABACE(groupObj)
# RA setup
U = ['ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE', 'TEN']
(pk, mk) = cpabe.RAgen(10, U)
# SA setup
(sgk,vk)... | [
"Ours.CD_ABACE",
"charm.toolbox.pairinggroup.PairingGroup"
] | [((125, 146), 'charm.toolbox.pairinggroup.PairingGroup', 'PairingGroup', (['"""BN254"""'], {}), "('BN254')\n", (137, 146), False, 'from charm.toolbox.pairinggroup import PairingGroup, ZR, G1, G2, GT, pair\n'), ((155, 173), 'Ours.CD_ABACE', 'CD_ABACE', (['groupObj'], {}), '(groupObj)\n', (163, 173), False, 'from Ours im... |
# pulse_sequence.py
# <NAME>
# <EMAIL>
# Last Edited: Mon 28 Feb 2022 11:17:58 GMT
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import numpy as np
PULSE_WIDTH = 1
PULSE_HEIGHT = 0.3 # fraction of height of figure
TAU_WIDTH = 0.05
HORIZOTAL_PADS = (0.05, 0.01)
# --- horizontal dimensions... | [
"matplotlib.pyplot.figure",
"matplotlib.patches.Rectangle",
"numpy.linspace",
"numpy.cos"
] | [((2047, 2073), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 2)'}), '(figsize=(6, 2))\n', (2057, 2073), True, 'import matplotlib.pyplot as plt\n'), ((5177, 5230), 'numpy.linspace', 'np.linspace', (['acquisition', '(acquisition + T2_WIDTH)', '(256)'], {}), '(acquisition, acquisition + T2_WIDTH, 256)\n... |
#!/usr/bin/python3
# test_numpy.py
# testing script for writing various numpy tensors to QG8 files using
# python -m pytest -rP tests/test_numpy.py
#
# Author : <NAME> <<EMAIL>>
# Date created : 18 July 2021
#
# Copyright 2021 University of Strasbourg
#
# Licensed under the Apache License, Version 2.0 (the "Lice... | [
"qg8.from_numpy",
"numpy.count_nonzero",
"numpy.array",
"numpy.zeros",
"numpy.random.randint",
"numpy.atleast_1d"
] | [((2377, 2403), 'numpy.zeros', 'np.zeros', (['(2 ** 8, 2 ** 8)'], {}), '((2 ** 8, 2 ** 8))\n', (2385, 2403), True, 'import numpy as np\n'), ((3101, 3159), 'numpy.random.randint', 'np.random.randint', (['(0)', '(2 ** 16 - 1)'], {'size': '(1, 2, 3, 4, 5, 6)'}), '(0, 2 ** 16 - 1, size=(1, 2, 3, 4, 5, 6))\n', (3118, 3159),... |
"""
Let's learn about Python types!
"""
import json #library
with open("raw_data/data.json", "r") as json_file:
text = json_file.read()
data = json.loads(text)
main_keys = data.keys()
print(f"he main keys are: {main_keys}")
language_code = data['LanguageCode']
print(language_code)
searh_parameters = data... | [
"json.loads"
] | [((154, 170), 'json.loads', 'json.loads', (['text'], {}), '(text)\n', (164, 170), False, 'import json\n')] |
#!/usr/bin/env python
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import json
import os
import sys
import common
# Add src/testing/ into sys.path for importing xvfb.
sys.path.append(... | [
"common.run_script",
"argparse.ArgumentParser",
"common.temporary_file",
"os.path.join",
"os.environ.copy",
"os.path.dirname",
"json.load",
"json.dump"
] | [((678, 703), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (701, 703), False, 'import argparse\n'), ((1137, 1154), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (1152, 1154), False, 'import os\n'), ((2762, 2814), 'json.dump', 'json.dump', (["['content_shell_crash_test']", 'args.outp... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2019-03-05 17:50
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import imagekit.models.fields
class Migration(migrations.Migration):
dependencies = [
... | [
"django.db.migrations.swappable_dependency",
"django.db.migrations.RemoveField",
"django.db.models.TextField",
"django.db.models.ForeignKey"
] | [((322, 379), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (353, 379), False, 'from django.db import migrations, models\n'), ((481, 552), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name... |
# Summation of primes
# Answer: 142913828922
from problem3 import is_prime
def sum_of_primes(limit):
total = 0
for i in range(2, limit):
if is_prime(i):
total += i
return total
limit = 2000000
print(sum_of_primes(limit))
| [
"problem3.is_prime"
] | [((168, 179), 'problem3.is_prime', 'is_prime', (['i'], {}), '(i)\n', (176, 179), False, 'from problem3 import is_prime\n')] |