repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
Miillky/automate_the_boring_stuff_with_python
Chapter 10/trackbackLog.py
284b074b0738c66f38b54fe0fc5f69b3446e7e43
import traceback try: raise Exception('This is the error message.') except: errorFile = open('./Chapter 10/errorInfo.txt', 'w') errorFile.write(traceback.format_exc()) errorFile.close() print('The traceback info was written to errorInfo.txt')
[((156, 178), 'traceback.format_exc', 'traceback.format_exc', ([], {}), '()\n', (176, 178), False, 'import traceback\n')]
wuchiehhan/KDD2019-HandsOn-Tutorial
Module_III/PySparkNetworkSimilarityClass.py
0377ae4b2a74e9cc08b15c983e4e0f59ab02debe
# Databricks notebook source from pyspark.sql.types import * from pyspark.sql import functions as F import base64 import array # COMMAND ---------- # s is a base64 encoded float[] with first element being the magnitude def Base64ToFloatArray(s): arr = array.array('f', base64.b64decode(s)) return (arr[0], arr[1:])...
[((646, 660), 'pyspark.sql.functions.udf', 'F.udf', (['"""float"""'], {}), "('float')\n", (651, 660), True, 'from pyspark.sql import functions as F\n'), ((273, 292), 'base64.b64decode', 'base64.b64decode', (['s'], {}), '(s)\n', (289, 292), False, 'import base64\n'), ((2664, 2680), 'pyspark.sql.functions.lit', 'F.lit', ...
vagnes/fizzbuzzgame
fizzbuzz.py
de72ffc5a21fbb3b1cfd930ef632b75697fa830f
print("Press q to quit") quit = False while quit is False: in_val = input("Please enter a positive integer.\n > ") if in_val is 'q': quit = True elif int(in_val) % 3 == 0 and int(in_val) % 5 == 0: print("FizzBuzz") elif int(in_val) % 5 == 0: print("Buzz") elif int(in_val) % ...
[]
muzudho/py-state-machine-practice
lesson10019_projects/pen/data/transition.py
e31c066f4cf142b6b6c5ff273b56a0f89428c59e
from lesson14_projects.pen.data.const import ( A, E_A, E_AN, E_IS, E_OVER, E_PEN, E_PIN, E_THAT, E_THIS, E_WAS, INIT, IS, PEN, THIS, ) pen_transition_doc_v19 = { "title": "This is a pen", "entry_state": INIT, "data": { INIT: { E_OV...
[]
olesmith/SmtC
Animation/Main.py
dfae5097f02192b60aae05b9d02404fcfe893be3
import gd,os,time from Html import Animation_Html from Iteration import Animation_Iteration from Write import Animation_Write from Base import * from Canvas2 import * from Canvas2 import Canvas2 from Image import Image from HTML import HTML __Canvas__=None class Animation( Animation_Html, Animation_...
[((1825, 1852), 'Canvas2.Canvas2', 'Canvas2', (['vals', '[pmin, pmax]'], {}), '(vals, [pmin, pmax])\n', (1832, 1852), False, 'from Canvas2 import Canvas2\n'), ((2608, 2629), 'Canvas2.Canvas2', 'Canvas2', (['parms', 'pexts'], {}), '(parms, pexts)\n', (2615, 2629), False, 'from Canvas2 import Canvas2\n')]
junjungoal/pytorch_metric_learning
pytorch_metric_learning/miners/distance_weighted_miner.py
e56bb440d1ec63e13622025209135a788c6f51c1
#! /usr/bin/env python3 from .base_miner import BasePostGradientMiner import torch from ..utils import loss_and_miner_utils as lmu # adapted from # https://github.com/chaoyuaw/incubator-mxnet/blob/master/example/gluon/ # /embedding_learning/model.py class DistanceWeightedMiner(BasePostGradientMiner): def __init_...
[((548, 568), 'torch.unique', 'torch.unique', (['labels'], {}), '(labels)\n', (560, 568), False, 'import torch\n'), ((1681, 1720), 'torch.sum', 'torch.sum', (['weights'], {'dim': '(1)', 'keepdim': '(True)'}), '(weights, dim=1, keepdim=True)\n', (1690, 1720), False, 'import torch\n'), ((1090, 1109), 'torch.log', 'torch....
cassie01/PumpLibrary
Keywords/__init__.py
c2a4884a36f4c6c6552fa942143ae5d21c120b41
# -*- coding: utf-8 -*- from .Alarm.alarm import Alarm from .DeliveryView.bolus import Bolus from .DeliveryView.info import Info from .DeliveryView.infusion import Infusion from .DeliveryView.infusion_parameter import InfusionParameter from .DeliveryView.priming import Priming from .HardwareControl.motor import Motor ...
[]
Azure/automl-devplat2-preview
src/responsibleai/rai_analyse/constants.py
05f327fe4c2504e9d49001ce26d8b49627214138
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- class DashboardInfo: MODEL_ID_KEY = "id" # To match Model schema MODEL_INFO_FILENAME = "model_info.json" RAI_INSIGHTS_MODEL_...
[]
goodboy/pulsar
pulsar/apps/data/redis/store.py
e4b42d94b7e262a165782747d65f8b39fb8d3ba9
from functools import partial from pulsar import Connection, Pool, get_actor from pulsar.utils.pep import to_string from pulsar.apps.data import RemoteStore from pulsar.apps.ds import redis_parser from .client import RedisClient, Pipeline, Consumer, ResponseError from .pubsub import RedisPubSub, RedisChannels class...
[((1192, 1231), 'functools.partial', 'partial', (['RedisStoreConnection', 'Consumer'], {}), '(RedisStoreConnection, Consumer)\n', (1199, 1231), False, 'from functools import partial\n'), ((1776, 1832), 'pulsar.Pool', 'Pool', (['self.connect'], {'pool_size': 'pool_size', 'loop': 'self._loop'}), '(self.connect, pool_size...
tschelbs18/fruitful
tasks/migrations/0005_auto_20200616_0123.py
66635cd521ffc0990275e32298419bfc2167b90b
# Generated by Django 3.0.7 on 2020-06-16 05:23 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('tasks', '0004_auto_20200616_0116'), ] operations = [ migrations.AddField( model_name='userreward', ...
[((369, 443), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)', 'default': 'django.utils.timezone.now'}), '(auto_now_add=True, default=django.utils.timezone.now)\n', (389, 443), False, 'from django.db import migrations, models\n'), ((612, 647), 'django.db.models.DateTimeField', '...
boschresearch/pcg_gazebo_pkgs
pcg_libraries/src/pcg_gazebo/parsers/types/vector.py
1c112d01847ca4f8da61ce9b273e13d13bc7eb73
# Copyright (c) 2019 - The Procedural Generation for Gazebo authors # For information on the respective copyright owner see the NOTICE file # # 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 # #...
[]
uk-gov-mirror/alphagov.digitalmarketplace-briefs-frontend
tests/main/helpers/test_buyers_helpers.py
2325f01b1bdb13fb5b0afe7fe110c0be0c031da6
import mock import pytest from werkzeug.exceptions import NotFound import app.main.helpers as helpers from dmcontent.content_loader import ContentLoader from dmtestutils.api_model_stubs import BriefStub, FrameworkStub, LotStub content_loader = ContentLoader('tests/fixtures/content') content_loader.load_manifest('dos...
[((247, 286), 'dmcontent.content_loader.ContentLoader', 'ContentLoader', (['"""tests/fixtures/content"""'], {}), "('tests/fixtures/content')\n", (260, 286), False, 'from dmcontent.content_loader import ContentLoader\n'), ((2802, 3195), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["['framework', 'lot', 'user'...
devinrsmith/deephaven-core
Plot/src/test/java/io/deephaven/db/plot/example_plots/PlottingPQ.py
3a6930046faf1cd556f62a914ce1cfd7860147b9
import deephaven.TableTools as tt import deephaven.Plot as plt t = tt.emptyTable(50)\ .update("X = i + 5", "XLow = X -1", "XHigh = X + 1", "Y = Math.random() * 5", "YLow = Y - 1", "YHigh = Y + 1", "USym = i % 2 == 0 ? `AAPL` : `MSFT`") p = plt.plot("S1", t, "X", "Y").lineColor("black").show() p2 = plt.plot("S1"...
[((1214, 1244), 'deephaven.Plot.piePlot', 'plt.piePlot', (['"""S1"""', 't', '"""X"""', '"""Y"""'], {}), "('S1', t, 'X', 'Y')\n", (1225, 1244), True, 'import deephaven.Plot as plt\n'), ((2181, 2245), 'deephaven.Plot.ohlcPlot', 'plt.ohlcPlot', (['"""Test1"""', 't', '"""Time"""', '"""Open"""', '"""High"""', '"""Low"""', '...
ahmedmagdyawaad/redhat-ci-dashboard
rhoci/test/routes.py
a9c0445add4e99bb44a8075752a62176968278df
# Copyright 2019 Arie Bregman # # 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 agree...
[((763, 790), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (780, 790), False, 'import logging\n'), ((829, 847), 'rhoci.test.bp.route', 'bp.route', (['"""/index"""'], {}), "('/index')\n", (837, 847), False, 'from rhoci.test import bp\n'), ((849, 862), 'rhoci.test.bp.route', 'bp.route', (...
aarnaut/mitmproxy
mitmproxy/net/http/http1/__init__.py
a8b6f48374b28954f9d8fb5cabbc4fdcaebe9e3a
from .read import ( read_request_head, read_response_head, connection_close, expected_http_body_size, validate_headers, ) from .assemble import ( assemble_request, assemble_request_head, assemble_response, assemble_response_head, assemble_body, ) __all__ = [ "read_request_head", ...
[]
alex-hutton/django-request-token
request_token/migrations/0009_requesttokenerror.py
299c4cb22ce3012c7ef995a648e5b1ea6b8a84d7
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2017-05-21 19:33 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('request_token', '0008_convert_token_data_to_jsonfield'), ...
[((459, 552), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (475, 552), False, 'from django.db import migrations, models\...
ncodeitgithub1/python-get-hands-dirty-programs
01-basic-programs/04-lines.py
c9edb9e0bc9b2580737ca185935427343c550f01
#4 lines: Fibonacci, tuple assignment parents, babies = (1, 1) while babies < 100: print ('This generation has {0} babies'.format(babies)) parents, babies = (babies, parents + babies)
[]
EvgenySmekalin/winter
winter/controller.py
24b6a02f958478547a4a120324823743a1f7e1a1
import typing from .core import Component _Controller = typing.TypeVar('_Controller') _ControllerType = typing.Type[_Controller] ControllerFactory = typing.NewType('ControllerFactory', typing.Callable[[typing.Type], object]) _controller_factory: typing.Optional[ControllerFactory] = None def controller(controller_cl...
[((58, 87), 'typing.TypeVar', 'typing.TypeVar', (['"""_Controller"""'], {}), "('_Controller')\n", (72, 87), False, 'import typing\n'), ((151, 226), 'typing.NewType', 'typing.NewType', (['"""ControllerFactory"""', 'typing.Callable[[typing.Type], object]'], {}), "('ControllerFactory', typing.Callable[[typing.Type], objec...
bobg/rules_go
go/def.bzl
fd11dd2768669dc2cc1f3a11f2b0b81d84e81c32
# Copyright 2014 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
[]
ayalapol/anyway
anyway/parsers/united.py
ebf2436a8f9b152ae8f4d051c129bac754cb8cc1
#!/usr/bin/env python # -*- coding: utf-8 -*- import calendar import csv from datetime import datetime import os from flask_sqlalchemy import SQLAlchemy from sqlalchemy import and_ from ..constants import CONST from ..models import AccidentMarker from ..utilities import init_flask, decode_hebrew, open_utf8 from ..imp...
[((2034, 2074), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (2053, 2074), False, 'import logging\n'), ((2083, 2101), 'requests.session', 'requests.session', ([], {}), '()\n', (2099, 2101), False, 'import requests\n'), ((2180, 2207), 'xml.dom.minidom.parseSt...
joequant/libact
libact/query_strategies/tests/test_variance_reduction.py
4fbf4d59fd0d4e23858b264de2f35f674c50445b
import unittest from numpy.testing import assert_array_equal import numpy as np from libact.base.dataset import Dataset from libact.models import LogisticRegression from libact.query_strategies import VarianceReduction from .utils import run_qs class VarianceReductionTestCase(unittest.TestCase): """Variance red...
[((936, 951), 'unittest.main', 'unittest.main', ([], {}), '()\n', (949, 951), False, 'import unittest\n'), ((879, 901), 'numpy.array', 'np.array', (['[4, 5, 2, 3]'], {}), '([4, 5, 2, 3])\n', (887, 901), True, 'import numpy as np\n'), ((759, 779), 'libact.models.LogisticRegression', 'LogisticRegression', ([], {}), '()\n...
fgreg/hysds
hysds/log_utils.py
74a1019665b02f0f475cc4e7fc0a993dd71d7a53
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from builtins import open from builtins import str from future import standard_library standard_library.install_aliases() import os import re import json import copy imp...
[((238, 272), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (270, 272), False, 'from future import standard_library\n'), ((671, 696), 'celery.utils.log.get_task_logger', 'get_task_logger', (['__name__'], {}), '(__name__)\n', (686, 696), False, 'from celery.utils.log im...
CplusShen/aurora-horizon
openstack_dashboard/api/rest/swift.py
8df16b3b87097d5a19bae3752d4b341ac64bda75
# Copyright 2015, Rackspace, US, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
[((1200, 1217), 'openstack_dashboard.api.rest.utils.ajax', 'rest_utils.ajax', ([], {}), '()\n', (1215, 1217), True, 'from openstack_dashboard.api.rest import utils as rest_utils\n'), ((1573, 1590), 'openstack_dashboard.api.rest.utils.ajax', 'rest_utils.ajax', ([], {}), '()\n', (1588, 1590), True, 'from openstack_dashbo...
kuangliu/pytorch-ssd
datagen.py
02ed1cbe6962e791895ab1c455dc5ddfb87291b9
'''Load image/class/box from a annotation file. The annotation file is organized as: image_name #obj xmin ymin xmax ymax class_index .. ''' from __future__ import print_function import os import sys import os.path import random import numpy as np import torch import torch.utils.data as data import torchvision.t...
[((938, 951), 'encoder.DataEncoder', 'DataEncoder', ([], {}), '()\n', (949, 951), False, 'from encoder import DataEncoder\n'), ((2156, 2186), 'os.path.join', 'os.path.join', (['self.root', 'fname'], {}), '(self.root, fname)\n', (2168, 2186), False, 'import os\n'), ((3309, 3324), 'random.random', 'random.random', ([], {...
allenwang28/lingvo
lingvo/core/builder.py
26d3d6672d3f46d8f281c2aa9f57166ef6296738
# Lint as: python3 # Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
[((1971, 2006), 'lingvo.core.hyperparams.InstantiableParams', 'hyperparams.InstantiableParams', (['cls'], {}), '(cls)\n', (2001, 2006), False, 'from lingvo.core import hyperparams\n'), ((11168, 11203), 'lingvo.core.builder_layers.LinearLayer.Params', 'builder_layers.LinearLayer.Params', ([], {}), '()\n', (11201, 11203)...
gilramir/instmake
instmakelib/instmake_toolnames.py
7b083a5061be43e9b92bdcf0f3badda7c4107eef
# Copyright (c) 2010 by Cisco Systems, Inc. """ Manage the tool plugins and use them appropriately. """ import os TOOLNAME_PLUGIN_PREFIX = "toolname" class ToolNameManager: """ToolName plugins have to register with this manager the circumstances under which they wish to be called.""" def __init__(self, pl...
[((4016, 4043), 'os.path.basename', 'os.path.basename', (['first_arg'], {}), '(first_arg)\n', (4032, 4043), False, 'import os\n')]
tirkarthi/raiden
raiden/tests/integration/long_running/test_stress.py
dbd03ddda039332b54ec0c02d81cbe1100bc8028
import time from http import HTTPStatus from itertools import count from typing import Sequence import gevent import grequests import pytest import structlog from eth_utils import to_canonical_address from flask import url_for from raiden.api.python import RaidenAPI from raiden.api.rest import APIServer, RestAPI from...
[((1325, 1355), 'structlog.get_logger', 'structlog.get_logger', (['__name__'], {}), '(__name__)\n', (1345, 1355), False, 'import structlog\n'), ((10739, 10834), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""flaky, see https://github.com/raiden-network/raiden/issues/4803"""'}), "(reason=\n 'flaky, see h...
jackie930/PyABSA
pyabsa/utils/preprocess.py
3cf733f8b95610a69c985b4650309c24f42b44b5
# -*- coding: utf-8 -*- # file: preprocess.py # author: jackie # Copyright (C) 2021. All Rights Reserved. import os import pandas as pd import argparse import emoji import re from sklearn.model_selection import train_test_split parser = argparse.ArgumentParser() parser.add_argument("--inpath", type=str, required=True...
[((239, 264), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (262, 264), False, 'import argparse\n'), ((3310, 3336), 'os.path.exists', 'os.path.exists', (['dist_fname'], {}), '(dist_fname)\n', (3324, 3336), False, 'import os\n'), ((3428, 3447), 'pandas.read_csv', 'pd.read_csv', (['inpath'], {})...
dparito/10Apps-Python_w-Andy
apps/06_lolcat_factory/you_try/PRD/cat_service.py
77ca1ec280729a9002e49071e2f31cb5bc7b75cd
import os import shutil import requests def get_cat(folder, name): url = "http://consuming-python-services-api.azurewebsites.net/cats/random" data = get_data_from_url(url) save_image(folder, name, data) def get_data_from_url(url): response = requests.get(url, stream=True) return response.raw ...
[((263, 293), 'requests.get', 'requests.get', (['url'], {'stream': '(True)'}), '(url, stream=True)\n', (275, 293), False, 'import requests\n'), ((372, 407), 'os.path.join', 'os.path.join', (['folder', "(name + '.jpg')"], {}), "(folder, name + '.jpg')\n", (384, 407), False, 'import os\n'), ((456, 486), 'shutil.copyfileo...
TryTestspace/dask
dask/dataframe/io/hdf.py
86d4f7d8c6d48ec6c4b1de1b6cfd2d3f4e5a4c1b
from __future__ import absolute_import, division, print_function from fnmatch import fnmatch from glob import glob import os import uuid from warnings import warn import pandas as pd from toolz import merge from .io import _link from ...base import get_scheduler from ..core import DataFrame, new_dd_object from ... i...
[((7395, 7414), 'toolz.merge', 'merge', (['df.dask', 'dsk'], {}), '(df.dask, dsk)\n', (7400, 7414), False, 'from toolz import merge\n'), ((10493, 10534), 'pandas.read_hdf', 'pd.read_hdf', (['path', 'key'], {'mode': 'mode', 'stop': '(0)'}), '(path, key, mode=mode, stop=0)\n', (10504, 10534), True, 'import pandas as pd\n...
mononobi/charma-server
src/charma/media_info/manager.py
ed90f5ec0b5ff3996232d5fe49a4f77f96d82ced
# -*- coding: utf-8 -*- """ media info manager module. """ from pyrin.core.mixin import HookMixin from pyrin.core.structs import Manager import pyrin.utils.path as path_utils from charma.media_info import MediaInfoPackage from charma.media_info.interface import AbstractMediaInfoProvider from charma.media_info.except...
[((1994, 2025), 'pyrin.utils.path.assert_is_file', 'path_utils.assert_is_file', (['file'], {}), '(file)\n', (2019, 2025), True, 'import pyrin.utils.path as path_utils\n')]
FlorisHoogenboom/BoxRec
tests/test_parsers.py
c9cc5d149318f916facdf57d7dbe94e797d81582
import unittest from boxrec.parsers import FightParser class MockResponse(object): def __init__(self, content, encoding, url): self.content= content self.encoding = encoding self.url = url class TestFightParser(unittest.TestCase): def setUp(self): with open('mock_data/fights/...
[((413, 426), 'boxrec.parsers.FightParser', 'FightParser', ([], {}), '()\n', (424, 426), False, 'from boxrec.parsers import FightParser\n')]
ErikGartner/hyperdock
hyperdock/common/workqueue.py
19510b4bf1e123576d7be067555d959cb8a7cf45
from datetime import datetime, timedelta from bson.objectid import ObjectId WORK_TIMEOUT = 600 class WorkQueue: """ A simple MongoDB priority work queue that handles the queue of experiment. """ def __init__(self, mongodb): super().__init__() self._mongodb = mongodb sel...
[((523, 540), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (538, 540), False, 'from datetime import datetime, timedelta\n'), ((1730, 1747), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (1745, 1747), False, 'from datetime import datetime, timedelta\n'), ((2218, 2235), 'datetime.da...
poojavade/Genomics_Docker
Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/apache_libcloud-0.15.1-py2.7.egg/libcloud/test/test_connection.py
829b5094bba18bbe03ae97daf925fee40a8476e8
# -*- coding: utf-8 -*- # Licensed to the Apache Software Foundation (ASF) under one or more§ # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "Li...
[((1200, 1206), 'mock.Mock', 'Mock', ([], {}), '()\n', (1204, 1206), False, 'from mock import Mock, call\n'), ((1240, 1246), 'mock.Mock', 'Mock', ([], {}), '()\n', (1244, 1246), False, 'from mock import Mock, call\n'), ((1550, 1574), 'libcloud.common.base.Connection', 'Connection', ([], {'secure': '(False)'}), '(secure...
mamadbiabon/iGibson
igibson/utils/data_utils/ext_object/scripts/step_1_visual_mesh.py
d416a470240eb7ad86e04fee475ae4bd67263a7c
import os import sys import bpy script_dir = os.path.dirname(os.path.abspath(__file__)) utils_dir = os.path.join(script_dir, "../../blender_utils") sys.path.append(utils_dir) from utils import bake_model, clean_unused, export_ig_object, import_obj_folder ############################################# # Parse command...
[((102, 149), 'os.path.join', 'os.path.join', (['script_dir', '"""../../blender_utils"""'], {}), "(script_dir, '../../blender_utils')\n", (114, 149), False, 'import os\n'), ((150, 176), 'sys.path.append', 'sys.path.append', (['utils_dir'], {}), '(utils_dir)\n', (165, 176), False, 'import sys\n'), ((1248, 1284), 'os.mak...
mail2nsrajesh/python-ceilometerclient
ceilometerclient/common/base.py
3b4e35abada626ce052f20d55c71fe12ab77052a
# Copyright 2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
[((3031, 3056), 'copy.deepcopy', 'copy.deepcopy', (['self._info'], {}), '(self._info)\n', (3044, 3056), False, 'import copy\n')]
freyes/charm-azure-integrator
lib/charms/layer/azure.py
9c96eed30388e5e7ae2ff590574890e27e845b5c
import json import os import re import subprocess from base64 import b64decode from enum import Enum from math import ceil, floor from pathlib import Path from urllib.error import HTTPError from urllib.request import urlopen import yaml from charmhelpers.core import hookenv from charmhelpers.core.unitdata import kv ...
[((1384, 1400), 'charmhelpers.core.hookenv.config', 'hookenv.config', ([], {}), '()\n', (1398, 1400), False, 'from charmhelpers.core import hookenv\n'), ((2443, 2471), 'charms.layer.status.blocked', 'status.blocked', (['no_creds_msg'], {}), '(no_creds_msg)\n', (2457, 2471), False, 'from charms.layer import status\n'), ...
pankajk22/Computer-Networks-Assignments
Assignment-1/Code/server3.py
5c227ef59c31ab52cde160568242dbbc84482bc5
import socket import csv import traceback import threading s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) usrpass={} def openfile(): filename="login_credentials.csv" with open(filename,'r')as csvfile: csv_file = csv.reader(csvfile, delimiter=",") for col in csv_file: usrpas...
[((62, 111), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (75, 111), False, 'import socket\n'), ((401, 421), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (419, 421), False, 'import socket\n'), ((427, 454), 'socket.gethostbyn...
joaopfonseca/research
research/utils/_check_pipelines.py
02659512218d077d9ef28d481178e62172ef18cd
from itertools import product from sklearn.base import clone from sklearn.preprocessing import FunctionTransformer from sklearn.model_selection import ParameterGrid from imblearn.pipeline import Pipeline from rlearn.utils import check_random_states def check_pipelines(objects_list, random_state, n_runs): """Extra...
[((407, 448), 'rlearn.utils.check_random_states', 'check_random_states', (['random_state', 'n_runs'], {}), '(random_state, n_runs)\n', (426, 448), False, 'from rlearn.utils import check_random_states\n'), ((517, 539), 'itertools.product', 'product', (['*objects_list'], {}), '(*objects_list)\n', (524, 539), False, 'from...
PuzeLiu/mushroom-rl
mushroom_rl/utils/plots/common_plots.py
99942b425e66b4ddcc26009d7105dde23841e95d
from mushroom_rl.utils.plots import PlotItemBuffer, DataBuffer from mushroom_rl.utils.plots.plot_item_buffer import PlotItemBufferLimited class RewardPerStep(PlotItemBuffer): """ Class that represents a plot for the reward at every step. """ def __init__(self, plot_buffer): """ Constr...
[]
helion-security/helion
libs/python-daemon-2.2.0/test/test_metadata.py
1e5f22da9808c4d67bb773b93c5295c72fcaf45a
# -*- coding: utf-8 -*- # # test/test_metadata.py # Part of ‘python-daemon’, an implementation of PEP 3143. # # This is free software, and you are welcome to redistribute it under # certain conditions; see the end of this file for copyright # information, grant of license, and disclaimer of warranty. """ Unit test for...
[((4225, 4282), 'collections.namedtuple', 'collections.namedtuple', (['"""FakeYearRange"""', "['begin', 'end']"], {}), "('FakeYearRange', ['begin', 'end'])\n", (4247, 4282), False, 'import collections\n'), ((4285, 4344), 'mock.patch.object', 'mock.patch.object', (['metadata', '"""YearRange"""'], {'new': 'FakeYearRange'...
wheatdog/CDM
objectModel/Python/cdm/persistence/cdmfolder/types/purpose_reference.py
8b6698f4a8b4f44132b12d97f9f261afcfeb798c
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. from typing import Union, List from .purpose import * from .trait_reference import TraitReference from cdm.utilities import JObject class PurposeReference(JObje...
[]
cyberpunk317/inverted_index
text_preprocessing/normalizer.py
f49ae3ca4f0255928986c1610c5ff8ee38c5f1ff
import re from typing import Union, List import nltk from bs4 import BeautifulSoup class Normalizer: def __init__(self): self.lemmatizer = nltk.stem.WordNetLemmatizer() def normalize(self, x: Union[list, str]) -> List[str]: """ Accepts text (possibly tokenized) and makes it ...
[((159, 188), 'nltk.stem.WordNetLemmatizer', 'nltk.stem.WordNetLemmatizer', ([], {}), '()\n', (186, 188), False, 'import nltk\n'), ((1581, 1609), 're.sub', 're.sub', (['""",|\\\\.|!|\\\\?"""', '""""""', 'x'], {}), "(',|\\\\.|!|\\\\?', '', x)\n", (1587, 1609), False, 'import re\n'), ((710, 748), 'nltk.corpus.stopwords.w...
MarcoMancha/BreastCancerDetector
env/lib/python3.7/site-packages/prompt_toolkit/filters/cli.py
be0dfdcebd1ae66da6d0cf48e2525c24942ae877
""" For backwards-compatibility. keep this file. (Many people are going to have key bindings that rely on this file.) """ from __future__ import unicode_literals from .app import * __all__ = [ # Old names. 'HasArg', 'HasCompletions', 'HasFocus', 'HasSelection', 'HasValidationError', 'IsDon...
[]
shilpasayura/bk
genetic/spaces.py
2b0a1aa9300da80e201264bcf80226b3c5ff4ad6
#spaces.py ''' AlgoHack Genetic Algorithm for University Semaster Planning Version 0.03 2018 Niranjan Meegammana Shilpasayura.org ''' import xdb def crt_spaces_table(cursor,drop=False): if (drop): sql="DROP TABLE IF EXISTS spaces;" success, count=xdb.runSQL(cursor, sql) sql='''C...
[((553, 576), 'xdb.runSQL', 'xdb.runSQL', (['cursor', 'sql'], {}), '(cursor, sql)\n', (563, 576), False, 'import xdb\n'), ((904, 927), 'xdb.runSQL', 'xdb.runSQL', (['cursor', 'sql'], {}), '(cursor, sql)\n', (914, 927), False, 'import xdb\n'), ((1540, 1577), 'xdb.runSQL_stmts', 'xdb.runSQL_stmts', (['cursor', 'sqls', 'd...
hyansuper/flask-video-streaming
threaded_remote_pi_camera.py
a6ba19519b9ba5470e59e535552b3e8c448d57ae
import urllib.request import cv2 import numpy as np import time import threading class ThreadedRemotePiCamera: def __init__(self, pi_address, resolution=(320,240), framerate=10, hflip=False, vflip=False): if hflip and vflip: self.flip = -1 elif hflip: self.flip = 0 e...
[((591, 608), 'threading.Event', 'threading.Event', ([], {}), '()\n', (606, 608), False, 'import threading\n'), ((627, 673), 'threading.Thread', 'threading.Thread', ([], {'target': 'self.run', 'daemon': '(True)'}), '(target=self.run, daemon=True)\n', (643, 673), False, 'import threading\n'), ((1456, 1518), 'numpy.froms...
jalawala/custom-kubernetes-scheduler
scheduler/misc/Ec2SpotCustomScheduler_jan19.py
07ccba57610048185a245257a1501f6273399d80
#! /usr/bin/python3 import time import random import json import os from pprint import pprint from kubernetes.client.rest import ApiException from pint import UnitRegistry from collections import defaultdict from kubernetes import client, config, watch from timeloop import Timeloop from datetime import timedelt...
[((325, 350), 'kubernetes.config.load_kube_config', 'config.load_kube_config', ([], {}), '()\n', (348, 350), False, 'from kubernetes import client, config, watch\n'), ((484, 502), 'kubernetes.client.CoreV1Api', 'client.CoreV1Api', ([], {}), '()\n', (500, 502), False, 'from kubernetes import client, config, watch\n'), (...
DewiBrynJones/docker-deepspeech-cy
local/utils/validate_label_locale.py
99159a746651bd848a8309da7f676045913f3d25
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from clean_transcript import clean_transcript ALPHABET_FILE_PATH = "/DeepSpeech/bin/bangor_welsh/alphabet.txt" def validate_label(label): clean = clean_transcript(ALPHABET_FILE_PATH) cleaned, transcript = clean.clean(label) if cleaned: return transc...
[((201, 237), 'clean_transcript.clean_transcript', 'clean_transcript', (['ALPHABET_FILE_PATH'], {}), '(ALPHABET_FILE_PATH)\n', (217, 237), False, 'from clean_transcript import clean_transcript\n')]
dumpmemory/state-spaces
src/models/nn/adaptive_softmax.py
2a85503cb3e9e86cc05753950d4a249df9a0fffb
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
[((13488, 13533), 'functools.partial', 'functools.partial', (['_init_weight'], {'default': '(0.02)'}), '(_init_weight, default=0.02)\n', (13505, 13533), False, 'import functools\n'), ((13547, 13592), 'functools.partial', 'functools.partial', (['_init_weight'], {'default': '(0.01)'}), '(_init_weight, default=0.01)\n', (...
CityOfPhiladelphia/the-el
the_el/cli.py
e3a97afc55d41f2e5fd76cef60ad9393dfa23547
import json import csv import sys import os import re import codecs import logging from logging.config import dictConfig import click import yaml from sqlalchemy import create_engine from jsontableschema_sql import Storage from smart_open import smart_open from . import postgres from . import carto csv.field_size_li...
[((303, 336), 'csv.field_size_limit', 'csv.field_size_limit', (['sys.maxsize'], {}), '(sys.maxsize)\n', (323, 336), False, 'import csv\n'), ((899, 912), 'click.group', 'click.group', ([], {}), '()\n', (910, 912), False, 'import click\n'), ((2014, 2042), 'click.argument', 'click.argument', (['"""table_name"""'], {}), "(...
vadam5/NeMo
examples/asr/experimental/speech_to_text_sclite.py
3c5db09539293c3c19a6bb7437011f91261119af
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[((2469, 2494), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (2492, 2494), False, 'import torch\n'), ((1409, 1448), 'os.path.join', 'os.path.join', (['sctk_dir', '"""bin"""', '"""sclite"""'], {}), "(sctk_dir, 'bin', 'sclite')\n", (1421, 1448), False, 'import os\n'), ((1598, 1617), 'os.path.ex...
pj0620/acca-video-series
accalib/utils.py
1b09548014cc899ded5a8fdd1293f7fc121a98bc
from manimlib.imports import * from manimlib.utils import bezier import numpy as np class VectorInterpolator: def __init__(self,points): self.points = points self.n = len(self.points) self.dists = [0] for i in range(len(self.points)): self.dists += [np.linalg.norm( ...
[((575, 641), 'numpy.linalg.norm', 'np.linalg.norm', (['(self.points[(idx + 1) % self.n] - self.points[idx])'], {}), '(self.points[(idx + 1) % self.n] - self.points[idx])\n', (589, 641), True, 'import numpy as np\n'), ((300, 362), 'numpy.linalg.norm', 'np.linalg.norm', (['(self.points[i] - self.points[(i + 1) % self.n]...
def-mycroft/rapid-plotly
setup.py
87ba5d9e6894e2c3288435aae9a377647b006e79
from setuptools import setup setup(name='rapid_plotly', version='0.1', description='Convenience functions to rapidly create beautiful Plotly graphs', author='Joseph Dasenbrock', author_email='dasenbrockjw@gmail.com', packages=['rapid_plotly'], zip_safe=False)
[((30, 273), 'setuptools.setup', 'setup', ([], {'name': '"""rapid_plotly"""', 'version': '"""0.1"""', 'description': '"""Convenience functions to rapidly create beautiful Plotly graphs"""', 'author': '"""Joseph Dasenbrock"""', 'author_email': '"""dasenbrockjw@gmail.com"""', 'packages': "['rapid_plotly']", 'zip_safe': '...
enerqi/bridge-bidding-systems
dodo.py
30ea2bf6f8bc0b786df4de8571063509d971236f
#! /usr/bin/doit -f # https://pydoit.org # `pip install [--user] doit` adds `doit.exe` to the PATH # - Note `doit auto`, the file watcher only works on Linux/Mac # - All commands are relative to dodo.py (doit runs in the working dir of dodo.py # even if ran from a different directory `doit -f path/to/dodo.py`) from g...
[((586, 606), 'typing.NewType', 'NewType', (['"""Path"""', 'str'], {}), "('Path', str)\n", (593, 606), False, 'from typing import Iterator, List, NewType, Optional\n'), ((620, 635), 'os.path.expanduser', 'expanduser', (['"""~"""'], {}), "('~')\n", (630, 635), False, 'from os.path import abspath, basename, dirname, exis...
hustbill/Python-auto
learn/hard-way/EmptyFileError.py
9f43bc2613a64a373927047ac52d8e90ffe644f8
class EmptyFileError(Exception): pass filenames = ["myfile1", "nonExistent", "emptyFile", "myfile2"] for file in filenames: try: f = open(file, 'r') line = f.readline() if line == "": f.close() raise EmptyFileError("%s: is empty" % file) # except IO...
[]
jimconner/digital_sky
plugins/crumbling_in.py
9427cd19dbd9fb1c82ca12fa8f962532d700c67f
# Crumbling In # Like randomised coloured dots and then they # increase on both sides getting closer and closer into the middle. import sys, traceback, random from numpy import array,full class animation(): def __init__(self,datastore): self.max_led = datastore.LED_COUNT self.pos = 0 self....
[((646, 672), 'numpy.full', 'full', (['(self.max_led, 4)', '(0)'], {}), '((self.max_led, 4), 0)\n', (650, 672), False, 'from numpy import array, full\n'), ((1251, 1287), 'traceback.print_exc', 'traceback.print_exc', ([], {'file': 'sys.stdout'}), '(file=sys.stdout)\n', (1270, 1287), False, 'import sys, traceback, random...
KBIbiopharma/pybleau
pybleau/app/plotting/tests/test_plot_config.py
5cdfce603ad29af874f74f0f527adc6b4c9066e8
from __future__ import division from unittest import skipIf, TestCase import os from pandas import DataFrame import numpy as np from numpy.testing import assert_array_equal BACKEND_AVAILABLE = os.environ.get("ETS_TOOLKIT", "qt4") != "null" if BACKEND_AVAILABLE: from app_common.apptools.testing_utils import asser...
[((5646, 5702), 'unittest.skipIf', 'skipIf', (['(not BACKEND_AVAILABLE)', '"""No UI backend available"""'], {}), "(not BACKEND_AVAILABLE, 'No UI backend available')\n", (5652, 5702), False, 'from unittest import skipIf, TestCase\n'), ((8462, 8518), 'unittest.skipIf', 'skipIf', (['(not BACKEND_AVAILABLE)', '"""No UI bac...
thomasrockhu/bfg9000
test/integration/languages/test_mixed.py
1cd1226eab9bed2fc2ec6acccf7864fdcf2ed31a
import os.path from .. import * class TestMixed(IntegrationTest): def __init__(self, *args, **kwargs): super().__init__(os.path.join('languages', 'mixed'), *args, **kwargs) def test_build(self): self.build(executable('program')) self.assertOutput([executable('program')], 'hello from ...
[]
TeamLab/introduction_to_pythoy_TEAMLAB_MOOC
code/7/collections/namedtupe_example.py
ebf1ff02d6a341bfee8695eac478ff8297cb97e4
from collections import namedtuple # Basic example Point = namedtuple('Point', ['x', 'y']) p = Point(11, y=22) print(p[0] + p[1]) x, y = p print(x, y) print(p.x + p.y) print(Point(x=11, y=22)) from collections import namedtuple import csv f = open("users.csv", "r") next(f) reader = csv.reader(f) student_list = [] fo...
[((60, 91), 'collections.namedtuple', 'namedtuple', (['"""Point"""', "['x', 'y']"], {}), "('Point', ['x', 'y'])\n", (70, 91), False, 'from collections import namedtuple\n'), ((286, 299), 'csv.reader', 'csv.reader', (['f'], {}), '(f)\n', (296, 299), False, 'import csv\n'), ((590, 620), 'collections.namedtuple', 'namedtu...
dotnes/mitmproxy
test/helper_tools/benchtool.py
5eb17bbf6d47c8d703763bfa41cf1ff3f98a632f
# Profile mitmdump with apachebench and # yappi (https://code.google.com/p/yappi/) # # Requirements: # - Apache Bench "ab" binary # - pip install click yappi from mitmproxy.main import mitmdump from os import system from threading import Thread import time import yappi import click class ApacheBenchThread(Thread): ...
[((580, 595), 'click.command', 'click.command', ([], {}), '()\n', (593, 595), False, 'import click\n'), ((760, 816), 'click.option', 'click.option', (['"""--concurrency"""'], {'default': '(1)', 'type': 'click.INT'}), "('--concurrency', default=1, type=click.INT)\n", (772, 816), False, 'import click\n'), ((1129, 1172), ...
alexliberzonlab/pivpy
pivpy/graphics.py
c1c984cd669fce6f5c0b6a602d6a51ed3fec5954
# -*- coding: utf-8 -*- """ Various plots """ import numpy as np import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation, FFMpegWriter import xarray as xr import os def quiver(data, arrScale = 25.0, threshold = None, nthArr = 1, contourLevels = None, colbar = True, logscale = Fa...
[((1913, 1930), 'matplotlib.pyplot.get_fignums', 'plt.get_fignums', ([], {}), '()\n', (1928, 1930), True, 'import matplotlib.pyplot as plt\n'), ((3479, 3494), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {}), '(2)\n', (3491, 3494), True, 'import matplotlib.pyplot as plt\n'), ((3624, 3656), 'matplotlib.pyplot...
BostonCrayfish/mmsegmentation
configs/my_config/vit_base_aspp.py
e8b87242b877bfe0c32ea2630c2fd08977d7dd4b
# model settings norm_cfg = dict(type='BN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='pretrain/vit_base_patch16_224.pth', backbone=dict( type='VisionTransformer', img_size=(224, 224), patch_size=16, in_channels=3, embed_dim=768, dept...
[]
smolar/tripleo-ansible
tripleo_ansible/ansible_plugins/modules/podman_container.py
7bd37f019870c032bea71f22b305832932d81424
#!/usr/bin/python # Copyright (c) 2019 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
[((27491, 27532), 'ansible.module_utils._text.to_bytes', 'to_bytes', (['i'], {'errors': '"""surrogate_or_strict"""'}), "(i, errors='surrogate_or_strict')\n", (27499, 27532), False, 'from ansible.module_utils._text import to_bytes, to_native\n'), ((27700, 27741), 'ansible.module_utils._text.to_bytes', 'to_bytes', (['i']...
UdoGi/dark-matter
setup.py
3d49e89fa5e81f83144119f6216c5774176d203b
#!/usr/bin/env python from setuptools import setup # Modified from http://stackoverflow.com/questions/2058802/ # how-can-i-get-the-version-defined-in-setup-py-setuptools-in-my-package def version(): import os import re init = os.path.join('dark', '__init__.py') with open(init) as fp: initDat...
[((242, 277), 'os.path.join', 'os.path.join', (['"""dark"""', '"""__init__.py"""'], {}), "('dark', '__init__.py')\n", (254, 277), False, 'import os\n'), ((346, 415), 're.search', 're.search', (['"""^__version__ = [\'\\\\"]([^\'\\\\"]+)[\'\\\\"]"""', 'initData', 're.M'], {}), '(\'^__version__ = [\\\'\\\\"]([^\\\'\\\\"]+...
FilipBali/VirtualPortfolio-WebApplication
authenticationApp/templatetags/timetags.py
9236509205e37c2c682b7b2f518f5794a94fd178
# ====================================================================================================================== # Fakulta informacnich technologii VUT v Brne # Bachelor thesis # Author: Filip Bali (xbalif00) # License: MIT # ======================================================================================...
[((472, 490), 'django.template.Library', 'template.Library', ([], {}), '()\n', (488, 490), False, 'from django import template\n'), ((1209, 1258), 'portfolioApp.models.NotificationEvent.objects.get', 'NotificationEvent.objects.get', ([], {'id': 'notification_id'}), '(id=notification_id)\n', (1238, 1258), False, 'from p...
donatoaz/pycfmodel
pycfmodel/model/resources/properties/policy.py
1586e290b67d2347493dd4a77d2b0c8ee6c0936b
from pycfmodel.model.resources.properties.policy_document import PolicyDocument from pycfmodel.model.resources.properties.property import Property from pycfmodel.model.types import Resolvable, ResolvableStr class Policy(Property): """ Contains information about an attached policy. Properties: - Poli...
[]
mrahim/stacked-learn
stlearn/__init__.py
b04b49f65f06de7f5b59ba4139b0f78f8d66d94a
from .stacking import StackingClassifier, stack_features from .multitask import MultiTaskEstimator
[]
utsavm9/wasm-micro-runtime
samples/workload/XNNPACK/toolchain/emscripten_toolchain_config.bzl
0960e82db2be30b741f5c83e7a57ea9056b2ab59
# Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES") load( "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", "feature", "flag_group", "flag_set", "tool_p...
[]
toplenboren/safezone
cloud_storages/gdrive/gdrive.py
eafad765ed7cd6f6b7607ac07e75fd843d32ee07
from __future__ import print_function import json from typing import List from functools import lru_cache from cloud_storages.http_shortcuts import * from database.database import Database from models.models import StorageMetaInfo, Resource, Size from cloud_storages.storage import Storage from cloud_storages.gdrive.c...
[((654, 677), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': 'None'}), '(maxsize=None)\n', (663, 677), False, 'from functools import lru_cache\n'), ((8527, 8552), 'database.database.Database', 'Database', (['"""../storage.db"""'], {}), "('../storage.db')\n", (8535, 8552), False, 'from database.database import Dat...
darkestmidnight/fedcodeathon2018
index/urls.py
2cac972b6eaebd7bfc47c02aade36b0f4a6869ab
from django.urls import re_path, include from . import views app_name='logged' # url mappings for the webapp. urlpatterns = [ re_path(r'^$', views.logged_count, name="logged_count"), re_path(r'^loggedusers/', views.logged, name="logged_users"), re_path(r'^settings/', views.user_settings, name="update_info...
[((132, 186), 'django.urls.re_path', 're_path', (['"""^$"""', 'views.logged_count'], {'name': '"""logged_count"""'}), "('^$', views.logged_count, name='logged_count')\n", (139, 186), False, 'from django.urls import re_path, include\n'), ((193, 252), 'django.urls.re_path', 're_path', (['"""^loggedusers/"""', 'views.logg...
uw-it-aca/scout
scout/dao/item.py
be787378c216f1fb172d68914a550a91c62bc264
# Copyright 2021 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from scout.dao.space import get_spots_by_filter, _get_spot_filters, \ _get_extended_info_by_key import copy def get_item_by_id(item_id): spot = get_spots_by_filter([ ('item:id', item_id), ('extended...
[((242, 321), 'scout.dao.space.get_spots_by_filter', 'get_spots_by_filter', (["[('item:id', item_id), ('extended_info:app_type', 'tech')]"], {}), "([('item:id', item_id), ('extended_info:app_type', 'tech')])\n", (261, 321), False, 'from scout.dao.space import get_spots_by_filter, _get_spot_filters, _get_extended_info_b...
umeboshi2/juriscraper
juriscraper/opinions/united_states/state/minnctapp.py
16abceb3747947593841b1c2708de84dcc85c59d
#Scraper for Minnesota Court of Appeals Published Opinions #CourtID: minnctapp #Court Short Name: MN #Author: mlr #Date: 2016-06-03 from juriscraper.opinions.united_states.state import minn class Site(minn.Site): # Only subclasses minn for the _download method. def __init__(self, *args, **kwargs): s...
[]
JosephMontoya-TRI/monty
monty/os/__init__.py
facef1776c7d05c941191a32a0b93f986a9761dd
from __future__ import absolute_import import os import errno from contextlib import contextmanager __author__ = 'Shyue Ping Ong' __copyright__ = 'Copyright 2013, The Materials Project' __version__ = '0.1' __maintainer__ = 'Shyue Ping Ong' __email__ = 'ongsp@ucsd.edu' __date__ = '1/24/14' @contextmanager def cd(pa...
[((616, 627), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (625, 627), False, 'import os\n'), ((632, 646), 'os.chdir', 'os.chdir', (['path'], {}), '(path)\n', (640, 646), False, 'import os\n'), ((691, 704), 'os.chdir', 'os.chdir', (['cwd'], {}), '(cwd)\n', (699, 704), False, 'import os\n'), ((1058, 1085), 'os.makedirs',...
FrancisMudavanhu/cookiecutter-data-science
{{ cookiecutter.repo_name }}/tests/test_environment.py
be766817a7399ccd714bf03d085609985fa7313a
import sys REQUIRED_PYTHON = "python3" required_major = 3 def main(): system_major = sys.version_info.major if system_major != required_major: raise TypeError( f"This project requires Python {required_major}." f" Found: Python {sys.version}") else: print(">>> ...
[]
siagholami/aws-documentation
documents/aws-doc-sdk-examples/python/example_code/kda/kda-python-datagenerator-stockticker.py
2d06ee9011f3192b2ff38c09f04e01f1ea9e0191
# snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.] # snippet-sourcedescription:[kda-python-datagenerator-stockticker.py demonstrates how to generate sample data for Amazon Kinesis Data Analytics SQL applications.] # snippet-service:[kinesisanalytics] # snippet-keyword:[Python] # sn...
[((1236, 1259), 'boto3.client', 'boto3.client', (['"""kinesis"""'], {}), "('kinesis')\n", (1248, 1259), False, 'import boto3\n'), ((1303, 1326), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1324, 1326), False, 'import datetime\n'), ((1411, 1465), 'random.choice', 'random.choice', (["['AAPL', 'AM...
alexespejo/project-argus
backend/app.py
53a6a8b1790906044bffbd2db156322938b62da9
import face_recognition from flask import Flask, request, redirect, Response import camera import firestore as db # You can change this to any folder on your system ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg'} app = Flask(__name__) def allowed_file(filename): return '.' in filename and \ filename....
[((221, 236), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (226, 236), False, 'from flask import Flask, request, redirect, Response\n'), ((470, 515), 'face_recognition.load_image_file', 'face_recognition.load_image_file', (['file_stream'], {}), '(file_stream)\n', (502, 515), False, 'import face_recogniti...
fishial/Object-Detection-Model
module/classification_package/src/utils.py
4792f65ea785156a8e240d9cdbbc0c9d013ea0bb
import numpy as np import logging import numbers import torch import math import json import sys from torch.optim.lr_scheduler import LambdaLR from torchvision.transforms.functional import pad class AverageMeter(object): """Computes and stores the average and current value""" def __init__(self): sel...
[((3352, 3366), 'numpy.max', 'np.max', (['[w, h]'], {}), '([w, h])\n', (3358, 3366), True, 'import numpy as np\n'), ((4799, 4825), 'logging.getLogger', 'logging.getLogger', (['"""train"""'], {}), "('train')\n", (4816, 4825), False, 'import logging\n'), ((5465, 5500), 'torch.tensor', 'torch.tensor', (['[0.485, 0.456, 0....
L-Net-1992/mlflow
tests/pylint_plugins/test_assert_raises_without_msg.py
a90574dbb730935c815ff41a0660b9a823b81630
import pytest from tests.pylint_plugins.utils import create_message, extract_node, skip_if_pylint_unavailable pytestmark = skip_if_pylint_unavailable() @pytest.fixture(scope="module") def test_case(): import pylint.testutils from pylint_plugins import AssertRaisesWithoutMsg class TestAssertRaisesWithou...
[((125, 153), 'tests.pylint_plugins.utils.skip_if_pylint_unavailable', 'skip_if_pylint_unavailable', ([], {}), '()\n', (151, 153), False, 'from tests.pylint_plugins.utils import create_message, extract_node, skip_if_pylint_unavailable\n'), ((157, 187), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'})...
AV321/SVPackage
SVassembly/plot_bcs_across_bkpts.py
c9c625af7f5047ddb43ae79f8beb2ce9aadf7697
import pandas as pd import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.colors import csv from scipy.stats import mode import math as m import os import collections #set working directory #os.chdir("/mnt/ix1/Projects/M002_131217_gastric/P00526/P00526_WG10_15072...
[((57, 78), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (71, 78), False, 'import matplotlib\n'), ((897, 918), 'pandas.read_table', 'pd.read_table', (['file_1'], {}), '(file_1)\n', (910, 918), True, 'import pandas as pd\n'), ((931, 952), 'pandas.read_table', 'pd.read_table', (['file_2'], {}), '...
ChidinmaKO/Chobe-bitesofpy
bites/bite029.py
2f933e6c8877a37d1ce7ef54ea22169fc67417d3
def get_index_different_char(chars): alnum = [] not_alnum = [] for index, char in enumerate(chars): if str(char).isalnum(): alnum.append(index) else: not_alnum.append(index) result = alnum[0] if len(alnum) < len(not_alnum) else not_alnum[0] return result ...
[]
derlin/SwigSpot_Schwyzertuutsch-Spotting
language-detection-webapp/blueprints/langid.py
f38c8243ff34c6e512cadab5e4f51b08dacc16c6
import logging from flask import Blueprint from flask import Flask, render_template, request, flash from flask_wtf import FlaskForm from wtforms import StringField, validators, SelectField, BooleanField from wtforms.fields.html5 import IntegerRangeField from wtforms.widgets import TextArea import langid from utils.u...
[((362, 391), 'flask.Blueprint', 'Blueprint', (['"""langid"""', '__name__'], {}), "('langid', __name__)\n", (371, 391), False, 'from flask import Blueprint\n'), ((1575, 1598), 'utils.utils.templated', 'templated', (['"""index.html"""'], {}), "('index.html')\n", (1584, 1598), False, 'from utils.utils import templated\n'...
kehw/spack
var/spack/repos/builtin/packages/r-xts/package.py
4f49b1a9301447a8cf880c99820cad65e5c2d7e3
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RXts(RPackage): """Provide for uniform handling of R's different time-based data classes b...
[]
threefoldtech/threebot_prebuilt
sandbox/lib/jumpscale/Jumpscale/core/BASECLASSES/JSConfigsBCDB.py
1f0e1c65c14cef079cd80f73927d7c8318755c48
# Copyright (C) July 2018: TF TECH NV in Belgium see https://www.threefold.tech/ # In case TF TECH NV ceases to exist (e.g. because of bankruptcy) # then Incubaid NV also in Belgium will get the Copyright & Authorship for all changes made since July 2018 # and the license will automatically become Apache v2 for al...
[((1888, 1937), 'Jumpscale.j.exceptions.Base', 'j.exceptions.Base', (['"""cannot do new object, exists"""'], {}), "('cannot do new object, exists')\n", (1905, 1937), False, 'from Jumpscale import j\n'), ((6306, 6417), 'Jumpscale.j.exceptions.Base', 'j.exceptions.Base', (["('Did not find instance for:%s, name searched f...
holderekt/regression-tree
source/tree.py
130fe07262faea8681159092718310d9aefe9889
import utils as utl import error_measures as err # Regression Tree Node class Node: def __init__(self, parent, node_id, index=None, value=None, examples=None, prediction=0): self.index = index self.id = node_id self.prediction = prediction self.value = value self.parent = pa...
[]
ninaamorim/sentiment-analysis-2018-president-election
src/site/config.py
a5c12f1b659186edbc2dfa916bc82a2cfa2dd67f
from starlette.applications import Starlette from starlette.middleware.gzip import GZipMiddleware from starlette.middleware.cors import CORSMiddleware from starlette.staticfiles import StaticFiles app = Starlette(debug=False, template_directory='src/site/templates') app.add_middleware(GZipMiddleware, minimum_size=500)...
[((204, 267), 'starlette.applications.Starlette', 'Starlette', ([], {'debug': '(False)', 'template_directory': '"""src/site/templates"""'}), "(debug=False, template_directory='src/site/templates')\n", (213, 267), False, 'from starlette.applications import Starlette\n'), ((398, 437), 'starlette.staticfiles.StaticFiles',...
fqzhou/LoadBalanceControl-RL
loadbalanceRL/lib/__init__.py
689eec3b3b27e121aa45d2793e411f1863f6fc0b
#! /usr/bin/env python3 # -*- coding: utf-8 -*- """ Contains core logic for Rainman2 """ __author__ = 'Ari Saha (arisaha@icloud.com), Mingyang Liu(liux3941@umn.edu)' __date__ = 'Wednesday, February 14th 2018, 11:42:09 am'
[]
openforcefield/bespoke-f
openff/bespokefit/__init__.py
27b072bd09610dc8209429118d739e1f453edd61
""" BespokeFit Creating bespoke parameters for individual molecules. """ import logging import sys from ._version import get_versions versions = get_versions() __version__ = versions["version"] __git_revision__ = versions["full-revisionid"] del get_versions, versions # Silence verbose messages when running the CLI ...
[((689, 715), 'openff.bespokefit.utilities.logging.DeprecationWarningFilter', 'DeprecationWarningFilter', ([], {}), '()\n', (713, 715), False, 'from openff.bespokefit.utilities.logging import DeprecationWarningFilter\n'), ((595, 630), 'logging.getLogger', 'logging.getLogger', (['"""openff.toolkit"""'], {}), "('openff.t...
greenwoodms/TRANSFORM-Library
TRANSFORM/Resources/python/2006LUT_to_SDF.py
dc152d4f0298d3f18385f2ea33645d87d7812915
# -*- coding: utf-8 -*- """ Created on Tue Apr 03 11:06:37 2018 @author: vmg """ import sdf import numpy as np # Load 2006 LUT for interpolation # 2006 Groeneveld Look-Up Table as presented in # "2006 CHF Look-Up Table", Nuclear Engineering and Design 237, pp. 190-1922. # This file requires the file 2006LUTdata.tx...
[((517, 695), 'numpy.array', 'np.array', (['(0.0, 50.0, 100.0, 300.0, 500.0, 750.0, 1000.0, 1500.0, 2000.0, 2500.0, \n 3000.0, 3500.0, 4000.0, 4500.0, 5000.0, 5500.0, 6000.0, 6500.0, 7000.0,\n 7500.0, 8000.0)'], {}), '((0.0, 50.0, 100.0, 300.0, 500.0, 750.0, 1000.0, 1500.0, 2000.0, \n 2500.0, 3000.0, 3500.0, 4...
tmsanrinsha/vint
test/asserting/policy.py
8c34196252b43d7361d0f58cb78cf2d3e4e4fbd0
import unittest from pathlib import Path from pprint import pprint from vint.compat.itertools import zip_longest from vint.linting.linter import Linter from vint.linting.config.config_default_source import ConfigDefaultSource class PolicyAssertion(unittest.TestCase): class StubPolicySet(object): def __ini...
[((2791, 2835), 'pathlib.Path', 'Path', (['"""test"""', '"""fixture"""', '"""policy"""', '*filename'], {}), "('test', 'fixture', 'policy', *filename)\n", (2795, 2835), False, 'from pathlib import Path\n'), ((2016, 2034), 'pprint.pprint', 'pprint', (['violations'], {}), '(violations)\n', (2022, 2034), False, 'from pprin...
gliptak/DataProfiler
dataprofiler/labelers/character_level_cnn_model.py
37ffbf43652246ef27e070df7ff0d9f1b9529162
import copy import json import logging import os import sys import time from collections import defaultdict import numpy as np import tensorflow as tf from sklearn import decomposition from .. import dp_logging from . import labeler_utils from .base_model import AutoSubRegistrationMeta, BaseModel, BaseTrainableModel ...
[((775, 806), 'logging.getLogger', 'logging.getLogger', (['"""tensorflow"""'], {}), "('tensorflow')\n", (792, 806), False, 'import logging\n'), ((859, 903), 'tensorflow.keras.utils.register_keras_serializable', 'tf.keras.utils.register_keras_serializable', ([], {}), '()\n', (901, 903), True, 'import tensorflow as tf\n'...
Nipica/airflow
airflow/contrib/plugins/metastore_browser/main.py
211a71f8a6b9d808bd03af84bd77bf8ff0ef247f
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the #...
[((1547, 1588), 'pandas.set_option', 'pd.set_option', (['"""display.max_colwidth"""', '(-1)'], {}), "('display.max_colwidth', -1)\n", (1560, 1588), True, 'import pandas as pd\n'), ((5719, 5861), 'flask.Blueprint', 'Blueprint', (['"""metastore_browser"""', '__name__'], {'template_folder': '"""templates"""', 'static_fold...
AaronDewes/compose-nonfree
app/lib/manage.py
82ef3e58019ee03d163dea7aff4d7ed18d884238
#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2021 Aaron Dewes <aaron.dewes@protonmail.com> # # SPDX-License-Identifier: MIT import stat import tempfile import threading from typing import List from sys import argv import os import requests import shutil import json import yaml import subprocess from lib.composeg...
[((917, 952), 'os.path.join', 'os.path.join', (['scriptDir', '""".."""', '""".."""'], {}), "(scriptDir, '..', '..')\n", (929, 952), False, 'import os\n'), ((963, 993), 'os.path.join', 'os.path.join', (['nodeRoot', '"""apps"""'], {}), "(nodeRoot, 'apps')\n", (975, 993), False, 'import os\n'), ((1009, 1045), 'os.path.joi...
YuanruiZJU/SZZ-TSE
features/jit-features/query/query.py
093506f9019a0d8b412dad4672525f93150ca181
from query.base import BaseQuery class CommitMetaQuery(BaseQuery): table_name = 'commit_meta' class DiffusionFeaturesQuery(BaseQuery): table_name = 'diffusion_features' class SizeFeaturesQuery(BaseQuery): table_name = 'size_features' class PurposeFeaturesQuery(BaseQuery): table_name = 'purpose_f...
[]
mikeywaites/flask-arrested
example/mappers.py
6b97ce2ad2765f9acab10f4726e310258aa51de0
from kim import Mapper, field from example.models import Planet, Character class PlanetMapper(Mapper): __type__ = Planet id = field.Integer(read_only=True) name = field.String() description = field.String() created_at = field.DateTime(read_only=True) class CharacterMapper(Mapper): __type...
[((139, 168), 'kim.field.Integer', 'field.Integer', ([], {'read_only': '(True)'}), '(read_only=True)\n', (152, 168), False, 'from kim import Mapper, field\n'), ((180, 194), 'kim.field.String', 'field.String', ([], {}), '()\n', (192, 194), False, 'from kim import Mapper, field\n'), ((213, 227), 'kim.field.String', 'fiel...
escalate/ansible-gitops-example-repository
collections/ansible_collections/community/general/plugins/connection/saltstack.py
f7f7a9fcd09abd982f5fcd3bd196809a6c4c2f08
# Based on local.py (c) 2012, Michael DeHaan <michael.dehaan@gmail.com> # Based on chroot.py (c) 2013, Maykel Moya <mmoya@speedyrails.com> # Based on func.py # (c) 2014, Michael Scherer <misc@zarb.org> # (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt...
[((1506, 1522), 'salt.client.LocalClient', 'sc.LocalClient', ([], {}), '()\n', (1520, 1522), True, 'import salt.client as sc\n'), ((2571, 2593), 'os.path.normpath', 'os.path.normpath', (['path'], {}), '(path)\n', (2587, 2593), False, 'import os\n'), ((2609, 2643), 'os.path.join', 'os.path.join', (['prefix', 'normpath[1...
normaldotcom/webvirtmgr
create/views.py
8d822cb94105abf82eb0ff6651a36c43b0911d2a
from django.shortcuts import render_to_response from django.http import HttpResponseRedirect from django.template import RequestContext from django.utils.translation import ugettext_lazy as _ from servers.models import Compute from create.models import Flavor from instance.models import Instance from libvirt import l...
[((645, 676), 'servers.models.Compute.objects.get', 'Compute.objects.get', ([], {'id': 'host_id'}), '(id=host_id)\n', (664, 676), False, 'from servers.models import Compute\n'), ((583, 613), 'django.http.HttpResponseRedirect', 'HttpResponseRedirect', (['"""/login"""'], {}), "('/login')\n", (603, 613), False, 'from djan...
andimarafioti/GACELA
utils/wassersteinGradientPenalty.py
34649fb01bdecbcb266db046a8b9c48c141f16e1
import torch __author__ = 'Andres' def calc_gradient_penalty_bayes(discriminator, real_data, fake_data, gamma): device = torch.device("cuda" if torch.cuda.is_available() else "cpu") batch_size = real_data.size()[0] alpha = torch.rand(batch_size, 1, 1, 1) alpha = alpha.expand(real_data.size()).to(devi...
[((238, 269), 'torch.rand', 'torch.rand', (['batch_size', '(1)', '(1)', '(1)'], {}), '(batch_size, 1, 1, 1)\n', (248, 269), False, 'import torch\n'), ((150, 175), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (173, 175), False, 'import torch\n'), ((409, 466), 'torch.autograd.Variable', 'torch....
butla/experiments
pytest_capture_log_error/test_file.py
8c8ade15bb01978763d6618342fa42ad7563e38f
import a_file def test_a(capsys): assert a_file.bla() == 5 assert a_file.LOG_MESSAGE in capsys.readouterr().err
[((46, 58), 'a_file.bla', 'a_file.bla', ([], {}), '()\n', (56, 58), False, 'import a_file\n')]
Magier/Aetia
src_py/ui/identify_page.py
7f6045d99904b808e1201f445d0d10b0dce54c37
import streamlit as st from ui.session_state import SessionState, get_state from infer import ModelStage def show(state: SessionState): st.header("identify") state = get_state() if state.model.stage < ModelStage.DEFINED: st.error("Please create the model first!")
[((142, 163), 'streamlit.header', 'st.header', (['"""identify"""'], {}), "('identify')\n", (151, 163), True, 'import streamlit as st\n'), ((176, 187), 'ui.session_state.get_state', 'get_state', ([], {}), '()\n', (185, 187), False, 'from ui.session_state import SessionState, get_state\n'), ((243, 285), 'streamlit.error'...
luofeisg/OpenKE-PuTransE
openke/data/UniverseTrainDataLoader.py
0bfefb3917e7479520917febd91a9f4d7353c7fc
''' MIT License Copyright (c) 2020 Rashid Lafraie 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...
[((3131, 3183), 'numpy.zeros', 'np.zeros', (['self.entity_total_universe'], {'dtype': 'np.int64'}), '(self.entity_total_universe, dtype=np.int64)\n', (3139, 3183), True, 'import numpy as np\n'), ((3213, 3267), 'numpy.zeros', 'np.zeros', (['self.relation_total_universe'], {'dtype': 'np.int64'}), '(self.relation_total_un...