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 |
|---|---|---|---|---|---|---|---|---|
''' written by Emanuel Ramirez (emanuel2718@gmail.com) '''
class LanguageFlagNotFound(Exception):
pass
class AlgorithmFlagNotFound(Exception):
pass
| 20.625 | 59 | 0.721212 | [
"MIT"
] | emanuel2718/algocli | algocli/errors.py | 165 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update handling."""
from __future__ import print_function, unicode_literals, absolute_import
import re, time, os, threading, zipfile, tarfile
try: # Python 2
# pylint:disable=import-error, no-name-in-module
from urllib import quote, unquote
from urlparse i... | 37.89011 | 80 | 0.649072 | [
"ISC"
] | McArcady/python-lnp | core/update.py | 10,344 | Python |
import lightgbm as lgb
import xgboost as xgb
from sklearn.metrics import mean_squared_error, mean_absolute_error, explained_variance_score, r2_score
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
def compile_model(network):
"""
:param network dict: dictionary with network parameter... | 35.927273 | 103 | 0.613866 | [
"MIT"
] | EvanBagis/gb_rf_evolution | gb_rf_evolution/gb_train.py | 1,976 | Python |
from datetime import datetime
from pydantic.main import BaseModel
from factory import db
from utils.models import OrmBase
from typing import List
class Post(db.Model):
__tablename__ = "post"
id = db.Column(db.Integer, primary_key=True)
text = db.Column(db.UnicodeText)
created = db.Column(db.DateTime... | 19.486486 | 63 | 0.699029 | [
"BSD-3-Clause"
] | ThiNepo/neps-guide-flask-1 | API_course/models/post.py | 721 | Python |
from logging import getLogger
from mpi4py import MPI
logger = getLogger('om.mpi_ctrl')
WORKTAG = 0
DIETAG = 1
class MpiMaster(object):
def __init__(self, run_control, comm, rank, size):
self.run_control = run_control
self.comm = comm
self.rank = rank
self.size = size
log... | 39.53913 | 93 | 0.548933 | [
"Apache-2.0"
] | markmuetz/omnium | omnium/run_control/mpi_control.py | 4,547 | Python |
# needs mayavi2
# run with ipython -wthread
import networkx as nx
import numpy as np
from enthought.mayavi import mlab
# some graphs to try
#H=nx.krackhardt_kite_graph()
#H=nx.Graph();H.add_edge('a','b');H.add_edge('a','c');H.add_edge('a','d')
#H=nx.grid_2d_graph(4,5)
H=nx.cycle_graph(20)
# reorder nodes from 0,len(... | 29.026316 | 73 | 0.625567 | [
"BSD-3-Clause"
] | AllenDowney/networkx | examples/3d_drawing/mayavi2_spring.py | 1,103 | Python |
#!/usr/bin/env python
import getopt
import sys
from coapthon.server.coap import CoAP
from exampleresources import BasicResource, Long, Separate, Storage, Big, voidResource, XMLResource, ETAGResource, \
Child, \
MultipleEncodingResource, AdvancedResource, AdvancedResourceSeparate, DynamicResource
__au... | 32.173913 | 117 | 0.588739 | [
"MIT"
] | Dalanke/CoAPthon | coapserver.py | 2,220 | Python |
"""
Prime Developer Trial
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from fds.sdk.Q... | 43.511029 | 144 | 0.581158 | [
"Apache-2.0"
] | factset/enterprise-sdk | code/python/QuotesAPIforDigitalPortals/v2/fds/sdk/QuotesAPIforDigitalPortals/model/prices_trading_schedule_event_list_data.py | 11,835 | Python |
#!/usr/bin/env python3
"""Define public exports."""
__all__ = ["OutputFileExists", "InvalidDomain", "FileWriteError", "NoDomains"]
class NoDomains(Exception):
"""Raise when no domains are passed to findcdn main."""
def __init__(self, error):
"""Instantiate super class with passed message."""
... | 33.136364 | 82 | 0.657064 | [
"CC0-1.0"
] | Pascal-0x90/findCDN | src/findcdn/findcdn_err.py | 1,458 | Python |
import pandas as pd
from utils.config import Config
import numpy as np
import pandas as pd
def fun_clean_categogy1(array, keyw1, index, BOW):
compty = 0
c = 0
for elm in array:
if elm == "oui" or elm == "parfois":
BOW[c].append(keyw1[index])
compty += 1
c += 1
#... | 33.625 | 120 | 0.596778 | [
"MIT"
] | lkorczowski/cleandata | notebooks/template_preprocessing_columns.py | 4,073 | Python |
import os
import re
import subprocess
import tempfile
def backups(destination, prefix):
name_re = re.compile(r'^{}(?:\.[0-9]+)?$'.format(prefix))
def _key(name):
return [int(char) if char.isdigit() else char
for char in re.split(r'([0-9]+)', name)]
paths = []
for name in sor... | 23.871429 | 80 | 0.60383 | [
"MIT"
] | neuroid/poor-mans-time-machine | poor_mans_time_machine/__init__.py | 1,671 | Python |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | 31.072072 | 79 | 0.658307 | [
"MIT"
] | MBaltz/dival | docs/conf.py | 6,898 | Python |
import time
import scipy.io.wavfile as wavfile
import numpy as np
import speech_recognition as sr
import librosa
import argparse
import os
from glob import glob
from pydub import AudioSegment
from pydub.silence import split_on_silence, detect_nonsilent
from pydub.playback import play
import pysrt
import math
import sh... | 33.352941 | 134 | 0.66362 | [
"Apache-2.0"
] | whilemind/subtitle | src/subtitle.py | 6,237 | Python |
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param: root: The root of the binary search tree.
@param: A: A TreeNode in a Binary.
@param: B: A TreeNode in a Binary.
@return: Return... | 25.310345 | 68 | 0.594005 | [
"MIT"
] | ctc316/algorithm-python | Lintcode/Ladder_11_15_A/88. Lowest Common Ancestor of a Binary Tree.py | 734 | Python |
import numpy as np
from yt.utilities.on_demand_imports import _h5py as h5py
from yt.funcs import \
mylog
from yt.geometry.selection_routines import GridSelector
from yt.utilities.io_handler import \
BaseIOHandler
def _grid_dname(grid_id):
return "/data/grid_%010i" % grid_id
def _field_dname(grid_id, fie... | 38.355556 | 93 | 0.514195 | [
"BSD-3-Clause-Clear"
] | aemerick/yt | yt/frontends/gdf/io.py | 3,452 | Python |
#######################
# Dennis MUD #
# telnet.py #
# Copyright 2018-2021 #
# Michael D. Reiley #
#######################
# **********
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal i... | 37.653543 | 103 | 0.628816 | [
"MIT"
] | seisatsu/Dennis | lib/telnet.py | 4,782 | Python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.INFO)
# Data sets
IRIS_TRAINING = os.path.join(os.path.dirname(__file__), "iris_training.csv")
IRIS_TEST = os.path.joi... | 35.716418 | 82 | 0.633514 | [
"MIT"
] | yamamototakas/fxtrading | agents/tensorflow_iris.py | 2,393 | Python |
# encoding: utf-8
"""
@author: sherlock
@contact: sherlockliao01@gmail.com
"""
import glob
import re
import os.path as osp
from .bases import BaseImageDataset
class Market1501(BaseImageDataset):
"""
Market1501
Reference:
Zheng et al. Scalable Person Re-identification: A Benchmark. ICCV 2015.
U... | 35.44 | 118 | 0.64936 | [
"Apache-2.0"
] | moranxiachong/PersonReID-VAAL | data/datasets/market1501.py | 2,658 | Python |
"""
Django settings for pets_forum project.
Generated by 'django-admin startproject' using Django 1.11.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
impor... | 25.719008 | 91 | 0.696979 | [
"MIT"
] | catnipoo/pets1 | pets_forum/pets_forum/settings.py | 3,112 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 30 03:08:17 2017
@author: aditya
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 26 12:46:25 2017
@author: aditya
"""
import math
import os
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow a... | 37.509146 | 121 | 0.636024 | [
"MIT"
] | AdityaPrasadMishra/TensorflowPractice | FSL - Entire Project + Report/Final Project/Code/Exp1.py | 12,303 | Python |
from os.path import join, dirname, abspath
here = lambda *paths: join(dirname(abspath(__file__)), *paths)
PROJECT_ROOT = here('..')
root = lambda *paths: join(PROJECT_ROOT, *paths)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
EMAIL_BACKEND = 'django.core.mail.bac... | 33.319527 | 127 | 0.694193 | [
"MIT"
] | mberingen/django-outbox | tests/settings.py | 5,631 | Python |
from unittest.mock import MagicMock, patch, call
from tagtrain import data
from . import fake
from tagtrain.tagtrain.tt_remove import Remove
@patch('tagtrain.data.by_owner.remove_user_from_group')
def test_unknown_group(remove_user_from_group):
remove_user_from_group.side_effect = data.Group.DoesNotExist()
... | 38.622642 | 106 | 0.778701 | [
"MIT"
] | c17r/TagTrain | tests/tagtrain/test_remove.py | 2,047 | Python |
# Copyright 2015 Red Hat, 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 agre... | 42.929024 | 79 | 0.630953 | [
"Apache-2.0"
] | mmidolesov2/neutron | neutron/tests/unit/agent/linux/openvswitch_firewall/test_firewall.py | 33,871 | Python |
"""
Test Sermin config module
"""
from sermin.config.module import Registry, Namespace, Setting, settings
from sermin.config.utils import parse_args
from .utils import SafeTestCase
class SettingsTest(SafeTestCase):
def setUp(self):
self.old_settings = settings._namespaces
settings._clear()
d... | 33.676056 | 74 | 0.670849 | [
"BSD-3-Clause"
] | radiac/sermin | tests/test_config.py | 2,391 | Python |
import numpy as np
from rafiki.constants import TaskType
def ensemble_predictions(predictions_list, predict_label_mappings, task):
# TODO: Better ensembling of predictions based on `predict_label_mapping` & `task` of models
if len(predictions_list) == 0 or len(predictions_list[0]) == 0:
return []
... | 33.772727 | 96 | 0.725437 | [
"Apache-2.0"
] | zlheui/rafiki | rafiki/predictor/ensemble.py | 743 | Python |
"""Auto-generated file, do not edit by hand. EC metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_EC = PhoneMetadata(id='EC', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='[19]\\d{2}', possible_number_pattern='\... | 76.384615 | 132 | 0.784491 | [
"Apache-2.0"
] | CygnusNetworks/python-phonenumbers | python/phonenumbers/shortdata/region_EC.py | 993 | Python |
import django_filters
from django_filters import DateFilter
from .models import Pet
class PetFilter(django_filters.FilterSet):
# name = django_filters.CharFilter(lookup_expr='iexact')
start_date = DateFilter(field_name = "age", lookup_expr='gte') #greater or equal to
end_date = DateFilter(field_name = "age... | 38.4 | 87 | 0.640625 | [
"MIT"
] | Me-Adota/website | pets/filters.py | 576 | Python |
import pytest
from app import crud
from app.schemas import EpisodeCreate
from app.schemas.episode import EpisodeSearch
from app.tests.utils import random_segment
def test_get_episode(db):
ep_in = EpisodeCreate(name="ep1", air_date="2022-03-04", segment=random_segment())
ep = crud.episode.create(db, ep_in)
... | 29.129032 | 87 | 0.662237 | [
"MIT"
] | flsworld/comment-rick-n-morty | backend/app/tests/unit/crud/test_episode.py | 1,806 | Python |
# coding:utf-8
import sys
import codecs
from pathlib import Path
from collections import defaultdict
MAIN_PATH = Path(__file__).absolute().parent.parent.parent
sys.path.insert(0, str(MAIN_PATH))
from log import log_info as _info
from log import log_error as _error
from log import print_process as _process
class Vert... | 23.466216 | 60 | 0.644976 | [
"Apache-2.0"
] | KnightZhang625/Stanford_Algorithm | Course_2/Week_01/3_SCC.py | 3,473 | Python |
d = set()
for i in range(int(input())):
I = input().split('-> ')
if len(I) == 1:
d.add(I[1])
continue
a, k = I
for aa in a.split():
if aa not in d:
print(i + 1)
exit()
d.add(k)
print('correct')
| 15.266667 | 29 | 0.475983 | [
"CC0-1.0"
] | terror/CompetitiveProgramming | kattis/proofs.py | 229 | Python |
#!/usr/bin/env python
from multipledispatch import dispatch as Override
import rospy
import threading
from std_msgs.msg import Float64
from araig_msgs.msg import BoolStamped
from base_classes.base_calculator import BaseCalculator
"""Compare data from one topic with one param
pub_list = {"out_bool": "BoolStamped"}... | 29.553571 | 76 | 0.610876 | [
"Apache-2.0"
] | ipa-kut/araig_test_stack | araig_calculators/src/comparators/comp_param.py | 1,655 | Python |
from deadfroglib import *
import Image
import math
# set up the colors
BLACK = 0xff000000
WHITE = 0xffffffff
im = Image.open("willow.bmp")
imOut = Image.new(im.mode, im.size)
graph3d = CreateGraph3d()
minA = 1000
maxA = -1000
minB = 1000
maxB = -1000
minC = 1000
maxC = -1000
err = 0.0
for y in range(im.size[1]):
... | 29.87395 | 100 | 0.52602 | [
"MIT"
] | abainbridge/deadfrog-lib | python/graph3d.py | 3,555 | Python |
# Copyright (c) OpenMMLab. All rights reserved.
log_level = 'INFO'
load_from = None
resume_from = None
dist_params = dict(backend='nccl')
workflow = [('train', 1)]
checkpoint_config = dict(interval=10)
evaluation = dict(interval=10, metric='mAP', key_indicator='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
op... | 28.810345 | 79 | 0.591063 | [
"Apache-2.0"
] | CCODING04/mmaction2 | demo/hrnet_w32_coco_256x192.py | 5,013 | Python |
import codecs
from xml.sax.saxutils import quoteattr, escape
__all__ = ['XMLWriter']
ESCAPE_ENTITIES = {
'\r': ' '
}
class XMLWriter(object):
def __init__(self, stream, namespace_manager, encoding=None,
decl=1, extra_ns=None):
encoding = encoding or 'utf-8'
encoder, deco... | 30.594595 | 74 | 0.535925 | [
"Apache-2.0"
] | 27theworldinurhand/schemaorg | lib/rdflib/plugins/serializers/xmlwriter.py | 3,396 | Python |
from tests.conftest import log_in
def test_logout_auth_user(test_client):
"""
GIVEN a flask app
WHEN an authorized user logs out
THEN check that the user was logged out successfully
"""
log_in(test_client)
response = test_client.get("auth/logout", follow_redirects=True)
assert response... | 34.518519 | 86 | 0.697425 | [
"MIT"
] | KGB33/Wedding-Website | tests/test_auth/test_logout.py | 932 | Python |
def demo():
"""Output:
---------⌝
----------
----?????-
----------
----------
--!!!-----
--!!!-----
----------
----------
⌞---------
"""
n = 10
# Construction is easy:
grid = {}
# Assignment is easy:
grid[(0, 0)] = "⌞"
grid[(n - 1, n - 1)] = "⌝"... | 20.745455 | 77 | 0.45837 | [
"MIT"
] | ssangervasi/examples | examples/grids/python/grid.py | 1,149 | Python |
# coding: utf-8
"""
Apteco API
An API to allow access to Apteco Marketing Suite resources # noqa: E501
The version of the OpenAPI document: v2
Contact: support@apteco.com
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class Selection(object... | 24.885449 | 162 | 0.553496 | [
"Apache-2.0"
] | Apteco/apteco-api | apteco_api/models/selection.py | 8,038 | Python |
"""
mavDynamics
- this file implements the dynamic equations of motion for MAV
- use unit quaternion for the attitude state
part of mavPySim
- Beard & McLain, PUP, 2012
- Update history:
12/20/2018 - RWB
2/24/2020
"""
import sys
sys.path.append('..')
import numpy as np
# load m... | 41.55298 | 197 | 0.563073 | [
"MIT"
] | donnel2-cooper/drone_control | Lectures/MAV_Dynamics/mav_dynamics.py | 12,549 | Python |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in th... | 43.878788 | 110 | 0.618785 | [
"Apache-2.0"
] | DerrickGXD/MXFusion | mxfusion/components/distributions/gp/kernels/static.py | 7,240 | Python |
from typing import Any
import tensorflow as tf
from .tf_util import scope_name as get_scope_name
def absolute_scope_name(relative_scope_name):
"""Appends parent scope name to `relative_scope_name`"""
base = get_scope_name()
if len(base) > 0:
base += '/'
return base + relative_scope_name
def _infer_scope_nam... | 26.190476 | 101 | 0.747879 | [
"MIT"
] | SandBlox/sandblox | sandblox/util/scope.py | 1,650 | Python |
n = input("Enter your name: ")
l = len(n)
print("The name enther is ", n, "and its length is ", l)
| 24.75 | 56 | 0.606061 | [
"Unlicense"
] | GalliWare/UNISA-studies | INF1511/Chapter3/string1.py | 99 | Python |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applica... | 27.816794 | 80 | 0.568332 | [
"MIT"
] | MyPureCloud/platform-client-sdk-python | build/PureCloudPlatformClientV2/models/text_bot_flow_launch_response.py | 3,644 | Python |
# Generated by Django 3.1.2 on 2020-10-29 20:54
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Quote',
fields=[
... | 30.060606 | 114 | 0.561492 | [
"Apache-2.0"
] | alinbal/enterspeedcrawler | crawler/migrations/0001_initial.py | 992 | Python |
from django.db import models
from django.utils.translation import gettext_lazy as _
from oscar.apps.offer.abstract_models import AbstractConditionalOffer, AbstractBenefit
from oscar.core.loading import get_class
class ConditionalOffer(AbstractConditionalOffer):
SITE, FLASH_SALE, VOUCHER, USER, SESSION = "Site", ... | 48.982759 | 112 | 0.693066 | [
"BSD-3-Clause"
] | Bastilla123/shop2 | sandbox/offer/models.py | 2,841 | Python |
"""Metadata State Manager."""
import asyncio
import logging
from typing import Dict, List, Optional, Set, Tuple, Type
from pydantic import ValidationError
from astoria.common.components import StateManager
from astoria.common.disks import DiskInfo, DiskType, DiskUUID
from astoria.common.ipc import (
MetadataMana... | 37.070175 | 89 | 0.591103 | [
"MIT"
] | trickeydan/astoria | astoria/astmetad/metadata_manager.py | 8,452 | Python |
from temboo.Library.Utilities.Authentication.OAuth2.FinalizeOAuth import FinalizeOAuth, FinalizeOAuthInputSet, FinalizeOAuthResultSet, FinalizeOAuthChoreographyExecution
from temboo.Library.Utilities.Authentication.OAuth2.InitializeOAuth import InitializeOAuth, InitializeOAuthInputSet, InitializeOAuthResultSet, Initial... | 128.75 | 179 | 0.912621 | [
"Apache-2.0"
] | lupyuen/RaspberryPiImage | home/pi/GrovePi/Software/Python/others/temboo/Library/Utilities/Authentication/OAuth2/__init__.py | 515 | Python |
#
# This file is part of the PyMeasure package.
#
# Copyright (c) 2013-2021 PyMeasure Developers
#
# 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 limit... | 38.127273 | 79 | 0.745351 | [
"MIT"
] | Bruyant/pymeasure | pymeasure/display/log.py | 2,097 | Python |
from django import forms
from sme_uniforme_apps.proponentes.models import Anexo
class AnexoForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(AnexoForm, self).__init__(*args, **kwargs)
self.fields['tipo_documento'].required = True
class Meta:
model = Anexo
fi... | 22.4 | 56 | 0.675595 | [
"MIT"
] | prefeiturasp/SME-PortalUniforme-BackEnd | sme_uniforme_apps/proponentes/models/forms.py | 336 | Python |
import re
import setuptools
import setuptools.command.develop
import setuptools.command.install
import subprocess
import sys
try:
result = subprocess.run(
[sys.executable, "-m", "pip", "show", "pkg_utils"],
check=True, capture_output=True)
match = re.search(r'\nVersion: (.*?)\n', result.stdout.d... | 30.441176 | 79 | 0.653623 | [
"MIT"
] | biosimulators/Biosimulators_GINsim | setup.py | 2,070 | Python |
"""
Top-level module of Jina.
The primary function of this module is to import all of the public Jina
interfaces into a single place. The interfaces themselves are located in
sub-modules, as described below.
"""
# DO SOME OS-WISE PATCHES
import datetime as _datetime
import os as _os
import platform as _platform
imp... | 32.363636 | 122 | 0.724571 | [
"Apache-2.0"
] | bsherifi/jina | jina/__init__.py | 6,764 | Python |
import unittest
from CsvReader import CsvReader
from Calculator import MyCalculator
class MyTestCase(unittest.TestCase):
def setUp(self) -> None:
self.calculator = MyCalculator()
def test_instantiate_calculator(self):
self.assertIsInstance(self.calculator, MyCalculator)
def test_additio... | 40.586207 | 98 | 0.649108 | [
"MIT"
] | jimishapatel/Calculator | src/CalculatorTest.py | 2,354 | Python |
from niaaml.classifiers.classifier import Classifier
from niaaml.utilities import MinMax
from niaaml.utilities import ParameterDefinition
from sklearn.ensemble import RandomForestClassifier as RF
import numpy as np
import warnings
from sklearn.exceptions import ChangedBehaviorWarning, ConvergenceWarning, DataConversio... | 35.290698 | 203 | 0.691269 | [
"MIT"
] | adi3/NiaAML | niaaml/classifiers/random_forest.py | 3,040 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 51.14094 | 234 | 0.684821 | [
"MIT"
] | 4thel00z/microsoft-crap-that-doesnt-work | sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py | 22,860 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/8/25 22:42
# @Author : Tom.lee
# @Site :
# @File : mysql_lock.py
# @Software: PyCharm
"""
通过MySQL实现分布式锁服务
"""
import MySQLdb
import logging
import time
FORMAT_STR = '%(asctime)s -%(module)s:%(filename)s-L%(lineno)d-%(levelname)s: %(message)s'
lo... | 26.808696 | 91 | 0.543951 | [
"MIT"
] | 2581676612/python | contributed_modules/mysql/mysqldb_/mysql_lock.py | 3,349 | Python |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..arithmetic import AddScalarVolumes
def test_AddScalarVolumes_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True... | 25.695652 | 67 | 0.6489 | [
"Apache-2.0"
] | lighthall-lab/nipype-legacy | nipype/interfaces/slicer/filtering/tests/test_auto_AddScalarVolumes.py | 1,182 | Python |
import dfstools as dt
import sys
if __name__ == "__main__":
print(sys.version)
print(sys.executable)
print("---pecanCookies Demo---")
print("Loading into dataframe from csv...", '\n')
data_list = dt.load_csv_to_df()
print("identifing relationships by column content....", '\n')
relationsh... | 26.352941 | 66 | 0.683036 | [
"Apache-2.0"
] | Jsostmann/comp410_summer2020 | peacn_cookies_sprint_one.py | 448 | Python |
#coding:utf-8
# Chainer version 3.2 (use version 3.x)
#
# This is based on <https://raw.githubusercontent.com/chainer/chainer/v3/examples/mnist/train_mnist.py>
#
# This used mean_absolute_error as loss function.
# Check version
# Python 3.6.4 on win32 (Windows 10)
# Chainer 3.2.0
# numpy 1.14.0
# mat... | 38.562771 | 113 | 0.610126 | [
"MIT"
] | shun60s/chainer-peak-detect | train.py | 9,050 | Python |
"""
Forward Chaining, K-Fold and Group K-Fold algorithms to split a given training dataset into train (X, y) and validation (Xcv, ycv) sets
"""
import numpy as np
def split_train_val_forwardChaining(sequence, numInputs, numOutputs, numJumps):
""" Returns sets to train and cross-validate a model using forward chai... | 37.681818 | 135 | 0.563088 | [
"MIT"
] | DidierRLopes/TimeSeriesCrossValidation | tsxv/splitTrainVal.py | 8,290 | Python |
import _plotly_utils.basevalidators
class LinewidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="linewidth", parent_name="carpet.aaxis", **kwargs):
super(LinewidthValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,... | 34.307692 | 86 | 0.656951 | [
"MIT"
] | labaran1/plotly.py | packages/python/plotly/plotly/validators/carpet/aaxis/_linewidth.py | 446 | Python |
from django.urls import path
from . import views
urlpatterns = [
path('list', views.list_view),
path('add', views.add_view),
] | 19.285714 | 34 | 0.681481 | [
"MIT"
] | StevenYwch/CloudNote | note/urls.py | 135 | Python |
# pass test
import numpy as np
def prepare_input(input_size):
return [np.random.rand(input_size), np.random.rand(input_size)]
def test_function(input_data):
return np.convolve(input_data[0], input_data[1])
| 24 | 67 | 0.75463 | [
"Apache-2.0"
] | Ashymad/praca.inz | tests/python/tests/conv/test.py | 216 | Python |
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | 34.17119 | 80 | 0.625367 | [
"Apache-2.0"
] | GPhilo/models | official/vision/beta/modeling/backbones/spinenet.py | 16,368 | Python |
import logging
import requests
import moment
import utils
import time
import json
class weather(utils.utils):
def message_callback(self,ch, method, properties, body):
logging.info('messgae received weather')
time.sleep(1)
self.__get_weather(body)
ch.basic_ack(delivery_tag=method.de... | 31.342857 | 99 | 0.632634 | [
"MIT"
] | hqs666666/python | Reptile/weather.py | 1,119 | Python |
"""This module implements row model of Amazon.co.jp CSV."""
from dataclasses import dataclass
from datetime import datetime
from typing import ClassVar, Optional
from zaimcsvconverter import CONFIG
from zaimcsvconverter.file_csv_convert import FileCsvConvert
from zaimcsvconverter.inputcsvformats import InputItemRow, ... | 35.410156 | 120 | 0.661335 | [
"MIT"
] | yukihiko-shinoda/zaim-csv-converter | zaimcsvconverter/inputcsvformats/amazon_201911.py | 9,135 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# flake8: noqa
#
# AppDaemon documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 11 14:36:18 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are pre... | 32.043624 | 91 | 0.709708 | [
"Apache-2.0"
] | ReneTode/appdaemon | docs/conf.py | 9,549 | Python |
# -*- coding: utf-8 -*-
import pytest
from pyleecan.Classes.LamSlotMag import LamSlotMag
from pyleecan.Classes.SlotM14 import SlotM14
from numpy import pi, exp, sqrt, angle
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Met... | 39.134409 | 87 | 0.629619 | [
"Apache-2.0"
] | ajpina/pyleecan | Tests/Methods/Slot/test_SlotM14_meth.py | 7,279 | Python |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | 34.121951 | 78 | 0.651894 | [
"Apache-2.0"
] | citrix-openstack-build/heat | heat/tests/test_nokey.py | 2,798 | Python |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from six.moves import range
import numpy as np
import utool
from ibeis.control import SQLDatabaseControl as sqldbc
from ibeis.control._sql_helpers import _results_gen
from os.path import join
print, print_,... | 34.574713 | 101 | 0.655918 | [
"Apache-2.0"
] | SU-ECE-17-7/ibeis | _broken/test_sql_numpy.py | 3,008 | Python |
"""
Tests for Markov Autoregression models
Author: Chad Fulton
License: BSD-3
"""
import warnings
import os
import numpy as np
from numpy.testing import assert_equal, assert_allclose
import pandas as pd
import pytest
from statsmodels.tools import add_constant
from statsmodels.tsa.regime_switching import markov_auto... | 45.644983 | 79 | 0.59401 | [
"BSD-3-Clause"
] | AKSoo/statsmodels | statsmodels/tsa/regime_switching/tests/test_markov_autoregression.py | 41,400 | Python |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from LovaszSoftmax.pytorch.lovasz_losses import lovasz_hinge
class SoftDiceLoss(nn.Module):
def __init__(self):
super(SoftDiceLoss, self).__init__()
def forward(self, input, target):
smooth = 1e-5
i... | 28.705882 | 93 | 0.603996 | [
"MIT"
] | 4uiiurz1/kaggle-tgs-salt-identification-challenge | losses.py | 1,952 | Python |
from inspect import cleandoc
from setuptools import setup
_version = {}
exec(open('yamlschema/_version.py').read(), _version)
setup(
name = 'yamlschema',
packages = ['yamlschema', 'yamlschema.test'],
version = _version['__version__'],
description = 'A schema validator for YAML files',
author = 'Ashley Fi... | 22.846154 | 53 | 0.6633 | [
"MIT"
] | Brightmd/yamlschema | setup.py | 594 | Python |
import tensorflow as tf
# DISCLAIMER:
# Parts of this code file were originally forked from
# https://github.com/tkipf/gcn
# which itself was very inspired by the keras package
def masked_logit_cross_entropy(preds, labels, mask):
"""Logit cross-entropy loss with masking."""
loss = tf.nn.sigmoid_cross_e... | 41.04878 | 99 | 0.7041 | [
"MIT"
] | gelareh1985/GraphSAGE | graphsage/metrics.py | 1,683 | Python |
import requests
import re
import random
import time
from bs4 import BeautifulSoup
import os
import lpmysql
import json
def getindex():
url = 'http://freeget.co'
headers = {'User-Agent': "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 S... | 30.269841 | 165 | 0.635553 | [
"BSD-2-Clause"
] | leifufeng/free91 | freeget.py | 1,983 | Python |
"""Python Interface for Residue-Residue Contact Predictions"""
import os
import sys
from distutils.command.build import build
from distutils.util import convert_path
from setuptools import setup, Extension
from Cython.Distutils import build_ext
import numpy as np
# ==================================================... | 29.298969 | 120 | 0.567734 | [
"BSD-3-Clause"
] | fsimkovic/cptbx | setup.py | 5,684 | Python |
"""
Django settings for mymedicalassistant project.
Generated by 'django-admin startproject' using Django 3.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
fro... | 25.631206 | 91 | 0.696458 | [
"MIT"
] | MyMedicalAssistant/MyMedicalAssistant | mymedicalassistant/settings.py | 3,614 | Python |
from deeplearning import logger, tf_util as U
import tensorflow as tf
from rl.runner import Runner
from rl.vec_env.subproc_vec_env import SubprocVecEnv
from collections import namedtuple
import os, time
class RLExperiment(U.Experiment):
def load_env_fn(self):
fname = os.path.join(self.logdir, 'checkpoints/... | 30.190476 | 125 | 0.614353 | [
"MIT"
] | cbschaff/nlimb | rl/algorithms/core.py | 5,072 | Python |
import datetime
import logging
import time
import dataset
import discord
import privatebinapi
from discord.ext import commands
from discord.ext.commands import Cog, Bot
from discord_slash import cog_ext, SlashContext
from discord_slash.model import SlashCommandPermissionType
from discord_slash.utils.manage_commands im... | 47.488565 | 215 | 0.641012 | [
"Unlicense"
] | y0usef-2E/chiya | cogs/commands/moderation/mutes.py | 22,845 | Python |
# -*- coding: utf-8 -*-
### 기본 라이브러리 불러오기
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
'''
[Step 1] 데이터 준비 - read_csv() 함수로 자동차 연비 데이터셋 가져오기
'''
# CSV 파일을 데이터프레임으로 변환
df = pd.read_csv('./auto-mpg.csv', header=None)
# 열 이름 지정
df.columns = ['mpg','cylinders','displacemen... | 23.361702 | 80 | 0.595628 | [
"MIT"
] | Adrian123K/pandas_ml | 7.1_simple_linear_regression.py | 4,174 | Python |
from datetime import datetime, timedelta as td
import json
import os
import re
from secrets import token_urlsafe
from urllib.parse import urlencode
from cron_descriptor import ExpressionDescriptor
from croniter import croniter
from django.conf import settings
from django.contrib import messages
from django.contrib.aut... | 30.955637 | 97 | 0.638785 | [
"BSD-3-Clause"
] | srvz/healthchecks | hc/front/views.py | 59,311 | Python |
# Copyright 2020 MONAI Consortium
# 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, s... | 40.87931 | 111 | 0.724589 | [
"Apache-2.0"
] | Alxaline/MONAI | monai/metrics/surface_distance.py | 2,371 | Python |
"""
This version considers task's datasets have equal number of labeled samples
"""
import os
import json
from collections import defaultdict
import numpy as np
from tensorboardX import SummaryWriter
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.aut... | 44.396419 | 161 | 0.556829 | [
"MIT"
] | cjshui/AMTNN | MTL.py | 17,359 | Python |
from django.test import TestCase
class PollsViewsTestCase(TestCase):
fixtures = ['polls_views_testdata.json']
def test_index(self):
resp = self.client.get('/polls/')
self.assertEqual(resp.status_code, 200)
self.assertTrue('latest_poll_list' in resp.context)
self.assertEqual([p... | 41.583333 | 101 | 0.662659 | [
"MIT"
] | nokiadev/django-tdd-dojo | tdd/polls/tests/test_fixtures.py | 1,497 | Python |
"""
Support for a local MQTT broker.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/mqtt/#use-the-embedded-broker
"""
import logging
import tempfile
from homeassistant.core import callback
from homeassistant.components.mqtt import PROTOCOL_311
from hom... | 28.78022 | 79 | 0.628102 | [
"MIT"
] | 1Forward1Back/home-assistant | homeassistant/components/mqtt/server.py | 2,619 | Python |
import pyos
state = None
app = None
def buildAppEntry(a):
cont = pyos.GUI.Container((0,0), color=state.getColorPalette().getColor("background"), width=app.ui.width-2, height=40)
ic = a.getIcon()
icon = None
if ic != False:
icon = pyos.GUI.Image((0,0), surface=a.getIcon())
else:
ico... | 39.688312 | 152 | 0.637435 | [
"MIT"
] | furmada/PythonOS | apps/task-manager/__init__.py | 3,056 | Python |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 33.149485 | 80 | 0.679521 | [
"Apache-2.0"
] | agrawalnishant/tensorflow | tensorflow/python/framework/test_util_test.py | 6,431 | Python |
from baselines.deepq import models # noqa F401
from baselines.deepq.deepq_learner import DEEPQ # noqa F401
from baselines.deepq.deepq import learn # noqa F401
from baselines.deepq.replay_buffer import ReplayBuffer, PrioritizedReplayBuffer # noqa F401
def wrap_atari_dqn(env):
from baselines.common.atari_wrapper... | 44.888889 | 92 | 0.814356 | [
"MIT"
] | RDaneelOlivav/baselines | baselines/deepq/__init__.py | 404 | Python |
# Generated by Django 3.1.4 on 2020-12-07 19:08
from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
... | 59.25 | 329 | 0.643987 | [
"MIT"
] | 12345rana/getting-started-with-django | leads/migrations/0001_initial.py | 3,792 | Python |
# Generated from decafJavier.g4 by ANTLR 4.9.2
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
from typing import TextIO
else:
from typing.io import TextIO
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7... | 35.501364 | 385 | 0.575535 | [
"MIT"
] | tej17584/compis_Proyecto1 | Python3/decafJavierParser.py | 78,103 | Python |
import numpy as np
from dct_image_transform.dct import dct2
def reflection(image,axis=0):
'''
8x8のブロックごとに離散コサイン変換された画像(以下DCT画像)を鏡像変換する.
Parameters
----------
image:幅と高さが8の倍数である画像を表す2次元配列. 8の倍数でない場合の動作は未定義.
axis:変換する軸. defalutは`axis=0`
Returns
-------
`image`を鏡像変換したDCT画像を表す2次元... | 40.984375 | 111 | 0.544034 | [
"MIT"
] | kanpurin/dctimagetransform | dct_image_transform/reflection.py | 2,823 | Python |
from __future__ import absolute_import
from django.conf import settings
import ujson
from zproject.backends import password_auth_enabled, dev_auth_enabled, google_auth_enabled, github_auth_enabled
def add_settings(request):
realm = request.user.realm if hasattr(request.user, "realm") else None
return {
... | 48.051282 | 111 | 0.664354 | [
"Apache-2.0"
] | yicongwu/zulip | zerver/context_processors.py | 1,874 | Python |
from ._base import *
DEBUG = True
| 8.75 | 20 | 0.685714 | [
"MIT"
] | AlexanderTN/Django-3-Web-Development-Cookbook-Fourth-Edition | ch01/myproject_docker/src/myproject/myproject/settings/dev.py | 35 | Python |
# div.py
def main():
bread = 10 # 열 개의 빵
people = int(input("몇 명? "))
print("1인당 빵의 수: ", bread / people)
print("맛있게 드세요.")
main()
| 15.8 | 39 | 0.481013 | [
"MIT"
] | chiwoongMOON/202111PythonGrammarStudy | module/chapter14/div.py | 194 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""The setup script."""
import sys
from setuptools import setup, find_p... | 25.069444 | 69 | 0.642659 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | mdboom/glean_parser | setup.py | 1,805 | Python |
import taichi as ti
from mpl_toolkits.mplot3d import Axes3D
import os
import math
import numpy as np
import random
import cv2
import matplotlib.pyplot as plt
import time
import taichi as tc
real = ti.f32
ti.set_default_fp(real)
dim = 3
# this will be overwritten
n_particles = 0
n_solid_particles = 0
n_actuators = 0
n... | 26.364 | 162 | 0.553254 | [
"MIT"
] | AnimatedRNG/taichi | examples/difftaichi/liquid.py | 13,182 | Python |
#!/usr/bin/env python
import sys
last_pkt_num = -1
daystart_pkt_num = -1
daystart_recv_time = -1
daystart_hwrecv_time = -1
dayend_pkt_num = -1
dayend_recv_time = -1
dayend_hwrecv_time = -1
def process_line(line):
global last_pkt_num
global daystart_pkt_num, daystart_recv_time, daystart_hwrecv_time
glob... | 22.910112 | 78 | 0.635606 | [
"BSD-3-Clause"
] | gmporter/TritonVFN | src/scripts/process-loss-rate-output.py | 2,039 | Python |
class Point:
counter = []
def __init__(self, x=0, y=0):
"""Konstruktor punktu."""
self.x = x
self.y = y
def update(self, n):
self.counter.append(n)
p1 = Point(0,0)
p2 = Point(1,1)
p1.counter.append(1)
p2.counter.append(3)
p1.counter[0] = 2
print(p1.counter)
print(p2.count... | 16.217391 | 33 | 0.597855 | [
"MIT"
] | wrutkowski1000/wizualizacja-danych | zadanka/l5zad4.py | 373 | Python |
import discord
from discord.ext import commands
import json
gamertags = 'gamer_tags.json'
class Gamertag(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def newtag(self, ctx):
with open(gamertags, 'r') as in_file:
data = json.load(in_file)
... | 32.75 | 134 | 0.586025 | [
"MIT"
] | GeorgeD88/Insomniac | cogs/gamertag.py | 1,703 | Python |
# -*- coding: utf8 -*-
import json
from activity.womail.womail import WoMail
class DailySign(WoMail):
def __init__(self, mobile, openId):
super(DailySign, self).__init__(mobile, openId)
self.session.headers.update({
# 'Origin': 'https://nyan.mail.wo.cn',
'Referer': 'https:... | 36.273504 | 340 | 0.545476 | [
"MIT"
] | Blessingorz/UnicomDailyTask | activity/womail/dailyTask.py | 4,340 | Python |
'''
References:
- An Outline of Set Theory, Henle
'''
from . import fol
class ElementSymbol(fol.ImproperSymbol):
def __init__(self):
fol.PrimitiveSymbol.__init__('∈')
def symbol_type(self) -> str:
return 'element of'
@staticmethod
def new() -> "ElementSymbol":
return Elemen... | 17.368421 | 41 | 0.636364 | [
"Unlicense"
] | jadnohra/connect | ddq_1/lang/set.py | 332 | Python |
from flask import (Blueprint, Response, request, render_template)
import json
from flask_test import db
from flask_test.schema import FORM_SCHEMA
from flask_test.utils import row_as_json, list_as_json
bp = Blueprint('list', __name__)
@bp.route('/resource/<doc_type>', methods=['GET'])
def get(doc_type):
data = db.... | 28.583333 | 65 | 0.704082 | [
"MIT"
] | barredterra/flask-test | flask_test/views/listview.py | 686 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.