content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
import glob
import os
from sqlalchemy import create_engine, exists
from sqlalchemy.orm import sessionmaker
try:
import config
except ImportError:
config = {'db_user': None, 'db_password': None }
from backend.database.objects import DBObjectBase, User, Replay, Model
connection_string = 'postgresql:///saltie'.... | 32.560976 | 106 | 0.669663 | [
"Apache-2.0"
] | SaltieRL/Distributed-Replays | helpers/convert_existing_replays.py | 1,335 | Python |
import numpy as np
import os
from sklearn.neighbors import NearestNeighbors
from pydrake.multibody.rigid_body import RigidBody
from pydrake.all import (
AddFlatTerrainToWorld,
AddModelInstancesFromSdfString,
AddModelInstanceFromUrdfFile,
FindResourceOrThrow,
FloatingBaseType,
... | 31.388889 | 94 | 0.626388 | [
"BSD-3-Clause"
] | gizatt/pose_estimation_segmentation_analysis | src/utils.py | 6,215 | Python |
import os
import sys
import tarfile
from six.moves.urllib.request import urlretrieve
url = 'https://commondatastorage.googleapis.com/books1000/'
last_percent_reported = None
data_root = '.' # Change me to store data elsewhere
def download_progress_hook(count, blockSize, totalSize):
"""A hook to report the progr... | 35.918919 | 99 | 0.674191 | [
"Apache-2.0"
] | fcarsten/ai_playground | udacity_deep_learning/download_data.py | 2,658 | Python |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from habitat.core.registry import registry
from habitat.core.simulator import Simulator
def _try_register_igibson_socia... | 34.742857 | 68 | 0.685855 | [
"MIT"
] | qianLyu/habitat-lab | habitat/sims/igibson_challenge/__init__.py | 1,216 | Python |
import unittest
from datetime import datetime
from unittest.mock import patch
from common.repository import Repository
from contract_api.config import NETWORKS, NETWORK_ID
from contract_api.consumers.service_event_consumer import ServiceCreatedEventConsumer
from contract_api.dao.service_repository import ServiceReposi... | 65.047619 | 413 | 0.569985 | [
"MIT"
] | vinthedark/snet-marketplace-service | contract_api/testcases/unit_testcases/consumers/test_service_event_consumer.py | 6,830 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.shortcuts import render, get_object_or_404
from .forms imp... | 30.514706 | 80 | 0.637108 | [
"MIT"
] | sachiv/django_blog | blog/blog/views.py | 2,075 | Python |
import numpy as np
import hypothesis
import strax.testutils
import straxen
def channel_split_naive(r, channel_ranges):
"""Slower but simpler implementation of straxen.split_channel_ranges"""
results = []
for left, right in channel_ranges:
results.append(r[np.in1d(r['channel'], np.arange(left, rig... | 32.551724 | 76 | 0.700212 | [
"BSD-3-Clause"
] | AlexElykov/straxen | tests/test_channel_split.py | 944 | Python |
import pytest
from django.urls import reverse, resolve
pytestmark = pytest.mark.django_db
def test_index():
assert reverse("sample_search:sample_search") == "/sample_search/"
assert resolve("/sample_search/").view_name == "sample_search:sample_search"
| 26.3 | 80 | 0.764259 | [
"MIT"
] | BFSSI-Bioinformatics-Lab/miseq_portal | miseq_portal/sample_search/tests/test_urls.py | 263 | Python |
import sys
import resource
from recommender import recommender
reload(sys)
sys.setdefaultencoding("UTF8")
import os
import uuid
from flask import *
from flask.ext.socketio import SocketIO, emit
from flask_socketio import join_room, leave_room
import psycopg2
import psycopg2.extras
psycopg2.extensions.register_type(psyc... | 33.679641 | 201 | 0.59712 | [
"MIT"
] | cmpgamer/Sprint2 | .~c9_invoke_iUgkLr.py | 11,249 | Python |
import os
import sys
import tempfile
import pytest
import logging
from pathlib import Path
from dtaidistance import dtw, dtw_ndim, clustering, util_numpy
import dtaidistance.dtw_visualisation as dtwvis
from dtaidistance.exceptions import PyClusteringException
logger = logging.getLogger("be.kuleuven.dtai.distance")
d... | 37.053435 | 108 | 0.525546 | [
"Apache-2.0"
] | Baael/dtaidistance | tests/test_clustering.py | 9,708 | Python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import OrderedDict
import logging
import numpy as np
from ray.rllib.policy.policy import Policy
from ray.rllib.policy.sample_batch import SampleBatch
from ray.rllib.policy.tf_policy import TFP... | 41.558659 | 79 | 0.611843 | [
"Apache-2.0"
] | lisadunlap/ray | rllib/policy/dynamic_tf_policy.py | 14,878 | Python |
from sklearn import linear_model # noqa
from sklearn.linear_model import LogisticRegressionCV # noqa
import logging
module_logger = logging.getLogger(__name__)
| 32.4 | 61 | 0.839506 | [
"MIT"
] | motleystate/moonstone | moonstone/analysis/regression.py | 162 | Python |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator, MultipleLocator, MaxNLocator
from matplotlib.path import Path
from matplotlib.patches import PathPatch
from matplotlib.colors import BoundaryNorm
import matplotlib.image as mpimg
Uinf=1
R=15
PI=np.pi
a... | 23.073171 | 119 | 0.708245 | [
"MIT"
] | ajupatatero/neurasim | util/unit_test/potential_test/cp_potential.py | 946 | Python |
"""
Configuration for docs
"""
# source_link = "https://github.com/[org_name]/jrdsite"
# docs_base_url = "https://[org_name].github.io/jrdsite"
# headline = "App that does everything"
# sub_heading = "Yes, you got that right the first time, everything"
def get_context(context):
context.brand_html = "jrdsite"
| 26.083333 | 68 | 0.722045 | [
"MIT"
] | jrd2017/jrdsite | jrdsite/config/docs.py | 313 | Python |
# MIT License
#
# Copyright (c) 2017 Tom Runia
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pu... | 32.745763 | 95 | 0.635611 | [
"MIT"
] | davide-belli/deep-learning-labs | assignment_2/part3/model.py | 1,932 | Python |
'''
xbmcswift2.cli.cli
------------------
The main entry point for the xbmcswift2 console script. CLI commands can be
registered in this module.
:copyright: (c) 2012 by Jonathan Beluch
:license: GPLv3, see LICENSE for more details.
'''
import sys
from optparse import OptionParser
... | 28.675325 | 80 | 0.652627 | [
"Apache-2.0"
] | liberty-developer/plugin.video.metalliq-forqed | resources/lib/xbmcswift2/cli/cli.py | 2,208 | Python |
from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, 'datadog_checks', 'logstash', '__about__.py')) as f:
exec(f.read(), ABOUT)
# Get the long description from ... | 30.194805 | 81 | 0.669247 | [
"BSD-3-Clause"
] | chrroberts-pure/integrations-extras | logstash/setup.py | 2,325 | Python |
import json
import os
import pathlib
from decouple import config
LIVE_DEMO_MODE = config('DEMO_MODE', cast=bool, default=False)
PORT = config('PORT', cast=int, default=5000)
APP_URL = 'https://bachelor-thesis.herokuapp.com/'
DEBUG_MODE = config('DEBUG', cast=bool, default=False)
NO_DELAYS = config('NO_DELAYS', cast=b... | 45.416667 | 100 | 0.798165 | [
"MIT"
] | JosXa/bachelor-thesis-insurance | settings.py | 1,635 | Python |
# Generated by Django 2.1.4 on 2018-12-29 01:40
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('account', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='bankaccount',
old_na... | 24.16 | 100 | 0.594371 | [
"MIT"
] | blarmon/bank-account-microservice | account/migrations/0002_auto_20181228_1940.py | 604 | Python |
import logging
import os
import types
from datetime import datetime
import pandas as pd
from sdgym.data import load_dataset
from sdgym.evaluate import compute_scores
from sdgym.synthesizers import BaseSynthesizer
LOGGER = logging.getLogger(__name__)
BASE_DIR = os.path.dirname(__file__)
LEADERBOARD_PATH = os.path.jo... | 38.964286 | 97 | 0.633364 | [
"MIT"
] | csala/SDGym | sdgym/benchmark.py | 9,819 | Python |
from typing import Any, Dict
import pandas
import numpy as np
from sklearn import datasets
from opticverge.core.chromosome.abstract_chromosome import AbstractChromosome
from opticverge.core.enum.objective import Objective
from opticverge.core.log.logger import data_logger, DATA
from opticverge.core.solver.abstract_so... | 42.3 | 133 | 0.700236 | [
"MIT"
] | opticverge/evolutionary-machine-learning | opticverge/examples/machine_learning/regression/red_wine_quality/problem.py | 2,115 | Python |
"""
# Hello
Demonstrate:
* conversion of regular python script into _Jupyter notebook_
* support **Markdown**
* this is a list
"""
from __future__ import absolute_import, print_function, division
"""
## Hello
This is a *hello world* function.
"""
def hello():
"""
This is a docstring
"""
print("he... | 10.367347 | 64 | 0.582677 | [
"BSD-3-Clause"
] | bwohlberg/py2jn | tests/example.py | 508 | Python |
"""Parser for envpy config parser"""
# Errors
class EnvpyError(Exception):
"""Base class for all envpy errors."""
class MissingConfigError(EnvpyError):
"""Raised when a config item is missing from the environment and has
no default.
"""
class ValueTypeError(EnvpyError):
"""Raised when a Schema i... | 25.633929 | 78 | 0.619993 | [
"MIT"
] | jonathanlloyd/envpy | envpy/parser.py | 2,871 | Python |
from . import generator
from . import discriminator
| 17.333333 | 27 | 0.807692 | [
"MIT"
] | rexwangcc/gengine | GenerativeModels/BGAN/__init__.py | 52 | Python |
# -*- coding: utf-8 -*-
"""Application configuration.
Most configuration is set via environment variables.
For local development, use a .env file to set
environment variables.
"""
from environs import Env
env = Env()
env.read_env()
ENV = env.str("FLASK_ENV", default="production")
DEBUG = ENV == "development"
SQLALC... | 34.24 | 75 | 0.739486 | [
"MIT"
] | centuri-engineering/cataloger | cataloger/settings.py | 1,712 | Python |
# -*- coding: utf-8 -*-
"""Test human2bytes function."""
import pytest
from pcof import bytesconv
@pytest.mark.parametrize(
"size, unit, result",
[
(1, "KB", "1024.00"),
(1, "MB", "1048576.00"),
(1, "GB", "1073741824.00"),
(1, "TB", "1099511627776.00"),
(1, "PB", "1125... | 26.854839 | 79 | 0.572973 | [
"MIT"
] | thobiast/pcof | tests/test_bytesconv_human2bytes.py | 1,665 | Python |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 40.401388 | 128 | 0.598504 | [
"Apache-2.0"
] | AnKingOne/Paddle | python/paddle/fluid/executor.py | 40,765 | Python |
def area(l,c):
a = l*c
return f'A area de um terreno {l}x{c} e de {a}m²'
print("Controle de Terrenos")
print()
largura = float(input("Largura (m): "))
altura = float(input("altura (m): "))
print(area(largura,altura)) | 28 | 53 | 0.633929 | [
"MIT"
] | AbelRapha/Python-Exercicios-CeV | Mundo 3/ex096 Funcao que Calcula Area.py | 225 | Python |
import numpy as np
import pandas as pd
from pandas import DataFrame, MultiIndex, Index, Series, isnull
from pandas.compat import lrange
from pandas.util.testing import assert_frame_equal, assert_series_equal
from .common import MixIn
class TestNth(MixIn):
def test_first_last_nth(self):
# tests for first... | 40.225806 | 79 | 0.498697 | [
"MIT"
] | QiqeMtz/Ethereum_Forecast | lib/python3.6/site-packages/pandas/tests/groupby/test_nth.py | 9,976 | Python |
import tensorflow as tf
class Layers(object):
def __init__(self):
self.name_bank, self.params_trainable = [], []
self.num_params = 0
self.initializer_xavier = tf.initializers.glorot_normal()
def elu(self, inputs): return tf.nn.elu(inputs)
def relu(self, inputs): return tf.nn.relu... | 33.943548 | 87 | 0.578997 | [
"MIT"
] | YeongHyeon/ReXNet-TF2 | source/layers.py | 4,209 | Python |
# python3 imports
from re import compile as compile_regex
from gettext import gettext as _
# project imports
from wintersdeep_postcode.postcode import Postcode
from wintersdeep_postcode.exceptions.validation_fault import ValidationFault
## A wrapper for validation of standard postcodes
# @remarks see \ref wintersdee... | 47.148855 | 117 | 0.727273 | [
"MIT"
] | WintersDeep/wintersdeep_postcode | wintersdeep_postcode/postcode_types/standard_postcode/standard_postcode_validator.py | 12,360 | Python |
# Generated by Django 2.2.8 on 2019-12-20 17:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('m2mbasic', '0002_auto_20191220_1716'),
]
operations = [
migrations.CreateModel(
name='Product',
fields=[
... | 29.272727 | 128 | 0.607143 | [
"MIT"
] | djangojeng-e/TIL | django/models/m2mbasic/migrations/0003_product.py | 644 | Python |
"""
Tests for the :mod:`fiftyone.utils.cvat` module.
You must run these tests interactively as follows::
python tests/intensive/cvat_tests.py
| Copyright 2017-2022, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
from bson import ObjectId
from collections import defaultdict
import numpy as np
import ... | 33.348739 | 83 | 0.572886 | [
"Apache-2.0"
] | bisraelsen/fiftyone | tests/intensive/cvat_tests.py | 31,748 | Python |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 22.085417 | 97 | 0.651637 | [
"Apache-2.0"
] | Arachnid/google_appengine | google/appengine/api/api_base_pb.py | 10,601 | Python |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | 44.359833 | 188 | 0.581305 | [
"Apache-2.0"
] | b-safwat/multi_action_recognition | c3d_model/predict_c3d_ucf101.py | 10,602 | Python |
#!/usr/bin/env python
"""GRR HTTP server implementation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import base64
import hashlib
import hmac
import logging
import os
import string
from cryptography.hazmat.primitives import constant_time
from futu... | 34.764368 | 92 | 0.704827 | [
"Apache-2.0"
] | Codehardt/grr | grr/server/grr_response_server/gui/wsgiapp.py | 12,098 | Python |
# coding: utf8
# try something like
# coding: utf8
# try something like
def index():
rows = db((db.activity.type=='stand')&(db.activity.status=='accepted')).select()
if rows:
return dict(projects=rows)
else:
return plugin_flatpage()
| 23.818182 | 84 | 0.641221 | [
"BSD-3-Clause"
] | bkahlerventer/web2conf | controllers/stands.py | 262 | Python |
"""Deep Q learning graph
The functions in this file can are used to create the following functions:
======= act ========
Function to chose an action given an observation
Parameters
----------
observation: object
Observation that can be feed into the output of make_obs_ph
stochastic: bool... | 46.17234 | 135 | 0.65232 | [
"MIT"
] | rwill128/baselines | baselines/deepq/build_graph.py | 21,701 | Python |
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | 43.244275 | 79 | 0.625243 | [
"BSD-3-Clause"
] | MaritimeResearchInstituteNetherlands/VisTrails | vistrails/db/versions/v0_9_4/domain/vistrail.py | 5,665 | Python |
import os
import torch
import tkdet.utils.comm as comm
from tkdet.checkpoint import DetectionCheckpointer
from tkdet.config import get_cfg
from tkdet.data import MetadataCatalog
from tkdet.engine import DefaultTrainer
from tkdet.engine import default_argument_parser
from tkdet.engine import default_setup
from tkdet.e... | 31.870588 | 93 | 0.695829 | [
"MIT"
] | tkhe/tkdetection | projects/PointRend/train_net.py | 2,709 | Python |
# Copyright (c) 2013, TeamPRO and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from six.moves import range
from six import string_types
import frappe
import json
from frappe.utils import (getdate, cint, add_months, date_diff, add_days,
nowdate, get_datetime_st... | 35.763158 | 142 | 0.64496 | [
"MIT"
] | thispl/tpl-hrpro | hrpro/hrpro/report/continuous_absent_report/continuous_absent_report.py | 2,718 | Python |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
from useradmin.models import HuePermission
try:
perm = HuePermission.objects.get(app='metastore', act... | 64.597701 | 182 | 0.568149 | [
"Apache-2.0"
] | 10088/hue | apps/useradmin/src/useradmin/old_migrations/0003_remove_metastore_readonly_huepermission.py | 5,620 | Python |
"""
.. module: lemur.users.models
:platform: unix
:synopsis: This module contains all of the models need to create a user within
lemur
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
""... | 30.733333 | 121 | 0.66992 | [
"Apache-2.0"
] | Brett-Wood/lemur | lemur/users/models.py | 2,766 | Python |
# SPDX-License-Identifier: MIT
# (c) 2019 The TJHSST Director 4.0 Development Team & Contributors
import asyncio
import json
from typing import Any, Dict
import websockets
from docker.models.services import Service
from ..docker.services import get_director_service_name, get_service_by_name
from ..docker.utils impor... | 30.634921 | 88 | 0.661658 | [
"MIT"
] | Rushilwiz/director4 | orchestrator/orchestrator/consumers/logs.py | 1,930 | Python |
from reqlist import *
import random
from catalog.models import Course
def ceiling_thresh(progress, maximum):
"""Creates a progress object
Ensures that 0 < progress < maximum"""
effective_progress = max(0, progress)
if maximum > 0:
return Progress(min(effective_progress, maximum), maximum)
... | 49.898438 | 208 | 0.663144 | [
"MIT"
] | georgiashay/fireroad-server2 | requirements/progress.py | 25,548 | Python |
"""Constants for the AVM FRITZ!SmartHome integration."""
from __future__ import annotations
import logging
from typing import Final
from homeassistant.components.binary_sensor import DEVICE_CLASS_WINDOW
from homeassistant.components.fritzbox.model import (
FritzBinarySensorEntityDescription,
FritzSensorEntity... | 34.587629 | 88 | 0.732042 | [
"Apache-2.0"
] | WireFuCo/core | homeassistant/components/fritzbox/const.py | 3,355 | Python |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test addressindex generation and fetching
#
import time
from test_framework.test_framework import Sa... | 42.145714 | 144 | 0.650736 | [
"MIT"
] | mirzaei-ce/linux-sagbit | qa/rpc-tests/addressindex.py | 14,751 | Python |
# Copyright (c) 2008-2013 Szczepan Faber, Serhiy Oplakanets, Herr Kaste
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | 36.852632 | 104 | 0.676378 | [
"MIT"
] | mriehl/mockito-without-hardcoded-distribute-version | mockito-0.5.2/mockito_test/verification_errors_test.py | 3,501 | Python |
# version 0.1
# by DrLecter
import sys
from com.l2jfrozen import Config
from com.l2jfrozen.gameserver.model.quest import State
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest
qn = "420_LittleWings"
# variables section
REQUIRED_... | 36.319372 | 149 | 0.557878 | [
"Unlicense"
] | DigitalCoin1/L2SPERO | datapack/data/scripts/quests/420_LittleWings/__init__.py | 20,811 | Python |
space1 = 'X'
space2 = 'X'
space3 = 'X'
space4 = 'X'
space5 = 'X'
space6 = ' '
space7 = 'O'
space8 = ' '
space9 = ' '
print(' | | ')
print(' {} | {} | {} '.format(space1,space2,space3))
print(' | | ')
print('-----------')
print(' | | ')
print(' {} | {} | {} '.format(space4,space5,space6... | 20.821429 | 53 | 0.4494 | [
"MIT"
] | chriswright61/python_shorts | noughts_crosses.py | 583 | Python |
from machine import Pin
import utime
led = Pin(28, Pin.OUT)
onboard_led = Pin(25, Pin.OUT)
led.low()
onboard_led.high()
while True:
led.toggle()
onboard_led.toggle()
print("Toggle")
utime.sleep(0.5)
| 18.25 | 30 | 0.666667 | [
"MIT"
] | luisC62/RPi_Pico_Examples | blink_001.py | 219 | Python |
"""Package exports."""
from .wrapper import Simulation
from .handler import SimulationHandler
from .parser import Parser
from .strategy import Strategy, Sequence, Legacy, Matrix, Sobol
from . import modules
from ._version import __version__, __author__
| 28.222222 | 63 | 0.80315 | [
"MIT"
] | ischoegl/ctwrap | ctwrap/__init__.py | 254 | Python |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
""" Test creating a new user with an email is successful """
def test_create_user_with_email_successful(self):
payload = {'email': 'pudgeinvonyx@gmail.com', 'password': '1111qqqq='}
user... | 36.975 | 81 | 0.663962 | [
"MIT"
] | pudka/recipe-app-api | app/core/tests/test_models.py | 1,479 | Python |
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.misc.textTools import safeEval, readHex
from fontTools.misc.encodingTools import getEncoding
from fontTools.ttLib import getSearchRange
from fontTools.unicode import Unicode
from . import DefaultTable
impor... | 35.289026 | 192 | 0.698888 | [
"MIT"
] | johanoren/IncrementalNumbers | FontTools/fontTools/ttLib/tables/_c_m_a_p.py | 45,664 | Python |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | 35.88961 | 81 | 0.667451 | [
"Apache-2.0",
"MIT"
] | Soum-Soum/Tensorflow_Face_Finder | venv1/Lib/site-packages/tensorflow/python/ops/distributions/exponential.py | 5,527 | Python |
#from numba import jit
import numpy as np
#from joblib import Parallel, delayed, parallel_backend
#from joblib import load, dump
#import tempfile
#import shutil
#import os
#
#import sys
#sys.path.append('pyunicorn_timeseries')
#from pyunicorn_timeseries.surrogates import Surrogates
def set_model_constants(xx=50.E3,nx=... | 46.994434 | 538 | 0.557521 | [
"MIT"
] | AleksiNummelin/coupled_channel | coupled_channel/cutils.py | 25,330 | Python |
import cv2
import os
import numpy as np
import faceReacognition as fr
test_img = cv2.imread('b.jpg')
faces_detected,gray_img = fr.faceDetection(test_img)
print("faces_detected ",faces_detected)
for (x,y,w,h) in faces_detected:
cv2.rectangle(test_img,(x,y),(x+w, y+h),(0,0,255),thickness=1)
resized_img = cv2.resi... | 22.944444 | 66 | 0.755448 | [
"MIT"
] | BathiyaSeneviratne/OpenFace | tester.py | 413 | Python |
"""
Subdivide Cells
~~~~~~~~~~~~~~~
Increase the number of triangles in a single, connected triangular mesh.
The :func:`pyvista.PolyDataFilters.subdivide` filter utilitizes three different
subdivision algorithms to subdivide a mesh's cells: `butterfly`, `loop`,
or `linear`.
"""
from pyvista import examples
import pyv... | 33.741379 | 84 | 0.611139 | [
"MIT"
] | Boorhin/pyvista | examples/01-filter/subdivide.py | 1,957 | Python |
import argparse
import boto3
import json
from uuid import uuid4
import os
S3_BUCKET = os.environ["S3_BUCKET"]
S3_BUCKET_KEY_ID = os.environ["S3_BUCKET_KEY_ID"]
S3_BUCKET_KEY = os.environ["S3_BUCKET_KEY"]
AZ_PROCESSED_FILE = "/mnt/aws-things-azure-processed.json"
if __name__ == '__main__':
client = boto3.client(
... | 33.945455 | 247 | 0.508838 | [
"MIT"
] | drcrook1/AWS_IOT_MIGRATION_TOOL | STREAM_2/createawsupgradejob.py | 1,867 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@package EFIT2D_Classes
Support Library: efit2d-pyopencl
Manuscript Title: Optimized OpenCL implementation of the Elastodynamic Finite Integration Technique for viscoelastic media
Authors: M Molero, U Iturraran-Viveros, S Aparicio, M.G. Hernández
Program title: EF... | 22.671388 | 167 | 0.642197 | [
"MIT"
] | guillaumedavidphd/efit2d-pyopencl | EFIT2D_Classes.py | 16,007 | Python |
import csv
import enum
class Usability(enum.Enum):
UNKNOWN = 0
USER = 1
BOT = 2
BOTH = 4
class MethodInfo:
def __init__(self, name, usability, errors):
self.name = name
self.errors = errors
try:
self.usability = {
'unknown': Usability.UNKNOWN,
... | 29.818182 | 75 | 0.548018 | [
"MIT"
] | Thorbijoern/Telethon | telethon_generator/parsers/methods.py | 1,312 | Python |
from math import pi
import pandas as pd
from bokeh.plotting import figure, output_file, show
from bokeh.sampledata.stocks import MSFT
df = pd.DataFrame(MSFT)[:50]
df["date"] = pd.to_datetime(df["date"])
inc = df.close > df.open
dec = df.open > df.close
w = 12*60*60*1000 # half day in ms
TOOLS = "pan,wheel_zoom,box... | 30.035714 | 94 | 0.72176 | [
"BSD-3-Clause"
] | AdityaJ7/bokeh | examples/plotting/file/candlestick.py | 841 | Python |
from collections import namedtuple
import json
import os
import unittest
import context
import ansi
import comment
class TestComment(unittest.TestCase):
def setUp(self):
self.maxDiff = None
comments_path = os.path.abspath(
os.path.join(
os.path.dirname(__file_... | 33.732558 | 95 | 0.590141 | [
"MIT"
] | slarwise/gercli | tests/test_comment.py | 2,901 | Python |
"""Classes for more complex applications that have tabbed or paged navigation."""
from collections import OrderedDict
from copy import deepcopy
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from implements import implements
from .utils_app import AppBa... | 34.571072 | 120 | 0.572098 | [
"Unlicense"
] | KyleKing/dash_charts | dash_charts/utils_app_with_navigation.py | 13,863 | Python |
from test.test_json import PyTest, CTest
# 2007-10-05
JSONDOCS = [
# http://json.org/JSON_checker/test/fail1.json
'"A JSON payload should be an object or array, not a string."',
# http://json.org/JSON_checker/test/fail2.json
'["Unclosed array"',
# http://json.org/JSON_checker/test/fail3.json
'{... | 40.940092 | 86 | 0.529941 | [
"Apache-2.0"
] | 4nkitd/pyAutomation | Mark_attandance_py_selenium/py/App/Python/Lib/test/test_json/test_fail.py | 8,884 | Python |
import pytest
from sanic import Sanic
from sanic.response import json
from sanic_jwt import Authentication, exceptions, Initialize
class WrongAuthentication(Authentication):
async def build_payload(self, user, *args, **kwargs):
return {"not_user_id": 1}
class AnotherWrongAuthentication(Authentication):... | 29.658537 | 88 | 0.697533 | [
"MIT"
] | amor71/sanic-jwt | tests/test_authentication.py | 6,080 | Python |
import os
import copy
import pytest
import time
import shutil
import tempfile
import logging
from _pytest.logging import caplog as _caplog
from contextlib import suppress
from panoptes.utils.logging import logger
from panoptes.utils.database import PanDB
from panoptes.utils.config.client import get_config
from panopt... | 30.041096 | 98 | 0.689314 | [
"MIT"
] | sarumanplaysguitar/panoptes-utils | conftest.py | 6,582 | Python |
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
APP = ['Patient Discharge System v2.0.py']
DATA_FILES = ['model.docx', 'logo.gif']
OPTIONS = {}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=[... | 16.65 | 48 | 0.66967 | [
"MIT"
] | dr-nandanpatel/patientdischargesystem-App-MacOS | setup.py | 333 | Python |
import os
from subprocess import call
if os.path.isdir("bin/test"):
call(["fusermount", "-u", "bin/test"])
os.rmdir("bin/test")
os.mkdir("bin/test")
call(["bin/simple", "-f", "bin/test"])
| 20.2 | 42 | 0.608911 | [
"MIT"
] | gareth-ferneyhough/SierraFS | examples/postbuild.py | 202 | Python |
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2015, ARM Limited and contributors.
#
# 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
#
# ... | 29.170732 | 75 | 0.732441 | [
"Apache-2.0"
] | ADVAN-ELAA-8QM-PRC1/platform-external-lisa | tests/eas/rfc.py | 1,196 | Python |
# Copyright (c) 2016-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | 35.166667 | 78 | 0.652736 | [
"Apache-2.0"
] | AIHGF/caffe2 | caffe2/python/layers/merge_id_lists.py | 2,321 | Python |
DEPTH_LIMIT = 2
FOLLOW_DOMAINS = {'livejournal.com'}
RSS_TEMPLATES = {
r'.*\.livejournal\.com/?.*': {
'http://%(netloc)s/data/rss': 100,
'https://%(netloc)s/data/rss': 200,
'http://%(netloc)s/data/atom': 300,
'https://%(netloc)s/data/atom': 400,
},
}
| 22.538462 | 44 | 0.532423 | [
"MIT"
] | monotony113/feedly-link-aggregator | presets/livejournal.py | 293 | Python |
"""Test project for line_round_dot_setting.
Command examples:
$ python test_projects/line_round_dot_setting/main.py
"""
import sys
sys.path.append('./')
import os
from types import ModuleType
import apysc as ap
from apysc._file import file_util
this_module: ModuleType = sys.modules[__name__]
_D... | 26.21978 | 65 | 0.644174 | [
"MIT"
] | simon-ritchie/action-py-script | test_projects/line_round_dot_setting/main.py | 2,386 | Python |
"""
This module descibes how to split a dataset into two parts A and B: A is for
tuning the algorithm parameters, and B is for having an unbiased estimation of
its performances. The tuning is done by Grid Search.
"""
from __future__ import (absolute_import, division, print_function,
unicode_lit... | 28.745455 | 78 | 0.748893 | [
"BSD-3-Clause"
] | wyjiang0930/dissertation_reference_3 | examples/split_data_for_unbiased_estimation.py | 1,581 | Python |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# sla.slaprofile application
# ---------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# -----------------------------------------------------... | 30.230769 | 71 | 0.516539 | [
"BSD-3-Clause"
] | ewwwcha/noc | services/web/apps/sla/slaprofile/views.py | 786 | Python |
from flask import Blueprint, request, jsonify
import subprocess
import json
import yamale
import yaml
import app_conf
import logging.handlers
import mydb
imageinfo = Blueprint('imageinfo', __name__)
# set logger
logger = logging.getLogger(__name__)
path = f'./logs/{__name__}.log'
fileHandler = logging.handlers.Rotati... | 23.2 | 108 | 0.585212 | [
"Apache-2.0"
] | cynpna/gedge-platform | gs-engine/gse_api_server/imageinfo.py | 3,016 | Python |
def is_sha1(maybe_sha):
if len(maybe_sha) != 40:
return False
try:
sha_int = int(maybe_sha, 16)
except ValueError:
return False
return True
def validate(date_text):
try:
datetime.datetime.strptime(date_text, '%d-%m-%Y:%S-%M-%H')
return True
except ValueEr... | 39.447293 | 140 | 0.584068 | [
"MIT"
] | craterkamath/microservice | load_balancer/docker_acts/app.py | 13,846 | Python |
"""Generated message classes for cloudasset version v1p2beta1.
The cloud asset API manages the history and inventory of cloud resources.
"""
# NOTE: This file is autogenerated and should not be edited by hand.
from __future__ import absolute_import
from apitools.base.protorpclite import messages as _messages
from ap... | 40.752847 | 89 | 0.721556 | [
"Apache-2.0"
] | google-cloud-sdk-unofficial/google-cloud-sdk | lib/googlecloudsdk/third_party/apis/cloudasset/v1p2beta1/cloudasset_v1p2beta1_messages.py | 35,781 | Python |
# -*- coding: utf-8 -*-
"""Django page CMS test suite module for page links"""
from pages.tests.testcase import TestCase
from pages.models import Content
class LinkTestCase(TestCase):
"""Django page CMS link test suite class"""
def test_01_set_body_pagelink(self):
"""Test the get_body_pagelink_ids an... | 36.147059 | 77 | 0.602929 | [
"BSD-3-Clause"
] | redsolution/django-page-cms | pages/tests/test_pages_link.py | 1,229 | Python |
import nextcord
from nextcord.ext import commands, menus
bot = commands.Bot(command_prefix="$")
class ButtonConfirm(menus.ButtonMenu):
def __init__(self, text):
super().__init__(timeout=15.0, delete_message_after=True)
self.text = text
self.result = None
async def send_initial_messa... | 25.153846 | 65 | 0.66157 | [
"MIT"
] | Brettanda/nextcord-ext-menus | examples/confirm.py | 981 | Python |
from ParseHandler import ParseHandler
from PathHandler import PathHandler
import paths
parser = ParseHandler()
pather = PathHandler()
# match subdirectories in both folders
pather.build_matching_subdir(paths.TOY_RAW, paths.TOY_CLEAN)
# get paths to folders in raw/ directory
dir_names = pather.get_dir_names(paths.TOY... | 33.862069 | 80 | 0.792261 | [
"MIT"
] | richard-duong/GuessTheClass | old/src/integrationClean.py | 982 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class MybankCreditLoanapplyInsturlQueryResponse(AlipayResponse):
def __init__(self):
super(MybankCreditLoanapplyInsturlQueryResponse, self).__init__()
self._target_url = No... | 28.769231 | 114 | 0.727273 | [
"Apache-2.0"
] | Anning01/alipay-sdk-python-all | alipay/aop/api/response/MybankCreditLoanapplyInsturlQueryResponse.py | 748 | Python |
"""
This file defines the database models
"""
from .common import db, Field, auth
from py4web import URL
from pydal.validators import IS_NOT_EMPTY, IS_FILE, IS_EMPTY_OR
import datetime
from . import settings
def get_time():
return datetime.datetime.utcnow()
def get_download_url(picture):
return f"images/{p... | 22.655172 | 87 | 0.672755 | [
"MIT"
] | Kkeller83/py4web_spa_blog | models.py | 1,314 | Python |
import imageio
import tensorflow as tf
import numpy as np
from PIL import Image, ImageDraw, ImageFont
from tf_agents.replay_buffers import tf_uniform_replay_buffer
from tf_agents.drivers import dynamic_step_driver
from tf_agents.environments import tf_py_environment
def load_policy(path):
return tf.compat.v2.s... | 33.488889 | 99 | 0.69144 | [
"MIT"
] | hr0nix/trackdays | trackdays/training/utils.py | 3,014 | Python |
#!/usr/bin/env python
import argparse
import open3d as o3d
import numpy as np
import os
import time
from os.path import join, dirname, basename, splitext, exists, isdir, isfile
from os import listdir
from numpy import linalg as LA
import math
import cv2
from pathlib import Path
def pcd_to_bin(pcd_path, outdir=None):
... | 36.723926 | 119 | 0.607751 | [
"MIT"
] | miroslavradojevic/python-snippets | pointcloud/pcl_conv.py | 5,986 | Python |
import os
import traceback
import datetime
class DuplicatePlotException(Exception): pass
class ModelLogUtils():
'''
Collection of utility methods for logging and plotting of messages & metrics during training.
'''
def __init__(self):
# Add logging to stdout for local debugging
self.... | 32.808219 | 123 | 0.616284 | [
"Apache-2.0"
] | Yirui-Wang/rafiki | rafiki/model/log.py | 2,395 | Python |
# -*- coding: utf-8 -*-
try:
# Python 2.7
from collections import OrderedDict
except:
# Python 2.6
from gluon.contrib.simplejson.ordered_dict import OrderedDict
from gluon import current
from gluon.storage import Storage
def config(settings):
"""
Template for WA-COP + CAD Cloud Integratio... | 38.672566 | 141 | 0.559725 | [
"MIT"
] | anurag-ks/eden | modules/templates/CAD/config.py | 8,740 | Python |
from urllib.parse import quote
import re
def parse_equation(match):
# Converts a latex expression into something the tex API can understand
eq = match.group(0)
# Curly brackets need to be escaped
eq = eq.replace('{', '\{')
eq = eq.replace('}', '\}')
# Create the url using the quote method wh... | 26.179487 | 77 | 0.666014 | [
"Apache-2.0"
] | gigumbrajaguru/SlackTats | venv/lib/python3.7/site-packages/github_markdown.py | 1,021 | Python |
import pandas as pd
from oss_hugo.API_Hugo_OSS import API_Hugo_OSS
class OSS_Schedule:
def __init__(self):
self.hugo = API_Hugo_OSS()
def sessions_mapped_by_size(self):
mapping = []
for path, session in self.hugo.sessions().items():
content = session.get('content')
... | 44.745763 | 136 | 0.580303 | [
"CC0-1.0"
] | Alone2671/oss2020 | notebooks/api/oss_hugo/OSS_Schedule.py | 2,640 | Python |
# --------------
##File path for the file
file_path
def read_file(path):
file = open(file_path , 'r')
sentence = file.readline()
file.close()
return sentence
sample_message = read_file(file_path)
print(sample_message)
#Code starts here
# --------------
#Code starts here
fil... | 19.226744 | 87 | 0.638645 | [
"MIT"
] | umeshpal93/ga-learner-dsb-repo | Spy-Game/code.py | 3,307 | Python |
# signals are for when a user modifies something in the db, example, creates a post
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from django.dispatch import receiver
from .models import Profile
# Creates a profile each time a new user is created
@receiver(post_save, send... | 30.944444 | 83 | 0.771993 | [
"MIT"
] | afern247/BookStore-Web | bookStore/users/signals.py | 557 | Python |
import os
import numpy as np
import torch
import time
import sys
from collections import OrderedDict
from torch.autograd import Variable
from pathlib import Path
import warnings
warnings.filterwarnings('ignore')
mainpath = os.getcwd()
pix2pixhd_dir = Path(mainpath+'/src/pix2pixHD/')
sys.path.append(str(pix2pixhd_dir))... | 39.070313 | 135 | 0.607678 | [
"MIT"
] | michellefli/EverybodyDanceNow_reproduce_pytorch | train_pose2vid.py | 5,001 | Python |
# MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2018
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# r... | 40.632124 | 120 | 0.618082 | [
"MIT"
] | SecantZhang/adversarial-robustness-toolbox | art/defences/detector/poison/ground_truth_evaluator.py | 7,842 | Python |
import logging; log = logging.getLogger(__name__)
from .Menu import Menu
class HitboxMenu(Menu):
"""A menu for examining a hitbox."""
def __init__(self, parent):
super().__init__(parent)
self.title = "Hitboxes"
self.refresh()
def refresh(self):
if self.parent.model is Non... | 29.888889 | 91 | 0.513631 | [
"MIT"
] | RenaKunisaki/StarFoxAdventures | modelviewer/programs/SfaModel/Menu/HitboxMenu.py | 1,614 | Python |
import pandas as pd
import pprint
all_client_diagnoses = pd.read_csv('2021_encounters_with_diagnoses.csv')
print(all_client_diagnoses.columns)
nora_clients = all_client_diagnoses.drop_duplicates('Pid').drop(columns=['Date Of Service', 'Encounter', 'Age', 'Service Code'])
nora_gender = nora_clients[nora_clients.Facil... | 42.75 | 128 | 0.610526 | [
"Apache-2.0"
] | thomps9012/noraML | demographics.py | 855 | Python |
from __future__ import unicode_literals
from .responses import OrganizationsResponse
url_bases = [
"https?://organizations.(.+).amazonaws.com",
]
url_paths = {
'{0}/$': OrganizationsResponse.dispatch,
}
| 19.363636 | 48 | 0.723005 | [
"Apache-2.0"
] | 7minus2/moto | moto/organizations/urls.py | 213 | Python |
# -*- coding: utf-8 -*-
# Copyright 2017 Openstack Foundation.
#
# 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 re... | 31.073529 | 78 | 0.637009 | [
"Apache-2.0"
] | RogerYuQian/shadowfiend | shadowfiend/common/paths.py | 2,113 | Python |
import csv
def save2csv(dst_fh, row):
"""
Appends a list with data to a dst_fh csv
args:
dst_fh: str, output file
row: list, list of values to write in a row
"""
with open(dst_fh, "a", encoding="utf-8") as csvfile:
out = csv.writer(
csvfile,
delimit... | 22.166667 | 56 | 0.511278 | [
"MIT"
] | BookOps-CAT/CBH-migration | src/utils.py | 532 | Python |
import re
from chatterbot.conversation import Statement
from chatbot.const import const
from chatbot.vocabulary import Word
class Detector(object):
def __init__(self):
self.vocabulary = Word()
self.enum_type_key_word = ('类型', '等级', '方式', '分类', '模式', 'type', 'class', '系列')
self.brand_type... | 33.093333 | 87 | 0.560435 | [
"Apache-2.0"
] | zgj0607/ChatBot | chatbot/logic/table/detect_column_type.py | 2,670 | Python |
import unittest
from conans.client.conf import get_default_settings_yml
from conans.client.generators.b2 import B2Generator
from conans.model.build_info import CppInfo
from conans.model.conan_file import ConanFile
from conans.model.env_info import EnvValues
from conans.model.ref import ConanFileReference
from conans.m... | 31.237792 | 145 | 0.642425 | [
"MIT"
] | FalkorX/conan | conans/test/unittests/client/generators/b2_test.py | 14,713 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.