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 re
import types
import logging
from banal import ensure_list
from normality import stringify
from balkhash.utils import safe_fragment
from email.utils import parsedate_to_datetime, getaddresses
from normality import safe_filename, ascii_text
from followthemoney.types import registry
from ingestors.support.html ... | 40.543689 | 79 | 0.622605 | [
"MIT"
] | adikadashrieq/aleph | services/ingest-file/ingestors/support/email.py | 8,352 | Python |
import setuptools
with open("../README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="cog",
version="0.0.1",
author_email="team@replicate.com",
description="Containers for machine learning",
long_description=long_description,
long_description_conte... | 27.269231 | 91 | 0.643159 | [
"Apache-2.0"
] | VictorXLR/cog | python/setup.py | 709 | Python |
from handlers.kbeServer.Editor.Interface import interface_workmark
from methods.DBManager import DBManager
#点赞
def Transactions_Code_2008( self_uid , self_username , json_data):
# 回调json
json_back = {
"code": 0,
"msg": "",
"pam": ""
}
# json_data 结构
uid = int(json_data["... | 24.927273 | 119 | 0.611233 | [
"MIT"
] | iamjing66/tornaodo_sdk | handlers/kbeServer/Editor/response/response_workmark.py | 2,954 | Python |
# Copyright 2019-2021 Wingify Software Pvt. Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | 41.203704 | 98 | 0.725843 | [
"Apache-2.0"
] | MDAkramSiddiqui/vwo-python-sdk | vwo/services/segmentor/segment_evaluator.py | 2,225 | Python |
"""
Given an array nums and a value val, remove all instances of that value in-place and return the new length.
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
The order of elements can be changed. It doesn't matter what you leave beyond the ... | 38.844444 | 133 | 0.680778 | [
"MIT"
] | ChenhaoJiang/LeetCode-Solution | 1-50/27_remove-element.py | 1,748 | Python |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'uofthacksemergencyfunds.settings')
try:
from django.core.management import execute_from_command_line... | 29.521739 | 87 | 0.686303 | [
"MIT"
] | donmin062501/Savings.io | manage.py | 679 | Python |
from tatau_core.models import TaskDeclaration
from tatau_core.models.task import ListEstimationAssignments
from tatau_core.utils.ipfs import Directory
class Estimator:
@staticmethod
def get_data_for_estimate(task_declaration):
dataset = task_declaration.dataset
ipfs_dir = Directory(dataset.tra... | 34.324324 | 101 | 0.697638 | [
"Apache-2.0"
] | makar21/core | tatau_core/node/producer/estimator.py | 1,270 | Python |
# MINLP written by GAMS Convert at 08/20/20 01:30:53
#
# Equation counts
# Total E G L N X C B
# 3360 1353 785 1222 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... | 42.421523 | 120 | 0.616743 | [
"MIT"
] | grossmann-group/pyomo-MINLP-benchmarking | models_nonconvex_simple2/crudeoil_lee3_06.py | 374,879 | 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 mempool limiting together/eviction with the wallet
from test_framework.test_framework import Bitc... | 40.75 | 119 | 0.666521 | [
"MIT"
] | 3s3s/bitcoin-v-12.1 | qa/rpc-tests/mempool_limit.py | 2,282 | Python |
import json
import time, asyncio
from smsgateway import sink_sms
from smsgateway.config import *
from smsgateway.sources.utils import *
from slackclient import SlackClient
def init():
global IDENTIFIER, app_log
IDENTIFIER = "SL"
app_log = setup_logging("slack")
def main():
init()
sc = SlackClien... | 31.553571 | 74 | 0.465761 | [
"MIT"
] | Craeckie/SMSGateway | smsgateway/sources/slack.py | 3,534 | Python |
#!/usr/bin/env python
#
# pyLearn documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | 29.478528 | 77 | 0.68512 | [
"MIT"
] | sravanrekandar/pyLearn | docs/conf.py | 4,805 | Python |
def remove_middle(a, b, c):
cross = (a[0] - b[0]) * (c[1] - b[1]) - (a[1] - b[1]) * (c[0] - b[0])
dot = (a[0] - b[0]) * (c[0] - b[0]) + (a[1] - b[1]) * (c[1] - b[1])
return cross < 0 or cross == 0 and dot <= 0
def convex_hull(points):
spoints = sorted(points)
hull = []
for p in spoints + spoin... | 29.875 | 73 | 0.470711 | [
"Apache-2.0"
] | 3xp10it3r/PyRival | pyrival/geometry/convex_hull.py | 478 | Python |
"""
Base settings for Mad Taxi project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
import environ
ROOT_DIR = environ.Path(__file__) - 3 # (mad_taxi/config/se... | 36.709343 | 101 | 0.630691 | [
"MIT"
] | Disruption/MadTaxiBackend | config/settings/base.py | 10,609 | Python |
'''cleanup intermediary files '''
import os
def run(c): # run something at terminal and wait to finish
print(c)
a = os.system(c)
run('rm *.png') # remove figures
run('rm test* truth*') # wipe test and truth data
run('rm -rf test truth') # wipe test and truth data segment files
| 26.454545 | 66 | 0.670103 | [
"Apache-2.0"
] | ashlinrichardson/bcgov-python-presentations | presentations/20210526_simple_character_recognition/cleanup.py | 291 | Python |
#
# Copyright 2021 IBM 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 or agreed... | 34.947368 | 74 | 0.753012 | [
"Apache-2.0"
] | hardik-dadhich/appconfiguration-python-sdk | ibm_appconfiguration/version.py | 664 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from rest_framework.test import APIRequestFactory
from elasticsearch_dsl import Q
from rest_framework_elasticsearch.es_filters import (
ESFieldFilter, ElasticOrderingFilter, ElasticFieldsFilter,
ElasticFieldsRangeFilter, ElasticSear... | 30.222785 | 78 | 0.544731 | [
"Apache-2.0"
] | ArtemBernatskyy/django-rest-elasticsearch | tests/test_filters.py | 11,940 | Python |
from __future__ import absolute_import
from datetime import datetime
from enum import Enum
from checkout_sdk.common.common import Address, Phone, CustomerRequest
from checkout_sdk.common.enums import Currency, PaymentSourceType, ChallengeIndicator, Country
class Exemption(str, Enum):
LOW_VALUE = 'low_value'
... | 19.962069 | 94 | 0.69943 | [
"MIT"
] | riaz-bordie-cko/checkout-sdk-python | checkout_sdk/payments/payments.py | 5,789 | Python |
# example of except/from exception usage
try:
1 / 0
except Exception as E:
raise NameError('bad') from E
"""
Traceback (most recent call last):
File "except_from.py", line 4, in <module>
1 / 0
ZeroDivisionError: division by zero
The above exception was the direct cause of the following exception:
Trac... | 21.034483 | 71 | 0.701639 | [
"MIT"
] | KonstantinKlepikov/all-python-ml-learning | python_learning/except_from.py | 610 | 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... | 38.695652 | 80 | 0.615169 | [
"Apache-2.0"
] | DarrenChanChenChi/Paddle | doc/v2/howto/cluster/src/word2vec/api_train_v2_cluster.py | 5,340 | Python |
import graphene
import datetime
import urllib
import json
from django.db import models
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core.signing import TimestampSigner
from django.shortcuts import render
from .registry import registry
from .signals import pre... | 29.786047 | 86 | 0.638039 | [
"MIT"
] | zerolab/wagtail-grapple | grapple/models.py | 6,404 | Python |
"""
Lemur
=====
Is a TLS management and orchestration tool.
:copyright: (c) 2015 by Netflix, see AUTHORS for more
:license: Apache, see LICENSE for more details.
"""
from __future__ import absolute_import
import sys
import json
import os.path
import datetime
from distutils import log
from distutils.core import Comm... | 31.528571 | 105 | 0.644918 | [
"Apache-2.0"
] | caiges/lemur | setup.py | 6,621 | Python |
from base_sss import SubsetSelectionStrategy
import base_sss
import random
import torch
class BALDDropoutStrategy(SubsetSelectionStrategy):
def __init__(self, size, Y_vec, n_drop=10, previous_s=None):
self.previous_s = previous_s
self.n_drop = n_drop
super(BALDDropoutStrategy, self).__init_... | 36.147059 | 70 | 0.609439 | [
"MIT"
] | LinaXiao201788/mexmi-project | mexmi/subset_selection_strategy/bayesian_disagreement_dropout_sss.py | 1,229 | Python |
from .fis import FIS
import numpy as np
try:
import pandas as pd
except ImportError:
pd = None
try:
from sklearn.model_selection import GridSearchCV
except ImportError:
GridSearchCV = None
def _get_vars(fis):
"""Get an encoded version of the parameters of the fuzzy sets in a FIS"""
for vari... | 35.328859 | 118 | 0.606573 | [
"MIT"
] | Dih5/zadeh | zadeh/tune.py | 5,264 | Python |
import os
import site
wsgidir = os.path.dirname(__file__)
for path in ['../',
'../..',
'../../..',
'../../lib',
'../../vendor/lib/python',
'../../apps']:
site.addsitedir(os.path.abspath(os.path.join(wsgidir, path)))
from update import application
| 22.714286 | 65 | 0.477987 | [
"BSD-3-Clause"
] | Joergen/zamboni | services/wsgi/versioncheck.py | 318 | Python |
#!/usr/bin/env python
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) Google LLC, 2018
#
# Author: Tom Roeder <tmroeder@google.com>
#
"""A tool for generating compile_commands.json in the Linux kernel."""
import argparse
import json
import logging
import os
import re
_DEFAULT_OUTPUT = 'compile_commands.json'
_DE... | 37.467105 | 80 | 0.641615 | [
"Apache-2.0"
] | Akh1lesh/Object_Detection_using_Intel_Realsense | ubuntu-bionic-hwe-edge/scripts/gen_compile_commands.py | 5,695 | Python |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""Namespace browser widget"""
import os.path as osp
import socket
from spyderlib.qt.QtGui import (QWidget, QVBoxLayout, QHBoxLayout, QMenu,
... | 45.217626 | 102 | 0.544887 | [
"MIT"
] | junglefunkyman/spectracer | spyderlib/widgets/externalshell/namespacebrowser.py | 25,142 | Python |
from typing import Optional
from inan.types.blockchain_format.coin import Coin
from inan.types.blockchain_format.program import Program
from inan.types.blockchain_format.sized_bytes import bytes32
from inan.wallet.puzzles.load_clvm import load_clvm
MOD = load_clvm("genesis-by-coin-id-with-0.clvm", package_or_requirem... | 30.787234 | 82 | 0.73877 | [
"Apache-2.0"
] | inan0812/Inans-blockchain | inan/wallet/puzzles/genesis_by_coin_id_with_0.py | 1,447 | Python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
import tensorflow as tf
from edward.inferences.monte_carlo import MonteCarlo
from edward.models import RandomVariable, Empirical
from edward.util import copy
try:
from edward.models import Normal... | 35.637681 | 79 | 0.652908 | [
"Apache-2.0"
] | mmargenot/edward | edward/inferences/sghmc.py | 4,918 | Python |
import torch.nn as nn
import numpy as np
import pytest
from test.utils import convert_and_test
class LayerSigmoid(nn.Module):
"""
Test for nn.layers based types
"""
def __init__(self):
super(LayerSigmoid, self).__init__()
self.sig = nn.Sigmoid()
def forward(self, x):
x = ... | 25.06383 | 93 | 0.669779 | [
"MIT"
] | Andredance/onnx2keras | test/layers/activations/test_sigmoid.py | 1,178 | Python |
import sys
import threading
from pynput import keyboard
from pynput.keyboard import Controller, Key
from massivemacro import main
COMMAND_KEY = Key.cmd_l if sys.platform == "darwin" else Key.ctrl_l
ALL_MODIFIERS = set()
ALL_KEY_BINDINGS = set()
class EnterKeyBinding(object):
def __init__(self, massivizer, *args)... | 18.606897 | 79 | 0.749444 | [
"MIT"
] | TheRandomLabs/MassiveMacro | massivemacro/key_handler.py | 2,698 | Python |
#!/usr/bin/env python
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# 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... | 37.401015 | 99 | 0.609799 | [
"MIT"
] | Chrislyle8/Test | lib/ansiblelint/__main__.py | 7,368 | Python |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | 34.293333 | 91 | 0.60381 | [
"MIT"
] | AFengKK/azure-sdk-for-python | sdk/netapp/azure-mgmt-netapp/setup.py | 2,572 | Python |
from typing import List, Optional
from discord.ext import commands
from fastapi import APIRouter
from pydantic import BaseModel
from bot.utils import ConnectionUtil, get_conn
class PartialAnswer(BaseModel):
"""Represents the model for an incomplete 8ball answer."""
response: Optional[str]
weight: Option... | 32.194444 | 91 | 0.715703 | [
"MIT"
] | Bluenix2/WinterBot | bot/extensions/misc/eight_ball.py | 2,318 | Python |
#!/usr/bin/env python3
import os
import subprocess
import sys
import serial
import numpy as np
import datetime
iterations = 1
def run(scheme, precomp_bitslicing, use_hardware_crypto):
os.system("make clean")
path = f"crypto_sign/{scheme}/m4"
binary = f"crypto_sign_{scheme}_m4_stack.bin"
if precomp_bitslicing:... | 30.229358 | 200 | 0.647648 | [
"CC0-1.0"
] | TobiasKovats/rainbowm4 | run_all_stack.py | 3,295 | Python |
# python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... | 29.670588 | 80 | 0.720658 | [
"Apache-2.0"
] | Idate96/acme | acme/core.py | 5,044 | Python |
from random import randrange
from autokeras.bayesian import SearchTree, contain
from autokeras.net_transformer import transform
from autokeras.search import Searcher
class RandomSearcher(Searcher):
""" Class to search for neural architectures using Random search strategy.
Attributes:
search_tree: The... | 40.451613 | 98 | 0.631978 | [
"MIT"
] | Beomi/autokeras | nas/random.py | 2,508 | Python |
import cv2
from util.image_type import ColorImage
class VideoWriter:
"""
This class wraps a cv2.VideoWriter object,
preset some parameters so simpler to use.
"""
def __init__(self, video_path: str, fps: float = 10.0) -> None:
"""
Arguments:
video_path: The path to out... | 30.375 | 90 | 0.626543 | [
"MIT"
] | Lai-YT/webcam-applications | util/video_writer.py | 972 | Python |
"""
The automcomplete example rewritten for bottle / gevent.
- Requires besides bottle and gevent also the geventwebsocket pip package
- Instead of a future we create the inner stream for flat_map_latest manually
"""
from bottle import request, Bottle, abort
import gevent
from geventwebsocket import WebSocketError
from... | 26.886364 | 78 | 0.658495 | [
"MIT"
] | samiur/RxPY | examples/autocomplete/bottle_autocomplete.py | 2,366 | Python |
import pytest
from jina.drivers.rank import Chunk2DocRankDriver
from jina.executors.rankers import Chunk2DocRanker
from jina.hub.rankers.MaxRanker import MaxRanker
from jina.hub.rankers.MinRanker import MinRanker
from jina.proto import jina_pb2
class MockLengthRanker(Chunk2DocRanker):
def __init__(self, *args, *... | 36.790244 | 105 | 0.620525 | [
"Apache-2.0"
] | DavidSanwald/jina | tests/unit/drivers/test_chunk2doc_rank_drivers.py | 7,542 | Python |
import os
import sys
import numpy as np
import pandas as pd
import random
from tqdm import tqdm
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
import torch.nn.functional as F
import albumentations as A
from albumentations.pytorch.transforms impo... | 30.638037 | 343 | 0.653584 | [
"MIT"
] | SumanSudhir/Kaggle-SIIM-ISIC-Melanoma-Classification | src/test.py | 4,994 | Python |
import sublime
import os
import queue
import unittest
import unittesting
import tempfile
from Tutkain.api import edn
from Tutkain.src import repl
from Tutkain.src.repl import formatter
from Tutkain.src import base64
from Tutkain.src import test
from .mock import JvmBackchannelServer, JvmServer
from .util import Packa... | 38.156658 | 696 | 0.562166 | [
"Apache-2.0"
] | eerohele/disjure | tests/test_client_jvm.py | 29,228 | Python |
import os
import re
import sys
import json
import glob
import hashlib
import requests
import concurrent.futures as futures
from tqdm import tqdm
from zipfile import ZipFile
from datetime import datetime
from abd_model.core import load_config, Logs
from abd_model.tiles import tiles_from_csv, tiles_to_granules
def a... | 44.055838 | 119 | 0.546031 | [
"MIT"
] | SeasyHQ/automated-building-detection | abd_model/src/abd_model/tools/_sat.py | 8,679 | Python |
"""
GTSAM Copyright 2010-2020, Georgia Tech Research Corporation,
Atlanta, Georgia 30332-0415
All Rights Reserved
See LICENSE for the license information
Rules and classes for parsing a module.
Author: Duy Nguyen Ta, Fan Jiang, Matthew Sklar, Varun Agrawal, and Frank Dellaert
"""
# pylint: disable=unnecessary-lambd... | 27.912281 | 154 | 0.636706 | [
"BSD-3-Clause"
] | BaiLiping/gtsam | wrap/gtwrap/interface_parser/module.py | 1,591 | Python |
# Copyright (c) 2016 Mirantis 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 to in writing, so... | 39.969697 | 79 | 0.682841 | [
"Apache-2.0"
] | Mirantis/CloudFerry | tests/lib/copy_engines/test_bbcp_copier.py | 3,957 | Python |
#!/usr/bin/env python
"""
Memory Loss
github.com/irlrobot/memory_loss
"""
from __future__ import print_function
from random import choice, shuffle
from alexa_responses import speech_with_card
from brain_training import QUESTIONS
def handle_answer_request(player_answer, session):
"""check if the answer is right, ad... | 33.959184 | 85 | 0.685697 | [
"Apache-2.0"
] | irlrobot/memory_loss | src/handle_answer_request.py | 1,664 | Python |
# Copyright 2015 OpenStack Foundation.
# 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 req... | 38.566288 | 79 | 0.658154 | [
"Apache-2.0"
] | ericho/stx-neutron | neutron/tests/unit/common/test_rpc.py | 20,363 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2017-02-17 20:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("scripts", "0007_auto_20150403_2339"), ("comms", "0010_auto_20161206_1912")]
operations = [
migrations.AddField(
mod... | 27.810811 | 97 | 0.524781 | [
"BSD-3-Clause"
] | 3eluk/evennia | evennia/comms/migrations/0011_auto_20170217_2039.py | 1,029 | Python |
#
# (C) Copyright IBM Corp. 2018
#
# 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 writi... | 32.413793 | 74 | 0.77234 | [
"Apache-2.0"
] | edwardstudy/pywren-ibm-cloud | pywren_ibm_cloud/compute/backends/ibm_cf/entry_point.py | 940 | Python |
from mitsubishi_central_controller.util.ControllerDictBuilder import ControllerDictBuilder
import aiohttp
import asyncio
from mitsubishi_central_controller.util.dict_utils import get_group_list_from_dict, get_system_data_from_dict, \
get_single_bulk_from_dict, get_single_racsw_from_dict, get_single_energycontrol_f... | 44.72093 | 120 | 0.729243 | [
"MIT"
] | adgelbfish/mitsubishi-central-controller2 | mitsubishi_central_controller/CentralController.py | 5,769 | Python |
# libraries imported
import os
import pathlib
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
# uses predict folder code to run predictor on entire folders
from predict_folder import predict_dir
def predict_dirs(model_type, target_prediction):
directory_name ... | 40.308571 | 119 | 0.663312 | [
"Apache-2.0"
] | abdmoh123/tremor-predictor | predict_all_data.py | 7,054 | Python |
#!/usr/bin/env python3
"""Example code that demonstrates using a button connected through the hat.
The button uses a hat pin through the sysfs driver illustrating the edge
detection polling.
The demo will light up the on board LED whenever PIN_D is drawn high.
"""
from signal import pause
from gpiozero import Button
... | 30.857143 | 77 | 0.767361 | [
"Apache-2.0"
] | EdieW/controlcenter | src/examples/vision/gpiozero/bonnet_button.py | 864 | Python |
# Use of this source code is governed by the MIT license.
__license__ = "MIT"
"""This is the IP Analyzer program for the AlteMatrix module."""
| 28.8 | 64 | 0.736111 | [
"MIT"
] | Ir0n-c0d3X/AlteMatrix | AlteMatrix/ipanalyzer/__init__.py | 144 | Python |
#!/usr/bin/python
# Copyright (c) 2010 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.
"""Utilities for PyAuto."""
import logging
import os
import shutil
import sys
import tempfile
import zipfile
class ExistingPathRepl... | 30.842857 | 80 | 0.667439 | [
"BSD-3-Clause"
] | Gitman1989/chromium | chrome/test/pyautolib/pyauto_utils.py | 4,318 | Python |
"""
URLConf for OCR presets.
"""
from django.conf.urls.defaults import *
from django.contrib.auth.decorators import login_required
from ocradmin.presets import views
urlpatterns = patterns('',
(r'^builder/?$', login_required(views.builder)),
(r'^builder/(?P<pid>[^/]+)/?$', login_required(views.builder_doc_edit)),
... | 40.6 | 73 | 0.618227 | [
"Apache-2.0"
] | DomWeldon/ocropodium | ocradmin/presets/urls.py | 1,218 | Python |
import collections
import itertools
import re
import yaml
from ansible.errors import AnsibleError
from cumulus_vxconfig.utils.filters import Filters
from cumulus_vxconfig.utils import File, Network, Link, Inventory, Host
filter = Filters()
mf = File().master()
inventory = Inventory()
class CheckVars:
'''
Pr... | 37.395349 | 80 | 0.466248 | [
"MIT"
] | rynldtbuen/ansible-configvars | cumulus_vxconfig/utils/checkvars.py | 17,688 | Python |
def solution(S, T):
#대소문자 변형
S = S.lower()
T = T.lower()
dic = {}
for i in S:
if dic.get(i):
dic[i] += 1
else:
dic[i] = 1
for i in T:
if dic.get(i):
dic[i] -= 1
else:
dic[i] = -1
for i in dic.values():
... | 16.192308 | 26 | 0.391924 | [
"MIT"
] | love-adela/algorithm | codility/1_2.py | 433 | Python |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 38 | 93 | 0.73985 | [
"Apache-2.0"
] | wudenggang/mindspore | model_zoo/mass/src/transformer/__init__.py | 1,330 | Python |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 41.057726 | 106 | 0.606974 | [
"Apache-2.0"
] | busunkim96/python-talent | google/cloud/talent_v4beta1/services/job_service/client.py | 46,231 | Python |
from __future__ import absolute_import
from .textfield import TextField
from .textarea import Textarea
from .password import PasswordField
from .command import CommandField
from .dropdown import Dropdown
from .listbox import Listbox
from .checkbox import CheckBox
from .checkbox import BlockCheckbox
from .cou... | 31.764706 | 55 | 0.825926 | [
"MIT"
] | 3ehzad/Gooey | gooey/gui/components/widgets/__init__.py | 540 | Python |
from ...Classes.Material import Material
from ...Functions.Material.compare_material import compare_material
def replace_material_pyleecan_obj(obj, mat1, mat2, comp_name_path=True):
"""
replace first material by the second in the object
Parameters
----------
obj: Pyleecan object
mat1: Materia... | 35.263158 | 92 | 0.589552 | [
"Apache-2.0"
] | BonneelP/pyleecan | pyleecan/Functions/Material/replace_material_pyleecan_obj.py | 2,010 | Python |
# Copyright (c) 2021 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 appli... | 41.617347 | 84 | 0.618855 | [
"Apache-2.0"
] | 17729703508/PaddleX | paddlex/ppdet/modeling/assigners/utils.py | 8,157 | Python |
#!/usr/bin/env python3
import sys
def application(env, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
return [b'Hello from Python %s' % sys.version.encode('utf-8')]
| 25.375 | 66 | 0.674877 | [
"MIT"
] | altermarkive/Scheduled-Tasks-with-Cron-Python-Ubuntu-Docker | uwsgi-nginx-container/root/app/main.py | 203 | Python |
import os
import logging
from mtkclient.Library.utils import LogBase
class damodes:
DEFAULT = 0
XFLASH = 1
class chipconfig:
def __init__(self, var1=None, watchdog=None, uart=None, brom_payload_addr=None,
da_payload_addr=None, pl_payload_addr=None, cqdma_base=None, sej_base=None, dxcc_b... | 32.865947 | 120 | 0.569059 | [
"MIT"
] | ligteltelecom/mtkclient | mtkclient/config/brom_config.py | 51,731 | Python |
import collections
from tensorflow.keras.losses import SparseCategoricalCrossentropy, BinaryCrossentropy
from tensorflow.keras.metrics import Mean, Accuracy
optimizer = SGD(lr=0.01, momentum=0.9, nesterov=True)
cce = SparseCategoricalCrossentropy()
bce = BinaryCrossentropy()
model.compile(
optimizer=optimizer,... | 39.434783 | 107 | 0.732819 | [
"MIT"
] | Mougatine/lectures-labs | labs/10_unsupervised_generative_models/solutions/grl_training.py | 2,721 | Python |
"""Test module for detecting uncollectable garbage in PyTables.
This test module *must* be loaded in the last place. It just checks for
the existence of uncollectable garbage in ``gc.garbage`` after running
all the tests.
"""
import gc
from tables.tests import common
class GarbageTestCase(common.PyTablesTestCase... | 28.961538 | 77 | 0.616202 | [
"BSD-3-Clause"
] | Daybreak2019/PyTables | tables/tests/test_garbage.py | 1,506 | Python |
import logging
import random
import re
from uuid import UUID
import dateutil.parser
import w3lib.url
from yarl import URL
from .captcha import CaptchaSolver
from .starbelly_pb2 import (
PatternMatch as PbPatternMatch,
PolicyRobotsTxt as PbPolicyRobotsTxt,
PolicyUrlRule as PbPolicyUrlRule
)
logger = logg... | 33.33865 | 80 | 0.568032 | [
"MIT"
] | HyperionGray/starbelly | starbelly/policy.py | 27,175 | Python |
import os
from datetime import date, datetime, timedelta
from enum import Enum
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.models import Group
from django.core.cache import cache
from django.core.cache.utils import make_template_fragment_key
from django.core.exceptions... | 40.686327 | 142 | 0.68918 | [
"MIT"
] | lill28/EvaP | evap/staff/tools.py | 15,176 | Python |
import os
import fabdeploytools.envs
from fabric.api import env, lcd, local, task
from fabdeploytools import helpers
import deploysettings as settings
env.key_filename = settings.SSH_KEY
fabdeploytools.envs.loadenv(settings.CLUSTER)
ROOT, PROJECT_NAME = helpers.get_app_dirs(__file__)
@task
def build():
with l... | 26.189189 | 60 | 0.627451 | [
"MPL-2.0"
] | mozilla/marketplace-style-guide | fabfile.py | 969 | Python |
"""
Consensus Algorithm for 6 Mobile robots using MLP Model for Line Graph Implementation
Inputs: Mx, My
Outputs: Ux, Uy
"""
import torch
import MLP_Model
import math
import numpy as np
import rclpy
from rclpy.node import Node
from tf2_msgs.msg import TFMessage
from std_msgs.msg import Float32
import time
L = 1
d =... | 42.073491 | 162 | 0.581347 | [
"MIT"
] | HusseinLezzaik/Consensus-Algorithm-for-2-Mobile-Robots | Real Topology Graph/GNN Model 1/Cyclic Graph/Main_MLP_line.py | 16,030 | Python |
from rest_framework import serializers
from django.shortcuts import get_object_or_404
from django.contrib.auth import get_user_model
from postreview.models import Review
class ReviewListSerializer(serializers.ModelSerializer):
first_name = serializers.SerializerMethodField()
url = serializers.HyperlinkedIdent... | 24.536842 | 81 | 0.551266 | [
"MIT"
] | ananyamalik/unicode-website | postreview/api/serializers.py | 2,331 | Python |
# Accessor functions for control properties
from Controls import *
import struct
# These needn't go through this module, but are here for completeness
def SetControlData_Handle(control, part, selector, data):
control.SetControlData_Handle(part, selector, data)
def GetControlData_Handle(control, part, selecto... | 32.793103 | 85 | 0.695058 | [
"MIT"
] | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.3/Lib/plat-mac/Carbon/ControlAccessor.py | 1,902 | Python |
# coding: utf-8
from __future__ import unicode_literals
from .spike import ParamountNetworkIE
class TVLandIE(ParamountNetworkIE):
IE_NAME = 'tvland.com'
_VALID_URL = r'https?://(?:www\.)?tvland\.com/(?:video-clips|(?:full-)?episodes)/(?P<id>[^/?#.]+)'
_FEED_URL = 'http://www.tvland.com/feeds/mrss/'
_... | 38.631579 | 106 | 0.592643 | [
"Unlicense"
] | 0017031/youtube-dl | youtube_dl/extractor/tvland.py | 1,468 | Python |
import argparse
import logging
from pprint import pprint
from .gcal import GCal
logger = logging.getLogger(__name__)
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="TODO"
)
parser.add_argument(
'-v', '--verbose', action='count', default=0,
)
... | 20.914286 | 64 | 0.655738 | [
"MIT"
] | liskin/gcal-sync | src/gcal_sync/cli.py | 732 | Python |
from ..options import Option, OptionHandler
class LocaleOptionsMixin(OptionHandler):
"""
Mixin which adds a locale option to option handlers.
"""
# The locale to use
locale = Option(
help="the locale to use for parsing the numbers",
default="en_US"
)
| 22.538462 | 57 | 0.651877 | [
"MIT"
] | waikato-datamining/wai-spectral-io | src/wai/spectralio/mixins/_LocaleOptionsMixin.py | 293 | Python |
"""Sets of metrics to look at the SRD metrics.
"""
import numpy as np
import healpy as hp
import rubin_sim.maf.metrics as metrics
import rubin_sim.maf.slicers as slicers
import rubin_sim.maf.stackers as stackers
import rubin_sim.maf.plots as plots
import rubin_sim.maf.metricBundles as mb
from .colMapDict import ColMapD... | 51.164804 | 108 | 0.612928 | [
"MIT"
] | RileyWClarke/Flarubin | rubin_sim/maf/batches/srdBatch.py | 18,317 | Python |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets 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 by appl... | 39.368421 | 102 | 0.783422 | [
"Apache-2.0"
] | BeeAlarmed/datasets | tensorflow_datasets/image_classification/i_naturalist2018/__init__.py | 748 | Python |
# Copyright 2016, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | 27.521505 | 78 | 0.601094 | [
"Apache-2.0"
] | augustand/Nuitka | nuitka/codegen/ListCodes.py | 5,119 | Python |
ADD_USER_ROLE = '''
INSERT INTO UserRole(roleId, userId) VALUES (
(SELECT id FROM Role WHERE name = :roleName),
:userId
)
'''
#
# User table queries
#
ADD_USER = '''
INSERT OR IGNORE INTO User(id, username) VALUES(:userId, :username)
'''
UPDATE_USERNAME = '''
UPDATE User... | 20.72 | 96 | 0.603282 | [
"MIT"
] | camd67/moebot-py-archive | bot/queries.py | 1,036 | Python |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... | 62.959543 | 1,678 | 0.660306 | [
"Apache-2.0"
] | CiscoDevNet/intersight-python | intersight/model/compute_vmedia_relationship.py | 71,585 | Python |
from setuptools import setup, find_packages
def readme():
with open('README.rst') as f:
return f.read()
setup(name = "triceratops",
version = '1.0.10',
description = "Statistical Validation of Transiting Planet Candidates",
long_description = readme(),
author = "Steven Giacalone",
... | 40.9 | 97 | 0.581907 | [
"MIT"
] | martindevora/triceratops | setup.py | 1,227 | Python |
np.deg2rad(x) | 13 | 13 | 0.769231 | [
"BSD-3-Clause"
] | kuanpern/jupyterlab-snippets-multimenus | example_snippets/multimenus_snippets/NewSnippets/NumPy/Vectorized (universal) functions/Trigonometric and hyperbolic functions/deg2rad Convert angles from degrees to radians.py | 13 | Python |
import time
import RPi.GPIO as GPIO
from adafruit_servokit import ServoKit
'''GPIO.setmode(GPIO.BCM)
GPIO.setup(11,GPIO.OUT)
servo1=GPIO.PWM(11,50)
servo1.start(2)'''
h = ServoKit(channels=16)
#servo1.ChangeDutyCycle(12)
#kit.servo[0].angle
init = [0,90,20,0,180,160,170,180,60,0,0,150]
limitLo = [0,0,20,0,0,40,0,... | 20.630769 | 64 | 0.595078 | [
"MIT"
] | DevJewel143/Robot-Leena | Store/robot-test-old/hand_shake.py | 1,341 | Python |
""" Modified from offical repo and mmlab's repo of HRNet
MIT License
Copyright (c) 2019 Microsoft
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 t... | 37.651515 | 118 | 0.562656 | [
"Apache-2.0"
] | Bobholamovic/ever | ever/module/_hrnet.py | 24,850 | Python |
from __future__ import print_function
import glob
import os
import datetime
import argparse
import json
import csv
import re
import pdb
import copy
import subprocess
import fnmatch
import textwrap
import sys
import tempfile
DEFAULT_BUILD_TAGS = "darwin,linux,windows"
# Get the beats repo root directory, making sure ... | 39.472973 | 122 | 0.667237 | [
"ECL-2.0",
"Apache-2.0"
] | cyrille-leclerc/apm-server | script/generate_notice.py | 5,842 | Python |
"""
Facebook platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.facebook/
"""
import logging
from aiohttp.hdrs import CONTENT_TYPE
import requests
import voluptuous as vol
from homeassistant.components.notify import (
... | 33.621951 | 79 | 0.6177 | [
"Apache-2.0"
] | Anthonymcqueen21/home-assistant | homeassistant/components/notify/facebook.py | 2,757 | Python |
#!/usr/bin/env pvpython
# -*- Python -*- (syntax highlighting)
# ----------------------------------------------------------------------
#
# Brad T. Aagaard, U.S. Geological Survey
# Charles A. Williams, GNS Science
# Matthew G. Knepley, University at Buffalo
#
# This code was developed as part of the Computational Infr... | 33.398496 | 106 | 0.630347 | [
"MIT"
] | Shengduo/pylith | examples/3d/subduction/viz/plot_faultdir.py | 4,442 | Python |
import os
import shutil
from unittest import TestCase
from osbot_utils.utils.Files import folder_exists, temp_folder, file_exists, folder_temp, folder_delete_all, temp_file, \
file_copy
from cdr_plugin_folder_to_folder.pre_processing.utils.file_service import File_Service
from cdr_plugin_folder_to_folder.utils.te... | 30.151163 | 121 | 0.706132 | [
"Apache-2.0"
] | lucia15/cdr-plugin-folder-to-folder | tests/unit/pre_processing/utils/test_File_service.py | 2,593 | Python |
# -*- coding: utf-8 -*-
"""\
Copyright (c) 2015-2018, MGH Computational Pathology
"""
from __future__ import print_function
from calicoml.core.metrics import ppv, npv, ROC
from calicoml.core.metrics import compute_averaged_metrics, accuracy_from_confusion_matrix, ConditionalMeansSelector
from calicoml.core.metrics ... | 49.25731 | 116 | 0.611421 | [
"BSD-3-Clause"
] | MGHComputationalPathology/CalicoML | tests/test_metrics.py | 8,423 | Python |
# Copyright (C) 2016 Li Cheng at Beijing University of Posts
# and Telecommunications. www.muzixing.com
# Copyright (C) 2016 Huang MaChi at Chongqing University
# of Posts and Telecommunications, China.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compl... | 35.293023 | 160 | 0.654389 | [
"Apache-2.0"
] | Helloworld1995/Ryu_SDN_Controller | build/lib.linux-x86_64-2.7/ryu/app/experiments/RUN-master/EFattree/network_monitor.py | 15,176 | Python |
"""engine.SCons.Tool.f03
Tool-specific initialization for the generic Posix f03 Fortran compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2... | 32.109375 | 113 | 0.750852 | [
"BSD-3-Clause"
] | Acpharis/protein_prep | pdb2pqr-1.9.0/scons/scons-local-2.3.0/SCons/Tool/f03.py | 2,055 | Python |
"""add ondelete set null to question_repyl, tabled_committee_report and call_for_comment tables
Revision ID: 122a38429a58
Revises: 29cf770ce19b
Create Date: 2015-02-10 10:13:58.437446
"""
# revision identifiers, used by Alembic.
revision = '122a38429a58'
down_revision = '29cf770ce19b'
branch_labels = None
depends_on... | 34.9375 | 157 | 0.77907 | [
"Apache-2.0"
] | Lunga001/pmg-cms-2 | migrations/versions/122a38429a58_add_ondelete_set_null_to_question_repyl_.py | 1,118 | Python |
#!/usr/bin/env python3
from aws_cdk import core
from arm64_wheel_tester_stack.arm64_wheel_tester_stack import Arm64WheelTesterStack
app = core.App()
Arm64WheelTesterStack(app, "arm64-github-testers", env={'region': 'us-east-1'})
app.synth()
| 20.5 | 83 | 0.780488 | [
"BSD-2-Clause"
] | AWSjswinney/arm64-python-wheel-tester | app.py | 246 | Python |
#
# This file is part of pyasn1-alt-modules software.
#
# Created by Russ Housley
# Copyright (c) 2020-2022, Vigil Security, LLC
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
#
import sys
import unittest
from pyasn1.codec.der.decoder import decode as der_decoder
from pyasn1.codec.der.encoder import enc... | 40.472973 | 78 | 0.795659 | [
"BSD-2-Clause"
] | CBonnell/pyasn1-alt-modules | tests/test_rfc8737.py | 2,995 | Python |
nome = input ('qual é o seu nome?')
print('é um prazer te conhecer, {}!'.format(nome))
| 17.8 | 50 | 0.629213 | [
"MIT"
] | railenedev/curso-em-video | exercicio2.py | 91 | Python |
import argparse
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
parser = argparse.ArgumentParser(description="Batch arguments")
parser.add_argument('--num-training-steps', type=int, dest='num_training_steps', default=2000)
parser.add_argument('--mini-batch-size', type=int, dest='mini... | 34.235955 | 94 | 0.656055 | [
"MIT"
] | alexanderlevin/mnist_digit_recognition | batch/train_model.py | 3,047 | Python |
from __future__ import absolute_import
import datetime
import jwt
import re
import json
import logging
from hashlib import md5 as _md5
from six.moves.urllib.parse import parse_qs, urlparse, urlsplit
from sentry.utils.cache import cache
from django.utils.encoding import force_bytes
from sentry.integrations.atlassian_... | 36.555556 | 144 | 0.638541 | [
"BSD-3-Clause"
] | YtvwlD/sentry | src/sentry/integrations/jira/client.py | 8,225 | Python |
# 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 required by applica... | 39.106481 | 85 | 0.664023 | [
"Apache-2.0"
] | Jerry-li-uw/privacy | tutorials/dp_optimizer_adp.py | 8,447 | Python |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 ysitu <ysitu@users.noreply.github.com>
# All rights reserved.
# BSD license.
#
# Author: ysitu <ysitu@users.noreply.github.com>
"""
Algebraic connectivity and Fiedler vectors of undirected graphs.
"""
from functools import partial
import networkx as nx
from networkx.utils im... | 32.598276 | 79 | 0.582271 | [
"Unlicense"
] | AlexKovrigin/facerecognition | venv/Lib/site-packages/networkx/linalg/algebraicconnectivity.py | 18,907 | Python |
#!/usr/bin/env python3
# @generated AUTOGENERATED file. Do not Change!
from dataclasses import dataclass, field as _field
from functools import partial
from ...config import custom_scalars, datetime
from numbers import Number
from typing import Any, AsyncGenerator, Dict, List, Generator, Optional
from dataclasses_jso... | 31.24 | 71 | 0.795134 | [
"BSD-3-Clause"
] | jesusrh12/symphony | cli/psym/graphql/input/edit_location_type_input.py | 781 | Python |
from shopyoapi.init import db
class Product(db.Model):
__tablename__ = "product"
barcode = db.Column(db.String(100), primary_key=True)
price = db.Column(db.Float)
name = db.Column(db.String(100))
description = db.Column(db.String(300))
date = db.Column(db.String(100))
in_stock = db.Column(... | 30.647059 | 70 | 0.675624 | [
"MIT"
] | ouyangjunfei/shopyo | shopyo/modules/product/models.py | 521 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.