code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pytest
import numpy as np
from synthpop.census_helpers import Census
from synthpop import categorizer as cat
import os
@pytest.fixture
def c():
return Census('bfa6b4e541243011fab6307a31aed9e91015ba90')
@pytest.fixture
def acs_data(c):
population = ['B01001_001E']
sex = ['B01001_002E', 'B01001_026... | [
"synthpop.categorizer.sum_accross_category",
"synthpop.categorizer.category_combinations",
"synthpop.census_helpers.Census",
"synthpop.categorizer.categorize"
] | [((164, 214), 'synthpop.census_helpers.Census', 'Census', (['"""bfa6b4e541243011fab6307a31aed9e91015ba90"""'], {}), "('bfa6b4e541243011fab6307a31aed9e91015ba90')\n", (170, 214), False, 'from synthpop.census_helpers import Census\n'), ((842, 1963), 'synthpop.categorizer.categorize', 'cat.categorize', (['acs_data', "{('p... |
import pyvista as pv
from utils import coastline
resolution = "50m"
blocks = coastline(resolution=resolution)
print(f"Geometries: {len(blocks)}")
mesh = pv.read("real/pdata_sst_t0.vtk")
p = pv.Plotter()
for block in blocks:
p.add_mesh(block, color="white")
p.add_mesh(mesh, scalars="faces", cmap="coolwarm", show... | [
"pyvista.read",
"pyvista.Plotter",
"utils.coastline"
] | [((79, 111), 'utils.coastline', 'coastline', ([], {'resolution': 'resolution'}), '(resolution=resolution)\n', (88, 111), False, 'from utils import coastline\n'), ((156, 188), 'pyvista.read', 'pv.read', (['"""real/pdata_sst_t0.vtk"""'], {}), "('real/pdata_sst_t0.vtk')\n", (163, 188), True, 'import pyvista as pv\n'), ((1... |
import random
from typing import List
from mpyc.runtime import mpc
"""
Run it with one party:
python3 fair_allocation.py
Run it at once with 3 parties, of which 1 corrupted:
python3 fair_allocation.py -M3 -T1
Run it in separate shells with 3 parties, of which 1 corrupted:
python3 fair_allocation.py -M3 -T1 -I... | [
"mpyc.runtime.mpc.output",
"mpyc.runtime.mpc.start",
"random.randrange",
"mpyc.runtime.mpc.sum",
"mpyc.runtime.mpc.SecInt",
"mpyc.runtime.mpc.if_else",
"mpyc.runtime.mpc.shutdown",
"mpyc.runtime.mpc.max",
"mpyc.runtime.mpc.min"
] | [((1107, 1121), 'mpyc.runtime.mpc.SecInt', 'mpc.SecInt', (['(16)'], {}), '(16)\n', (1117, 1121), False, 'from mpyc.runtime import mpc\n'), ((1037, 1048), 'mpyc.runtime.mpc.start', 'mpc.start', ([], {}), '()\n', (1046, 1048), False, 'from mpyc.runtime import mpc\n'), ((1915, 1955), 'mpyc.runtime.mpc.if_else', 'mpc.if_el... |
import copy
from hearthbreaker.cards.base import Card
from hearthbreaker.tags.action import AddCard
from hearthbreaker.tags.aura import ManaAura
from hearthbreaker.tags.base import Effect, BuffUntil, Buff
from hearthbreaker.tags.event import TurnStarted, TurnEnded
from hearthbreaker.tags.selector import PlayerSelector,... | [
"hearthbreaker.tags.selector.SpecificCardSelector",
"hearthbreaker.tags.selector.PlayerSelector",
"hearthbreaker.tags.action.AddCard",
"hearthbreaker.tags.status.ChangeAttack",
"hearthbreaker.tags.selector.SpellSelector",
"hearthbreaker.tags.event.TurnStarted",
"hearthbreaker.tags.event.TurnEnded",
"c... | [((4785, 4821), 'copy.copy', 'copy.copy', (['game.other_player.minions'], {}), '(game.other_player.minions)\n', (4794, 4821), False, 'import copy\n'), ((7389, 7425), 'copy.copy', 'copy.copy', (['game.other_player.minions'], {}), '(game.other_player.minions)\n', (7398, 7425), False, 'import copy\n'), ((2780, 2816), 'cop... |
from __future__ import print_function, absolute_import, division
import re
import sys
import pysam
from katana.util import KatanaException
PYSAM_ADAPTER = None
class _Pysam(object):
@staticmethod
def alignment_file(bam_filename, mode='rb', template=None, header=None):
return pysam.AlignmentFile(bam... | [
"pysam.index",
"pysam.view",
"katana.util.KatanaException",
"pysam.AlignedSegment",
"re.match",
"pysam.AlignmentFile",
"pysam.sort"
] | [((602, 643), 're.match', 're.match', (['"""^0\\\\.8\\\\.*"""', 'pysam.__version__'], {}), "('^0\\\\.8\\\\.*', pysam.__version__)\n", (610, 643), False, 'import re\n'), ((1083, 1135), 're.match', 're.match', (['"""^0\\\\.(9|10|11|12)\\\\.*"""', 'pysam.__version__'], {}), "('^0\\\\.(9|10|11|12)\\\\.*', pysam.__version__... |
# coding: utf-8
import setuptools
long_description = """\
# stbt_rig
Command-line tool & library for interacting with the Stb-tester Portal's [REST
API].
For more details see [IDE Configuration] in the Stb-tester manual.
[IDE Configuration]: https://stb-tester.com/manual/ide-configuration
[REST API]: https://stb-... | [
"setuptools.setup"
] | [((355, 1130), 'setuptools.setup', 'setuptools.setup', ([], {'name': '"""stbt_rig"""', 'version': '"""2.0.2"""', 'author': '"""<EMAIL>."""', 'author_email': '"""<EMAIL>"""', 'description': '"""Library for interacting with the Stb-tester Portal\'s REST API"""', 'long_description': 'long_description', 'long_description_c... |
# -*- coding: utf-8 -*-
# imports
import helper;
import cv2;
# global variables
cam = 0;
# Function gets access of the camera.
def getCamera():
global cam;
cam = cv2.VideoCapture("experimentalVideos/vid2.mp4");
#cam = cv2.VideoCapture("experimentalVideos/vid2.mp4");
#cam = cv2.VideoCapture(0);
... | [
"helper.throwException",
"cv2.imread",
"cv2.VideoCapture"
] | [((179, 226), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""experimentalVideos/vid2.mp4"""'], {}), "('experimentalVideos/vid2.mp4')\n", (195, 226), False, 'import cv2\n'), ((744, 812), 'cv2.imread', 'cv2.imread', (['"""web_test_visual_output/sel_image.png"""', 'cv2.IMREAD_COLOR'], {}), "('web_test_visual_output/sel_ima... |
#<NAME>
#30/11/21
#Some basic college coding - NDVI, Advanced list manipulations & plotting
########################
#Imports & Inits
########################
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
import seaborn as sns
from sklearn.linear_model imp... | [
"scipy.stats.linregress",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.array",
"pandas.ExcelFile",
"pandas.read_excel",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((524, 547), 'pandas.read_excel', 'pd.read_excel', (['location'], {}), '(location)\n', (537, 547), True, 'import pandas as pd\n'), ((557, 669), 'pandas.ExcelFile', 'pd.ExcelFile', (['"""C:\\\\Data\\\\Remote_Sensing\\\\CourseData\\\\Remotesensing(1)\\\\Achterhoek_FieldSpec_2008.xlsx"""'], {}), "(\n 'C:\\\\Data\\\\Re... |
import json
from rest_framework.response import Response
from rest_framework.views import APIView
from master.workflow.preprocess.workflow_feed_fr2seq import WorkflowFeedFr2Seq
from master.workflow.preprocess.workflow_feed_fr2wv import WorkflowFeedFr2Wv
from master.workflow.preprocess.workflow_feed_fr2auto import Workf... | [
"master.workflow.preprocess.workflow_feed_iob2bilstmcrf.WorkflowFeedIob2BiLstmCrf",
"master.workflow.preprocess.workflow_feed_fr2wcnn.WorkflowFeedFr2Wcnn",
"coreapi.Field",
"master.workflow.preprocess.workflow_feed_fr2wv.WorkflowFeedFr2Wv",
"json.dumps",
"master.workflow.preprocess.workflow_feed_fr2auto.W... | [((651, 708), 'coreapi.Field', 'coreapi.Field', ([], {'name': '"""parm1"""', 'required': '(True)', 'type': '"""string"""'}), "(name='parm1', required=True, type='string')\n", (664, 708), False, 'import coreapi\n'), ((765, 822), 'coreapi.Field', 'coreapi.Field', ([], {'name': '"""parm2"""', 'required': '(True)', 'type':... |
"""
Module to assist with the creation of python ascii art
"""
def goto(x_pos, y_pos):
"""
Move the cursor to a given position
"""
x_pos = int(x_pos)
y_pos = int(y_pos)
print(f"\033[{y_pos};{x_pos}H", end="")
def set_color(red, green, blue):
"""
Set the foreground color of the text
... | [
"time.sleep"
] | [((2944, 2952), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (2949, 2952), False, 'from time import sleep\n'), ((3026, 3034), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (3031, 3034), False, 'from time import sleep\n'), ((3070, 3078), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (3075, 3078), False, 'from time i... |
# Import modules
from ctypes import windll
# Sets a photo on the desktop wallpaper
def SetWallpapers(Photo, Directory):
windll.user32.SystemParametersInfoW(20, 0, Directory + Photo.file_path, 0) | [
"ctypes.windll.user32.SystemParametersInfoW"
] | [((125, 199), 'ctypes.windll.user32.SystemParametersInfoW', 'windll.user32.SystemParametersInfoW', (['(20)', '(0)', '(Directory + Photo.file_path)', '(0)'], {}), '(20, 0, Directory + Photo.file_path, 0)\n', (160, 199), False, 'from ctypes import windll\n')] |
from django.urls import path
from . import views
app_name = 'extractor'
urlpatterns = [
path('', views.index, name='index'),
path('<int:extractor_id>/', views.detail, name='detail'),
path('headers/', views.headers_vote, name='extract_headers')
]
| [
"django.urls.path"
] | [((93, 128), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (97, 128), False, 'from django.urls import path\n'), ((134, 190), 'django.urls.path', 'path', (['"""<int:extractor_id>/"""', 'views.detail'], {'name': '"""detail"""'}), "('<int:extractor_i... |
# Generated by Django 3.0.2 on 2020-12-05 17:38
import accounts.models
import cloudinary.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('minmarkets', '0002_auto_20200517_1124'),
]
operations = [
m... | [
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((435, 528), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (451, 528), False, 'from django.db import migrations, models\... |
"""Sample API Client."""
import json
from datetime import datetime, timedelta
import asyncio
import logging
import socket
import aiohttp
import async_timeout
from custom_components.wellbeing.const import SENSOR, FAN, BINARY_SENSOR
from homeassistant.components.binary_sensor import DEVICE_CLASS_CONNECTIVITY
from home... | [
"logging.getLogger",
"datetime.datetime.now",
"datetime.timedelta",
"asyncio.get_event_loop"
] | [((922, 952), 'logging.getLogger', 'logging.getLogger', (['__package__'], {}), '(__package__)\n', (939, 952), False, 'import logging\n'), ((7303, 7317), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (7315, 7317), False, 'from datetime import datetime, timedelta\n'), ((7240, 7254), 'datetime.datetime.now', ... |
"""
The MIT License (MIT)
Copyright (c) 2016-2017 <NAME> <EMAIL>
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,... | [
"utility.Logging.logger.error",
"util.KDMFileExtractor.extractfile",
"util.SourceFilePathGenerator.OriginalFilePathGenerator",
"util.FilePathExtractor.FilePathExtractor"
] | [((1704, 1730), 'util.KDMFileExtractor.extractfile', 'extractfile', (['kdm_file_path'], {}), '(kdm_file_path)\n', (1715, 1730), False, 'from util.KDMFileExtractor import extractfile\n'), ((1895, 1929), 'util.FilePathExtractor.FilePathExtractor', 'FilePathExtractor', (['toif_components'], {}), '(toif_components)\n', (19... |
import os, pprint
import numpy as np
import joblib
from utils.BaseModel import BaseModel
from utils.AwesomeTimeIt import timeit
from utils.RegressionReport import evaluate_regression
from utils.FeatureImportanceReport import report_feature_importance
from sklearn.model_selection import RandomizedSearchCV
from sklearn... | [
"sklearn.model_selection.GridSearchCV",
"pprint.pformat",
"xgboost.XGBRegressor",
"numpy.linspace",
"joblib.load",
"xgboost.DMatrix",
"joblib.dump",
"sklearn.model_selection.RandomizedSearchCV"
] | [((2116, 2166), 'xgboost.DMatrix', 'xgb.DMatrix', ([], {'data': 'self.X_train', 'label': 'self.Y_train'}), '(data=self.X_train, label=self.Y_train)\n', (2127, 2166), True, 'import xgboost as xgb\n'), ((2192, 2397), 'xgboost.XGBRegressor', 'xgb.XGBRegressor', ([], {'max_depth': 'self.max_depth', 'learning_rate': 'self.l... |
import sys
import os
from setuptools import setup, find_packages
PACKAGES = find_packages()
# Get version and release info, which is all stored in Water-Pipe-Project/version.py
ver_file = os.path.join('water_main_predictions', 'version.py')
with open(ver_file) as f:
exec(f.read())
# Give setuptools a hint to comp... | [
"setuptools.find_packages",
"os.path.join",
"setuptools.setup"
] | [((76, 91), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (89, 91), False, 'from setuptools import setup, find_packages\n'), ((189, 241), 'os.path.join', 'os.path.join', (['"""water_main_predictions"""', '"""version.py"""'], {}), "('water_main_predictions', 'version.py')\n", (201, 241), False, 'import ... |
import asyncio
from kopf.engines.sleeping import sleep_or_wait
async def test_sleep_or_wait_by_delay_reached(timer):
event = asyncio.Event()
with timer:
unslept = await asyncio.wait_for(sleep_or_wait(0.10, event), timeout=1.0)
assert 0.10 <= timer.seconds < 0.11
assert unslept is None
async... | [
"kopf.engines.sleeping.sleep_or_wait",
"asyncio.get_running_loop",
"asyncio.Event"
] | [((132, 147), 'asyncio.Event', 'asyncio.Event', ([], {}), '()\n', (145, 147), False, 'import asyncio\n'), ((377, 392), 'asyncio.Event', 'asyncio.Event', ([], {}), '()\n', (390, 392), False, 'import asyncio\n'), ((711, 726), 'asyncio.Event', 'asyncio.Event', ([], {}), '()\n', (724, 726), False, 'import asyncio\n'), ((98... |
from typing import TYPE_CHECKING
import platform
if TYPE_CHECKING or platform.python_version().startswith("3.6."):
from . import data, nn, utils
else:
# Lazy submodule loading
def __getattr__(name):
import importlib
module = importlib.import_module(__name__)
if name not in __all__:... | [
"platform.python_version",
"importlib.import_module"
] | [((255, 288), 'importlib.import_module', 'importlib.import_module', (['__name__'], {}), '(__name__)\n', (278, 288), False, 'import importlib\n'), ((416, 475), 'importlib.import_module', 'importlib.import_module', (['f""".{name}"""', 'module.__spec__.parent'], {}), "(f'.{name}', module.__spec__.parent)\n", (439, 475), F... |
"""
Usage:
cfgen FILE [list] [OPTIONS] [--overwrite]
Commands:
list list variables and their values
Options:
--overwrite overwrite existing file
metaconfig cache
.cfgen.cache
<variable_name> = <value>
metaconfig file
cfgen.metaconfig
<variable_name> = <shell_command>
*.template
jinja templat... | [
"subprocess.check_output",
"os.path.exists",
"collections.OrderedDict",
"jinja2.loaders.FileSystemLoader",
"os.getcwd",
"os.path.isfile",
"sys.exc_info",
"docopt.docopt"
] | [((1216, 1238), 'docopt.docopt', 'docopt.docopt', (['__doc__'], {}), '(__doc__)\n', (1229, 1238), False, 'import docopt\n'), ((3292, 3325), 'os.path.exists', 'os.path.exists', (['caching_file_name'], {}), '(caching_file_name)\n', (3306, 3325), False, 'import os\n'), ((3785, 3798), 'collections.OrderedDict', 'OrderedDic... |
"""
Copyright 2021 Johns Hopkins University (Author: <NAME>)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""
import time
import logging
import torch
import torch.nn as nn
from ...utils.math import invert_trimat
from .plda_base import PLDABase
class SPLDA(PLDABase):
def __init__(
self,
... | [
"torch.get_default_dtype",
"torch.eye",
"torch.cholesky",
"torch.sqrt",
"torch.nn.Parameter",
"torch.matmul",
"torch.sum",
"torch.symeig"
] | [((1616, 1631), 'torch.nn.Parameter', 'nn.Parameter', (['V'], {}), '(V)\n', (1628, 1631), True, 'import torch.nn as nn\n'), ((2133, 2167), 'torch.symeig', 'torch.symeig', (['W'], {'eigenvectors': '(True)'}), '(W, eigenvectors=True)\n', (2145, 2167), False, 'import torch\n'), ((2220, 2235), 'torch.nn.Parameter', 'nn.Par... |
# nrf52 bobble test in python
import time
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
ble = BLERadio()
while True:
while ble.connected and any(
UARTService in connection for co... | [
"adafruit_ble.BLERadio",
"time.sleep"
] | [((221, 231), 'adafruit_ble.BLERadio', 'BLERadio', ([], {}), '()\n', (229, 231), False, 'from adafruit_ble import BLERadio\n'), ((732, 745), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (742, 745), False, 'import time\n')] |
""" unit tests for cloudwatch alarms operator. """
from unittest.mock import patch
import sys
import os
import botocore
from botocore.stub import Stubber
import cwoperator.helpers.cloudwatch as cloudwatch
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, "src"))
CW_CLIENT = botocore.session.get_sess... | [
"botocore.session.get_session",
"botocore.stub.Stubber",
"os.path.dirname",
"cwoperator.helpers.cloudwatch.put_cloudwatch_composit_alarm",
"unittest.mock.patch.object",
"cwoperator.helpers.cloudwatch.delete_alarm",
"cwoperator.helpers.cloudwatch.put_cloudwatch_alarm"
] | [((364, 382), 'botocore.stub.Stubber', 'Stubber', (['CW_CLIENT'], {}), '(CW_CLIENT)\n', (371, 382), False, 'from botocore.stub import Stubber\n'), ((385, 454), 'unittest.mock.patch.object', 'patch.object', (['cloudwatch', '"""cloudwatch_client"""'], {'return_value': 'CW_CLIENT'}), "(cloudwatch, 'cloudwatch_client', ret... |
# fakedata.py
# run `py fakedata.py` to generate a file full of fake data for testing
import random
def generateFakeLine(year, doy, mst):
out = '0,' + str(year) + ',' + str(doy) + ',' + str(mst) + ','
for i in range(12):
out += str(random.randint(40, 60))
if (i < 11):
out += ','
... | [
"random.randint"
] | [((250, 272), 'random.randint', 'random.randint', (['(40)', '(60)'], {}), '(40, 60)\n', (264, 272), False, 'import random\n')] |
#!/usr/bin/python3
import os
import requests
import json
import sys
def notifySlack(branch_name: str, job_name: str, build_url: str, pr_url: str, slack_webhook: str):
job_name_message = 'Job name: `' + job_name + '`\n'
build_url_message = 'Build URL: ' + build_url + '\n'
pr_url_message = 'Pull request UR... | [
"json.dumps"
] | [((854, 870), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (864, 870), False, 'import json\n')] |
import struct
import csv
import sys
import os
import glob
# docu from http://forums.ni.com/attachments/ni/60/169/1/dmheader.pdf
class DIAdemType:
def __init__(self):
self.name = "" # (200)
self.comments = "" # (201)
self.unit = "" # (202)
self.implicit = True # (210)
s... | [
"struct.calcsize",
"csv.writer",
"os.path.isdir",
"struct.Struct",
"glob.glob"
] | [((3134, 3161), 'struct.calcsize', 'struct.calcsize', (['struct_fmt'], {}), '(struct_fmt)\n', (3149, 3161), False, 'import struct\n'), ((4404, 4439), 'os.path.isdir', 'os.path.isdir', (['fname_with_extension'], {}), '(fname_with_extension)\n', (4417, 4439), False, 'import os\n'), ((4639, 4681), 'glob.glob', 'glob.glob'... |
import json
from enum import IntEnum
from typing import Callable, List, NamedTuple
from crypto_crawler._lowlevel import ffi, lib
class MarketType(IntEnum):
'''Market type.'''
spot = lib.Spot
linear_future = lib.LinearFuture
inverse_future = lib.InverseFuture
linear_swap = lib.LinearSwap
inver... | [
"crypto_crawler._lowlevel.ffi.string",
"json.dumps",
"crypto_crawler._lowlevel.ffi.callback",
"crypto_crawler._lowlevel.ffi.new"
] | [((1693, 1731), 'crypto_crawler._lowlevel.ffi.callback', 'ffi.callback', (['"""void (struct Message*)"""'], {}), "('void (struct Message*)')\n", (1705, 1731), False, 'from crypto_crawler._lowlevel import ffi, lib\n'), ((1152, 1165), 'json.dumps', 'json.dumps', (['d'], {}), '(d)\n', (1162, 1165), False, 'import json\n')... |
# coding: utf-8
import matplotlib.pyplot as plt
import csv
import sys
from itertools import islice
"""
This script is for gathering force/RMSE data and Thermal conductivity data
of GaN 1750&3500 sample and plot them
"""
if __name__ == '__main__':
GaNfolder="/home/okugawa/NNP-F/GaN/SMZ-200901/"
rmsefile=GaNf... | [
"itertools.islice",
"matplotlib.pyplot.savefig",
"csv.writer",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"sys.exit",
"matplotlib.pyplot.title",
"csv.reader"
] | [((2170, 2182), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2180, 2182), True, 'import matplotlib.pyplot as plt\n'), ((2218, 2271), 'matplotlib.pyplot.title', 'plt.title', (['"""[GaN 1750 & 3500 sample] force/RMSE & TC"""'], {}), "('[GaN 1750 & 3500 sample] force/RMSE & TC')\n", (2227, 2271), True, 'im... |
from flask import Flask, render_template, request
from zipfile import ZipFile
import shutil
import base64
import zipfile
import os
import sys
import json
import requests
from os import path
# FLASK_APP=server.py flask run
# source gusPythonEnviroment/bin/activate
app = Flask(__name__)
@app.route('/')
def index():
... | [
"flask.render_template",
"Char_Replacement.server.main",
"os.listdir",
"requests.post",
"flask.Flask",
"os.path.join",
"base64.b64decode",
"flask.request.form.get",
"os.path.isfile",
"os.path.isdir",
"Mapping.mapping_module.map_words",
"os.unlink",
"Letter_Segmentation.letterSegmentation.let... | [((272, 287), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (277, 287), False, 'from flask import Flask, render_template, request\n'), ((329, 358), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (344, 358), False, 'from flask import Flask, render_template, requ... |
#!/usr/bin/env python
import unittest
from palo_alto_firewall_analyzer.core import ProfilePackage
from palo_alto_firewall_analyzer.pan_config import PanConfig
from palo_alto_firewall_analyzer.validators.find_shadowing_objects import find_shadowing_services
from palo_alto_firewall_analyzer.validators.find_shadowing_obj... | [
"unittest.main",
"palo_alto_firewall_analyzer.validators.find_shadowing_objects.find_shadowing_service_groups",
"palo_alto_firewall_analyzer.pan_config.PanConfig",
"palo_alto_firewall_analyzer.validators.find_shadowing_objects.find_shadowing_services"
] | [((4876, 4891), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4889, 4891), False, 'import unittest\n'), ((2483, 2502), 'palo_alto_firewall_analyzer.pan_config.PanConfig', 'PanConfig', (['test_xml'], {}), '(test_xml)\n', (2492, 2502), False, 'from palo_alto_firewall_analyzer.pan_config import PanConfig\n'), ((278... |
# Generated by Django 3.0.1 on 2020-04-09 15:04
from django.db import migrations
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [("webfront", "0007_history")]
operations = [
migrations.RemoveField(model_name="set", name="integrated"),
migrations.RemoveField(mo... | [
"django.db.migrations.RemoveField"
] | [((226, 285), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""set"""', 'name': '"""integrated"""'}), "(model_name='set', name='integrated')\n", (248, 285), False, 'from django.db import migrations\n'), ((295, 350), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], ... |
import os
from aiogram import Bot, Dispatcher, executor, types
from dotenv import find_dotenv, load_dotenv
from loguru import logger
load_dotenv(find_dotenv())
API_TOKEN = os.getenv("API_TOKEN")
# Initialize bot and dispatcher
bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)
@dp.message_handler()
async def process(... | [
"dotenv.find_dotenv",
"loguru.logger.info",
"os.getenv",
"aiogram.Dispatcher",
"aiogram.executor.start_polling",
"aiogram.Bot"
] | [((174, 196), 'os.getenv', 'os.getenv', (['"""API_TOKEN"""'], {}), "('API_TOKEN')\n", (183, 196), False, 'import os\n'), ((236, 256), 'aiogram.Bot', 'Bot', ([], {'token': 'API_TOKEN'}), '(token=API_TOKEN)\n', (239, 256), False, 'from aiogram import Bot, Dispatcher, executor, types\n'), ((262, 277), 'aiogram.Dispatcher'... |
#!/usr/bin/env python2
#
# Strelka - Small Variant Caller
# Copyright (c) 2009-2018 Illumina, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# at your... | [
"re.compile",
"re.match",
"optparse.OptionParser",
"os.path.isfile",
"sys.exit",
"re.search"
] | [((829, 870), 're.search', 're.search', (["('%s=([^;\\t]*);?' % key)", 'string'], {}), "('%s=([^;\\t]*);?' % key, string)\n", (838, 870), False, 'import re\n'), ((1591, 1631), 're.compile', 're.compile', (['"""^##contig=<ID=([^,>]*)[,>]"""'], {}), "('^##contig=<ID=([^,>]*)[,>]')\n", (1601, 1631), False, 'import re\n'),... |
#!/usr/bin/env python
# encoding: utf-8
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
# An engine has a Dialect / Pool object which establish a DBAPI connection
# This could easily be switched to PostgreSQL; SQLite ... | [
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.create_engine",
"sqlalchemy.ext.declarative.declarative_base"
] | [((413, 481), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///test.db"""'], {'echo': '(False)', 'convert_unicode': '(True)'}), "('sqlite:///test.db', echo=False, convert_unicode=True)\n", (426, 481), False, 'from sqlalchemy import create_engine\n'), ((760, 778), 'sqlalchemy.ext.declarative.declarative_base... |
"""Main module for randnames
Simple usage:
>>> import randomname
>>> randomname.full_name()
'<NAME>'
"""
import random
import json
import os
import warnings
from bisect import bisect_left
from .errors import *
_THIS_FOLDER = os.path.dirname(os.path.abspath(__file__))
_COUNTRIES_BASE = os.listdir(os.path.join(_THIS_F... | [
"random.choice",
"os.path.join",
"json.load",
"random.choices",
"os.path.abspath",
"warnings.warn",
"random.randint",
"bisect.bisect_left"
] | [((356, 390), 'os.path.join', 'os.path.join', (['_THIS_FOLDER', '"""data"""'], {}), "(_THIS_FOLDER, 'data')\n", (368, 390), False, 'import os\n'), ((244, 269), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (259, 269), False, 'import os\n'), ((300, 334), 'os.path.join', 'os.path.join', (['_TH... |
import os
import json
import numpy as np
from SoccerNet.Downloader import getListGames
from config.classes import EVENT_DICTIONARY_V2, INVERSE_EVENT_DICTIONARY_V2
def predictions2json(predictions_half_1, output_path, framerate=2):
os.makedirs(output_path, exist_ok=True)
output_file_path = output_path + "/Pred... | [
"numpy.where",
"json.dump",
"os.makedirs"
] | [((237, 276), 'os.makedirs', 'os.makedirs', (['output_path'], {'exist_ok': '(True)'}), '(output_path, exist_ok=True)\n', (248, 276), False, 'import os\n'), ((372, 405), 'numpy.where', 'np.where', (['(predictions_half_1 >= 0)'], {}), '(predictions_half_1 >= 0)\n', (380, 405), True, 'import numpy as np\n'), ((1203, 1246)... |
from pathlib import Path
import dash_core_components as dcc
import dash_html_components as html
from ...api_doc import ApiDoc
from ...helpers import (
ExampleContainer,
HighlightedSource,
load_source_with_environment,
)
from ...metadata import get_component_metadata
from .content import alert as alert_con... | [
"dash_html_components.H4",
"dash_core_components.Markdown",
"dash_html_components.H2",
"pathlib.Path"
] | [((417, 431), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (421, 431), False, 'from pathlib import Path\n'), ((776, 816), 'dash_html_components.H2', 'html.H2', (['"""Alerts"""'], {'className': '"""display-4"""'}), "('Alerts', className='display-4')\n", (783, 816), True, 'import dash_html_components as ht... |
from django import forms
from django.db.models import fields
from django.forms import widgets
from order.models import Checkout_billing, Shipping_Info, Payment_method
class billing_form(forms.ModelForm):
class Meta:
model = Checkout_billing
fields = '__all__'
def clean(self):
data = ... | [
"django.forms.RadioSelect",
"django.forms.ValidationError"
] | [((400, 466), 'django.forms.ValidationError', 'forms.ValidationError', (['"""Title must be at least 5 characters long."""'], {}), "('Title must be at least 5 characters long.')\n", (421, 466), False, 'from django import forms\n'), ((756, 810), 'django.forms.RadioSelect', 'forms.RadioSelect', ([], {'attrs': "{'class': '... |
import tensorflow as tf
import sys
if __name__ == "__main__":
if len(sys.argv) >= 2:
raw_dataset = tf.data.TFRecordDataset(sys.argv[1])
for raw_record in raw_dataset.take(1):
example = tf.train.Example()
example.ParseFromString(raw_record.numpy())
print(examp... | [
"tensorflow.data.TFRecordDataset",
"tensorflow.train.Example"
] | [((115, 151), 'tensorflow.data.TFRecordDataset', 'tf.data.TFRecordDataset', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (138, 151), True, 'import tensorflow as tf\n'), ((222, 240), 'tensorflow.train.Example', 'tf.train.Example', ([], {}), '()\n', (238, 240), True, 'import tensorflow as tf\n')] |
# Generated by Django 2.2.7 on 2020-01-08 22:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('test_app', '0010_auto_20191223_0950'),
]
operations = [
migrations.AddField(
model_name='user',
name='... | [
"django.db.models.ManyToManyField"
] | [((362, 450), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'related_name': '"""inspector_apply_list"""', 'to': '"""test_app.Activity"""'}), "(related_name='inspector_apply_list', to=\n 'test_app.Activity')\n", (384, 450), False, 'from django.db import migrations, models\n'), ((576, 653), 'djan... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import io
import warnings
from sklearn.model_selection import cross_validate
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
from sklearn.metrics import accuracy_score, precision_... | [
"sklearn.metrics.classification_report",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"sklearn.model_selection.KFold",
"matplotlib.lines.Line2D",
"numpy.mean",
"seaborn.color_palette",
"pandas.DataFrame",
"warnings.simplefilter",
"io.StringIO",
"numpy.abs",
"sklearn.model... | [((4194, 4211), 'pandas.get_dummies', 'pd.get_dummies', (['X'], {}), '(X)\n', (4208, 4211), True, 'import pandas as pd\n'), ((5547, 5632), 'pandas.DataFrame', 'pd.DataFrame', (['entries'], {'columns': "['model_name', 'fold_idx', 'accuracy', use_metric]"}), "(entries, columns=['model_name', 'fold_idx', 'accuracy',\n ... |
#!/usr/bin/env python
# encoding: utf-8
'''
@project : MSRGCN
@file : draw_pictures.py
@author : Droliven
@contact : <EMAIL>
@ide : PyCharm
@time : 2021-07-27 21:22
'''
import numpy as np
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import se... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.use",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.random.randn",
"matplotlib.pyplot.... | [((217, 238), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (231, 238), False, 'import matplotlib\n'), ((670, 682), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (680, 682), True, 'import matplotlib.pyplot as plt\n'), ((692, 725), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111... |
import cmd
from copy import deepcopy
from wordle_assist.constants import AUTOMATICALLY_SHOW_MAX_SET_SIZE
from wordle_assist.wordle import process_guess, suggest_guess
INTRO ='Welcome to a wordle assistant. Type help or ? to list commands.'
PROMPT = '(wordle-assist) '
class WordleShell(cmd.Cmd):
intro = INTRO
... | [
"wordle_assist.wordle.suggest_guess",
"wordle_assist.wordle.process_guess",
"copy.deepcopy"
] | [((457, 474), 'copy.deepcopy', 'deepcopy', (['answers'], {}), '(answers)\n', (465, 474), False, 'from copy import deepcopy\n'), ((1114, 1144), 'copy.deepcopy', 'deepcopy', (['self.initial_answers'], {}), '(self.initial_answers)\n', (1122, 1144), False, 'from copy import deepcopy\n'), ((1666, 1707), 'wordle_assist.wordl... |
import os
from cupy.testing._pytest_impl import is_available, check_available
if is_available():
import pytest
_gpu_limit = int(os.getenv('CUPY_TEST_GPU_LIMIT', '-1'))
def gpu(*args, **kwargs):
return pytest.mark.gpu(*args, **kwargs)
def cudnn(*args, **kwargs):
return pytest.mark.... | [
"os.getenv",
"pytest.mark.gpu",
"cupy.testing._pytest_impl.is_available",
"cupy.testing._pytest_impl.check_available",
"pytest.mark.cudnn",
"pytest.mark.slow",
"pytest.mark.multi_gpu"
] | [((85, 99), 'cupy.testing._pytest_impl.is_available', 'is_available', ([], {}), '()\n', (97, 99), False, 'from cupy.testing._pytest_impl import is_available, check_available\n'), ((1059, 1097), 'cupy.testing._pytest_impl.check_available', 'check_available', (['"""multi_gpu attribute"""'], {}), "('multi_gpu attribute')\... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import scipy.misc
import tqdm
import cv2
import torch
from nnutils import geom_utils
from kaolin.graphics.NeuralMeshRenderer import NeuralMeshRenderer
class NeuralRenderer(torch.nn.Modul... | [
"kaolin.graphics.NeuralMeshRenderer.NeuralMeshRenderer"
] | [((522, 655), 'kaolin.graphics.NeuralMeshRenderer.NeuralMeshRenderer', 'NeuralMeshRenderer', ([], {'image_size': 'img_size', 'camera_mode': '"""look_at"""', 'perspective': '(False)', 'viewing_angle': '(30)', 'light_intensity_ambient': '(0.8)'}), "(image_size=img_size, camera_mode='look_at', perspective=\n False, vie... |
import os
import shutil
VERSION = "v1.0.1"
CURR_PATH = os.path.dirname(os.path.abspath(__file__))
src_path = os.path.join(CURR_PATH, "..", "src")
temp_path = os.path.join(CURR_PATH, "temp", "src")
if os.path.isdir(temp_path):
shutil.rmtree(temp_path)
shutil.copytree(src_path, temp_path)
os.chdir(temp_path)
cm... | [
"os.path.join",
"shutil.copytree",
"os.chdir",
"os.path.isdir",
"shutil.rmtree",
"os.path.abspath",
"os.system"
] | [((111, 147), 'os.path.join', 'os.path.join', (['CURR_PATH', '""".."""', '"""src"""'], {}), "(CURR_PATH, '..', 'src')\n", (123, 147), False, 'import os\n'), ((160, 198), 'os.path.join', 'os.path.join', (['CURR_PATH', '"""temp"""', '"""src"""'], {}), "(CURR_PATH, 'temp', 'src')\n", (172, 198), False, 'import os\n'), ((2... |
import socket
import select
import re
from Debug import errlog_add
from ConfigHandler import cfgget
from SocketServer import SocketServer
class InterCon:
CONN_MAP = {}
def __init__(self):
self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.conn.settimeout(4)
@staticmethod
... | [
"select.select",
"socket.socket",
"ConfigHandler.cfgget",
"re.match",
"socket.getaddrinfo",
"SocketServer.SocketServer"
] | [((3628, 3645), 'ConfigHandler.cfgget', 'cfgget', (['"""socport"""'], {}), "('socport')\n", (3634, 3645), False, 'from ConfigHandler import cfgget\n'), ((219, 268), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (232, 268), False, 'import sock... |
import math
import numpy as np
import torch
from torch import nn
import copy
import random
import concurrent.futures
## Distributions
def generate_gaussian_parity(n, cov_scale=1, angle_params=None, k=1, acorn=None):
""" Generate Gaussian XOR, a mixture of four Gaussians elonging to two classes.
Class 0 cons... | [
"numpy.copy",
"torch.nn.ReLU",
"numpy.ones",
"torch.nn.ModuleList",
"torch.nn.Sequential",
"numpy.sin",
"torch.nn.BatchNorm1d",
"numpy.matmul",
"numpy.cos",
"numpy.concatenate",
"torch.nn.Linear",
"torch.nn.BCEWithLogitsLoss",
"numpy.zeros_like",
"torch.FloatTensor",
"numpy.random.permut... | [((1050, 1069), 'numpy.zeros_like', 'np.zeros_like', (['blob'], {}), '(blob)\n', (1063, 1069), True, 'import numpy as np\n'), ((4746, 4774), 'torch.nn.BCEWithLogitsLoss', 'torch.nn.BCEWithLogitsLoss', ([], {}), '()\n', (4772, 4774), False, 'import torch\n'), ((7182, 7209), 'numpy.random.permutation', 'np.random.permuta... |
""" Cisco_IOS_XR_sysadmin_entity_mib
This module contains a collection of YANG
definitions for Cisco IOS\-XR SysAdmin configuration.
Copyright(c) 2015\-2017 by Cisco Systems, Inc.
All rights reserved.
"""
from collections import OrderedDict
from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YL... | [
"ydk.types.YList",
"collections.OrderedDict",
"ydk.types.YLeaf",
"ydk.types.Enum.YLeaf"
] | [((909, 931), 'ydk.types.Enum.YLeaf', 'Enum.YLeaf', (['(1)', '"""other"""'], {}), "(1, 'other')\n", (919, 931), False, 'from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64\n'), ((947, 971), 'ydk.types.Enum.YLeaf', 'Enum.YLeaf', (['(2)', '"""unkn... |
from zope.interface import implements
from axiom.item import Item
from axiom.attributes import bytes
from nevow.url import URL
from xmantissa.ixmantissa import ISiteRootPlugin
class RedirectPlugin(Item):
redirectFrom = bytes(default='admin.php')
redirectTo = bytes(default='private')
powerupInterfaces = ... | [
"zope.interface.implements",
"axiom.attributes.bytes",
"nevow.url.URL.fromRequest"
] | [((227, 253), 'axiom.attributes.bytes', 'bytes', ([], {'default': '"""admin.php"""'}), "(default='admin.php')\n", (232, 253), False, 'from axiom.attributes import bytes\n'), ((271, 295), 'axiom.attributes.bytes', 'bytes', ([], {'default': '"""private"""'}), "(default='private')\n", (276, 295), False, 'from axiom.attrib... |
#!/usr/bin/python3
from zoo.serving.server import ClusterServing
serving = ClusterServing()
print("Cluster Serving has been properly set up.") | [
"zoo.serving.server.ClusterServing"
] | [((76, 92), 'zoo.serving.server.ClusterServing', 'ClusterServing', ([], {}), '()\n', (90, 92), False, 'from zoo.serving.server import ClusterServing\n')] |
"""
Modified from DETR https://github.com/facebookresearch/detr
"""
import torch
from torch import nn
from misc import nested_tensor_from_tensor_list, get_world_size, interpolate, is_dist_avail_and_initialized
from .segmentation import dice_loss, sigmoid_focal_loss
from utils import flatten_temporal_batch_dims
class ... | [
"torch.as_tensor",
"torch.full",
"misc.is_dist_avail_and_initialized",
"misc.interpolate",
"torch.stack",
"torch.distributed.all_reduce",
"torch.full_like",
"misc.nested_tensor_from_tensor_list",
"torch.tensor",
"misc.get_world_size",
"torch.arange",
"utils.flatten_temporal_batch_dims",
"tor... | [((2815, 2860), 'utils.flatten_temporal_batch_dims', 'flatten_temporal_batch_dims', (['outputs', 'targets'], {}), '(outputs, targets)\n', (2842, 2860), False, 'from utils import flatten_temporal_batch_dims\n'), ((3163, 3239), 'torch.as_tensor', 'torch.as_tensor', (['[num_masks]'], {'dtype': 'torch.float', 'device': 'in... |
from torch.utils.data import DataLoader
import torch
import torch.nn as nn
class Sequentiak(nn.Module):
def __init__(self, layers):
super().__init__()
self.layers = nn.ModuleList(layers)
def __call__(self, x):
for l in self.layers:
x = l(x)
return x
class Optimiz... | [
"torch.randperm",
"torch.nn.ModuleList",
"torch.utils.data.DataLoader",
"torch.no_grad",
"torch.arange"
] | [((187, 208), 'torch.nn.ModuleList', 'nn.ModuleList', (['layers'], {}), '(layers)\n', (200, 208), True, 'import torch.nn as nn\n'), ((1856, 1904), 'torch.utils.data.DataLoader', 'DataLoader', (['train_ds', 'bs'], {'shuffle': '(True)'}), '(train_ds, bs, shuffle=True, **kwargs)\n', (1866, 1904), False, 'from torch.utils.... |
import numpy as np
import pandas as pd
import sys
import csv
def check_overlap(interval, array):
height = array.shape[0]
intervals = np.stack([np.tile(interval,(height,1)), array],axis=0)
swaghook = (intervals[0,:,0] < intervals[1,:,0]).astype(int)
return intervals[1-swaghook,np.arange(height),1] > i... | [
"numpy.tile",
"pandas.read_table",
"numpy.arange"
] | [((367, 406), 'pandas.read_table', 'pd.read_table', (['sys.argv[1]'], {'header': 'None'}), '(sys.argv[1], header=None)\n', (380, 406), True, 'import pandas as pd\n'), ((154, 184), 'numpy.tile', 'np.tile', (['interval', '(height, 1)'], {}), '(interval, (height, 1))\n', (161, 184), True, 'import numpy as np\n'), ((296, 3... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Examples for the NURBS-Python Package
Released under MIT License
Developed by <NAME> (c) 2016-2017
This example is contributed by <NAME> (@jedufour)
"""
import os
from geomdl import NURBS
from geomdl import construct
from geomdl import exchange
from g... | [
"geomdl.NURBS.Surface",
"geomdl.visualization.VisMPL.VisSurface",
"geomdl.exchange.import_txt",
"os.path.realpath",
"geomdl.construct.extract_curves"
] | [((475, 490), 'geomdl.NURBS.Surface', 'NURBS.Surface', ([], {}), '()\n', (488, 490), False, 'from geomdl import NURBS\n'), ((828, 858), 'geomdl.construct.extract_curves', 'construct.extract_curves', (['surf'], {}), '(surf)\n', (852, 858), False, 'from geomdl import construct\n'), ((1180, 1196), 'geomdl.visualization.Vi... |
from graph import get_goodreads_graph, get_sc_graph
import json
import numpy as np
import math
import os
# don't let matplotlib use xwindows
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.pylab import savefig
import seaborn as sns
sns.set_style("ticks")
import pandas as pd
out... | [
"os.path.exists",
"os.makedirs",
"seaborn.despine",
"matplotlib.use",
"matplotlib.pyplot.legend",
"graph.get_goodreads_graph",
"numpy.log",
"seaborn.set_style",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"json.load",
"seaborn.scatterplot",
"pandas.DataFrame",
"matplotlib.lines.... | [((160, 181), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (174, 181), False, 'import matplotlib\n'), ((273, 295), 'seaborn.set_style', 'sns.set_style', (['"""ticks"""'], {}), "('ticks')\n", (286, 295), True, 'import seaborn as sns\n'), ((360, 397), 'os.path.exists', 'os.path.exists', (['output... |
from nnet.models.srl import *
from nnet.run.runner import *
from nnet.ml.voc import *
from nnet.run.srl.run import *
from nnet.run.srl.util import *
from nnet.run.srl.decoder import *
from functools import partial
from nnet.run.srl.read_dependency import get_adj
import nnet.run.srl.conll09_evaluation.eval
def make_l... | [
"nnet.run.srl.read_dependency.get_adj",
"functools.partial"
] | [((6905, 6924), 'functools.partial', 'partial', (['bio_reader'], {}), '(bio_reader)\n', (6912, 6924), False, 'from functools import partial\n'), ((7924, 7952), 'nnet.run.srl.read_dependency.get_adj', 'get_adj', (['dep_parsing', 'degree'], {}), '(dep_parsing, degree)\n', (7931, 7952), False, 'from nnet.run.srl.read_depe... |
import sys, os, subprocess
here = os.path.dirname(os.path.abspath(__file__))
home = os.path.expanduser("~")
#subprocess.run(args, *, stdin=None, input=None, stdout=None, stderr=None,
# capture_output=False, shell=False, cwd=None, timeout=None,
# check=False, encoding=None, errors=None, tex... | [
"os.path.abspath",
"os.path.join",
"subprocess.call",
"os.path.expanduser"
] | [((85, 108), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (103, 108), False, 'import sys, os, subprocess\n'), ((51, 76), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (66, 76), False, 'import sys, os, subprocess\n'), ((1662, 1712), 'subprocess.call', 'subprocess.... |
"""Path definitions"""
from pathlib import Path
# Path to this repository
PROJECT_DIR = Path(__file__).parents[1]
# Path to local directory where data files will be stored
LOCAL_DIR = Path.home()
LOCAL_DATA_DIR = LOCAL_DIR / "Documents" / "Data" / "Common_microbes"
# Location of raw microbiome data
RAW_MICROBIOME_DA... | [
"pathlib.Path.home",
"pathlib.Path"
] | [((186, 197), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (195, 197), False, 'from pathlib import Path\n'), ((89, 103), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (93, 103), False, 'from pathlib import Path\n')] |
# -*- coding: utf-8 -*-
"""
This module contains a method for flagging consecutive data values where the
recorded value repeats multiple times.
================================================================================
@Author:
| <NAME>, NSSC Contractor (ORAU)
| U.S. EPA / ORD / CEMM / AMCD / SFSB
Created:... | [
"pandas.DataFrame",
"numpy.arange"
] | [((2216, 2230), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2228, 2230), True, 'import pandas as pd\n'), ((2244, 2285), 'numpy.arange', 'np.arange', (['(1)', '(tolerance + 1)', '(1)'], {'dtype': 'int'}), '(1, tolerance + 1, 1, dtype=int)\n', (2253, 2285), True, 'import numpy as np\n')] |
from DatabaseConnection import DatabaseConnection
import sys
host = '172.16.58.3'
username = 'laksita'
password = '<PASSWORD>'
database = 'db_simak'
rowLimit = '200'
db = DatabaseConnection(host, username,
password, database)
tahun = 2019
semester = 1
tahunajaran = f"{tahun}{semester}"
kelasS... | [
"DatabaseConnection.DatabaseConnection",
"sys.exit"
] | [((173, 227), 'DatabaseConnection.DatabaseConnection', 'DatabaseConnection', (['host', 'username', 'password', 'database'], {}), '(host, username, password, database)\n', (191, 227), False, 'from DatabaseConnection import DatabaseConnection\n'), ((942, 952), 'sys.exit', 'sys.exit', ([], {}), '()\n', (950, 952), False, ... |
from datahub.company.models import Company
from datahub.dataset.company_future_interest_countries.pagination import (
CompanyFutureInterestCountriesDatasetViewCursorPagination,
)
from datahub.dataset.core.views import BaseDatasetView
class CompanyFutureInterestCountriesDatasetView(BaseDatasetView):
"""
A ... | [
"datahub.company.models.Company.future_interest_countries.through.objects.values"
] | [((801, 926), 'datahub.company.models.Company.future_interest_countries.through.objects.values', 'Company.future_interest_countries.through.objects.values', (['"""id"""', '"""company_id"""', '"""country__name"""', '"""country__iso_alpha2_code"""'], {}), "('id', 'company_id',\n 'country__name', 'country__iso_alpha2_c... |
__author__ = 'BrianAguirre'
import twitter #EXAMPLE 1
import json #EXAMPLE 3
"""
/------------------------------------------------------------------/
Example 1. Authorizing an application to access Twitter account data
/------------------------------------------------------------------/
"""
# XXX: Go to http://de... | [
"twitter.oauth.OAuth",
"json.dumps",
"twitter.Twitter"
] | [((736, 823), 'twitter.oauth.OAuth', 'twitter.oauth.OAuth', (['OAUTH_TOKEN', 'OAUTH_TOKEN_SECRET', 'CONSUMER_KEY', 'CONSUMER_SECRET'], {}), '(OAUTH_TOKEN, OAUTH_TOKEN_SECRET, CONSUMER_KEY,\n CONSUMER_SECRET)\n', (755, 823), False, 'import twitter\n'), ((862, 888), 'twitter.Twitter', 'twitter.Twitter', ([], {'auth': ... |
message = """
List datatypes store data in order and sequence.
Just as Lists, There is a smaller and faster alternative: Tuples
There are two ways to make a Tuple.
tup1 = (1,) # Adding a trailing comma is necessesary if the tuple contains a single element.
... | [
"timeit.timeit",
"sys.getsizeof"
] | [((3147, 3196), 'timeit.timeit', 'timeit.timeit', ([], {'stmt': '"""[1,2,3,4,5]"""', 'number': '(1000000)'}), "(stmt='[1,2,3,4,5]', number=1000000)\n", (3160, 3196), False, 'import timeit\n'), ((3214, 3263), 'timeit.timeit', 'timeit.timeit', ([], {'stmt': '"""(1,2,3,4,5)"""', 'number': '(1000000)'}), "(stmt='(1,2,3,4,5... |
import torch
from torch import Tensor
from torch.nn import Module
from torch.nn.utils.rnn import PackedSequence, pad_packed_sequence
class Seq2Vec(Module):
"""A sequence-to-vector RNN."""
def __init__(self, rnn, attn=None):
"""
Initialize a Seq2Vec module.
:param rnn: The RNN module ... | [
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.arange"
] | [((1675, 1704), 'torch.nn.utils.rnn.pad_packed_sequence', 'pad_packed_sequence', (['encoding'], {}), '(encoding)\n', (1694, 1704), False, 'from torch.nn.utils.rnn import PackedSequence, pad_packed_sequence\n'), ((1893, 1924), 'torch.arange', 'torch.arange', (['encoding.shape[1]'], {}), '(encoding.shape[1])\n', (1905, 1... |
import time
from datetime import date, datetime, timedelta
import base64
import requests
import urllib.parse
import hashlib
import hmac
import sys
import os
import csv
from dotenv import load_dotenv
load_dotenv()
api_key = os.environ.get("API_KEY")
api_secret = os.environ.get("API_SECRET")
token_pair = os.environ.get... | [
"hmac.new",
"hashlib.sha256",
"requests.post",
"base64.b64encode",
"csv.writer",
"os.environ.get",
"base64.b64decode",
"time.sleep",
"dotenv.load_dotenv",
"time.time_ns",
"datetime.timedelta",
"datetime.datetime.fromisoformat",
"datetime.datetime.today",
"datetime.date.today",
"csv.reade... | [((200, 213), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (211, 213), False, 'from dotenv import load_dotenv\n'), ((225, 250), 'os.environ.get', 'os.environ.get', (['"""API_KEY"""'], {}), "('API_KEY')\n", (239, 250), False, 'import os\n'), ((264, 292), 'os.environ.get', 'os.environ.get', (['"""API_SECRET"""'... |
import base64
import os
import secrets
import tarfile
from collections.abc import MutableMapping
from contextlib import suppress
from glob import glob
from typing import Callable
# import cryptography
from cryptography.fernet import Fernet
from cryptography.hazmat.backends import default_backend
from cryptography.hazm... | [
"os.listdir",
"tarfile.open",
"os.getenv",
"secrets.token_urlsafe",
"os.path.join",
"cryptography.hazmat.primitives.hashes.SHA256",
"cryptography.fernet.Fernet",
"cryptography.hazmat.backends.default_backend",
"contextlib.suppress",
"os.mkdir",
"glob.glob",
"os.remove"
] | [((3137, 3148), 'cryptography.fernet.Fernet', 'Fernet', (['key'], {}), '(key)\n', (3143, 3148), False, 'from cryptography.fernet import Fernet\n'), ((3390, 3421), 'os.path.join', 'os.path.join', (['self.dirname', 'key'], {}), '(self.dirname, key)\n', (3402, 3421), False, 'import os\n'), ((3448, 3472), 'glob.glob', 'glo... |
# 347. Top K Frequent Elements
from collections import Counter
import heapq
from typing import List
def topKFrequent(nums: List[int], k: int) -> List[int]:
count = Counter(nums)
return heapq.nlargest(k, count.keys(), key=count.get)
topKFrequent([1,1,1,2,2,3,3,4,4,4,4,4], 2)
topKFrequent([1,1,1,2,2,3,3,4,4,4,... | [
"collections.Counter"
] | [((170, 183), 'collections.Counter', 'Counter', (['nums'], {}), '(nums)\n', (177, 183), False, 'from collections import Counter\n')] |
import math
from os import path
import logging
from tqdm import tqdm
import numpy as np
import torch
import torch.nn as nn
from torch.functional import F
from transformers import BertTokenizer
from h02_bert_embeddings.bert import BertProcessor
from utils import constants
from utils import utils
class BertEmbeddingsG... | [
"tqdm.tqdm.write",
"tqdm.tqdm",
"os.path.join",
"h02_bert_embeddings.bert.BertProcessor",
"utils.utils.get_n_lines",
"utils.utils.write_pickle",
"torch.no_grad",
"numpy.matrix",
"logging.info",
"utils.utils.get_filenames"
] | [((743, 791), 'logging.info', 'logging.info', (['"""Loading pre-trained BERT network"""'], {}), "('Loading pre-trained BERT network')\n", (755, 791), False, 'import logging\n'), ((807, 854), 'h02_bert_embeddings.bert.BertProcessor', 'BertProcessor', (['bert_option'], {'tgt_words': 'tgt_words'}), '(bert_option, tgt_word... |
'''
@author:<NAME>
@name:Open-Pifu
'''
import sys
sys.path.append("./")
from opt import opt
from mmcv import Config
import os
from torch.utils.data import DataLoader
import torch.nn as nn
from engineer.datasets.loader.build_loader import train_loader_collate_fn,test_loader_collate_fn
from engineer.datasets.... | [
"utils.logger.info_cfg",
"os.path.exists",
"engineer.datasets.builder.build_dataset",
"engineer.models.builder.build_model",
"utils.dataloader.build_dataloader",
"utils.distributed.build_dpp_net",
"engineer.core.train.train_epochs",
"utils.logger.setup_logger",
"utils.distributed.load_checkpoints",
... | [((55, 76), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (70, 76), False, 'import sys\n'), ((907, 935), 'mmcv.Config.fromfile', 'Config.fromfile', (['args.config'], {}), '(args.config)\n', (922, 935), False, 'from mmcv import Config\n'), ((1181, 1202), 'utils.logger.info_cfg', 'info_cfg', (['lo... |
"""
tail.py stringa [-c] carattere | [-]numero stampa la sottostringa a partire dall'ultima occorrenza
di carattere, opzionalmente specificato con il parametro '-c', ovvero stampa la sottostringa a partire
dalla posizione specificata da numero eventualmente anche negativo
"""
import sys
def lastIndexOf(s, c):
""... | [
"sys.exit"
] | [((876, 886), 'sys.exit', 'sys.exit', ([], {}), '()\n', (884, 886), False, 'import sys\n'), ((1146, 1156), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1154, 1156), False, 'import sys\n'), ((1307, 1317), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1315, 1317), False, 'import sys\n'), ((1606, 1616), 'sys.exit', 'sys.exit',... |
# This is a single helper file from Excel and CSV Conversion Tools Toolbox
# ArcMap Description: This toolbox includes four tools: TableToCSV,
# TableToExcel, CSVToTable, and ExcelToTable. Both .xls and .xlsx file
# formats are supported in this toolbox. The toolbox utilizes (and includes)
# XLRD, XLWT, and OPENPY... | [
"arcpy.da.ListDomains",
"arcpy.SearchCursor",
"arcpy.ValidateFieldName",
"arcpy.Describe",
"arcpy.da.SearchCursor",
"os.path.dirname",
"arcpy.ListFields",
"os.path.basename",
"arcpy.GetInstallInfo"
] | [((3228, 3256), 'arcpy.Describe', 'arcpy.Describe', (['dataset_name'], {}), '(dataset_name)\n', (3242, 3256), False, 'import arcpy\n'), ((5387, 5413), 'os.path.dirname', 'os.path.dirname', (['out_table'], {}), '(out_table)\n', (5402, 5413), False, 'import os\n'), ((5430, 5457), 'os.path.basename', 'os.path.basename', (... |
# 1. Only add your code inside the function (including newly improted packages).
# You can design a new function and call the new function in the given functions.
# 2. For bonus: Give your own picturs. If you have N pictures, name your pictures such as ["t3_1.png", "t3_2.png", ..., "t3_N.png"], and put them inside t... | [
"cv2.imwrite",
"cv2.imread",
"numpy.sqrt",
"cv2.findHomography",
"cv2.imshow",
"numpy.argsort",
"numpy.array",
"cv2.SIFT_create",
"cv2.equalizeHist",
"numpy.sum",
"numpy.concatenate",
"cv2.cvtColor",
"cv2.perspectiveTransform",
"cv2.waitKey",
"numpy.float32",
"matplotlib.pyplot.show"
] | [((947, 990), 'cv2.perspectiveTransform', 'cv2.perspectiveTransform', (['img2_dims_temp', 'M'], {}), '(img2_dims_temp, M)\n', (971, 990), False, 'import cv2\n'), ((1037, 1083), 'numpy.concatenate', 'np.concatenate', (['(img1_dims, img2_dims)'], {'axis': '(0)'}), '((img1_dims, img2_dims), axis=0)\n', (1051, 1083), True,... |
# Copyright 2018 Google Inc
#
# 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, ... | [
"core.models.Param.create",
"core.models.Param.find",
"mock.patch",
"core.models.StartCondition.create",
"core.models.Job.find",
"core.models.Schedule.find",
"core.models.StartCondition.find",
"core.models.Pipeline.find",
"google.appengine.ext.testbed.Testbed",
"core.models.Job.create",
"core.mo... | [((3041, 3074), 'mock.patch', 'mock.patch', (['"""core.logging.logger"""'], {}), "('core.logging.logger')\n", (3051, 3074), False, 'import mock\n'), ((815, 832), 'google.appengine.ext.testbed.Testbed', 'testbed.Testbed', ([], {}), '()\n', (830, 832), False, 'from google.appengine.ext import testbed\n'), ((1186, 1210), ... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | [
"itertools.chain",
"oslo_config.cfg.OptGroup",
"oslo_config.cfg.StrOpt"
] | [((700, 789), 'oslo_config.cfg.OptGroup', 'cfg.OptGroup', ([], {'name': '"""certificates"""', 'title': '"""Certificate options for the cert manager."""'}), "(name='certificates', title=\n 'Certificate options for the cert manager.')\n", (712, 789), False, 'from oslo_config import cfg\n'), ((1121, 1289), 'oslo_config... |
"""
Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license
(https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
"""
import os
import numpy as np
from PIL import Image
import torch
import torch.backends.cudnn as cudnn
from torchvision import transfor... | [
"numpy.uint8",
"os.listdir",
"nntools.maybe_cuda.mbcuda",
"PIL.Image.open",
"argparse.ArgumentParser",
"os.path.join",
"torchvision.transforms.Normalize",
"torchvision.transforms.Resize",
"torch.no_grad",
"torchvision.transforms.ToTensor",
"numpy.transpose",
"torchvision.transforms.Compose"
] | [((460, 485), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (483, 485), False, 'import argparse\n'), ((1278, 1293), 'nntools.maybe_cuda.mbcuda', 'mbcuda', (['trainer'], {}), '(trainer)\n', (1284, 1293), False, 'from nntools.maybe_cuda import mbcuda\n'), ((1539, 1573), 'torchvision.transforms.C... |
# ----------------------------------------------------------------------
# |
# | __init__.py
# |
# | <NAME> <<EMAIL>>
# | 2018-05-19 14:06:53
# |
# ----------------------------------------------------------------------
# |
# | Copyright <NAME> 2018.
# | Distributed under the Boost Software Li... | [
"os.path.abspath",
"sys.executable.lower",
"os.path.split"
] | [((861, 892), 'os.path.split', 'os.path.split', (['_script_fullpath'], {}), '(_script_fullpath)\n', (874, 892), False, 'import os\n'), ((748, 773), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (763, 773), False, 'import os\n'), ((789, 811), 'sys.executable.lower', 'sys.executable.lower', ([... |
# Copyright (c) 2013 <NAME> <<EMAIL>>
#
# This file is part of OctoHub.
#
# OctoHub is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
im... | [
"simplejson.dumps"
] | [((606, 638), 'simplejson.dumps', 'json.dumps', (['self.error'], {'indent': '(1)'}), '(self.error, indent=1)\n', (616, 638), True, 'import simplejson as json\n')] |
import re
segmented_file = open(r"C:/Edata/UIUC_Academics/Spring2020/CS512/Assignment-1/AutoPhrase/models/cate/segmentation.txt", "r")
post_tag_removal_file = open(r"C:/Edata/UIUC_Academics/Spring2020/CS512/Assignment-1/AutoPhrase/models/cate/segmentationPP.txt","w")
segmented_phrases_found = open(r"C:/Edata/UIUC_Acad... | [
"re.sub"
] | [((781, 848), 're.sub', 're.sub', (['"""<phrase>.*?</phrase>"""', 'remove_tags_join_to_word_func', 'line'], {}), "('<phrase>.*?</phrase>', remove_tags_join_to_word_func, line)\n", (787, 848), False, 'import re\n')] |
# -*- coding: utf-8 -*-
from flask import g, current_app
from mongoengine import IntField, StringField, ObjectIdField
from werkzeug.security import generate_password_hash, check_password_hash
from app.libs.error_code import AuthFailed
from app.libs.scope import Scope
from app.libs.enums import ScopeEnum
from app.model... | [
"mongoengine.ObjectIdField",
"app.libs.error_code.AuthFailed",
"mongoengine.IntField",
"app.models.cdkey.CDKey.verify_hashkey",
"app.models.group.Group.objects.filter",
"app.service.wx_token.WxToken",
"werkzeug.security.generate_password_hash",
"app.models.cdkey.CDKey.objects.filter",
"mongoengine.S... | [((523, 536), 'mongoengine.StringField', 'StringField', ([], {}), '()\n', (534, 536), False, 'from mongoengine import IntField, StringField, ObjectIdField\n'), ((559, 572), 'mongoengine.StringField', 'StringField', ([], {}), '()\n', (570, 572), False, 'from mongoengine import IntField, StringField, ObjectIdField\n'), (... |
# -*- coding: utf-8 -*-
###############################################################################
#
# PublishLink
# Publishes a link on a given profile.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fil... | [
"json.loads"
] | [((4677, 4692), 'json.loads', 'json.loads', (['str'], {}), '(str)\n', (4687, 4692), False, 'import json\n')] |
import numpy as np
from sortingComplexity import run
def test_basic_test():
#asserts that the outputs of both algorithms in "basic test" are equivalent
assert run.basic_test()
def test_complexity_experiment_and_vis():
c,i = run.complexity_experiment()
#format of output is correct (two dictio... | [
"sortingComplexity.run.complexity_experiment",
"sortingComplexity.run.basic_test"
] | [((168, 184), 'sortingComplexity.run.basic_test', 'run.basic_test', ([], {}), '()\n', (182, 184), False, 'from sortingComplexity import run\n'), ((243, 270), 'sortingComplexity.run.complexity_experiment', 'run.complexity_experiment', ([], {}), '()\n', (268, 270), False, 'from sortingComplexity import run\n')] |
# vim:set ts=4 sw=4 et:
'''
CheckAllowTests
---------------
'''
import unittest
from docker_leash.checks.allow import Allow
from docker_leash.config import Config
class CheckAllowTests(unittest.TestCase):
"""Validation of :cls:`docker_leash.checks.Allow`
"""
@classmethod
def test_init(cls):
... | [
"docker_leash.config.Config",
"docker_leash.checks.allow.Allow"
] | [((382, 389), 'docker_leash.checks.allow.Allow', 'Allow', ([], {}), '()\n', (387, 389), False, 'from docker_leash.checks.allow import Allow\n'), ((408, 416), 'docker_leash.config.Config', 'Config', ([], {}), '()\n', (414, 416), False, 'from docker_leash.config import Config\n')] |
import sys
try:
from django.db import models
except Exception:
print('Exception: Django Not Found, please install it with "pip install django".')
sys.exit()
# Sample User model
class Test(models.Model):
question = models.TextField()
a = models.CharField(max_length=255)
b = models.CharField(ma... | [
"django.db.models.DateTimeField",
"sys.exit",
"django.db.models.TextField",
"django.db.models.CharField"
] | [((233, 251), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (249, 251), False, 'from django.db import models\n'), ((260, 292), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (276, 292), False, 'from django.db import models\n'), ((301, 333), '... |
import requests
import os
import json
import re
class ReadmeApi(object):
def __init__(self):
super().__init__()
self.doc_version = None
def authenticate(self, api_key):
r = requests.get('https://dash.readme.com/api/v1', auth=(api_key, ''))
if r.status_code != 200:
r... | [
"os.listdir",
"os.getenv",
"os.path.join",
"requests.get",
"requests.request",
"os.path.isfile",
"os.path.realpath",
"json.load"
] | [((10145, 10172), 'os.getenv', 'os.getenv', (['"""README_API_KEY"""'], {}), "('README_API_KEY')\n", (10154, 10172), False, 'import os\n'), ((10651, 10678), 'os.getenv', 'os.getenv', (['"""PRUNE_CONTROLS"""'], {}), "('PRUNE_CONTROLS')\n", (10660, 10678), False, 'import os\n'), ((207, 273), 'requests.get', 'requests.get'... |
import datetime
from json_ext_encoder import timezone
def test_is_aware():
utcnow = datetime.datetime.utcnow()
assert not timezone.is_aware(utcnow)
utcnow = utcnow.replace(tzinfo=datetime.timezone.utc)
assert timezone.is_aware(utcnow)
| [
"json_ext_encoder.timezone.is_aware",
"datetime.datetime.utcnow"
] | [((91, 117), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (115, 117), False, 'import datetime\n'), ((229, 254), 'json_ext_encoder.timezone.is_aware', 'timezone.is_aware', (['utcnow'], {}), '(utcnow)\n', (246, 254), False, 'from json_ext_encoder import timezone\n'), ((133, 158), 'json_ext_en... |
from jrpc.server import Application
app = Application()
@app.method
async def ping() -> str:
"""ping method"""
return "pong"
@app.method
async def plus(n: int, m: int) -> int:
"""Addition"""
return n + m
app.run(host="0.0.0.0", endpoint="/", port=8080, debug=True)
| [
"jrpc.server.Application"
] | [((43, 56), 'jrpc.server.Application', 'Application', ([], {}), '()\n', (54, 56), False, 'from jrpc.server import Application\n')] |
import os
from abc import ABC, abstractmethod
import leancloud
from leancloud import LeanCloudError
class Store(ABC):
"""
后端类需要基于此类进行扩展
"""
@abstractmethod
def get_suburl(self, expires=False):
"""
:param expires: 获取订阅链接的expires
:type expires: bool
:return: 返回查找到的符合... | [
"leancloud.use_master_key",
"leancloud.Object.extend",
"leancloud.init"
] | [((1344, 1406), 'leancloud.init', 'leancloud.init', (['APP_ID'], {'app_key': 'APP_KEY', 'master_key': 'MASTER_KEY'}), '(APP_ID, app_key=APP_KEY, master_key=MASTER_KEY)\n', (1358, 1406), False, 'import leancloud\n'), ((1415, 1445), 'leancloud.use_master_key', 'leancloud.use_master_key', (['(True)'], {}), '(True)\n', (14... |
from machine import Pin
import time
led = Pin(25, Pin.OUT)
while True:
led.toggle()
time.sleep_ms(200)
| [
"time.sleep_ms",
"machine.Pin"
] | [((46, 62), 'machine.Pin', 'Pin', (['(25)', 'Pin.OUT'], {}), '(25, Pin.OUT)\n', (49, 62), False, 'from machine import Pin\n'), ((101, 119), 'time.sleep_ms', 'time.sleep_ms', (['(200)'], {}), '(200)\n', (114, 119), False, 'import time\n')] |
import copy
from mmcv.utils import assert_dict_has_keys
from mmaction.datasets import CharadesDataset
from .base import BaseTestDataset
class TestCharadesDaataset(BaseTestDataset):
def test_charades_dataset(self):
_charades_test_pipeline = copy.deepcopy(self.charades_test_pipeline)
_charades_te... | [
"mmcv.utils.assert_dict_has_keys",
"mmaction.datasets.CharadesDataset",
"copy.deepcopy"
] | [((257, 299), 'copy.deepcopy', 'copy.deepcopy', (['self.charades_test_pipeline'], {}), '(self.charades_test_pipeline)\n', (270, 299), False, 'import copy\n'), ((383, 533), 'mmaction.datasets.CharadesDataset', 'CharadesDataset', (['self.charades_ann_file', '_charades_test_pipeline', 'self.data_prefix'], {'filename_tmpl_... |
import random
import numpy
import simpy
from file_manager import SharedFile
def new_inter_session_time():
"""
Ritorna un valore per l'istanza di "inter-session time"
"""
return numpy.random.lognormal(mean=7.971, sigma=1.308)
def new_session_duration():
"""
Ritorna un valore per l'istanza di ... | [
"random.choice",
"simpy.events.AllOf",
"file_manager.SharedFile.from_cloud",
"random.random",
"simpy.Container",
"numpy.random.lognormal"
] | [((195, 242), 'numpy.random.lognormal', 'numpy.random.lognormal', ([], {'mean': '(7.971)', 'sigma': '(1.308)'}), '(mean=7.971, sigma=1.308)\n', (217, 242), False, 'import numpy\n'), ((354, 401), 'numpy.random.lognormal', 'numpy.random.lognormal', ([], {'mean': '(8.492)', 'sigma': '(1.545)'}), '(mean=8.492, sigma=1.545)... |
import discord
import os
from discord.ext import commands, tasks
from itertools import cycle
import re
client = commands.Bot(command_prefix = '.', help_command=None)
status = cycle(['NACL', 'Developing with NACL Group'])
@client.event
async def on_ready():
change_status.start()
@tasks.loop(seconds=10)
async de... | [
"discord.ext.commands.Bot",
"itertools.cycle",
"os.listdir",
"discord.ext.tasks.loop"
] | [((114, 165), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': '"""."""', 'help_command': 'None'}), "(command_prefix='.', help_command=None)\n", (126, 165), False, 'from discord.ext import commands, tasks\n'), ((178, 223), 'itertools.cycle', 'cycle', (["['NACL', 'Developing with NACL Group']"], {}), ... |
#!/usr/bin/python3.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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 app... | [
"getopt.getopt",
"pycopia.remote.pyro.locate_nameserver"
] | [((1569, 1593), 'pycopia.remote.pyro.locate_nameserver', 'pyro.locate_nameserver', ([], {}), '()\n', (1591, 1593), False, 'from pycopia.remote import pyro\n'), ((1230, 1259), 'getopt.getopt', 'getopt.getopt', (['argv[1:]', '"""h?"""'], {}), "(argv[1:], 'h?')\n", (1243, 1259), False, 'import getopt\n')] |
#!/usr/bin/env python #
# #
# Autor: <NAME>, GSFC/CRESST/UMBC . #
# #
# T... | [
"numpy.log10",
"numpy.sqrt",
"re.compile",
"matplotlib.pyplot.ylabel",
"scipy.special.factorial",
"numpy.log",
"numpy.array",
"re.search",
"os.path.exists",
"numpy.where",
"matplotlib.pyplot.xlabel",
"itertools.product",
"Xgam.utils.spline_.xInterpolatedUnivariateSplineLinear",
"matplotlib... | [((1202, 1226), 're.compile', 're.compile', (['"""\\\\_\\\\d+\\\\."""'], {}), "('\\\\_\\\\d+\\\\.')\n", (1212, 1226), False, 'import re\n'), ((2036, 2053), 'numpy.array', 'np.array', (['fore_en'], {}), '(fore_en)\n', (2044, 2053), True, 'import numpy as np\n'), ((2198, 2222), 'os.path.exists', 'os.path.exists', (['out_... |
import torch
from torch import nn
from pathlib import Path
import gradio as gr
LABELS = Path('class_names.txt').read_text().splitlines()
model = nn.Sequential(
nn.Conv2d(1, 32, 3, padding='same'),
nn.ReLU(),
nn.MaxPool2d(2),
nn.Conv2d(32, 64, 3, padding='same'),
nn.ReLU(),
nn.... | [
"torch.nn.ReLU",
"gradio.Interface",
"pathlib.Path",
"torch.nn.Flatten",
"torch.load",
"torch.topk",
"torch.nn.Conv2d",
"torch.tensor",
"torch.nn.MaxPool2d",
"torch.nn.Linear",
"torch.no_grad",
"torch.nn.functional.softmax"
] | [((529, 580), 'torch.load', 'torch.load', (['"""pytorch_model.bin"""'], {'map_location': '"""cpu"""'}), "('pytorch_model.bin', map_location='cpu')\n", (539, 580), False, 'import torch\n'), ((178, 213), 'torch.nn.Conv2d', 'nn.Conv2d', (['(1)', '(32)', '(3)'], {'padding': '"""same"""'}), "(1, 32, 3, padding='same')\n", (... |
"""
Helpers for tests with random generators.
"""
import random
from functools import wraps, partial
import simpy
from serversim import Server, CoreSvcRequester
from serversim.randutil import prob_chooser, rand_int, gen_int, rand_float, \
gen_float, rand_choice, gen_choice, rand_list, gen_list
random.seed(1234... | [
"random.uniform",
"random.choice",
"serversim.randutil.rand_float",
"simpy.Environment",
"random.seed",
"serversim.randutil.rand_int"
] | [((304, 322), 'random.seed', 'random.seed', (['(12345)'], {}), '(12345)\n', (315, 322), False, 'import random\n'), ((823, 863), 'random.uniform', 'random.uniform', (['(mid - delta)', '(mid + delta)'], {}), '(mid - delta, mid + delta)\n', (837, 863), False, 'import random\n'), ((956, 980), 'random.choice', 'random.choic... |
#!/usr/bin/python
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"google.datacatalog_connectors.apache_atlas.scrape.ApacheAtlasFacade",
"unittest.mock.patch",
"google.datacatalog_connectors.commons_test.utils.MockedObject"
] | [((829, 862), 'unittest.mock.patch', 'patch', (['"""atlasclient.client.Atlas"""'], {}), "('atlasclient.client.Atlas')\n", (834, 862), False, 'from unittest.mock import patch\n'), ((928, 1037), 'google.datacatalog_connectors.apache_atlas.scrape.ApacheAtlasFacade', 'scrape.ApacheAtlasFacade', (["{'host': 'my_host', 'port... |
from datetime import datetime, timedelta
from followers_consolidation import FollowersConsolidation
from news_vs_recurrents_consolidation import NewsVsRecurrentsConsolidation
from add_interactions_consolidation import AddInteractionsConsolidation
followers_consolidation = FollowersConsolidation()
news_vs_recurrents_co... | [
"datetime.datetime",
"add_interactions_consolidation.AddInteractionsConsolidation",
"news_vs_recurrents_consolidation.NewsVsRecurrentsConsolidation",
"followers_consolidation.FollowersConsolidation",
"datetime.timedelta"
] | [((274, 298), 'followers_consolidation.FollowersConsolidation', 'FollowersConsolidation', ([], {}), '()\n', (296, 298), False, 'from followers_consolidation import FollowersConsolidation\n'), ((334, 365), 'news_vs_recurrents_consolidation.NewsVsRecurrentsConsolidation', 'NewsVsRecurrentsConsolidation', ([], {}), '()\n'... |
"""Unit-tests for the core ontology module."""
from hamcrest import (
assert_that,
contains_inanyorder,
empty,
equal_to,
instance_of,
is_,
is_not,
only_contains,
)
from nose.plugins.attrib import attr
from nose_parameterized import parameterized
from six import StringIO, string_types, te... | [
"hamcrest.contains_inanyorder",
"hamcrest.instance_of",
"ontology_alchemy.tests.fixtures.create_ontology_file_object",
"hamcrest.empty",
"nose.plugins.attrib.attr",
"hamcrest.is_",
"ontology_alchemy.ontology.Ontology.load",
"nose_parameterized.parameterized",
"ontology_alchemy.tests.fixtures.create_... | [((2829, 2865), 'nose.plugins.attrib.attr', 'attr', (['"""requires_internet_connection"""'], {}), "('requires_internet_connection')\n", (2833, 2865), False, 'from nose.plugins.attrib import attr\n'), ((2867, 2968), 'nose_parameterized.parameterized', 'parameterized', (["['http://www.w3.org/TR/skos-reference/skos.rdf',\... |
from os import environ
from pyftdi import FtdiLogger
from pyftdi.spi import SpiController
from sys import stdout
from time import sleep
class Ssd1306FtdiPort:
"""
"""
DC_PIN = 1 << 5
RESET_PIN = 1 << 6
IO_PINS = DC_PIN | RESET_PIN
def __init__(self, debug=False):
self._debug = debug
... | [
"logging.StreamHandler",
"pyftdi.FtdiLogger.set_level",
"os.environ.get",
"time.sleep",
"pyftdi.spi.SpiController"
] | [((1749, 1779), 'pyftdi.FtdiLogger.set_level', 'FtdiLogger.set_level', (['loglevel'], {}), '(loglevel)\n', (1769, 1779), False, 'from pyftdi import FtdiLogger\n'), ((340, 365), 'pyftdi.spi.SpiController', 'SpiController', ([], {'cs_count': '(2)'}), '(cs_count=2)\n', (353, 365), False, 'from pyftdi.spi import SpiControl... |