code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Generated by Django 3.2.7 on 2021-09-29 09:43
from django.db import migrations
def migrate_license(apps, schema_editor):
"""
Migrate license from charfield to ArrayField.
This migration copies data from the old license column to the new
licenses column which is a ArrayField.
"""
Version = ap... | [
"django.db.migrations.RunPython"
] | [((678, 715), 'django.db.migrations.RunPython', 'migrations.RunPython', (['migrate_license'], {}), '(migrate_license)\n', (698, 715), False, 'from django.db import migrations\n')] |
# -*- coding: utf-8 -*-
from tests.utils import fix_bs4_parsing_spaces
from tests.data.dummy import LINKS
def test_anchor_format():
"""Test annotate elements with default and manipulated config."""
RLINKS = [
{"A": {"type": "letterA", "score": 42}},
{"AA": {"type": "letterA", "score": 42}}... | [
"copy.copy",
"anchorman.get_config",
"anchorman.annotate",
"tests.utils.fix_bs4_parsing_spaces"
] | [((1345, 1379), 'copy.copy', 'copy.copy', (['elements.format_element'], {}), '(elements.format_element)\n', (1354, 1379), False, 'import copy\n'), ((1495, 1507), 'anchorman.get_config', 'get_config', ([], {}), '()\n', (1505, 1507), False, 'from anchorman import annotate, clean, get_config\n'), ((1750, 1785), 'anchorman... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import logging
# Created by box on 2018/3/7.
from scrapy import cmdline
from scrapy.crawler import CrawlerRunner
from scrapy.utils.log import configure_logging
from scrapy.utils.project import get_project_settings
from twisted.internet import reactor
from tieba import sp... | [
"twisted.internet.reactor.stop",
"scrapy.utils.project.get_project_settings",
"scrapy.crawler.CrawlerRunner",
"twisted.internet.reactor.run",
"scrapy.utils.log.configure_logging",
"logging.info"
] | [((522, 544), 'scrapy.utils.project.get_project_settings', 'get_project_settings', ([], {}), '()\n', (542, 544), False, 'from scrapy.utils.project import get_project_settings\n'), ((549, 576), 'scrapy.utils.log.configure_logging', 'configure_logging', (['settings'], {}), '(settings)\n', (566, 576), False, 'from scrapy.... |
import glob
import json
import os.path
import math
from functools import reduce
from typing import Union
from collections.abc import Iterable
from datetime import datetime
import numpy as np
import scipy.interpolate
from matplotlib import transforms, rcParams
import matplotlib.pyplot as plt
from matplotlib.patches imp... | [
"numpy.prod",
"numpy.ptp",
"icecream.ic",
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"math.acos",
"math.floor",
"math.sqrt",
"seaborn.set_style",
"numpy.array",
"numpy.sin",
"numpy.cov",
"matplotlib.pyplot.arrow",
"pint.UnitRegistry",
"numpy.mean",
"numpy.repeat",
"seaborn.color_palet... | [((578, 603), 'seaborn.set_style', 'sns.set_style', (['"""darkgrid"""'], {}), "('darkgrid')\n", (591, 603), True, 'import seaborn as sns\n'), ((632, 651), 'pint.UnitRegistry', 'pint.UnitRegistry', ([], {}), '()\n', (649, 651), False, 'import pint\n'), ((802, 814), 'json.load', 'json.load', (['f'], {}), '(f)\n', (811, 8... |
import numpy as np
from PIL import Image
import json
import open3d as o3d
import cv2
def ply_vtx(path):
f = open(path)
assert f.readline().strip() == "ply"
f.readline()
f.readline()
N = int(f.readline().split()[-1])
while f.readline().strip() != "end_header":
continue
pts = []
f... | [
"numpy.identity",
"numpy.mean",
"numpy.sqrt",
"numpy.finfo",
"PIL.Image._show",
"numpy.linalg.det",
"numpy.append",
"numpy.array",
"numpy.zeros",
"numpy.dot",
"open3d.io.read_triangle_mesh",
"open3d.utility.Vector3dVector",
"open3d.geometry.PointCloud",
"open3d.io.write_point_cloud",
"js... | [((1285, 1329), 'numpy.array', 'np.array', (['[[0, 0, 1], [1, 0, 0], [0, -1, 0]]'], {}), '([[0, 0, 1], [1, 0, 0], [0, -1, 0]])\n', (1293, 1329), True, 'import numpy as np\n'), ((1536, 1559), 'json.load', 'json.load', (['fixed_config'], {}), '(fixed_config)\n', (1545, 1559), False, 'import json\n'), ((1578, 1646), 'nump... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 6 00:11:55 2020
@author: andreas
"""
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from PlotScatter import hue_order
from Basefolder import basefolder
import pickle
import numpy as np
my_pal = {'FINDER_1D_loop':'#701a... | [
"matplotlib.pyplot.savefig",
"pandas.read_csv",
"pickle.load",
"seaborn.histplot",
"numpy.min",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((2941, 2996), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(4)', '(2)'], {'gridspec_kw': 'gs_kw', 'figsize': '(12, 12)'}), '(4, 2, gridspec_kw=gs_kw, figsize=(12, 12))\n', (2953, 2996), True, 'import matplotlib.pyplot as plt\n'), ((4180, 4208), 'pandas.read_csv', 'pd.read_csv', (['(base + filename)'], {}), '(base... |
import json
import web
import six
import re
import os
import urllib.parse as urlparse
from werkzeug.exceptions import BadRequest, MethodNotAllowed
from urllib.parse import unquote
from .utils import props
from .init_subclass_meta import InitSubclassMeta
from graphql import Source, execute, parse, validate
from graph... | [
"graphql.Source",
"werkzeug.exceptions.BadRequest",
"six.text_type",
"graphql.execution.ExecutionResult",
"graphql.parse",
"web.template.render",
"web.header",
"web.ctx.method.lower",
"graphql.validate",
"json.dumps",
"graphql.error.format_error",
"web.data",
"graphql.execute",
"json.loads... | [((633, 668), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""templates"""'], {}), "(BASE_DIR, 'templates')\n", (645, 668), False, 'import os\n'), ((594, 620), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (610, 620), False, 'import os\n'), ((2683, 2712), 'web.template.render', 'web.temp... |
from secret_sdk.core import Coins
from secret_sdk.client.localsecret import LocalSecret, main_net_chain_id
api = LocalSecret(chain_id=main_net_chain_id)
fee = api.tx.estimate_fee(
gas=250_000
)
print(fee)
fee = api.tx.estimate_fee(
gas=200_000,
gas_prices=Coins.from_data([{"amount": 0.25, "denom": "uscrt"... | [
"secret_sdk.client.localsecret.LocalSecret",
"secret_sdk.core.Coins.from_data"
] | [((114, 153), 'secret_sdk.client.localsecret.LocalSecret', 'LocalSecret', ([], {'chain_id': 'main_net_chain_id'}), '(chain_id=main_net_chain_id)\n', (125, 153), False, 'from secret_sdk.client.localsecret import LocalSecret, main_net_chain_id\n'), ((270, 323), 'secret_sdk.core.Coins.from_data', 'Coins.from_data', (["[{'... |
# Copyright (c) 2017 Uber Technologies, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | [
"demo.example_client.client.create_consumer",
"time.sleep"
] | [((1309, 1360), 'demo.example_client.client.create_consumer', 'client.create_consumer', (['destination', 'consumer_group'], {}), '(destination, consumer_group)\n', (1331, 1360), False, 'from demo.example_client import client\n'), ((1521, 1534), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (1531, 1534), False, 'i... |
from django.contrib import admin
from .models import Segment, Restaurant
admin.site.register(Segment)
admin.site.register(Restaurant)
| [
"django.contrib.admin.site.register"
] | [((75, 103), 'django.contrib.admin.site.register', 'admin.site.register', (['Segment'], {}), '(Segment)\n', (94, 103), False, 'from django.contrib import admin\n'), ((104, 135), 'django.contrib.admin.site.register', 'admin.site.register', (['Restaurant'], {}), '(Restaurant)\n', (123, 135), False, 'from django.contrib i... |
import os
SCAN_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../scan/')
SCAN_DIR = os.path.join(SCAN_ROOT, 'archive/05.06.2017/')
# TODO: Discriminate between scan static (normal) files and scan dynamic (generated by code) files (archive dir).
BANNERS_DIR = os.path.join(SCAN_DIR, 'banners/')
BA... | [
"os.path.realpath",
"os.path.exists",
"os.path.join",
"os.makedirs"
] | [((107, 153), 'os.path.join', 'os.path.join', (['SCAN_ROOT', '"""archive/05.06.2017/"""'], {}), "(SCAN_ROOT, 'archive/05.06.2017/')\n", (119, 153), False, 'import os\n'), ((283, 317), 'os.path.join', 'os.path.join', (['SCAN_DIR', '"""banners/"""'], {}), "(SCAN_DIR, 'banners/')\n", (295, 317), False, 'import os\n'), ((3... |
'''The framework module contains the logic used in building the graph and
inferring the order that the nodes have to be executed in forward and backward
direction.
Based on FrEIA (https://github.com/VLL-HD/FrEIA)'''
import torch.nn as nn
from torch.autograd import Variable
import FrEIA.dummy_modules as dummys
clas... | [
"torch.nn.ModuleList",
"torch.autograd.Variable",
"FrEIA.dummy_modules.dummy_data"
] | [((4266, 4290), 'FrEIA.dummy_modules.dummy_data', 'dummys.dummy_data', (['*dims'], {}), '(*dims)\n', (4283, 4290), True, 'import FrEIA.dummy_modules as dummys\n'), ((7558, 7602), 'torch.nn.ModuleList', 'nn.ModuleList', (['[n.module for n in node_list]'], {}), '([n.module for n in node_list])\n', (7571, 7602), True, 'im... |
import collections
from supriya import CalculationRate
from supriya.ugens.DUGen import DUGen
class Dbufwr(DUGen):
"""
A buffer-writing demand-rate UGen.
::
>>> dbufwr = supriya.ugens.Dbufwr(
... buffer_id=0,
... source=0,
... loop=1,
... phase=0,
... | [
"collections.OrderedDict"
] | [((488, 586), 'collections.OrderedDict', 'collections.OrderedDict', (["[('source', 0.0), ('buffer_id', 0.0), ('phase', 0.0), ('loop', 1.0)]"], {}), "([('source', 0.0), ('buffer_id', 0.0), ('phase', 0.0\n ), ('loop', 1.0)])\n", (511, 586), False, 'import collections\n')] |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys
sys.dont_write_bytecode = True
import os
import re
import posixpath
try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension
def get_str(var_name):
src_py = open('litefs.py').read()
return re.... | [
"re.search"
] | [((317, 385), 're.search', 're.search', (['(\'%s\\\\s*=\\\\s*[\\\'\\\\"]([^\\\'\\\\"]+)[\\\'\\\\"]\' % var_name)', 'src_py'], {}), '(\'%s\\\\s*=\\\\s*[\\\'\\\\"]([^\\\'\\\\"]+)[\\\'\\\\"]\' % var_name, src_py)\n', (326, 385), False, 'import re\n'), ((475, 549), 're.search', 're.search', (['(\'%s\\\\s*=\\\\s*[\\\'\\\\"]... |
# Generated by Django 3.1.4 on 2020-12-05 12:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0039_auto_20201205_1218'),
]
operations = [
migrations.RemoveField(
model_name='post',
name='postImage',
... | [
"django.db.migrations.RemoveField",
"django.db.models.ManyToManyField"
] | [((232, 291), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""post"""', 'name': '"""postImage"""'}), "(model_name='post', name='postImage')\n", (254, 291), False, 'from django.db import migrations, models\n'), ((436, 498), 'django.db.models.ManyToManyField', 'models.ManyToManyField... |
# Code behind module for DCAL_Vegetation_Phenology.ipynb
################################
##
## Import Statments
##
################################
# Import standard Python modules
import sys
import datacube
import numpy as np
# Import DCAL utilities containing function definitions used generally across DCAL
sys.... | [
"dc_time._n64_datetime_to_scalar",
"numpy.argmax",
"numpy.array",
"numpy.gradient",
"sys.path.append"
] | [((316, 348), 'sys.path.append', 'sys.path.append', (['"""../DCAL_utils"""'], {}), "('../DCAL_utils')\n", (331, 348), False, 'import sys\n'), ((1961, 2012), 'dc_time._n64_datetime_to_scalar', '_n64_datetime_to_scalar', (['dataarray[time_dim].values'], {}), '(dataarray[time_dim].values)\n', (1984, 2012), False, 'from dc... |
import csv
import io
import logging
import os
from collections import OrderedDict
from functools import partial
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Generator,
List,
Optional,
)
from funcy import cached_property, first, project
from dvc.exceptions import DvcException
fr... | [
"logging.getLogger",
"collections.OrderedDict",
"dvc.fs.repo.RepoFileSystem",
"dvc_render.vega_templates.get_template",
"dvc.utils.errored_revisions",
"os.path.splitext",
"dvc.utils.collections.ensure_list",
"os.path.join",
"dvc.repo.collect.collect",
"io.StringIO",
"dvc.exceptions.DvcException"... | [((553, 580), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (570, 580), False, 'import logging\n'), ((6860, 6949), 'dvc.repo.collect.collect', 'collect', (['repo'], {'output_filter': '_is_plot', 'targets': 'targets', 'rev': 'rev', 'recursive': 'recursive'}), '(repo, output_filter=_is_plo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Should be used instead of Exception in test_get_submissions_private_sub and
# test_get_submissions_nonexisting_sub. But weirdly enough it doesn't catch the
# error even though it should be the same.
# from urllib2 import HTTPError
import os
import pytest
from authenti... | [
"pytest.raises",
"os.remove"
] | [((799, 823), 'pytest.raises', 'pytest.raises', (['Exception'], {}), '(Exception)\n', (812, 823), False, 'import pytest\n'), ((1437, 1461), 'pytest.raises', 'pytest.raises', (['Exception'], {}), '(Exception)\n', (1450, 1461), False, 'import pytest\n'), ((1716, 1740), 'pytest.raises', 'pytest.raises', (['Exception'], {}... |
import os
from pathlib import Path
def make_file(path: str) -> None:
Path(path).touch()
def make_valid_symlink(path: str) -> None:
target = path + "1"
make_file(target)
os.symlink(target, path)
def make_broken_symlink(path: str) -> None:
os.symlink("foo", path)
def make_dir(path: str) -> Non... | [
"os.mkdir",
"os.symlink",
"pathlib.Path"
] | [((189, 213), 'os.symlink', 'os.symlink', (['target', 'path'], {}), '(target, path)\n', (199, 213), False, 'import os\n'), ((264, 287), 'os.symlink', 'os.symlink', (['"""foo"""', 'path'], {}), "('foo', path)\n", (274, 287), False, 'import os\n'), ((327, 341), 'os.mkdir', 'os.mkdir', (['path'], {}), '(path)\n', (335, 34... |
import numpy as np
import matplotlib.pyplot as plt
colors = ['gold', 'yellowgreen', 'c', 'royalblue', 'pink']
# randomly generate the number of occurrences of each color
occurrences = np.random.randint(10, size=len(colors)) + 1
# pmf of the distribution
sum = np.sum(occurrences)
pmf = occurrences / sum
print(pmf)
#... | [
"numpy.sum",
"numpy.cumsum",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((262, 281), 'numpy.sum', 'np.sum', (['occurrences'], {}), '(occurrences)\n', (268, 281), True, 'import numpy as np\n'), ((370, 385), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {}), '(2)\n', (382, 385), True, 'import matplotlib.pyplot as plt\n'), ((493, 507), 'numpy.cumsum', 'np.cumsum', (['pmf'], {}), '(... |
from functools import wraps
from operator import itemgetter
from signal import getsignal, signal, SIGPIPE, SIG_DFL
def dslice(x, indexes):
"""Slice with discontinuous indexes."""
if not x or not indexes:
return []
subx = itemgetter(*indexes)(x)
if len(indexes) == 1:
return [subx]
e... | [
"operator.itemgetter",
"signal.signal",
"signal.getsignal",
"functools.wraps"
] | [((789, 797), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (794, 797), False, 'from functools import wraps\n'), ((243, 263), 'operator.itemgetter', 'itemgetter', (['*indexes'], {}), '(*indexes)\n', (253, 263), False, 'from operator import itemgetter\n'), ((855, 873), 'signal.getsignal', 'getsignal', (['SIGPIPE'], ... |
#!/usr/bin/env python
# Copyright (c) 2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2 License
# The full license information can be found in LICENSE.txt
# in the root directory of this project.
import time
from axon.db.sql.analytics import session_scope
from axon.db.sql.repository import Repos... | [
"axon.db.sql.repository.Repositories",
"time.time",
"axon.db.sql.analytics.session_scope"
] | [((405, 419), 'axon.db.sql.repository.Repositories', 'Repositories', ([], {}), '()\n', (417, 419), False, 'from axon.db.sql.repository import Repositories\n'), ((532, 543), 'time.time', 'time.time', ([], {}), '()\n', (541, 543), False, 'import time\n'), ((1234, 1249), 'axon.db.sql.analytics.session_scope', 'session_sco... |
"""
A federated learning client at the edge server in a cross-silo training workload.
"""
from dataclasses import dataclass
import logging
import os
import pickle
import sys
from plato.clients import edge
@dataclass
class Report(edge.Report):
"""Report from an Axiothea edge server, to be sent to the central se... | [
"pickle.dumps",
"logging.info",
"os.getpid"
] | [((1144, 1243), 'logging.info', 'logging.info', (['"""[Edge Server #%d] Passing the global meta model to its clients."""', 'self.client_id'], {}), "('[Edge Server #%d] Passing the global meta model to its clients.',\n self.client_id)\n", (1156, 1243), False, 'import logging\n'), ((2478, 2511), 'pickle.dumps', 'pickl... |
import logging
import inspect
import importlib
import threading
import time
import signal
import os
import json
from http.client import HTTPConnection
from extensions.base.burpextensionapi import BurpExtensionApi
from libs.registry import Registry
LOGGER = logging.getLogger(__name__)
class ExtensionLoader(threading... | [
"logging.getLogger",
"json.loads",
"signal.signal",
"inspect.getmembers",
"importlib.import_module",
"inspect.isclass",
"os.environ.get",
"http.client.HTTPConnection",
"time.sleep",
"libs.registry.Registry.unregister_all"
] | [((259, 286), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (276, 286), False, 'import logging\n'), ((577, 592), 'time.sleep', 'time.sleep', (['(0.4)'], {}), '(0.4)\n', (587, 592), False, 'import time\n'), ((1839, 1874), 'os.environ.get', 'os.environ.get', (['"""WERKZEUG_RUN_MAIN"""'], {... |
import argparse
def parse_args():
parser = argparse.ArgumentParser(description='Train face network')
# general
parser.add_argument('--data-dir', default='', help='training set directory')
parser.add_argument('--prefix', default='../model/model', help='directory to save model.')
parser.add_argument('--pretrai... | [
"argparse.ArgumentParser"
] | [((46, 103), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train face network"""'}), "(description='Train face network')\n", (69, 103), False, 'import argparse\n')] |
import model
from sklearn.externals import joblib
import itertools
if __name__ == "__main__":
corpus_root = "/Users/thisismattmiller/Downloads/gmb-2.2.0/"
reader = model.read_gmb_ner(corpus_root)
all_classes = ['O', 'B-per', 'I-per', 'B-gpe', 'I-gpe',
'B-geo', 'I-geo', 'B-org', 'I-org', 'B-tim',... | [
"itertools.islice",
"model.read_gmb_ner",
"sklearn.externals.joblib.dump"
] | [((177, 208), 'model.read_gmb_ner', 'model.read_gmb_ner', (['corpus_root'], {}), '(corpus_root)\n', (195, 208), False, 'import model\n'), ((724, 758), 'sklearn.externals.joblib.dump', 'joblib.dump', (['pa_ner', '"""chunker.pkl"""'], {}), "(pa_ner, 'chunker.pkl')\n", (735, 758), False, 'from sklearn.externals import job... |
from fairing.backend.kubeflow import KubeflowBackend
from fairing.utils import get_image_full
class BasicArchitecture():
def add_jobs(self, svc, count, repository, image_name, image_tag, volumes, volume_mounts):
full_image_name = get_image_full(repository, image_name, image_tag)
tfjobs = []
... | [
"fairing.utils.get_image_full",
"fairing.backend.kubeflow.KubeflowBackend"
] | [((243, 292), 'fairing.utils.get_image_full', 'get_image_full', (['repository', 'image_name', 'image_tag'], {}), '(repository, image_name, image_tag)\n', (257, 292), False, 'from fairing.utils import get_image_full\n'), ((959, 976), 'fairing.backend.kubeflow.KubeflowBackend', 'KubeflowBackend', ([], {}), '()\n', (974, ... |
from gym.envs.registration import register
register(
id="ArdaEnv-v0",
entry_point="anet.tasks.hexagrid.envs:ArdaEnv",
)
| [
"gym.envs.registration.register"
] | [((44, 117), 'gym.envs.registration.register', 'register', ([], {'id': '"""ArdaEnv-v0"""', 'entry_point': '"""anet.tasks.hexagrid.envs:ArdaEnv"""'}), "(id='ArdaEnv-v0', entry_point='anet.tasks.hexagrid.envs:ArdaEnv')\n", (52, 117), False, 'from gym.envs.registration import register\n')] |
from collections import Counter
from collections import defaultdict
# [3] https://leetcode.com/problems/longest-substring-without-repeating-characters/
# Given a string, find the length of the longest substring without repeating characters.
#
# variation with no pattern
def lengthOfLongestSubstring(s):
# create a... | [
"collections.Counter",
"collections.defaultdict"
] | [((366, 382), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (377, 382), False, 'from collections import defaultdict\n'), ((1006, 1016), 'collections.Counter', 'Counter', (['t'], {}), '(t)\n', (1013, 1016), False, 'from collections import Counter\n'), ((1970, 1986), 'collections.defaultdict', 'defa... |
#!/usr/bin/env python2
import unittest
from appscale.common import appscale_info
from appscale.datastore import dbconstants
from cassandra.cluster import Cluster
from appscale.datastore.cassandra_env import schema
from flexmock import flexmock
class TestCassandraPrimer(unittest.TestCase):
def test_define_ua_schem... | [
"appscale.datastore.cassandra_env.schema.define_ua_schema",
"flexmock.flexmock"
] | [((343, 391), 'flexmock.flexmock', 'flexmock', ([], {'execute': '(lambda statement, values: None)'}), '(execute=lambda statement, values: None)\n', (351, 391), False, 'from flexmock import flexmock\n'), ((396, 428), 'appscale.datastore.cassandra_env.schema.define_ua_schema', 'schema.define_ua_schema', (['session'], {})... |
import sys
from typing import List, Any
import logging
import argparse
import time
import timeit
import random
from pacos4.token import Address, Token
from pacos4.call import CallArg, Call, CallResult
from pacos4.procedure import Procedure, IProcessorAPI
from pacos4.actor import Actor
from pacos4.processor import Proce... | [
"argparse.ArgumentParser",
"pacos4.call.CallResult",
"pacos4.board.Board",
"pacos4.token.Address",
"time.time",
"pacos4.processor.ProcessorConfig"
] | [((1711, 1735), 'pacos4.board.Board', 'Board', (['processor_configs'], {}), '(processor_configs)\n', (1716, 1735), False, 'from pacos4.board import Board\n'), ((2031, 2070), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (2054, 2070), False, 'import argparse\n... |
from mltoolkit.mldp.pipeline import Pipeline
from mltoolkit.mldp.steps.readers import CsvReader
from mltoolkit.mldp.steps.transformers.nlp import TokenProcessor,\
VocabMapper, Padder
from mltoolkit.mldp.steps.transformers.field import FieldSelector
from mltoolkit.mldp.utils.helpers.nlp.token_cleaning import twitter... | [
"mltoolkit.mldp.steps.transformers.field.FieldSelector",
"nltk.tokenize.TweetTokenizer",
"mltoolkit.mldp.steps.transformers.nlp.Padder",
"mltoolkit.mldp.steps.transformers.nlp.TokenProcessor",
"mltoolkit.mldp.tutorials.model.ISentiLSTM",
"os.path.join",
"mltoolkit.mldp.utils.tools.Vocabulary",
"mltool... | [((4809, 4824), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4822, 4824), False, 'import unittest\n'), ((838, 890), 'os.path.join', 'os.path.join', (['self.tutorials_path', '"""data/tweets.csv"""'], {}), "(self.tutorials_path, 'data/tweets.csv')\n", (850, 890), False, 'import os\n'), ((1022, 1080), 'os.path.joi... |
import unittest
from tginviter import generate_invite_link, get_random_token, \
generate_joinchat_link
class TestLinksGeneration(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.bot_name = "test_bot"
cls.token = get_random_token()
def test_keywords_param_only(self):
... | [
"tginviter.generate_invite_link",
"tginviter.get_random_token",
"tginviter.generate_joinchat_link"
] | [((257, 275), 'tginviter.get_random_token', 'get_random_token', ([], {}), '()\n', (273, 275), False, 'from tginviter import generate_invite_link, get_random_token, generate_joinchat_link\n'), ((432, 479), 'tginviter.generate_invite_link', 'generate_invite_link', (['self.bot_name'], {'max_uses': '(2)'}), '(self.bot_name... |
""" 5G-MEDIA project """
import os
# =================================
# PROJECT ROOT
# =================================
from datetime import timedelta
PROJECT_ROOT = os.path.dirname(os.path.abspath(os.path.join(__file__, os.pardir)))
# =================================
# DEBUG SETTINGS
# ==========================... | [
"datetime.timedelta",
"os.path.join",
"os.getenv"
] | [((336, 358), 'os.getenv', 'os.getenv', (['"""ACC_DEBUG"""'], {}), "('ACC_DEBUG')\n", (345, 358), False, 'import os\n'), ((8527, 8555), 'os.getenv', 'os.getenv', (['"""ACC_OSM_HOST_IP"""'], {}), "('ACC_OSM_HOST_IP')\n", (8536, 8555), False, 'import os\n'), ((8961, 8990), 'os.getenv', 'os.getenv', (['"""ACC_KAFKA_SERVER... |
import json
import os
import re
import subprocess
from functools import cached_property
import requests
import yaml
# Changelog types
PULL_REQUEST = 'pull_request'
COMMIT = 'commit_message'
class ChangelogCIBase:
"""Base Class for Changelog CI"""
github_api_url = 'https://api.github.com'
def __init__... | [
"os.path.exists",
"requests.post",
"re.compile",
"subprocess.run",
"os.environ.get",
"requests.get",
"json.load"
] | [((25087, 25143), 'subprocess.run', 'subprocess.run', (["['echo', f'::{message_type}::{message}']"], {}), "(['echo', f'::{message_type}::{message}'])\n", (25101, 25143), False, 'import subprocess\n'), ((25763, 25793), 'os.environ.get', 'os.environ.get', (['"""GITHUB_TOKEN"""'], {}), "('GITHUB_TOKEN')\n", (25777, 25793)... |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from operator import itemgetter
from pytz import common_timezone... | [
"wtforms.validators.Email",
"indico.modules.users.models.emails.UserEmail.find",
"indico.web.forms.validators.HiddenUnless",
"indico.util.i18n._",
"indico.web.forms.widgets.SwitchWidget",
"indico.util.i18n.get_all_locales",
"indico.web.forms.widgets.SyncedInputWidget",
"operator.itemgetter",
"wtform... | [((1350, 1360), 'indico.util.i18n._', '_', (['"""Title"""'], {}), "('Title')\n", (1351, 1360), False, 'from indico.util.i18n import _, get_all_locales\n'), ((1420, 1435), 'indico.util.i18n._', '_', (['"""First name"""'], {}), "('First name')\n", (1421, 1435), False, 'from indico.util.i18n import _, get_all_locales\n'),... |
"""
Use the library to calculate stiffness matrices for Zysset-Curnier Model based orthotropic materials
and extract the engineering constants from the stiffness matrices.
"""
from collections import namedtuple
import numpy as np
import tenseng.tenseng.tenseng as t
cubic = namedtuple('CubicAnisotropic', ['E', 'nu', ... | [
"numpy.trace",
"numpy.eye",
"collections.namedtuple",
"numpy.isclose",
"numpy.linalg.eig",
"tenseng.tenseng.tenseng.to_matrix",
"tenseng.tenseng.tenseng.Vector",
"tenseng.tenseng.tenseng.double_tensor_product",
"tenseng.tenseng.tenseng.identity",
"tenseng.tenseng.tenseng.dyad",
"tenseng.tenseng.... | [((277, 325), 'collections.namedtuple', 'namedtuple', (['"""CubicAnisotropic"""', "['E', 'nu', 'G']"], {}), "('CubicAnisotropic', ['E', 'nu', 'G'])\n", (287, 325), False, 'from collections import namedtuple\n'), ((332, 368), 'collections.namedtuple', 'namedtuple', (['"""Isotropic"""', "['E', 'nu']"], {}), "('Isotropic'... |
# Copyright (c) 2020 Norwegian University of Science and Technology
# Copyright (c) 2019, Zivid AS
# Use of this source code is governed by the BSD 3-Clause license, see LICENSE
from zivid_interfaces.srv import Capture
import rclpy
from rclpy.node import Node
from rclpy.executors import SingleThreadedExecutor, MultiT... | [
"lifecycle_msgs.srv.ChangeState.Request",
"rclpy.executors.SingleThreadedExecutor",
"rclpy.spin_until_future_complete",
"lifecycle_msgs.msg.Transition",
"lifecycle_msgs.srv.GetAvailableTransitions.Request",
"rclpy.init",
"rclpy.shutdown",
"zivid_interfaces.srv.Capture.Request"
] | [((3399, 3420), 'rclpy.init', 'rclpy.init', ([], {'args': 'args'}), '(args=args)\n', (3409, 3420), False, 'import rclpy\n'), ((1706, 1739), 'lifecycle_msgs.srv.GetAvailableTransitions.Request', 'GetAvailableTransitions.Request', ([], {}), '()\n', (1737, 1739), False, 'from lifecycle_msgs.srv import ChangeState, GetAvai... |
import rx3
from rx3 import operators as ops
a = rx.cold(' ---a0---a1----------------a2-| ')
b = rx.cold(' ---b1---b2---| ')
c = rx.cold(' ---c1---c2---| ')
d = rx.cold(' -----d1---d2---|')
e1 = rx.cold('a--b--------c-----d-------| ')
observableLookup = ... | [
"rx3.operators.flat_map"
] | [((376, 427), 'rx3.operators.flat_map', 'ops.flat_map', (['(lambda value: observableLookup[value])'], {}), '(lambda value: observableLookup[value])\n', (388, 427), True, 'from rx3 import operators as ops\n')] |
#!/usr/bin/env python
# coding: utf-8
# # WEEK - 2 ASSIGNMENTS
# ## Data Science & Data Analytics Laboratory
# ### Name: <NAME>
# #### Section: CSE 3H
# #### Roll No.: 29
# #### Enrollment No.: 12018009019439
# # Regression - Diabetes
# In[2]:
from sklearn.datasets import load_diabetes
# In[3]:
diabetes = load... | [
"matplotlib.pyplot.ylabel",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"sklearn.metrics.mean_squared_error",
"sklearn.datasets.load_diabetes",
"matplotlib.pyplot.scatter",
"pandas.DataFrame",
"sklearn.linear_model.LinearRegression",
"matplotli... | [((316, 331), 'sklearn.datasets.load_diabetes', 'load_diabetes', ([], {}), '()\n', (329, 331), False, 'from sklearn.datasets import load_diabetes\n'), ((451, 510), 'pandas.DataFrame', 'pd.DataFrame', (['diabetes.data'], {'columns': 'diabetes.feature_names'}), '(diabetes.data, columns=diabetes.feature_names)\n', (463, 5... |
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# VulnerableCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/vulnerablecode for support or download.
# See https://aboutcode.org for mor... | [
"univers.versions.RubygemsVersion",
"pytest.raises",
"vulnerabilities.importer.AffectedPackage.merge",
"packageurl.PackageURL"
] | [((784, 822), 'pytest.raises', 'pytest.raises', (['UnMergeablePackageError'], {}), '(UnMergeablePackageError)\n', (797, 822), False, 'import pytest\n'), ((2413, 2511), 'packageurl.PackageURL', 'PackageURL', ([], {'type': '"""npm"""', 'namespace': 'None', 'name': '"""foo"""', 'version': 'None', 'qualifiers': '{}', 'subp... |
from unittest import TestCase
from django_jsonform.utils import normalize_schema
class TestNormalizeSchemaFunction(TestCase):
"""Tests for utils.normalize_schema function"""
def test_normalized_schema_is_same(self):
"""Normalized schema must be the same as input schema
if there are no python ... | [
"django_jsonform.utils.normalize_schema"
] | [((745, 769), 'django_jsonform.utils.normalize_schema', 'normalize_schema', (['schema'], {}), '(schema)\n', (761, 769), False, 'from django_jsonform.utils import normalize_schema\n')] |
from meas_exponential import mechanism_exponential_discrete
import numpy as np
def score_auction_price_discrete(x, candidates):
return candidates * (x[None] >= candidates[:, None]).sum(axis=1)
def release_dp_auction_price_via_de(x, candidate_prices, epsilon):
"""Release a price for a digital auction that ma... | [
"numpy.random.randint",
"numpy.random.uniform"
] | [((1783, 1816), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '(1000, 4)'}), '(size=(1000, 4))\n', (1800, 1816), True, 'import numpy as np\n'), ((2175, 2202), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '(100)'}), '(size=100)\n', (2192, 2202), True, 'import numpy as np\n'), ((2220, 2245), 'n... |
"""Definitions for analytic metadata and schemas."""
from jsl import DocumentField, ArrayField, StringField, BooleanField, DictField
from jsl import Document as BaseDocument
import jsonschema
UUID_PATTERN = r'[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
OS_NAMES = ["linux", "macos", "windows"]
TACTICS... | [
"jsl.DictField",
"jsl.StringField",
"jsl.DocumentField",
"jsl.BooleanField",
"jsonschema.validate"
] | [((1082, 1130), 'jsl.StringField', 'StringField', ([], {'pattern': 'UUID_PATTERN', 'required': '(True)'}), '(pattern=UUID_PATTERN, required=True)\n', (1093, 1130), False, 'from jsl import DocumentField, ArrayField, StringField, BooleanField, DictField\n'), ((1289, 1347), 'jsl.StringField', 'StringField', ([], {'enum': ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | [
"Kamaelia.Internet.TCPClient.TCPClient",
"random.randint",
"Kamaelia.Util.Console.ConsoleEchoer",
"Kamaelia.Chassis.ConnectedServer.SimpleServer"
] | [((1335, 1361), 'random.randint', 'random.randint', (['(1500)', '(1599)'], {}), '(1500, 1599)\n', (1349, 1361), False, 'import random\n'), ((1362, 1433), 'Kamaelia.Chassis.ConnectedServer.SimpleServer', 'SimpleServer', ([], {'protocol': 'FortuneCookieProtocol', 'port': 'clientServerTestPort'}), '(protocol=FortuneCookie... |
#!/usr/bin/python3
import smtplib
import argparse
import logging
import sys
FORMAT = '%(asctime)s %(name)s %(levelname)s: %(message)s'
EPILOG = '''\
Text message via email:
T-Mobile – <EMAIL>
Virgin Mobile – <EMAIL>
AT&T – <EMAIL>
Sprint – <EMAIL>
Verizon – <EMAIL>
Tracfone – <EMAIL>
Ting – <EMAIL>
Boost Mobile – <... | [
"logging.getLogger",
"logging.basicConfig",
"logging.StreamHandler",
"argparse.ArgumentParser",
"logging.Formatter",
"logging.FileHandler"
] | [((1506, 1625), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""lanforge email"""', 'epilog': 'EPILOG', 'formatter_class': 'argparse.RawTextHelpFormatter'}), "(description='lanforge email', epilog=EPILOG,\n formatter_class=argparse.RawTextHelpFormatter)\n", (1529, 1625), False, 'import... |
# -*- coding: utf-8 -*-
# OPEN AI LAB is pleased to support the open source community by supporting Tengine available.
#
# Copyright (C) 2021 OPEN AI LAB. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
# in compliance with the License. You may ... | [
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"os.path.split",
"os.path.isdir",
"os.mkdir",
"os.system",
"subprocess.getstatusoutput"
] | [((2471, 2532), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""convert tools in batch"""'}), "(description='convert tools in batch')\n", (2494, 2532), False, 'import argparse\n'), ((3184, 3214), 'os.path.split', 'os.path.split', (['onnx_model_path'], {}), '(onnx_model_path)\n', (3197, 32... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 Brno University of Technology FIT
# Author: <NAME> <<EMAIL>>
# All Rights Reserved
import os
import re
import random
from os import listdir
from os.path import isfile, join
import fnmatch
import math
import numpy as np
import yaml
class Utils(obje... | [
"os.listdir",
"os.walk",
"math.sqrt",
"yaml.load",
"os.path.join",
"numpy.array_split",
"doctest.testmod",
"fnmatch.filter",
"os.path.abspath",
"re.sub",
"numpy.load",
"numpy.save"
] | [((14989, 15006), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (15004, 15006), False, 'import doctest\n'), ((1368, 1394), 'os.path.abspath', 'os.path.abspath', (['directory'], {}), '(directory)\n', (1383, 1394), False, 'import os\n'), ((2349, 2375), 'os.path.abspath', 'os.path.abspath', (['directory'], {}), ... |
import numpy as np
from mcfa import utils
np.random.seed(42)
def test_latent_factor_rotation(D=15, J=10, noise=0.05):
# Generate fake factors.
A = np.random.uniform(-1, 1, size=(D, J))
# Randomly flip them.
true_signs = np.sign(np.random.uniform(-1, 1, size=J)).astype(int)
# Add a little n... | [
"numpy.random.normal",
"mcfa.utils.rotation_matrix",
"numpy.alltrue",
"numpy.random.choice",
"numpy.where",
"numpy.random.seed",
"numpy.random.uniform"
] | [((47, 65), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (61, 65), True, 'import numpy as np\n'), ((163, 200), 'numpy.random.uniform', 'np.random.uniform', (['(-1)', '(1)'], {'size': '(D, J)'}), '(-1, 1, size=(D, J))\n', (180, 200), True, 'import numpy as np\n'), ((346, 384), 'numpy.random.normal', ... |
# -*- coding: utf-8 -*-
import sqlalchemy as sa
from h.models import Document, Annotation
MAX_DOCUMENT_COUNT = 100
class DocumentService:
def __init__(self, session):
self._session = session
def fetch_by_groupid(self, groupid, userid=None):
"""
Return documents that have been annot... | [
"h.models.Annotation.shared.is_",
"h.models.Document.updated.desc",
"sqlalchemy.or_"
] | [((1098, 1125), 'h.models.Annotation.shared.is_', 'Annotation.shared.is_', (['(True)'], {}), '(True)\n', (1119, 1125), False, 'from h.models import Document, Annotation\n'), ((1198, 1244), 'sqlalchemy.or_', 'sa.or_', (['(Annotation.userid == userid)', 'is_shared'], {}), '(Annotation.userid == userid, is_shared)\n', (12... |
import tensorflow as tf
from tensorflow.keras.layers import Dense, Flatten, Input
# pylint: disable-msg=unused-argument
def orig_2nn_compiled(
input_shape=(28, 28, 1), num_classes=10, seed: int = 2017, epoch_base: int = 0
) -> tf.keras.Model:
# Kernel initializer
ki = tf.keras.initializers.glorot_uniform(... | [
"tensorflow.keras.layers.Input",
"tensorflow.keras.initializers.glorot_uniform",
"tensorflow.keras.optimizers.SGD",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.Model",
"tensorflow.keras.layers.Flatten"
] | [((283, 330), 'tensorflow.keras.initializers.glorot_uniform', 'tf.keras.initializers.glorot_uniform', ([], {'seed': 'seed'}), '(seed=seed)\n', (319, 330), True, 'import tensorflow as tf\n'), ((364, 388), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': 'input_shape'}), '(shape=input_shape)\n', (369, 388), False... |
# Generated by Django 3.1.3 on 2020-12-10 12:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('betting', '0004_auto_20201208_2005'),
]
operations = [
migrations.RemoveField(
model_name='leag... | [
"django.db.migrations.RemoveField",
"django.db.models.ForeignKey"
] | [((268, 331), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""league"""', 'name': '"""contestants"""'}), "(model_name='league', name='contestants')\n", (290, 331), False, 'from django.db import migrations, models\n'), ((480, 611), 'django.db.models.ForeignKey', 'models.ForeignKey',... |
# coding: utf-8
"""
1Password Connect
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 0.2.1
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | [
"six.iteritems"
] | [((6974, 7007), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (6987, 7007), False, 'import six\n')] |
from django.urls import path, include
from . import views
# from utils import router
urlpatterns = [
path('', views.home),
# Search for channels
path('channels',views.channels),
# enter/alter/delete a certain channel
path('channels/<int:id>',views.channels_id),
path('channels/<int:id>/users'... | [
"django.urls.path"
] | [((107, 127), 'django.urls.path', 'path', (['""""""', 'views.home'], {}), "('', views.home)\n", (111, 127), False, 'from django.urls import path, include\n'), ((160, 192), 'django.urls.path', 'path', (['"""channels"""', 'views.channels'], {}), "('channels', views.channels)\n", (164, 192), False, 'from django.urls impor... |
from pyky040 import pyky040
from gpiozero import *
from time import sleep
from RPLCD.i2c import CharLCD
lcd=CharLCD(i2c_expander='PCF8574', address=0x27, port=1,
cols=16, rows=2, dotsize=8,
charmap='A02',
auto_linebreaks=True,
backlight_enabled=True)
gled1=LED(21... | [
"RPLCD.i2c.CharLCD"
] | [((109, 253), 'RPLCD.i2c.CharLCD', 'CharLCD', ([], {'i2c_expander': '"""PCF8574"""', 'address': '(39)', 'port': '(1)', 'cols': '(16)', 'rows': '(2)', 'dotsize': '(8)', 'charmap': '"""A02"""', 'auto_linebreaks': '(True)', 'backlight_enabled': '(True)'}), "(i2c_expander='PCF8574', address=39, port=1, cols=16, rows=2,\n ... |
# Import libraries
import requests
import json
import csv
# Identifier for market code
market_code = "BTC-PLN"
# Identifier for quantity limit
limit = "100"
# Function to get data from REST API based on market code identifier
# market_code - identifies for which pair data should be retrieved
# query_params - list of ... | [
"csv.DictWriter",
"json.loads",
"requests.request"
] | [((947, 967), 'json.loads', 'json.loads', (['response'], {}), '(response)\n', (957, 967), False, 'import json\n'), ((1282, 1328), 'csv.DictWriter', 'csv.DictWriter', (['csvfile'], {'fieldnames': 'fieldnames'}), '(csvfile, fieldnames=fieldnames)\n', (1296, 1328), False, 'import csv\n'), ((678, 723), 'requests.request', ... |
# quat_test.py Test for quat.py
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2020 <NAME>
from math import sin, cos, isclose, pi, sqrt
from quat import *
print('Properties')
q1 = Quaternion(1, 2, 3, 4)
q1.w = 5
q1.x = 6
q1.y = 7
q1.z = 8
assert q1 == Quaternion(5, 6, 7, 8)
assert (q1.w, q1.x, ... | [
"math.sin",
"math.sqrt",
"math.isclose"
] | [((2319, 2351), 'math.isclose', 'isclose', (['rv.w', '(0)'], {'abs_tol': 'mdelta'}), '(rv.w, 0, abs_tol=mdelta)\n', (2326, 2351), False, 'from math import sin, cos, isclose, pi, sqrt\n'), ((2456, 2488), 'math.isclose', 'isclose', (['rv.z', '(0)'], {'abs_tol': 'mdelta'}), '(rv.z, 0, abs_tol=mdelta)\n', (2463, 2488), Fal... |
import os
import math
import operator
def load_embeddings(embedding_file):
if embedding_file is None:
return {}
word_to_vec = {}
with open(embedding_file, 'r') as fin:
header = fin.readline()
for line in fin:
items = line.strip().split()
word = items[0]
... | [
"os.path.exists",
"os.makedirs",
"math.pow",
"math.sqrt",
"os.path.dirname",
"math.exp"
] | [((1777, 1796), 'math.sqrt', 'math.sqrt', (['distance'], {}), '(distance)\n', (1786, 1796), False, 'import math\n'), ((2050, 2069), 'math.sqrt', 'math.sqrt', (['distance'], {}), '(distance)\n', (2059, 2069), False, 'import math\n'), ((3938, 3964), 'os.path.dirname', 'os.path.dirname', (['file_name'], {}), '(file_name)\... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-24 18:21
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import main.models
import unixtimestampfield.fields
class Migration(migrations.Migration):
initial = True
dependencies = [... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.SlugField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((4295, 4452), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.DO_NOTHING', 'related_name': '"""clas_textbooks"""', 'to': '"""textbook.TextbookClas"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.DO_NOTHING... |
import sys
import logging
def get_logger(name: str):
logger = logging.getLogger(name)
logformat = "[%(asctime)s] %(levelname)s:%(name)s: %(message)s"
logging.basicConfig(level=logging.INFO, stream=sys.stdout,
format=logformat, datefmt="%Y-%m-%d %H:%M:%S")
return logger
| [
"logging.getLogger",
"logging.basicConfig"
] | [((68, 91), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (85, 91), False, 'import logging\n'), ((164, 273), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'stream': 'sys.stdout', 'format': 'logformat', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(level=logging.INFO, s... |
from enum import Enum, auto
import itertools
from .figure import Figure, Circle
from .scene import Scene
from .util import Comment, divide, normalize_number, keys_for_triangle
class Property:
def __init__(self, property_key, point_set):
self.implications = []
self.property_key = property_key
... | [
"enum.auto"
] | [((2082, 2088), 'enum.auto', 'auto', ([], {}), '()\n', (2086, 2088), False, 'from enum import Enum, auto\n'), ((2107, 2113), 'enum.auto', 'auto', ([], {}), '()\n', (2111, 2113), False, 'from enum import Enum, auto\n'), ((2132, 2138), 'enum.auto', 'auto', ([], {}), '()\n', (2136, 2138), False, 'from enum import Enum, au... |
from abc import ABC
import warnings
import contextlib
from genie.conf.base.attributes import UnsupportedAttributeWarning,\
AttributesHelper
from genie.conf.base.cli import CliConfigBuilder
from genie.conf.base.config import CliConfig
from genie.libs.conf.l2vpn.pseudowire import PseudowireNeighbor,\
Pseudowir... | [
"genie.conf.base.cli.CliConfigBuilder",
"genie.conf.base.config.CliConfig",
"genie.conf.base.attributes.AttributesHelper"
] | [((537, 571), 'genie.conf.base.attributes.AttributesHelper', 'AttributesHelper', (['self', 'attributes'], {}), '(self, attributes)\n', (553, 571), False, 'from genie.conf.base.attributes import UnsupportedAttributeWarning, AttributesHelper\n'), ((597, 632), 'genie.conf.base.cli.CliConfigBuilder', 'CliConfigBuilder', ([... |
from pathlib import Path
import os
import sys
sys.path.append((Path(__file__).parent / ".." / "src").as_posix())
| [
"pathlib.Path"
] | [((64, 78), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (68, 78), False, 'from pathlib import Path\n')] |
from django import template
from ..models import InterConsultas
register = template.Library()
@register.simple_tag
def total_inter_consultas(historia_id):
"""
Devuelve el total de inter consultas para una historia clinica
"""
return InterConsultas.objects.filter(historia=historia_id).count() | [
"django.template.Library"
] | [((76, 94), 'django.template.Library', 'template.Library', ([], {}), '()\n', (92, 94), False, 'from django import template\n')] |
from symtable import SymbolTable
from xml.dom import NO_MODIFICATION_ALLOWED_ERR
from flask import Flask, flash, redirect, render_template, request, session, abort
from random import randint
import shabbos_web_class
import googleapi
app = Flask(__name__)
@app.route("/")
@app.route("/home")
def index():
#return ... | [
"shabbos_web_class.return_candletime_string",
"shabbos_web_class.time_remaining",
"flask.Flask"
] | [((241, 256), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (246, 256), False, 'from flask import Flask, flash, redirect, render_template, request, session, abort\n'), ((348, 392), 'shabbos_web_class.return_candletime_string', 'shabbos_web_class.return_candletime_string', ([], {}), '()\n', (390, 392), Fal... |
"""
Django settings for {{ project_name }} project.
Generated by 'django-admin startproject' using Django {{ django_version }}.
For more information on this file, see
https://docs.djangoproject.com/en/{{ docs_version }}/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.c... | [
"os.path.dirname",
"os.path.join"
] | [((3651, 3688), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""staticfiles"""'], {}), "(BASE_DIR, 'staticfiles')\n", (3663, 3688), False, 'import os\n'), ((3727, 3758), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""media"""'], {}), "(BASE_DIR, 'media')\n", (3739, 3758), False, 'import os\n'), ((6700, 6764), 'os.... |
# -*- encoding: utf-8 -*-
"""
keri.core.coring module
"""
import re
import json
import copy
from dataclasses import dataclass, astuple
from collections import namedtuple, deque
from base64 import urlsafe_b64encode as encodeB64
from base64 import urlsafe_b64decode as decodeB64
from math import ceil
from fractions impo... | [
"pysodium.crypto_sign_detached",
"re.compile",
"dataclasses.dataclass",
"hashlib.blake2s",
"hashlib.blake2b",
"collections.deque",
"pysodium.crypto_sign_verify_detached",
"json.dumps",
"fractions.Fraction",
"pysodium.crypto_sign_seed_keypair",
"pysodium.randombytes",
"hashlib.sha256",
"colle... | [((954, 995), 'collections.namedtuple', 'namedtuple', (['"""Serialage"""', '"""json mgpk cbor"""'], {}), "('Serialage', 'json mgpk cbor')\n", (964, 995), False, 'from collections import namedtuple, deque\n'), ((2090, 2107), 're.compile', 're.compile', (['VEREX'], {}), '(VEREX)\n', (2100, 2107), False, 'import re\n'), (... |
from random import randint
while(True):
stats=[0,1,2,3,4,5]
i=0
while(i<6):
a=1
j=0
while(j<4):
a = a+randint(1,6)
if(a>8&a<18):
j=j+1
a = a-3
stats[i] = a
i=i+1
print("\nWhat is your race A... | [
"random.randint"
] | [((164, 177), 'random.randint', 'randint', (['(1)', '(6)'], {}), '(1, 6)\n', (171, 177), False, 'from random import randint\n')] |
import appdaemon.plugins.hass.hassapi as hass
import requests
import json
import datetime
import time
class NettleieElvia(hass.Hass):
def initialize(self):
self.log_progress = (self.args["log_progress"])
self.set_request_data()
self.set_correction_data()
self.run_in(self.hourly_call, 1)
def h... | [
"datetime.datetime",
"json.loads",
"requests.post",
"datetime.timedelta",
"datetime.datetime.now",
"time.localtime"
] | [((1104, 1133), 'datetime.datetime', 'datetime.datetime', (['(2022)', '(4)', '(1)'], {}), '(2022, 4, 1)\n', (1121, 1133), False, 'import datetime\n'), ((1230, 1246), 'time.localtime', 'time.localtime', ([], {}), '()\n', (1244, 1246), False, 'import time\n'), ((1378, 1401), 'datetime.datetime.now', 'datetime.datetime.no... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import abc
import logging
try:
import wiringpi
except ModuleNotFoundError:
logging.warning('wiringpi is not installed! This should only be used with --use-dummy-gpio.')
from pyrrigate.PyrrigateConfig_pb2 import ControllerConf
class Controller(metaclass=abc.ABCMe... | [
"wiringpi.digitalWrite",
"logging.warning",
"logging.info",
"wiringpi.pinMode"
] | [((131, 234), 'logging.warning', 'logging.warning', (['"""wiringpi is not installed! This should only be used with --use-dummy-gpio."""'], {}), "(\n 'wiringpi is not installed! This should only be used with --use-dummy-gpio.'\n )\n", (146, 234), False, 'import logging\n'), ((1291, 1354), 'logging.info', 'logging.... |
# -*- coding: utf-8 -*-
"""
@date: 2021/5/4 下午7:11
@file: torchvision_resnet_to_zcls_resnet.py
@author: zj
@description: Transform torchvision pretrained model into zcls format
"""
import os
from torchvision.models.resnet import resnet18, resnet34, resnet50, resnet101, resnet152, resnext50_32x4d, \
resnext101_32x... | [
"os.path.exists",
"os.makedirs",
"torchvision.models.resnet.resnet152",
"torchvision.models.resnet.resnet18",
"torchvision.models.resnet.resnext101_32x8d",
"torchvision.models.resnet.resnet50",
"zcls.util.checkpoint.CheckPointer",
"os.path.join",
"torchvision.models.resnet.resnet34",
"torchvision.... | [((1923, 1952), 'zcls.config.cfg.merge_from_file', 'cfg.merge_from_file', (['cfg_file'], {}), '(cfg_file)\n', (1942, 1952), False, 'from zcls.config import cfg\n'), ((1971, 1982), 'zcls.model.recognizers.resnet.resnet.ResNet', 'ResNet', (['cfg'], {}), '(cfg)\n', (1977, 1982), False, 'from zcls.model.recognizers.resnet.... |
import requests
from bs4 import BeautifulSoup
def proxies_pool():
url = 'https://www.sslproxies.org/'
# Retrieve the site's page. The 'with'(Python closure) is used here in order to automatically close the session when done
with requests.Session() as res:
proxies_page = res.get(url)
... | [
"bs4.BeautifulSoup",
"requests.Session"
] | [((422, 472), 'bs4.BeautifulSoup', 'BeautifulSoup', (['proxies_page.content', '"""html.parser"""'], {}), "(proxies_page.content, 'html.parser')\n", (435, 472), False, 'from bs4 import BeautifulSoup\n'), ((247, 265), 'requests.Session', 'requests.Session', ([], {}), '()\n', (263, 265), False, 'import requests\n')] |
"""Blender Addon Netcat"""
# coding=utf-8
#
# /************************************************************************************
# ***
# *** Copyright Dell 2020, All Rights Reserved.
# ***
# *** File Author: Dell, 2020年 09月 09日 星期三 23:56:45 CST
# ***
# **********************************************************... | [
"bpy.utils.register_classes_factory",
"bpy.ops.render.render"
] | [((2688, 2721), 'bpy.utils.register_classes_factory', 'register_classes_factory', (['classes'], {}), '(classes)\n', (2712, 2721), False, 'from bpy.utils import register_classes_factory\n'), ((2089, 2126), 'bpy.ops.render.render', 'bpy.ops.render.render', ([], {'animation': '(True)'}), '(animation=True)\n', (2110, 2126)... |
from logging import getLogger
from django.db import models
from commands.utils import(
send_cec_command,
send_infrared_command,
send_serial_command,
send_tcp_command,
)
LOGGER = getLogger(__name__)
class RemoteButton(models.Model):
lirc_code = models.CharField(
unique=True,
max... | [
"logging.getLogger",
"django.db.models.OneToOneField",
"commands.utils.send_cec_command",
"commands.utils.send_tcp_command",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"commands.utils.send_infrared_command",
"django.db.models.PositiveIntegerField",
"commands.utils.send_serial... | [((197, 216), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (206, 216), False, 'from logging import getLogger\n'), ((270, 315), 'django.db.models.CharField', 'models.CharField', ([], {'unique': '(True)', 'max_length': '(255)'}), '(unique=True, max_length=255)\n', (286, 315), False, 'from django.... |
"""
$url clubbingtv.com
$type live, vod
$account Login required
"""
import logging
import re
from streamlink.plugin import Plugin, PluginArgument, PluginArguments, pluginmatcher
from streamlink.stream.hls import HLSStream
log = logging.getLogger(__name__)
@pluginmatcher(re.compile(
r"https?://(www\.)?clubbingt... | [
"logging.getLogger",
"streamlink.stream.hls.HLSStream.parse_variant_playlist",
"streamlink.plugin.PluginArgument",
"re.compile"
] | [((231, 258), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (248, 258), False, 'import logging\n'), ((431, 527), 're.compile', 're.compile', (['"""playerInstance\\\\.setup\\\\({\\\\s*"file"\\\\s*:\\\\s*"(?P<stream_url>.+?)\\""""', 're.DOTALL'], {}), '(\'playerInstance\\\\.setup\\\\({\\\\... |
#!/usr/bin/env python3
import os
import numpy as np
import astropy.io.fits as fits
from stella.catalog.base import _str_to_float
inputfile = os.path.join(os.getenv('ASTRO_DATA'), 'catalog/I/239/hip_main.dat')
types = [
('HIP', np.int32),
('RAdeg', np.float64),
('DEdeg', np.float64),
... | [
"os.path.exists",
"astropy.io.fits.HDUList",
"astropy.io.fits.PrimaryHDU",
"os.getenv",
"astropy.io.fits.BinTableHDU",
"numpy.array",
"stella.catalog.base._str_to_float",
"numpy.isnan",
"numpy.dtype",
"os.remove"
] | [((1185, 1231), 'numpy.dtype', 'np.dtype', (["{'names': tmp[0], 'formats': tmp[1]}"], {}), "({'names': tmp[0], 'formats': tmp[1]})\n", (1193, 1231), True, 'import numpy as np\n'), ((1242, 1462), 'numpy.array', 'np.array', (["(0, np.NaN, np.NaN, np.NaN, np.NaN, np.NaN, np.NaN, np.NaN, np.NaN, np.NaN,\n np.NaN, np.NaN... |
#!/usr/bin/python
# coding=utf8 rajan @_@
import sys;
import os;
if __name__ == "__main__":
type = sys.argv[1];
port = sys.argv[2];
if not type or not port:
print("type or port can not be null");
sys.exit(0)
cmd = "/sbin/iptables -I INPUT -p %s --dport %s -j ACCEPT"%(type,port)
print... | [
"sys.exit"
] | [((224, 235), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (232, 235), False, 'import sys\n')] |
"""
사이트 관리도구 기본 뷰.
"""
import os
from django.contrib.auth.mixins import AccessMixin
from django.http import Http404
from django.views.generic import TemplateView
from apps.ksso.mixins import SignUpRequiredMixin
from apps.manager.constants import *
from apps.manager.models import Category, Service
class PermissionC... | [
"apps.manager.models.Category.objects.filter",
"os.path.join",
"apps.manager.models.Service.objects.filter"
] | [((3700, 3737), 'apps.manager.models.Category.objects.filter', 'Category.objects.filter', ([], {'is_open': '(True)'}), '(is_open=True)\n', (3723, 3737), False, 'from apps.manager.models import Category, Service\n'), ((2249, 2281), 'os.path.join', 'os.path.join', (['"""/"""', "kwargs['url']"], {}), "('/', kwargs['url'])... |
import astropy.units as u
from astropy.coordinates import EarthLocation,SkyCoord
from pytz import timezone
import numpy as np
from collections import Sequence
import matplotlib.pyplot as plt
from matplotlib import dates
from astroplan import Observer
from astroplan import FixedTarget
from datetime import datetime, ... | [
"matplotlib.dates.date2num",
"pytz.timezone",
"re.compile",
"matplotlib.dates.DateFormatter",
"astropy.coordinates.EarthLocation.from_geodetic",
"astropy.coordinates.SkyCoord",
"bs4.BeautifulSoup",
"numpy.zeros",
"numpy.linspace",
"datetime.datetime.fromisoformat",
"datetime.timedelta",
"numpy... | [((1639, 1655), 'bs4.BeautifulSoup', 'bs', (['text', '"""lxml"""'], {}), "(text, 'lxml')\n", (1641, 1655), True, 'from bs4 import BeautifulSoup as bs\n'), ((3202, 3244), 're.compile', 're.compile', (['"""top: (.*)px; bottom: (.*)px;"""'], {}), "('top: (.*)px; bottom: (.*)px;')\n", (3212, 3244), False, 'import re\n'), (... |
#RPi Control Algorithm
import RPi.GPIO as GPIO
import time
#Setup
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(21,GPIO.IN,pull_up_down=GPIO.PUD_DOWN) #Status Input
STATUS_IN=21
GPIO.setup(20, GPIO.OUT) #Power Direction Output
POWER_DIRECTION=20
GPIO.setup(16, GPIO.OUT) #Power Magnitude Output
POWER_MAG_6=1... | [
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"RPi.GPIO.setwarnings",
"time.sleep",
"RPi.GPIO.input",
"time.time",
"RPi.GPIO.setmode"
] | [((66, 89), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}), '(False)\n', (82, 89), True, 'import RPi.GPIO as GPIO\n'), ((90, 112), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (102, 112), True, 'import RPi.GPIO as GPIO\n'), ((113, 164), 'RPi.GPIO.setup', 'GPIO.setup', (['(21)',... |
import sys
from PySide6.QtCore import Qt, QTimer, QSettings, QThread, QRegularExpression
from PySide6.QtGui import QIcon, QAction, QPixmap, QIntValidator, QRegularExpressionValidator
from PySide6.QtWidgets import QApplication, QSystemTrayIcon, QMenu, \
QLabel, QWidgetAction, QWidget, QHBoxLayout, QMessageBox, QForm... | [
"PySide6.QtCore.QRegularExpression",
"modules.flask_thread.FlaskThread",
"PySide6.QtWidgets.QMessageBox",
"PySide6.QtWidgets.QFormLayout",
"PySide6.QtGui.QAction",
"qdarktheme.load_stylesheet",
"PySide6.QtWidgets.QHBoxLayout",
"PySide6.QtWidgets.QPushButton",
"PySide6.QtWidgets.QWidgetAction",
"Py... | [((13354, 13376), 'PySide6.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (13366, 13376), False, 'from PySide6.QtWidgets import QApplication, QSystemTrayIcon, QMenu, QLabel, QWidgetAction, QWidget, QHBoxLayout, QMessageBox, QFormLayout, QLineEdit, QPushButton\n'), ((654, 667), 'PySide6.QtW... |
#
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 <NAME> and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by the Free... | [
"django.dispatch.receiver",
"json.dumps",
"decimal.Decimal"
] | [((6761, 6824), 'django.dispatch.receiver', 'receiver', (['register_data_exporters'], {'dispatch_uid': '"""exporter_json"""'}), "(register_data_exporters, dispatch_uid='exporter_json')\n", (6769, 6824), False, 'from django.dispatch import receiver\n'), ((6720, 6757), 'json.dumps', 'json.dumps', (['jo'], {'cls': 'Django... |
"""
Module for app authorization
"""
from flask import Blueprint, request
from github import Github, BadCredentialsException
from .config import ALLOWED_GITHUB_USERS
auth_protected = Blueprint("auth_protected", __name__)
def _unauthorized(reason):
return reason, 401
def _forbidden(reason):
return reason, 4... | [
"flask.Blueprint",
"flask.request.headers.get",
"github.Github"
] | [((184, 221), 'flask.Blueprint', 'Blueprint', (['"""auth_protected"""', '__name__'], {}), "('auth_protected', __name__)\n", (193, 221), False, 'from flask import Blueprint, request\n'), ((827, 863), 'flask.request.headers.get', 'request.headers.get', (['"""Authorization"""'], {}), "('Authorization')\n", (846, 863), Fal... |
import pytest
import gzip, zipfile, pathlib
from file_iterator.FileIterator import PlainIterator, \
GzipIterator, ZipIterator
from file_iterator.FileGroupIterator import FileGroupIterator
# Helper functions.
def write_nums(f, lines_no):
for i in range(lines_no):
f.write(f'{i}\n'.encode())
def get_pa... | [
"file_iterator.FileGroupIterator.FileGroupIterator",
"pathlib.Path",
"file_iterator.FileIterator.PlainIterator",
"file_iterator.FileIterator.GzipIterator",
"file_iterator.FileIterator.ZipIterator"
] | [((1341, 1364), 'file_iterator.FileIterator.PlainIterator', 'PlainIterator', (['txt_file'], {}), '(txt_file)\n', (1354, 1364), False, 'from file_iterator.FileIterator import PlainIterator, GzipIterator, ZipIterator\n'), ((1445, 1468), 'file_iterator.FileIterator.GzipIterator', 'GzipIterator', (['gzip_file'], {}), '(gzi... |
#!/bin/false
# Copyright (c) 2022 <NAME>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and th... | [
"sys.path.insert",
"datalidator.filters.impl.ListDeduplicateItemsFilter.ListDeduplicateItemsFilter",
"theoretical_testutils.test_function_parameter_generator",
"datalidator.validators.impl.SequenceMinimumLengthValidator.SequenceMinimumLengthValidator",
"datalidator.validators.impl.SequenceHasAllItemsUniqueV... | [((67040, 67119), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""length"""', '(0, 1, 100, 1000, 1000000, 1000000000000000)'], {}), "('length', (0, 1, 100, 1000, 1000000, 1000000000000000))\n", (67063, 67119), False, 'import pytest\n'), ((67300, 67363), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ... |
# -*- coding: utf-8 -*-
"""
fix alpha blending of font_control
===================================
"""
# import standard libraries
from operator import sub
import os
from pathlib import Path
from colour.models.cie_lab import Lab_to_LCHab
# import third-party libraries
import numpy as np
from colour import LUT3D, RGB_... | [
"numpy.dstack",
"pathlib.Path",
"colour.RGB_to_XYZ",
"colour.XYZ_to_Lab",
"numpy.stack",
"numpy.array",
"colour.LUT3D.linear_table",
"numpy.save",
"os.path.abspath",
"colour.difference.delta_E_CIE2000",
"numpy.arange",
"numpy.load"
] | [((926, 1001), 'colour.RGB_to_XYZ', 'RGB_to_XYZ', (['rgb_linear', 'cs.D65', 'cs.D65', 'BT709_COLOURSPACE.RGB_to_XYZ_matrix'], {}), '(rgb_linear, cs.D65, cs.D65, BT709_COLOURSPACE.RGB_to_XYZ_matrix)\n', (936, 1001), False, 'from colour import LUT3D, RGB_to_XYZ, XYZ_to_Lab\n'), ((1021, 1042), 'colour.XYZ_to_Lab', 'XYZ_to... |
from __future__ import absolute_import, division, print_function
from iotbx.kriber import strudat
from cctbx import geometry_restraints
from cctbx import crystal
from cctbx.array_family import flex
import scitbx.math
from scitbx import matrix
from libtbx.test_utils import approx_equal, show_diff
from libtbx.utils impor... | [
"math.sqrt",
"cctbx.array_family.flex.min",
"cctbx.array_family.flex.size_t",
"libtbx.test_utils.approx_equal",
"cctbx.crystal.direct_space_asu.non_crystallographic_asu_mappings",
"libtbx.dict_with_default_0",
"six.moves.cStringIO",
"cctbx.geometry_restraints.bond_sorted_asu_proxies",
"cctbx.geometr... | [((592, 615), 'six.moves.range', 'range', (['(0)', '(max_level + 1)'], {}), '(0, max_level + 1)\n', (597, 615), False, 'from six.moves import range\n'), ((5678, 5691), 'cctbx.array_family.flex.size_t', 'flex.size_t', ([], {}), '()\n', (5689, 5691), False, 'from cctbx.array_family import flex\n'), ((6451, 6464), 'cctbx.... |
import sys
import tkinter as tk
import cv2
from datetime import date, datetime
from PIL import ImageTk, Image
from dobe_config import *
from dobe_api import *
LARGE_FONT = ("ChicagoFLF", 90)
MED_FONT = ("ChicagoFLF", 20)
DIVIDER_HEIGHT = 3
class Dobe_View():
def __init__(self):
root = tk.Tk()
co... | [
"PIL.Image.fromarray",
"tkinter.Frame.__init__",
"tkinter.Button",
"tkinter.Canvas",
"datetime.datetime.now",
"tkinter.Tk",
"cv2.VideoCapture",
"tkinter.Label",
"sys.exit",
"cv2.cvtColor",
"tkinter.PhotoImage",
"tkinter.Canvas.__init__",
"PIL.ImageTk.PhotoImage"
] | [((302, 309), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (307, 309), True, 'import tkinter as tk\n'), ((834, 844), 'sys.exit', 'sys.exit', ([], {}), '()\n', (842, 844), False, 'import sys\n'), ((932, 972), 'tkinter.Frame.__init__', 'tk.Frame.__init__', (['self', '*args'], {}), '(self, *args, **kwargs)\n', (949, 972), Tru... |
import time
class Cooldown:
__slots__ = ("rate", "per", "_window", "_tokens", "_last")
def __init__(self, rate, per):
self.rate = int(rate)
self.per = float(per)
self._window = 0.0
self._tokens = self.rate
self._last = 0.0
def get_tokens(self, current=None):
... | [
"time.time"
] | [((361, 372), 'time.time', 'time.time', ([], {}), '()\n', (370, 372), False, 'import time\n'), ((579, 590), 'time.time', 'time.time', ([], {}), '()\n', (588, 590), False, 'import time\n'), ((810, 821), 'time.time', 'time.time', ([], {}), '()\n', (819, 821), False, 'import time\n'), ((2462, 2473), 'time.time', 'time.tim... |
from module_b.main import get_the_question
QUESTION: str = "life universe and everything"
def test_given_question_is_known_when_asked_for_question_then_answer():
assert QUESTION == get_the_question()
| [
"module_b.main.get_the_question"
] | [((188, 206), 'module_b.main.get_the_question', 'get_the_question', ([], {}), '()\n', (204, 206), False, 'from module_b.main import get_the_question\n')] |
try:
from json import load
from math import floor
from os import path
from random import choice, sample, randrange
except ImportError:
raise ImportError
class Fighter:
def __init__(self, as_str, as_con, as_dex,
as_int, as_wis, as_cha, char_race, char_background, level):
... | [
"random.sample",
"random.choice",
"random.randrange",
"math.floor",
"os.path.dirname",
"json.load"
] | [((4202, 4230), 'random.choice', 'choice', (['self.fighting_styles'], {}), '(self.fighting_styles)\n', (4208, 4230), False, 'from random import choice, sample, randrange\n'), ((1674, 1696), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (1686, 1696), False, 'from os import path\n'), ((2866, 2890... |
import os
from typing import Optional, List
import click
from valohai.internals.merge import python_to_yaml_merge_strategy
from valohai.internals.yaml import parse_config_from_source
from valohai.yaml import config_to_yaml
from valohai_yaml.objs.config import Config
from valohai_cli.ctx import get_project
from valoha... | [
"valohai_cli.messages.info",
"os.path.join",
"valohai.yaml.config_to_yaml",
"os.path.isfile",
"click.Path",
"valohai_cli.ctx.get_project",
"click.command"
] | [((397, 412), 'click.command', 'click.command', ([], {}), '()\n', (410, 412), False, 'import click\n'), ((784, 797), 'valohai_cli.ctx.get_project', 'get_project', ([], {}), '()\n', (795, 797), False, 'from valohai_cli.ctx import get_project\n'), ((4023, 4074), 'os.path.join', 'os.path.join', (['project.directory', '"""... |
#!/usr/bin/env python
# coding: utf-8
import numpy as np
import random
import itertools
import mccd
## Extracting the EigenPSFs from the fitted models
vignets_noiseless = np.zeros((19665, 51, 51))
i=0
for j in list(range(2000000, 2000287)) + list(range(2100000, 2100150)):
path_fitted_model = '/n05data/a... | [
"mccd.mccd_utils.save_to_fits",
"numpy.zeros",
"mccd.utils.reg_format",
"numpy.load",
"numpy.random.shuffle"
] | [((176, 201), 'numpy.zeros', 'np.zeros', (['(19665, 51, 51)'], {}), '((19665, 51, 51))\n', (184, 201), True, 'import numpy as np\n'), ((639, 675), 'numpy.random.shuffle', 'np.random.shuffle', (['vignets_noiseless'], {}), '(vignets_noiseless)\n', (656, 675), True, 'import numpy as np\n'), ((763, 863), 'mccd.mccd_utils.s... |
"""To run this program you may need to install dependencies, for
example
pip3 install flask flask_cors py-gfm gunicorn
"""
README = """You can run this API server with JSON arguments whose structure
matches 'command_line_structure', for example
PYTHONPATH=src python3 -m elapid.example.main '{"port": 7700, "... | [
"elapid.jsonstructure.Number",
"elapid.api_main",
"elapid.jsonstructure.String",
"elapid.example.face_detector.ExampleFaceDetector",
"elapid.jsonstructure.Empty"
] | [((1219, 1265), 'elapid.example.face_detector.ExampleFaceDetector', 'ExampleFaceDetector', ([], {'example_parameter': '"""value"""'}), "(example_parameter='value')\n", (1238, 1265), False, 'from elapid.example.face_detector import ExampleFaceDetector\n'), ((3660, 3710), 'elapid.api_main', 'api_main', (['command_line_st... |
import subprocess
import time
class ProxyClient():
def restart_client(self):
while True:
(status, output) = subprocess.getstatusoutput('systemctl restart tinyproxy.service')
if status ==0:
print("tinyproxy 重启成功")
time.sleep(1200)
else... | [
"time.sleep",
"subprocess.getstatusoutput"
] | [((138, 203), 'subprocess.getstatusoutput', 'subprocess.getstatusoutput', (['"""systemctl restart tinyproxy.service"""'], {}), "('systemctl restart tinyproxy.service')\n", (164, 203), False, 'import subprocess\n'), ((287, 303), 'time.sleep', 'time.sleep', (['(1200)'], {}), '(1200)\n', (297, 303), False, 'import time\n'... |
import numpy as np
from sklearn.base import BaseEstimator, clone
from sklearn.metrics import r2_score
from .utils import my_fit
class EraBoostXgbRegressor(BaseEstimator):
def __init__(self, base_estimator=None, num_iterations=3, proportion=0.5, n_estimators=None):
self.base_estimator = base_estimator
... | [
"sklearn.base.clone",
"numpy.quantile",
"numpy.concatenate",
"sklearn.metrics.r2_score",
"numpy.arange"
] | [((575, 601), 'sklearn.base.clone', 'clone', (['self.base_estimator'], {}), '(self.base_estimator)\n', (580, 601), False, 'from sklearn.base import BaseEstimator, clone\n'), ((1287, 1327), 'numpy.quantile', 'np.quantile', (['era_scores', 'self.proportion'], {}), '(era_scores, self.proportion)\n', (1298, 1327), True, 'i... |
from abc import ABC, abstractmethod
from urllib.parse import urlencode
import logging
import csv
import pandas as pd
from helper import retrieve_website
from jobs import StepstoneJob
class BaseParser(ABC):
def __init__(self):
self.jobs = []
self._create_startinglink()
@abstractmethod
def ... | [
"urllib.parse.urlencode",
"jobs.StepstoneJob",
"pandas.DataFrame.from_records",
"helper.retrieve_website"
] | [((1357, 1386), 'urllib.parse.urlencode', 'urlencode', (['self.search_params'], {}), '(self.search_params)\n', (1366, 1386), False, 'from urllib.parse import urlencode\n'), ((1679, 1713), 'pandas.DataFrame.from_records', 'pd.DataFrame.from_records', (['ls_jobs'], {}), '(ls_jobs)\n', (1704, 1713), True, 'import pandas a... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, <NAME> and contributors
# For license information, please see license.txt
#
# Api for configurations
#
from __future__ import unicode_literals
import frappe
from ioe_api.helper import get_post_json_data, throw, as_dict, update_doc, get_doc_as_dict, valid_auth_code
@frap... | [
"ioe_api.helper.throw",
"frappe.get_value",
"ioe_api.helper.update_doc",
"frappe.response.update",
"frappe.whitelist",
"ioe_api.helper.get_doc_as_dict",
"frappe.delete_doc",
"frappe.get_doc",
"ioe_api.helper.valid_auth_code",
"frappe.get_all",
"ioe_api.helper.get_post_json_data",
"ioe_api.help... | [((316, 350), 'frappe.whitelist', 'frappe.whitelist', ([], {'allow_guest': '(True)'}), '(allow_guest=True)\n', (332, 350), False, 'import frappe\n'), ((472, 506), 'frappe.whitelist', 'frappe.whitelist', ([], {'allow_guest': '(True)'}), '(allow_guest=True)\n', (488, 506), False, 'import frappe\n'), ((977, 1011), 'frappe... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from typing import Tuple
import libcst as cst
from libcst._nodes._internal import (
BasicCodegenState,
CodePosition,
... | [
"libcst._nodes._internal.CodeRange",
"libcst._nodes._internal.CodeRange.create",
"libcst._nodes._internal.CodePosition",
"libcst.Pass",
"libcst.metadata.position_provider.BasicPositionProvider",
"libcst.metadata.position_provider.SyntacticPositionProvider"
] | [((2181, 2191), 'libcst.Pass', 'cst.Pass', ([], {}), '()\n', (2189, 2191), True, 'import libcst as cst\n'), ((2376, 2414), 'libcst._nodes._internal.CodePosition', 'CodePosition', (['state.line', 'state.column'], {}), '(state.line, state.column)\n', (2388, 2414), False, 'from libcst._nodes._internal import BasicCodegenS... |
# coding: utf-8
import argparse
import torch
import torch.nn.functional as F
import numpy as np
import cv2
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import models.ssd as ssd
import models.detection as detection
from config import Config as cfg
COLORS = [(255, 0, 0), (0, 255, 0), (0, 0, ... | [
"cv2.imwrite",
"argparse.ArgumentParser",
"matplotlib.use",
"models.detection.detection",
"torch.load",
"torch.Tensor",
"torch.from_numpy",
"torch.cuda.is_available",
"models.ssd.build_ssd",
"torch.no_grad",
"cv2.resize",
"cv2.imread",
"torch.nn.functional.softmax",
"torch.device"
] | [((126, 147), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (140, 147), False, 'import matplotlib\n'), ((665, 700), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""ssd demo"""'], {}), "('ssd demo')\n", (688, 700), False, 'import argparse\n'), ((1227, 1245), 'models.ssd.build_ssd', 's... |