code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright 2021 Fedlearn authors.
# 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 writi... | [
"pandas.read_csv",
"numpy.random.choice",
"sklearn.model_selection.train_test_split",
"pandas.merge",
"sklearn.datasets.fetch_20newsgroups",
"numpy.array",
"numpy.vstack",
"pandas.DataFrame",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((4240, 4277), 'pandas.DataFrame', 'pd.DataFrame', (['newsgroups.target_names'], {}), '(newsgroups.target_names)\n', (4252, 4277), True, 'import pandas as pd\n'), ((4320, 4377), 'pandas.merge', 'pd.merge', (['df', 'targets'], {'left_on': '"""target"""', 'right_index': '(True)'}), "(df, targets, left_on='target', right... |
# (c) MIT License Copyright 2014 <NAME>
# Please reuse, modify or distribute freely.
from collections import OrderedDict
import tkinter as tk
class StripChart( tk.Frame ):
def __init__( self, parent, scale, historySize, trackColors, *args, **opts ):
# Initialize
super().__init__( parent, *args, **opts ... | [
"tkinter.Canvas",
"collections.OrderedDict",
"tkinter.Tk",
"random.choice"
] | [((3213, 3220), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (3218, 3220), True, 'import tkinter as tk\n'), ((348, 361), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (359, 361), False, 'from collections import OrderedDict\n'), ((605, 700), 'tkinter.Canvas', 'tk.Canvas', (['self'], {'height': '(self._chartHei... |
from apps.quiver.models import AnalyticsService, AnalyticsServiceExecution
from django.shortcuts import render, HttpResponseRedirect
from django.core.exceptions import PermissionDenied
from django.views.generic import FormView, CreateView, ListView, DetailView, UpdateView
from django.contrib.auth.mixins import LoginRe... | [
"django.shortcuts.render",
"apps.quiver.models.AnalyticsService.objects.get",
"django.core.exceptions.PermissionDenied",
"apps.projects.models.Datarow.objects.filter",
"numpy.transpose",
"apps.quiver.models.AnalyticsService.objects.filter",
"random.randrange",
"django.http.JsonResponse",
"apps.proje... | [((3445, 3477), 'django.shortcuts.HttpResponseRedirect', 'HttpResponseRedirect', (['"""/quiver/"""'], {}), "('/quiver/')\n", (3465, 3477), False, 'from django.shortcuts import render, HttpResponseRedirect\n'), ((6457, 6508), 'django.shortcuts.render', 'render', (['request', '"""quiver/index.html"""', 'dataForRender'], ... |
"""
Mapping from OOType opcodes to JVM MicroInstructions. Most of these
come from the oosupport directory.
"""
from pypy.translator.oosupport.metavm import \
PushArg, PushAllArgs, StoreResult, InstructionList, New, DoNothing, Call,\
SetField, GetField, DownCast, RuntimeNew, OOString, OOUnicode, \
Cas... | [
"pypy.translator.oosupport.metavm.PushPrimitive",
"pypy.translator.oosupport.metavm.InstructionList",
"pypy.translator.oosupport.metavm.PushArg"
] | [((1445, 1493), 'pypy.translator.oosupport.metavm.InstructionList', 'InstructionList', (['(PushAllArgs, val, StoreResult)'], {}), '((PushAllArgs, val, StoreResult))\n', (1460, 1493), False, 'from pypy.translator.oosupport.metavm import PushArg, PushAllArgs, StoreResult, InstructionList, New, DoNothing, Call, SetField, ... |
from hamcrest import *
from tests.helpers.sql import sql_query
class TestSqlQueries:
def test_sql_select(self, namespace, index, item):
# Given("Create namespace with item")
db, namespace_name = namespace
item_definition = item
# When ("Execute SQL query SELECT")
query = f... | [
"tests.helpers.sql.sql_query"
] | [((373, 400), 'tests.helpers.sql.sql_query', 'sql_query', (['namespace', 'query'], {}), '(namespace, query)\n', (382, 400), False, 'from tests.helpers.sql import sql_query\n'), ((1027, 1054), 'tests.helpers.sql.sql_query', 'sql_query', (['namespace', 'query'], {}), '(namespace, query)\n', (1036, 1054), False, 'from tes... |
from collections import defaultdict
from localstack.utils.common import to_str
def multi_value_dict_for_list(elements):
temp_mv_dict = defaultdict(list)
for key in elements:
if isinstance(key, (list, tuple)):
key, value = key
else:
value = elements[key]
key = to... | [
"collections.defaultdict",
"localstack.utils.common.to_str"
] | [((141, 158), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (152, 158), False, 'from collections import defaultdict\n'), ((318, 329), 'localstack.utils.common.to_str', 'to_str', (['key'], {}), '(key)\n', (324, 329), False, 'from localstack.utils.common import to_str\n')] |
## Copyright 2019 <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by... | [
"tensorflow.Variable",
"tensorflow.ones",
"tensorflow.multiply",
"tensorflow.nn.l2_loss",
"tensorflow.random_uniform",
"dgp.sorf_transform.sorf_transform",
"tensorflow.subtract",
"tensorflow.exp"
] | [((1451, 1516), 'tensorflow.random_uniform', 'tf.random_uniform', (['[1, d]'], {'minval': '(0)', 'maxval': '(1.0)', 'dtype': 'tf.float32'}), '([1, d], minval=0, maxval=1.0, dtype=tf.float32)\n', (1468, 1516), True, 'import tensorflow as tf\n'), ((1526, 1541), 'tensorflow.ones', 'tf.ones', (['[1, d]'], {}), '([1, d])\n'... |
import cv2
import numpy as np
from .augmentor import DataAugment
import math
class Rotate(DataAugment):
"""
Continuous rotatation.
The sample size for x- and y-axes should be at least sqrt(2) times larger
than the input size to make sure there is no non-valid region after center-crop.
Args:
... | [
"numpy.copy",
"cv2.warpAffine",
"numpy.asarray",
"math.cos",
"numpy.array",
"numpy.dot",
"numpy.moveaxis",
"cv2.getRotationMatrix2D",
"math.sin",
"numpy.random.RandomState"
] | [((1025, 1038), 'numpy.copy', 'np.copy', (['imgs'], {}), '(imgs)\n', (1032, 1038), True, 'import numpy as np\n'), ((1960, 1976), 'numpy.asarray', 'np.asarray', (['axis'], {}), '(axis)\n', (1970, 1976), True, 'import numpy as np\n'), ((2086, 2107), 'math.cos', 'math.cos', (['(theta / 2.0)'], {}), '(theta / 2.0)\n', (209... |
import re
# Used to access the DATA_TYPES dictionary
INT = "INT"
FLOAT = "FLOAT"
BOOLEAN = "BOOLEAN"
INT_LIST = "INT_LIST"
FLOAT_LIST = "FLOAT_LIST"
BOOLEAN_LIST = "BOOLEAN_LIST"
VOID = "VOID"
OBJECT = "OBJECT"
SEMANTIC_ERROR = 99
# Regular expressiones to match data types
REGEX_BOOLEAN = r'true|false'
regex_boolean ... | [
"re.compile"
] | [((322, 347), 're.compile', 're.compile', (['REGEX_BOOLEAN'], {}), '(REGEX_BOOLEAN)\n', (332, 347), False, 'import re\n'), ((388, 409), 're.compile', 're.compile', (['REGEX_INT'], {}), '(REGEX_INT)\n', (398, 409), False, 'import re\n'), ((459, 482), 're.compile', 're.compile', (['REGEX_FLOAT'], {}), '(REGEX_FLOAT)\n', ... |
import FWCore.ParameterSet.Config as cms
simEcalDigis = cms.EDProducer("EcalSelectiveReadoutProducer",
# Label of input EB and EE digi collections
digiProducer = cms.string('simEcalUnsuppressedDigis'),
# Instance name of input EB digi collections
EBdigiCollection = cms.string(''),
# Instance name... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.double",
"FWCore.ParameterSet.Config.vint32",
"FWCore.ParameterSet.Config.vdouble",
"FWCore.ParameterSet.Config.untracked.int32",
"FWCore.ParameterSet.Config.int32",
"FWCore.ParameterSet.Config.untracked.bool",
"FWCore.ParameterSet.Confi... | [((171, 209), 'FWCore.ParameterSet.Config.string', 'cms.string', (['"""simEcalUnsuppressedDigis"""'], {}), "('simEcalUnsuppressedDigis')\n", (181, 209), True, 'import FWCore.ParameterSet.Config as cms\n'), ((284, 298), 'FWCore.ParameterSet.Config.string', 'cms.string', (['""""""'], {}), "('')\n", (294, 298), True, 'imp... |
# Generated from jsgParser.g4 by ANTLR 4.9
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
from typing import TextIO
else:
from typing.io import TextIO
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u77... | [
"io.StringIO"
] | [((240, 250), 'io.StringIO', 'StringIO', ([], {}), '()\n', (248, 250), False, 'from io import StringIO\n')] |
#!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Modified by <NAME> at SNU Software Platform Lab for
# SWPP fall 2020 lecture.
import sys
i... | [
"functools.wraps",
"re.compile"
] | [((1155, 1166), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (1160, 1166), False, 'from functools import wraps\n'), ((2576, 2608), 're.compile', 're.compile', (['"""<td>\\\\w{1,60}</td>"""'], {}), "('<td>\\\\w{1,60}</td>')\n", (2586, 2608), False, 'import re\n')] |
from typing import Optional
import requests
from app.core import config
from app.services.bgm_tv.model import UserInfo, SubjectWithEps
class BgmApi:
def __init__(self, mirror=False):
self.session = requests.Session()
if mirror:
self.host = "mirror.api.bgm.rin.cat"
self.se... | [
"app.services.bgm_tv.model.UserInfo.parse_obj",
"requests.Session",
"app.services.bgm_tv.model.SubjectWithEps.parse_obj"
] | [((214, 232), 'requests.Session', 'requests.Session', ([], {}), '()\n', (230, 232), False, 'import requests\n'), ((894, 921), 'app.services.bgm_tv.model.SubjectWithEps.parse_obj', 'SubjectWithEps.parse_obj', (['r'], {}), '(r)\n', (918, 921), False, 'from app.services.bgm_tv.model import UserInfo, SubjectWithEps\n'), ((... |
''' The most basic way to use the Private API. I recommend renaming the file .env
to .env and filling out the gemini api key information. The dotenv package loads the .env (or .env)
file and the os.environ() function reads the values from the file.ß
'''
import os
import robin_stocks.gemini as g
from dotenv import load... | [
"robin_stocks.gemini.login",
"robin_stocks.gemini.get_trades_for_crypto"
] | [((352, 430), 'robin_stocks.gemini.login', 'g.login', (["os.environ['gemini_account_key']", "os.environ['gemini_account_secret']"], {}), "(os.environ['gemini_account_key'], os.environ['gemini_account_secret'])\n", (359, 430), True, 'import robin_stocks.gemini as g\n'), ((450, 495), 'robin_stocks.gemini.get_trades_for_c... |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.core.validators import MinValueValidator
# Create your models here.
class Profile(models.Model):
""" Extend built-in Django User model with cash v... | [
"django.db.models.OneToOneField",
"django.db.models.FloatField",
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.dispatch.receiver",
"django.core.validators.MinValueValidator",
"django.db.models.CharField"
] | [((584, 616), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'User'}), '(post_save, sender=User)\n', (592, 616), False, 'from django.dispatch import receiver\n'), ((810, 842), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'User'}), '(post_save, sender=User)\n', (818, 842), False... |
import re
from .Node import Node
class XGBoostNode(Node):
FLOAT_REGEX = '[+-]?\d+(\.\d+)?([eE][+-]?\d+)?'
BRANCH_REGEX = re.compile(f'(?P<branch>\d+):\[(?P<feature>\w+)(?P<comp><)(?P<value>{FLOAT_REGEX})\]')
LEAF_REGEX = re.compile(f'(?P<leaf>\d+):leaf=(?P<value>{FLOAT_REGEX})')
FEATURE_REGEX = re.c... | [
"re.compile"
] | [((133, 233), 're.compile', 're.compile', (['f"""(?P<branch>\\\\d+):\\\\[(?P<feature>\\\\w+)(?P<comp><)(?P<value>{FLOAT_REGEX})\\\\]"""'], {}), "(\n f'(?P<branch>\\\\d+):\\\\[(?P<feature>\\\\w+)(?P<comp><)(?P<value>{FLOAT_REGEX})\\\\]'\n )\n", (143, 233), False, 'import re\n'), ((237, 296), 're.compile', 're.comp... |
import flask_login
from .application import app
from .models import DbUser
login_manager = flask_login.LoginManager() # pylint: disable=invalid-name
login_manager.init_app(app)
login_manager.user_loader(lambda user_id: DbUser.query.filter_by(id=user_id).first())
login_required = flask_login.login_required
@login_ma... | [
"flask.render_template",
"flask_login.LoginManager",
"flask.request.url.replace",
"flask.url_for",
"flask.redirect"
] | [((92, 118), 'flask_login.LoginManager', 'flask_login.LoginManager', ([], {}), '()\n', (116, 118), False, 'import flask_login\n'), ((921, 984), 'flask.render_template', 'render_template', (['"""index.html"""'], {'byline': 'byline', 'title': '"""Azure CLI"""'}), "('index.html', byline=byline, title='Azure CLI')\n", (936... |
#!/usr/bin/env python
import json
import os
import subprocess
import sys
def fileExistsAndNonEmpty(filename):
if not os.path.exists(filename):
return False
return os.stat(filename).st_size > 0
class AssemblerRunner(object):
def __init__(self, sample_id, sample_seq, bam_file):
with open("st... | [
"os.path.exists",
"os.stat",
"subprocess.Popen",
"os.path.join",
"os.getpid",
"json.load",
"os.system",
"sys.stdout.flush",
"os.path.abspath",
"json.dump"
] | [((122, 146), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (136, 146), False, 'import os\n'), ((747, 794), 'os.path.join', 'os.path.join', (['self.output_dir', 'self.sample_name'], {}), '(self.output_dir, self.sample_name)\n', (759, 794), False, 'import os\n'), ((856, 901), 'os.path.join', 'o... |
# -*- coding:utf-8 -*-
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
import logging
def logger_fn(name, filepath, level = logging.DEBUG):
""" Function for creating log manager
Args:
name: name for log manager
filepath: file ... | [
"logging.getLogger",
"logging.Formatter",
"logging.StreamHandler",
"logging.FileHandler"
] | [((442, 465), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (459, 465), False, 'import logging\n'), ((497, 530), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (518, 530), False, 'import logging\n'), ((537, 576), 'logging.FileHandler', 'logging.FileHand... |
from drf_extra_fields.geo_fields import PointField
from rest_framework import serializers
from phr.insteducativa.models import InstitucionEducativa
from phr.ubigeo.models import UbigeoDepartamento, UbigeoDistrito, UbigeoProvincia
class InstEducativaSerializer(serializers.ModelSerializer):
ubicacion = PointField(... | [
"phr.ubigeo.models.UbigeoProvincia.objects.get",
"rest_framework.serializers.SerializerMethodField",
"phr.ubigeo.models.UbigeoDepartamento.objects.get",
"drf_extra_fields.geo_fields.PointField",
"phr.ubigeo.models.UbigeoDistrito.objects.get"
] | [((309, 335), 'drf_extra_fields.geo_fields.PointField', 'PointField', ([], {'required': '(False)'}), '(required=False)\n', (319, 335), False, 'from drf_extra_fields.geo_fields import PointField\n'), ((362, 397), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {}), '()\n', (... |
## list
array = [1,2,3,"four","five","six",True]
print(array[:3])
dust = {
'영등포구': 50,
'강남구' : 40
}
## Dictionary
print(dust['영등포구'])
dust2 = dict(abc=50)
print(dust2)
## 랜덤으로 coffee메뉴 3개 뽑기
import random
coffee = ['아아','뜨아','라떼','믹스','핫초코']
coffee_fav=coffee[1:4] #내가 좋아하는 메뉴 일부 출력
print(coffee_fav)
ls... | [
"random.choice"
] | [((748, 767), 'random.choice', 'random.choice', (['manu'], {}), '(manu)\n', (761, 767), False, 'import random\n'), ((344, 365), 'random.choice', 'random.choice', (['coffee'], {}), '(coffee)\n', (357, 365), False, 'import random\n')] |
from gevent import monkey
monkey.patch_all()
import sys
import purpledrop.server as server
from purpledrop.purpledrop import list_purpledrop_devices, PurpleDropDevice, PurpleDropController
devices = list_purpledrop_devices()
if(len(devices) == 0):
print("No PurpleDrop USB device found")
sys.exit(1)
elif len(d... | [
"purpledrop.server.run_server",
"purpledrop.purpledrop.PurpleDropDevice",
"purpledrop.purpledrop.list_purpledrop_devices",
"gevent.monkey.patch_all",
"purpledrop.purpledrop.PurpleDropController",
"sys.exit"
] | [((27, 45), 'gevent.monkey.patch_all', 'monkey.patch_all', ([], {}), '()\n', (43, 45), False, 'from gevent import monkey\n'), ((201, 226), 'purpledrop.purpledrop.list_purpledrop_devices', 'list_purpledrop_devices', ([], {}), '()\n', (224, 226), False, 'from purpledrop.purpledrop import list_purpledrop_devices, PurpleDr... |
from typing import Any
from urllib.parse import urlparse
from rediscluster import RedisCluster
from .redis import RedisStorage
class RedisClusterStorage(RedisStorage):
"""
Rate limit storage with redis cluster as backend.
Depends on `redis-py-cluster` library.
"""
@classmethod
def from_uri... | [
"rediscluster.RedisCluster",
"urllib.parse.urlparse"
] | [((668, 681), 'urllib.parse.urlparse', 'urlparse', (['uri'], {}), '(uri)\n', (676, 681), False, 'from urllib.parse import urlparse\n'), ((986, 1009), 'rediscluster.RedisCluster', 'RedisCluster', ([], {}), '(**options)\n', (998, 1009), False, 'from rediscluster import RedisCluster\n')] |
def alien_order(words):
# Underspecified input 0
if not words:
return []
# Underspecified input 1
if len(words) == 1:
return "".join(sorted(set(list(words[0]))))
nodes = []
adj_list = []
chars = set()
# 1. Take each word pair
for i, word1 in enumerate(words[:-1]):
... | [
"pytest.mark.parametrize",
"pytest.main"
] | [((2731, 2877), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""words,expected"""', "[(['zy', 'zx'], 'yxz'), (['wrt', 'wrf', 'er', 'ett', 'rftt'], 'wertf'), ([\n 'ac', 'ab', 'b'], 'acb')]"], {}), "('words,expected', [(['zy', 'zx'], 'yxz'), (['wrt',\n 'wrf', 'er', 'ett', 'rftt'], 'wertf'), (['ac', 'ab'... |
from pyspark import Row
from pyspark.sql import SparkSession
"""
Row class introduction:
Row class extends the tuple hence it takes variable number of arguments, Row() is used to create the row object.
Once the row object created, we can retrieve the data from Row using index similar to tuple.
Key Points of Row Cla... | [
"pyspark.Row",
"pyspark.sql.SparkSession.builder.master"
] | [((1134, 1150), 'pyspark.Row', 'Row', (['"""Alice"""', '(18)'], {}), "('Alice', 18)\n", (1137, 1150), False, 'from pyspark import Row\n'), ((1378, 1401), 'pyspark.Row', 'Row', ([], {'name': '"""Bob"""', 'age': '(38)'}), "(name='Bob', age=38)\n", (1381, 1401), False, 'from pyspark import Row\n'), ((2124, 2142), 'pyspark... |
# models.py
from sys import path
from os.path import dirname as dir
path.append(dir(path[0]))
from app import db
class District(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(120), unique=True)
coordinates = db.Column(db.String(120), nullable=True)
def __init__(s... | [
"app.db.String",
"os.path.dirname",
"app.db.backref",
"app.db.Column",
"app.db.ForeignKey"
] | [((81, 93), 'os.path.dirname', 'dir', (['path[0]'], {}), '(path[0])\n', (84, 93), True, 'from os.path import dirname as dir\n'), ((152, 191), 'app.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (161, 191), False, 'from app import db\n'), ((501, 540), 'app.db.Co... |
#!/usr/bin/env python3
import os, sys
dr = os.getenv('DISBATCH_ROOT')
if dr and dr not in sys.path:
sys.path.append(dr)
try:
import disbatch
except:
print(f'disBatch environment is incomplete. Check:\n\tDISBATCH_ROOT {dr!r}.', file=sys.stderr)
sys.exit(1)
dbExec = os.path.join(os.path.dirnam... | [
"os.getenv",
"os.path.dirname",
"os.execv",
"sys.exit",
"sys.path.append"
] | [((45, 71), 'os.getenv', 'os.getenv', (['"""DISBATCH_ROOT"""'], {}), "('DISBATCH_ROOT')\n", (54, 71), False, 'import os, sys\n'), ((357, 422), 'os.execv', 'os.execv', (['sys.executable', '([sys.executable, dbExec] + sys.argv[1:])'], {}), '(sys.executable, [sys.executable, dbExec] + sys.argv[1:])\n', (365, 422), False, ... |
from aiohttp import web
from prometheus_client import generate_latest
from prometheus_client.core import REGISTRY
def metric_to_text():
return generate_latest(REGISTRY).decode('utf-8')
async def handle_metrics(_request):
return web.Response(text=metric_to_text())
async def handle_health(_request):
he... | [
"aiohttp.web.Response",
"prometheus_client.generate_latest"
] | [((372, 424), 'aiohttp.web.Response', 'web.Response', ([], {'status': 'health_status', 'text': 'health_text'}), '(status=health_status, text=health_text)\n', (384, 424), False, 'from aiohttp import web\n'), ((150, 175), 'prometheus_client.generate_latest', 'generate_latest', (['REGISTRY'], {}), '(REGISTRY)\n', (165, 17... |
from django.http.response import Http404
from django.http import HttpResponse
from blogs.helpers import unmark, clean_text
from blogs.views.blog import resolve_address
from feedgen.feed import FeedGenerator
import mistune
def feed(request):
blog = resolve_address(request)
if not blog:
raise Http404... | [
"django.http.HttpResponse",
"blogs.views.blog.resolve_address",
"mistune.html",
"blogs.helpers.unmark",
"django.http.response.Http404",
"feedgen.feed.FeedGenerator"
] | [((256, 280), 'blogs.views.blog.resolve_address', 'resolve_address', (['request'], {}), '(request)\n', (271, 280), False, 'from blogs.views.blog import resolve_address\n'), ((449, 464), 'feedgen.feed.FeedGenerator', 'FeedGenerator', ([], {}), '()\n', (462, 464), False, 'from feedgen.feed import FeedGenerator\n'), ((313... |
from time import strftime, gmtime, time
from collections import defaultdict
import tensorflow as tf
from utility.aggregator import Aggregator
from utility.display import pwc
def timeit(func, *args, name=None, to_print=True,
return_duration=False, **kwargs):
start_time = gmtime()
start = time()
r... | [
"utility.display.pwc",
"time.strftime",
"tensorflow.summary.experimental.get_step",
"collections.defaultdict",
"time.time",
"tensorflow.summary.scalar",
"time.gmtime"
] | [((287, 295), 'time.gmtime', 'gmtime', ([], {}), '()\n', (293, 295), False, 'from time import strftime, gmtime, time\n'), ((308, 314), 'time.time', 'time', ([], {}), '()\n', (312, 314), False, 'from time import strftime, gmtime, time\n'), ((360, 366), 'time.time', 'time', ([], {}), '()\n', (364, 366), False, 'from time... |
import io
import multiprocessing
import pathlib
from urllib.parse import quote_plus
import pytest
import yappi
semaphore = multiprocessing.Semaphore(1)
class PytestProfiler:
def __init__(self, outdir):
self.func_stats_summary = io.StringIO()
self.outdir = pathlib.Path(outdir)
def pytest_ses... | [
"yappi.start",
"pathlib.Path",
"yappi.stop",
"yappi.get_func_stats",
"multiprocessing.Semaphore",
"io.StringIO",
"pytest.hookimpl",
"urllib.parse.quote_plus",
"yappi.clear_stats"
] | [((125, 153), 'multiprocessing.Semaphore', 'multiprocessing.Semaphore', (['(1)'], {}), '(1)\n', (150, 153), False, 'import multiprocessing\n'), ((683, 716), 'pytest.hookimpl', 'pytest.hookimpl', ([], {'hookwrapper': '(True)'}), '(hookwrapper=True)\n', (698, 716), False, 'import pytest\n'), ((244, 257), 'io.StringIO', '... |
#/bin/python3
## Step1 scan recursively over all files
import os
import re
import pdb
import datetime
path = "./notes"
dest = "_posts"
magic_prefix = "Active-"
def extractModifiedDate(string):
regexp = r"\d+-\d+-\d+T\d+:\d+:\d+.\d+Z"
date_strings_all = re.findall(regexp,string)
date = None
if (len(da... | [
"datetime.datetime.strptime",
"os.path.join",
"os.path.split",
"re.findall",
"os.walk"
] | [((2537, 2550), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (2544, 2550), False, 'import os\n'), ((264, 290), 're.findall', 're.findall', (['regexp', 'string'], {}), '(regexp, string)\n', (274, 290), False, 'import re\n'), ((358, 430), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['date_strings_al... |
#!/usr/bin/env python
import unittest
# import your test modules
import test_unittest_01
import test_unittest_02
import test_unittest_03
import test_unittest_04
if __name__ == '__main__':
# initialize the test suite
loader = unittest.TestLoader()
suite = unittest.TestSuite()
# add tests to the test... | [
"unittest.TestSuite",
"unittest.TextTestRunner",
"unittest.TestLoader"
] | [((236, 257), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (255, 257), False, 'import unittest\n'), ((271, 291), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (289, 291), False, 'import unittest\n'), ((658, 694), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {'verbosity':... |
#!python3
# from https://stackoverflow.com/questions/21241708/python-get-a-list-of-selected-files-in-explorer-windows-7/52959617#52959617
import win32gui, time
from win32con import PAGE_READWRITE, MEM_COMMIT, MEM_RESERVE, MEM_RELEASE, PROCESS_ALL_ACCESS, WM_GETTEXTLENGTH, WM_GETTEXT
from commctrl import LVS_OWNERDATA, ... | [
"ctypes.addressof",
"win32com.client.Dispatch",
"win32gui.SendMessage",
"time.sleep",
"ctypes.create_string_buffer",
"win32gui.GetWindowText",
"win32gui.GetClassName",
"win32gui.EnumChildWindows"
] | [((841, 878), 'ctypes.create_string_buffer', 'ctypes.create_string_buffer', (['buf_size'], {}), '(buf_size)\n', (868, 878), False, 'import ctypes\n'), ((2629, 2650), 'win32com.client.Dispatch', 'win32.Dispatch', (['clsid'], {}), '(clsid)\n', (2643, 2650), True, 'import win32com.client as win32\n'), ((5647, 5660), 'time... |
from django.shortcuts import render, render_to_response
from django.core.mail import mail_admins
from django.contrib import messages
from django.template import RequestContext
from django.http import HttpResponseRedirect, Http404, HttpResponse
from django.views.generic.base import TemplateView
from .forms import Conta... | [
"django.http.HttpResponseRedirect",
"django.template.RequestContext",
"django.core.mail.mail_admins",
"django.contrib.messages.success"
] | [((963, 992), 'django.core.mail.mail_admins', 'mail_admins', (['subject', 'message'], {}), '(subject, message)\n', (974, 992), False, 'from django.core.mail import mail_admins\n'), ((1050, 1103), 'django.contrib.messages.success', 'messages.success', (['request', '"""Thanks for the feedback!"""'], {}), "(request, 'Than... |
from setuptools import setup
with open('README.md', 'r') as f:
long_description = f.read()
setup(
name = 'dogey',
version = '0.1',
description = 'A pythonic dogehouse API.',
long_description = long_description,
long_description_content_type = 'text/markdown',
author = 'Shadofer#7312',
... | [
"setuptools.setup"
] | [((97, 503), 'setuptools.setup', 'setup', ([], {'name': '"""dogey"""', 'version': '"""0.1"""', 'description': '"""A pythonic dogehouse API."""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', 'author': '"""Shadofer#7312"""', 'author_email': '"""<EMAIL>"""', 'python_requi... |
# coding: utf-8
"""
HyperOne
HyperOne API # noqa: E501
The version of the OpenAPI document: 0.1.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from h1.configuration import Configuration
class Billing(object):
"""NOTE: This class is auto ... | [
"six.iteritems",
"h1.configuration.Configuration"
] | [((6807, 6840), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (6820, 6840), False, 'import six\n'), ((1636, 1651), 'h1.configuration.Configuration', 'Configuration', ([], {}), '()\n', (1649, 1651), False, 'from h1.configuration import Configuration\n')] |
#!/usr/bin/env python
# -*- test-case-name: twisted.names.test.test_examples -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Print the IP address for a given hostname. eg
python gethostbyname.py www.google.com
This script does a host lookup using the default Twisted Names
resolver, ... | [
"twisted.names.client.getHostByName",
"twisted.internet.task.react",
"sys.stdout.write"
] | [((1627, 1657), 'twisted.names.client.getHostByName', 'client.getHostByName', (['hostname'], {}), '(hostname)\n', (1647, 1657), False, 'from twisted.names import client, error\n'), ((1784, 1809), 'twisted.internet.task.react', 'react', (['main', 'sys.argv[1:]'], {}), '(main, sys.argv[1:])\n', (1789, 1809), False, 'from... |
import swapper
from accelerator_abstract.models.base_ethno_racial_identity import (
BaseEthnoRacialIdentity,
)
class EthnoRacialIdentity(BaseEthnoRacialIdentity):
class Meta(BaseEthnoRacialIdentity.Meta):
swappable = swapper.swappable_setting(
BaseEthnoRacialIdentity.Meta.app_label, 'Ethno... | [
"swapper.swappable_setting"
] | [((235, 327), 'swapper.swappable_setting', 'swapper.swappable_setting', (['BaseEthnoRacialIdentity.Meta.app_label', '"""EthnoRacialIdentity"""'], {}), "(BaseEthnoRacialIdentity.Meta.app_label,\n 'EthnoRacialIdentity')\n", (260, 327), False, 'import swapper\n')] |
from __future__ import annotations
import logging
from datetime import date, datetime, timedelta
from typing import Dict, Generator, List, Optional, Union, Tuple
import pandas as pd
import metrics
from api.models import ( # noqa
ChangeDeleteLog,
County,
ProductionHorizontal,
ProductionMasterHorizont... | [
"logging.getLogger",
"collector.Collector",
"collector.Endpoint.from_yaml",
"collector.XMLParser.load_from_config",
"datetime.timedelta",
"loggers.config",
"collector.CDExporter",
"metrics.post",
"config.get_active_config",
"collector.Endpoint.load_from_config",
"api.models.County.__name__.split... | [((975, 1002), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (992, 1002), False, 'import logging\n'), ((1011, 1030), 'config.get_active_config', 'get_active_config', ([], {}), '()\n', (1028, 1030), False, 'from config import ExportDataTypes, IdentityTemplates, get_active_config\n'), ((10... |
import numpy as np
import random
import pandas as pd
import sqlalchemy
from sqlalchemy.orm import sessionmaker
from sqlalchemy.sql import select
from sqlalchemy import and_
from sqlalchemy import between
from sqlalchemy.sql import exists
from sqlalchemy import desc
from datetime import datetime, timezone, timedelta
... | [
"sqlalchemy.orm.sessionmaker",
"random.shuffle",
"sqlalchemy.create_engine",
"datetime.datetime.now",
"numpy.zeros",
"numpy.vstack",
"pandas.read_sql"
] | [((2315, 2329), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (2327, 2329), False, 'from datetime import datetime, timezone, timedelta\n'), ((2468, 2522), 'pandas.read_sql', 'pd.read_sql', (['self._df.statement', 'self._df.session.bind'], {}), '(self._df.statement, self._df.session.bind)\n', (2479, 2522), ... |
from __future__ import annotations
import os
from functools import partial
from pathlib import Path
from typing import TYPE_CHECKING, Dict
from PySide2.QtGui import QIcon, QKeySequence
from bw_tools.common.bw_node import BWNode
from bw_tools.modules.bw_settings.bw_settings import BWModuleSettings
from PySide2.QtWidg... | [
"sd.api.sdbasetypes.float2",
"pathlib.Path",
"bw_tools.common.bw_node.BWNode",
"os.access",
"sd.api.sdbasetypes.ColorRGBA",
"functools.partial",
"sd.api.sdgraphobjectframe.SDGraphObjectFrame.sNew",
"sd.api.sdhistoryutils.SDHistoryUtils.UndoGroup",
"PySide2.QtGui.QKeySequence",
"PySide2.QtWidgets.Q... | [((1788, 1798), 'bw_tools.common.bw_node.BWNode', 'BWNode', (['x0'], {}), '(x0)\n', (1794, 1798), False, 'from bw_tools.common.bw_node import BWNode\n'), ((1808, 1818), 'bw_tools.common.bw_node.BWNode', 'BWNode', (['x1'], {}), '(x1)\n', (1814, 1818), False, 'from bw_tools.common.bw_node import BWNode\n'), ((1828, 1838)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Github attached AWS Code Pipeline"""
__author__ = '<NAME>'
__version__ = '0.1'
import boto3
import os
import sys
import subprocess
import logging
from troposphere import Parameter, Ref, Template, iam
from troposphere.iam import Role
from troposphere.s3 import Bucket
... | [
"logging.getLogger",
"troposphere.codepipeline.ActionTypeId",
"troposphere.codebuild.Environment",
"boto3.client",
"troposphere.Parameter",
"troposphere.codepipeline.OutputArtifacts",
"troposphere.Ref",
"troposphere.Template",
"logging.info",
"argparse.ArgumentParser",
"os.path.split",
"tropos... | [((877, 989), 'troposphere.codebuild.Environment', 'Environment', ([], {'ComputeType': '"""BUILD_GENERAL1_SMALL"""', 'Image': '"""aws/codebuild/standard:3.0"""', 'Type': '"""LINUX_CONTAINER"""'}), "(ComputeType='BUILD_GENERAL1_SMALL', Image=\n 'aws/codebuild/standard:3.0', Type='LINUX_CONTAINER')\n", (888, 989), Fal... |
import cost_function as cf
import pic
target_image = pic.pic2rgb("../data/img03.jpg", 50, 50)
cf.set_target_image(target_image)
s = "(H 0.73 (V 0.451 (H 0.963 (L color)(L color))(V 0.549 (L color)(L color)))(L color))"
matrix = cf.to_array(s, 50, 50, 1)
#print(matrix)
pic.rgb2pic(matrix, 'LAB', "./master_piece.png")
| [
"pic.rgb2pic",
"cost_function.set_target_image",
"cost_function.to_array",
"pic.pic2rgb"
] | [((53, 93), 'pic.pic2rgb', 'pic.pic2rgb', (['"""../data/img03.jpg"""', '(50)', '(50)'], {}), "('../data/img03.jpg', 50, 50)\n", (64, 93), False, 'import pic\n'), ((94, 127), 'cost_function.set_target_image', 'cf.set_target_image', (['target_image'], {}), '(target_image)\n', (113, 127), True, 'import cost_function as cf... |
import json
import pygments.formatters
import pygments.lexers
def pretty_view(mapping: dict, /) -> str:
"""
Args:
mapping:
Returns:
"""
dumped_mapping = json.dumps(mapping, ensure_ascii=False, indent=4)
pretty_mapping = pygments.highlight(
dumped_mapping,
pygments.lex... | [
"json.dumps"
] | [((185, 234), 'json.dumps', 'json.dumps', (['mapping'], {'ensure_ascii': '(False)', 'indent': '(4)'}), '(mapping, ensure_ascii=False, indent=4)\n', (195, 234), False, 'import json\n')] |
from pathlib import Path
from configparser import ConfigParser
from utils.installer import Installer
from utils.chalk import print_header
from utils.utils import link_file
import utils.platform as platform
MOZILLA_DIR = Path.home().joinpath(".mozilla", "firefox")
SCRIPT_DIR = Path(__file__).parent
class Main(Instal... | [
"configparser.ConfigParser",
"pathlib.Path.home",
"utils.chalk.print_header",
"pathlib.Path"
] | [((279, 293), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (283, 293), False, 'from pathlib import Path\n'), ((222, 233), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (231, 233), False, 'from pathlib import Path\n'), ((401, 443), 'utils.chalk.print_header', 'print_header', (['"""Setting up Firefox... |
# 网易云音乐批量下载
# By Tsing
# Python3.4.4
import requests
import urllib
# 榜单歌曲批量下载
# r = requests.get('http://music.163.com/api/playlist/detail?id=2884035') # 网易原创歌曲榜
# r = requests.get('http://music.163.com/api/playlist/detail?id=19723756') # 云音乐飙升榜
# r = requests.get('http://music.163.com/api/playlist/detai... | [
"requests.get",
"urllib.request.urlretrieve"
] | [((351, 418), 'requests.get', 'requests.get', (['"""http://music.163.com/api/playlist/detail?id=3779629"""'], {}), "('http://music.163.com/api/playlist/detail?id=3779629')\n", (363, 418), False, 'import requests\n'), ((828, 878), 'urllib.request.urlretrieve', 'urllib.request.urlretrieve', (['link', "('网易云音乐\\\\' + name... |
""" De- and Encoding Layer, using a predefined Encoder """
import multiprocessing
from PiCN.Layers.PacketEncodingLayer.Encoder import BasicEncoder
from PiCN.Processes import LayerProcess
class BasicPacketEncodingLayer(LayerProcess):
""" De- and Encoding Layer, using a predefined Encoder """
def __init__(sel... | [
"PiCN.Processes.LayerProcess.__init__"
] | [((375, 450), 'PiCN.Processes.LayerProcess.__init__', 'LayerProcess.__init__', (['self'], {'logger_name': '"""PktEncLayer"""', 'log_level': 'log_level'}), "(self, logger_name='PktEncLayer', log_level=log_level)\n", (396, 450), False, 'from PiCN.Processes import LayerProcess\n')] |
from tkinter import *
import random
import time
class Widget(object): # 画面上で動く物の基本となるクラス
def __init__(self, window, size, color, pos, speed=[0, 0]):
self.window = window
self.size = size
self.color = color
self.pos = pos
self.speed = speed
def acty(self): # インスタンスを動... | [
"time.perf_counter",
"time.sleep",
"random.randrange"
] | [((6172, 6186), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (6182, 6186), False, 'import time\n'), ((4294, 4319), 'random.randrange', 'random.randrange', (['(50)', '(400)'], {}), '(50, 400)\n', (4310, 4319), False, 'import random\n'), ((4321, 4346), 'random.randrange', 'random.randrange', (['(50)', '(100)'], ... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pyatv/protocols/mrp/protobuf/PlayerClientPropertiesMessage.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from g... | [
"google.protobuf.descriptor_pool.Default",
"google.protobuf.reflection.GeneratedProtocolMessageType",
"google.protobuf.symbol_database.Default",
"pyatv.protocols.mrp.protobuf.ProtocolMessage_pb2.ProtocolMessage.RegisterExtension"
] | [((527, 553), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (551, 553), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((1586, 1821), 'google.protobuf.reflection.GeneratedProtocolMessageType', '_reflection.GeneratedProtocolMessageType', (['"""Playe... |
# Generated by Django 2.0.8 on 2019-06-19 19:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0001_squashed_0021'),
('app_challenges_sections_units', '0035_auto_20190619_1847'),
]
operations = [
migrations.RenameModel... | [
"django.db.migrations.RenameModel"
] | [((298, 362), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""Slideshow"""', 'new_name': '"""Gallery"""'}), "(old_name='Slideshow', new_name='Gallery')\n", (320, 362), False, 'from django.db import migrations\n'), ((407, 481), 'django.db.migrations.RenameModel', 'migrations.RenameMod... |
from self_organising_systems.texture_ca.config import cfg
from self_organising_systems.shared.util import imread
import tensorflow as tf
import numpy as np
style_layers = ['block%d_conv1'%i for i in range(1, 6)]
content_layer = 'block4_conv2'
class StyleModel:
def __init__(self, input_texture_path):
vgg = tf.... | [
"tensorflow.shape",
"tensorflow.io.gfile.GFile",
"tensorflow.einsum",
"tensorflow.concat",
"tensorflow.sqrt",
"tensorflow.clip_by_value",
"tensorflow.import_graph_def",
"tensorflow.keras.applications.vgg16.VGG16",
"tensorflow.keras.Model",
"tensorflow.reduce_mean",
"self_organising_systems.share... | [((317, 389), 'tensorflow.keras.applications.vgg16.VGG16', 'tf.keras.applications.vgg16.VGG16', ([], {'include_top': '(False)', 'weights': '"""imagenet"""'}), "(include_top=False, weights='imagenet')\n", (350, 389), True, 'import tensorflow as tf\n'), ((543, 578), 'tensorflow.keras.Model', 'tf.keras.Model', (['[vgg.inp... |
import numpy as np
import os
import traceback
import yaml
from edflow.hooks.hook import Hook
from edflow.util import walk, retrieve, contains_key
from edflow.custom_logging import get_logger
class RuntimeInputHook(Hook):
"""Given a textfile reads that at each step and passes the results to
a callback functio... | [
"os.path.exists",
"traceback.format_exc",
"edflow.custom_logging.get_logger",
"edflow.util.walk",
"numpy.any",
"edflow.util.contains_key",
"edflow.util.retrieve"
] | [((708, 724), 'edflow.custom_logging.get_logger', 'get_logger', (['self'], {}), '(self)\n', (718, 724), False, 'from edflow.custom_logging import get_logger\n'), ((842, 868), 'os.path.exists', 'os.path.exists', (['self.ufile'], {}), '(self.ufile)\n', (856, 868), False, 'import os\n'), ((1856, 1906), 'edflow.util.walk',... |
from django.shortcuts import get_object_or_404
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.response import Response
from cajas.users.models.partner import Partner
from cajas.loans.models.loan import Loan, LoanType
class ValidatePartnerWithdraw(APIView):
def p... | [
"rest_framework.response.Response",
"django.shortcuts.get_object_or_404",
"cajas.loans.models.loan.Loan.objects.filter"
] | [((1232, 1278), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Partner'], {'pk': "data['partner']"}), "(Partner, pk=data['partner'])\n", (1249, 1278), False, 'from django.shortcuts import get_object_or_404\n'), ((1295, 1369), 'cajas.loans.models.loan.Loan.objects.filter', 'Loan.objects.filter', ([], {'le... |
"""
todo: check pandas
"""
from openpyxl import Workbook
from openpyxl.styles import Font
from pi88reader.pi88_importer import PI88Measurement, SegmentType
def main():
filename = '..\\resources\\quasi_static_12000uN.tdm'
filename = '..\\resources\\AuSn_Creep\\1000uN 01 LC.tdm'
measurement = PI88Measureme... | [
"pi88reader.pi88_importer.PI88Measurement",
"openpyxl.styles.Font",
"openpyxl.Workbook"
] | [((307, 332), 'pi88reader.pi88_importer.PI88Measurement', 'PI88Measurement', (['filename'], {}), '(filename)\n', (322, 332), False, 'from pi88reader.pi88_importer import PI88Measurement, SegmentType\n'), ((538, 548), 'openpyxl.Workbook', 'Workbook', ([], {}), '()\n', (546, 548), False, 'from openpyxl import Workbook\n'... |
import json
import sys
# import matplotlib.pyplot as plt
import copy
import numpy as np
import tensorflow as tf
from sklearn.model_selection import StratifiedShuffleSplit
from sklearn.utils import class_weight
from collections import Counter
import random
from tensorflow.keras.callbacks import Callback
from sklearn.met... | [
"sklearn.model_selection.StratifiedShuffleSplit",
"sklearn.metrics.classification_report",
"bert.load_bert_weights",
"tensorflow.python.keras.utils.layer_utils.count_params",
"numpy.array",
"tensorflow.keras.layers.Dense",
"nltk.tokenize.sent_tokenize",
"BertModel.BertModel",
"copy.deepcopy",
"sys... | [((3640, 3659), 'copy.deepcopy', 'copy.deepcopy', (['data'], {}), '(data)\n', (3653, 3659), False, 'import copy\n'), ((7818, 7867), 'sklearn.model_selection.StratifiedShuffleSplit', 'StratifiedShuffleSplit', ([], {'n_splits': '(1)', 'test_size': '(0.1)'}), '(n_splits=1, test_size=0.1)\n', (7840, 7867), False, 'from skl... |
from constructor import ArrayConstructor
from measure import MeasureMemory
import re
import array
class Trie(object):
def __init__(self, words, unit_scale=8):
bit_array, labels = self.create_tree(words)
self.rank1 = self.get_rank(1)
self.unit_scale = unit_scale
self.split_list = B... | [
"constructor.ArrayConstructor",
"array.array"
] | [((565, 596), 'array.array', 'array.array', (['"""I"""', 'self.zero_pos'], {}), "('I', self.zero_pos)\n", (576, 596), False, 'import array\n'), ((623, 650), 'array.array', 'array.array', (['"""B"""', 'bit_array'], {}), "('B', bit_array)\n", (634, 650), False, 'import array\n'), ((672, 696), 'array.array', 'array.array'... |
"""A library for converting weather codes to symbols."""
import os.path
from io import BytesIO
import cairosvg
import imageio
from .glyphs import WMO_GLYPH_LOOKUP, DEFAULT_GLYPHS
from .codes import DATAPOINT_TO_WMO_LOOKUP, DARKSKY_TO_WMO_LOOKUP
class GlyphSet():
"""A set of glyphs."""
def __init__(self, n... | [
"cairosvg.svg2png"
] | [((3574, 3624), 'cairosvg.svg2png', 'cairosvg.svg2png', ([], {'bytestring': 'self.svg', 'scale': 'scale'}), '(bytestring=self.svg, scale=scale)\n', (3590, 3624), False, 'import cairosvg\n')] |
#! /usr/bin/env python3
# randomQuizGenerator.py - Creates quizzes with questions and answers in
# random order, along with the answer key
import random
# The quiz data. Keys are states and values are their capitals.
capitals = {'Alabama': 'Montgomery',
'Alaska': 'Juneau',
'Ariz... | [
"random.sample",
"random.shuffle"
] | [((2723, 2745), 'random.shuffle', 'random.shuffle', (['states'], {}), '(states)\n', (2737, 2745), False, 'import random\n'), ((2970, 3001), 'random.sample', 'random.sample', (['wrong_answers', '(3)'], {}), '(wrong_answers, 3)\n', (2983, 3001), False, 'import random\n'), ((3053, 3083), 'random.shuffle', 'random.shuffle'... |
# MIT License
# Copyright (c) 2019 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish... | [
"jarvis.utils.mongoDB.db.is_collection_empty",
"jarvis.utils.mongoDB.db.drop_collection",
"jarvis.utils.mongoDB.db.insert_many_documents",
"jarvis.utils.input.check_input_to_continue"
] | [((2559, 2610), 'jarvis.utils.mongoDB.db.is_collection_empty', 'db.is_collection_empty', ([], {'collection': '"""learned_skills"""'}), "(collection='learned_skills')\n", (2581, 2610), False, 'from jarvis.utils.mongoDB import db\n'), ((2252, 2283), 'jarvis.utils.input.check_input_to_continue', 'input.check_input_to_cont... |
# -*- coding: utf-8 -*-
# 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, softw... | [
"kubernetes.client.api.batch_v1_api.BatchV1Api",
"kubernetes.client.api_client.ApiClient",
"kubernetes.e2e_test.base.get_e2e_configuration",
"uuid.uuid4"
] | [((833, 861), 'kubernetes.e2e_test.base.get_e2e_configuration', 'base.get_e2e_configuration', ([], {}), '()\n', (859, 861), False, 'from kubernetes.e2e_test import base\n'), ((910, 957), 'kubernetes.client.api_client.ApiClient', 'api_client.ApiClient', ([], {'configuration': 'self.config'}), '(configuration=self.config... |
"""
Model definition adapted from: https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py
"""
import math
from typing import Optional, List, Union, Type
import torch.nn as nn
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://downlo... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Sequential",
"math.sqrt",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d"
] | [((701, 796), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': '(3, 3)', 'stride': 'stride', 'padding': '(1)', 'bias': '(False)'}), '(in_planes, out_planes, kernel_size=(3, 3), stride=stride, padding\n =1, bias=False)\n', (710, 796), True, 'import torch.nn as nn\n'), ((1179, 1201), 'torc... |
import os
import pefile
import time
import re
import click
import subprocess
data_directory_list = ['DIRECTORY_ENTRY_DEBUG', 'DIRECTORY_ENTRY_EXPORT', 'DIRECTORY_ENTRY_LOAD_CONFIG',
'DIRECTORY_ENTRY_RESOURCE', 'DIRECTORY_ENTRY_BASERELOC', 'DIRECTORY_ENTRY_TLS']
normal_section_names = ['.text',... | [
"os.listdir",
"click.option",
"time.time",
"re.sub",
"click.command",
"pefile.PE"
] | [((2394, 2409), 'click.command', 'click.command', ([], {}), '()\n', (2407, 2409), False, 'import click\n'), ((2411, 2472), 'click.option', 'click.option', (['"""--path"""'], {'required': '(True)', 'help': '"""path of samples"""'}), "('--path', required=True, help='path of samples')\n", (2423, 2472), False, 'import clic... |
import threading
import time
from dredis.db import NUMBER_OF_REDIS_DATABASES, DB_MANAGER, KEY_CODEC
DEFAULT_GC_INTERVAL = 500 # milliseconds
DEFAULT_GC_BATCH_SIZE = 10000 # number of storage keys to delete in a batch
class KeyGarbageCollector(threading.Thread):
def __init__(self, gc_interval=DEFAULT_GC_INTE... | [
"threading.Thread.__init__",
"dredis.db.KEY_CODEC.decode_key",
"time.sleep",
"dredis.db.DB_MANAGER.get_db"
] | [((369, 430), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {'name': '"""Key Garbage Collector"""'}), "(self, name='Key Garbage Collector')\n", (394, 430), False, 'import threading\n'), ((627, 664), 'time.sleep', 'time.sleep', (['self._gc_interval_in_secs'], {}), '(self._gc_interval_in_secs)\n', ... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
ExtractorError,
urlencode_postdata,
)
class PromptFileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?promptfile\.com/l/(?P<id>[0-9A-Z\-]+)'
... | [
"re.search"
] | [((802, 873), 're.search', 're.search', (['"""<div.+id="not_found_msg".+>(?!We are).+</div>[^-]"""', 'webpage'], {}), '(\'<div.+id="not_found_msg".+>(?!We are).+</div>[^-]\', webpage)\n', (811, 873), False, 'import re\n')] |
#! /usr/bin/python3
##################################################################
#
# Raspberry Pi Antenna Driver (RPiAntDrv.py)
#
# Python GUI script to control H-Bridge via RPi.
# H-Bridge drives single DC motor tuned antenna.
#
# Name Call Date(s)
# Authors: <NAME> N7IFC Mar-May2020
#
###... | [
"configparser.ConfigParser",
"RPi.GPIO.output",
"tkinter.Button",
"RPi.GPIO.PWM",
"tkinter.Label",
"RPi.GPIO.setmode",
"RPi.GPIO.cleanup",
"pathlib.Path",
"tkinter.StringVar",
"tkinter.ttk.Combobox",
"tkinter.Menu",
"RPi.GPIO.setup",
"RPi.GPIO.setwarnings",
"tkinter.Toplevel",
"tkinter.I... | [((23276, 23280), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (23278, 23280), False, 'from tkinter import Tk, ttk, messagebox, Frame, Menu, Label, Button\n'), ((809, 837), 'tkinter.Frame.__init__', 'Frame.__init__', (['self', 'master'], {}), '(self, master)\n', (823, 837), False, 'from tkinter import Tk, ttk, messagebox, Fra... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'window_profile.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QMainWindow
class Profile(QMainWindow):
d... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QDateEdit",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QLineE... | [((466, 489), 'PyQt5.QtWidgets.QWidget', 'QtWidgets.QWidget', (['self'], {}), '(self)\n', (483, 489), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((584, 621), 'PyQt5.QtWidgets.QWidget', 'QtWidgets.QWidget', (['self.centralwidget'], {}), '(self.centralwidget)\n', (601, 621), False, 'from PyQt5 import QtCore,... |
import glob
import os
import tempfile
from unittest import mock
from . import utils
from hotsos.core.config import setup_config, HotSOSConfig
from hotsos.core.searchtools import (
FileSearcher,
FilterDef,
SearchDef,
SearchResult,
SequenceSearchDef,
)
FILTER_TEST_1 = """blah blah ERROR blah
blah ... | [
"hotsos.core.config.setup_config",
"tempfile.TemporaryDirectory",
"os.listdir",
"hotsos.core.searchtools.FilterDef",
"hotsos.core.searchtools.SearchDef",
"os.path.join",
"tempfile.NamedTemporaryFile",
"hotsos.core.searchtools.FileSearcher",
"unittest.mock.patch.object",
"os.mknod",
"glob.glob",
... | [((997, 1033), 'unittest.mock.patch.object', 'mock.patch.object', (['os', '"""environ"""', '{}'], {}), "(os, 'environ', {})\n", (1014, 1033), False, 'from unittest import mock\n'), ((1039, 1073), 'unittest.mock.patch.object', 'mock.patch.object', (['os', '"""cpu_count"""'], {}), "(os, 'cpu_count')\n", (1056, 1073), Fal... |
from setuptools import setup, find_packages
VERSION = '0.5.0'
with open('README.md', 'r') as f:
LONG_DESCRIPTION = f.read()
with open('requirements.txt') as f:
DEPENDENCIES = f.read().split('\n')
setup(
name = 'bqtools',
version = VERSION,
description = 'Python Tools for BigQuery',
long_desc... | [
"setuptools.find_packages"
] | [((519, 551), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests']"}), "(exclude=['tests'])\n", (532, 551), False, 'from setuptools import setup, find_packages\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='UserProfile',
fields=[
('id', models.AutoField(... | [
"django.db.models.DateField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((303, 396), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)', 'auto_created': '(True)', 'verbose_name': '"""ID"""', 'serialize': '(False)'}), "(primary_key=True, auto_created=True, verbose_name='ID',\n serialize=False)\n", (319, 396), False, 'from django.db import migrations, models\... |
from datetime import timedelta
from dotenv import load_dotenv
from azure.identity import DefaultAzureCredential
from azure.mgmt.media import AzureMediaServices
from azure.storage.blob import BlobServiceClient
from azure.mgmt.media.models import (
Asset,
Transform,
TransformOutput,
StandardEncoderPreset,
AacAu... | [
"azure.mgmt.media.models.Asset",
"azure.mgmt.media.models.JobOutputAsset",
"azure.identity.DefaultAzureCredential",
"os.getenv",
"azure.mgmt.media.models.Rectangle",
"os.path.join",
"time.sleep",
"dotenv.load_dotenv",
"os.chdir",
"os.getcwd",
"azure.mgmt.media.models.JobInputs",
"azure.mgmt.me... | [((610, 623), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (621, 623), False, 'from dotenv import load_dotenv\n'), ((773, 797), 'azure.identity.DefaultAzureCredential', 'DefaultAzureCredential', ([], {}), '()\n', (795, 797), False, 'from azure.identity import DefaultAzureCredential\n'), ((895, 922), 'os.geten... |
from sysu_dataset import SYSU
import numpy as np
import scipy
import itertools
import cv2
import torch
from torch.utils.data import Dataset
import torchvision.transforms as transforms
from config import *
vox_size=54
all_tups = np.array(list(itertools.product(range(vox_size), repeat=2)))
rot_array = np.arange(vox_... | [
"numpy.radians",
"torchvision.transforms.functional.to_tensor",
"torchvision.transforms.RandomRotation.get_params",
"torchvision.transforms.functional.to_pil_image",
"torch.stack",
"torch.from_numpy",
"numpy.zeros",
"numpy.random.randint",
"torchvision.transforms.functional.rotate",
"torchvision.t... | [((6173, 6298), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['dataset'], {'batch_size': 'DATA_BATCH_SIZE', 'shuffle': '(True)', 'num_workers': 'NUM_WORKERS', 'pin_memory': '(True)'}), '(dataset, batch_size=DATA_BATCH_SIZE, shuffle=\n True, num_workers=NUM_WORKERS, pin_memory=True)\n', (6200, 6298)... |
import pandas as pd
import numpy as numpy
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Conv1D, MaxPooling1D, LeakyReLU, PReLU
from keras.utils import np_utils
from keras.callbacks import CSVLogger, ModelCheckpoint
import h5py
import os
import ... | [
"keras.callbacks.CSVLogger",
"keras.callbacks.ModelCheckpoint",
"tensorflow.Session",
"keras.models.Sequential",
"tensorflow.ConfigProto",
"keras.layers.Dropout",
"keras.layers.Conv1D"
] | [((631, 647), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (645, 647), True, 'import tensorflow as tf\n'), ((1285, 1297), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1295, 1297), False, 'from keras.models import Sequential\n'), ((699, 724), 'tensorflow.Session', 'tf.Session', ([], {'con... |
'''
NAME: <NAME>
TE-B
ROLL NO: 08
ASSIGNMENT NO: 11
PROBLEM STATEMENT:
Write a program using TCP sockets for wired network to implement
a. Peer to Peer Chat (server side)
'''
import socket
import sys
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('localhost',23000))
sock.listen(1)
clisock, (ip,p... | [
"socket.socket"
] | [((210, 259), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (223, 259), False, 'import socket\n')] |
from django.shortcuts import render
from rest_framework import viewsets
from institutions.models import Institution, Career, Course
from institutions.serializers import InstitutionSerializer, CareerSerializer, CourseSerializer
from permissions.services import APIPermissionClassFactory
class InstitutionViewSet(viewse... | [
"institutions.models.Institution.objects.all",
"permissions.services.APIPermissionClassFactory",
"institutions.models.Course.objects.all",
"institutions.models.Career.objects.all"
] | [((353, 378), 'institutions.models.Institution.objects.all', 'Institution.objects.all', ([], {}), '()\n', (376, 378), False, 'from institutions.models import Institution, Career, Course\n'), ((1207, 1227), 'institutions.models.Career.objects.all', 'Career.objects.all', ([], {}), '()\n', (1225, 1227), False, 'from insti... |
# Lint as: python3
# Copyright 2019 DeepMind Technologies Limited.
#
# 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 ap... | [
"typing.get_type_hints"
] | [((1278, 1314), 'typing.get_type_hints', 'get_type_hints', (['schema_pb2.TableInfo'], {}), '(schema_pb2.TableInfo)\n', (1292, 1314), False, 'from typing import Any, Iterable, Mapping, NamedTuple, Optional, Union, get_type_hints\n')] |
import os
import shutil
import unittest
from oeqa.core.utils.path import remove_safe
from oeqa.sdk.case import OESDKTestCase
class GccCompileTest(OESDKTestCase):
td_vars = ['MACHINE']
@classmethod
def setUpClass(self):
files = {'test.c' : self.tc.files_dir, 'test.cpp' : self.tc.files_dir,
... | [
"os.path.join",
"unittest.SkipTest",
"oeqa.core.utils.path.remove_safe"
] | [((725, 819), 'unittest.SkipTest', 'unittest.SkipTest', (['"""GccCompileTest class: SDK doesn\'t contain a cross-canadian toolchain"""'], {}), '(\n "GccCompileTest class: SDK doesn\'t contain a cross-canadian toolchain")\n', (742, 819), False, 'import unittest\n'), ((1340, 1372), 'os.path.join', 'os.path.join', (['s... |
from fastapi import APIRouter
from . import auth, index, list, task
router = APIRouter()
router.include_router(index.router)
router.include_router(auth.router, prefix='/auth', tags=['Authenticate'])
router.include_router(list.router, prefix='/lists', tags=['Lists'])
router.include_router(task.router, prefix='/lists'... | [
"fastapi.APIRouter"
] | [((79, 90), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (88, 90), False, 'from fastapi import APIRouter\n')] |
# -*- coding: utf-8 -*-
'''
Created on Oct 23, 2015
@author: jrm
'''
from inkcut.device.plugin import DeviceProtocol
from inkcut.core.utils import async_sleep, log
class DebugProtocol(DeviceProtocol):
""" A protocol that just logs what is called """
def connection_made(self):
log.debug("protocol.conn... | [
"inkcut.core.utils.async_sleep",
"inkcut.core.utils.log.debug"
] | [((296, 334), 'inkcut.core.utils.log.debug', 'log.debug', (['"""protocol.connectionMade()"""'], {}), "('protocol.connectionMade()')\n", (305, 334), False, 'from inkcut.core.utils import async_sleep, log\n'), ((515, 531), 'inkcut.core.utils.async_sleep', 'async_sleep', (['(0.1)'], {}), '(0.1)\n', (526, 531), False, 'fro... |
# -*- encoding: utf8 -*-
# version 1.11
import tkinter.messagebox,os
from tkinter import *
from tkinter.ttk import *
from tkinter import Menu
import datetime
import threading
import pickle
import time
import tushare as ts
import pywinauto
import pywinauto.clipboard
import pywinauto.application
NUM_OF_STOCKS = 5 # 自定义... | [
"pywinauto.clipboard.GetData",
"tkinter.Menu",
"pickle.dump",
"datetime.datetime.strptime",
"pywinauto.findwindows.find_windows",
"pickle.load",
"time.sleep",
"pywinauto.findwindows.find_window",
"datetime.datetime.now",
"tushare.get_realtime_quotes",
"threading.Thread",
"pywinauto.application... | [((22092, 22125), 'threading.Thread', 'threading.Thread', ([], {'target': 'StockGui'}), '(target=StockGui)\n', (22108, 22125), False, 'import threading\n'), ((22150, 22182), 'threading.Thread', 'threading.Thread', ([], {'target': 'monitor'}), '(target=monitor)\n', (22166, 22182), False, 'import threading\n'), ((1650, 1... |
import pytest
import re
from proknow import Exceptions
def test_create(app, custom_metric_generator):
pk = app.pk
# Verify returned CustomMetricItem
params, custom_metric = custom_metric_generator()
assert custom_metric.name == params["name"]
assert custom_metric.context == params["context"]
... | [
"pytest.raises",
"re.compile"
] | [((2350, 2369), 're.compile', 're.compile', (['"""ind M"""'], {}), "('ind M')\n", (2360, 2369), False, 'import re\n'), ((1058, 1093), 'pytest.raises', 'pytest.raises', (['Exceptions.HttpError'], {}), '(Exceptions.HttpError)\n', (1071, 1093), False, 'import pytest\n'), ((1987, 2022), 'pytest.raises', 'pytest.raises', ([... |
import torch
from torch import dtype, nn
import torch.nn.functional as F
class PAM_Module(nn.Module):
def __init__(self, num, sizes,mode=None):
super(PAM_Module, self).__init__()
self.sizes = sizes
self.mode = mode
for i in range(num):
setattr(self, "query" + str(i),
... | [
"torch.nn.ConvTranspose2d",
"torch.stack",
"torch.nn.Conv2d",
"torch.softmax",
"torch.tensor",
"torch.bmm",
"torch.Size",
"torch.rand"
] | [((10040, 10056), 'torch.rand', 'torch.rand', (['(3)', '(3)'], {}), '(3, 3)\n', (10050, 10056), False, 'import torch\n'), ((5812, 5840), 'torch.Size', 'torch.Size', (['[-1, 16, 14, 14]'], {}), '([-1, 16, 14, 14])\n', (5822, 5840), False, 'import torch\n'), ((6633, 6659), 'torch.Size', 'torch.Size', (['[-1, 32, 7, 7]'],... |
from docassemble.base.util import variables_snapshot_connection, user_info
__all__ = ['get_stats']
def get_stats(filename: str):
conn = variables_snapshot_connection()
cur = conn.cursor()
# use a parameterized query to prevent SQL injection
query = "select modtime, data from jsonstorage where filenam... | [
"docassemble.base.util.variables_snapshot_connection"
] | [((143, 174), 'docassemble.base.util.variables_snapshot_connection', 'variables_snapshot_connection', ([], {}), '()\n', (172, 174), False, 'from docassemble.base.util import variables_snapshot_connection, user_info\n')] |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of cond... | [
"primaires.interpreteur.commande.commande.Commande.__init__"
] | [((3656, 3699), 'primaires.interpreteur.commande.commande.Commande.__init__', 'Commande.__init__', (['self', '"""prompt"""', '"""prompt"""'], {}), "(self, 'prompt', 'prompt')\n", (3673, 3699), False, 'from primaires.interpreteur.commande.commande import Commande\n')] |
import sys
sys.path.append('/home/jwalker/dynamics/python/atmos-tools')
sys.path.append('/home/jwalker/dynamics/python/atmos-read')
import xray
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
import pandas as pd
import atmos as atm
import precipdat
import merra
# ---------------------... | [
"numpy.radians",
"numpy.gradient",
"atmos.gradient",
"atmos.homedir",
"matplotlib.pyplot.plot",
"atmos.pres_convert",
"atmos.get_coord",
"xray.open_dataset",
"atmos.moisture_flux_conv",
"numpy.cos",
"merra.merra_urls",
"sys.path.append",
"atmos.precip_convert",
"atmos.subset"
] | [((11, 71), 'sys.path.append', 'sys.path.append', (['"""/home/jwalker/dynamics/python/atmos-tools"""'], {}), "('/home/jwalker/dynamics/python/atmos-tools')\n", (26, 71), False, 'import sys\n'), ((72, 131), 'sys.path.append', 'sys.path.append', (['"""/home/jwalker/dynamics/python/atmos-read"""'], {}), "('/home/jwalker/d... |
'''
Solution for day 6 of the 2021 Advent of Code calendar.
Run it with the command `python -m adventofcode run_solution -y 2021 6` from the project root.
'''
import time
from adventofcode.types import Solution
class LanternFish:
def __init__(self, timer_til_fork):
self.timer_til_fork = timer_til_fork
... | [
"time.time"
] | [((694, 705), 'time.time', 'time.time', ([], {}), '()\n', (703, 705), False, 'import time\n'), ((886, 897), 'time.time', 'time.time', ([], {}), '()\n', (895, 897), False, 'import time\n'), ((1163, 1174), 'time.time', 'time.time', ([], {}), '()\n', (1172, 1174), False, 'import time\n'), ((1335, 1346), 'time.time', 'time... |
import os
import json
import numpy as np
import matplotlib.pyplot as plt
def compute_iou(box_1, box_2):
'''
This function takes a pair of bounding boxes and returns intersection-over-
union (IoU) of two bounding boxes.
'''
intersection = 0
tlr1, tlc1, brr1, brc1 = box_1[0], box_1[1], box_1[2], ... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"os.path.join",
"numpy.array",
"matplotlib.pyplot.figure",
"json.load",
"matplotlib.pyplot.title",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((4004, 4058), 'matplotlib.pyplot.plot', 'plt.plot', (['recall', 'precision'], {'color': '"""black"""', 'marker': '"""o"""'}), "(recall, precision, color='black', marker='o')\n", (4012, 4058), True, 'import matplotlib.pyplot as plt\n'), ((4059, 4116), 'matplotlib.pyplot.plot', 'plt.plot', (['recall_l', 'precision_l'],... |
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------------------------------... | [
"atom.api.Typed",
"wx.PostEvent",
"wx.Size"
] | [((791, 807), 'atom.api.Typed', 'Typed', (['wx.Window'], {}), '(wx.Window)\n', (796, 807), False, 'from atom.api import Typed\n'), ((2934, 2952), 'wx.Size', 'wx.Size', (['*min_size'], {}), '(*min_size)\n', (2941, 2952), False, 'import wx\n'), ((3101, 3119), 'wx.Size', 'wx.Size', (['*max_size'], {}), '(*max_size)\n', (3... |
import radical.saga as saga
c = saga.Context ('ssh')
c.user_id = 'dinesh'
s = saga.Session ()
s.add_context (c)
js = saga.job.Service("lsf+ssh://yellowstone.ucar.edu", session=s)
| [
"radical.saga.job.Service",
"radical.saga.Context",
"radical.saga.Session"
] | [((34, 53), 'radical.saga.Context', 'saga.Context', (['"""ssh"""'], {}), "('ssh')\n", (46, 53), True, 'import radical.saga as saga\n'), ((81, 95), 'radical.saga.Session', 'saga.Session', ([], {}), '()\n', (93, 95), True, 'import radical.saga as saga\n'), ((121, 182), 'radical.saga.job.Service', 'saga.job.Service', (['"... |
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
led_state = False
try:
while True:
GPIO.output(18, led_state)
if led_state:
print("The LED is on. Press 'enter' to switch it off")
else:
print("The LED is off. Press 'enter' to switch it on")
... | [
"RPi.GPIO.setup",
"RPi.GPIO.cleanup",
"RPi.GPIO.output",
"RPi.GPIO.setmode"
] | [((25, 47), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (37, 47), True, 'import RPi.GPIO as GPIO\n'), ((48, 72), 'RPi.GPIO.setup', 'GPIO.setup', (['(18)', 'GPIO.OUT'], {}), '(18, GPIO.OUT)\n', (58, 72), True, 'import RPi.GPIO as GPIO\n'), ((528, 542), 'RPi.GPIO.cleanup', 'GPIO.cleanup', ([],... |
# grasp.py
# This script implements the GRASP heuristic for the dynamic bin packing
# problem.
# Author: <NAME>
from __future__ import print_function
import numpy as np
import random
import solutions_dynamic as solmaker
import sys
from copy import deepcopy
from itertools import combinations
from math import ceil... | [
"numpy.less_equal",
"math.sqrt",
"numpy.argsort",
"numpy.array",
"copy.deepcopy",
"numpy.divide",
"numpy.multiply",
"numpy.where",
"numpy.subtract",
"numpy.max",
"random.random",
"numpy.setxor1d",
"numpy.argmin",
"random.randint",
"operator.attrgetter",
"random.sample",
"numpy.allclo... | [((62326, 62343), 'numpy.allclose', 'np.allclose', (['u', 'v'], {}), '(u, v)\n', (62337, 62343), True, 'import numpy as np\n'), ((62506, 62525), 'numpy.less_equal', 'np.less_equal', (['u', 'v'], {}), '(u, v)\n', (62519, 62525), True, 'import numpy as np\n'), ((62537, 62552), 'numpy.all', 'np.all', (['domtest'], {}), '(... |
import argparse
import csv
from datetime import datetime
import logging
import sys
import time
from typing import Set, Tuple
from urllib.parse import urlparse, urlunparse
from botocore.config import Config
from botocore.exceptions import ClientError
from hca.util import SwaggerAPIException
from azul import config, re... | [
"logging.getLogger",
"csv.DictReader",
"argparse.ArgumentParser",
"botocore.config.Config",
"datetime.datetime.strptime",
"urllib.parse.urlunparse",
"azul.dss.shared_dss_credentials",
"azul.logging.configure_script_logging",
"time.time"
] | [((520, 547), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (537, 547), False, 'import logging\n'), ((13175, 13207), 'azul.logging.configure_script_logging', 'configure_script_logging', (['logger'], {}), '(logger)\n', (13199, 13207), False, 'from azul.logging import configure_script_logg... |
#! /usr/bin/env python3 -B
# build utility for easy development
# complete and unreliable hack used for making it easier to develop
import click, os, platform, markdown, glob, textwrap
def build(target, dirname, buildtype, cmakeopts=''):
os.system('mkdir -p build/{dirname}; cd build/{dirname}; cmake ../../ -GNin... | [
"click.group",
"os.system",
"click.argument"
] | [((573, 586), 'click.group', 'click.group', ([], {}), '()\n', (584, 586), False, 'import click, os, platform, markdown, glob, textwrap\n'), ((624, 676), 'click.argument', 'click.argument', (['"""target"""'], {'required': '(False)', 'default': '""""""'}), "('target', required=False, default='')\n", (638, 676), False, 'i... |
import sqlite3 as lite
import csv
# Constants.
inputPath = "/Users/kdinkla/Desktop/Novartis/HCS/CellMorph/www.ebi.ac.uk/huber-srv/cellmorph/data/"
outputPath = "/Users/kdinkla/MPDA/git/wrangle/db/"
sqlDotReplacement = '_'
# Screening parameters.
plates = ["HT" + str(i).zfill(2) for i in range(1, 69)]
plateDirectories... | [
"csv.reader",
"sqlite3.connect"
] | [((854, 874), 'sqlite3.connect', 'lite.connect', (['dbPath'], {}), '(dbPath)\n', (866, 874), True, 'import sqlite3 as lite\n'), ((1358, 1393), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '"""\t"""'}), "(csvfile, delimiter='\\t')\n", (1368, 1393), False, 'import csv\n')] |
from django.urls import resolve, reverse
from .base_classes import NetworkStationTest
from ..views import station_borehole_layer_add
class StationBoreholeLayerAddTests(NetworkStationTest):
def __init__(self, *args):
NetworkStationTest.__init__(
self,
*args,
url="statio... | [
"django.urls.resolve"
] | [((834, 886), 'django.urls.resolve', 'resolve', (['"""/networks/1/station/1/add-borehole-layer/"""'], {}), "('/networks/1/station/1/add-borehole-layer/')\n", (841, 886), False, 'from django.urls import resolve, reverse\n')] |
# Generated by Django 3.2.3 on 2021-06-19 00:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
('frosh', '0003_alter_team_coin_amount'),
]
operations = [... | [
"django.db.models.OneToOneField"
] | [((427, 580), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'primary_key': '(True)', 'related_name': '"""frosh_team"""', 'serialize': '(False)', 'to': '"""auth.group"""'}), "(on_delete=django.db.models.deletion.CASCADE,\n primary_key=True, related_n... |
import os.path
import numpy as np
import itertools
import Tools
# Those patterns are used for tests and benchmarks.
# For tests, there is the need to add tests for saturation
def writeTests(config):
NBSAMPLES=128
inputsA=np.random.randn(NBSAMPLES)
inputsB=np.random.randn(NBSAMPLES)
inputsA = inpu... | [
"Tools.Config",
"numpy.random.randn"
] | [((624, 665), 'Tools.Config', 'Tools.Config', (['PATTERNDIR', 'PARAMDIR', '"""f32"""'], {}), "(PATTERNDIR, PARAMDIR, 'f32')\n", (636, 665), False, 'import Tools\n'), ((674, 715), 'Tools.Config', 'Tools.Config', (['PATTERNDIR', 'PARAMDIR', '"""q31"""'], {}), "(PATTERNDIR, PARAMDIR, 'q31')\n", (686, 715), False, 'import ... |
# Generated by Django 3.2.1 on 2021-05-12 20:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('todo', '0003_auto_20210511_0127'),
]
operations = [
migrations.AlterField(
model_name='post',
name='ti... | [
"django.db.models.CharField"
] | [((345, 388), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(25)'}), '(blank=True, max_length=25)\n', (361, 388), False, 'from django.db import migrations, models\n')] |
# encoding: UTF-8
import sys
import ctypes
import platform
from vtEngine import MainEngine
from ctaAlgo.uiStrategyWindow import *
#----------------------------------------------------------------------
def main():
"""主程序入口"""
# 设置底部任务栏图标,win7以下请注释掉
try:
ctypes.windll.shell32.SetCurrentProcessExpl... | [
"vtEngine.MainEngine",
"ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID",
"sys.setdefaultencoding",
"qdarkstyle.load_stylesheet"
] | [((430, 460), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf8"""'], {}), "('utf8')\n", (452, 460), False, 'import sys\n'), ((1044, 1056), 'vtEngine.MainEngine', 'MainEngine', ([], {}), '()\n', (1054, 1056), False, 'from vtEngine import MainEngine\n'), ((277, 352), 'ctypes.windll.shell32.SetCurrentProcess... |
import sys
from csvcols import get_column
categories = get_column(sys.argv[1], col=1)
descriptions = get_column(sys.argv[1], col=2)
for c, n in categories.most_common(len(categories)):
print("%6d %s" % (n, c))
for d, n in descriptions.most_common(len(descriptions)):
print("%6d %s" % (n, d))
| [
"csvcols.get_column"
] | [((57, 87), 'csvcols.get_column', 'get_column', (['sys.argv[1]'], {'col': '(1)'}), '(sys.argv[1], col=1)\n', (67, 87), False, 'from csvcols import get_column\n'), ((103, 133), 'csvcols.get_column', 'get_column', (['sys.argv[1]'], {'col': '(2)'}), '(sys.argv[1], col=2)\n', (113, 133), False, 'from csvcols import get_col... |