repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
zichuan-scott-xu/automl-workflow | examples/DeepWisdom/Auto_NLP/deepWisdom/transformers_/__init__.py | d108e55da943775953b9f1801311a86ac07e58a0 | __version__ = "2.1.1"
# Work around to update TensorFlow's absl.logging threshold which alters the
# default Python logging output behavior when present.
# see: https://github.com/abseil/abseil-py/issues/99
# and: https://github.com/tensorflow/tensorflow/issues/26691#issuecomment-500369493
try:
import absl.logging... | [((494, 521), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (511, 521), False, 'import logging\n')] |
TiankunZhou/dials | test/model/data/all_foreground_valid_data.py | bd5c95b73c442cceb1c61b1690fd4562acf4e337 | from __future__ import absolute_import, division, print_function
data = r"""cdials_array_family_flex_ext
shoebox
p1
(tRp2
(cscitbx_array_family_flex_ext
grid
p3
((I0
t(I8
tI01
tRp4
(I8
tbS'\x02\x01\x02\x08\x00\x03\\\x01\x03m\x01\x03\x04\x06\x03\x15\x06\x00\x02\x01\x02\x03\x02\x01\x02\x11\x02\x11\x02\x9c\x02\x06\x02\x8... | [] |
sofieditmer/self-assigned | src/use-model.py | 3033b64d2848fcf73c44dd79ad4e7f07f8387c65 | #!/usr/bin/env python
"""
Info: This script loads the model trained in the cnn-asl.py script and enables the user to use it for classifying unseen ASL letters. It also visualizes the feature map of the last convolutional layer of the network to enable the user to get an insight into exactly which parts of the original ... | [((960, 978), 'os.path.join', 'os.path.join', (['""".."""'], {}), "('..')\n", (972, 978), False, 'import os\n'), ((1486, 1511), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1509, 1511), False, 'import argparse\n'), ((2663, 2737), 'os.path.join', 'os.path.join', (['""".."""', '"""data"""', '"... |
algorithmiaio/algorithmia-adk-python | examples/hello_world/src/Algorithm.py | 1e5c6b9de08fe34260f3b4c03eb4596cccb4d070 | from Algorithmia import ADK
# API calls will begin at the apply() method, with the request body passed as 'input'
# For more details, see algorithmia.com/developers/algorithm-development/languages
def apply(input):
# If your apply function uses state that's loaded into memory via load, you can pass that loaded s... | [((677, 687), 'Algorithmia.ADK', 'ADK', (['apply'], {}), '(apply)\n', (680, 687), False, 'from Algorithmia import ADK\n')] |
Xiaoxiong-Liu/gluon-ts | src/gluonts/nursery/autogluon_tabular/estimator.py | 097c492769258dd70b7f223f826b17b0051ceee9 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | [((1145, 1172), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1162, 1172), False, 'import logging\n'), ((2824, 2835), 'gluonts.core.component.validated', 'validated', ([], {}), '()\n', (2833, 2835), False, 'from gluonts.core.component import validated\n'), ((3622, 3655), 'gluonts.time_f... |
andreas19/dcar | src/dcar/errors.py | 31118ac5924b7cb01f8b7da5a84480824c046df2 | """Errors module."""
__all__ = [
'Error',
'AddressError',
'AuthenticationError',
'TransportError',
'ValidationError',
'RegisterError',
'MessageError',
'DBusError',
'SignatureError',
'TooLongError',
]
class Error(Exception):
"""Base class."""
class AddressError(Error):
... | [] |
SergeBakharev/content | Packs/CortexXDR/Integrations/XDR_iocs/XDR_iocs_test.py | d66cc274f5bf6f9f0e9ed7e4df1af7b6f305aacf | from XDR_iocs import *
import pytest
from freezegun import freeze_time
Client.severity = 'INFO'
client = Client({'url': 'test'})
def d_sort(in_dict):
return sorted(in_dict.items())
class TestGetHeaders:
@freeze_time('2020-06-01T00:00:00Z')
def test_sanity(self, mocker):
"""
Given:
... | [((218, 253), 'freezegun.freeze_time', 'freeze_time', (['"""2020-06-01T00:00:00Z"""'], {}), "('2020-06-01T00:00:00Z')\n", (229, 253), False, 'from freezegun import freeze_time\n'), ((2366, 2453), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""res, expected_output"""', 'data_test_http_request_error_codes'],... |
rchdlps/django-docker | project/users/models.py | 2c12732264c1f17cd62e20927b5956db498c30b7 | from django.contrib.auth.models import AbstractUser
from django.db.models import CharField
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.db import models
from PIL import Image
class User(AbstractUser):
# First Name and Last Name do not cover name patterns
... | [((447, 549), 'django.db.models.ImageField', 'models.ImageField', ([], {'verbose_name': '"""Foto de Perfil:"""', 'default': '"""default.jpg"""', 'upload_to': '"""profile_pics"""'}), "(verbose_name='Foto de Perfil:', default='default.jpg',\n upload_to='profile_pics')\n", (464, 549), False, 'from django.db import mode... |
cloudify-incubator/cloudify-plugins-sdk | cloudify_terminal_sdk/netconf_connection.py | 9805008e739d31e5f9fe3184411648f9be5e6214 | # Copyright (c) 2015-2020 Cloudify Platform Ltd. 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 b... | [((3425, 3467), 'cloudify_common_sdk.exceptions.NonRecoverableError', 'exceptions.NonRecoverableError', (['"""no start"""'], {}), "('no start')\n", (3455, 3467), False, 'from cloudify_common_sdk import exceptions\n')] |
dyt1990/Seis_DCEC | Seismic_Conv1D_dec.py | 6cc56a7db10dd87b0ef39ece73578fca8b23c55f | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 19 17:48:13 2018
@author: Sediment
"""
# -*- coding: utf-8 -*-
'''
Keras implementation of deep embedder to improve clustering, inspired by:
"Unsupervised Deep Embedding for Clustering Analysis" (Xie et al, ICML 2016)
Definition can accept somewhat custom ne... | [((3045, 3077), 'keras.backend.variable', 'K.variable', (['self.initial_weights'], {}), '(self.initial_weights)\n', (3055, 3077), True, 'import keras.backend as K\n'), ((5348, 5380), 'keras.layers.Input', 'Input', ([], {'shape': '(self.input_dim, 1)'}), '(shape=(self.input_dim, 1))\n', (5353, 5380), False, 'from keras.... |
xiguadong/ppq | ppq/utils/round.py | 6c71adb3c2a8ca95967f101724b5e4b3e6f761ff | from decimal import ROUND_HALF_DOWN, ROUND_HALF_EVEN, ROUND_HALF_UP, Decimal
from math import ceil, floor, log2
from typing import Union
import torch
from ppq.core import RoundingPolicy
def ppq_numerical_round(value: float,
policy: RoundingPolicy=RoundingPolicy.ROUND_HALF_EVEN) -> int:
"""
reference... | [((1397, 1411), 'decimal.Decimal', 'Decimal', (['value'], {}), '(value)\n', (1404, 1411), False, 'from decimal import ROUND_HALF_DOWN, ROUND_HALF_EVEN, ROUND_HALF_UP, Decimal\n'), ((1425, 1435), 'decimal.Decimal', 'Decimal', (['(1)'], {}), '(1)\n', (1432, 1435), False, 'from decimal import ROUND_HALF_DOWN, ROUND_HALF_E... |
maropu/scavenger | python/repair/train.py | 03a935968f4aa507d4d98c8ca528195b770757d9 | #!/usr/bin/env python3
#
# 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 "L... | [((1090, 1104), 'repair.utils.setup_logger', 'setup_logger', ([], {}), '()\n', (1102, 1104), False, 'from repair.utils import elapsed_time, get_option_value, setup_logger\n'), ((1151, 1222), 'collections.namedtuple', 'namedtuple', (['"""_option"""', '"""key default_value type_class validator err_msg"""'], {}), "('_opti... |
volzotan/django-howl | howl/roomsensor/urls.py | 3b11c530da95d152844934da09592619b3d4497f | from django.conf.urls import patterns, url
from roomsensor import views
urlpatterns = patterns('',
url(r'^$', views.index, name='roomsensor'),
# ex: /roomsensor/name/
url(r'^(?P<roomsensor_name>\w+)/$', views.display, name='roomsensor_display'),
url(r'^(?P<roomsensor_name>\w+)/read/$', views.read, na... | [((105, 146), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.index'], {'name': '"""roomsensor"""'}), "('^$', views.index, name='roomsensor')\n", (108, 146), False, 'from django.conf.urls import patterns, url\n'), ((182, 259), 'django.conf.urls.url', 'url', (['"""^(?P<roomsensor_name>\\\\w+)/$"""', 'views.display']... |
vu-telab/DAKOTA-moga-post-processing-tool | main.py | 2f41561bd8ca44c693e5994f7f68a1edc1a82361 | # main.py
#
# currently just an example script I use to test my optimization_results module
#
# WARNING: design point numbers 0-indexed in pandas database, but
# eval_id column is the original 1-indexed value given by DAKOTA
import optimization_results as optr
def main():
a4 = optr.MogaOptimizationResults()
... | [] |
Rhodolite/Gem.py.UnitTest | Topaz/Core.py | eaa8b6855bcfbb12f67e7eb146928814543ef9d4 | #
# Copyright (c) 2017 Joy Diamond. All rights reserved.
#
@gem('Topaz.Core')
def gem():
require_gem('Gem.Global')
from Gem import gem_global
gem_global.testing = true
require_gem('Gem.Cache2')
require_gem('Gem.DumpCache')
require_gem('Gem.GeneratedConjureQuadruple')
require_gem('Ge... | [] |
kosovojs/wikibooster | app.py | 70a9d9d7bf41be9fa5e58d40fba216d9b6df008d | import flask
from flask import Flask
from flask import jsonify
from flask import request
from flask_cors import CORS, cross_origin
from flask import render_template
import mwoauth
import requests_oauthlib
import os
import yaml
import mwapi
from tasks.main import Tasks
from save import Save
from db import DB
from typ... | [((348, 445), 'flask.Flask', 'Flask', (['__name__'], {'static_folder': '"""./frontend/build/static"""', 'template_folder': '"""./frontend/build"""'}), "(__name__, static_folder='./frontend/build/static', template_folder=\n './frontend/build')\n", (353, 445), False, 'from flask import Flask\n'), ((464, 473), 'flask_c... |
shelleyyyyu/few_shot | pre_embed.py | 0fe54444e820fe3201927e6363682913b6d61028 | import numpy as np
from collections import defaultdict, Counter
import random
import json
from tqdm import tqdm
def transX(dataset):
rel2id = json.load(open(dataset + '/relation2ids'))
ent2id = json.load(open(dataset + '/ent2ids'))
with open('../Fast-TransX/' + dataset + '_base/entity2id.txt', 'w') as... | [((874, 885), 'tqdm.tqdm', 'tqdm', (['lines'], {}), '(lines)\n', (878, 885), False, 'from tqdm import tqdm\n')] |
Xinverse/BOTC-Bot | botc/gamemodes/troublebrewing/FortuneTeller.py | 1932c649c81a5a1eab735d7abdee0761c2853940 | """Contains the Fortune Teller Character class"""
import json
import random
import discord
import datetime
from botc import Action, ActionTypes, Townsfolk, Character, Storyteller, RedHerring, \
RecurringAction, Category, StatusList
from botc.BOTCUtils import GameLogic
from ._utils import TroubleBrewing, TBRole
im... | [((557, 577), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (566, 577), False, 'import json\n'), ((692, 712), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (701, 712), False, 'import json\n'), ((434, 454), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (443, 454), Fa... |
bjuvensjo/schmetterling | src/schmetterling/build/tests/test_maven.py | 0cdbfe4f379a081d9d4711dd21866b90983365cf | from unittest.mock import call, MagicMock, patch
from schmetterling.build.maven import build_multi_modules
from schmetterling.build.maven import create_build_result
from schmetterling.build.maven import create_command
from schmetterling.build.maven import create_multi_modules
from schmetterling.build.maven import crea... | [((2949, 3052), 'unittest.mock.patch', 'patch', (['"""schmetterling.build.maven.get_summary"""'], {'return_value': "(['mygroup:app.admin'], ['app.sign'])"}), "('schmetterling.build.maven.get_summary', return_value=([\n 'mygroup:app.admin'], ['app.sign']))\n", (2954, 3052), False, 'from unittest.mock import call, Mag... |
FdelMazo/7540rw-Algo1 | Copados y Clases/Mastermind_DEBUG.py | 8900604873195df9e902ead6bcb67723a8b654c8 | #Sacar las lineas con DEBUG para que el juego funcione
import random
DIGITOS = 4
def mastermind():
"""Funcion principal del juego Mastermind"""
print("Bienvenido al Mastermind!")
print("Instrucciones: Tenes que adivinar un codigo de {} digitos distintos. Tu cantidad de aciertos son los numeros que estan corr... | [((1213, 1235), 'random.choice', 'random.choice', (['digitos'], {}), '(digitos)\n', (1226, 1235), False, 'import random\n'), ((1324, 1346), 'random.choice', 'random.choice', (['digitos'], {}), '(digitos)\n', (1337, 1346), False, 'import random\n')] |
ovnicraft/runa | setup.py | 4834b7467314c51c3e8e010b47a10bdfae597a5b | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
with open("README.rst") as readme_file:
readme = readme_file.read()
with open("HISTORY.rst") as history_file:
history = history_file.read()
requirements = ["Click>=6.0", "suds2==0.7.1"]
setup_... | [((798, 829), 'setuptools.find_packages', 'find_packages', ([], {'include': "['runa']"}), "(include=['runa'])\n", (811, 829), False, 'from setuptools import setup, find_packages\n')] |
RichardA1/Adafruit_Learning_System_Guides | PyPortal_User_Interface/code.py | 7d06d8a126f357a431384c3af73339cb46f44c19 | import time
import board
import displayio
import busio
from analogio import AnalogIn
import neopixel
import adafruit_adt7410
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text.label import Label
from adafruit_button import Button
import adafruit_touchscreen
from adafruit_pyportal import PyPortal
#... | [((417, 448), 'busio.I2C', 'busio.I2C', (['board.SCL', 'board.SDA'], {}), '(board.SCL, board.SDA)\n', (426, 448), False, 'import busio\n'), ((455, 500), 'adafruit_adt7410.ADT7410', 'adafruit_adt7410.ADT7410', (['i2c_bus'], {'address': '(72)'}), '(i2c_bus, address=72)\n', (479, 500), False, 'import adafruit_adt7410\n'),... |
yottatix/btse-python | btse_futures/order.py | 1c5019d0a68dff797afc70c4cc32c1950c28af4e | import json
from btse_futures.constants import OrderType, Side, TimeInForce
class Order:
"""
Class to represent a BTSE Order
...
Attributes
----------
size : int
order quantity or size. e.g. 1
price : float
price. e.g. 7000.0
side: str
order side. B... | [] |
md-reddevil/blinkpy | tests/mock_responses.py | 3c7892385352079227c6251eb88257870bea0bb3 | """Simple mock responses definitions."""
from blinkpy.helpers.util import BlinkURLHandler
import blinkpy.helpers.constants as const
LOGIN_RESPONSE = {
'region': {'mock': 'Test'},
'networks': {
'1234': {'name': 'test', 'onboarded': True}
},
'authtoken': {'authtoken': 'foobar123', 'message': 'au... | [] |
steveschulze/Photometry | fits_tools.py | 3bc4ce457a270962321176d0e3e288b5a96cd34b | from astropy import coordinates as coord
from astropy import wcs
from astropy.io import fits
from astropy import units as u
from misc import bcolors
import numpy as np
import os
def convert_hms_dd(RA, DEC):
'''
Convert HMS to DD system
'''
if (':' in RA) and (':' in DEC):
Coord_dd = coord.SkyCoord(RA, DEC... | [((736, 756), 'astropy.io.fits.getheader', 'fits.getheader', (['FILE'], {}), '(FILE)\n', (750, 756), False, 'from astropy.io import fits\n'), ((841, 856), 'astropy.io.fits.open', 'fits.open', (['FITS'], {}), '(FITS)\n', (850, 856), False, 'from astropy.io import fits\n'), ((999, 1014), 'astropy.wcs.WCS', 'wcs.WCS', (['... |
neurom-iot/n3ml | test_stbp_snn_eval.py | 39c6b50661f293d58b4b37ef613643860724bb24 | import argparse
import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
from n3ml.model import DynamicModel_STBP_SNN
def validate(val_loader, model, encoder, criterion, opt):
model.eval()
total_images = 0
num_corrects = 0
total_loss = 0
with torch.no_g... | [((1344, 1370), 'torch.load', 'torch.load', (['opt.pretrained'], {}), '(opt.pretrained)\n', (1354, 1370), False, 'import torch\n'), ((1384, 1432), 'n3ml.model.DynamicModel_STBP_SNN', 'DynamicModel_STBP_SNN', ([], {'batch_size': 'opt.batch_size'}), '(batch_size=opt.batch_size)\n', (1405, 1432), False, 'from n3ml.model i... |
govex/python-lessons | section_07_(files)/read_csv.py | e692f48b6db008a45df0b941dee1e580f5a6c800 | # If you're new to file handling, be sure to check out with_open.py first!
# You'll also want to check out read_text.py before this example. This one is a bit more advanced.
with open('read_csv.csv', 'r') as states_file:
# Instead of leaving the file contents as a string, we're splitting the file into a list... | [] |
tinve/kaggle_melanoma | kaggle_melanoma/schedulers.py | 6d2d16d62a394fd9cc2498bdf1a19ce60fe047eb | import math
from torch.optim.lr_scheduler import _LRScheduler
from torch.optim.optimizer import Optimizer
class PolyLR(_LRScheduler):
"""
Sets the learning rate of each parameter group according to poly learning rate policy
"""
def __init__(self, optimizer, max_iter=90000, power=0.9, last_epoch=-1):... | [((657, 709), 'math.cos', 'math.cos', (['(step * math.pi / (total_epoch * len_epoch))'], {}), '(step * math.pi / (total_epoch * len_epoch))\n', (665, 709), False, 'import math\n')] |
PumpkinYing/GAT | data/data/__init__.py | 723a20fcd9f915123d46ef4ef03eeadb6910635a | from .dataset import load_data | [] |
federicosapienza/InboxNotionTelegramBot | utils.py | 031d5e78cd352dfb692b93f3e0b421695f1dc18e | import json
import logging
logger = logging.getLogger(__name__)
with open('configuration.json') as f:
config = json.load(f)
TELEGRAM_TOKEN = config["telegram-bot-token"]
NOTION_TOKEN = config["notion-token"]
NOTION_TABLE_URL = config["inbox_table"]["table_url"]
def check_allowed_user(user_id):
"""
chec... | [((37, 64), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (54, 64), False, 'import logging\n'), ((117, 129), 'json.load', 'json.load', (['f'], {}), '(f)\n', (126, 129), False, 'import json\n')] |
timgates42/enaml | enaml/core/byteplay/__init__.py | 054efe6a4047d84f2fff718d656a64a2363884dc | #------------------------------------------------------------------------------
# Copyright (c) 2013-2018, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#--------------------------------------------... | [] |
artemigkh/cassiopeia | cassiopeia/datastores/riotapi/match.py | fa78cb8f86ea21857916a707d04de6a05498033e | from time import time
from typing import Type, TypeVar, MutableMapping, Any, Iterable, Generator, Union
import arrow
import datetime
import math
from datapipelines import DataSource, PipelineContext, Query, NotFoundError, validate_query
from .common import RiotAPIService, APINotFoundError
from ...data import Platform... | [((477, 489), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (484, 489), False, 'from typing import Type, TypeVar, MutableMapping, Any, Iterable, Generator, Union\n'), ((1103, 1172), 'datapipelines.validate_query', 'validate_query', (['_validate_get_match_query', 'convert_region_to_platform'], {}), '(_valid... |
fochoao/cpython | Lib/site-packages/hackedit/vendor/jedi/cache.py | 3dc84b260e5bced65ebc2c45c40c8fa65f9b5aa9 | """
This caching is very important for speed and memory optimizations. There's
nothing really spectacular, just some decorators. The following cache types are
available:
- module caching (`load_parser` and `save_parser`), which uses pickle and is
really important to assure low load times of modules like ``numpy``.
-... | [((3207, 3232), 'jedi.common.splitlines', 'common.splitlines', (['source'], {}), '(source)\n', (3224, 3232), False, 'from jedi import common\n'), ((3404, 3439), 're.match', 're.match', (['""".*\\\\("""', 'whole', 're.DOTALL'], {}), "('.*\\\\(', whole, re.DOTALL)\n", (3412, 3439), False, 'import re\n'), ((5956, 5978), '... |
adarshrs/Drone-Simulator-for-ROS-Kinetic | sandia_hand/ros/sandia_hand_teleop/simple_grasp/simple_grasp.py | a44eef1bcaacc55539325bba663f0c8abfd7c75b | #!/usr/bin/env python
#
# Software License Agreement (Apache License)
#
# Copyright 2013 Open Source Robotics Foundation
# Author: Morgan Quigley
#
# 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 ... | [] |
edzzn/Manejo_Liberia | ui/ui_prestamo_libros.py | c735d35b32fc53839acfc48d4e088e69983edf16 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'PrestamoDeLibros.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromU... | [((1541, 1569), 'PyQt4.QtGui.QApplication', 'QtGui.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (1559, 1569), False, 'from PyQt4 import QtCore, QtGui\n'), ((1581, 1596), 'PyQt4.QtGui.QWidget', 'QtGui.QWidget', ([], {}), '()\n', (1594, 1596), False, 'from PyQt4 import QtCore, QtGui\n'), ((458, 522), 'PyQt4.QtGui.Q... |
zopefoundation/zope.app.content | src/zope/app/content/__init__.py | d4c0276ff90bceed2156d808ab6b42b85d7b3810 | ##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [((3465, 3493), 'zope.interface.provider', 'provider', (['IVocabularyFactory'], {}), '(IVocabularyFactory)\n', (3473, 3493), False, 'from zope.interface import provider\n'), ((2749, 2776), 'zope.security.proxy.removeSecurityProxy', 'removeSecurityProxy', (['object'], {}), '(object)\n', (2768, 2776), False, 'from zope.s... |
yschiebelhut/ewm-cloud-robotics | python-modules/robcoewmrobotconfigurator/robcoewmrobotconfigurator/run.py | bdf3a6c13850d266b70168912494300c32d4d803 | #!/usr/bin/env python3
# encoding: utf-8
#
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
#
# This file is part of ewm-cloud-robotics
# (see https://github.com/SAP/ewm-cloud-robotics).
#
# This file is licensed under the Apache Software License, v. 2 except as noted
# otherwise in the LIC... | [((744, 771), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (761, 771), False, 'import logging\n'), ((1803, 1818), 'robcoewmrobotconfigurator.robco_robot_api.RobCoRobotAPI', 'RobCoRobotAPI', ([], {}), '()\n', (1816, 1818), False, 'from robcoewmrobotconfigurator.robco_robot_api import Rob... |
DanielSBrown/osf.io | website/addons/forward/views/__init__.py | 98dda2ac237377197acacce78274bc0a4ce8f303 | from . import config, widget # noqa
| [] |
crvallance/wlanpi-hwtest | hwtest/automated/usb3_test.py | 8858ef6e8fa78767238b968b121b4d5ab2155701 | from hwtest.shell_utils import run_command
def test_linux_usb3hub():
"""
Test for Linux Foundation 3.0 root hub in `lsusb` output
"""
resp = run_command(["lsusb"])
assert "1d6b:0003" in resp
| [((160, 182), 'hwtest.shell_utils.run_command', 'run_command', (["['lsusb']"], {}), "(['lsusb'])\n", (171, 182), False, 'from hwtest.shell_utils import run_command\n')] |
tp-m/meson | ninjabackend.py | 2d1aa395e86848ca948d30d83cc5357777e5b490 | # Copyright 2012-2014 The Meson development team
# 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... | [((875, 896), 'mesonlib.is_windows', 'mesonlib.is_windows', ([], {}), '()\n', (894, 896), False, 'import environment, mesonlib\n'), ((5495, 5565), 'coredata.MesonException', 'MesonException', (['"""Could not determine vs dep dependency prefix string."""'], {}), "('Could not determine vs dep dependency prefix string.')\... |
y-tetsu/othello | tests/strategies/common/test_cputime.py | 73eabfe22d6b44bbfa0b436e6287e3e7356620f4 | """Tests of cputime.py
"""
import unittest
from reversi.strategies.common import CPU_TIME
class TestCputime(unittest.TestCase):
"""cputime
"""
def test_cputime(self):
self.assertEqual(CPU_TIME, 0.5)
| [] |
coopersigrist/RecurrentNeuralSystem- | experiments/cifar10_recon.py | bd5bb680ec7f2166547709195f7bb3cd52cca5e8 | # -*- coding: utf-8 -*-
"""ReNS experiments - CIFAR10
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1byZ4xTfCK2x1Rhkxpl-Vv4sqA-bo4bis
# SETUP
"""
#@title Insatlling Pyorch
# !pip install torch
# !pip install torchvision
#@title Import Dependencies... | [((1081, 1157), 'torchvision.datasets.CIFAR10', 'dsets.CIFAR10', ([], {'root': '"""./data"""', 'train': '(True)', 'transform': 'transform', 'download': '(True)'}), "(root='./data', train=True, transform=transform, download=True)\n", (1094, 1157), True, 'import torchvision.datasets as dsets\n'), ((1203, 1265), 'torchvis... |
ameoba/horizon | horizon/forms/__init__.py | ff9e367c98a8bb79f10914abffaaa04b0a461819 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | [] |
noironetworks/heat | heat/tests/test_rpc_listener_client.py | 7cdadf1155f4d94cf8f967635b98e4012a7acfb7 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | [((1108, 1119), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (1117, 1119), False, 'import mock\n'), ((1147, 1192), 'heat.rpc.listener_client.EngineListenerClient', 'rpc_client.EngineListenerClient', (['"""engine-007"""'], {}), "('engine-007')\n", (1178, 1192), True, 'from heat.rpc import listener_client as rpc_client\n'... |
akshitsingla/amadeus-python | amadeus/travel/trip_parser_jobs/_status.py | d8f3595e556b674998156f98d8a318045bb4c21c | from amadeus.client.decorator import Decorator
class TripParserStatus(Decorator, object):
def __init__(self, client, job_id):
Decorator.__init__(self, client)
self.job_id = job_id
def get(self, **params):
'''
Returns the parsing status and the link to the result
in cas... | [((140, 172), 'amadeus.client.decorator.Decorator.__init__', 'Decorator.__init__', (['self', 'client'], {}), '(self, client)\n', (158, 172), False, 'from amadeus.client.decorator import Decorator\n')] |
meyerweb/wpt | tools/third_party/iniconfig/testing/test_iniconfig.py | f04261533819893c71289614c03434c06856c13e | import py
import pytest
from iniconfig import IniConfig, ParseError, __all__ as ALL
from iniconfig import iscommentline
from textwrap import dedent
check_tokens = {
'section': (
'[section]',
[(0, 'section', None, None)]
),
'value': (
'value = 1',
[(0, None, 'value', '1')]
... | [((3009, 3049), 'py.test.mark.parametrize', 'py.test.mark.parametrize', (['"""line"""', "['!!']"], {}), "('line', ['!!'])\n", (3033, 3049), False, 'import py\n'), ((7583, 7651), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""line"""', "['#qwe', ' #qwe', ';qwe', ' ;qwe']"], {}), "('line', ['#qwe', ' #qwe'... |
natebragg/java-sketch | jskparser/jskparser/util.py | f5ac26f2cc46ae4556f9a61c55afd37f55c961ff | import os
from subprocess import call
from . import glob2
pwd = os.path.dirname(__file__)
def get_files_from_path(path, ext):
# use set to remove duplicate files. weird...but it happens
if os.path.isfile(path): return set([os.path.abspath(path)])
else: # i.e., folder
files = glob2.glob(os.path.a... | [((66, 91), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (81, 91), False, 'import os\n'), ((200, 220), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (214, 220), False, 'import os\n'), ((3502, 3523), 'subprocess.call', 'call', (['cmd'], {'shell': '(True)'}), '(cmd, shell=Tr... |
SNeugber/fiftyone | fiftyone/core/patches.py | a50be47bbbf189e4bbdcd631b93c4c9cbf41c6b7 | """
Patches views.
| Copyright 2017-2021, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
from copy import deepcopy
import eta.core.utils as etau
import fiftyone.core.aggregations as foa
import fiftyone.core.dataset as fod
import fiftyone.core.fields as fof
import fiftyone.core.labels as fol
import fifty... | [((13620, 13652), 'fiftyone.core.dataset.Dataset', 'fod.Dataset', (['name'], {'_patches': '(True)'}), '(name, _patches=True)\n', (13631, 13652), True, 'import fiftyone.core.dataset as fod\n'), ((17000, 17032), 'fiftyone.core.dataset.Dataset', 'fod.Dataset', (['name'], {'_patches': '(True)'}), '(name, _patches=True)\n',... |
ocesaulo/cookiecutter-ocn_sci | {{cookiecutter.repo_name}}/setup.py | d41e826f56ba67cfde878ffc8188d497214a5f5b | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
{%- set license_classifiers = {
'MIT license': 'License :: OSI Approved :: MIT License',
'BSD license': 'License :: OSI A... | [] |
zopefoundation/zope.app.debug | src/zope/app/debug/debug.py | 4f31e98f6a633f089bf132dd55cb3ead0270887b | ##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [((1749, 1761), 'zope.app.appsetup.database', 'database', (['db'], {}), '(db)\n', (1757, 1761), False, 'from zope.app.appsetup import config, database\n'), ((2873, 2905), 'urllib.unquote', 'urllib.unquote', (["env['PATH_INFO']"], {}), "(env['PATH_INFO'])\n", (2887, 2905), False, 'import urllib\n'), ((3936, 3953), 'zope... |
terryli710/SIIM-ACR-Pneumothorax-Classification | transfer_learning.py | 8b278a9885b71c919d7064b2df42863b53f7adf3 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 18 22:42:54 2020
@author: mike
"""
import numpy as np
import tensorflow as tf
from tensorflow import keras
from sklearn.model_selection import train_test_split
from tensorflow.keras.applications import VGG16
from tensorflow.keras import layers
fro... | [((449, 474), 'numpy.load', 'np.load', (['"""train_data.npy"""'], {}), "('train_data.npy')\n", (456, 474), True, 'import numpy as np\n'), ((485, 513), 'numpy.zeros', 'np.zeros', (['(210, 204, 204, 3)'], {}), '((210, 204, 204, 3))\n', (493, 513), True, 'import numpy as np\n'), ((520, 533), 'numpy.zeros', 'np.zeros', (['... |
erexer/polyaxon | core/tests/test_polyflow/test_workflows/test_hyperband.py | be14dae1ed56d568983388736bcdaf27a7baa4a4 | #!/usr/bin/python
#
# Copyright 2018-2020 Polyaxon, 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 ... | [((1405, 1439), 'polyaxon.polyflow.matrix.V1Hyperband.from_dict', 'V1Hyperband.from_dict', (['config_dict'], {}), '(config_dict)\n', (1426, 1439), False, 'from polyaxon.polyflow.matrix import V1Hyperband\n'), ((2066, 2100), 'polyaxon.polyflow.matrix.V1Hyperband.from_dict', 'V1Hyperband.from_dict', (['config_dict'], {})... |
fatimatswanya/fatimaCSC102 | Class Work oop.py | cab70bd696d39a9e16bcb57e0180e872be4f49bc |
class Student:
studentLevel = 'first year computer science 2020/2021 session'
studentCounter = 0
registeredCourse='csc102'
def __init__(self, thename, thematricno, thesex,thehostelname,theage,thecsc102examscore):
self.name = thename
self.matricno = thematricno
self.sex = thesex
... | [] |
Fozar/clickhouse-sqlalchemy | clickhouse_sqlalchemy/drivers/reflection.py | 88fd630856655cc470430b365dce7e85516abf62 | from sqlalchemy.engine import reflection
from clickhouse_sqlalchemy import Table, engines
class ClickHouseInspector(reflection.Inspector):
def reflect_table(self, table, *args, **kwargs):
# This check is necessary to support direct instantiation of
# `clickhouse_sqlalchemy.Table` and then reflect... | [] |
abdul-khalid/pydisque | tests/test_disque.py | a9b5caa6dac0621a0174d168f4a04c88d0e2f8b5 | """
Unit Tests for the pydisque module.
Currently, most of these tests require a fresh instance of
Disque to be valid and pass.
"""
import unittest
import json
import time
import random
import six
from pydisque.client import Client
from redis.exceptions import ResponseError
class TestDisque(unittest.TestCase):
... | [((6670, 6685), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6683, 6685), False, 'import unittest\n'), ((450, 476), 'pydisque.client.Client', 'Client', (["['localhost:7711']"], {}), "(['localhost:7711'])\n", (456, 476), False, 'from pydisque.client import Client\n'), ((2895, 2906), 'time.time', 'time.time', ([]... |
samirsahoo007/Naive-Bayes-and-Decision-Tree-Classifiers | src/runner.py | 619c5c0b17438d1014f7ca7e4ce13cc44c45de3c | # -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ runner.py ]
# Synopsis [ main program that runs the 'Naive Bayes' and 'Decision Tree' training / testing ]
# Author [ Ting-Wei Liu (Andi611) ]
# Copyright [... | [((772, 822), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""descrip_msg"""'}), "(description='descrip_msg')\n", (795, 822), False, 'import argparse\n'), ((5098, 5115), 'data_loader.data_loader', 'data_loader', (['args'], {}), '(args)\n', (5109, 5115), False, 'from data_loader import dat... |
Nick-AhSen/iGibson | igibson/metrics/agent.py | c6854f11eec5d935fa3ef3d6d4852c6571beab4b | import copy
import numpy as np
import pybullet as p
from igibson.metrics.metric_base import MetricBase
class BehaviorRobotMetric(MetricBase):
def __init__(self):
self.initialized = False
self.state_cache = {}
self.next_state_cache = {}
self.agent_pos = {part: [] for part in ["l... | [((3877, 3913), 'copy.deepcopy', 'copy.deepcopy', (['self.next_state_cache'], {}), '(self.next_state_cache)\n', (3890, 3913), False, 'import copy\n'), ((5886, 5903), 'numpy.abs', 'np.abs', (['delta_pos'], {}), '(delta_pos)\n', (5892, 5903), True, 'import numpy as np\n'), ((6072, 6179), 'numpy.linalg.norm', 'np.linalg.n... |
Arahabica/font-subset-css | fontslice/__init__.py | 393b9a452af49c2168c7a9f84983e4170937ea67 | import sys
from .main import (
_chunk_list,
_get_unicode_range_hash,
convert_unicode_range,
get_120_unicode_ranges,
get_unicode_ranges_from_text,
generate_css,
main,
)
__all__ = [
"_chunk_list",
"_get_unicode_range_hash",
"convert_unicode_range",
"get_120_unicode_ranges",
... | [] |
MrJaatt/ttkbootstrap | src/ttkbootstrap/dialogs/dialogs.py | 4e837d64859e5a230ef0500faddbb2c384f5b9d4 | """
This module contains various base dialog base classes that can be
used to create custom dialogs for the end user.
These classes serve as the basis for the pre-defined static helper
methods in the `Messagebox`, and `Querybox` container classes.
"""
import calendar
import textwrap
from datetime im... | [((1279, 1314), 'tkinter.BaseWidget._setup', 'BaseWidget._setup', (['self', 'parent', '{}'], {}), '(self, parent, {})\n', (1296, 1314), False, 'from tkinter import BaseWidget\n'), ((8915, 8955), 'ttkbootstrap.Frame', 'ttk.Frame', (['master'], {'padding': 'self._padding'}), '(master, padding=self._padding)\n', (8924, 89... |
venky4121994/ga-learner-dsmp-repo | Google-Play-Store-App-Rating/code.py | 1bef03489931eece0d5ecb9ce0501dfeb558dc59 | # --------------
#Importing header files
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
#Code starts here
data = pd.read_csv(path)
data.hist(['Rating'])
data = data[data['Rating']<=5]
data.hist(['Rating'])
#Code ends here
# --------------
# code starts here
total_null = data.isnull().s... | [((145, 162), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (156, 162), True, 'import pandas as pd\n'), ((390, 462), 'pandas.concat', 'pd.concat', (['[total_null, percent_null]'], {'keys': "['Total', 'Percent']", 'axis': '(1)'}), "([total_null, percent_null], keys=['Total', 'Percent'], axis=1)\n", (399,... |
Banguiskode/nerds | converters/brat2iob.py | 366420b2ec57bf790562de62a79f4973cbd6b3ed | import argparse
import operator
import os
import re
import shutil
import spacy
import tempfile
from nerds.utils import spans_to_tokens, get_logger
def segment_text_to_sentences(text_file, sentence_splitter):
""" Segment text into sentences. Text is provided by BRAT in .txt
file.
Args:
... | [((5781, 5882), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Script to convert BRAT annotations to IOB (NERDS) format."""'}), "(description=\n 'Script to convert BRAT annotations to IOB (NERDS) format.')\n", (5804, 5882), False, 'import argparse\n'), ((6182, 6194), 'nerds.utils.get_... |
zjsteyn/kraken | kraken/lib/util.py | eaa9f4290db5425ddf80d0aebfa3944713558ab5 | """
Ocropus's magic PIL-numpy array conversion routines. They express slightly
different behavior from PIL.Image.toarray().
"""
import unicodedata
import numpy as np
from PIL import Image
__all__ = ['pil2array', 'array2pil']
def pil2array(im: Image.Image, alpha: int = 0) -> np.array:
if im.mode == '1':
... | [((364, 376), 'numpy.array', 'np.array', (['im'], {}), '(im)\n', (372, 376), True, 'import numpy as np\n'), ((434, 447), 'numpy.dtype', 'np.dtype', (['"""B"""'], {}), "('B')\n", (442, 447), True, 'import numpy as np\n'), ((1891, 1917), 'unicodedata.category', 'unicodedata.category', (['char'], {}), '(char)\n', (1911, 1... |
hao44le/ico_top_holder_analysis | analysis/calculate_holding_amount.py | aeeab01c90e4446b424c52c33a68ccb814123121 | import sys
sys.path.insert(0,'..')
from data.whale_data import exchnage_accounts
from data.html_helper import check_if_address_name_exists
from data.whale_eth_tx_data import *
from data.whale_token_tx_data import identify_investor_type_token
holding_account = "holding_account"
deposit_account = 'deposit_account'
withd... | [((11, 35), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (26, 35), False, 'import sys\n'), ((1185, 1218), 'data.whale_token_tx_data.identify_investor_type_token', 'identify_investor_type_token', (['out'], {}), '(out)\n', (1213, 1218), False, 'from data.whale_token_tx_data import ident... |
JBoRu/TextBox-1 | textbox/trainer/trainer.py | 0dcbaa153acc507e3d55075312d7ca5d23146e03 | # @Time : 2020/11/14
# @Author : Junyi Li, Gaole He
# @Email : lijunyi@ruc.edu.cn
# UPDATE:
# @Time : 2020/12/2, 2020/11/27, 2020/12/3, 2020/12/26
# @Author : Jinhao Jiang, Xiaoxuan Hu, Tianyi Tang, Jinhao Jiang
# @Email : jiangjinhao@std.uestc.edu.cn, huxiaoxuan@ruc.edu.cn, steventang@ruc.edu.cn, jiangjinhao@st... | [((14311, 14326), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (14324, 14326), False, 'import torch\n'), ((32725, 32740), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (32738, 32740), False, 'import torch\n'), ((2678, 2689), 'logging.getLogger', 'getLogger', ([], {}), '()\n', (2687, 2689), False, 'from log... |
EurusEurus/RSSerpent | rsserpent/plugins/builtin/__init__.py | fd7aaf67b80b2b48c14b1a3efe733374b0012338 | from ...models import Persona, Plugin
from . import example, example_cache, example_ratelimit, example_with_args
plugin = Plugin(
name="rsserpent-plugin-builtin",
author=Persona(
name="queensferryme",
link="https://github.com/queensferryme",
email="queensferry.me@gmail.com",
),
... | [] |
luisroel91/libdib_assesment | data_processing/process_xls.py | c969cfecbce1243b457961ffafe5caaea7bb5149 | import pandas as pd
# Define our header
col_names = [
"year",
"num_males_with_income",
"male_median_income_curr_dollars",
"male_median_income_2019_dollars",
"num_females_with_income",
"female_median_income_curr_dollars",
"female_median_income_2019_dollars",
]
# Load Asian census data XLS, ... | [((347, 415), 'pandas.read_excel', 'pd.read_excel', (['"""p08a.xlsx"""'], {'skiprows': '(8)', 'header': 'None', 'names': 'col_names'}), "('p08a.xlsx', skiprows=8, header=None, names=col_names)\n", (360, 415), True, 'import pandas as pd\n'), ((569, 637), 'pandas.read_excel', 'pd.read_excel', (['"""p08w.xlsx"""'], {'skip... |
Szymon-Budziak/WDI_exercises_solutions | Section_1/Exercise_16.py | 51ffc9ec8b3cd6809bd55e98ecb8aed759c2d460 | """
Dany jest ciąg określony wzorem: A[n+1] = (A[n] % 2) ∗ (3 ∗ A[n] + 1) + (1 − A[n] % 2) ∗ A[n] / 2.
Startując z dowolnej liczby naturalnej > 1 ciąg ten osiąga wartość 1. Napisać program, który
znajdzie wyraz początkowy z przedziału 2-10000 dla którego wartość 1 jest osiągalna po największej
liczbie kroków.
"""
a0 = ... | [] |
evlog/SysPy | SysPy_ver/funcs/_var_declaration.py | d1ee6e2ca60492d20339c0016a9c24d027170553 | """
*****************************************************************************
*
H E A D E R I N F O R M A T I O N *
*
****... | [] |
MaggieIllustrations/softuni-github-programming | Giraffe/Functions.py | f5695cb14602f3d2974359f6d8734332acc650d3 | def say_hi(name,age):
print("Hello " + name + ", you are " + age)
say_hi("Mike", "35")
def cube(num): # function
return num*num*num
result = cube(4) # variable
print(result)
| [] |
wipfli/airspaces | airspace_surgery.py | c2e01615fa6a065895ed04b8f342a38732e9196b | import glob
import json
path_in = './airspaces/'
path_out = './airspaces_processed/'
filenames = [path.split('/')[-1] for path in glob.glob(path_in + '*')]
remove = {
'france_fr.geojson': [
314327,
314187,
314360,
314359,
314362,
314361,
314364,
314... | [((4215, 4284), 'json.dump', 'json.dump', (["{'type': 'FeatureCollection', 'features': all_features}", 'f'], {}), "({'type': 'FeatureCollection', 'features': all_features}, f)\n", (4224, 4284), False, 'import json\n'), ((132, 156), 'glob.glob', 'glob.glob', (["(path_in + '*')"], {}), "(path_in + '*')\n", (141, 156), Fa... |
lidenghong1/SmallReptileTraining | AndroidSpider/spider_main.py | a1bfb81c9969edfb7554acc50370c0cb036da690 | from AndroidSpider import url_manager, html_downloader, html_parser, html_output
'''
爬取百度百科 Android 关键词相关词及简介并输出为一个HTML tab网页
Extra module:
BeautifulSoup
'''
class SpiderMain(object):
def __init__(self):
self.urls = url_manager.UrlManager()
self.downloader = html_downloader.HtmlDownLoader()
... | [((230, 254), 'AndroidSpider.url_manager.UrlManager', 'url_manager.UrlManager', ([], {}), '()\n', (252, 254), False, 'from AndroidSpider import url_manager, html_downloader, html_parser, html_output\n'), ((281, 313), 'AndroidSpider.html_downloader.HtmlDownLoader', 'html_downloader.HtmlDownLoader', ([], {}), '()\n', (31... |
trompamusic/ce-queries-template | trompace/mutations/__init__.py | cc5ae69d0e76623bfd72e9453f569f6624bf7c3b | MUTATION = '''mutation {{
{mutation}
}}'''
def _verify_additional_type(additionaltype):
"""Check that the input to additionaltype is a list of strings.
If it is empty, raise ValueError
If it is a string, convert it to a list of strings."""
if additionaltype is None:
return None
if isins... | [] |
CapitalOneDevExchangeHackathon/Financial-Fitness | Web_App/infrastructure/infra.py | 54a2203d6b3d96687d822247b040613b644874f2 | import boto
import boto3
from config import Config
dynamodb = boto3.resource('dynamodb',
aws_access_key_id=Config.AWS_KEY,
aws_secret_access_key=Config.AWS_SECRET_KEY,
region_name=Config.REGION)
table = dynamodb.Table('user_details')
tables... | [((63, 199), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {'aws_access_key_id': 'Config.AWS_KEY', 'aws_secret_access_key': 'Config.AWS_SECRET_KEY', 'region_name': 'Config.REGION'}), "('dynamodb', aws_access_key_id=Config.AWS_KEY,\n aws_secret_access_key=Config.AWS_SECRET_KEY, region_name=Config.REGION)\n... |
ndarwin314/symbolicPy | numberTheory/natural.py | ce2e48bf1557b5995db6c324ada9fbd4767df1e3 | # TODO: implement algorithms in c++ or something to make them fast
| [] |
TeaPackCZ/RobotZed | SelfTests.py | 7ac8bfb14a6c2e5887f8fed299ad87b384701c54 | import os
import unittest
from Logger import Logger
class TestLogger(unittest.TestCase):
def test_file_handling(self):
testLog = Logger("testLog")
## Check if program can create and open file
self.assertTrue(testLog.opened)
returns = testLog.close()
## Check if logger correc... | [((2735, 2750), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2748, 2750), False, 'import unittest\n'), ((142, 159), 'Logger.Logger', 'Logger', (['"""testLog"""'], {}), "('testLog')\n", (148, 159), False, 'from Logger import Logger\n'), ((653, 676), 'os.remove', 'os.remove', (['testLog.name'], {}), '(testLog.nam... |
Abijithkrishna/manga-py | manga_py/parser.py | 03b142ecb944ef37a36e5095ffa580209021e3b0 | from logging import warning
from requests import get
from .info import Info
from .provider import Provider
from .providers import get_provider
class Parser:
def __init__(self, args: dict):
self.params = args
def init_provider(
self,
chapter_progress: callable = None,
... | [((1827, 1865), 'requests.get', 'get', (['url'], {'stream': '(True)', 'proxies': 'proxies'}), '(url, stream=True, proxies=proxies)\n', (1830, 1865), False, 'from requests import get\n')] |
pwelzel/bornhack-website | src/villages/migrations/0008_auto_20161228_2209.py | af794e6a2fba06e09626259c7768feb30ff394be | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-28 22:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('villages', '0007_village_camp'),
]
operations = [
migrations.AlterField(
... | [((389, 468), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""camps.Camp"""'}), "(on_delete=django.db.models.deletion.CASCADE, to='camps.Camp')\n", (406, 468), False, 'from django.db import migrations, models\n')] |
sindhumadhadi09/CustomerMgmt | customers/views.py | db8b27ad6ceb8050843dc33509dc2b6c2ed2c1e2 | from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.views import generic
from django.utils import timezone
from .models import Customer
class IndexView(generic.ListView):
template_name = 'customers/index.html'
context_... | [((932, 958), 'django.urls.reverse', 'reverse', (['"""customers:index"""'], {}), "('customers:index')\n", (939, 958), False, 'from django.urls import reverse\n'), ((1100, 1126), 'django.urls.reverse', 'reverse', (['"""customers:index"""'], {}), "('customers:index')\n", (1107, 1126), False, 'from django.urls import reve... |
yuriks/salt | salt/ext/tornado/test/import_test.py | d2a5bd8adddb98ec1718d79384aa13b4f37e8028 | # flake8: noqa
# pylint: skip-file
from __future__ import absolute_import, division, print_function
from salt.ext.tornado.test.util import unittest
class ImportTest(unittest.TestCase):
def test_import_everything(self):
# Some of our modules are not otherwise tested. Import them
# all (unless they... | [] |
fossabot/butterfree | butterfree/configs/db/metastore_config.py | 8a7da8c540b51c6560b2825cb926c40a351f202b | """Holds configurations to read and write with Spark to AWS S3."""
import os
from typing import Any, Dict, List, Optional
from pyspark.sql import DataFrame
from butterfree.configs import environment
from butterfree.configs.db import AbstractWriteConfig
from butterfree.dataframe_service import extract_partition_value... | [((2995, 3074), 'butterfree.dataframe_service.extract_partition_values', 'extract_partition_values', (['dataframe'], {'partition_columns': "['year', 'month', 'day']"}), "(dataframe, partition_columns=['year', 'month', 'day'])\n", (3019, 3074), False, 'from butterfree.dataframe_service import extract_partition_values\n'... |
johanngan/special_relativity | examples/2-objects.py | cd372c7460d2c0d4040c81bc1bd0090086dba735 | #!/usr/bin/env python3
import sys
sys.path.append('..')
import specrel.geom as geom
import specrel.spacetime.physical as phy
import specrel.visualize as vis
# Shared parameters
include_grid = True
include_legend = True
tlim = (0, 2)
xlim = (-2, 2)
# A stationary point object
stationary = phy.MovingObject(0, draw_opt... | [((34, 55), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (49, 55), False, 'import sys\n'), ((292, 346), 'specrel.spacetime.physical.MovingObject', 'phy.MovingObject', (['(0)'], {'draw_options': "{'label': '$v = 0$'}"}), "(0, draw_options={'label': '$v = 0$'})\n", (308, 346), True, 'import specr... |
mfkiwl/OpenXcvr | firmware/modulator.py | 9bea6efd03cd246f16982f0fadafed684ac5ce1c | from baremetal import *
from math import pi, sin, cos
import sys
from scale import scale
from settings import *
from ssb import ssb_polar
def modulator(clk, audio, audio_stb, settings):
audio_bits = audio.subtype.bits
#AM modulation
am_mag = Unsigned(12).constant(0) + audio + 2048
am_phase = Signe... | [] |
pierredup/sentry | tests/sentry/auth/test_helper.py | 0145e4b3bc0e775bf3482fe65f5e1a689d0dbb80 | from __future__ import absolute_import
from six.moves.urllib.parse import urlencode
from django.test import RequestFactory
from django.contrib.auth.models import AnonymousUser
from sentry.auth.helper import handle_new_user
from sentry.models import AuthProvider, InviteStatus, OrganizationMember
from sentry.testutils ... | [((415, 452), 'sentry.utils.compat.mock.patch', 'mock.patch', (['"""sentry.analytics.record"""'], {}), "('sentry.analytics.record')\n", (425, 452), False, 'from sentry.utils.compat import mock\n'), ((597, 612), 'django.contrib.auth.models.AnonymousUser', 'AnonymousUser', ([], {}), '()\n', (610, 612), False, 'from djang... |
richo/groundstation | groundstation/broadcast_events/__init__.py | 7ed48dd355051ee6b71164fc801e3893c09d11db | from broadcast_ping import BroadcastPing
EVENT_TYPES = {
"PING": BroadcastPing,
}
class UnknownBroadcastEvent(Exception):
pass
def new_broadcast_event(data):
event_type, payload = data.split(" ", 1)
if event_type not in EVENT_TYPES:
raise UnknownBroadcastEvent(event_type)
return EVENT... | [] |
dougzor/mbta_python | mbta_python/__init__.py | f277f48f8bf8048cb5c9c6307e672c37292e57f7 | import datetime
import requests
from mbta_python.models import Stop, Direction, Schedule, Mode, \
TripSchedule, Alert, StopWithMode, Prediction
HOST = "http://realtime.mbta.com/developer/api/v2"
def datetime_to_epoch(dt):
epoch = datetime.datetime.utcfromtimestamp(0)
return int((dt - epoch).total_second... | [((242, 279), 'datetime.datetime.utcfromtimestamp', 'datetime.datetime.utcfromtimestamp', (['(0)'], {}), '(0)\n', (276, 279), False, 'import datetime\n'), ((579, 611), 'requests.get', 'requests.get', (['url'], {'params': 'params'}), '(url, params=params)\n', (591, 611), False, 'import requests\n'), ((1986, 2004), 'mbta... |
piotrwinkler/breast_density_classifier | density_model_torch_custom.py | 4d47dd98bb0a839cea8b9aef242f5af5db84f06f | import argparse
import glob
import os
import numpy as np
import torch
from sklearn.metrics import accuracy_score
import models_torch as models
import utils
EXPERIMENT_DATA_DIR = "/tmp/mgr"
def inference(parameters, verbose=True) -> int:
# resolve device
device = torch.device(
"cuda:{}".format(par... | [((448, 499), 'utils.load_images', 'utils.load_images', (["parameters['image_path']", '"""L-CC"""'], {}), "(parameters['image_path'], 'L-CC')\n", (465, 499), False, 'import utils\n'), ((517, 568), 'utils.load_images', 'utils.load_images', (["parameters['image_path']", '"""R-CC"""'], {}), "(parameters['image_path'], 'R-... |
yifatdzigan/ESMValTool | esmvaltool/diag_scripts/ensclus/ens_anom.py | 83320b0e0b24ddde965599961bb80428e180a731 | """Computation of ensemble anomalies based on a desired value."""
import os
import numpy as np
from scipy import stats
# User-defined packages
from read_netcdf import read_iris, save_n_2d_fields
from sel_season_area import sel_area, sel_season
def ens_anom(filenames, dir_output, name_outputs, varname, numens, seaso... | [((3510, 3534), 'numpy.array', 'np.array', (['varextreme_ens'], {}), '(varextreme_ens)\n', (3518, 3534), True, 'import numpy as np\n'), ((4015, 4092), 'read_netcdf.save_n_2d_fields', 'save_n_2d_fields', (['lat_area', 'lon_area', 'ens_anomalies', 'varsave', 'varunits', 'ofile'], {}), '(lat_area, lon_area, ens_anomalies,... |
Te-k/Pytition | pytition/petition/models.py | 16ebce01b491b72ed387709d9b705f7cb0d5476f | from django.db import models
from django.utils.html import mark_safe, strip_tags
from django.utils.text import slugify
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy
from django.core.exceptions import ValidationError
from django.db.models.signals import post_save, ... | [((22649, 22701), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'settings.AUTH_USER_MODEL'}), '(post_save, sender=settings.AUTH_USER_MODEL)\n', (22657, 22701), False, 'from django.dispatch import receiver\n'), ((22834, 22886), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'sett... |
JohnShullTopDev/generating-traning-data-for-healthcare-machine-learningcare- | bin/socialhistory.py | d0ffb26e1b99204a796df905b50c8caf01417f69 | import csv
from testdata import SOCIALHISTORY_FILE
from testdata import rndDate
from patient import Patient
SMOKINGCODES = {
'428041000124106': 'Current some day smoker',
'266919005' : 'Never smoker',
'449868002' : 'Current every day smoker',
'266927001' : 'Unknown if ever smoked',
'... | [((2604, 2617), 'testdata.rndDate', 'rndDate', (['(2016)'], {}), '(2016)\n', (2611, 2617), False, 'from testdata import rndDate\n')] |
nirobio/puzzles | Python X/Dictionaries in python.py | fda8c84d8eefd93b40594636fb9b7f0fde02b014 | {
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# dictionaries, look-up tables & key-value pairs\n",
"# d = {} OR d = dict()\n",
"# e.g. d = {\"George\": 24, \"Tom\": 32}\n",
"\n",
"d = {}\n",
"\n"
]
},
{
"cell_typ... | [] |
LiamBindle/spack | lib/spack/spack/test/cache_fetch.py | e90d5ad6cfff2ba3de7b537d6511adccd9d5fcf1 | # 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)
import os
import pytest
from llnl.util.filesystem import mkdirp, touch
import spack.config
from spack.fetch_strategy im... | [((394, 454), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""_fetch_method"""', "['curl', 'urllib']"], {}), "('_fetch_method', ['curl', 'urllib'])\n", (417, 454), False, 'import pytest\n'), ((875, 935), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""_fetch_method"""', "['curl', 'urllib']"], {}... |
hanhanwu/Hanhan-Spark-Python | temp_range_sql.py | a04c33100742acffa2ad11d1937ea05c44688427 | __author__ = 'hanhanw'
import sys
from pyspark import SparkConf, SparkContext
from pyspark.sql.context import SQLContext
from pyspark.sql.types import StructType, StructField, StringType, DoubleType
conf = SparkConf().setAppName("temp range sql")
sc = SparkContext(conf=conf)
sqlContext = SQLContext(sc)
assert sc.ver... | [((255, 278), 'pyspark.SparkContext', 'SparkContext', ([], {'conf': 'conf'}), '(conf=conf)\n', (267, 278), False, 'from pyspark import SparkConf, SparkContext\n'), ((292, 306), 'pyspark.sql.context.SQLContext', 'SQLContext', (['sc'], {}), '(sc)\n', (302, 306), False, 'from pyspark.sql.context import SQLContext\n'), ((2... |
Pompino/react-components-23KB | container/pyf/graphqltypes/Event.py | 3201a417c5160e1b77f29fc1eac74ae9dc10d6ad | from typing_extensions import Required
#from sqlalchemy.sql.sqltypes import Boolean
from graphene import ObjectType, String, Field, ID, List, DateTime, Mutation, Boolean, Int
from models.EventsRelated.EventModel import EventModel
from graphqltypes.Utils import extractSession
class EventType(ObjectType):
id = ID(... | [((317, 321), 'graphene.ID', 'ID', ([], {}), '()\n', (319, 321), False, 'from graphene import ObjectType, String, Field, ID, List, DateTime, Mutation, Boolean, Int\n'), ((333, 341), 'graphene.String', 'String', ([], {}), '()\n', (339, 341), False, 'from graphene import ObjectType, String, Field, ID, List, DateTime, Mut... |
kokosing/hue | desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/drawing/shape.py | 2307f5379a35aae9be871e836432e6f45138b3d9 | from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from openpyxl.styles.colors import Color, BLACK, WHITE
from openpyxl.utils.units import (
pixels_to_EMU,
EMU_to_pixels,
short_color,
)
from openpyxl.compat import deprecated
from openpyxl.xml.functions import Element, SubElement, t... | [((4470, 4522), 'openpyxl.compat.deprecated', 'deprecated', (['"""Chart Drawings need a complete rewrite"""'], {}), "('Chart Drawings need a complete rewrite')\n", (4480, 4522), False, 'from openpyxl.compat import deprecated\n'), ((5152, 5170), 'openpyxl.utils.units.short_color', 'short_color', (['color'], {}), '(color... |
elowy01/igsr_analysis | scripts/VCF/FILTER/subset_vcf.py | ffea4885227c2299f886a4f41e70b6e1f6bb43da |
from VcfQC import VcfQC
from ReseqTrackDB import File
from ReseqTrackDB import ReseqTrackDB
import argparse
import os
import logging
import datetime
#get command line arguments
parser = argparse.ArgumentParser(description='Script to subset a VCF by excluding the variants within the regions defined by a BED file')
... | [((190, 328), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Script to subset a VCF by excluding the variants within the regions defined by a BED file"""'}), "(description=\n 'Script to subset a VCF by excluding the variants within the regions defined by a BED file'\n )\n", (213, 3... |
Acidburn0zzz/helloworld | controllers/restart.py | 9d88357658c55dadf9d4c6f923b63e8cb6207f75 | import os
from base import BaseHandler
class RestartHandler(BaseHandler):
def get(self):
if not self.authenticate(superuser=True):
return
os.system('touch ' + self.application.settings["restart_path"])
self.redirect(self.get_argument("next"))
| [((157, 220), 'os.system', 'os.system', (["('touch ' + self.application.settings['restart_path'])"], {}), "('touch ' + self.application.settings['restart_path'])\n", (166, 220), False, 'import os\n')] |
badock/nova-tidb | nova/tests/unit/conductor/tasks/test_migrate.py | 4c4591f2cd887fdc22828e12f0c297c051bbd912 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | [((2530, 2587), 'mock.patch.object', 'mock.patch.object', (['objects.RequestSpec', '"""from_components"""'], {}), "(objects.RequestSpec, 'from_components')\n", (2547, 2587), False, 'import mock\n'), ((2593, 2651), 'mock.patch.object', 'mock.patch.object', (['scheduler_utils', '"""setup_instance_group"""'], {}), "(sched... |
maxmac12/BlackHatPython | CH7_GitCmdAndCtrl/modules/environment.py | 60044c65ffc2f1216cbf92c2ec850a4e2e9ca5bf | import os
def run(**kwargs):
print("[*] In environment module.")
return str(os.environ) | [] |
rywjhzd/Cataloging-and-Visualizing-Cradles-of-Planet-Formation | diskcatalog/core/views.py | 6d59ea9d9a07630721e19c554651bae2775962ac | from django.shortcuts import render
from .models import Disk
import os
def index(request):
context = {}
disk_list = Disk.objects.all()
context['disk_list'] = disk_list
return render(request, 'index.html', context)
#def index(request):
# module_dir = os.path.dirname(__file__)
# file_path = os.p... | [((193, 231), 'django.shortcuts.render', 'render', (['request', '"""index.html"""', 'context'], {}), "(request, 'index.html', context)\n", (199, 231), False, 'from django.shortcuts import render\n')] |
guswynn/materialize | misc/python/materialize/checks/insert_select.py | f433173ed71f511d91311769ec58c2d427dd6c3b | # Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software... | [((628, 926), 'textwrap.dedent', 'dedent', (['"""\n > CREATE TABLE insert_select_destination (f1 STRING);\n\n > CREATE TABLE insert_select_source_table (f1 STRING);\n > INSERT INTO insert_select_source_table SELECT \'T1\' || generate_series FROM generate_series(1,10000);\n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.