repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
aisk/pyston
test/cpython/test_base64.py
ac69cfef0621dbc8901175e84fa2b5cb5781a646
import unittest from test import test_support import base64 class LegacyBase64TestCase(unittest.TestCase): def test_encodestring(self): eq = self.assertEqual eq(base64.encodestring("www.python.org"), "d3d3LnB5dGhvbi5vcmc=\n") eq(base64.encodestring("a"), "YQ==\n") eq(base64.encod...
[((9310, 9345), 'test.test_support.run_unittest', 'test_support.run_unittest', (['__name__'], {}), '(__name__)\n', (9335, 9345), False, 'from test import test_support\n'), ((1720, 1824), 'cStringIO.StringIO', 'StringIO', (['"""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}"""'], {}),...
gabbonj/Workbench
src/Path.py
86bbb2e3184e0f2fc5e9ac6dc7cfec86473fb7b9
import numpy as np from ctypes import c_void_p from .Shader import Shader from .transforms import * from OpenGL.GL import * class Path: # position=[x1, y1, z1, ..., xn, yn, zn] ; rotation = [[Rx1, Ry1, Rz1], ..., [Rxn, Ryn, Rzn]] def __init__(self, position, rotation=None): self.loadPath(position) ...
[((4234, 4248), 'numpy.identity', 'np.identity', (['(4)'], {}), '(4)\n', (4245, 4248), True, 'import numpy as np\n'), ((1016, 1056), 'numpy.array', 'np.array', (['self.vertices'], {'dtype': '"""float32"""'}), "(self.vertices, dtype='float32')\n", (1024, 1056), True, 'import numpy as np\n'), ((1137, 1148), 'ctypes.c_voi...
brsynth/icfree-ml
icfree/echo_instructor/args.py
7f6c67f26bf60e9cadd59855aebb6bdb5bd64fda
from argparse import ( ArgumentParser ) from os import getcwd as os_getcwd DEFAULT_OUTPUT_FOLDER = os_getcwd() DEFAULT_SAMPLE_VOLUME = 10000 def build_args_parser( program, description): parser = ArgumentParser( program, description, ) parser = add_arguments(pars...
[((108, 119), 'os.getcwd', 'os_getcwd', ([], {}), '()\n', (117, 119), True, 'from os import getcwd as os_getcwd\n'), ((228, 264), 'argparse.ArgumentParser', 'ArgumentParser', (['program', 'description'], {}), '(program, description)\n', (242, 264), False, 'from argparse import ArgumentParser\n')]
sitdh/59.com-prog
ex1_01.py
24f536a72b0467ff3ee1615f515ecff9fbf36bb3
import math x = float(input()) prop_2 = -(x**2) / math.factorial(2) prop_3 = (x**4) / math.factorial(4) prop_4 = -(x**6) / math.factorial(6) cos_x = float(1 + prop_2 + prop_3 + prop_4) print(prop_2) print(prop_3) print(prop_4) print(cos_x)
[((52, 69), 'math.factorial', 'math.factorial', (['(2)'], {}), '(2)\n', (66, 69), False, 'import math\n'), ((89, 106), 'math.factorial', 'math.factorial', (['(4)'], {}), '(4)\n', (103, 106), False, 'import math\n'), ((127, 144), 'math.factorial', 'math.factorial', (['(6)'], {}), '(6)\n', (141, 144), False, 'import math...
MRichards99/datagateway-api
test/datagateway_api/icat/filters/test_where_filter.py
2e6133636fed950a16190d2f703f152c73bb5b1b
import pytest from datagateway_api.src.common.exceptions import BadRequestError, FilterError from datagateway_api.src.datagateway_api.filter_order_handler import FilterOrderHandler from datagateway_api.src.datagateway_api.icat.filters import PythonICATWhereFilter class TestICATWhereFilter: @pytest.mark.parametri...
[((1462, 1507), 'datagateway_api.src.datagateway_api.icat.filters.PythonICATWhereFilter', 'PythonICATWhereFilter', (['"""id"""', 'value', 'operation'], {}), "('id', value, operation)\n", (1483, 1507), False, 'from datagateway_api.src.datagateway_api.icat.filters import PythonICATWhereFilter\n'), ((1862, 1900), 'datagat...
huobingli/splider
scrapy/spider/spider/items.py
a62f0553160531a0735b249b0dc49747e9c821f9
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # https://doc.scrapy.org/en/latest/topics/items.html import scrapy from scrapy.loader import ItemLoader from scrapy.loader.processors import TakeFirst # class SpiderItem(scrapy.Item): # # define the fields for your...
[((665, 676), 'scrapy.loader.processors.TakeFirst', 'TakeFirst', ([], {}), '()\n', (674, 676), False, 'from scrapy.loader.processors import TakeFirst\n'), ((812, 826), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (824, 826), False, 'import scrapy\n'), ((846, 860), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', ...
enthought/codetools
codetools/contexts/multi_context.py
20d8bb1eba68145750a1b689655b839078121474
# # (C) Copyright 2013 Enthought, Inc., Austin, TX # All right reserved. # # This file is open source software distributed according to the terms in # LICENSE.txt # """ Context holding multiple subcontexts. """ from __future__ import absolute_import from itertools import chain from collections import MutableMapping ...
[((613, 635), 'traits.api.provides', 'provides', (['IDataContext'], {}), '(IDataContext)\n', (621, 635), False, 'from traits.api import Bool, List, Str, Undefined, Supports, adapt, provides, on_trait_change\n'), ((788, 805), 'traits.api.Str', 'Str', (['"""multidummy"""'], {}), "('multidummy')\n", (791, 805), False, 'fr...
FMoller/coding-auxiliary-tools
line_counter/TestCodes/python_test.py
21784f01731404f33059f3a8c4e73a104709ffe9
"""A simple file to test the line_counter performance in python This is a multiline doctest """ __author__ = "Frederico Moeller" __copyright__ = "" __credits__ = ["Frederico Moeller"] __license__ = "MIT" __version__ = "1.0.1" __maintainer__ = "Frederico Moeller" __email__ = "" __status__ = "" #import things import ma...
[]
VaniW/deconfounded-lexicon-induction
causal_attribution/data.py
419ecf717f51cfd1741732ca3191b36b565bd1a4
"""Data pipelines.""" from collections import defaultdict, OrderedDict from tqdm import tqdm from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler import torch def get_info(examples, vocab=None, max_seq_len=256): """Gathers info on and creats a featurized example generator for...
[((3172, 3189), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (3183, 3189), False, 'from collections import defaultdict, OrderedDict\n'), ((4077, 4129), 'torch.tensor', 'torch.tensor', (['featurized_data[var_name]'], {'dtype': 'dtype'}), '(featurized_data[var_name], dtype=dtype)\n', (4089, 4129)...
H2u-Hwng/EVC
fopp/Chapter 12. Functions/get_num_digits.py
c650fe7356a333011514cf9025dfd97bf71b1de3
# Take number, and convert integer to string # Calculate and return number of digits def get_num_digits(num): # Convert int to str num_str = str(num) # Calculate number of digits digits = len(num_str) return digits # Define main function def main(): # Prompt user for an int...
[]
mzpqnxow/whois-1
whois/__init__.py
b5623ed25cfa58d9457d30dae640e69b9e530b23
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals from __future__ import division from future import standard_library standard_library.install_aliases() from builtins import * import re import sys import os import subprocess imp...
[((210, 244), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (242, 244), False, 'from future import standard_library\n'), ((453, 1744), 're.compile', 're.compile', (['"""((^\\\\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-...
tirinox/alphavatarbot
app/dialog/avatar_picture_dialog.py
5adac8c9c4534206eaf6c146f6e194ed5951d055
import asyncio from contextlib import AsyncExitStack from aiogram.dispatcher.filters.state import StatesGroup, State from aiogram.dispatcher.storage import FSMContextProxy from aiogram.types import Message, PhotoSize, ReplyKeyboardRemove, ContentTypes from aiogram.utils.helper import HelperMode from dialog.avatar_ima...
[((696, 703), 'aiogram.dispatcher.filters.state.State', 'State', ([], {}), '()\n', (701, 703), False, 'from aiogram.dispatcher.filters.state import StatesGroup, State\n'), ((1028, 1055), 'dialog.base.message_handler', 'message_handler', ([], {'state': 'None'}), '(state=None)\n', (1043, 1055), False, 'from dialog.base i...
olubiyiontheweb/digid_websearch_flask
image_store_processing.py
181107eaa60faff9429b754236406eed56e3c1ec
from skimage.metrics import structural_similarity as ssim from glob import glob from PIL import Image import numpy as np import ntpath import dhash import cv2 from database_structure import database_migrations IMAGE_FOLDER = "./image_store" ALLOWED_EXTENSIONS = ['png', 'jpg', 'jpeg'] image_store_hash = dict() db_ops ...
[((322, 343), 'database_structure.database_migrations', 'database_migrations', ([], {}), '()\n', (341, 343), False, 'from database_structure import database_migrations\n'), ((4333, 4369), 'skimage.metrics.structural_similarity', 'ssim', (['uploaded_image', 'db_store_image'], {}), '(uploaded_image, db_store_image)\n', (...
elthorito/Rai
cogs/jpserv.py
a6f05567a0d4ed98a09676e507c478a27630bf1c
import discord from discord.ext import commands import os import json from datetime import date, datetime, timedelta from .utils import helper_functions as hf from copy import deepcopy dir_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))).replace('\\', '/') class Jpserv(commands.Cog): """Module...
[((668, 686), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (684, 686), False, 'from discord.ext import commands\n'), ((1305, 1365), 'discord.ext.commands.group', 'commands.group', ([], {'invoke_without_command': '(True)', 'aliases': "['uhc']"}), "(invoke_without_command=True, aliases=['uhc'])\n...
psifertex/nehebn2
nehebn2.py
8b62a88a9d06624dbb62b8b74cc0566172fba970
#!/usr/bin/env python3 from components import ProgramState import binaryninja as binja import argparse import os.path import curses # TODO...impliment live-refreashing the settings.json during run (add the keybinding and check for it here in the global input loop) # TODO...support multi-key presses? Not sure if this ...
[((520, 587), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Nearly Headless BinaryNinja."""'}), "(description='Nearly Headless BinaryNinja.')\n", (543, 587), False, 'import argparse\n'), ((2006, 2026), 'curses.wrapper', 'curses.wrapper', (['main'], {}), '(main)\n', (2020, 2026), False, ...
itsraina/keras
keras/layers/pooling/base_pooling3d.py
5e9376b5b94b6fb445dd52dbfafbc4e95bff5e35
# Copyright 2015 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 required by applica...
[((2611, 2664), 'keras.utils.conv_utils.normalize_tuple', 'conv_utils.normalize_tuple', (['pool_size', '(3)', '"""pool_size"""'], {}), "(pool_size, 3, 'pool_size')\n", (2637, 2664), False, 'from keras.utils import conv_utils\n'), ((2688, 2754), 'keras.utils.conv_utils.normalize_tuple', 'conv_utils.normalize_tuple', (['...
lucastan96/video2bitmap
main.py
8a54f33af92b5088d29322abf936a6ce2ecc0ac4
import moviepy.editor as mpy import moviepy.video.fx.all as vfx import subprocess as sp # Crop and resize video clip = mpy.VideoFileClip("smoke.mp4") (w, h) = clip.size cropped_clip = vfx.crop(clip, width=(h/128)*64, height=h, x1=w/4*3-100, y1=0).resize((64, 128)) cropped_clip.write_videofile('smoke-cropped.mp4') # C...
[((120, 150), 'moviepy.editor.VideoFileClip', 'mpy.VideoFileClip', (['"""smoke.mp4"""'], {}), "('smoke.mp4')\n", (137, 150), True, 'import moviepy.editor as mpy\n'), ((455, 479), 'subprocess.call', 'sp.call', (['cmd'], {'shell': '(True)'}), '(cmd, shell=True)\n', (462, 479), True, 'import subprocess as sp\n'), ((185, 2...
bbhunter/Ghostwriter
ghostwriter/rolodex/apps.py
1b684ddd119feed9891e83b39c9b314b41d086ca
"""This contains the configuration of the Rolodex application.""" # Django Imports from django.apps import AppConfig class RolodexConfig(AppConfig): name = "ghostwriter.rolodex" def ready(self): try: import ghostwriter.rolodex.signals # noqa F401 isort:skip except ImportError: ...
[]
oscarsiles/jotlet
boards/migrations/0024_boardpreferences_moderators.py
361f7ad0d32ea96d012020a67493931482207036
# Generated by Django 4.0.3 on 2022-03-01 14:42 from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('boards', '0023_alter_image_type'), ] operations ...
[((194, 251), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (225, 251), False, 'from django.db import migrations, models\n'), ((445, 546), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(...
MichalBusta/OpenCitiesAIC
models/minimize_model.py
2358118a782edde27a588d6adaf79941cbd90de6
''' Created on Mar 22, 2020 @author: Michal.Busta at gmail.com ''' #get rid of the optimizer state ... import torch MODEL_PATH = '/models/model-b2-2.pth' state = torch.load(MODEL_PATH, map_location=lambda storage, loc: storage) state_out = { "state_dict": state["state_dict"], } torch.save(state_out, 'model-b2-2....
[((165, 230), 'torch.load', 'torch.load', (['MODEL_PATH'], {'map_location': '(lambda storage, loc: storage)'}), '(MODEL_PATH, map_location=lambda storage, loc: storage)\n', (175, 230), False, 'import torch\n'), ((286, 325), 'torch.save', 'torch.save', (['state_out', '"""model-b2-2.pth"""'], {}), "(state_out, 'model-b2-...
thomas-kloeber/braumeister
setup.py
1045df0ad95eb6a4b9b16bb91ece64b09ff1b1f7
import os import re from setuptools import setup version = re.search( '^__version__\s*=\s*"(.*)"', open('braumeister/braumeister.py').read(), re.M ).group(1) def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name="braumeister", packages=["braumeiste...
[((220, 245), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (235, 245), False, 'import os\n')]
rubelchowdhury20/wuton-with-densepose
modules/inference.py
5485f1f311724d8f8b887d669a8b55c73849eb98
# standard library imports import os # third party imports import numpy as np from PIL import Image import torch.nn as nn from torchvision import transforms # local imports import config from . import utils from . import geometric_transformer class GeoTransformationInfer(nn.Module): def __init__(self, output_di...
[((3034, 3072), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(1568, 224)', '"""white"""'], {}), "('RGB', (1568, 224), 'white')\n", (3043, 3072), False, 'from PIL import Image\n'), ((1872, 1901), 'numpy.uint8', 'np.uint8', (['(model_apparel * 255)'], {}), '(model_apparel * 255)\n', (1880, 1901), True, 'import numpy as ...
p-lambda/unlabeled_outputs
imggen/fonts.py
18cda9e922591ec99d70caaa173abbb049ef274b
from pathlib import Path import h5py import numpy as np from torchvision.datasets.vision import VisionDataset from PIL import Image import requests import zipfile from tqdm import tqdm def download_file_from_google_drive(id, destination): URL = "https://docs.google.com/uc?export=download" session = requests...
[((312, 330), 'requests.Session', 'requests.Session', ([], {}), '()\n', (328, 330), False, 'import requests\n'), ((2396, 2418), 'numpy.random.seed', 'np.random.seed', (['(484347)'], {}), '(484347)\n', (2410, 2418), True, 'import numpy as np\n'), ((2538, 2566), 'numpy.random.shuffle', 'np.random.shuffle', (['font_idxs']...
windniw/just-for-fun
leetcode/47.py
54e5c2be145f3848811bfd127f6a89545e921570
""" link: https://leetcode.com/problems/permutations-ii problem: 求全排列,nums中存在重复数 solution: 同46,加上排序即可 """ class Solution: def permuteUnique(self, nums: List[int]) -> List[List[int]]: if len(nums) == 1: return [nums] new_nums = nums.copy() new_nums.sort() ...
[]
IamMayankThakur/test-bigdata
adminmgr/media/code/A3/task3/T1_ocefXVJ.py
cef633eb394419b955bdce479699d0115d8f99c3
import findspark findspark.init() from pyspark import SparkConf,SparkContext from pyspark.streaming import StreamingContext from pyspark.sql import Row,SQLContext import sys import requests def tmp(x): y = (x.split(';')[7]).split(',') return (y) def forf(x): for i in x: yield (i,1) def topprint(time,rdd): re...
[((17, 33), 'findspark.init', 'findspark.init', ([], {}), '()\n', (31, 33), False, 'import findspark\n'), ((457, 468), 'pyspark.SparkConf', 'SparkConf', ([], {}), '()\n', (466, 468), False, 'from pyspark import SparkConf, SparkContext\n'), ((499, 522), 'pyspark.SparkContext', 'SparkContext', ([], {'conf': 'conf'}), '(c...
antonnifo/E-Soma
courses/migrations/0003_alter_content_options_alter_module_options_and_more.py
93d49b27dedbff58d19f8245a79693762fc819d5
# Generated by Django 4.0.1 on 2022-01-20 13:10 import courses.fields from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('courses', '0002_video_text_image_file_content'), ] operations = [ migrations.AlterModelOptions( name='content', ...
[((260, 337), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""content"""', 'options': "{'ordering': ['order']}"}), "(name='content', options={'ordering': ['order']})\n", (288, 337), False, 'from django.db import migrations\n'), ((382, 458), 'django.db.migrations.AlterModelOpt...
prateekdegaons1991/experiment-loadtest
pkg/maths/maths.py
b53c70fac5b2f7d37df77844b26f79741c74c1b6
#Atoi stands for ASCII to Integer Conversion def atoi(string): res = 0 # Iterate through all characters of # input and update result for i in range(len(string)): res = res * 10 + (ord(string[i]) - ord('0')) return res #Adjustment contains rule of three for calculating an integer given an...
[]
redoxdrh/GCP-Flask
google_compute_engine/config_manager.py
34af307df541edca4eee58b1d8be64888550a674
#!/usr/bin/python # Copyright 2016 Google Inc. 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...
[((1260, 1285), 'google_compute_engine.compat.parser.SafeConfigParser', 'parser.SafeConfigParser', ([], {}), '()\n', (1283, 1285), False, 'from google_compute_engine.compat import parser\n'), ((1504, 1539), 'textwrap.dedent', 'textwrap.dedent', (['self.config_header'], {}), '(self.config_header)\n', (1519, 1539), False...
e-mayo/mscreen
mscreen/autodocktools_prepare_py3k/mglutil/web/services/AppService_services.py
a50f0b2f7104007c730baa51b4ec65c891008c47
################################################## # ./AppService_services.py # generated by ZSI.wsdl2python # # ################################################## from .AppService_services_types import * from .AppService_services_types import \ nbcr_sdsc_edu_opal_types as ns1 import urllib.parse, types from...
[((1348, 1368), 'ZSI.client.Binding', 'client.Binding', ([], {}), '(**kw)\n', (1362, 1368), False, 'from ZSI import client\n'), ((14182, 14278), 'ZSI.TCcompound.Struct', 'Struct', (['getAppConfigRequest', '[]'], {'pname': 'name', 'aname': "('%s' % name)", 'oname': '(\'%s xmlns=""\' % name)'}), '(getAppConfigRequest, [...
hieuhoang/FasterTransformer
examples/pytorch/swin/checkpoint_quantization.py
440695ccac874574b1d2e1121788e8fa674b4381
# Copyright (c) 2020-2022, 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 ...
[((946, 982), 'torch.classes.load_library', 'torch.classes.load_library', (['ths_path'], {}), '(ths_path)\n', (972, 982), False, 'import torch\n'), ((10265, 10296), 'torch.load', 'torch.load', (['"""pytorch_model.bin"""'], {}), "('pytorch_model.bin')\n", (10275, 10296), False, 'import torch\n'), ((9514, 9557), 'torch.t...
tomzhang/mars-1
mars/deploy/kubernetes/core.py
6f1d85e37eb1b383251314cb0ba13e06288af03d
# -*- coding: utf-8 -*- # Copyright 1999-2020 Alibaba Group Holding Ltd. # # 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 require...
[((731, 758), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (748, 758), False, 'import logging\n'), ((1635, 1648), 'gevent.threadpool.ThreadPool', 'ThreadPool', (['(1)'], {}), '(1)\n', (1645, 1648), False, 'from gevent.threadpool import ThreadPool\n'), ((3396, 3409), 'kubernetes.watch.Wa...
elangovana/gene_normalisation
tests/tests_model/tests_bert_model.py
9152298e951cd968ee516815c7fa11f1ceabca51
from unittest import TestCase import torch import transformers from model.bert_model import BertModel class TestBertModel(TestCase): def test_forward(self): # Bert Config vocab_size = 10 sequence_len = 20 batch = 32 num_classes = 3 expected_shape = (batch, seque...
[((365, 434), 'torch.randint', 'torch.randint', ([], {'low': '(0)', 'high': '(vocab_size - 1)', 'size': '(batch, sequence_len)'}), '(low=0, high=vocab_size - 1, size=(batch, sequence_len))\n', (378, 434), False, 'import torch\n'), ((449, 583), 'transformers.BertConfig', 'transformers.BertConfig', ([], {'vocab_size': 'v...
tmcclintock/PyDonJuan
tests/renderer_test.py
ab6d567b568c3e0dd976b10c2628ad99ca81b953
import json import os import tempfile from unittest import TestCase import pytest from donjuan import Dungeon, DungeonRandomizer, Renderer class RendererTest(TestCase): def setUp(self): super().setUp() self.TEMP_DIR = tempfile.mkdtemp() def test_smoke(self): r = Renderer() a...
[((242, 260), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (258, 260), False, 'import tempfile\n'), ((300, 310), 'donjuan.Renderer', 'Renderer', ([], {}), '()\n', (308, 310), False, 'from donjuan import Dungeon, DungeonRandomizer, Renderer\n'), ((379, 396), 'donjuan.Renderer', 'Renderer', ([], {'scale': '(...
dnava013/foremast
src/foremast/validate.py
9849821b5bb3cd67b438c5adeaa0e42f86e9eaf8
"""Spinnaker validate functions.""" import logging from .consts import API_URL from .utils.credentials import get_env_credential LOG = logging.getLogger(__name__) def validate_gate(): """Check Gate connection.""" try: credentials = get_env_credential() LOG.debug('Found credentials: %s', cred...
[((137, 164), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (154, 164), False, 'import logging\n')]
ConstellationApps/Forms
constellation_forms/migrations/0001_initial.py
5d2bacf589c1a473cf619f34d569d33191b11285
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-15 00:56 from __future__ import unicode_literals from django.conf import settings import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial =...
[((356, 413), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (387, 413), False, 'from django.db import migrations, models\n'), ((542, 635), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)...
ptphp/PyLib
src/webpy1/src/borough/dbsqli.py
07ac99cf2deb725475f5771b123b9ea1375f5e65
#!/usr/bin/env python # -*- coding: utf-8 -*- import sqlite3 as sqlite import os.path as osp import sys class Sqli(object): conn = '' cursor = '' def __init__(self, dbname): try: self.conn = sqlite.connect(osp.abspath(dbname)) except Exception, what: print wh...
[]
Liudzz/loss-chapter
losses/all_lost.py
22359b92ca5e155d5af32ef2f22eeddf0483b947
""" easy way to use losses """ from center_loss import Centerloss import torch.nn as nn from FocalLoss import FocalLoss def center_loss(pred,label,num_calss,feature): loss = Centerloss(num_calss,feature) return loss(pred,label) def Focal_loss(pred,label,num_calss,alaph=None, gamma): loss = Centerloss(num...
[]
Nexenta/nova
nova/tests/functional/test_metadata.py
ccecb507ff4bdcdd23d90e7b5b02a22c5a46ecc3
# Copyright 2016 Rackspace Australia # 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 requi...
[((1119, 1142), 'oslo_serialization.jsonutils.dumps', 'jsonutils.dumps', (['result'], {}), '(result)\n', (1134, 1142), False, 'from oslo_serialization import jsonutils\n'), ((1718, 1757), 'nova.tests.unit.image.fake.stub_out_image_service', 'fake_image.stub_out_image_service', (['self'], {}), '(self)\n', (1751, 1757), ...
zxlzr/OpenUE
openue/sequence_labeling/subject_labeling_data_manager.py
a49f8950dc2b93a489bb8ce0d40abb26c2c0f347
import os import sys import json sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../bert"))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))) import tokenization from config import config class Model_data_preparation(object): def __init__(self, DATA_...
[((78, 103), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (93, 103), False, 'import os\n'), ((166, 191), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (181, 191), False, 'import os\n'), ((807, 832), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__fi...
Taik/clarifai-python
clarifai/rest/grpc/custom_converters/custom_message_to_dict.py
c3b66b84cb348d3cb1edff958f561a4734b78650
import typing # noqa from google.protobuf import descriptor from google.protobuf.json_format import _IsMapEntry, _Printer from google.protobuf.message import Message # noqa from clarifai.rest.grpc.proto.clarifai.api.utils import extensions_pb2 def protobuf_to_dict(object_protobuf, use_integers_for_enums=True, ign...
[((2258, 2276), 'google.protobuf.json_format._IsMapEntry', '_IsMapEntry', (['field'], {}), '(field)\n', (2269, 2276), False, 'from google.protobuf.json_format import _IsMapEntry, _Printer\n')]
mschrimpf/CapsNetKeras
__init__.py
4c514860bf6689fb1772a7bd858638cd538ff22f
from .capsulenet import *
[]
mrchoi87/IRSOSv4
gate/mate_ksx3267v2.py
886c3dcbeb64c3a8cc257b58692946fd5462312e
#!/usr/bin/env python # # -*- coding: utf-8 -*- # # Copyright (c) 2018 JiNong, Inc. # All right reserved. # import struct import time import socket import select import traceback import hashlib import json from enum import IntEnum from threading import Thread, Lock from mate import Mate, ThreadMate, DevType from mbloc...
[]
aimalygin/aws-sdk-ios
CircleciScripts/run_integrationtests.py
6cfaa3c56296300499f4885e9039c2dd24624cfa
import demjson import sys from subprocess import Popen, PIPE import subprocess import xml.etree.ElementTree as ET import os from datetime import datetime from functions import runcommand #from sets import Set def getfailedcases(withBundle = True): xmlfile='build/reports/junit.xml' tree = ET.parse(xmlfile) ...
[((2221, 2247), 'demjson.decode', 'demjson.decode', (['jsonstring'], {}), '(jsonstring)\n', (2235, 2247), False, 'import demjson\n'), ((3205, 3258), 'functions.runcommand', 'runcommand', (['"""echo "export testresult=0" >> $BASH_ENV"""'], {}), '(\'echo "export testresult=0" >> $BASH_ENV\')\n', (3215, 3258), False, 'fro...
kernelmethod/Seagrass
seagrass/hooks/__init__.py
52c5f1852fb2d52b3d94411c2a49c3da6fab6c6c
# flake8: noqa: F401 from .context_manager_hook import ContextManagerHook from .counter_hook import CounterHook from .file_open_hook import FileOpenHook from .logging_hook import LoggingHook from .profiler_hook import ProfilerHook from .runtime_audit_hook import RuntimeAuditHook from .stack_trace_hook import StackTrace...
[]
aschleg/hypy
tests/test_internal.py
d5b8451dcd24b803bbf2eebc46bc3acfd64d8edc
import pytest import numpy as np import pandas as pd from hypothetical._lib import _build_des_mat def test_array(): d = np.array([[1., 1.11, 2.569, 3.58, 0.76], [1., 1.19, 2.928, 3.75, 0.821], [1., 1.09, 2.865, 3.93, 0.928], [1., 1.25, 3.844, 3.94, 1.009], ...
[((126, 1806), 'numpy.array', 'np.array', (['[[1.0, 1.11, 2.569, 3.58, 0.76], [1.0, 1.19, 2.928, 3.75, 0.821], [1.0, \n 1.09, 2.865, 3.93, 0.928], [1.0, 1.25, 3.844, 3.94, 1.009], [1.0, 1.11,\n 3.027, 3.6, 0.766], [1.0, 1.08, 2.336, 3.51, 0.726], [1.0, 1.11, 3.211,\n 3.98, 1.209], [1.0, 1.16, 3.037, 3.62, 0.75...
JamesWang007/Open3D-PointNet
download.py
402847ceef8d364672ca7d81e0afebcb445cceb5
#!/usr/bin/env python3 # Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """Download big files from Google Drive.""" import shutil import sys import...
[((1400, 1452), 'sys.stdout.write', 'sys.stdout.write', (["('\\r' + message + empty_space * ' ')"], {}), "('\\r' + message + empty_space * ' ')\n", (1416, 1452), False, 'import sys\n'), ((1457, 1475), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (1473, 1475), False, 'import sys\n'), ((2282, 2300), 'request...
cklwblove/python-100-days-source-code
ls12/demo5.py
5d66c7708047f0d7bac0ce05d21834bbbfa6ccf1
# -*- coding: utf-8 -*- """ 将耗时间的任务放到线程中以获得更好的用户体验。 """ import time import tkinter import tkinter.messagebox def download(): # 模拟下载任务需要花费10秒时间 time.sleep(10) tkinter.messagebox.showinfo('提示', '下载完成') def show_about(): tkinter.messagebox.showinfo('关于', '作者:罗浩') def main(): t...
[((164, 178), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (174, 178), False, 'import time\n'), ((184, 225), 'tkinter.messagebox.showinfo', 'tkinter.messagebox.showinfo', (['"""提示"""', '"""下载完成"""'], {}), "('提示', '下载完成')\n", (211, 225), False, 'import tkinter\n'), ((254, 296), 'tkinter.messagebox.showinfo', 't...
mygreentour/hangoutsbot
hangupsbot/sinks/gitlab/simplepush.py
9ea2da10f546e6f1dd06c8240187049501c5452a
""" GitLab webhook receiver - see http://doc.gitlab.com/ee/web_hooks/web_hooks.html """ import asyncio import json import logging from sinks.base_bot_request_handler import AsyncRequestHandler logger = logging.getLogger(__name__) try: import dateutil.parser except ImportError: logger.error("missing module p...
[((205, 232), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (222, 232), False, 'import logging\n'), ((877, 896), 'json.loads', 'json.loads', (['content'], {}), '(content)\n', (887, 896), False, 'import json\n'), ((1072, 1091), 'json.dumps', 'json.dumps', (['payload'], {}), '(payload)\n',...
cbchoi/nppsim
evsim/assessor.py
4d096f9d2fdb5ebf3e3e83be7b1974bfc92554c1
from evsim.system_simulator import SystemSimulator from evsim.behavior_model_executor import BehaviorModelExecutor from evsim.system_message import SysMessage from evsim.definition import * import os import subprocess as sp class Assessor(BehaviorModelExecutor): def __init__(self, instance_time, destruct...
[((356, 445), 'evsim.behavior_model_executor.BehaviorModelExecutor.__init__', 'BehaviorModelExecutor.__init__', (['self', 'instance_time', 'destruct_time', 'name', 'engine_name'], {}), '(self, instance_time, destruct_time, name,\n engine_name)\n', (386, 445), False, 'from evsim.behavior_model_executor import Behavio...
NEISSproject/TEIEntityEnricher
tei_entity_enricher/interface/postprocessing/gnd_connector.py
09a4a932b30886e50965959935dc803b36063e36
import os from typing import Union, List from tei_entity_enricher.interface.postprocessing.io import FileReader, FileWriter from tei_entity_enricher.util.helper import local_save_path, makedir_if_necessary from tei_entity_enricher.util.exceptions import FileNotFound class GndConnector: def __init__( ...
[((1901, 1978), 'os.path.join', 'os.path.join', (['local_save_path', '"""config"""', '"""postprocessing"""', '"""gnd_apilist.json"""'], {}), "(local_save_path, 'config', 'postprocessing', 'gnd_apilist.json')\n", (1913, 1978), False, 'import os\n'), ((2040, 2149), 'tei_entity_enricher.interface.postprocessing.io.FileRea...
WHOIGit/nes-lter-ims
neslter/workflow/__init__.py
d4cc96c10da56ca33286af84d669625b67170522
import logging logger = logging.getLogger(__name__) logger.addHandler(logging.NullHandler()) logger.level = logging.DEBUG
[((25, 52), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (42, 52), False, 'import logging\n'), ((71, 92), 'logging.NullHandler', 'logging.NullHandler', ([], {}), '()\n', (90, 92), False, 'import logging\n')]
emitch/SEAMLeSS
inference/_archive/render_section.py
cae21c67316ed36529fdc2e470a105a9f847975c
from args import get_argparser, parse_args, get_aligner, get_bbox def render(aligner, bbox, z): aligner.total_bbox = bbox aligner.zs = z aligner.render_section_all_mips(z, bbox) if __name__ == '__main__': parser = get_argparser() args = parse_args(parser) a = get_aligner(args) bbox = get_bbox(args) ...
[((225, 240), 'args.get_argparser', 'get_argparser', ([], {}), '()\n', (238, 240), False, 'from args import get_argparser, parse_args, get_aligner, get_bbox\n'), ((250, 268), 'args.parse_args', 'parse_args', (['parser'], {}), '(parser)\n', (260, 268), False, 'from args import get_argparser, parse_args, get_aligner, get...
qarik-hanrattyjen/apache-airflow-backport-providers-google-2021.3.3
venv/lib/python3.9/site-packages/google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py
630dcef73e6a258b6e9a52f934e2dd912ce741f8
# -*- coding: utf-8 -*- # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
[((1870, 1924), 'pkg_resources.get_distribution', 'pkg_resources.get_distribution', (['"""google-cloud-spanner"""'], {}), "('google-cloud-spanner')\n", (1900, 1924), False, 'import pkg_resources\n'), ((3990, 4053), 'google.oauth2.service_account.Credentials.from_service_account_file', 'service_account.Credentials.from_...
helloabunai/ScaleHD
src/ScaleHD/__backend.py
b48c1a1ed742bdbda0a4cd42555d1e12d2e3024d
#/usr/bin/python __version__ = '1.0' __author__ = 'alastair.maxwell@glasgow.ac.uk' ## ## Imports import string import os import errno import shutil import sys import glob import datetime import subprocess import logging as log import numpy as np import csv from io import StringIO import PyPDF2 from sklearn import prep...
[((22083, 22104), 'os.path.lexists', 'os.path.lexists', (['path'], {}), '(path)\n', (22098, 22104), False, 'import os\n'), ((28656, 28677), 'lxml.etree.Element', 'etree.Element', (['"""data"""'], {}), "('data')\n", (28669, 28677), False, 'from lxml import etree\n'), ((28810, 28866), 'lxml.etree.Element', 'etree.Element...
Jian137/mmediting-1
tests/test_models/test_backbones/test_encoder_decoders/test_deepfill_encoder.py
e1ac6c93441ec96696d0b530f040b91b809015b6
# Copyright (c) OpenMMLab. All rights reserved. import torch from mmedit.models.backbones import ContextualAttentionNeck, DeepFillEncoder from mmedit.models.common import SimpleGatedConvModule def test_deepfill_enc(): encoder = DeepFillEncoder() x = torch.randn((2, 5, 256, 256)) outputs = encoder(x) ...
[((235, 252), 'mmedit.models.backbones.DeepFillEncoder', 'DeepFillEncoder', ([], {}), '()\n', (250, 252), False, 'from mmedit.models.backbones import ContextualAttentionNeck, DeepFillEncoder\n'), ((261, 290), 'torch.randn', 'torch.randn', (['(2, 5, 256, 256)'], {}), '((2, 5, 256, 256))\n', (272, 290), False, 'import to...
Wastecoinng/mvp_beta
mvp/migrations/0004_auto_20201127_0649.py
2faa4b9eeac99b2c284bafad955b90f9951991fc
# Generated by Django 2.2.13 on 2020-11-27 05:49 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('mvp', '0003_hublocation'), ] operations = [ migrations.RemoveField( model_name='hublocation', name='longitude', ...
[((225, 291), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""hublocation"""', 'name': '"""longitude"""'}), "(model_name='hublocation', name='longitude')\n", (247, 291), False, 'from django.db import migrations, models\n'), ((439, 530), 'django.db.models.TextField', 'models.TextFie...
mofresh27/MuseumExperience-Group2-Python-BE-1
adminapp/migrations/0012_auto_20210714_1155.py
d6ca7aceeddfcfdefdf112ab5e40cf74d6b472ce
# Generated by Django 3.2.4 on 2021-07-14 11:55 from django.db import migrations, models import uuid class Migration(migrations.Migration): dependencies = [ ('adminapp', '0011_faq'), ] operations = [ migrations.AddField( model_name='faq', name='uuid', ...
[((327, 386), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'blank': '(True)', 'default': 'uuid.uuid4', 'null': '(True)'}), '(blank=True, default=uuid.uuid4, null=True)\n', (343, 386), False, 'from django.db import migrations, models\n'), ((505, 558), 'django.db.models.TextField', 'models.TextField', ([], {'b...
andrewsimonds14/Capstone
scripts/json_parse.py
5ae56b9be40846e9993a8f23aaa8e1ef92cd9ea3
import json import os import nibabel as nib import csv from operator import itemgetter # PATH TO PREPROCESSED DATA raw_data_path = '/home/lab/nnUNet_data/nnUNet_raw_data_base/nnUNet_raw_data/Task500_BrainMets' pixdim_ind = [1,2,3] # Indexes at which the voxel size [x,y,z] is stored # PATH TO JSON FILE with open('/h...
[((479, 494), 'json.load', 'json.load', (['file'], {}), '(file)\n', (488, 494), False, 'import json\n'), ((565, 642), 'csv.writer', 'csv.writer', (['csv_file'], {'delimiter': '""","""', 'quotechar': '"""\\""""', 'quoting': 'csv.QUOTE_MINIMAL'}), '(csv_file, delimiter=\',\', quotechar=\'"\', quoting=csv.QUOTE_MINIMAL)\n...
tinylambda/tornadio2
tests/gen_test.py
7b112e2e207bd7500288b42896f9970c16e623ad
# -*- coding: utf-8 -*- """ tornadio2.tests.gen ~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2011 by the Serge S. Koval, see AUTHORS for more details. :license: Apache, see LICENSE for more details. """ from collections import deque from nose.tools import eq_ from tornadio2 import gen _queue = None def in...
[((369, 376), 'collections.deque', 'deque', ([], {}), '()\n', (374, 376), False, 'from collections import deque\n'), ((1945, 1965), 'nose.tools.eq_', 'eq_', (['dummy.v', '"""test"""'], {}), "(dummy.v, 'test')\n", (1948, 1965), False, 'from nose.tools import eq_\n'), ((2104, 2124), 'nose.tools.eq_', 'eq_', (['dummy.v', ...
JordanMicahBennett/DeepBrainSeg
DeepBrainSeg/tumor/Tester.py
659dd439d20d4c024fe337874eadb90deffc40a4
#! /usr/bin/env python # -*- coding: utf-8 -*- # # author: Avinash Kori # contact: koriavinash1@gmail.com import torch import SimpleITK as sitk import numpy as np import nibabel as nib from torch.autograd import Variable from skimage.transform import resize from torchvision import transforms from time import gmtime, ...
[((443, 458), 'os.path.expanduser', 'expanduser', (['"""~"""'], {}), "('~')\n", (453, 458), False, 'from os.path import expanduser\n'), ((605, 635), 'os.path.join', 'os.path.join', (['"""/opt/ANTs/bin/"""'], {}), "('/opt/ANTs/bin/')\n", (617, 635), False, 'import os\n'), ((2047, 2132), 'os.path.join', 'os.path.join', (...
porcpine1967/statsmodels
statsmodels/discrete/tests/test_conditional.py
db4900056d80732ffff2733454fac88781ced8d2
import numpy as np from statsmodels.discrete.conditional_models import ( ConditionalLogit, ConditionalPoisson) from statsmodels.tools.numdiff import approx_fprime from numpy.testing import assert_allclose import pandas as pd def test_logit_1d(): y = np.r_[0, 1, 0, 1, 0, 1, 0, 1, 1, 1] g = np.r_[0, 0, 0...
[((420, 452), 'statsmodels.discrete.conditional_models.ConditionalLogit', 'ConditionalLogit', (['y', 'x'], {'groups': 'g'}), '(y, x, groups=g)\n', (436, 452), False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((997, 1057), 'numpy.testing.assert_allclose', 'assert_allc...
tcarmet/bert-e
bert_e/workflow/gitwaterflow/utils.py
8e0623d9a8c7bd111790d72307862167eca18a23
def bypass_incompatible_branch(job): return (job.settings.bypass_incompatible_branch or job.author_bypass.get('bypass_incompatible_branch', False)) def bypass_peer_approval(job): return (job.settings.bypass_peer_approval or job.author_bypass.get('bypass_peer_approval', False)) def b...
[]
pyro-team/bkt-toolbox
bkt/library/powerpoint/elements.py
bbccba142a81ca0a46056f2bcda75899979158a5
# -*- coding: utf-8 -*- ''' Created on 02.11.2017 @author: fstallmann ''' from __future__ import absolute_import from collections import deque import bkt from bkt import dotnet Drawing = dotnet.import_drawing() from . import helpers as pplib class TextframeSpinnerBox(bkt.ribbon.RoundingSpinnerBox): ### Inst...
[((192, 215), 'bkt.dotnet.import_drawing', 'dotnet.import_drawing', ([], {}), '()\n', (213, 215), False, 'from bkt import dotnet\n'), ((7763, 7819), 'bkt.settings.get', 'bkt.settings.get', (['"""bkt.symbols.convert_into_shape"""', '(True)'], {}), "('bkt.symbols.convert_into_shape', True)\n", (7779, 7819), False, 'impor...
guliverza/AdditionalPylons
sc2/unit.py
37336dcd1678c6cdfa22d881c2178ba65cb1fd61
from __future__ import annotations import warnings from typing import Any, Dict, List, Optional, Set, Tuple, Union, TYPE_CHECKING from .cache import property_immutable_cache, property_mutable_cache from .constants import ( transforming, IS_STRUCTURE, IS_LIGHT, IS_ARMORED, IS_BIOLOGICAL, IS_MECH...
[((1186, 1215), 'warnings.simplefilter', 'warnings.simplefilter', (['"""once"""'], {}), "('once')\n", (1207, 1215), False, 'import warnings\n'), ((23636, 23747), 'warnings.warn', 'warnings.warn', (['"""noqueue will be removed soon, please use is_idle instead"""', 'DeprecationWarning'], {'stacklevel': '(2)'}), "('noqueu...
striantafyllouEPFL/healthy-candies
healthy_candies/load/__init__.py
fc7d9e05d54ba207e15d997acea44ff0bf9edb13
from .load import load_data, NUTRI_COLS, load_clean_rel_to_nutri
[]
mia-jingyi/simglucose
simglucose/sensor/cgm.py
a90bd8750fce362be91668ed839b3b252bc0d58d
# from .noise_gen import CGMNoiseGenerator from .noise_gen import CGMNoise import pandas as pd import logging logger = logging.getLogger(__name__) class CGMSensor(object): def __init__(self, params, seed=None): self._params = params self.name = params.Name self.sample_time = params.sample...
[((120, 147), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (137, 147), False, 'import logging\n'), ((477, 506), 'pandas.read_csv', 'pd.read_csv', (['sensor_para_file'], {}), '(sensor_para_file)\n', (488, 506), True, 'import pandas as pd\n')]
carlabguillen/spack
var/spack/repos/builtin/packages/thepeg/package.py
7070bb892f9bdb5cf9e76e0eecd64f6cc5f4695c
# Copyright 2013-2020 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 Thepeg(AutotoolsPackage): """Toolkit for High Energy Physics Event Generation""" home...
[]
wfu8/lightwave
vmca/python/get_cert.py
cf6a7417cd9807bfcf9bcd99c43c5b2eecf2d298
#!/usr/bin/env python # # Copyright © 2012-2016 VMware, Inc. 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 requi...
[]
sisisin/pulumi-gcp
sdk/python/pulumi_gcp/securitycenter/notification_config.py
af6681d70ea457843409110c1324817fe55f68ad
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import...
[((1980, 2010), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""configId"""'}), "(name='configId')\n", (1993, 2010), False, 'import pulumi\n'), ((2704, 2737), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""pubsubTopic"""'}), "(name='pubsubTopic')\n", (2717, 2737), False, 'import pulumi\n'), ((3121, 3158), 'pul...
wwxFromTju/malib
malib/agents/tabular/q_learning/base_tabular_agent.py
7cd2a4af55cf1f56da8854e26ea7a4f3782ceea2
from abc import ABCMeta, abstractmethod import numpy as np class Agent(object): __metaclass__ = ABCMeta def __init__(self, name, id_, action_num, env): self.name = name self.id_ = id_ self.action_num = action_num # len(env.action_space[id_]) # self.opp_action_space = e...
[((1170, 1199), 'numpy.array', 'np.array', (['pi'], {'dtype': 'np.double'}), '(pi, dtype=np.double)\n', (1178, 1199), True, 'import numpy as np\n'), ((1482, 1492), 'numpy.min', 'np.min', (['pi'], {}), '(pi)\n', (1488, 1492), True, 'import numpy as np\n'), ((1559, 1569), 'numpy.sum', 'np.sum', (['pi'], {}), '(pi)\n', (1...
Lonitch/hackerRank
290.word-pattern.py
84991b8340e725422bc47eec664532cc84a3447e
# # @lc app=leetcode id=290 lang=python3 # # [290] Word Pattern # # https://leetcode.com/problems/word-pattern/description/ # # algorithms # Easy (35.86%) # Likes: 825 # Dislikes: 113 # Total Accepted: 164K # Total Submissions: 455.9K # Testcase Example: '"abba"\n"dog cat cat dog"' # # Given a pattern and a stri...
[((1216, 1232), 'collections.defaultdict', 'defaultdict', (['str'], {}), '(str)\n', (1227, 1232), False, 'from collections import defaultdict\n'), ((1249, 1265), 'collections.defaultdict', 'defaultdict', (['str'], {}), '(str)\n', (1260, 1265), False, 'from collections import defaultdict\n')]
jaschn/dtu_mlops
s1_getting_started/exercise_files/final_exercise/model.py
59f404cffc756739433b5ccebb46ef6bfd467436
from torch import nn class MyAwesomeModel(nn.Module): def __init__(self): super().__init__() self.cnn = nn.Sequential(nn.Conv2d(in_channels=1, out_channels=5, kernel_size=3), nn.ReLU(), nn.Conv2d(in_channels=5, out_channels=3, kernel...
[((141, 196), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': '(1)', 'out_channels': '(5)', 'kernel_size': '(3)'}), '(in_channels=1, out_channels=5, kernel_size=3)\n', (150, 196), False, 'from torch import nn\n'), ((230, 239), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (237, 239), False, 'from torch import nn\n...
dreamflyer/musket_core
musket_core/tests/coders_test.py
1bdf1b4715a3b5c63bf687799d7b977fdf49053f
import unittest from musket_core import coders import numpy as np import pandas as pd import os import math fl=__file__ fl=os.path.dirname(fl) class TestCoders(unittest.TestCase): def test_binary_num(self): a=np.array([0,1,0,1]) bc=coders.get_coder("binary",a, None) self.as...
[((134, 153), 'os.path.dirname', 'os.path.dirname', (['fl'], {}), '(fl)\n', (149, 153), False, 'import os\n'), ((237, 259), 'numpy.array', 'np.array', (['[0, 1, 0, 1]'], {}), '([0, 1, 0, 1])\n', (245, 259), True, 'import numpy as np\n'), ((269, 304), 'musket_core.coders.get_coder', 'coders.get_coder', (['"""binary"""',...
isijara/zulip
manage.py
403f4dafcc71369f3b1143b9f7073cd5d76bf357
#!/usr/bin/env python3 import os import sys BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) import scripts.lib.setup_path_on_import if __name__ == "__main__": if 'posix' in os.name and os.geteuid() == 0: print("manage.py should not be run as root. Use `su zulip` to drop ro...
[((99, 124), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (114, 124), False, 'import sys\n'), ((72, 97), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (87, 97), False, 'import os\n'), ((1003, 1071), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_S...
merwaaan/mr.system
core/scripts/fetch_instructions_specs.py
0b3ff1b1fd726c6fd525a3f03f361dcac678344a
import json, requests from bs4 import BeautifulSoup def fetch(): r = requests.get('http://clrhome.org/table/') if not r.ok: print('Cannot fetch {})'.format(r.url)) return None # remove newlines text = r.text.replace('\n', '') # Return the data as a BeautifulSoup object for easy querying return ...
[((73, 114), 'requests.get', 'requests.get', (['"""http://clrhome.org/table/"""'], {}), "('http://clrhome.org/table/')\n", (85, 114), False, 'import json, requests\n'), ((320, 354), 'bs4.BeautifulSoup', 'BeautifulSoup', (['text', '"""html.parser"""'], {}), "(text, 'html.parser')\n", (333, 354), False, 'from bs4 import ...
M-Rod101/django-DefectDojo
unittests/tools/test_intsights_parser.py
7b09a00b1a526abaf40455c2ddec16aaa06b16e2
from ..dojo_test_case import DojoTestCase from dojo.models import Test from dojo.tools.intsights.parser import IntSightsParser class TestIntSightsParser(DojoTestCase): def test_intsights_parser_with_one_critical_vuln_has_one_findings_json( self): testfile = open("unittests/scans/intsights/ints...
[((358, 375), 'dojo.tools.intsights.parser.IntSightsParser', 'IntSightsParser', ([], {}), '()\n', (373, 375), False, 'from dojo.tools.intsights.parser import IntSightsParser\n'), ((1169, 1186), 'dojo.tools.intsights.parser.IntSightsParser', 'IntSightsParser', ([], {}), '()\n', (1184, 1186), False, 'from dojo.tools.ints...
sktollman/p4c
tools/testutils.py
380830f6c26135d1d65e1312e3ba2da628c18145
#!/usr/bin/env python # Copyright 2013-present Barefoot Networks, Inc. # Copyright 2018 VMware, 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/LIC...
[((3959, 3987), 'threading.Timer', 'Timer', (['TIMEOUT', 'kill', '[proc]'], {}), '(TIMEOUT, kill, [proc])\n', (3964, 3987), False, 'from threading import Timer\n'), ((5028, 5039), 'os.getuid', 'os.getuid', ([], {}), '()\n', (5037, 5039), False, 'import os\n'), ((3444, 3567), 'subprocess.Popen', 'Popen', (['args'], {'st...
BootyAss/bmstu
AlgorithmsAndDataStructures/mod2/Heap.py
bea202cbdff159d3840335b2a2a5c3bd632a7393
class Heap: def __init__(self): self.items = dict() # key - (value, index) self.indexes = [] # index - key // to know indexes # Usefull functions def swap(self, i, j): x = self.indexes[i] # key of 1 item y = self.indexes[j] # key of 2 item # swa...
[]
Boondockers-Welcome/django-comments-xtd
django_comments_xtd/tests/test_api_views.py
8edd68350803bfc351345820ccc4289077918e91
from __future__ import unicode_literals try: from unittest.mock import patch except ImportError: from mock import patch from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.test import TestCase from django.urls import reverse from rest_framework.t...
[((554, 573), 'rest_framework.test.APIRequestFactory', 'APIRequestFactory', ([], {}), '()\n', (571, 573), False, 'from rest_framework.test import APIRequestFactory, force_authenticate\n'), ((774, 797), 'django_comments_xtd.api.views.CommentCreate.as_view', 'CommentCreate.as_view', ([], {}), '()\n', (795, 797), False, '...
szhu3210/LeetCode_Solutions
LC/358.py
64747eb172c2ecb3c889830246f3282669516e10
class Solution(object): def rearrangeString(self, str, k): """ :type str: str :type k: int :rtype: str """ ## greedy: count keeps the # of chars, valid keeps the leftmost valid index of a char. res=[] # count # of chars d=coll...
[]
ferdinand-wood/kino_dynamic_opt
momentumopt/python/momentumopt/kinoptpy/momentum_kinematics_optimizer.py
ba6bef170819c55d1d26e40af835a744d1ae663f
''' @file momentum_kinematics_optimizer.py @package momentumopt @author Brahayam Ponton (brahayam.ponton@tuebingen.mpg.de) @license License BSD-3-Clause @copyright Copyright (c) 2019, New York University and Max Planck Gesellschaft. @date 2019-10-08 ''' import os import numpy as np from momentumopt.kinoptpy.qp import...
[((3985, 4023), 'numpy.zeros', 'np.zeros', (['(num_time_steps, num_eff, 3)'], {}), '((num_time_steps, num_eff, 3))\n', (3993, 4023), True, 'import numpy as np\n'), ((4049, 4087), 'numpy.zeros', 'np.zeros', (['(num_time_steps, num_eff, 3)'], {}), '((num_time_steps, num_eff, 3))\n', (4057, 4087), True, 'import numpy as n...
Addvilz/gullveig
gullveig/web/__init__.py
6ac5e66062c1b5ea8ad7c66f69be9e3d99ac0825
import logging from gullveig import bootstrap_default_logger # Configure default logging def _configure_default_web_logger(): logger = logging.getLogger('gullveig-web') bootstrap_default_logger(logger) api_logger = logging.getLogger('gullveig-api') bootstrap_default_logger(api_logger) aio_logge...
[((142, 175), 'logging.getLogger', 'logging.getLogger', (['"""gullveig-web"""'], {}), "('gullveig-web')\n", (159, 175), False, 'import logging\n'), ((180, 212), 'gullveig.bootstrap_default_logger', 'bootstrap_default_logger', (['logger'], {}), '(logger)\n', (204, 212), False, 'from gullveig import bootstrap_default_log...
clockfly/jupterhub_http_authenticator
jupyterhub_http_authenticator/httpauthenticator.py
88185e4677836129cd1bd15af368b7070103b1bf
import json import urllib import os import jupyterhub from tornado.httpclient import HTTPRequest, AsyncHTTPClient from traitlets import Unicode from jupyterhub.auth import Authenticator from tornado import gen class HttpAuthenticator(Authenticator): server = Unicode( None, allow_none=True, ...
[((265, 373), 'traitlets.Unicode', 'Unicode', (['None'], {'allow_none': '(True)', 'config': '(True)', 'help': '"""\n Http authentication server.\n """'}), '(None, allow_none=True, config=True, help=\n """\n Http authentication server.\n """)\n', (272, 373), False, 'from traitlets impo...
KushajveerSingh/fastai_without_fastai
src/lr_find.py
9a7c71b92c49be1e05858dc0e7ce63901c3c1bd2
import torch import torch.nn as nn import numpy as np import matplotlib.pyplot as plt # NOT -> ParameterModule # NOT -> children_and_parameters # NOT -> flatten_model # NOT -> lr_range # NOT -> scheduling functions # NOT -> SmoothenValue # YES -> lr_find # NOT -> plot_lr_find # NOT TO BE MODIFIED class ParameterModu...
[((1675, 1688), 'numpy.array', 'np.array', (['res'], {}), '(res)\n', (1683, 1688), True, 'import numpy as np\n'), ((4280, 4300), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (4292, 4300), False, 'import torch\n'), ((9315, 9333), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {}), ...
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py
b0e590d8130e97856afe578869b83a209e2b19be
""" Test the lldb disassemble command on each call frame when stopped on C's ctor. """ from __future__ import print_function import os import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class IterateFrameAndDisassembleTestCase(T...
[((1713, 1777), 'lldbsuite.test.lldbutil.get_stopped_thread', 'lldbutil.get_stopped_thread', (['process', 'lldb.eStopReasonBreakpoint'], {}), '(process, lldb.eStopReasonBreakpoint)\n', (1740, 1777), False, 'from lldbsuite.test import lldbutil\n'), ((3105, 3204), 'lldbsuite.test.lldbutil.run_break_set_by_file_and_line',...
irinaid/MAlice
reservedwords.py
02740d661020866c3927b9ee7ee4523aaaafcb7e
''' All the reserved, individual words used in MAlice. ''' A = "a" ALICE = "Alice" AND = "and" ATE = "ate" BECAME = "became" BECAUSE = "because" BUT = "but" CLOSED = "closed" COMMA = "," CONTAINED = "contained" DOT = "." DRANK = "drank" EITHER = "either" ENOUGH = "enough" EVENTUALLY = "eventually" FOUND = "found" H...
[]
theck17/notes
leetcode/0057_Insert_Interval/result.py
f32f0f4b8f821b1ed38d173ef0913efddd094b91
# !/usr/bin/env python3 # Author: C.K # Email: theck17@163.com # DateTime:2021-04-12 18:35:15 # Description: import os import sys class Solution: def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: res, i = [], 0 for interval in intervals: ...
[]
TiKeil/pymor
src/pymortests/benchmarks.py
5c6b3b6e1714b5ede11ce7cf03399780ab29d252
# This file is part of the pyMOR project (http://www.pymor.org). # Copyright 2013-2020 pyMOR developers and contributors. All rights reserved. # License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) from pymortests.base import runmodule if __name__ == "__main__": runmodule(filename=__file__...
[((293, 321), 'pymortests.base.runmodule', 'runmodule', ([], {'filename': '__file__'}), '(filename=__file__)\n', (302, 321), False, 'from pymortests.base import runmodule\n')]
anand2312/storage-py
storage3/_sync/client.py
75c9c43ea373cb58970255b8e7438c2ec67e7f25
from ..utils import SyncClient, __version__ from .bucket import SyncStorageBucketAPI from .file_api import SyncBucketProxy __all__ = [ "SyncStorageClient", ] class SyncStorageClient(SyncStorageBucketAPI): """Manage storage buckets and files.""" def __init__(self, url: str, headers: dict[str, str]) -> No...
[]
Hades01/Addons
repo/script.module.liveresolver/lib/js2py/translators/__init__.py
710da97ac850197498a3cd64be1811c593610add
# The MIT License # # Copyright 2014, 2015 Piotr Dabkowski # # 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, modif...
[((1704, 1716), 'pyjsparser.PyJsParser', 'PyJsParser', ([], {}), '()\n', (1714, 1716), False, 'from pyjsparser import PyJsParser, Node, WrappingNode, node_to_dict\n')]
xchange11/ttconv-1
src/test/python/test_scc_pacs.py
6e67172af126fa0e90690044848f300c0173715c
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Copyright (c) 2020, Sandflow Consulting LLC # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, ...
[((141705, 141720), 'unittest.main', 'unittest.main', ([], {}), '()\n', (141718, 141720), False, 'import unittest\n'), ((3449, 3479), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', (['(17)', '(64)'], {}), '(17, 64)\n', (3471, 3479), False, 'from ttconv.scc.codes.preambles_a...
NMijat1024/azure-sdk-for-python
azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/custom_image_properties_custom.py
c49e1d6d797dceaca81813cafb1a486d67185182
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
[]
nicolalandro/softpool
distance_torch_no_compile/chamfer.py
ca77161ab70e5fe6c6505dc40f448bd8e1d78a48
import torch def expanded_pairwise_distances(x, y): ''' Input: x is a bxNxd matrix y is an optional bxMxd matirx Output: dist is a bxNxM matrix where dist[i,j] is the square norm between x[i,:] and y[j,:] if y is not given then use 'y=x'. i.e. dist[i,j] = ||x[i,:]-y[j,:]||^2 ...
[((390, 430), 'torch.sum', 'torch.sum', (['(differences * differences)', '(-1)'], {}), '(differences * differences, -1)\n', (399, 430), False, 'import torch\n'), ((1095, 1220), 'torch.tensor', 'torch.tensor', (['[[[0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 1.0, 0.0]], [[1.0, 1.0, 0.0], [\n 1.0, 2.0, 0.0], [0.0, 1.0, 0....
crispzips/IsisCB
isiscb/curation/authority_views/relation_views.py
72f5ad47bbc2c615f995df148f5b86550835efdb
from __future__ import absolute_import from __future__ import print_function from __future__ import division from __future__ import unicode_literals from django.http import HttpResponse, HttpResponseRedirect, JsonResponse, QueryDict #, HttpResponseForbidden, Http404, , JsonResponse from django.shortcuts import get_obj...
[((844, 900), 'django.contrib.admin.views.decorators.user_passes_test', 'user_passes_test', (['(lambda u: u.is_superuser or u.is_staff)'], {}), '(lambda u: u.is_superuser or u.is_staff)\n', (860, 900), False, 'from django.contrib.admin.views.decorators import staff_member_required, user_passes_test\n'), ((2451, 2507), ...
silx-kit/silx
run_tests.py
360f890a617676a92f0bed6a28b718d09e70ec03
#!/usr/bin/env python3 # coding: utf8 # /*########################################################################## # # Copyright (c) 2015-2021 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files ...
[((1730, 1759), 'logging.captureWarnings', 'logging.captureWarnings', (['(True)'], {}), '(True)\n', (1753, 1759), False, 'import logging\n'), ((1776, 1808), 'warnings.simplefilter', 'warnings.simplefilter', (['"""default"""'], {}), "('default')\n", (1797, 1808), False, 'import warnings\n'), ((1819, 1849), 'logging.getL...
vprashanth777/Selenium
src/robot/utils/error.py
b3c48b75e73322891bb697f251b32a9a9d8b4dbe
# Copyright 2008-2015 Nokia Solutions and Networks # # 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 l...
[((796, 830), 'os.getenv', 'os.getenv', (['"""ROBOT_INTERNAL_TRACES"""'], {}), "('ROBOT_INTERNAL_TRACES')\n", (805, 830), False, 'import os\n'), ((4930, 4959), 're.compile', 're.compile', (['"""^\\\\s+at (\\\\w.+)"""'], {}), "('^\\\\s+at (\\\\w.+)')\n", (4940, 4959), False, 'import re\n'), ((1976, 1990), 'sys.exc_info'...
neozhangthe1/dedupe
dedupe/_init.py
aff99e6bd027291eecfb78eae08aa73877f4fff0
from dedupe.api import StaticDedupe, Dedupe from dedupe.api import StaticRecordLink, RecordLink from dedupe.api import StaticGazetteer, Gazetteer from dedupe.core import randomPairs, randomPairsMatch, frozendict from dedupe.convenience import consoleLabel, trainingDataDedupe, trainingDataLink, canonicalize
[]
ggreif/ic
scalability/tests/test_misc.py
ac56ec91f077c00d59eea3f73f51e14a1b3ea882
import unittest from unittest import TestCase from misc import verify class TestVerify(TestCase): """Tests misc.py verifies function.""" def test_verify__with_zero_threshold_and_expected_succeeds(self): """Test passes when expected rate, actual rate and threshold are all zero.""" result = ve...
[((1414, 1429), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1427, 1429), False, 'import unittest\n'), ((318, 394), 'misc.verify', 'verify', ([], {'metric': '"""Query failure rate"""', 'actual': '(0.0)', 'expected': '(0.0)', 'threshold': '(0.0)'}), "(metric='Query failure rate', actual=0.0, expected=0.0, thresh...
tomzhang/mars-1
mars/tensor/fft/ifft.py
6f1d85e37eb1b383251314cb0ba13e06288af03d
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2020 Alibaba Group Holding Ltd. # # 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-...
[((4231, 4252), 'numpy.dtype', 'np.dtype', (['np.complex_'], {}), '(np.complex_)\n', (4239, 4252), True, 'import numpy as np\n')]
mminamina/311-data
server/api/src/db/migrate/versions/v_2.py
9a3e4dc6e14c7500fc3f75f583c7fc4b01108b29
def migrate(): print('migrating to version 2')
[]