code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from flask import Flask, json, jsonify, request, send_file, flash, redirect, url_for
from flask_cors import CORS, cross_origin
import mysql.connector
import json
import shutil
import os
from werkzeug.utils import secure_filename
api = Flask(__name__)
CORS(api)
configPath = "C:\\Users\\B147258369\\Desktop\\CESI_innova... | [
"os.listdir",
"os.mkdir",
"json.load",
"os.path.join",
"flask.request.args.get",
"flask_cors.CORS",
"os.path.isdir",
"flask.Flask",
"json.dumps",
"werkzeug.utils.secure_filename",
"shutil.disk_usage",
"flask.jsonify",
"flask.send_file",
"flask.request.get_json"
] | [((236, 251), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (241, 251), False, 'from flask import Flask, json, jsonify, request, send_file, flash, redirect, url_for\n'), ((252, 261), 'flask_cors.CORS', 'CORS', (['api'], {}), '(api)\n', (256, 261), False, 'from flask_cors import CORS, cross_origin\n'), ((1... |
"""
Copyright: MAXON Computer GmbH
Author: <NAME>
Description:
- Creates a Modal Dialog displaying a different SubDialog according to the selected entry of the QuickTab.
- Demonstrates how to add, flushes, remove tab interactively.
Class/method highlighted:
- c4d.gui.QuickTabCustomGui
- QuickTabCustom... | [
"c4d.BaseContainer"
] | [((7257, 7276), 'c4d.BaseContainer', 'c4d.BaseContainer', ([], {}), '()\n', (7274, 7276), False, 'import c4d\n')] |
import numpy as np
from tqdm import tqdm
import torch
import torch.cuda
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from torch.utils.data import TensorDataset, DataLoader
import torchvision.models
use_cuda = torch.cuda.is_available()
if use_cu... | [
"numpy.load",
"tqdm.tqdm",
"numpy.sum",
"torch.nn.ReLU",
"torch.utils.data.DataLoader",
"torch.autograd.Variable",
"torch.nn.Conv2d",
"numpy.transpose",
"torch.nn.CrossEntropyLoss",
"torch.nn.BatchNorm2d",
"torch.cuda.is_available",
"torch.utils.data.TensorDataset",
"torch.nn.Softmax",
"to... | [((285, 310), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (308, 310), False, 'import torch\n'), ((434, 454), 'numpy.load', 'np.load', (['"""train.npz"""'], {}), "('train.npz')\n", (441, 454), True, 'import numpy as np\n'), ((513, 531), 'numpy.load', 'np.load', (['"""val.npz"""'], {}), "('val... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from time_now.views import TimeNowView
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'simple_django_rest_api.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^now/', TimeNowView.as_view(),... | [
"time_now.views.TimeNowView.as_view",
"django.conf.urls.include"
] | [((298, 319), 'time_now.views.TimeNowView.as_view', 'TimeNowView.as_view', ([], {}), '()\n', (317, 319), False, 'from time_now.views import TimeNowView\n'), ((364, 388), 'django.conf.urls.include', 'include', (['admin.site.urls'], {}), '(admin.site.urls)\n', (371, 388), False, 'from django.conf.urls import patterns, in... |
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
CREATE_USER_URL = reverse('user:create')
TOKEN_URL = reverse('user:token')
ME_URL = reverse('user:me')
def create_user(**params):
return get_user_model().o... | [
"django.urls.reverse",
"django.contrib.auth.get_user_model"
] | [((177, 199), 'django.urls.reverse', 'reverse', (['"""user:create"""'], {}), "('user:create')\n", (184, 199), False, 'from django.urls import reverse\n'), ((212, 233), 'django.urls.reverse', 'reverse', (['"""user:token"""'], {}), "('user:token')\n", (219, 233), False, 'from django.urls import reverse\n'), ((243, 261), ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-25 15:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0121_add_fuel_class_relationships'),
]
operations = [
migrations.Ad... | [
"django.db.models.DateField"
] | [((438, 477), 'django.db.models.DateField', 'models.DateField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (454, 477), False, 'from django.db import migrations, models\n'), ((630, 669), 'django.db.models.DateField', 'models.DateField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=... |
from subprocess import call
from typing import List
import os
class Compiler:
def __init__(self, cc_exe: str, flags: List[str]):
self.cc_exe = cc_exe
self.flags = flags
def compile(self, src: str, target: str, verbose: bool = False) -> bool:
if verbose:
print(self.cmd_str(... | [
"os.environ.get",
"subprocess.call"
] | [((2178, 2198), 'os.environ.get', 'os.environ.get', (['"""CC"""'], {}), "('CC')\n", (2192, 2198), False, 'import os\n'), ((2217, 2241), 'os.environ.get', 'os.environ.get', (['"""CFLAGS"""'], {}), "('CFLAGS')\n", (2231, 2241), False, 'import os\n'), ((2261, 2281), 'os.environ.get', 'os.environ.get', (['"""LD"""'], {}), ... |
"""
Distributed under the MIT License. See LICENSE.txt for more info.
"""
import pickle
import codecs
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect
from ..forms.cone_search.public import ConeSearchForm
from ..forms.cone_search.collaborator import ConeSearchCo... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"pickle.dumps"
] | [((1014, 1104), 'django.shortcuts.render', 'render', (['request', '"""dwfsearch/cone_search.html"""', "{'form': form, 'submit_text': 'Search'}"], {}), "(request, 'dwfsearch/cone_search.html', {'form': form, 'submit_text':\n 'Search'})\n", (1020, 1104), False, 'from django.shortcuts import render, redirect\n'), ((835... |
import tqdm
from multiprocessing import Pool
import logging
from dsrt.config.defaults import DataConfig
class Filter:
def __init__(self, properties, parallel=True, config=DataConfig()):
self.properties = properties
self.config = config
self.parallel = parallel
self.init_logger()
... | [
"multiprocessing.Pool",
"logging.getLogger",
"dsrt.config.defaults.DataConfig"
] | [((177, 189), 'dsrt.config.defaults.DataConfig', 'DataConfig', ([], {}), '()\n', (187, 189), False, 'from dsrt.config.defaults import DataConfig\n'), ((376, 395), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (393, 395), False, 'import logging\n'), ((547, 553), 'multiprocessing.Pool', 'Pool', ([], {}), '(... |
#!/usr/bin/env python
#
# USAGE: test_usdt.py
#
# Copyright 2018 Facebook, Inc
# Licensed under the Apache License, Version 2.0 (the "License")
from __future__ import print_function
from bcc import BPF
from unittest import main, skipUnless, TestCase
import distutils.version
import os, resource
class TestRlimitMemlock... | [
"unittest.main",
"bcc.BPF",
"resource.getrlimit",
"resource.setrlimit"
] | [((1079, 1085), 'unittest.main', 'main', ([], {}), '()\n', (1083, 1085), False, 'from unittest import main, skipUnless, TestCase\n'), ((515, 558), 'resource.getrlimit', 'resource.getrlimit', (['resource.RLIMIT_MEMLOCK'], {}), '(resource.RLIMIT_MEMLOCK)\n', (533, 558), False, 'import os, resource\n'), ((611, 668), 'reso... |
from math import cos, sin, pi, exp, sqrt
import numpy as np
positions = []
rotations = []
scales = []
shift_factor = np.array(shift_factor)
spiral_types = ['archimedean', 'hyperbolic', 'fermat', 'lituus', 'log']
if spiral_type not in spiral_types:
spiral_type = 'archimedean'
# iterate through each element
for i... | [
"math.exp",
"math.sqrt",
"math.sin",
"numpy.array",
"math.cos"
] | [((118, 140), 'numpy.array', 'np.array', (['shift_factor'], {}), '(shift_factor)\n', (126, 140), True, 'import numpy as np\n'), ((1039, 1060), 'numpy.array', 'np.array', (['base_radius'], {}), '(base_radius)\n', (1047, 1060), True, 'import numpy as np\n'), ((1107, 1127), 'numpy.array', 'np.array', (['base_scale'], {}),... |
"""
Expandable abstraction and mixins for AIOHTTP class based request handlers.
"""
import warnings
from abc import ABCMeta, abstractmethod
from typing import Any, Awaitable, Callable, Dict, Generator, Iterable, Optional
from aiohttp.abc import AbstractView
from aiohttp.hdrs import METH_ALL
from aiohttp.web import Req... | [
"warnings.warn",
"aiohttp_jinja2.render_template_async",
"aiohttp.web.json_response"
] | [((4308, 4345), 'aiohttp.web.json_response', 'json_response', (['self.context'], {}), '(self.context, **kwargs)\n', (4321, 4345), False, 'from aiohttp.web import Request, Response, StreamResponse, json_response\n'), ((2469, 2611), 'warnings.warn', 'warnings.warn', (['"""`page` and `page_adapter` attributes is deprecate... |
import json
def main(request, response):
key = request.GET.first('id')
# No CORS support for cross-origin reporting endpoints
if request.method == 'POST':
reports = request.server.stash.take(key) or []
for report in json.loads(request.body):
reports.append(report)
request.server.stash.put(key,... | [
"json.loads"
] | [((232, 256), 'json.loads', 'json.loads', (['request.body'], {}), '(request.body)\n', (242, 256), False, 'import json\n')] |
import argparse
import cv2
import numpy as np
import os
import sys
import torch
from utils.model_opr import load_model
from utils.common import tensor2img, calculate_psnr, calculate_ssim, bgr2ycbcr
def get_network(model_path):
if 'REDS' in model_path:
from exps.MuCAN_REDS.config import config
fr... | [
"argparse.ArgumentParser",
"torch.device",
"torch.no_grad",
"os.path.join",
"torch.nn.functional.pad",
"utils.common.tensor2img",
"cv2.imwrite",
"os.path.exists",
"numpy.transpose",
"exps.LAPAR_C_x4.config.config.MODEL.KERNEL_PATH.replace",
"numpy.stack",
"exps.LAPAR_C_x4.network.Network",
"... | [((2054, 2079), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2077, 2079), False, 'import argparse\n'), ((2629, 2649), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (2641, 2649), False, 'import torch\n'), ((2683, 2730), 'utils.model_opr.load_model', 'load_model', (['mode... |
from django import forms
from user import models as user_models
from talentalps import constants
class ForgotPasswordForm(forms.Form):
email = forms.EmailField(required=True)
class ResetPasswordForm(forms.Form):
password = forms.CharField(widget=(forms.PasswordInput()), required=True)
confirm_password = ... | [
"django.forms.EmailField",
"django.forms.BooleanField",
"django.forms.PasswordInput",
"django.forms.ValidationError",
"django.forms.MultipleChoiceField",
"django.forms.HiddenInput"
] | [((149, 180), 'django.forms.EmailField', 'forms.EmailField', ([], {'required': '(True)'}), '(required=True)\n', (165, 180), False, 'from django import forms\n'), ((2139, 2173), 'django.forms.BooleanField', 'forms.BooleanField', ([], {'required': '(False)'}), '(required=False)\n', (2157, 2173), False, 'from django impor... |
import json
class FileHandler:
def __init__(self):
pass
def readJSON(self, fileName: str) -> dict:
output = None
try:
with open(fileName, 'r') as f:
output = json.load(f)
except:
output = {}
return output
def writeJSON(self... | [
"json.load",
"json.dumps"
] | [((221, 233), 'json.load', 'json.load', (['f'], {}), '(f)\n', (230, 233), False, 'import json\n'), ((461, 487), 'json.dumps', 'json.dumps', (['info'], {'indent': '(2)'}), '(info, indent=2)\n', (471, 487), False, 'import json\n')] |
"""
example using distutils
The great thing is that python provides a nice tool called distutils.
Let it do all the hard compiling work for you.
"""
from distutils.core import setup, Extension
import numpy as np
try:
numpy_include = np.get_include()
except AttributeError:
numpy_include = np.get_numpy_include... | [
"distutils.core.Extension",
"numpy.get_numpy_include",
"numpy.get_include",
"distutils.core.setup"
] | [((333, 438), 'distutils.core.Extension', 'Extension', ([], {'name': '"""_u_numpy"""', 'sources': "['u_numpy.cpp', 'u_numpy_wrap.cxx']", 'include_dirs': '[numpy_include]'}), "(name='_u_numpy', sources=['u_numpy.cpp', 'u_numpy_wrap.cxx'],\n include_dirs=[numpy_include])\n", (342, 438), False, 'from distutils.core imp... |
from ez_setup import use_setuptools
from setuptools import setup, find_packages
use_setuptools() # nopycodestyle
with open('README.rst') as file:
long_description = file.read()
setup(
name='netbuffer',
version='0.4',
description='Network based queries and aggregations on land use data',
... | [
"setuptools.find_packages",
"ez_setup.use_setuptools"
] | [((82, 98), 'ez_setup.use_setuptools', 'use_setuptools', ([], {}), '()\n', (96, 98), False, 'from ez_setup import use_setuptools\n'), ((680, 714), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['*.tests']"}), "(exclude=['*.tests'])\n", (693, 714), False, 'from setuptools import setup, find_packages\n')... |
#
# Copyright (c) 2009-2021 fem2ufo
#
# Python stdlib imports
import math
from itertools import chain
from array import array
#from collections import OrderedDict
from collections import Counter
from collections.abc import Mapping
from dataclasses import dataclass
import functools
#import logging
from typing import ... | [
"math.dist",
"array.array",
"collections.Counter",
"functools.lru_cache",
"steelpy.trave3D.preprocessor.assemble.trans_3d_beam",
"itertools.chain.from_iterable",
"steelpy.trave3D.preprocessor.assemble.Rmatrix"
] | [((784, 817), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': '(2048)'}), '(maxsize=2048)\n', (803, 817), False, 'import functools\n'), ((7425, 7456), 'math.dist', 'math.dist', (['node1[:3]', 'node2[:3]'], {}), '(node1[:3], node2[:3])\n', (7434, 7456), False, 'import math\n'), ((9894, 9925), 'math.dist',... |
from django.db import models
from django.conf import settings
from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.authtoken.models import Token
import os
from shutil import rmtree
User = settings.AUTH_USER_MODEL
def get_image_path(instance, filename):
return os.p... | [
"django.db.models.OneToOneField",
"rest_framework.authtoken.models.Token.objects.create",
"django.db.models.CharField",
"django.dispatch.receiver",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.DateTimeField"
] | [((386, 438), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'settings.AUTH_USER_MODEL'}), '(post_save, sender=settings.AUTH_USER_MODEL)\n', (394, 438), False, 'from django.dispatch import receiver\n'), ((604, 641), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'null': '(True... |
"""
Spherical Harmonic Coefficient and Grid classes
"""
import numpy as _np
import matplotlib as _mpl
import matplotlib.pyplot as _plt
from mpl_toolkits.axes_grid1 import make_axes_locatable as _make_axes_locatable
import copy as _copy
import warnings as _warnings
from scipy.special import factorial as _factorial
i... | [
"numpy.load",
"numpy.triu",
"numpy.random.seed",
"numpy.abs",
"matplotlib.cm.get_cmap",
"cartopy.mpl.ticker.LongitudeFormatter",
"numpy.empty",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.arange",
"matplotlib.colors.LogNorm",
"numpy.mean",
"numpy.random.normal",
"matplotlib.pyplot.Norm... | [((9883, 9907), 'numpy.iscomplexobj', '_np.iscomplexobj', (['coeffs'], {}), '(coeffs)\n', (9899, 9907), True, 'import numpy as _np\n'), ((15106, 15120), 'numpy.arange', '_np.arange', (['nl'], {}), '(nl)\n', (15116, 15120), True, 'import numpy as _np\n'), ((22676, 22700), 'numpy.iscomplexobj', '_np.iscomplexobj', (['coe... |
# Copyright 2020 Makani Technologies 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 agreed to... | [
"makani.lib.python.h5_utils.numpy_utils.Vec3ToArray",
"numpy.degrees",
"numpy.min",
"numpy.fabs",
"numpy.max"
] | [((1371, 1403), 'numpy.min', 'np.min', (["timeseries['water_line']"], {}), "(timeseries['water_line'])\n", (1377, 1403), True, 'import numpy as np\n'), ((2526, 2560), 'numpy.degrees', 'np.degrees', (['buoy_yaw_angle_from_eq'], {}), '(buoy_yaw_angle_from_eq)\n', (2536, 2560), True, 'import numpy as np\n'), ((3257, 3283)... |
#print(input("What's your name? *"))
player_name = input("what's your name? *")
#print("Your name is {}.".format(player_name))
import time
print("hi {}.".format(player_name))
care_1 = input("are you ready to save the Earth? *")
if care_1 == "yes":
print ("great")
elif care_1 == "no":
print ("too bad. choice i... | [
"time.sleep"
] | [((684, 697), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (694, 697), False, 'import time\n'), ((974, 987), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (984, 987), False, 'import time\n'), ((1077, 1090), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1087, 1090), False, 'import time\n'), ((1138, 1... |
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-02-25 13:02
from __future__ import absolute_import, print_function, unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import ietf.utils.models
class Migration(m... | [
"django.db.models.ManyToManyField",
"django.db.models.AutoField"
] | [((2172, 2298), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(True)', 'related_name': '"""groupmilestones"""', 'through': '"""group.GroupMilestoneDocs"""', 'to': '"""doc.Document"""'}), "(blank=True, related_name='groupmilestones', through=\n 'group.GroupMilestoneDocs', to='doc.Docum... |
import pytest
from sklearn.utils.estimator_checks import check_estimator
from fare import TemplateEstimator
from fare import TemplateClassifier
from fare import TemplateTransformer
@pytest.mark.parametrize(
"Estimator", [TemplateEstimator, TemplateTransformer, TemplateClassifier]
)
def test_all_estimators(Estim... | [
"pytest.mark.parametrize",
"sklearn.utils.estimator_checks.check_estimator"
] | [((186, 288), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""Estimator"""', '[TemplateEstimator, TemplateTransformer, TemplateClassifier]'], {}), "('Estimator', [TemplateEstimator,\n TemplateTransformer, TemplateClassifier])\n", (209, 288), False, 'import pytest\n'), ((338, 364), 'sklearn.utils.estimato... |
import os.path
import numpy as np
import pandas as pd
import pytest
from packerlabimaging.utils.io import import_obj
LOCAL_DATA_PATH = '/Users/prajayshah/data/oxford-data-to-process/'
REMOTE_DATA_PATH = '/home/pshah/mnt/qnap/Data/'
BASE_PATH = LOCAL_DATA_PATH
SUITE2P_FRAMES_SPONT_t005t006 = [0, 14880]
SUITE2P_FRAM... | [
"pandas.DataFrame",
"packerlabimaging.processing.suite2p.s2p_loader",
"pytest.fixture",
"packerlabimaging.utils.io.import_obj",
"numpy.random.random",
"numpy.arange",
"numpy.random.choice"
] | [((340, 371), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (354, 371), False, 'import pytest\n'), ((810, 841), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (824, 841), False, 'import pytest\n'), ((1235, 1266), 'pytest.fixtur... |
#c = _namespace['c']
#cw = _namespace['cw']
import q3.config
import q3.console as console
c = q3.config.consoleInstance
cw = q3.config.consoleWidgetInstance
#core funcs
rc = c.registerCommand
rp = c.registerProp
rc('rc',c.registerCommand, True)
rc('rp',c.registerProp, True)
pr = print
rc('pr',print,True)
#cw write
... | [
"q3.console.handleArg",
"types.MethodType",
"io.StringIO"
] | [((3295, 3411), 'q3.console.handleArg', 'console.handleArg', (['None', '"""putBefore"""'], {'kwargs': 'kwargs', 'desc': '"""If to put call before call of method"""', 'default': '(False)'}), "(None, 'putBefore', kwargs=kwargs, desc=\n 'If to put call before call of method', default=False)\n", (3312, 3411), True, 'imp... |
import pandas as pd
import os, re
from cryptography.fernet import Fernet
from keputils import koiutils as ku, koiname
from .cfg import DATADIR
KEY = open(os.path.join(DATADIR,'fernet.key')).read()
def parse_cell(s):
return float(s.replace('$',''))
def encrypt_file(filename, cryptfile, key=KEY):
raw = open(... | [
"pandas.DataFrame",
"cryptography.fernet.Fernet",
"os.path.join",
"re.search"
] | [((356, 367), 'cryptography.fernet.Fernet', 'Fernet', (['key'], {}), '(key)\n', (362, 367), False, 'from cryptography.fernet import Fernet\n'), ((1249, 1288), 'os.path.join', 'os.path.join', (['DATADIR', '"""spec.tex.crypt"""'], {}), "(DATADIR, 'spec.tex.crypt')\n", (1261, 1288), False, 'import os, re\n'), ((2323, 2514... |
# -*- coding: utf-8 -*-
"""SHERIFS
Seismic Hazard and Earthquake Rates In Fault Systems
Version 1.2
@author: <NAME>
"""
import numpy as np
class bg():
"""
Extract the geometry and properities of the background.
"""
def geom(model_name,file_geom):
Lon_bg = []
Lat_bg = [... | [
"numpy.array",
"numpy.genfromtxt"
] | [((404, 471), 'numpy.genfromtxt', 'np.genfromtxt', (['file_geom'], {'dtype': "['U100', 'f8', 'f8']", 'skip_header': '(1)'}), "(file_geom, dtype=['U100', 'f8', 'f8'], skip_header=1)\n", (417, 471), True, 'import numpy as np\n'), ((598, 620), 'numpy.array', 'np.array', (['column_model'], {}), '(column_model)\n', (606, 62... |
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2020, Pomfort GmbH"
__license__ = "MIT"
__maintainer__ = "<NAME>, <NAME>"
__email__ = "<EMAIL>"
"""
from click.testing import CliRunner
from ascmhl.__version__ import ascmhl_tool_version
from ascmhl.cli.ascmhl import mhltool_cli
def test_version():
runner = ... | [
"click.testing.CliRunner"
] | [((320, 331), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (329, 331), False, 'from click.testing import CliRunner\n')] |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 11:33:53 2020
@author: Peter
"""
import time
from bs4 import BeautifulSoup
from selenium import webdriver
"""Template für das Scrapen der Parkhausauslastung eines Landkreises von einer Website.
An den durch Kommentare gekennzeichneten Stellen im Code müss... | [
"bs4.BeautifulSoup",
"selenium.webdriver.Chrome",
"time.sleep"
] | [((1207, 1225), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (1223, 1225), False, 'from selenium import webdriver\n'), ((1470, 1485), 'time.sleep', 'time.sleep', (['sek'], {}), '(sek)\n', (1480, 1485), False, 'import time\n'), ((1506, 1554), 'bs4.BeautifulSoup', 'BeautifulSoup', (['driver.page_sou... |
import os
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc:
import errno
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
def find_files(path):
paths = []
for dirpath, dirnames, filenames in os.walk(path):
... | [
"os.path.isdir",
"os.walk",
"os.path.join",
"os.makedirs"
] | [((304, 317), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (311, 317), False, 'import os\n'), ((48, 65), 'os.makedirs', 'os.makedirs', (['path'], {}), '(path)\n', (59, 65), False, 'import os\n'), ((155, 174), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (168, 174), False, 'import os\n'), ((379, 41... |
from digideep.environment.common.vec_env import VecEnvWrapper
def get_type_name(cls):
"""Gets the name of a type.
This function is used to produce a key for each wrapper to store its states in a dictionary of wrappers' states.
Args:
cls: The input class.
Returns:
str: Name of the clas... | [
"digideep.environment.common.vec_env.VecEnvWrapper.__init__"
] | [((897, 931), 'digideep.environment.common.vec_env.VecEnvWrapper.__init__', 'VecEnvWrapper.__init__', (['self', 'venv'], {}), '(self, venv)\n', (919, 931), False, 'from digideep.environment.common.vec_env import VecEnvWrapper\n')] |
import minizinc
from minizinc import Model
print("Hi there, excited to run MZN")
# Create a MiniZinc model
basic_voting_model = Model("base_model.mzn")
gecode_solver = minizinc.Solver.lookup("gecode")
instance = minizinc.Instance(gecode_solver, basic_voting_model)
# set some parameters like this
# instance["a"] = 1
... | [
"minizinc.Instance",
"minizinc.Solver.lookup",
"minizinc.Model"
] | [((130, 153), 'minizinc.Model', 'Model', (['"""base_model.mzn"""'], {}), "('base_model.mzn')\n", (135, 153), False, 'from minizinc import Model\n'), ((170, 202), 'minizinc.Solver.lookup', 'minizinc.Solver.lookup', (['"""gecode"""'], {}), "('gecode')\n", (192, 202), False, 'import minizinc\n'), ((215, 267), 'minizinc.In... |
# -*- coding: utf-8 -*-
"""
Copyright (c) Microsoft Corporation and Dapr Contributors.
Licensed under the MIT License.
"""
import unittest
import json
from datetime import timedelta
from dapr.serializers.util import convert_from_dapr_duration, convert_to_dapr_duration
from dapr.serializers.json import DaprJSONDecode... | [
"unittest.main",
"datetime.timedelta",
"json.dumps",
"dapr.serializers.util.convert_from_dapr_duration"
] | [((1861, 1876), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1874, 1876), False, 'import unittest\n'), ((454, 492), 'dapr.serializers.util.convert_from_dapr_duration', 'convert_from_dapr_duration', (['"""4h15m40s"""'], {}), "('4h15m40s')\n", (480, 492), False, 'from dapr.serializers.util import convert_from_dap... |
from django.urls import path
from . import views
urlpatterns = [
path("", views.index, name='index'),
path("api/generate_text/", views.MarkovChainText.as_view(), name='markov_chain_text'),
path("api/preset_texts/", views.PresetTextsListView.as_view(), name='preset_texts'),
]
| [
"django.urls.path"
] | [((70, 105), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (74, 105), False, 'from django.urls import path\n')] |
# -*- coding: future_fstrings -*-
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import pathlib
_COLS = ('wavelength', 'nlines', 'depth', 'fwhm',
'EW', 'EWerr', 'amplitude', 'sigma', 'mean')
class ARES:
def __init__(self, *arg, **kwargs):
self._c... | [
"numpy.sum",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"os.system",
"pathlib.Path",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((5449, 5469), 'numpy.arange', 'np.arange', (['(1)', '(8)', '(0.1)'], {}), '(1, 8, 0.1)\n', (5458, 5469), True, 'import numpy as np\n'), ((1990, 2019), 'os.system', 'os.system', (['"""ARES > /dev/null"""'], {}), "('ARES > /dev/null')\n", (1999, 2019), False, 'import os\n'), ((2615, 2663), 'pandas.read_csv', 'pd.read_c... |
import copy
import pickle
import sys
from pathlib import Path
from sklearn.cluster import KMeans, DBSCAN
import numpy as np
from skimage import io
import mayavi.mlab as mlab
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "3"
from ..ops.roiaware_pool3d import roiaware_pool3d_utils
from ..utils import (
box_utils,
... | [
"pickle.dump",
"numpy.maximum",
"torch.sqrt",
"torch.cat",
"numpy.ones",
"numpy.argsort",
"pathlib.Path",
"numpy.sin",
"numpy.arange",
"pickle.load",
"os.path.join",
"sklearn.cluster.DBSCAN",
"sys.path.append",
"numpy.zeros_like",
"numpy.meshgrid",
"sklearn.cluster.KMeans",
"mayavi.m... | [((560, 629), 'sys.path.append', 'sys.path.append', (['"""/home/xharlie/dev/occlusion_pcd/tools/visual_utils"""'], {}), "('/home/xharlie/dev/occlusion_pcd/tools/visual_utils')\n", (575, 629), False, 'import sys\n'), ((6286, 6375), 'visualize_utils.draw_scenes_multi', 'vu.draw_scenes_multi', (['box_pnt_lst', 'colors_lst... |
import logging
import pickle
import random
import re
import time
from logging import Logger
from typing import List, Optional, Type, Union
import matplotlib.pyplot as plt
import numpy as np
from mohou.model.autoencoder import VariationalAutoEncoder
try:
from moviepy.editor import ImageSequenceClip
except Excepti... | [
"mohou.dataset.AutoEncoderDataset.from_chunk",
"mohou.utils.canvas_to_ndarray",
"random.shuffle",
"time.strftime",
"logging.getLogger",
"matplotlib.pyplot.figure",
"mohou.trainer.TrainCache.load",
"mohou.trainer.TrainCache",
"pickle.load",
"moviepy.editor.ImageSequenceClip",
"mohou.file.get_subp... | [((1076, 1103), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1093, 1103), False, 'import logging\n'), ((1545, 1571), 'logging.getLogger', 'logging.getLogger', (['"""mohou"""'], {}), "('mohou')\n", (1562, 1571), False, 'import logging\n'), ((2305, 2369), 'mohou.dataset.AutoEncoderDatase... |
from django.db import models
from django.db.models.deletion import CASCADE
from django.utils import timezone
from django.contrib.auth.models import User
class Message(models.Model):
content = models.TextField(max_length=200, blank=False)
to_user = models.ForeignKey(
to=User, on_delete=models.CASCADE, ... | [
"django.db.models.ForeignKey",
"django.db.models.TextField",
"django.db.models.BooleanField",
"django.utils.timezone.now"
] | [((198, 243), 'django.db.models.TextField', 'models.TextField', ([], {'max_length': '(200)', 'blank': '(False)'}), '(max_length=200, blank=False)\n', (214, 243), False, 'from django.db import models\n'), ((258, 334), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'to': 'User', 'on_delete': 'models.CASCADE', ... |
import os
from pathlib import Path
PROJECT_ROOT = Path(os.path.dirname(os.path.realpath(__file__)))
TEMPLATES_DIR = PROJECT_ROOT / 'templates'
| [
"os.path.realpath"
] | [((73, 99), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (89, 99), False, 'import os\n')] |
from flask import Blueprint, request
crossword_creator_blueprint = Blueprint("crossword_creator", __name__)
from . import events, routes # noqa: F401,E402
def _get_player_id() -> str:
if "playerId" in request.cookies:
return request.cookies["playerId"]
else:
raise ValueError("No playerId de... | [
"flask.Blueprint"
] | [((68, 108), 'flask.Blueprint', 'Blueprint', (['"""crossword_creator"""', '__name__'], {}), "('crossword_creator', __name__)\n", (77, 108), False, 'from flask import Blueprint, request\n')] |
'''
# Example dictionary containing information on power excess and shortage for the current timestep
# {key:[Qsum,Qchp_nom,Qchp_min,Qboiler_nom,Qboiler_min,Q_tes_in,Q_tes_out]}
dict_Qlhn={'1001': {'Qsum':[10,10],'Qchp_nom':[8,8],'Qchp_min':[5,5],'Qboiler_nom':[2,2],'Qboiler_min':[1,1]},
'1002': {'Qsum... | [
"pickle.dump",
"pycity_calc.toolbox.dimensioning.dim_networks.estimate_u_value",
"pycity_calc.toolbox.networks.network_ops.get_list_with_energy_net_con_node_ids",
"pycity_calc.toolbox.dimensioning.dim_networks.calc_pipe_power_loss",
"numpy.zeros",
"pycity_calc.simulation.energy_balance_optimization.energy... | [((2919, 2964), 'pycity_calc.cities.city.City', 'cit.City', ([], {'environment': 'City_Object.environment'}), '(environment=City_Object.environment)\n', (2927, 2964), True, 'import pycity_calc.cities.city as cit\n'), ((3022, 3146), 'pycity_calc.toolbox.networks.network_ops.get_list_with_energy_net_con_node_ids', 'netop... |
import tarfile
import pathlib
tar_f = pathlib.Path(__file__).parent / 'data' / 'electron_microscopy' / \
'test_files.tar.gz'
def pytest_sessionstart(session):
"""
Called after the Session object has been created and
before performing collection and entering the run test loop.
Unpack the comp... | [
"tarfile.open",
"pathlib.Path"
] | [((375, 402), 'tarfile.open', 'tarfile.open', (['tar_f', '"""r:gz"""'], {}), "(tar_f, 'r:gz')\n", (387, 402), False, 'import tarfile\n'), ((678, 705), 'tarfile.open', 'tarfile.open', (['tar_f', '"""r:gz"""'], {}), "(tar_f, 'r:gz')\n", (690, 705), False, 'import tarfile\n'), ((39, 61), 'pathlib.Path', 'pathlib.Path', ([... |
import unittest
# from ssdaq import SSReadout, SSReadoutAssembler # ,SSReadoutlowSignalDataProtocol
import socket
from queue import Queue
import time
# #Silencing INFO logging
# import logging
# from ssdaq import sslogger
# sslogger.setLevel(logging.ERROR)
# import numpy as np
# class TestSSReadout(unittest.TestCa... | [
"unittest.main"
] | [((3159, 3174), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3172, 3174), False, 'import unittest\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2019, <NAME>
"""Tools to use data (especially from QM9) for machine learning applications."""
# Here comes your imports
import os
import re
import tarfile
import logging
import multiprocessing
from concurrent.futures.process import ProcessPoolExecutor
fro... | [
"re.split",
"multiprocessing.Lock",
"os.getcwd",
"chemlearning_data.molecule.Molecule",
"logging.StreamHandler",
"logging.Formatter",
"logging.info",
"pathlib.Path",
"os.scandir",
"cclib.parser.utils.PeriodicTable",
"os.chdir",
"concurrent.futures.process.ProcessPoolExecutor",
"tarfile.open"... | [((529, 551), 'multiprocessing.Lock', 'multiprocessing.Lock', ([], {}), '()\n', (549, 551), False, 'import multiprocessing\n'), ((1697, 1712), 'cclib.parser.utils.PeriodicTable', 'PeriodicTable', ([], {}), '()\n', (1710, 1712), False, 'from cclib.parser.utils import PeriodicTable\n'), ((1843, 1879), 'chemlearning_data.... |
from rest_framework import routers
from .apis import RecipesRestAPI
router = routers.DefaultRouter()
router.register(r'recipes', RecipesRestAPI, basename='recipes_api_v1')
urlpatterns = router.urls
| [
"rest_framework.routers.DefaultRouter"
] | [((79, 102), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (100, 102), False, 'from rest_framework import routers\n')] |
import re
from typing import Any, Optional
import pytest
from pytest import raises
from omegaconf import MissingMandatoryValue, OmegaConf
from . import does_not_raise
@pytest.mark.parametrize("struct", [True, False, None]) # type: ignore
def test_select_key_from_empty(struct: Optional[bool]) -> None:
c = Omeg... | [
"re.escape",
"omegaconf.OmegaConf.select",
"omegaconf.OmegaConf.create",
"pytest.raises",
"omegaconf.OmegaConf.register_resolver",
"pytest.mark.parametrize",
"omegaconf.OmegaConf.set_struct"
] | [((173, 227), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""struct"""', '[True, False, None]'], {}), "('struct', [True, False, None])\n", (196, 227), False, 'import pytest\n'), ((316, 334), 'omegaconf.OmegaConf.create', 'OmegaConf.create', ([], {}), '()\n', (332, 334), False, 'from omegaconf import Missin... |
import os, sys, inspect
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
if cmd_subfolder not in sys.path:
sys.path.insert(0, cmd_subfolder) | [
"sys.path.insert",
"inspect.currentframe"
] | [((192, 225), 'sys.path.insert', 'sys.path.insert', (['(0)', 'cmd_subfolder'], {}), '(0, cmd_subfolder)\n', (207, 225), False, 'import os, sys, inspect\n'), ((117, 139), 'inspect.currentframe', 'inspect.currentframe', ([], {}), '()\n', (137, 139), False, 'import os, sys, inspect\n')] |
from pypi_org.models.shared.modelbase import ViewModelBase
from pypi_org.services.user import find_user_by_id
class IndexViewModel(ViewModelBase):
def __init__(self):
super().__init__()
self.user = find_user_by_id(self.user_id)
| [
"pypi_org.services.user.find_user_by_id"
] | [((220, 249), 'pypi_org.services.user.find_user_by_id', 'find_user_by_id', (['self.user_id'], {}), '(self.user_id)\n', (235, 249), False, 'from pypi_org.services.user import find_user_by_id\n')] |
"""Mass Apk Installer.
Automate back up of android devices
Author: Evan
Created: 19/10/2011
Last Modified: 13/03/2020
Licence: MIT
Copyright (c) 2021, Evan
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the followi... | [
"logging.Formatter",
"os.path.abspath",
"logging.StreamHandler",
"logging.getLogger"
] | [((2008, 2041), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (2029, 2041), False, 'import logging\n'), ((2166, 2193), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2183, 2193), False, 'import logging\n'), ((2076, 2145), 'logging.Formatter', '... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015 by PyCLibrary Authors, see AUTHORS for more details.
#
# Distributed under the terms of the MIT/X11 license.
#
# The full license is in the file LICENCE, distributed with this software.
# -----------... | [
"subprocess.Popen",
"os.path.isdir",
"os.path.dirname",
"subprocess.CalledProcessError",
"os.path.isfile",
"io.open",
"os.path.join",
"logging.getLogger"
] | [((941, 968), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (958, 968), False, 'import logging\n'), ((7635, 7697), 'subprocess.Popen', 'subprocess.Popen', (['*popenargs'], {'stdout': 'subprocess.PIPE'}), '(*popenargs, stdout=subprocess.PIPE, **kwargs)\n', (7651, 7697), False, 'import sub... |
import arcade
import math
import random
from game import constants
class Player(arcade.Sprite):
def update(self):
""" Move the player """
self.center_x += self.change_x
self.center_y += self.change_y
# Check for out-of-bounds
if self.left < 0:
self.left = 0
... | [
"arcade.run",
"math.atan2",
"arcade.start_render",
"arcade.Sprite",
"math.sin",
"arcade.check_for_collision_with_list",
"random.randrange",
"math.cos",
"arcade.set_background_color",
"arcade.SpriteList",
"math.degrees",
"arcade.draw_text"
] | [((7410, 7422), 'arcade.run', 'arcade.run', ([], {}), '()\n', (7420, 7422), False, 'import arcade\n'), ((1348, 1396), 'arcade.set_background_color', 'arcade.set_background_color', (['arcade.color.AMAZON'], {}), '(arcade.color.AMAZON)\n', (1375, 1396), False, 'import arcade\n'), ((1532, 1551), 'arcade.SpriteList', 'arca... |
import numpy as np
from base64 import b64decode
from json import loads
import matplotlib.pyplot as plt
""" algorithm to classify unlabeled data into K classes using K_means_clustering algorithm
devloper -> <NAME>
bilding the K means clusturing machine learning model from scrach
"""
class k_mea... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"json.loads",
"numpy.zeros",
"numpy.ones",
"numpy.argmin",
"base64.b64decode",
"matplotlib.pyplot.figure",
"numpy.array"
] | [((7205, 7221), 'numpy.array', 'np.array', (['digits'], {}), '(digits)\n', (7213, 7221), True, 'import numpy as np\n'), ((6598, 6606), 'json.loads', 'loads', (['x'], {}), '(x)\n', (6603, 6606), False, 'from json import loads\n'), ((7646, 7658), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (7656, 7658), T... |
"""
This module evaluates each decades's word2vec performance using AUROC and precision-recall.
Very similar to `analysis` module.
"""
from sklearn.metrics import (
roc_curve,
auc,
precision_recall_curve,
average_precision_score,
)
import pandas as pd
import numpy as np
import os
import matplotlib.pyplo... | [
"matplotlib.pyplot.xlim",
"sklearn.metrics.average_precision_score",
"matplotlib.pyplot.plot",
"sklearn.metrics.roc_curve",
"matplotlib.pyplot.ylim",
"os.getcwd",
"matplotlib.pyplot.legend",
"sklearn.metrics.precision_recall_curve",
"sklearn.metrics.auc",
"matplotlib.pyplot.figure",
"matplotlib.... | [((647, 677), 'sklearn.metrics.roc_curve', 'roc_curve', (['labels', 'predictions'], {}), '(labels, predictions)\n', (656, 677), False, 'from sklearn.metrics import roc_curve, auc, precision_recall_curve, average_precision_score\n'), ((692, 703), 'sklearn.metrics.auc', 'auc', (['fp', 'tp'], {}), '(fp, tp)\n', (695, 703)... |
"""
This module declares the Bayesian regression tree models:
* PerpendicularRegressionTree
* HyperplaneRegressionTree
"""
import numpy as np
from abc import ABC
from scipy.special import gammaln
from sklearn.base import RegressorMixin
from bayesian_decision_tree.base import BaseTree
from bayesian_decision_tree.base_h... | [
"numpy.log",
"bayesian_decision_tree.base_perpendicular.BasePerpendicularTree.__init__",
"bayesian_decision_tree.base.BaseTree.__init__",
"bayesian_decision_tree.base_hyperplane.BaseHyperplaneTree.__init__",
"numpy.array",
"numpy.arange",
"scipy.special.gammaln"
] | [((809, 917), 'bayesian_decision_tree.base.BaseTree.__init__', 'BaseTree.__init__', (['self', 'partition_prior', 'prior', 'delta', 'prune', 'child_type', '(True)', 'split_precision', 'level'], {}), '(self, partition_prior, prior, delta, prune, child_type, \n True, split_precision, level)\n', (826, 917), False, 'from... |
import matplotlib.pyplot as plt
import numpy as np
import scipy.interpolate
from oneibl.one import ONE
from ibllib.io import spikeglx
import alf.io
from scipy.io import savemat
from brainbox.io.one import load_channel_locations
from scipy import signal
import brainbox as bb
from pathlib import Path
import pandas as pd... | [
"matplotlib.pyplot.title",
"numpy.load",
"numpy.abs",
"matplotlib.pyplot.suptitle",
"os.walk",
"numpy.argsort",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"pathlib.Path",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.yticks",
"ibllib.io.spi... | [((503, 512), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (510, 512), True, 'import matplotlib.pyplot as plt\n'), ((1791, 1796), 'oneibl.one.ONE', 'ONE', ([], {}), '()\n', (1794, 1796), False, 'from oneibl.one import ONE\n'), ((2900, 2953), 'numpy.save', 'np.save', (["('/home/mic/saturation_scan2/%s.npy' % ei... |
"""This module contains functions which extract the required information for
populating the raga lakshana section in a wiki article. This module defines
those functions which generate information about a raga from its moorchana
alone.
@author: <NAME>, iREL, IIIT-H"""
import re
import json
import argparse
import nump... | [
"argparse.ArgumentParser",
"tomita.legacy.pysynth_b.make_wav",
"PIL.Image.open",
"PIL.ImageFont.truetype",
"PIL.ImageDraw.Draw"
] | [((452, 477), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (475, 477), False, 'import argparse\n'), ((809, 865), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (["CONF['font_path']", "CONF['font_size']"], {}), "(CONF['font_path'], CONF['font_size'])\n", (827, 865), False, 'from PIL import Im... |
"""Web server resource, base on bottle framework
"""
import threading
from bottle import (
Bottle,
run
)
web_server = None
class ConfigItems:
"""Web server配置项
"""
SERVER_TYPE = "server_type" # web服务基于的IO模型,比如gevent、tornado、gunicorn等等
HOST = "host" # 监听的host地址
PORT = "port" # 监听的端... | [
"threading.Thread",
"bottle.Bottle",
"bottle.run"
] | [((1194, 1307), 'bottle.run', 'run', ([], {'app': 'self.app', 'server': 'self.server_type', 'host': 'self.host', 'port': 'self.port', 'quiet': '(True)'}), '(app=self.app, server=self.server_type, host=self.host, port=self.port,\n quiet=True, **self.server_options)\n', (1197, 1307), False, 'from bottle import Bottle,... |
#!/usr/bin/env python
"""Select rows from a fusion table."""
import ee
import ee.mapclient
ee.Initialize()
ee.mapclient.centerMap(-93, 40, 4)
# Select the 'Sonoran desert' feature from the TNC Ecoregions fusion table.
fc = (ee.FeatureCollection('ft:1Ec8IWsP8asxN-ywSqgXWMuBaxI6pPaeh6hC64lA')
.filter(ee.Filter(... | [
"ee.Filter",
"ee.FeatureCollection",
"ee.Image",
"ee.mapclient.centerMap",
"ee.Initialize"
] | [((93, 108), 'ee.Initialize', 'ee.Initialize', ([], {}), '()\n', (106, 108), False, 'import ee\n'), ((109, 143), 'ee.mapclient.centerMap', 'ee.mapclient.centerMap', (['(-93)', '(40)', '(4)'], {}), '(-93, 40, 4)\n', (131, 143), False, 'import ee\n'), ((228, 295), 'ee.FeatureCollection', 'ee.FeatureCollection', (['"""ft:... |
'''Chemyx Pump Module
Chemyx manufacturers several types of syringe pumps, which can be found on their website:
https://www.chemyx.com/
This module can be used to control Chemyx pumps.
'''
import serial
import time
import re
import io
import logging
from chemios.utils import serial_write, write_i2c, sio_write
from... | [
"logging.debug",
"logging.warning",
"time.sleep",
"chemios.utils.sio_write",
"chemios.utils.serial_write",
"re.search"
] | [((2917, 2959), 'logging.debug', 'logging.debug', (['"""Connecting to Chemyx pump"""'], {}), "('Connecting to Chemyx pump')\n", (2930, 2959), False, 'import logging\n'), ((4556, 4589), 'chemios.utils.serial_write', 'serial_write', (['self.ser', "'start\\r'"], {}), "(self.ser, 'start\\r')\n", (4568, 4589), False, 'from ... |
import jwt
from rest_framework import authentication, exceptions
from django.conf import settings
from authentication.models import User
class JWTAuthentication(authentication.BaseAuthentication):
def authenticate(self, request):
auth_data = authentication.get_authorization_header(request)
if not... | [
"rest_framework.exceptions.AuthenticationFailed",
"authentication.models.User.objects.get",
"rest_framework.authentication.get_authorization_header",
"jwt.decode"
] | [((257, 305), 'rest_framework.authentication.get_authorization_header', 'authentication.get_authorization_header', (['request'], {}), '(request)\n', (296, 305), False, 'from rest_framework import authentication, exceptions\n'), ((453, 517), 'jwt.decode', 'jwt.decode', (['token', 'settings.JWT_SECRET_KEY'], {'algorithms... |
import pytest
import pandas as pd
from FinMind.BackTestSystem import BackTest
from FinMind.BackTestSystem.Strategies.ContinueHolding import ContinueHolding
from FinMind.BackTestSystem.Strategies.Bias import Bias
from FinMind.BackTestSystem.Strategies.NaiveKd import NaiveKd
from FinMind.BackTestSystem.Strategies.Kd impo... | [
"FinMind.BackTestSystem.BackTest"
] | [((890, 1003), 'FinMind.BackTestSystem.BackTest', 'BackTest', ([], {'stock_id': '"""0056"""', 'start_date': '"""2018-01-01"""', 'end_date': '"""2019-01-01"""', 'trader_fund': '(500000.0)', 'fee': '(0.001425)'}), "(stock_id='0056', start_date='2018-01-01', end_date='2019-01-01',\n trader_fund=500000.0, fee=0.001425)\... |
import pandas as pd
from sentinelsat import *
from collections import OrderedDict
from datetime import datetime,timedelta, date
import numpy as np
from rasterio.features import sieve
from Python.prep_raster import computeIndexStack,compute_index
from Python.mlc import *
from Python.pred_raster import dtc_pred_stack
fro... | [
"numpy.radians",
"numpy.sum",
"Python.prep_raster.compute_index",
"Python.prep_raster.computeIndexStack",
"numpy.where",
"numpy.array",
"rasterio.features.sieve",
"datetime.timedelta",
"glob.glob",
"collections.OrderedDict",
"Python.pred_raster.dtc_pred_stack",
"sklearn.cluster.DBSCAN"
] | [((1019, 1032), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1030, 1032), False, 'from collections import OrderedDict\n'), ((3097, 3142), 'numpy.sum', 'np.sum', (['[mlc_img, dtc_img, slice_img]'], {'axis': '(0)'}), '([mlc_img, dtc_img, slice_img], axis=0)\n', (3103, 3142), True, 'import numpy as np\n'),... |
from django_better_admin_arrayfield.models.fields import ArrayField
from django.db import models
from django.utils.text import slugify
from tinymce.models import HTMLField
class BaseModel(models.Model):
"""
The common field in all the models are defined here
"""
# A timestamp representing when this ob... | [
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.BooleanField",
"tinymce.models.HTMLField",
"django.utils.text.slugify",
"django.db.models.IntegerField",
"django.db.models.DateField",
"django.db.models.DateTimeField"
] | [((355, 394), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (375, 394), False, 'from django.db import models\n'), ((479, 514), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)'}), '(auto_now=True)\n', (499, 514), F... |
import os
import argparse
import logging
from server import SDKServer
logging.basicConfig(level=10, format="%(asctime)s - [%(levelname)8s] - %(name)s - %(message)s")
log = logging.getLogger("snet_sdk_server")
if __name__ == '__main__':
parser = argparse.ArgumentParser()
# SNET SDK
parser.add_argument(... | [
"argparse.ArgumentParser",
"logging.basicConfig",
"server.SDKServer",
"os.path.exists",
"os.environ.get",
"logging.getLogger"
] | [((73, 173), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': '(10)', 'format': '"""%(asctime)s - [%(levelname)8s] - %(name)s - %(message)s"""'}), "(level=10, format=\n '%(asctime)s - [%(levelname)8s] - %(name)s - %(message)s')\n", (92, 173), False, 'import logging\n'), ((175, 211), 'logging.getLogger', ... |
from unittest.mock import patch
import pytest
import requests
from pyoffers.api import HasOffersAPI
from pyoffers.exceptions import HasOffersException, MaxRetriesExceeded
from pyoffers.models import Advertiser, Country
def test_invalid_network_id(api):
old_token = api.network_token
try:
api.network_... | [
"unittest.mock.patch",
"pyoffers.api.HasOffersAPI",
"pytest.raises",
"pyoffers.models.Country"
] | [((1781, 1795), 'pyoffers.api.HasOffersAPI', 'HasOffersAPI', ([], {}), '()\n', (1793, 1795), False, 'from pyoffers.api import HasOffersAPI\n'), ((1809, 1823), 'pyoffers.api.HasOffersAPI', 'HasOffersAPI', ([], {}), '()\n', (1821, 1823), False, 'from pyoffers.api import HasOffersAPI\n'), ((2336, 2369), 'pytest.raises', '... |
# -*- coding: utf-8 -*-
import pathlib # change to pathlib from Python 3.4 instead of os
import tifffile, cv2, datetime, pickle
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec
from libraries import OFlowCalc, Filters, plotfunctions, helpfunctions, PeakDetection, videoreader
... | [
"pickle.dump",
"numpy.sum",
"numpy.abs",
"libraries.plotfunctions.plot_TimeAveragedMotions",
"libraries.helpfunctions.scale_ImageStack",
"pickle.load",
"numpy.arange",
"libraries.helpfunctions.read_config",
"numpy.nanmean",
"numpy.copy",
"libraries.videoreader.import_video",
"numpy.max",
"li... | [((1581, 1610), 'libraries.PeakDetection.PeakDetection', 'PeakDetection.PeakDetection', ([], {}), '()\n', (1608, 1610), False, 'from libraries import OFlowCalc, Filters, plotfunctions, helpfunctions, PeakDetection, videoreader\n'), ((1840, 1867), 'libraries.helpfunctions.read_config', 'helpfunctions.read_config', ([], ... |
import copy
import logging
import importlib
from typing import List
from django.apps import apps
from django.utils import timezone
from django.db import models
from django.contrib.postgres.fields import ArrayField
from django.db.models.signals import class_prepared, post_save
from django.utils.translation import gette... | [
"django.db.models.OneToOneField",
"importlib.import_module",
"django.utils.translation.gettext_lazy",
"django.utils.timezone.now",
"copy.copy",
"django.db.models.signals.class_prepared.connect",
"model_utils.FieldTracker",
"django.db.models.signals.post_save.connect",
"logging.getLogger"
] | [((650, 677), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (667, 677), False, 'import logging\n'), ((2073, 2312), 'django.utils.translation.gettext_lazy', '_', (['"""Изменение - некоторый текстовый или материальный объект, являющийся, с точки зрения "бизнеса", интерфейсом ввода данных в... |
"""Tests for the views of the ``django-user-media`` app."""
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from django_libs.tests.mixins import ViewRequestFactoryTestMixin
from mixer.backend.django import mixer, get_image
from .. import views
class CreateImageViewTestCas... | [
"mixer.backend.django.mixer.blend",
"mixer.backend.django.get_image",
"django.contrib.contenttypes.models.ContentType.objects.get_for_model"
] | [((603, 637), 'mixer.backend.django.mixer.blend', 'mixer.blend', (['"""test_app.DummyModel"""'], {}), "('test_app.DummyModel')\n", (614, 637), False, 'from mixer.backend.django import mixer, get_image\n'), ((701, 735), 'mixer.backend.django.mixer.blend', 'mixer.blend', (['"""test_app.DummyModel"""'], {}), "('test_app.D... |
# -*- coding: utf-8 -*-
"""
model_visil
revision 0.2 2015/nov mlabru
pep8 style conventions
revision 0.1 2015/fev mlabru
initial release (Linux/Python)
"""
# < imports >--------------------------------------------------------------------------------------
# python library
import logging
import os
import sys
# P... | [
"model.visil.emula_visil.CEmulaVisil",
"control.events.events_basic.CQuit",
"model.visil.airspace_visil.CAirspaceVisil",
"libs.geomag.geomag.geomag.geomag.GeoMag",
"libs.coords.coord_sys.CCoordSys",
"sys.exit",
"os.path.expanduser",
"logging.getLogger"
] | [((1877, 1929), 'libs.coords.coord_sys.CCoordSys', 'coords.CCoordSys', (['lf_ref_lat', 'lf_ref_lng', 'lf_dcl_mag'], {}), '(lf_ref_lat, lf_ref_lng, lf_dcl_mag)\n', (1893, 1929), True, 'import libs.coords.coord_sys as coords\n'), ((2019, 2049), 'libs.geomag.geomag.geomag.geomag.GeoMag', 'gm.GeoMag', (['"""data/tabs/WMM.C... |
# QC
from .samplers import *
from .graph_data import *
from .graph_state import *
from .graph_circuit import *
from .stabilizers import *
from .simulate import *
from .witnesses import *
# config
from .config import *
# ML
from .dataset import *
from .models import *
__version__ = "0.0.1"
import logging
from pytorch_... | [
"pytorch_lightning.seed_everything",
"logging.getLogger"
] | [((388, 413), 'pytorch_lightning.seed_everything', 'seed_everything', (['__seed__'], {}), '(__seed__)\n', (403, 413), False, 'from pytorch_lightning import seed_everything\n'), ((465, 492), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (482, 492), False, 'import logging\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import email
from email.header import decode_header
from email.utils import getaddresses
from .compat import bytes, IS_PY3, unicode
def convert_addresses(raw_header):
result = []
name_addr_pairs = getaddresses([raw_header]... | [
"email.header.decode_header",
"email.message_from_string",
"email.utils.getaddresses"
] | [((295, 321), 'email.utils.getaddresses', 'getaddresses', (['[raw_header]'], {}), '([raw_header])\n', (307, 321), False, 'from email.utils import getaddresses\n'), ((1233, 1263), 'email.message_from_string', 'email.message_from_string', (['raw'], {}), '(raw)\n', (1258, 1263), False, 'import email\n'), ((2431, 2452), 'e... |
from cloudmesh.flow.Flow import FlowDatabase
import subprocess
import time
import json
import webbrowser
from cloudmesh.common.console import Console
import sys
class FlowRunner(object):
def __init__(self, flowname, filename=None):
self.filename = filename or f"{flowname}-flow.py"
self.flowname = ... | [
"webbrowser.open",
"cloudmesh.flow.Flow.FlowDatabase",
"cloudmesh.common.console.Console.error",
"time.sleep",
"sys.exit"
] | [((463, 485), 'cloudmesh.flow.Flow.FlowDatabase', 'FlowDatabase', (['flowname'], {}), '(flowname)\n', (475, 485), False, 'from cloudmesh.flow.Flow import FlowDatabase\n'), ((2266, 2279), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (2276, 2279), False, 'import time\n'), ((2392, 2412), 'webbrowser.open', 'webbrow... |
from wordsapy import Dictionary
dictionary = Dictionary(api_key='')
# More details: https://www.wordsapi.com/docs/#frequency
frequency = dictionary.frequency('wind')
if hasattr(frequency, 'zipf'):
print('Zipf: ' + str(frequency.zipf))
if hasattr(frequency, 'perMillion'):
print('Per million: ' + str(frequen... | [
"wordsapy.Dictionary"
] | [((46, 68), 'wordsapy.Dictionary', 'Dictionary', ([], {'api_key': '""""""'}), "(api_key='')\n", (56, 68), False, 'from wordsapy import Dictionary\n')] |
#train_unet2.py
import matplotlib
#matplotlib.use("Agg")# to save figure(NO UI backed)
import matplotlib.pyplot as plt
#matplotlib.use( 'tkagg' ) for UI
from model import *
from data_loader import get_test_gen, get_train_gen
import keras
from keras.callbacks import TensorBoard
IMG_SIZE = 160
img_size = (I... | [
"data_loader.get_test_gen",
"pickle.dump",
"keras.callbacks.ModelCheckpoint",
"keras.callbacks.TensorBoard",
"keras.callbacks.EarlyStopping",
"data_loader.get_train_gen"
] | [((712, 747), 'data_loader.get_train_gen', 'get_train_gen', (['IMG_SIZE', 'BATCH_SIZE'], {}), '(IMG_SIZE, BATCH_SIZE)\n', (725, 747), False, 'from data_loader import get_test_gen, get_train_gen\n'), ((768, 802), 'data_loader.get_test_gen', 'get_test_gen', (['IMG_SIZE', 'BATCH_SIZE'], {}), '(IMG_SIZE, BATCH_SIZE)\n', (7... |
import sys
import os
import pytest
from numpy import array, array_equal, allclose
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from lxmls.readers import galton
tolerance = 1e-5
@pytest.fixture(scope='module')
def galton_data():
return galton.load()
def test_galton_data(galton_data)... | [
"matplotlib.pyplot.hist",
"numpy.allclose",
"pytest.fixture",
"pytest.main",
"matplotlib.use",
"numpy.array",
"lxmls.readers.galton.load"
] | [((101, 122), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (115, 122), False, 'import matplotlib\n'), ((210, 240), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (224, 240), False, 'import pytest\n'), ((271, 284), 'lxmls.readers.galton.load', 'galton.... |
from django.test import TestCase
from functional_tests.factory import ResourceFactory
from django.test import Client
class ResourceListTest(TestCase):
def setUp(self):
self.client = Client()
self.resource1 = ResourceFactory(title='Resource1')
self.resource2 = ResourceFactory(title='Resourc... | [
"functional_tests.factory.ResourceFactory",
"functional_tests.factory.ResourceFactory.create_batch",
"django.test.Client"
] | [((196, 204), 'django.test.Client', 'Client', ([], {}), '()\n', (202, 204), False, 'from django.test import Client\n'), ((230, 264), 'functional_tests.factory.ResourceFactory', 'ResourceFactory', ([], {'title': '"""Resource1"""'}), "(title='Resource1')\n", (245, 264), False, 'from functional_tests.factory import Resour... |
import asyncio
import logging
from typing import Optional
from urllib.parse import quote as quote_url
import aiohttp
from .constants import Keys, URLs
log = logging.getLogger(__name__)
class ResponseCodeError(ValueError):
"""Raised when a non-OK HTTP response is received."""
def __init__(
self,
... | [
"aiohttp.ClientSession",
"urllib.parse.quote",
"logging.getLogger"
] | [((160, 187), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (177, 187), False, 'import logging\n'), ((1567, 1606), 'aiohttp.ClientSession', 'aiohttp.ClientSession', ([], {}), '(**session_kwargs)\n', (1588, 1606), False, 'import aiohttp\n'), ((1722, 1741), 'urllib.parse.quote', 'quote_url... |
import string
import random
from textwrap import wrap
def charset(length: int = 6) -> str:
return ''.join(random.choices(string.ascii_lowercase, k=length))
def superset(
length: int = 3,
set_length: int = 6,
numbers: int = 1,
uppercase: int = 1,
separator: str = '-'
) -> str:
assert numb... | [
"textwrap.wrap",
"random.choices",
"random.choice"
] | [((1331, 1352), 'textwrap.wrap', 'wrap', (['all', 'set_length'], {}), '(all, set_length)\n', (1335, 1352), False, 'from textwrap import wrap\n'), ((112, 160), 'random.choices', 'random.choices', (['string.ascii_lowercase'], {'k': 'length'}), '(string.ascii_lowercase, k=length)\n', (126, 160), False, 'import random\n'),... |
# -*- coding: utf-8 -*-
import os
import numpy as np
import glob
import re
import multiprocessing as mp
from parameters import ovfParms
class OvfFile:
def __init__(self, path, parms=None):
self._path = path
if parms is None:
self._parms = ovfParms()
else:
... | [
"numpy.load",
"os.path.isdir",
"numpy.allclose",
"os.path.realpath",
"parameters.ovfParms",
"re.findall",
"numpy.array",
"glob.glob",
"numpy.savez",
"multiprocessing.cpu_count"
] | [((1600, 1624), 'numpy.allclose', 'np.allclose', (['self', 'other'], {}), '(self, other)\n', (1611, 1624), True, 'import numpy as np\n'), ((4557, 4648), 'numpy.savez', 'np.savez', (['path'], {'array': 'self.array', 'headers': 'self.headers', 'path': 'self._path', 'time': 'self.time'}), '(path, array=self.array, headers... |
from django.shortcuts import render,redirect
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.contrib import messages
from .models import Profile
from .forms import UpdateProfileForm
@login_required
def dashbo(request):
return render(request,'dash... | [
"django.shortcuts.render",
"django.contrib.messages.success",
"django.shortcuts.redirect",
"django.contrib.auth.models.User.objects.get"
] | [((300, 333), 'django.shortcuts.render', 'render', (['request', '"""dashboard.html"""'], {}), "(request, 'dashboard.html')\n", (306, 333), False, 'from django.shortcuts import render, redirect\n'), ((367, 395), 'django.shortcuts.render', 'render', (['request', '"""home.html"""'], {}), "(request, 'home.html')\n", (373, ... |
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license.
Uniter for RE model
"""
from collections import defaultdict
import torch
from torch import nn
import random
import numpy as np
from .layer import GELU
from .model import UniterPreTrainedModel, UniterModel
try:
from apex.normalization.fused_l... | [
"numpy.random.uniform",
"random.randint",
"torch.argsort",
"torch.cat",
"torch.nn.CrossEntropyLoss",
"collections.defaultdict",
"torch.nn.LayerNorm",
"torch.sigmoid",
"torch.clamp",
"torch.nn.Linear",
"torch.zeros",
"torch.tensor"
] | [((1566, 1599), 'collections.defaultdict', 'defaultdict', (['(lambda : None)', 'batch'], {}), '(lambda : None, batch)\n', (1577, 1599), False, 'from collections import defaultdict\n'), ((3675, 3721), 'torch.argsort', 'torch.argsort', (['scores'], {'dim': '(-1)', 'descending': '(True)'}), '(scores, dim=-1, descending=Tr... |
import sys
import typing
# import numpy as np
# import numba as nb
# @nb.njit((), cache=True)
# def solve() -> typing.NoReturn:
# ...
def main() -> typing.NoReturn:
n, k = map(int, input().split())
s = sys.stdin.read().split()
s.sort()
print(''.join(s[:k]))
main()
| [
"sys.stdin.read"
] | [((237, 253), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (251, 253), False, 'import sys\n')] |
#coding=utf-8
# coding=utf-8
'''
Created on 2014-1-5
@author: ETHAN
'''
from rest_framework import generics
from doraemon.api.project.serializer import project_serializer
from rest_framework.permissions import AllowAny
from doraemon.project.models import Version
from doraemon.api.project.render import project_version_... | [
"doraemon.project.models.Version.objects.get_versions",
"doraemon.project.models.Version.objects.get"
] | [((726, 766), 'doraemon.project.models.Version.objects.get_versions', 'Version.objects.get_versions', (['project_id'], {}), '(project_id)\n', (754, 766), False, 'from doraemon.project.models import Version\n'), ((1112, 1143), 'doraemon.project.models.Version.objects.get', 'Version.objects.get', (['version_id'], {}), '(... |
import tensorflow as tf
import pdb
def _phase_shift(I, r, batch_size = 10):
# Helper function with main phase shift operation
# pdb.set_trace()
_, a, b, c = I.get_shape().as_list()
X = tf.reshape(I, (batch_size, a, b, r, r))
X = tf.transpose(X, (0, 1, 2, 4, 3)) # bsize, a, b, 1, 1
X = tf.split(X... | [
"tensorflow.reshape",
"tensorflow.concat",
"tensorflow.transpose",
"tensorflow.squeeze",
"tensorflow.split",
"tensorflow.expand_dims"
] | [((200, 239), 'tensorflow.reshape', 'tf.reshape', (['I', '(batch_size, a, b, r, r)'], {}), '(I, (batch_size, a, b, r, r))\n', (210, 239), True, 'import tensorflow as tf\n'), ((248, 280), 'tensorflow.transpose', 'tf.transpose', (['X', '(0, 1, 2, 4, 3)'], {}), '(X, (0, 1, 2, 4, 3))\n', (260, 280), True, 'import tensorflo... |
import unittest
from parameterized import parameterized
from integration_tests.dataproc_test_case import DataprocTestCase
class HBaseTestCase(DataprocTestCase):
COMPONENT = 'hbase'
INIT_ACTION = 'gs://dataproc-initialization-actions/hbase/hbase.sh'
def verify_instance(self, name):
ret_code, stdo... | [
"unittest.main",
"parameterized.parameterized.expand"
] | [((719, 975), 'parameterized.parameterized.expand', 'parameterized.expand', (["[('SINGLE', '1.2', ['m']), ('STANDARD', '1.2', ['m']), ('HA', '1.2', ['m-0'\n ]), ('SINGLE', '1.3', ['m']), ('STANDARD', '1.3', ['m']), ('HA', '1.3',\n ['m-0'])]"], {'testcase_func_name': 'DataprocTestCase.generate_verbose_test_name'})... |
from unittest import TestCase
from p33 import can_digit_cancel, p33
class P33_Test(TestCase):
def test_p33(self):
self.assertEqual(p33(), 100)
class Can_Digit_Cancel_Test(TestCase):
def test_trivial(self):
self.assertEqual(can_digit_cancel(30, 50), False)
def test_49_98(self):
... | [
"p33.p33",
"p33.can_digit_cancel"
] | [((144, 149), 'p33.p33', 'p33', ([], {}), '()\n', (147, 149), False, 'from p33 import can_digit_cancel, p33\n'), ((249, 273), 'p33.can_digit_cancel', 'can_digit_cancel', (['(30)', '(50)'], {}), '(30, 50)\n', (265, 273), False, 'from p33 import can_digit_cancel, p33\n'), ((338, 362), 'p33.can_digit_cancel', 'can_digit_c... |
import random
import sys
from introcs.stdlib import stdio
stake = int(sys.argv[1])
goal = int(sys.argv[2])
trials = int(sys.argv[3])
bets = 0
wins = 0
for t in range(trials):
cash = stake
while (cash > 0) and (cash < goal):
bets += 1
if random.randrange(0, 2) == 0:
cash += 1
... | [
"introcs.stdlib.stdio.writeln",
"random.randrange"
] | [((392, 436), 'introcs.stdlib.stdio.writeln', 'stdio.writeln', (['f"""{100 * wins // trials}% 이김"""'], {}), "(f'{100 * wins // trials}% 이김')\n", (405, 436), False, 'from introcs.stdlib import stdio\n'), ((437, 480), 'introcs.stdlib.stdio.writeln', 'stdio.writeln', (['f"""평균 베팅 수: {bets // trials}"""'], {}), "(f'평균 베팅 수... |
from node import Node
from let import Let
from copy import deepcopy as copy
from map import Map, KVPair
from tools import ItemStream
import fern
class Function(Node):
def __init__(self, child, args=None):
Node.__init__(self)
self.child = child
self.reparent(child)
self.args = args o... | [
"tools.ItemStream",
"copy.deepcopy",
"node.Node.__init__",
"map.Map",
"fern.errors.TypeError",
"map.KVPair",
"let.Let"
] | [((218, 237), 'node.Node.__init__', 'Node.__init__', (['self'], {}), '(self)\n', (231, 237), False, 'from node import Node\n'), ((549, 554), 'let.Let', 'Let', ([], {}), '()\n', (552, 554), False, 'from let import Let\n'), ((754, 759), 'map.Map', 'Map', ([], {}), '()\n', (757, 759), False, 'from map import Map, KVPair\n... |
import os
import sys
import logging
import colorlog
import traceback
from datetime import datetime
def get_root_log_level():
"""
Log level of root logger
:return:
DEBUG: all logs
INFO: except debug, all logs
WARNING: except debug, info and warning, all logs
ERROR: only error and critical l... | [
"colorlog.basicConfig",
"logging.root.setLevel",
"traceback.format_exception",
"logging.Filter",
"os.environ.get",
"datetime.datetime.utcnow",
"sys.exc_info",
"logging.getLogger"
] | [((376, 417), 'os.environ.get', 'os.environ.get', (['"""ROOT_LOG_LEVEL"""', '"""DEBUG"""'], {}), "('ROOT_LOG_LEVEL', 'DEBUG')\n", (390, 417), False, 'import os\n'), ((741, 785), 'os.environ.get', 'os.environ.get', (['"""CURRENT_LOG_LEVEL"""', '"""DEBUG"""'], {}), "('CURRENT_LOG_LEVEL', 'DEBUG')\n", (755, 785), False, '... |
#!/usr/bin/env python
# coding: utf-8
# # Plot & analyse results
# In[21]:
import os
import pandas as pd
import numpy as np
import glob
import seaborn as sns
from matplotlib import pyplot as plt
import statistics
# In[22]:
# Read in data
df_gschwind = pd.read_csv('/cubric/data/c1639425/Monkey_Brains/results_df... | [
"matplotlib.pyplot.subplot",
"pandas.read_csv",
"seaborn.boxplot",
"pandas.melt",
"scipy.stats.wilcoxon",
"matplotlib.pyplot.subplots"
] | [((261, 385), 'pandas.read_csv', 'pd.read_csv', (['"""/cubric/data/c1639425/Monkey_Brains/results_df/proportion_gschwind_bst_ncc_subic_antthal_globpal_df"""'], {}), "(\n '/cubric/data/c1639425/Monkey_Brains/results_df/proportion_gschwind_bst_ncc_subic_antthal_globpal_df'\n )\n", (272, 385), True, 'import pandas a... |
# Copyright 2019 Adobe. All rights reserved.
# This file is licensed to you 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 ... | [
"himl.config_generator.ConfigProcessor",
"kompos.display"
] | [((776, 793), 'himl.config_generator.ConfigProcessor', 'ConfigProcessor', ([], {}), '()\n', (791, 793), False, 'from himl.config_generator import ConfigProcessor\n'), ((1657, 1685), 'kompos.display', 'display', (['cmd'], {'color': '"""yellow"""'}), "(cmd, color='yellow')\n", (1664, 1685), False, 'from kompos import dis... |
import numpy as np
# importing from alphaBetaLab the needed components
from alphaBetaLab.abOptionManager import abOptions
from alphaBetaLab.abEstimateAndSave import triMeshSpecFromMshFile, abEstimateAndSaveTriangularEtopo1
# definition of the spectral grid
dirs = np.linspace(0, 2*np.pi, 25)
nfreq = 25
minfrq = .04118... | [
"alphaBetaLab.abEstimateAndSave.abEstimateAndSaveTriangularEtopo1",
"alphaBetaLab.abOptionManager.abOptions",
"alphaBetaLab.abEstimateAndSave.triMeshSpecFromMshFile",
"numpy.linspace"
] | [((266, 295), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(25)'], {}), '(0, 2 * np.pi, 25)\n', (277, 295), True, 'import numpy as np\n'), ((482, 513), 'alphaBetaLab.abEstimateAndSave.triMeshSpecFromMshFile', 'triMeshSpecFromMshFile', (['mshfile'], {}), '(mshfile)\n', (504, 513), False, 'from alphaBetaLab.... |
import numpy as np
import scipy
import scipy.misc
import os
def save_img(img, dir, name, count):
if os.path.isdir(dir) is False:
os.makedirs(dir)
n = int(np.sqrt(img.shape[0]))
img = img.data.cpu().numpy().transpose(0,2,3,1)
out_img = np.zeros((64*n,64*n,3))
for r in range(n):
for c... | [
"os.path.isdir",
"numpy.zeros",
"os.makedirs",
"numpy.sqrt"
] | [((260, 289), 'numpy.zeros', 'np.zeros', (['(64 * n, 64 * n, 3)'], {}), '((64 * n, 64 * n, 3))\n', (268, 289), True, 'import numpy as np\n'), ((105, 123), 'os.path.isdir', 'os.path.isdir', (['dir'], {}), '(dir)\n', (118, 123), False, 'import os\n'), ((142, 158), 'os.makedirs', 'os.makedirs', (['dir'], {}), '(dir)\n', (... |
# entry point for the websocket loop
import gevent.monkey
gevent.monkey.patch_thread()
from ws4redis.uwsgi_runserver import uWSGIWebsocketServer
application = uWSGIWebsocketServer()
| [
"ws4redis.uwsgi_runserver.uWSGIWebsocketServer"
] | [((160, 182), 'ws4redis.uwsgi_runserver.uWSGIWebsocketServer', 'uWSGIWebsocketServer', ([], {}), '()\n', (180, 182), False, 'from ws4redis.uwsgi_runserver import uWSGIWebsocketServer\n')] |
#!/usr/bin/env python3
# Script to send GET request to the Heroku app URL every 25 minutes to prevent the app from sleeping.
import os
import logging
try:
import requests
except:
os.system("pip3 install requests")
import requests
from time import sleep
if __name__ == "__main__":
logging.basicConfig(fil... | [
"logging.basicConfig",
"os.system",
"time.sleep",
"requests.get",
"os.getenv",
"logging.getLogger"
] | [((297, 423), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""/app/.vubuntu/assets/logs/self-ping.py.log"""', 'format': '"""%(asctime)s %(message)s"""', 'filemode': '"""w"""'}), "(filename='/app/.vubuntu/assets/logs/self-ping.py.log',\n format='%(asctime)s %(message)s', filemode='w')\n", (316, 42... |
import time
import sys
from src import main
from watchdog.observers import Observer
from watchdog.events import RegexMatchingEventHandler
from IPython.lib.deepreload import reload
exclude = (
'sys',
'os',
'os.path',
'builtins',
'__main__',
'numpy',
'numpy._globals',
'json... | [
"src.main.generate_files",
"IPython.lib.deepreload.reload",
"time.sleep",
"watchdog.observers.Observer"
] | [((1039, 1068), 'IPython.lib.deepreload.reload', 'reload', (['main'], {'exclude': 'exclude'}), '(main, exclude=exclude)\n', (1045, 1068), False, 'from IPython.lib.deepreload import reload\n'), ((1078, 1099), 'src.main.generate_files', 'main.generate_files', ([], {}), '()\n', (1097, 1099), False, 'from src import main\n... |
from pathlib import Path
from typing import List
# from IPython.display import display
import pandas as pd
# import numpy as np
# from sklearn import metrics
from helpers.helpers_analysis.loaders import (
load_snv_datasets,
load_prediction_dataset,
load_elaspic_datasets,
load_reference_dataset,
lo... | [
"helpers.helpers_analysis.add_num_interface_patients_disruptive_interactor.add_num_interface_patients_disruptive_interactor",
"helpers.helpers_analysis.get_protein_to_gene_dict.get_protein_to_gene_dict",
"helpers.helpers_analysis.get_elaspic_proteins.get_elaspic_proteins",
"helpers.helpers_analysis.counts_bas... | [((2369, 2382), 'helpers.mylogger.get_handler', 'get_handler', ([], {}), '()\n', (2380, 2382), False, 'from helpers.mylogger import get_handler\n'), ((2390, 2417), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2407, 2417), False, 'import logging\n'), ((2721, 2764), 'pathlib.Path', 'Path... |
# Copyright (c) 2020, <NAME>.
# Distributed under the MIT License. See LICENSE for more info.
"""
Scree plot
==========
This example will show the eigenvalues of principal components
from a
`principal component analysis
<https://en.wikipedia.org/wiki/Principal_component_analysis>`_.
"""
from matplotlib import pyplot a... | [
"pandas.DataFrame",
"sklearn.datasets.load_wine",
"matplotlib.pyplot.show",
"sklearn.preprocessing.scale",
"psynlig.pca_scree",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.rcParams.update",
"sklearn.decomposition.PCA"
] | [((493, 517), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn"""'], {}), "('seaborn')\n", (506, 517), True, 'from matplotlib import pyplot as plt\n'), ((518, 556), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 16}"], {}), "({'font.size': 16})\n", (537, 556), True, 'from matp... |