repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
zsolt-beringer/osm-gimmisn | tests/test_webframe.py | b0cbf2e88c1846ef49e33fd32aeb6b4ecabea4c0 | #!/usr/bin/env python3
#
# Copyright (c) 2019 Miklos Vajna and contributors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""The test_webframe module covers the webframe module."""
from typing import List
from typing import TYPE_CHECKING
from typing import Tupl... | [((3893, 3908), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3906, 3908), False, 'import unittest\n'), ((839, 884), 'webframe.handle_static', 'webframe.handle_static', (['"""/osm/static/osm.css"""'], {}), "('/osm/static/osm.css')\n", (861, 884), False, 'import webframe\n'), ((1087, 1137), 'webframe.handle_stati... |
nimatest1234/telegram_spotify_downloader_bot | spotify.py | 7e0a9ba32ee219752582b917867600653337f3d1 | from __future__ import unicode_literals
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
import requests
from youtube_search import YoutubeSearch
import youtube_dl
import eyed3.id3
import eyed3
import lyricsgenius
import telepot
spotifyy = spotipy.Spotify(
client_credentials_manager=SpotifyClient... | [((494, 586), 'lyricsgenius.Genius', 'lyricsgenius.Genius', (['"""biZZReO7F98mji5oz3cE0FiIG73Hh07qoXSIzYSGNN3GBsnY-eUrPAVSdJk_0_de"""'], {}), "(\n 'biZZReO7F98mji5oz3cE0FiIG73Hh07qoXSIzYSGNN3GBsnY-eUrPAVSdJk_0_de')\n", (513, 586), False, 'import lyricsgenius\n'), ((610, 628), 'telepot.Bot', 'telepot.Bot', (['token']... |
Tillsten/atom | tests/test_atomdict.py | 19b6291f7d3c9b3828dcd73e900b8dcbc2ddf92d | #------------------------------------------------------------------------------
# Copyright (c) 2018-2019, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------... | [((1130, 1172), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""member"""', 'MEMBERS'], {}), "('member', MEMBERS)\n", (1153, 1172), False, 'import pytest\n'), ((1305, 1347), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""member"""', 'MEMBERS'], {}), "('member', MEMBERS)\n", (1328, 1347), False,... |
eggveloper/dippy.core | dippy/core/timestamp.py | 8ad613a50bcbf52132de1ece889e22fa4aba3a44 | from datetime import datetime
class Timestamp(float):
def __new__(cls, value=None):
return super().__new__(
cls, datetime.utcnow().timestamp() if value is None else value
)
def to_date(self) -> datetime:
return datetime.utcfromtimestamp(self)
def __repr__(self):
... | [((258, 289), 'datetime.datetime.utcfromtimestamp', 'datetime.utcfromtimestamp', (['self'], {}), '(self)\n', (283, 289), False, 'from datetime import datetime\n'), ((139, 156), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (154, 156), False, 'from datetime import datetime\n')] |
tushortz/biblelover | bible/admin.py | 8ef4980d7f68e4037874373fb0ecde12d2d63d76 | from django.contrib import admin
from bible.models import Bible, VerseOfTheDay
@admin.register(Bible)
class BibleAdmin(admin.ModelAdmin):
list_display = ['__str__', 'text']
readonly_fields = ['book', 'chapter', 'verse', 'text', 'category']
search_fields = ['text', 'book', 'chapter']
list_filter = ['ca... | [((82, 103), 'django.contrib.admin.register', 'admin.register', (['Bible'], {}), '(Bible)\n', (96, 103), False, 'from django.contrib import admin\n'), ((561, 590), 'django.contrib.admin.register', 'admin.register', (['VerseOfTheDay'], {}), '(VerseOfTheDay)\n', (575, 590), False, 'from django.contrib import admin\n')] |
Procrat/typy | typy/nodes.py | 668cedb7f929256a09f565af9ee43c02889bec3f | """
Our own implementation of an abstract syntax tree (AST).
The convert function recursively converts a Python AST (from the module `ast`)
to our own AST (of the class `Node`).
"""
import ast
from logging import debug
from typy.builtin import data_types
from typy.exceptions import NotYetSupported, NoSuchAttribute, ... | [((570, 608), 'typy.exceptions.NotYetSupported', 'NotYetSupported', (['"""check call to"""', 'self'], {}), "('check call to', self)\n", (585, 608), False, 'from typy.exceptions import NotYetSupported, NoSuchAttribute, NotIterable\n'), ((1809, 1849), 'logging.debug', 'debug', (['"""checking func def %s"""', 'self.name']... |
Sam-Gresh/linkage-agent-tools | anonlink-entity-service/backend/entityservice/integrationtests/objectstoretests/test_objectstore.py | f405c7efe3fa82d99bc047f130c0fac6f3f5bf82 | """
Testing:
- uploading over existing files
- using deleted credentials
- using expired credentials
"""
import io
import minio
from minio import Minio
import pytest
from minio.credentials import AssumeRoleProvider, Credentials
from entityservice.object_store import connect_to_object_store, connect_to_upload_obje... | [((853, 878), 'entityservice.object_store.connect_to_object_store', 'connect_to_object_store', ([], {}), '()\n', (876, 878), False, 'from entityservice.object_store import connect_to_object_store, connect_to_upload_object_store\n'), ((920, 952), 'entityservice.object_store.connect_to_upload_object_store', 'connect_to_u... |
JackDan9/soil | soil/build/lib/soil/db/sqlalchemy/api.py | ae612a4634634aace834491fbdefbc69e6167674 | # Copyright 2020 Soil, Inc.
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); yo... | [((1137, 1164), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1154, 1164), True, 'from oslo_log import log as logging\n'), ((1175, 1191), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1189, 1191), False, 'import threading\n')] |
kykrueger/redash | tests/test_models.py | 5fd78fdb2324a7c194e8a99c13deb5a57268866c | import calendar
import datetime
from unittest import TestCase
import pytz
from dateutil.parser import parse as date_parse
from tests import BaseTestCase
from redash import models, redis_connection
from redash.models import db, types
from redash.utils import gen_query_hash, utcnow
class DashboardTest(BaseTestCase):
... | [((22833, 22851), 'redash.models.db.session.flush', 'db.session.flush', ([], {}), '()\n', (22849, 22851), False, 'from redash.models import db, types\n'), ((431, 449), 'redash.models.db.session.flush', 'db.session.flush', ([], {}), '()\n', (447, 449), False, 'from redash.models import db, types\n'), ((558, 576), 'redas... |
EvanthiosPapadopoulos/Python3 | .history/List of Capstone Projects/FibonacciSequence_20200516134123.py | ab773fd458e365c1510f98ecac65965234c881e8 | '''
Fibonacci Sequence
'''
import HeaderOfFiles
def fibonacciSeq(number):
'''
Generate Fibonacci Sequence to the given number.
'''
a = 1
b = 1
for i in range(number):
yield a
a,b = b,a+b
while True:
try:
f = int(input("Enter a number for Fibonacci: "... | [] |
jacobfulano/composer | composer/algorithms/mixup/__init__.py | 4ad81df2d2ca6e5f0b4922bb2db750cd76ba34e8 | # Copyright 2021 MosaicML. All Rights Reserved.
from composer.algorithms.mixup.mixup import MixUp as MixUp
from composer.algorithms.mixup.mixup import MixUpHparams as MixUpHparams
from composer.algorithms.mixup.mixup import mixup_batch as mixup_batch
_name = 'MixUp'
_class_name = 'MixUp'
_functional = 'mixup_batch'
_... | [] |
alanpeixinho/NiftyNet | tests/simple_gan_test.py | 9a17022a71985974f9e5ca992c765d55860fdd7d | from __future__ import absolute_import, print_function
import unittest
import os
import tensorflow as tf
from tensorflow.keras import regularizers
from niftynet.network.simple_gan import SimpleGAN
from tests.niftynet_testcase import NiftyNetTestCase
class SimpleGANTest(NiftyNetTestCase):
def test_3d_reg_shape(s... | [((1488, 1502), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (1500, 1502), True, 'import tensorflow as tf\n'), ((410, 430), 'tensorflow.ones', 'tf.ones', (['input_shape'], {}), '(input_shape)\n', (417, 430), True, 'import tensorflow as tf\n'), ((443, 463), 'tensorflow.ones', 'tf.ones', (['noise_shape'], {}... |
N4S4/thingspeak_wrapper | tests/test.py | f5c26e52c09124b85cc6056782d766d145e65a31 | import time
import thingspeak_wrapper as tsw
# Initiate the class ThingWrapper with (CHANNEL_ID, WRITE_API__KEY, READ_API_KEY)
# if is a public channel just pass the CHANNEL_ID argument, api_key defaults are None
my_channel = tsw.wrapper.ThingWrapper(501309, '6TQDNWJQ44FA0GAQ', '10EVD2N6YIHI5O7Z')
# all set of func... | [((228, 300), 'thingspeak_wrapper.wrapper.ThingWrapper', 'tsw.wrapper.ThingWrapper', (['(501309)', '"""6TQDNWJQ44FA0GAQ"""', '"""10EVD2N6YIHI5O7Z"""'], {}), "(501309, '6TQDNWJQ44FA0GAQ', '10EVD2N6YIHI5O7Z')\n", (252, 300), True, 'import thingspeak_wrapper as tsw\n'), ((820, 834), 'time.sleep', 'time.sleep', (['(15)'], ... |
neptune-ai/neptune-contrib | neptunecontrib/monitoring/skopt.py | fe5c6853128020aaaa59b440cc5203b940dcd39a | #
# Copyright (c) 2019, Neptune Labs Sp. z o.o.
#
# 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 agr... | [((4315, 4337), 'neptunecontrib.monitoring.utils.expect_not_a_run', 'expect_not_a_run', (['_exp'], {}), '(_exp)\n', (4331, 4337), False, 'from neptunecontrib.monitoring.utils import axes2fig, expect_not_a_run\n'), ((4823, 4845), 'warnings.warn', 'warnings.warn', (['message'], {}), '(message)\n', (4836, 4845), False, 'i... |
aiddenkeli/Snoopy | snoopy/server/transforms/Maltego.py | dd76180145981b3574b419edce39dbb060bd8c8c | #!/usr/bin/python
#
# This might be horrible code...
# ...but it works
# Feel free to re-write in a better way
# And if you want to - send it to us, we'll update ;)
# maltego@paterva.com (2010/10/18)
#
import sys
from xml.dom import minidom
class MaltegoEntity(object):
value = "";
weight = 100;
displayInformation ... | [] |
sfdc-qbranch/MetaDeploy | metadeploy/api/migrations/0050_add_clickthrough_agreement.py | d22547b3814dbec6aefa4d86b9f81c6f175c1b67 | # Generated by Django 2.1.5 on 2019-02-12 21:18
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("api", "0049_add_all_other_translations")]
operations = [
migrations.CreateModel(
name="ClickThroughAgreement... | [((830, 939), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.PROTECT', 'to': '"""api.ClickThroughAgreement"""'}), "(null=True, on_delete=django.db.models.deletion.PROTECT,\n to='api.ClickThroughAgreement')\n", (847, 939), False, 'from django.db imp... |
dfdan/invenio-iiif | invenio_iiif/config.py | 2ea2747fd29ab03b1d38e0ca6d2a9c1506aa8cbc | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""IIIF API for Invenio."""
IIIF_API_PREFIX = '/iiif/'
"""URL prefix to IIIF API."""
III... | [] |
mconlon17/vivo-pub-ingest | pub_ingest.py | 7c03ecdd6dc5418121a6b92de1572d1cc63f5cb5 | #!/user/bin/env/python
"""
pub_ingest.py -- Read a bibtex file and make VIVO RDF
The following objects will be made as needed:
-- publisher
-- journal
-- information resource
-- timestamp for the information resource
-- people
-- authorships
-- concepts
The result... | [] |
u-blox/ubxlib | port/platform/common/automation/u_utils.py | 4dc1b16e6f12354b601cb1c9d799c10f4e2afb54 | #!/usr/bin/env python
'''Generally useful bits and bobs.'''
import queue # For PrintThread and exe_run
from time import sleep, time, gmtime, strftime # For lock timeout, exe_run timeout and logging
from multiprocessing import RLock
from copy import copy
import threading # For Print... | [((7666, 7695), 'os.chmod', 'os.chmod', (['path', 'stat.S_IWRITE'], {}), '(path, stat.S_IWRITE)\n', (7674, 7695), False, 'import os\n'), ((7837, 7861), 'os.path.isdir', 'os.path.isdir', (['directory'], {}), '(directory)\n', (7850, 7861), False, 'import os\n'), ((15992, 16016), 'os.path.isdir', 'os.path.isdir', (['direc... |
tcjansen/beer | faigler_mazeh.py | c6421371b6506cef1adf88cefa9a55db2f04e2dc | import numpy as np
import astropy.modeling.blackbody as bb
import astropy.constants as const
from astropy.io import fits
from scipy.interpolate import interp2d
class FaiglerMazehFit():
def __init__(self, P_orb, inc, R_star, M_star, T_star, A_ellip=False, A_beam=False,
R_p=False, a=False, u=False, g=0.65, logg=... | [((8484, 8553), 'numpy.genfromtxt', 'np.genfromtxt', (['file'], {'delimiter': 'delimiter', 'usecols': '(0, 1)', 'unpack': '(True)'}), '(file, delimiter=delimiter, usecols=(0, 1), unpack=True)\n', (8497, 8553), True, 'import numpy as np\n'), ((6992, 7078), 'numpy.genfromtxt', 'np.genfromtxt', (['"""../claret_ldc.dat"""'... |
f2010126/LTH_Master | src/vanilla_pytorch/prune_model.py | 709472e7e7962fbf3a56a620c536fb03d359734f | import torch.nn.utils.prune as prune
import torch
from src.vanilla_pytorch.utils import count_rem_weights
from src.vanilla_pytorch.models.linearnets import LeNet, init_weights
from src.vanilla_pytorch.models.resnets import Resnets
def remove_pruning(model):
for i, (name, module) in enumerate(model.named_modules()... | [((2718, 2740), 'src.vanilla_pytorch.models.resnets.Resnets', 'Resnets', ([], {'in_channels': '(3)'}), '(in_channels=3)\n', (2725, 2740), False, 'from src.vanilla_pytorch.models.resnets import Resnets\n'), ((445, 475), 'torch.nn.utils.prune.remove', 'prune.remove', (['module', '"""weight"""'], {}), "(module, 'weight')\... |
CitrusAqua/mol-infer | Grid-neighbor-search/GNS/read_instance_2layer_2LMM_L.py | 6d5411a2cdc7feda418f9413153b1b66b45a2e96 | """
read_instance_BH-cyclic.py
"""
'''
[seed graph]
V_C : "V_C"
E_C : "E_C"
[core specification]
ell_LB : "\ell_{\rm LB}"
ell_UB : "\ell_{\rm UB}"
cs_LB : "\textsc{cs}_{\rm LB}"
cs_UB : "\textsc{cs}_{\rm UB}"
'''
import sys
def read_pmax_file(filename):
with ope... | [((2045, 2098), 'sys.stderr.write', 'sys.stderr.write', (['"""error: a strange edge is found.\n"""'], {}), "('error: a strange edge is found.\\n')\n", (2061, 2098), False, 'import sys\n'), ((2111, 2122), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (2119, 2122), False, 'import sys\n')] |
ArtBIT/gamma | gamma/system_input.py | 4ec03251fcd46cd7ae7b5123ad101064b0f9bdd1 | from .system import *
from .colours import *
class InputSystem(System):
def init(self):
self.key = 'input'
def setRequirements(self):
self.requiredComponents = ['input']
def updateEntity(self, entity, scene):
# don't allow input during a cutscene
if scene.cutscene is... | [] |
mcognetta/federated | tensorflow_federated/python/research/utils/checkpoint_utils_test.py | fa0c1a00b5d77768bc2f38f503f3ef1a65693945 | # Lint as: python3
# Copyright 2019, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | [((890, 921), 'attr.s', 'attr.s', ([], {'cmp': '(False)', 'frozen': '(False)'}), '(cmp=False, frozen=False)\n', (896, 921), False, 'import attr\n'), ((1255, 1264), 'attr.ib', 'attr.ib', ([], {}), '()\n', (1262, 1264), False, 'import attr\n'), ((1285, 1294), 'attr.ib', 'attr.ib', ([], {}), '()\n', (1292, 1294), False, '... |
alexli0707/pyforum | website/models/user.py | 4f5ea4a0b07e094e24410ae699016590b9c20d59 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import peewee
from flask import current_app,abort
from flask.ext.login import AnonymousUserMixin, UserMixin
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from peewee import Model, IntegerField, CharField,PrimaryKeyField
from website.app import db_wr... | [((521, 538), 'peewee.PrimaryKeyField', 'PrimaryKeyField', ([], {}), '()\n', (536, 538), False, 'from peewee import Model, IntegerField, CharField, PrimaryKeyField\n'), ((551, 572), 'peewee.CharField', 'CharField', ([], {'index': '(True)'}), '(index=True)\n', (560, 572), False, 'from peewee import Model, IntegerField, ... |
robertavram/project5 | FlaskApp/__init__.py | 12a2816b84be994b561f2f693cf34c0fa4f0ca19 | # application
import application | [] |
harikuts/dsr_optimization | sim2net/speed/constant.py | 796e58da578f7841a060233a8981eb69d92b798b | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2012 Michal Kalewski <mkalewski at cs.put.poznan.pl>
#
# This file is a part of the Simple Network Simulator (sim2net) project.
# USE, MODIFICATION, COPYING AND DISTRIBUTION OF THIS SOFTWARE IS SUBJECT TO
# THE TERMS AND CONDITIONS OF THE MIT LICENSE. YOU SHOULD H... | [((1557, 1631), 'sim2net.utility.validation.check_argument_type', 'check_argument_type', (['Constant.__name__', '"""speed"""', 'float', 'speed', 'self.logger'], {}), "(Constant.__name__, 'speed', float, speed, self.logger)\n", (1576, 1631), False, 'from sim2net.utility.validation import check_argument_type\n')] |
haryoa/nexula | nexula/nexula_utility/utility_extract_func.py | cc3b5a9b8dd8294bdc47150a1971cb49c4dde225 | from nexula.nexula_utility.utility_import_var import import_class
class NexusFunctionModuleExtractor():
"""
Used for constructing pipeline data preporcessing and feature representer
"""
def __init__(self, module_class_list, args_dict, **kwargs):
"""
Instantiate class(es) object in pip... | [((1025, 1052), 'logging.getLogger', 'logging.getLogger', (['"""nexula"""'], {}), "('nexula')\n", (1042, 1052), False, 'import logging\n'), ((1700, 1730), 'nexula.nexula_utility.utility_import_var.import_class', 'import_class', (['function', 'module'], {}), '(function, module)\n', (1712, 1730), False, 'from nexula.nexu... |
MJ-Jang/Marbas | marbas/preprocessing.py | 0a144e4f2ae868604ed4d3b7ae892a53fdebf388 | import os
from configparser import ConfigParser
cfg = ConfigParser()
#PATH_CUR = os.getcwd() + '/pynori'
PATH_CUR = os.path.dirname(__file__)
cfg.read(PATH_CUR+'/config.ini')
# PREPROCESSING
ENG_LOWER = cfg.getboolean('PREPROCESSING', 'ENG_LOWER')
class Preprocessing(object):
"""Preprocessing modules before tokeniz... | [((55, 69), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (67, 69), False, 'from configparser import ConfigParser\n'), ((117, 142), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (132, 142), False, 'import os\n')] |
amvasudeva/rapidata | pravash/servicenowplugin/xlr-servicenow-plugin-master/src/main/resources/servicenow/ServiceNowQueryTile.py | 7b6e984d24866f5cf474847cf462ac628427cf48 | #
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
#
import com.xhaus.jyson.JysonCodec... | [] |
Buckinghamshire-Digital-Service/buckinghamshire-council | bc/recruitment/migrations/0022_merge_20200331_1633.py | bbbdb52b515bcdfc79a2bd9198dfa4828405370e | # Generated by Django 2.2.10 on 2020-03-31 15:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("recruitment", "0021_merge_20200331_1503"),
("recruitment", "0013_button_block"),
]
operations = []
| [] |
Pyabecedarian/Algorithms-and-Data-Structures-using-Python | Stage_3/Task11_Graph/depth_first_search.py | 08642357df60d48cb185b5487150204b42764260 | """
The Depth First Search (DFS)
The goal of a dfs is to search as deeply as possible, connecting as many nodes in the graph as possible and
branching where necessary. Think of the BFS that builds a search tree one level at a time, whereas the DFS
creates a search tree by exploring one branch of the tree a... | [] |
rbtcollins/rusty_rail | salt/_modules/freebsd_common.py | 6ab8a95247b42a81add03500a75ce6678ede5d58 | def sysrc(value):
"""Call sysrc.
CLI Example:
.. code-block:: bash
salt '*' freebsd_common.sysrc sshd_enable=YES
salt '*' freebsd_common.sysrc static_routes
"""
return __salt__['cmd.run_all']("sysrc %s" % value)
| [] |
jhunken/auth0-python | auth0/v3/management/blacklists.py | af5d863ffe75a4a7cd729c9d084cad6b37bd632e | from .rest import RestClient
class Blacklists(object):
"""Auth0 blacklists endpoints
Args:
domain (str): Your Auth0 domain, e.g: 'username.auth0.com'
token (str): Management API v2 Token
telemetry (bool, optional): Enable or disable Telemetry
(defaults to True)
"""
... | [] |
qzm/QUANTAXIS | test_backtest/simplebacktest.py | 055fdc16d67670fb4770e7097865336199e55f3e | # coding=utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2018 yutiansut/QUANTAXIS
#
# 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 th... | [((1226, 1248), 'QUANTAXIS.QA_BacktestBroker', 'QA.QA_BacktestBroker', ([], {}), '()\n', (1246, 1248), True, 'import QUANTAXIS as QA\n'), ((1254, 1269), 'QUANTAXIS.QA_Account', 'QA.QA_Account', ([], {}), '()\n', (1267, 1269), True, 'import QUANTAXIS as QA\n'), ((2840, 2854), 'QUANTAXIS.QA_Risk', 'QA.QA_Risk', (['AC'], ... |
jjhelmus/artview | artview/components/field.py | 2af5ccad8d509d11ef6da7c97bee0f7b255b6879 | """
field.py
Class instance used for modifying field via Display window.
"""
# Load the needed packages
from functools import partial
from ..core import Variable, Component, QtGui, QtCore
class FieldButtonWindow(Component):
'''Class to display a Window with Field name radio buttons.'''
Vradar = None #: s... | [((3174, 3209), 'functools.partial', 'partial', (['self.FieldSelectCmd', 'field'], {}), '(self.FieldSelectCmd, field)\n', (3181, 3209), False, 'from functools import partial\n')] |
Careerleaf/django-rest-framework-mongoengine | rest_framework_mongoengine/fields.py | fc28dbf7af760528f6f7247e567328df46458799 | from bson.errors import InvalidId
from django.core.exceptions import ValidationError
from django.utils.encoding import smart_str
from mongoengine import dereference
from mongoengine.base.document import BaseDocument
from mongoengine.document import Document
from rest_framework import serializers
from mongoengine.fields... | [((2884, 2904), 'django.core.exceptions.ValidationError', 'ValidationError', (['msg'], {}), '(msg)\n', (2899, 2904), False, 'from django.core.exceptions import ValidationError\n'), ((1074, 1090), 'django.utils.encoding.smart_str', 'smart_str', (['field'], {}), '(field)\n', (1083, 1090), False, 'from django.utils.encodi... |
bbhunter/fuzz-lightyear | tests/conftest.py | 75c1318d2f747a4fac6b55a46649c944528769ba | import pytest
from fuzz_lightyear.datastore import _ALL_POST_FUZZ_HOOKS_BY_OPERATION
from fuzz_lightyear.datastore import _ALL_POST_FUZZ_HOOKS_BY_TAG
from fuzz_lightyear.datastore import _RERUN_POST_FUZZ_HOOKS_BY_OPERATION
from fuzz_lightyear.datastore import _RERUN_POST_FUZZ_HOOKS_BY_TAG
from fuzz_lightyear.datastore... | [((723, 751), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (737, 751), False, 'import pytest\n'), ((1238, 1266), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (1252, 1266), False, 'import pytest\n'), ((776, 805), 'fuzz_lightyear.supplements.... |
michael-the1/diepvries | src/diepvries/field.py | ddba9c91ee5fb2014dc576ffb74faa40c3d0d04f | """Module for a Data Vault field."""
from typing import Optional
from . import (
FIELD_PREFIX,
FIELD_SUFFIX,
METADATA_FIELDS,
TABLE_PREFIXES,
UNKNOWN,
FieldDataType,
FieldRole,
TableType,
)
class Field:
"""A field in a Data Vault model."""
def __init__(
self,
... | [] |
tuggeluk/mmdetection | mmdet/datasets/deepscoresV2.py | 669a535c944628a3ab43330cae5c77b643e13a4b | """DEEPSCORESV2
Provides access to the DEEPSCORESV2 database with a COCO-like interface. The
only changes made compared to the coco.py file are the class labels.
Author:
Lukas Tuggener <tugg@zhaw.ch>
Yvan Satyawan <y_satyawan@hotmail.com>
Created on:
November 23, 2019
"""
from .coco import *
import os
im... | [((489, 506), 'obb_anns.OBBAnns', 'OBBAnns', (['ann_file'], {}), '(ann_file)\n', (496, 506), False, 'from obb_anns import OBBAnns\n'), ((3279, 3306), 'json.dump', 'json.dump', (['json_results', 'fo'], {}), '(json_results, fo)\n', (3288, 3306), False, 'import json\n')] |
agsmorodin/gomatic | tests/go_cd_configurator_test.py | e6ae871ffc2d027823f6b7a5755e0ac65c724538 | #!/usr/bin/env python
import unittest
from xml.dom.minidom import parseString
import xml.etree.ElementTree as ET
from decimal import Decimal
from gomatic import GoCdConfigurator, FetchArtifactDir, RakeTask, ExecTask, ScriptExecutorTask, FetchArtifactTask, \
FetchArtifactFile, Tab, GitMaterial, PipelineMaterial,... | [] |
adriangrepo/qreservoir | gui/wellplot/settings/style/wellplotstylehandler.py | 20fba1b1fd1a42add223d9e8af2d267665bec493 | import logging
from qrutilities.imageutils import ImageUtils
from PyQt4.QtGui import QColor
logger = logging.getLogger('console')
class WellPlotStyleHandler(object):
'''
classdocs
'''
def saveDataState(self, wellPlotData, wellPlotStyleWidget):
if wellPlotStyleWidget.plotTitleOnCheckBox.isC... | [((101, 129), 'logging.getLogger', 'logging.getLogger', (['"""console"""'], {}), "('console')\n", (118, 129), False, 'import logging\n'), ((615, 646), 'qrutilities.imageutils.ImageUtils.rgbToString', 'ImageUtils.rgbToString', (['r', 'g', 'b'], {}), '(r, g, b)\n', (637, 646), False, 'from qrutilities.imageutils import I... |
geoffreynyaga/ANGA-UTM | utm_messages/urls.py | 8371a51ad27c85d2479bb34d8c4e02ea28465941 | from django.conf.urls import url
from . import views
app_name = "messages"
urlpatterns = [
url(r'^$', views.InboxListView.as_view(), name='inbox'),
url(r'^sent/$', views.SentMessagesListView.as_view(), name='sent'),
url(r'^compose/$', views.MessagesCreateView.as_view(), name='compo... | [] |
iotile/iotile_cloud | server/apps/datablock/tests/test_create_worker.py | 9dc65ac86d3a730bba42108ed7d9bbb963d22ba6 | import datetime
import json
import dateutil.parser
from django.contrib.auth import get_user_model
from django.test import Client, TestCase
from django.utils import timezone
from apps.devicelocation.models import DeviceLocation
from apps.physicaldevice.models import Device
from apps.property.models import GenericProp... | [((937, 953), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (951, 953), False, 'from django.contrib.auth import get_user_model\n'), ((1148, 1248), 'apps.stream.models.StreamVariable.objects.create_variable', 'StreamVariable.objects.create_variable', ([], {'name': '"""Var A"""', 'project': 's... |
maya2250/nova | nova/policies/servers.py | e483ca1cd9a5db5856f87fc69ca07c42d2be5def | # 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... | [((970, 1092), 'oslo_policy.policy.DocumentedRuleDefault', 'policy.DocumentedRuleDefault', (["(SERVERS % 'index')", 'RULE_AOO', '"""List all servers"""', "[{'method': 'GET', 'path': '/servers'}]"], {}), "(SERVERS % 'index', RULE_AOO,\n 'List all servers', [{'method': 'GET', 'path': '/servers'}])\n", (998, 1092), Fal... |
sajaldebnath/vrops-custom-group-creation | set-env.py | e3c821336832445e93706ad29afe216867660123 | # !/usr/bin python
"""
#
# set-env - a small python program to setup the configuration environment for data-push.py
# data-push.py contains the python program to push attribute values to vROps
# Author Sajal Debnath <sdebnath@vmware.com>
#
"""
# Importing the required modules
import json
import base64
i... | [((861, 891), 'base64.b64encode', 'base64.b64encode', (['serverpasswd'], {}), '(serverpasswd)\n', (877, 891), False, 'import base64\n'), ((1474, 1577), 'json.dump', 'json.dump', (['final_data', 'outfile'], {'sort_keys': '(True)', 'indent': '(2)', 'separators': "(',', ':')", 'ensure_ascii': '(False)'}), "(final_data, ou... |
gtadeus/LeetCodeChallenge2009 | week02/day08.py | 81d3fae205fb9071d7a98260df9bbeb1c8c8ffe0 | import unittest
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def sumRootToLeaf(self, root: TreeNode) -> int:
m = self.c(root)
r=0
for n in ... | [((1484, 1499), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1497, 1499), False, 'import unittest\n')] |
tiuD/cross-prom | config.py | 8b987138ec32e0ac64ca6ffe13d0e1cd0d18aef3 | TOKEN = "1876415562:AAEsX_c9k3Fot2IT0BYRqkCCQ5vFEHQDLDQ"
CHAT_ID = [957539786] # e.g. [1234567, 2233445, 3466123...]
| [] |
mik2k2/buchschloss | buchschloss/gui2/__init__.py | 8a9d17de5847ccab48a0de48aa4b60af2a7cc045 | """entry point"""
from . import main
start = main.app.launch
| [] |
francesco-p/FACIL | src/tests/test_stop_at_task.py | e719deebb6d2acb5778b60759294c23ea5e2b454 | from tests import run_main_and_assert
FAST_LOCAL_TEST_ARGS = "--exp-name local_test --datasets mnist" \
" --network LeNet --num-tasks 5 --seed 1 --batch-size 32" \
" --nepochs 2 --num-workers 0 --stop-at-task 3"
def test_finetuning_stop_at_task():
args_line = FAST_LO... | [((380, 410), 'tests.run_main_and_assert', 'run_main_and_assert', (['args_line'], {}), '(args_line)\n', (399, 410), False, 'from tests import run_main_and_assert\n')] |
shreyventure/LeetCode-Solutions | Python/contains-duplicate.py | 74423d65702b78974e390f17c9d6365d17e6eed5 | # Autor: Anuj Sharma (@optider)
# Github Profile: https://github.com/Optider/
# Problem Link: https://leetcode.com/problems/contains-duplicate/
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
count = {}
for n in nums :
if count.get(n) != None :
ret... | [] |
google-ar/chromium | build/android/gyp/dex.py | 2441c86a5fd975f09a6c30cddb57dfb7fc239699 | #!/usr/bin/env python
#
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import logging
import optparse
import os
import sys
import tempfile
import zipfile
from util import build_utils
def _C... | [((675, 705), 'zipfile.ZipFile', 'zipfile.ZipFile', (['dex_path', '"""r"""'], {}), "(dex_path, 'r')\n", (690, 705), False, 'import zipfile\n'), ((754, 810), 'zipfile.ZipFile', 'zipfile.ZipFile', (['tmp_dex_path', '"""w"""', 'zipfile.ZIP_DEFLATED'], {}), "(tmp_dex_path, 'w', zipfile.ZIP_DEFLATED)\n", (769, 810), False, ... |
Edwardhgj/meiduo | apps/views.py | 38796f5caf54676eb5620f50ade5474ee8700ad8 | from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth.hashers import check_password, make_password
from django.views import View
from utils.response_code import RET, error_map
from rest_framework.views import APIView
from rest_framework.response import Response
from apps.ser... | [((436, 471), 'django.shortcuts.render', 'render', (['request', '"""admin/login.html"""'], {}), "(request, 'admin/login.html')\n", (442, 471), False, 'from django.shortcuts import render\n'), ((1591, 1611), 'django.contrib.auth.hashers.make_password', 'make_password', (['"""123"""'], {}), "('123')\n", (1604, 1611), Fal... |
realtwister/LearnedEvolution | learnedevolution/targets/covariance/amalgam_covariance.py | 2ec49b50a49acae9693cfb05ac114dfbcc4aa337 | import numpy as np;
from .covariance_target import CovarianceTarget;
class AMaLGaMCovariance(CovarianceTarget):
_API=2.
def __init__(self,
theta_SDR = 1.,
eta_DEC = 0.9,
alpha_Sigma = [-1.1,1.2,1.6],
NIS_MAX = 25,
tau = 0.35,
epsilon = 1e-30,
condition_n... | [((1389, 1418), 'numpy.linalg.svd', 'np.linalg.svd', (['new_covariance'], {}), '(new_covariance)\n', (1402, 1418), True, 'import numpy as np\n'), ((1437, 1446), 'numpy.max', 'np.max', (['s'], {}), '(s)\n', (1443, 1446), True, 'import numpy as np\n'), ((1464, 1532), 'numpy.clip', 'np.clip', (['s_max', '(self.epsilon * s... |
terrorizer1980/fs-admin | binding.gyp | e21216161c56def4ca76a3ef4e71844e2ba26074 | {
'target_defaults': {
'win_delay_load_hook': 'false',
'conditions': [
['OS=="win"', {
'msvs_disabled_warnings': [
4530, # C++ exception handler used, but unwind semantics are not enabled
4506, # no definition for inline function
],
}],
],
},
'targets'... | [] |
emoritzx/botw-tracker | src/botwtracker/settings.py | 9c096e62825f2ba2f0f66167b646eaf5a1b5b50a | """Django settings for botwtracker project.
Copyright (c) 2017, Evan Moritz.
botw-tracker is an open source software project released under the MIT License.
See the accompanying LICENSE file for terms.
"""
import os
from .config_local import *
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
... | [((402, 438), 'os.path.join', 'os.path.join', (['BASE_DIR', '""".."""', '"""data"""'], {}), "(BASE_DIR, '..', 'data')\n", (414, 438), False, 'import os\n'), ((2876, 2914), 'os.path.join', 'os.path.join', (['BASE_DIR', '""".."""', '"""static"""'], {}), "(BASE_DIR, '..', 'static')\n", (2888, 2914), False, 'import os\n'),... |
Geo-Gabriel/eccomerce_nestle_mongodb | app/domains/users/views.py | 97bf5dbdc7bee20a9ca2f7cad98afc6e8f11bd3e | from flask import Blueprint, request, jsonify
from app.domains.users.actions import get_all_users, insert_user, get_user_by_id, update_user, delete_user
app_users = Blueprint('app.users', __name__)
@app_users.route('/users', methods=['GET'])
def get_users():
return jsonify([user.serialize() for user in get_all_... | [((167, 199), 'flask.Blueprint', 'Blueprint', (['"""app.users"""', '__name__'], {}), "('app.users', __name__)\n", (176, 199), False, 'from flask import Blueprint, request, jsonify\n'), ((421, 447), 'app.domains.users.actions.get_user_by_id', 'get_user_by_id', ([], {'id_user': 'id'}), '(id_user=id)\n', (435, 447), False... |
PerryXDeng/project_punyslayer | legacy_code/tf_cnn_siamese/model.py | 79529b020ca56a5473dbb85ac7155bc03dc5023a | import legacy_code.tf_cnn_siamese.configurations as conf
import tensorflow as tf
import numpy as np
def construct_cnn(x, conv_weights, conv_biases, fc_weights, fc_biases,
dropout = False):
"""
constructs the convolution graph for one image
:param x: input node
:param conv_weights: convolutio... | [((1327, 1348), 'tensorflow.reshape', 'tf.reshape', (['x', '[n, m]'], {}), '(x, [n, m])\n', (1337, 1348), True, 'import tensorflow as tf\n'), ((2472, 2509), 'tensorflow.squared_difference', 'tf.squared_difference', (['twin_1', 'twin_2'], {}), '(twin_1, twin_2)\n', (2493, 2509), True, 'import tensorflow as tf\n'), ((325... |
FingerCrunch/scrapy | tests/test_utils_log.py | 3225de725720bba246ba8c9845fe4b84bc0c82e7 | import sys
import logging
import unittest
from testfixtures import LogCapture
from twisted.python.failure import Failure
from scrapy.utils.log import (failure_to_exc_info, TopLevelFormatter,
LogCounterHandler, StreamLogger)
from scrapy.utils.test import get_crawler
from scrapy.extensions... | [((802, 814), 'testfixtures.LogCapture', 'LogCapture', ([], {}), '()\n', (812, 814), False, 'from testfixtures import LogCapture\n'), ((930, 955), 'logging.getLogger', 'logging.getLogger', (['"""test"""'], {}), "('test')\n", (947, 955), False, 'import logging\n'), ((1142, 1173), 'logging.getLogger', 'logging.getLogger'... |
jeff012345/clue-part-duo | astar.py | bd9ccd2ccdbc2fe358a696b31644b93e70ff874b | import heapq
from typing import List
from definitions import RoomPosition, Position
import random
import sys
class PriorityQueue:
def __init__(self):
self.elements: Array = []
def empty(self) -> bool:
return len(self.elements) == 0
def put(self, item, priority: float):
hea... | [((441, 469), 'heapq.heappop', 'heapq.heappop', (['self.elements'], {}), '(self.elements)\n', (454, 469), False, 'import heapq\n'), ((358, 393), 'random.randint', 'random.randint', (['(1)', '(9999999999999999)'], {}), '(1, 9999999999999999)\n', (372, 393), False, 'import random\n')] |
pb-jchin/FALCON_unzip | src/py_scripts/fc_phasing.py | 21b1df3491e3bb7b9d8ecd13fc0c9c1a45b6393f | from pypeflow.common import *
from pypeflow.data import PypeLocalFile, makePypeLocalFile, fn
from pypeflow.task import PypeTask, PypeThreadTaskBase, PypeTaskBase
from pypeflow.controller import PypeWorkflow, PypeThreadWorkflow
from falcon_kit.FastaReader import FastaReader
import subprocess, shlex
import os, re
cigar... | [((392, 409), 'pypeflow.data.fn', 'fn', (['self.bam_file'], {}), '(self.bam_file)\n', (394, 409), False, 'from pypeflow.data import PypeLocalFile, makePypeLocalFile, fn\n'), ((547, 565), 'pypeflow.data.fn', 'fn', (['self.vmap_file'], {}), '(self.vmap_file)\n', (549, 565), False, 'from pypeflow.data import PypeLocalFile... |
pabloduque0/cnn_deconv_viz | augmentation/combineds/wgan_gp_straight.py | 3fc3d8a9dbad8e8e28d4df4023bdb438e4c9cf85 | from keras.datasets import mnist
from keras.layers.merge import _Merge
from keras.layers import Input, Dense, Reshape, Flatten, Dropout
from keras.layers import BatchNormalization, Activation, ZeroPadding2D
from keras.layers.advanced_activations import LeakyReLU
from keras.layers.convolutional import UpSampling2D, Conv... | [((830, 861), 'keras.backend.random_uniform', 'K.random_uniform', (['(32, 1, 1, 1)'], {}), '((32, 1, 1, 1))\n', (846, 861), True, 'import keras.backend as K\n'), ((1183, 1200), 'keras.optimizers.RMSprop', 'RMSprop', ([], {'lr': '(5e-05)'}), '(lr=5e-05)\n', (1190, 1200), False, 'from keras.optimizers import RMSprop\n'),... |
BernardoB95/Extrator_SPEDFiscal | Core/Block_C/RC480_Factory.py | 10b4697833c561d24654251da5f22d044f03fc16 | from Core.IFactory import IFactory
from Regs.Block_C import RC480
class RC480Factory(IFactory):
def create_block_object(self, line):
self.rc480 = _rc480 = RC480()
_rc480.reg_list = line
return _rc480
| [((170, 177), 'Regs.Block_C.RC480', 'RC480', ([], {}), '()\n', (175, 177), False, 'from Regs.Block_C import RC480\n')] |
mgoldchild/keras-onnx | keras2onnx/proto/__init__.py | 8e700572b89a907ca21a3096556f64b62b7aa76c | ###############################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
###############################################################################
imp... | [((709, 739), 'onnx.defs.onnx_opset_version', 'onnx.defs.onnx_opset_version', ([], {}), '()\n', (737, 739), False, 'import onnx\n'), ((820, 856), 'pkg_resources.parse_version', 'pkg_resources.parse_version', (['"""1.0.1"""'], {}), "('1.0.1')\n", (847, 856), False, 'import pkg_resources\n'), ((1089, 1120), 'os.environ.g... |
ocefpaf/xroms | tests/test_load.py | 763d6e678e28fe074e0aaab26fecd2b74e51a8b0 | '''Test package.'''
import xroms
from glob import glob
import os
def test_open_netcdf():
'''Test xroms.open_netcdf().'''
base = os.path.join(xroms.__path__[0],'..','tests','input')
files = glob('%s/ocean_his_000?.nc' % base)
ds = xroms.open_netcdf(files)
assert ds
def test_open_zar... | [((144, 199), 'os.path.join', 'os.path.join', (['xroms.__path__[0]', '""".."""', '"""tests"""', '"""input"""'], {}), "(xroms.__path__[0], '..', 'tests', 'input')\n", (156, 199), False, 'import os\n'), ((209, 244), 'glob.glob', 'glob', (["('%s/ocean_his_000?.nc' % base)"], {}), "('%s/ocean_his_000?.nc' % base)\n", (213,... |
alvnary18/django-nvd3 | demoproject/demoproject/urls.py | 4b7dffb1107b8202698212b99c26d1d0097afd1d | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^piechart/', views.demo_piechart, name='demo_piechart'),
url(r'^linechart/', views.demo_linechart, name='demo_linechart'),
url(r'^linechart_without_date/', views.demo_linechart_without_date,... | [((75, 109), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.home'], {'name': '"""home"""'}), "('^$', views.home, name='home')\n", (78, 109), False, 'from django.conf.urls import url\n'), ((116, 176), 'django.conf.urls.url', 'url', (['"""^piechart/"""', 'views.demo_piechart'], {'name': '"""demo_piechart"""'}), "('^... |
Harri-Renney/Mind_Control_Synth | wired_version/mcs_wired.py | 5a892a81a3f37444ef154f29a62d44fa1476bfbd | import time
import mido
from pinaps.piNapsController import PiNapsController
from NeuroParser import NeuroParser
"""
Equation of motion used to modify virbato.
"""
def positionStep(pos, vel, acc):
return pos + vel * 2 + (1/2) * acc * 4
def velocityStep(vel, acc):
return acc * 2 + vel
CTRL_LF... | [((1690, 1739), 'mido.open_output', 'mido.open_output', (['"""USB Midi:USB Midi MIDI 1 20:0"""'], {}), "('USB Midi:USB Midi MIDI 1 20:0')\n", (1706, 1739), False, 'import mido\n'), ((1759, 1824), 'mido.Message', 'mido.Message', (['"""control_change"""'], {'control': 'CTRL_LFO_PITCH', 'value': '(100)'}), "('control_chan... |
windblood/kafka_stock | pipeline/visualization/single_tab.py | 8dbe4a1cf5c367b3c210683d4027bbfaf955ed41 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 31 11:47:47 2019
@author: yanyanyu
"""
"""
Tab1-plot1: candlestick
"""
import json
import datetime
import pandas as pd
from math import pi
from random import choice
from pytz import timezone
from bokeh.plotting import figure,show
from bokeh.p... | [((1385, 1464), 'pandas.DataFrame', 'pd.DataFrame', (['institution_list'], {'columns': "['organization', 'position', 'pctHeld']"}), "(institution_list, columns=['organization', 'position', 'pctHeld'])\n", (1397, 1464), True, 'import pandas as pd\n'), ((1720, 1769), 'bokeh.models.Select', 'Select', ([], {'value': 'symbo... |
Wangjw6/project | traffic_predict/model.py | daae9de42fe7bf7ff29c20246e1164b62b7cef4a | # -*- coding:utf-8 -*-
import tensorflow as tf
class CNN:
def __init__(self, save_or_load_path=None, trainable=True, learning_rate = 0.00002,timestep=9,road=189,predstep=1):
self.trainable = trainable
self.learning_rate = learning_rate
self.road = road
self.input_size = timestep *... | [((391, 462), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[None, self.input_size]', 'name': '"""input"""'}), "(tf.float32, shape=[None, self.input_size], name='input')\n", (405, 462), True, 'import tensorflow as tf\n'), ((495, 568), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32']... |
SanLiWuXun/Virtual-Control | VirtualMouse-mediapipe.py | c3b38d4e2df201af851ca70a90de1fdc770158e4 | import cv2
import mediapipe as mp
from time import sleep
import numpy as np
import autopy
import pynput
wCam, hCam = 1280, 720
wScr, hScr = autopy.screen.size()
cap = cv2.VideoCapture(0)
cap.set(3, wCam)
cap.set(4, hCam)
mp_drawing = mp.solutions.drawing_utils
mp_hands = mp.solutions.hands
mouse = pynput.mouse.Cont... | [((141, 161), 'autopy.screen.size', 'autopy.screen.size', ([], {}), '()\n', (159, 161), False, 'import autopy\n'), ((169, 188), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (185, 188), False, 'import cv2\n'), ((303, 328), 'pynput.mouse.Controller', 'pynput.mouse.Controller', ([], {}), '()\n', (326, 3... |
JochenZoellner/tf_neiss-1 | util/tools/split_train_val.py | c91019e5bce6d3c7512237eec5ea997fd95304ac | import glob
import logging
import os
import shutil
import sys
"""script to divide a folder with generated/training data into a train and val folder
- val folder contains 500 Samples if not changed in source code
- DOES NOT work if images structured in subfolders, see below
- if there is no dir in the given... | [((685, 712), 'os.path.join', 'os.path.join', (['foldername', 'x'], {}), '(foldername, x)\n', (697, 712), False, 'import os\n'), ((570, 581), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (579, 581), False, 'import os\n'), ((1079, 1108), 'glob.glob1', 'glob.glob1', (['dir_path', '"""*.jpg"""'], {}), "(dir_path, '*.jpg')\... |
KonstantinKlepikov/Hands-on-Neuroevolution-with-Python | Chapter10/neuroevolution/distributed_helpers.py | cdd35fa21f2a091d176c140427ab1644d9ecd1f2 |
import threading
from queue import Queue
from multiprocessing.pool import ApplyResult
import tabular_logger as tlogger
class AsyncWorker(object):
@property
def concurrent_tasks(self):
raise NotImplementedError()
def run_async(self, task_id, task, callback):
raise NotImplementedError()
... | [((430, 437), 'queue.Queue', 'Queue', ([], {}), '()\n', (435, 437), False, 'from queue import Queue\n'), ((502, 509), 'queue.Queue', 'Queue', ([], {}), '()\n', (507, 509), False, 'from queue import Queue\n'), ((836, 898), 'threading.Thread', 'threading.Thread', ([], {'target': 'WorkerHub._handle_input', 'args': '(self,... |
tompis/casual | make/platform/registry.py | d838716c7052a906af8a19e945a496acdc7899a2 |
import os
registry = {}
class RegisterPlatform(object):
'''
classdocs
'''
def __init__(self, platform):
'''
Constructor
'''
self.platform = platform
def __call__(self, clazz):
registry[self.platform] = clazz
def platform():
# Decide on whi... | [] |
everyvoter/everyvoter | mailer/admin.py | 65d9b8bdf9b5c64057135c279f6e03b6c207e0fa | """Django Admin Panels for App"""
from django.contrib import admin
from mailer import models
@admin.register(models.SendingAddress)
class SendingAddressAdmin(admin.ModelAdmin):
"""Admin View for SendingAddress"""
list_display = ('address', 'organization')
list_filter = ('organization__name',)
actions ... | [((96, 133), 'django.contrib.admin.register', 'admin.register', (['models.SendingAddress'], {}), '(models.SendingAddress)\n', (110, 133), False, 'from django.contrib import admin\n')] |
systemallica/django-belt | tests/settings.py | 3035a8bad26a108d9c78daaccb81ab8a9a9ebd41 | DEBUG = True
USE_TZ = True
SECRET_KEY = "dummy"
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}}
INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"rest_framework",
"django_filters",
"belt",
"tests.app",
]... | [] |
ALIGN-analoglayout/2018-01-ALIGN | Cell_Generation/fabric_CMC_NMOS.py | 931263cec2efc05d58657af9ecca88ae0040c3a5 | import sys
import json
import transformation
class StopPointGrid:
def __init__( self, nm, layer, direction, width, pitch, offset=0):
self.nm = nm
self.layer = layer
self.direction = direction
assert direction in ['v','h']
self.width = width
self.pitch = pitch
... | [((1651, 1694), 'transformation.Rect', 'transformation.Rect', (['None', 'None', 'None', 'None'], {}), '(None, None, None, None)\n', (1670, 1694), False, 'import transformation\n'), ((1744, 1778), 'transformation.Rect', 'transformation.Rect', (["*term['rect']"], {}), "(*term['rect'])\n", (1763, 1778), False, 'import tra... |
tiramtaramta/conduit | docs/testcases/all_in_one.py | ae4ca8e64fe64c2b6702d803d799e380fda84a92 | from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
import os
import time
import csv
from webdriver_manager.chrome import ChromeDriverManager
import math
from basic_function import ... | [((422, 431), 'selenium.webdriver.chrome.options.Options', 'Options', ([], {}), '()\n', (429, 431), False, 'from selenium.webdriver.chrome.options import Options\n'), ((1060, 1073), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (1070, 1073), False, 'import time\n'), ((2047, 2060), 'time.sleep', 'time.sleep', (['(... |
amalshaji/python-playground | config.py | bd3a88a493f36230958613d60a9d70d64f971dba | from pydantic import BaseSettings
class Settings(BaseSettings):
deta_project_key: str
settings = Settings()
| [] |
dainiusjocas/labs | IV_semester/os/configs.py | 25aa0ae2032681dbaf0afd83f3d80bedddea6407 | #!/usr/bin/env python
''' This module provides configuration options for OS project. No more magic numbers! '''
BLOCK_SIZE = 16 # words
WORD_SIZE = 4 # bytes
# length od RS in blocks
RESTRICTED_LENGTH = 1
# length of DS in blocks
DS_LENGTH = 6
# timer value
TIMER_VALUE = 10
# buffer size
BUFFER_SIZE = 16
# num... | [] |
Russ76/robotics-toolbox-python | roboticstoolbox/models/URDF/Puma560.py | 4b3e82a6522757ffde1f83aef8d05b3ad475e9de | #!/usr/bin/env python
import numpy as np
from roboticstoolbox.robot.ERobot import ERobot
from math import pi
class Puma560(ERobot):
"""
Class that imports a Puma 560 URDF model
``Puma560()`` is a class which imports a Unimation Puma560 robot definition
from a URDF file. The model describes its kine... | [((1685, 1724), 'numpy.array', 'np.array', (['[0, pi / 2, -pi / 2, 0, 0, 0]'], {}), '([0, pi / 2, -pi / 2, 0, 0, 0])\n', (1693, 1724), True, 'import numpy as np\n'), ((1743, 1754), 'numpy.zeros', 'np.zeros', (['(6)'], {}), '(6)\n', (1751, 1754), True, 'import numpy as np\n'), ((1954, 1982), 'numpy.array', 'np.array', (... |
hashnfv/hashnfv-functest | functest/tests/unit/odl/test_odl.py | ff34df7ec7be6cd5fcf0f7557b393bd5d6266047 | #!/usr/bin/env python
# Copyright (c) 2016 Orange and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
"""Define t... | [((2053, 2086), 'logging.disable', 'logging.disable', (['logging.CRITICAL'], {}), '(logging.CRITICAL)\n', (2068, 2086), False, 'import logging\n'), ((4340, 4402), 'mock.patch', 'mock.patch', (['"""robot.api.ExecutionResult"""'], {'side_effect': 'DataError'}), "('robot.api.ExecutionResult', side_effect=DataError)\n", (4... |
OptimalRanging/NTPsec | ntpclients/ntptrace.py | 7fa9b38c3e91f96b173ffa02bafa29cf81173cf7 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
ntptrace - trace peers of an NTP server
Usage: ntptrace [-n | --numeric] [-m number | --max-hosts=number]
[-r hostname | --host=hostname] [--help | --more-help]
hostname
See the manual page for details.
"""
# SPDX-License-Identifier: BS... | [((3401, 3499), 'getopt.getopt', 'getopt.getopt', (['sys.argv[1:]', '"""m:nr:?"""', "['help', 'host=', 'max-hosts=', 'more-help', 'numeric']"], {}), "(sys.argv[1:], 'm:nr:?', ['help', 'host=', 'max-hosts=',\n 'more-help', 'numeric'])\n", (3414, 3499), False, 'import getopt\n'), ((4751, 4812), 're.search', 're.search... |
abueide/lbry | lbrynet/wallet/server/block_processor.py | 7f5deaf6c80422a30b3714d4bf12e028756ed9fe | import struct
import msgpack
from lbrynet.wallet.transaction import Transaction, Output
from torba.server.hash import hash_to_hex_str
from torba.server.block_processor import BlockProcessor
from lbrynet.schema.claim import Claim
from lbrynet.wallet.server.model import ClaimInfo
class LBRYBlockProcessor(BlockProce... | [((6877, 6952), 'lbrynet.wallet.server.model.ClaimInfo', 'ClaimInfo', (['name', 'value', 'txid', 'nout', 'output.amount', 'address', 'height', 'cert_id'], {}), '(name, value, txid, nout, output.amount, address, height, cert_id)\n', (6886, 6952), False, 'from lbrynet.wallet.server.model import ClaimInfo\n'), ((4367, 439... |
jihunroh/ProjectEuler-Python | ProjectEuler.Problem.013.py | 2fceaf5c3dd61038004b6128c5d9ee7a76142bca | from ProjectEulerCommons.Base import *
numbers_list = """37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
8926167... | [] |
historeno/enermaps | api/app/endpoints/datasets.py | ad3a97636baa153a56367e374d0fef7f009bf19d | """Endpoint for the manipulation of datasets
"""
import hashlib
from flask import Response
from flask_restx import Namespace, Resource, abort
from app.common import client
from app.common import datasets as datasets_fcts
from app.common import path
api = Namespace("datasets", description="Datasets related endpoints... | [((259, 322), 'flask_restx.Namespace', 'Namespace', (['"""datasets"""'], {'description': '"""Datasets related endpoints"""'}), "('datasets', description='Datasets related endpoints')\n", (268, 322), False, 'from flask_restx import Namespace, Resource, abort\n'), ((471, 496), 'app.common.client.get_dataset_list', 'clien... |
forewing/lc | python/p45.py | 314468a1a3bb7d38eccf1f34b0d1b7da04a34784 | class Solution:
def jump(self, nums: List[int]) -> int:
n = len(nums)
dp = [float('inf')] * n
dp[0] = 0
tail = 1
for i in range(n):
limit = min(n, i + nums[i] + 1)
for j in range(tail, limit):
dp[j] = min(dp[j], dp[i] + 1)
... | [] |
doycode/mlgorithms | mlgorithms/knn/__init__.py | b187efad474acdc9b7c6defe4761f101530bd1a3 | from .knn import KNNClassifier
__all__ = ['KNNClassifier'] | [] |
sotkonstantinidis/testcircle | apps/configuration/fields.py | 448aa2148fbc2c969e60f0b33ce112d4740a8861 | import unicodedata
from django.forms import fields
class XMLCompatCharField(fields.CharField):
"""
Strip 'control characters', as XML 1.0 does not allow them and the API may
return data in XML.
"""
def to_python(self, value):
value = super().to_python(value=value)
return self.rem... | [((514, 538), 'unicodedata.category', 'unicodedata.category', (['ch'], {}), '(ch)\n', (534, 538), False, 'import unicodedata\n')] |
erikdelange/MicroPython-HTTP-Server | ademo.py | 54bda9d55ac65b9a6bbf2189098a788add52b344 | import sys
import time
import uasyncio as asyncio
from ahttpserver import sendfile, Server
app = Server()
@app.route("GET", "/")
async def root(reader, writer, request):
writer.write(b"HTTP/1.1 200 OK\r\n")
writer.write(b"Connection: close\r\n")
writer.write(b"Content-Type: text/html\r\n")
... | [((105, 113), 'ahttpserver.Server', 'Server', ([], {}), '()\n', (111, 113), False, 'from ahttpserver import sendfile, Server\n'), ((1303, 1319), 'time.localtime', 'time.localtime', ([], {}), '()\n', (1317, 1319), False, 'import time\n'), ((2184, 2208), 'uasyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\... |
vipulSharma18/Deep-Self-Supervised-Audio-Video-Cosegmentation-with-Adaptive-Noise-Cancellation | models/audio_net.py | d52695be31a1552d0785f3b6634bde6ef9276a90 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Unet(nn.Module):
def __init__(self, fc_dim=64, num_downs=5, ngf=64, use_dropout=False):
super(Unet, self).__init__()
# construct unet structure
unet_block = UnetBlock(
ngf * 8, ngf * 8, input_n... | [((1046, 1063), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['(1)'], {}), '(1)\n', (1060, 1063), True, 'import torch.nn as nn\n'), ((1983, 2006), 'torch.nn.LeakyReLU', 'nn.LeakyReLU', (['(0.2)', '(True)'], {}), '(0.2, True)\n', (1995, 2006), True, 'import torch.nn as nn\n'), ((2027, 2057), 'torch.nn.BatchNorm2d', 'nn.Ba... |
cnschema/kgtool | tests/test_core.py | 599e23a9e8a856625143b171f9c36eb5b00623f6 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Path hack
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
try:
import unittest2 as unittest
except ImportError:
import unittest
from kgtool.core import * # noqa
class CoreTestCase(unittest.TestCase):
def setUp(self):
pass
def t... | [((98, 119), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {}), "('..')\n", (113, 119), False, 'import os\n'), ((6101, 6116), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6114, 6116), False, 'import unittest\n'), ((687, 708), 'os.path.basename', 'os.path.basename', (['tin'], {}), '(tin)\n', (703, 708), F... |
ricardoavelino/compas_ags | ui/Rhino/AGS/dev/AGS_toolbar_display_cmd.py | 1c9e496bc4b72b11adc80ea97288ddc27e92c08e | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import scriptcontext as sc
import compas_rhino
from compas_ags.rhino import SettingsForm
from compas_ags.rhino import FormObject
from compas_ags.rhino import ForceObject
__commandname__ = "AGS_toolbar_displa... | [((586, 685), 'compas_ags.rhino.SettingsForm.from_scene', 'SettingsForm.from_scene', (['scene'], {'object_types': '[FormObject, ForceObject]', 'global_settings': "['AGS']"}), "(scene, object_types=[FormObject, ForceObject],\n global_settings=['AGS'])\n", (609, 685), False, 'from compas_ags.rhino import SettingsForm\... |
VidoniJorge/c-interprete | lpp/evaluator.py | 4f026d093b26289d3f692cd64d52069fdd1d954c | from typing import (
Any,
cast,
List,
Optional,
Type
)
import lpp.ast as ast
from lpp.builtins import BUILTINS
from lpp.object import(
Boolean,
Builtin,
Environment,
Error,
Function,
Integer,
Null,
Object,
ObjectType,
String,
Return
)
TRUE = Boolean(True... | [((308, 321), 'lpp.object.Boolean', 'Boolean', (['(True)'], {}), '(True)\n', (315, 321), False, 'from lpp.object import Boolean, Builtin, Environment, Error, Function, Integer, Null, Object, ObjectType, String, Return\n'), ((330, 344), 'lpp.object.Boolean', 'Boolean', (['(False)'], {}), '(False)\n', (337, 344), False, ... |
QPC-database/aws-parallelcluster | cli/tests/pcluster/config/test_validators.py | 8c2e9595ca171340df21695c27d85dc00f19d3e4 | # Copyright 2019 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://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accom... | [((1665, 1681), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1679, 1681), False, 'import pytest\n'), ((1757, 2976), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""section_dict, expected_message, expected_warning"""', "[({'scheduler': 'sge', 'initial_queue_size': 1, 'max_queue_size': 2,\n 'main... |
takamatsu-shyo/yolo-microservice | flask_app.py | b8ab03b98c0939ab1849d0da938d0878b0ec441f | from flask import Flask
from flask import request
from flask import Response
from resources import resourcePing, resourceResolution
from message_protocol.resolution_input import parseResolutionInput
import json
app = Flask(__name__)
@app.route('/ping', methods=['GET'])
def ping():
output = resourcePing.main()
... | [((218, 233), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (223, 233), False, 'from flask import Flask\n'), ((297, 316), 'resources.resourcePing.main', 'resourcePing.main', ([], {}), '()\n', (314, 316), False, 'from resources import resourcePing, resourceResolution\n'), ((355, 397), 'flask.Response', 'Re... |
Stinger101/my_uno_ml_service | backend/server/server/wsgi.py | 47d19f6e5e19e73c465b7ddca889324c9bd5862f | """
WSGI config for server project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTIN... | [((284, 350), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""server.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'server.settings')\n", (305, 350), False, 'import os\n'), ((366, 388), 'django.core.wsgi.get_wsgi_application', 'get_wsgi_application', ([], {}), '()\n', (386, 388... |
mchestr/pycbc | pycbc/config.py | c215c1f177fe383ec6e797437fa2d5f4727eb9f3 | import os
from functools import reduce
import boto3
import yaml
from copy import deepcopy
from cryptography.fernet import Fernet
from pycbc import json
from pycbc.utils import AttrDict as d
s3 = boto3.client('s3')
_mapping_tag = yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG
_DEFAULTS = d({
'users': [],
'enc... | [((198, 216), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (210, 216), False, 'import boto3\n'), ((2208, 2247), 'yaml.load', 'yaml.load', (['data'], {'Loader': 'yaml.FullLoader'}), '(data, Loader=yaml.FullLoader)\n', (2217, 2247), False, 'import yaml\n'), ((1086, 1089), 'pycbc.utils.AttrDict', 'd', (... |
vinirossa/password_generator_test | models/toolscontext/errorhandler.py | dd2f43540c6f58ff9217320c21b246c0be3fc55f | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Module Name
Description...
"""
__author__ = "Vinícius Pereira"
__copyright__ = "Copyright 2021, Vinícius Pereira"
__credits__ = ["Vinícius Pereira","etc."]
__date__ = "2021/04/12"
__license__ = "GPL"
__version__ = "1.0.0"
__pythonversion__ = "3.9.1"
__maintaine... | [((755, 782), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (772, 782), False, 'import logging\n'), ((827, 852), 'logging.Formatter', 'logging.Formatter', (['format'], {}), '(format)\n', (844, 852), False, 'import logging\n'), ((873, 902), 'logging.FileHandler', 'logging.FileHandler', ([... |
henchc/Rediscovering-Text-as-Data | 05-Intro-to-SpaCy/scripts/choropleth.py | 3e14fa7a4bd82899ea564d4f7857a5dbdc616a4f | def us_choropleth(t):
import matplotlib.cm
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
from matplotlib.colors import Normalize
import shapefile
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
im... | [((397, 426), 'matplotlib.pyplot.title', 'plt.title', (['"""NER"""'], {'fontsize': '(12)'}), "('NER', fontsize=12)\n", (406, 426), True, 'import matplotlib.pyplot as plt\n'), ((451, 577), 'mpl_toolkits.basemap.Basemap', 'Basemap', ([], {'resolution': '"""l"""', 'llcrnrlon': '(-128.94)', 'llcrnrlat': '(23.52)', 'urcrnrl... |
ntmoore/skycamera | take_day_and_night_pictures.py | c8c67970b0e3a52ce008dbd6b34df20cdda786b7 | import time
import os
#parameters
sunset_hr=8
dawn_hr=7
daytime_period_min=60
nighttime_period_min=1
time.localtime()
print("program starts at ",time.localtime());
while(1):
#Is it day or night?
time.localtime()
hour = time.localtime()[3]
minute = time.localtime()[4]
hour_float = 1.0*hour+minute... | [((103, 119), 'time.localtime', 'time.localtime', ([], {}), '()\n', (117, 119), False, 'import time\n'), ((147, 163), 'time.localtime', 'time.localtime', ([], {}), '()\n', (161, 163), False, 'import time\n'), ((207, 223), 'time.localtime', 'time.localtime', ([], {}), '()\n', (221, 223), False, 'import time\n'), ((235, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.