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 |
|---|---|---|---|---|---|---|---|---|
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 38.553488 | 107 | 0.519725 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | MatrixManAtYrService/airflow | chart/tests/test_pod_template_file.py | 16,578 | Python |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 38.790476 | 100 | 0.631169 | [
"Apache-2.0"
] | HemiMin/tvm | tutorials/autotvm/tune_relay_mobile_gpu.py | 16,292 | Python |
from __future__ import absolute_import
import abc
class Database(object):
__metaclass__ = abc.ABCMeta
FIELD_FILE_SHA1 = 'file_sha1'
FIELD_SONG_ID = 'song_id'
FIELD_SONGNAME = 'song_name'
FIELD_OFFSET = 'offset'
FIELD_HASH = 'hash'
# Name of your Database subclass, this is used in configu... | 24.461111 | 76 | 0.605042 | [
"MIT"
] | KundanGaira/dejavu | dejavu/database.py | 4,403 | Python |
import pytest
from unittest.mock import patch
from collections import Counter
from bigchaindb.core import Bigchain
from bigchaindb.exceptions import CriticalDuplicateVote
from bigchaindb.voting import Voting, INVALID, VALID, UNDECIDED
################################################################################
#... | 31.084677 | 80 | 0.558827 | [
"Apache-2.0"
] | RiddleAndCode/bigchaindb | tests/test_voting.py | 7,709 | Python |
#!/usr/bin/env python
# ref: Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun"Deep Residual Learning for Image Recognition"
# https://arxiv.org/pdf/1512.03385v1.pdf
#
ResNetConfig={
"16":[ "16", "small", 1, 1, 1, 1],
"18":[ "18", "small", 2, 2, 2, 2],
"34":[ "34", "small", 3, 4, 6, 3],
"50":[ "50", ... | 37.737931 | 142 | 0.688109 | [
"BSD-2-Clause"
] | 103yiran/caffe | models/resnet18/ResNet_Generator.py | 16,416 | Python |
import gym
import rlkit.torch.pytorch_util as ptu
from rlkit.data_management.obs_dict_replay_buffer import ObsDictRelabelingBuffer
from rlkit.exploration_strategies.base import \
PolicyWrappedWithExplorationStrategy
from rlkit.exploration_strategies.gaussian_and_epislon import \
GaussianAndEpislonStrategy
from... | 34.719626 | 102 | 0.676716 | [
"MIT"
] | Asap7772/railrl_evalsawyer | experiments/ashvin/rfeatures/sawyer/door/bc3.py | 3,715 | Python |
import os
import platform
import re
import sys
from contextlib import suppress
from pathlib import Path
from loguru import logger
from sc2 import wsl
BASEDIR = {
"Windows": "C:/Program Files (x86)/StarCraft II",
"WSL1": "/mnt/c/Program Files (x86)/StarCraft II",
"WSL2": "/mnt/c/Program Files (x86)/StarCr... | 29.740506 | 118 | 0.604597 | [
"MIT"
] | Sc2-AI-Cup/example-bot-marinerush | sc2/paths.py | 4,699 | Python |
# http://www.pythonchallenge.com/pc/def/peak.html
import requests, pickle
input_url = "http://www.pythonchallenge.com/pc/def/banner.p"
obj = requests.get(input_url)
text = obj.text
banner = pickle.loads(text)
final = []
for index, value in enumerate(banner):
for j in value:
final.append("".join(j[0] * j... | 19.578947 | 60 | 0.672043 | [
"MIT"
] | yarabarla/python-challenge | 5.py | 372 | Python |
SUMMARIES = {
'git-adjust': 'Amend any commit, not just the last',
'git-copy': 'Copy a git branch locally and remotely',
'git-delete': 'Delete one or more branches locally and remotely',
'git-gitz': 'Print information about the gitz git commands',
'git-go': 'Go to a specific location in the current ... | 54.842105 | 78 | 0.68714 | [
"MIT"
] | rec/gitz | gitz/program/summaries.py | 1,042 | Python |
# ABC082b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
s = input()[:-1]
t = input()[:-1]
print('Yes' if sorted(s) < sorted(t, reverse=True) else 'No')
| 19.333333 | 61 | 0.66092 | [
"Unlicense"
] | VolgaKurvar/AtCoder | ABC082/ABC082b.py | 174 | Python |
import argparse
import os
import os.path as osp
import shutil
import tempfile
import json
import pdb
import numpy as np
import pickle
import pandas as pd
import mmcv
import torch
import torch.distributed as dist
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import get_dist_info, l... | 39.072139 | 148 | 0.625199 | [
"Apache-2.0"
] | ydiller/BalancedGroupSoftmax | tools/test_lvis.py | 15,707 | Python |
from __future__ import absolute_import
from __future__ import print_function
from typing import Any, Iterable
from optparse import make_option
import logging
import sys
from django.core.management.base import BaseCommand, CommandParser
from zerver.lib import utils
from zerver.models import UserMessage, get_user_pro... | 36.224719 | 97 | 0.537531 | [
"Apache-2.0"
] | dehnert/zulip | zerver/management/commands/set_message_flags.py | 3,224 | Python |
# coding: utf-8
import errno
import os
import random
import re
from contextlib import contextmanager
import h5py
import numpy as np
import time
import yaml
from datetime import datetime
def write_yaml_file(yaml_dict, file_yaml):
path_yaml = os.path.dirname(file_yaml)
if not os.path.isdir(path_yaml):
... | 29.332645 | 98 | 0.520885 | [
"Apache-2.0"
] | NingAnMe/snow_cover_of_remote_sensing | lib/pb_io.py | 14,837 | Python |
def hello_world(context):
context.logger.info("hello world")
| 21.666667 | 38 | 0.738462 | [
"Apache-2.0"
] | AlonMaor14/mlrun | tests/system/runtimes/assets/kubejob_function.py | 65 | Python |
import os
import sys
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..'))
import tensorflow as tf
slim = tf.contrib.slim
def disc_net_64(img1, img2, target_dim, scope="DISC", reuse=False):
nets_dict = dict()
nets_dict['input1'] = img1
nets_dict['input2'] = img2
with tf.vari... | 62.730769 | 168 | 0.633967 | [
"MIT"
] | zhuxinqimac/DisentanglementICML19 | Dsprites_exp/VAE-VC/local_nets.py | 1,631 | Python |
#!/usr/bin/env python3
# purpose: Mimics a simple telnet daemon login prompts and records output
# starts a tcp listener on port and address with variables defined below
# author: Raresteak
# date: 6 October 2021
# version: 3
import datetime
import socket
HOST = '127.0.0.1'
PORT = 2323
FILE = "stn-results.json"
fh = o... | 37.472727 | 145 | 0.447841 | [
"BSD-2-Clause"
] | raresteak/simple-telnet-deception | simple-telnet-deception.py | 2,061 | Python |
import unittest
import filecmp
import datetime
from utils import in_tst_dir, in_tst_output_dir
import xlwt as xlwt
ezxf = xlwt.easyxf
def write_xls(file_name, sheet_name, headings, data, heading_xf, data_xfs):
book = xlwt.Workbook()
sheet = book.add_sheet(sheet_name)
rowx = 0
for colx, value in enume... | 40.232143 | 88 | 0.59787 | [
"Apache-2.0"
] | 10088/hue | desktop/core/ext-py/xlwt-1.3.0/tests/test_easyxf.py | 2,253 | Python |
#!c:\users\jerem\dev\ipp-core\venv\scripts\python.exe
# See http://cens.ioc.ee/projects/f2py2e/
from __future__ import division, print_function
import os
import sys
for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]:
try:
i = sys.argv.index("--" + mode)
del sys.argv[i]
break
... | 27.344828 | 67 | 0.641866 | [
"MIT"
] | jeremycward/ipp-core | venv/Scripts/f2py.py | 793 | Python |
import sys
sys.path.append('..')
from utilities import jamfconfig
from utilities import apirequests
from computergroups import computergroups
import xml.etree.ElementTree as etree
jss_api_base_url = jamfconfig.getJSS_API_URL()
#print("JSS API Base URL: {}".format(jss_api_base_url))
def cleanupOutput(inputString):
#... | 28.345029 | 185 | 0.702909 | [
"Apache-2.0"
] | eventbrite/britetech-casper-tools | policies/policies_core.py | 9,694 | Python |
from __future__ import annotations
from typing import List, Tuple, Optional
from network_simulator.BloodType import BloodType
from network_simulator.compatibility_markers import OrganType
path_structure = Optional[List[Optional[int]]]
shortest_path_structure = Tuple[path_structure, float]
class Organ:
"""
... | 36.477778 | 88 | 0.63905 | [
"MIT"
] | zspatter/Network-Simulation | network_simulator/Organ.py | 3,283 | Python |
from invoke import task
@task
def precheck(ctx):
ctx.run("black .")
ctx.run("pre-commit run -a")
ctx.run("interrogate -c pyproject.toml", pty=True)
@task
def clean(ctx):
ctx.run("python setup.py clean")
ctx.run("rm -rf netcfgbu.egg-info")
ctx.run("rm -rf .pytest_cache .pytest_tmpdir .coverag... | 20.823529 | 60 | 0.649718 | [
"MIT"
] | andyfcx/demo-beginner-concurrency | tasks.py | 354 | Python |
"""
Example how setup service
"""
from typing import Optional, Any
from orchestrator_service import Message
from orchestrator_service.service import CommandHandlerPostStrategy
from orchestrator_service.service import CommandHandlerStrategy
from orchestrator_service.service import ServiceBlock, ServiceBuilder, ... | 27.240602 | 105 | 0.634281 | [
"Unlicense"
] | Shchusia/orchestrator | examples/example_service.py | 3,623 | Python |
"""
Expose top-level symbols that are safe for import *
"""
from __future__ import print_function, division, absolute_import
import re
from . import testing, decorators
from ._version import get_versions
from . import special, types, config
# Re-export typeof
from .special import *
from .pycc.decorators import export,... | 22.223684 | 74 | 0.67614 | [
"BSD-2-Clause"
] | meawoppl/numba | numba/__init__.py | 1,689 | Python |
from string import ascii_lowercase
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from plotly.colors import hex_to_rgb
from src.timeit import timeit
@timeit
def plotOverTime(FSCPData: pd.DataFrame, FSCPDataSteel: pd.DataFrame, config: dict):
#... | 37.185393 | 149 | 0.584177 | [
"MIT"
] | PhilippVerpoort/blue-green-H2 | src/plotting/plots/plotOverTime.py | 19,861 | Python |
suite = {
"mxversion": "5.156.0",
"name": "truffleruby",
"imports": {
"suites": [
{ # Import only the tools suite which depends on truffle, to avoid duplicating import versions.
# We want tools to be reliably available with TruffleRuby, even with "mx build", so this is a s... | 34.466793 | 123 | 0.428265 | [
"EPL-1.0",
"Apache-2.0"
] | Quintasan/truffleruby | mx.truffleruby/suite.py | 18,164 | Python |
import torch
import time
from math import pi
import numpy as np
from ..utils.tensorboard import Tensorboard
from ..utils.output import progress
from .convergence import Convergence
from ..model.deepmod import DeepMoD
from typing import Optional
def train(model: DeepMoD,
data: torch.Tensor,
target... | 46.811189 | 246 | 0.60736 | [
"MIT"
] | GJBoth/MultiTaskPINN | src/multitaskpinn/training/.ipynb_checkpoints/training-checkpoint.py | 20,082 | Python |
#!/usr/bin/env python
import paho.mqtt.client as mqtt
import random
from logger import error, info
from message import Message
from pubsub import publish
MQTT_ERR_SUCCESS = 0
# MQTT client wrapper for use with Mainflux.
class MQTT:
# Initialize the class with topics that will be used
# during publish and po... | 37.333333 | 159 | 0.613487 | [
"MIT"
] | dustinengle/smart-mailbox | gateway/kit/mqtt.py | 4,256 | Python |
from .results import Result
class K4AException(Exception):
pass
class K4ATimeoutException(K4AException):
pass
def _verify_error(res: int):
"""
Validate k4a_module result
"""
res = Result(res)
if res == Result.Failed:
raise K4AException()
elif res == Result.Timeout:
... | 16.571429 | 40 | 0.658046 | [
"MIT"
] | 1079931505/ME336-Yellow-Team-SUSTech | deepclaw/driver/sensors/camera/pyk4a_cfg/errors.py | 348 | Python |
#!/usr/bin/env python
# Copyright (c) 2014, OpenCog Foundation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | 30.733577 | 163 | 0.644698 | [
"BSD-3-Clause"
] | geni-lab/ros_blender_bridge | src/ros_blender_plugin/urdf_exporter.py | 8,421 | Python |
# -*- coding: utf-8 -*-
"""Cisco Identity Services Engine SXPConnections API wrapper.
Copyright (c) 2021 Cisco and/or its affiliates.
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 restr... | 39.658273 | 128 | 0.549274 | [
"MIT"
] | CiscoISE/ciscoisesdk | ciscoisesdk/api/v3_0_0/sxp_connections.py | 44,100 | Python |
# Copyright 2015, 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 or agreed to in writing, s... | 30.348837 | 74 | 0.658238 | [
"Apache-2.0"
] | xiaopeng163/python-docs-samples | bigquery/tests/test_streaming.py | 1,305 | Python |
import RPi.GPIO as gpio
import time
class Tank:
def __init__(self, name):
self.name = name
def init(self):
gpio.setmode(gpio.BCM)
gpio.setup(17, gpio.OUT)
gpio.setup(22, gpio.OUT)
gpio.setup(23, gpio.OUT)
gpio.setup(24, gpio.OUT)
def forward(self):
... | 22.253333 | 75 | 0.52846 | [
"MIT"
] | JasonGreenwell/Tank-Platform | tank_standalone.py | 1,669 | Python |
import unittest
from ebird.api.validation import is_subnational1
class IsSubnational1Tests(unittest.TestCase):
"""Tests for the is_subnational1 validation function."""
def test_is_subnational1(self):
self.assertTrue(is_subnational1("US-NV"))
def test_invalid_code_is_not_subnational1(self):
... | 30.041667 | 60 | 0.744799 | [
"MIT"
] | ProjectBabbler/ebird-api | tests/validation/test_is_subnational1.py | 721 | Python |
# Copyright (c) 2021 - present / Neuralmagic, 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 b... | 35.206278 | 87 | 0.703605 | [
"Apache-2.0"
] | bharadwaj1098/sparseml | tests/sparseml/pytorch/optim/test_modifier_quantization.py | 7,851 | Python |
# =============================================================================
# periscope-ps (blipp)
#
# Copyright (c) 2013-2016, Trustees of Indiana University,
# All rights reserved.
#
# This software may be modified and distributed under the terms of the BSD
# license. See the COPYING file for details.
#
# ... | 38.835294 | 120 | 0.518025 | [
"BSD-3-Clause"
] | periscope-ps/blipp | blipp/conf.py | 6,602 | Python |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.10.3
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
import pandas as pd
from pyrfu... | 32.076923 | 97 | 0.641487 | [
"MIT"
] | CastroLab/pyrfume-data | snitz_2013/main.py | 1,668 | Python |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Deals with K-mers and K-mer distribution from reads or genome
"""
from __future__ import print_function
import os.path as op
import sys
import logging
import math
import numpy as np
from collections import defaultdict
from jcvi.graphics.base import (
plt,
as... | 29.156021 | 116 | 0.565364 | [
"BSD-2-Clause"
] | lufuhao/jcvi | jcvi/assembly/kmer.py | 27,844 | Python |
from contextlib import contextmanager
import sys
import importlib
from .base_evaluator import BaseEvaluator
class ModuleEvaluator(BaseEvaluator):
def __init__(self, internal_module):
super().__init__()
self._internal_module = internal_module
@classmethod
def from_configs(cls, config):
... | 32.34375 | 102 | 0.735266 | [
"Apache-2.0"
] | AnthonyQuantum/open_model_zoo | tools/accuracy_checker/accuracy_checker/evaluators/module_evaluator.py | 2,070 | Python |
import serial
import time
import datetime
import logging
from recordtype import recordtype
from enum import IntEnum, unique
from datetime import timedelta
import _thread
import readchar
import os
import sys
import threading
from collections import deque
import shutil
import binascii
START_CHAR = '02'
... | 53.631256 | 320 | 0.552652 | [
"Apache-2.0"
] | smartcommunitylab/vela-lab | gateway/dev/sink_integration/main.py | 52,507 | Python |
# MIT License
#
# Copyright (C) IBM Corporation 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
# rights to use, copy, modify, merge... | 43.621622 | 120 | 0.625099 | [
"MIT"
] | Viktour19/adversarial-robustness-toolbox | art/attacks/elastic_net.py | 17,754 | 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 ... | 54.466216 | 285 | 0.695613 | [
"MIT"
] | AriZavala2/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_02_01/operations/_service_endpoint_policy_definitions_operations.py | 24,183 | Python |
from typing import List, Optional
from .result import Result, Ok, Err
res1 = Ok('hello') # type: Result[str, int]
if isinstance(res1, Ok):
ok = res1 # type: Ok[str]
okValue = res1.ok() # type: str
mapped_to_float = res1.map_or(1.0, lambda s: len(s) * 1.5) # type: float
else:
err = res1 # type: E... | 26 | 83 | 0.628846 | [
"MIT"
] | PhilipTrauner/result | result/typetests.py | 520 | Python |
"""PyTorch optimizer builders."""
import argparse
import torch
from espnet.optimizer.factory import OptimizerFactoryInterface
from espnet.optimizer.parser import adadelta
from espnet.optimizer.parser import adam
from espnet.optimizer.parser import sgd
class AdamFactory(OptimizerFactoryInterface):
"""Adam factor... | 26.265957 | 82 | 0.624949 | [
"Apache-2.0"
] | 18445864529/espnet | espnet/optimizer/pytorch.py | 2,469 | Python |
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from salmonella.admin import SalmonellaMixin
from edw.models.postal_zone import PostZoneModel
# ===========================================================================================
# PostalZoneAdmin
# ============... | 28.48 | 93 | 0.549157 | [
"BSD-3-Clause"
] | EagerBeager/django-edw | backend/edw/admin/postal_zone.py | 712 | Python |
"""The Admin module for the Bower Cache registry."""
import logging
from django import forms
from django.core.exceptions import ValidationError
from django.conf import settings
from django.conf.urls import patterns, url
from django.contrib import admin, messages
from django.contrib.admin.views.main import ChangeList
f... | 36.830508 | 80 | 0.606228 | [
"MIT"
] | Tinche/django-bower-cache | registry/admin.py | 6,519 | Python |
import re
from typing import Pattern
from unittest import mock
import pytest
from faker import Faker, providers
from faker.providers.address.cs_CZ import Provider as CsCzAddressProvider
from faker.providers.address.da_DK import Provider as DaDkAddressProvider
from faker.providers.address.de_AT import Provider as DeA... | 39.442957 | 111 | 0.649366 | [
"MIT"
] | Pipoline/faker | tests/providers/test_address.py | 68,001 | Python |
from map.models import *
import requests
# initialize geo_info table, used to show choropleth map
def run():
try:
response = requests.get('http://www.ourd3js.com/map/china_provinces/beijing.json')
json_result = response.json()
for area in json_result.get('features'):
properties... | 32.555556 | 90 | 0.622867 | [
"MIT",
"Unlicense"
] | YogiAi/FinalProject_hmap | scripts/geoinfo.py | 586 | Python |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# type: ignore
import copy
import os
import platform
from dataclasses import dataclass
from pathlib import Path
from typing import List
import nox
from nox.logger import logger
BASE = os.path.abspath(os.path.dirname(__file__))
DEFAULT_PYTHON_VERS... | 30.297189 | 111 | 0.626591 | [
"MIT"
] | strx2322/hydra | noxfile.py | 15,088 | Python |
#vim: set encoding=utf-8
from django.core.urlresolvers import reverse
from django.http import Http404
from django.views.generic.base import TemplateView
from regulations.generator import generator
from regulations.generator.html_builder import HTMLBuilder
from regulations.generator.node_types import EMPTYPART, REGTEXT... | 35.822222 | 78 | 0.642473 | [
"CC0-1.0"
] | DalavanCloud/regulations-site | regulations/views/partial.py | 4,836 | Python |
# -*- coding: utf-8 -*-
import unittest
from pathlib import Path
from knipse.db import KnipseDB
from knipse.scan import scan_images
from knipse.lists import image_id_from_string
from .test_walk import EXPECTED_IMAGES
class TestKnipseDatabase(unittest.TestCase):
def setUp(self) -> None:
self.src = Path(... | 33.266667 | 76 | 0.624248 | [
"MIT"
] | luphord/knipse_old | tests/test_lists.py | 998 | Python |
from django.db import models
class Produto(models.Model):
descricao = models.CharField(max_length=30, null=False, blank='False')
preco = models.DecimalField(max_digits=5, decimal_places=2)
estoque = models.IntegerField()
def __str__(self):
return self.descricao + ' ' + str(self.preco)
| 28.454545 | 74 | 0.70607 | [
"MIT"
] | evaristofm/gestao-produtos | produtos/models.py | 313 | Python |
from .api.accounts import Accounts
from .api.classifications import Classifications
from .api.departments import Departments
from .api.currencies import Currencies
from .api.locations import Locations
from .api.vendor_bills import VendorBills
from .api.vendors import Vendors
from .internal.client import NetSuiteClient
... | 47.285714 | 137 | 0.775428 | [
"MIT"
] | Gzing/netsuite-sdk-py | netsuitesdk/connection.py | 993 | Python |
import user
import db
if __name__ == "__main__":
# Initializes the database if it doesn't already exist
engine = db.open_db('maintenance.db')
db.create_tables(engine)
# TODO: Make this selectable with arrow keys
while True:
print('\nSelect an option:\n1. View Service History\n2. Add a Car\n3. Add a Serv... | 33.294118 | 98 | 0.680212 | [
"MIT"
] | tshea113/maintenance-minder | src/main.py | 566 | Python |
#!/usr/bin/env python
import logging
from typing import (
Optional,
Dict,
List, Any)
from hummingbot.core.data_type.order_book import OrderBook
from sqlalchemy.engine import RowProxy
import hummingbot.connector.exchange.binarz.binarz_constants as constants
from hummingbot.connector.exchange.binarz.binarz... | 33.446809 | 113 | 0.628075 | [
"Apache-2.0"
] | amirhosein-fasihi/hummingbot | hummingbot/connector/exchange/binarz/binarz_order_book.py | 4,716 | Python |
import pygame
class TextSprite(pygame.sprite.Sprite):
"""Subclass of sprite to draw text to the screen"""
def __init__(self, position, text_lines, font, fg=(0, 0, 0), bg=None,
border_width=0, border_color=(0, 0, 0),
bold=False, italic=False, underline=False,
... | 36.625 | 116 | 0.590444 | [
"MIT"
] | bashkirtsevich/pytile | text_sprite.py | 2,344 | Python |
#!/usr/bin/env python
u"""
combine_kernels.py
by Yara Mohajerani
Combine the sensitivity kernels of the sum of the 'fixed points'
and produce netcdf and png outputs
Last Update 12/2020
"""
#-- load required modules
import os
import sys
import numpy as np
import geopandas as gpd
import matplotlib.pyplot as plt
from mp... | 39.707547 | 130 | 0.562842 | [
"MIT"
] | yaramohajerani/dynamic_mascons | combine_kernels.py | 4,209 | Python |
# coding: utf8
"""
Delphi Decision Maker - Controllers
"""
module = request.controller
resourcename = request.function
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
# =============================================================================
def index():
"""... | 36.84703 | 190 | 0.50308 | [
"MIT"
] | Code4SierraLeone/shdms | controllers/delphi.py | 45,285 | Python |
#Copyright (c) 2013 Marion Zepf
#Copyright (c) 2014 Walter Bender
#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, mod... | 35.363839 | 79 | 0.618633 | [
"MIT"
] | sugar-activities/4742-activity | TurtleArt/tatype.py | 15,843 | Python |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.svm import SVC
from O3 import prepare_data
from utils import plot_decision_regions
X_train, X_test, y_train, y_test = prepare_data(standardize=True,
split=True)
svm = SVC(kernel='rbf', random_state=1, g... | 24.419355 | 65 | 0.688243 | [
"MIT"
] | ShAlireza/ML-Tries | O3/_14_kernel_methods_linearly_inseparable_data/rbf_kernel_iris_dataset.py | 757 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Cisco Systems
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = r"""
---
module: anc_endpoint_apply
short_description: Resource module for Anc Endpoint Apply
description:
- Manage operation updat... | 25.126984 | 92 | 0.69362 | [
"Apache-2.0"
] | saeedya/docker-ansible | venv/lib/python3.8/site-packages/ansible_collections/cisco/ise/plugins/modules/anc_endpoint_apply.py | 1,583 | Python |
# -*- coding:utf-8 -*-
# =========================================================================== #
# Project : MLStudio #
# File : \test_preprocessing.py #
# Python : 3.8.3 ... | 52.42 | 146 | 0.572937 | [
"BSD-3-Clause"
] | DecisionScients/MLStudio | tests/test_data_services/test_preprocessing.py | 7,863 | Python |
# -*- coding: utf-8 -*-
# TheQube profile dialog
# A part of TheQube accessible social networking client
# Copyright © Andre Polykanine A.K.A. Menelion Elensúlë, 2014 — 2015
from logger import logger
logging = logger.getChild("sessions.twitter.gui.profile")
import config
import sessions
import wx
from ... | 58.053097 | 199 | 0.729726 | [
"MIT"
] | Oire/TheQube | src/session/twitter/gui/profile.py | 6,565 | Python |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 41.769231 | 96 | 0.638609 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | CoverGenius/airflow | airflow/sensors/base_sensor_operator.py | 9,231 | Python |
import numpy as np
import matplotlib.pyplot as plt
import bisect
from lmfit import Parameters
import astropy.constants as cst
from edibles.models import ContinuumModel, VoigtModel
from edibles.utils.edibles_spectrum import EdiblesSpectrum
class Sightline:
'''A model of the sightline between the telescope and the... | 33.404762 | 100 | 0.573447 | [
"MIT"
] | jancami/edibles | edibles/sightline.py | 15,433 | Python |
# _tmp_
import datetime
from copy import deepcopy
# _tmp_
from pymongo import MongoClient
import pymongo
import pandas as pd
import numpy as np
import sys
pd.options.mode.chained_assignment = None
class AnalyzerDatabaseManager(object):
def __init__(self, db_config, config):
self._db_config = db_config
... | 50.876923 | 158 | 0.629977 | [
"MIT"
] | JanRaik/X-Road-opmonitor | analysis_module/analyzer/AnalyzerDatabaseManager_tmp.py | 29,763 | Python |
import asyncio
from typing import List
import pytest
from hddcoin.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
from hddcoin.full_node.mempool_manager import MempoolManager
from hddcoin.simulator.simulator_protocol import FarmNewBlockProtocol
from hddcoin.types.blockchain_format.c... | 43.312727 | 120 | 0.702166 | [
"Apache-2.0"
] | HDDcoin-Network/hddcoin-blockchain | tests/wallet/cc_wallet/test_cc_wallet.py | 23,822 | Python |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 6 11:37:06 2018
@author: dkorff
"""
import numpy as np
import cantera as ct
from assimulo.problem import Implicit_Problem
from li_ion_battery_p2d_init import anode as an
from li_ion_battery_p2d_init import cathode as cat
from li_ion_battery_p2d_init import separator as... | 39.375 | 92 | 0.541711 | [
"BSD-3-Clause"
] | coresresearch/p2d_li_ion_battery | li_ion_battery_p2d_functions.py | 22,680 | Python |
import asyncio
import discord
from discord.ext.commands import Bot
from discord.ext import commands
from discord import Color, Embed
import backend.commands as db
from backend import strikechannel
# This command allows players to change their name.
#
# !name [new_name]
#
# This replaces the default nickname changin... | 25.537313 | 70 | 0.585038 | [
"Apache-2.0"
] | DaleNaci/AUC | commands/name.py | 1,711 | Python |
import json
import re
from types import FunctionType, LambdaType
_pattern_type = re.compile('t').__class__
class ConversionIndex(object):
def __init__(self, index_name=''):
self.o2t = {}
self.t2o = {}
self.name = index_name
def set_index(self, origin_index, target_index):
if ... | 29.7 | 95 | 0.518519 | [
"MIT"
] | chwnam/pymigrator | pymigrator/core/indices.py | 4,752 | Python |
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
# 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/LI... | 33.413793 | 78 | 0.745098 | [
"Apache-2.0"
] | AO-AO/cmss-cinder | cinder/tests/fake_hp_lefthand_client.py | 969 | Python |
FROM = 'vie-qs'
TO = 'fee-qs'
from_layer = Font.glyphs[FROM].layers[0]
XHEIGHT = Font.masters[0].xHeight
WIDTH = Font.masters[0].widthValue
to_layer = Font.glyphs[TO].layers[0] = from_layer.copyDecomposedLayer()
for path in to_layer.paths:
for node in path.nodes:
# mess with node.x and node.y
... | 23.8 | 71 | 0.632353 | [
"Apache-2.0"
] | adiabatic/abbots-morton-experiment | glyph-generation scripts/vie2fee.py | 476 | Python |
import torch
import numpy as np
class ScheduledOptim:
""" A simple wrapper class for learning rate scheduling """
def __init__(self, model, train_config, model_config, current_step):
self._optimizer = torch.optim.Adam(
model.parameters(),
betas=train_config["optimi... | 33.230769 | 85 | 0.595486 | [
"MIT"
] | ARBML/klaam | FastSpeech2/model/optimizer.py | 1,728 | Python |
#!/usr/bin/env python
"""
Analyze docstrings to detect errors.
If no argument is provided, it does a quick check of docstrings and returns
a csv with all API functions and results of basic checks.
If a function or method is provided in the form "pandas.function",
"pandas.module.class.method", etc. a list of all error... | 33.713775 | 79 | 0.566699 | [
"BSD-3-Clause"
] | Anjali2019/pandas | scripts/validate_docstrings.py | 18,846 | Python |
import itertools
def turn(face, dir):
nface=face[:]
if dir==1:
nface=[0, face[2],face[6],face[3],face[1],face[5],face[4]]
if dir==2:
nface=[0, face[3],face[2],face[6],face[4],face[1],face[5]]
if dir==3:
nface=[0, face[4],face[1],face[3],face[6],face[5],face[2]]
if dir==4:
... | 26.490196 | 66 | 0.510733 | [
"MIT"
] | njw1204/BOJ-AC | problem/01000~09999/02642/2642.py3.py | 1,351 | Python |
import subprocess
import math
import os
from pipes import quote
import platform
class Sorolla:
"""
Main class which will launch ImageMagick commands to apply selected
transformations to the given images.
It needs ImageMagick & GhostScript installed in the system and in PATH
to work properly
""... | 41.522968 | 129 | 0.512722 | [
"Apache-2.0"
] | bq/sorolla | sorolla/sorolla.py | 11,751 | Python |
#%%
# Our numerical workhorses
import numpy as np
import pandas as pd
import itertools
# Import libraries to parallelize processes
from joblib import Parallel, delayed
# Import matplotlib stuff for plotting
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib as mpl
# Seaborn, useful for grap... | 26.742574 | 82 | 0.733062 | [
"MIT"
] | RPGroup-PBoC/chann_cap | src/theory/scripts/channcap_protein_multi_prom_iptg_range.py | 2,701 | Python |
from settings import settings
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.caml_query import CamlQuery
from office365.sharepoint.client_context import ClientContext
list_title = "Survey"
view_title = "All Responses"
def print_list_views(ctx):
"""Read l... | 31.387097 | 90 | 0.684995 | [
"MIT"
] | Aisbergg/Office365-REST-Python-Client | examples/sharepoint/view_operations.py | 1,946 | Python |
from transform import Transform
import tensorflow as tf
class StyleTransferTester:
def __init__(self, session, content_image, model_path):
# session
self.sess = session
# input images
self.x0 = content_image
# input model
self.model_path = model_path
# ... | 23.396226 | 78 | 0.625806 | [
"Apache-2.0"
] | altonelli/tensorflow-fast-style-transfer | style_transfer_tester.py | 1,240 | Python |
from django.db import models
from .validators import validate_resume_ext
class Resume(models.Model):
name = models.CharField(max_length = 20)
phone = models.IntegerField()
email = models.EmailField()
resume = models.FileField(upload_to='resume/%Y/%m/%d/', validators=[validate_resume_ext])
uploaded_... | 36.909091 | 93 | 0.753695 | [
"MIT"
] | asisbagga-dev/RapidezWriter | rapidez/resumeAnalysis/models.py | 406 | Python |
from asyncio import iscoroutinefunction
from types import MethodType
from typing import Any
__all__ = ("VirtualStep",)
class VirtualStep:
def __init__(self, orig_step: MethodType) -> None:
self._orig_step: MethodType = orig_step
@property
def name(self) -> str:
return self._orig_step.__n... | 27.555556 | 86 | 0.677419 | [
"Apache-2.0"
] | nikitanovosibirsk/vedro | vedro/_core/_virtual_step.py | 744 | Python |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 33.438596 | 79 | 0.659496 | [
"MIT"
] | BrambleXu/SeqAL | docs/source/conf.py | 1,906 | Python |
import unittest
from gen_bst_seq import gen_bst_seq, Node
class Test_Case_Gen_Bst_Seq(unittest.TestCase):
def test_gen_bst_seq(self):
root = Node(2)
root.left_child = Node(1)
root.right_child = Node(3)
root.right_child.left_child = Node(4)
ans = gen_bst_seq(root)
sel... | 33.818182 | 63 | 0.647849 | [
"Apache-2.0"
] | angelusualle/algorithms | cracking_the_coding_interview_qs/4.9/get_bst_seq_test.py | 372 | Python |
# -*- coding: utf-8 -*-
if __name__ == "__main__":
raise Exception("Test files can't be run directly. Use `python -m pytest greenery`")
import pytest
from greenery.fsm import fsm, null, epsilon, anything_else
def test_addbug():
# Odd bug with fsm.__add__(), exposed by "[bc]*c"
int5A = fsm(
alphabet = {"a", "b",... | 24.898352 | 98 | 0.576906 | [
"MIT"
] | doni69/greenery | greenery/fsm_test.py | 18,126 | Python |
"""Tools for constructing domains for expressions. """
from sympy.core import sympify
from sympy.core.evalf import pure_complex
from sympy.polys.domains import ZZ, QQ, ZZ_I, QQ_I, EX
from sympy.polys.domains.complexfield import ComplexField
from sympy.polys.domains.realfield import RealField
from sympy.polys.polyopti... | 28.723333 | 83 | 0.555182 | [
"BSD-3-Clause"
] | ABKor752/sympy | sympy/polys/constructor.py | 8,617 | Python |
import keras
import os
from keras import losses
from keras.models import Model
from keras.layers import Input,merge, concatenate, Conv2D, MaxPooling2D, Activation, UpSampling2D,Dropout,Conv2DTranspose,add,multiply,Flatten,Dense
from keras.layers.normalization import BatchNormalization as bn
from keras.callbacks import ... | 35.4975 | 148 | 0.610747 | [
"MIT"
] | dsp-uga/rope | src/models/final_model.py | 14,199 | Python |
import json
import kfp.dsl as _kfp_dsl
import kfp.components as _kfp_components
from collections import OrderedDict
from kubernetes import client as k8s_client
def step1():
from kale.common import mlmdutils as _kale_mlmdutils
_kale_mlmdutils.init_metadata()
from kale.marshal.decorator import marshal as... | 34.480769 | 88 | 0.725739 | [
"Apache-2.0"
] | akravacyber/kale | backend/kale/tests/assets/kfp_dsl/simple_data_passing.py | 7,172 | Python |
import numpy as np
import matplotlib.pyplot as plt
from UTILS.Calculus import Calculus
from UTILS.SetAxisLimit import SetAxisLimit
from UTILS.Tools import Tools
from UTILS.Errors import Errors
import sys
# Theoretical background https://arxiv.org/abs/1401.5176
# Mocak, Meakin, Viallet, Arnett, 2014, Compressible Hyd... | 35.538922 | 131 | 0.563353 | [
"BSD-2-Clause"
] | mmicromegas/ransX | CANUTO1997/LuminosityEquation.py | 11,870 | Python |
import numpy as np
class Graph():
""" The Graph to model the skeletons extracted by the openpose
Args:
strategy (string): must be one of the follow candidates
- uniform: Uniform Labeling
- distance: Distance Partitioning
- spatial: Spatial Configuration
For more informa... | 41.91411 | 97 | 0.492096 | [
"MIT"
] | IkeaASM/ikea_asm_dataset | action/pose_based/net/utils/graph.py | 7,104 | Python |
import struct
class PEF:
MAGIC = b'Joy!'
CONT_HEAD_FMT = '>4s4s4s5I2HI'
CONT_HEAD_LEN = struct.calcsize(CONT_HEAD_FMT)
SEC_HEAD_FMT = '>i5I4B'
SEC_HED_LEN = struct.calcsize(SEC_HEAD_FMT)
@classmethod
def read_from(cls, path):
with open(path, 'rb') as f:
return... | 29.359551 | 122 | 0.574436 | [
"MIT"
] | elliotnunn/ToolboxToolbox | pefbinary.py | 2,613 | Python |
import os
from patricesorter._version import __version__
VERSION = __version__
COPYRIGHT = "Copyright (C) 2022"
LICENSE = "MIT"
| 16.25 | 46 | 0.776923 | [
"MIT"
] | PatriceJada/patricesorter | patricesorter/lib/defaults.py | 130 | Python |
from selenium.webdriver.support.select import Select
def get_selected_option(browser, css_selector):
# Takes a css selector for a <select> element and returns the value of
# the selected option
select = Select(browser.find_element_by_css_selector(css_selector))
return select.first_selected_option.get_a... | 42.25 | 74 | 0.792899 | [
"MIT"
] | egineering-llc/egat_example_project | tests/test_helpers/selenium_helper.py | 338 | Python |
import sys
import numpy as np
from contextlib import contextmanager
from qtpy.QtGui import QOpenGLBuffer
def setup_vertex_buffer(gl, data, shader, shader_variable):
'Setup a vertex buffer with `data` vertices as `shader_variable` on shader'
vbo = QOpenGLBuffer(QOpenGLBuffer.VertexBuffer)
vbo.create()
... | 33.418367 | 79 | 0.651908 | [
"BSD-3-Clause"
] | klauer/caproto-image-viewer | caimageviewer/gl_util.py | 3,275 | Python |
import base64 as _base64
import hashlib as _hashlib
import http.server as _BaseHTTPServer
import os as _os
import re as _re
import urllib.parse as _urlparse
import webbrowser as _webbrowser
from http import HTTPStatus as _StatusCodes
from multiprocessing import get_context as _mp_get_context
from urllib.parse import ur... | 36.769481 | 141 | 0.680442 | [
"Apache-2.0"
] | AdrianoKF/flytekit | flytekit/clis/auth/auth.py | 11,325 | Python |
# Copyright (c) 2012-2016 Seafile Ltd.
import logging
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import status
from seaserv import seafile_a... | 35.405063 | 93 | 0.618401 | [
"Apache-2.0"
] | DMKun/seahub | seahub/api2/endpoints/admin/group_members.py | 8,391 | Python |
import os
import cv2
import time
import argparse
import multiprocessing
import numpy as np
import tools.find_mxnet
import mxnet as mx
import sys
from detect.image_detector import ImageDetector
from symbol.symbol_factory import get_symbol
from utils import WebcamVideoStream
class_names = 'Argentina, Australia, Bhutan,... | 41.556701 | 112 | 0.711734 | [
"MIT"
] | Prasad9/Detect-Flags-SSD | object_detection_app.py | 4,031 | Python |
# Copyright 2013 Rackspace Hosting
#
# 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 ... | 39.541568 | 79 | 0.554634 | [
"Apache-2.0"
] | ChinaMassClouds/horizon | openstack_dashboard/contrib/trove/content/databases/workflows/create_instance.py | 16,647 | Python |
from typing import NamedTuple
from inari._internal import _format
from ward import each, test, using
class Fixtures(NamedTuple):
raw_description: str
attributes: str
result: str
simple = Fixtures(
raw_description="- var (`object`): Target object.",
attributes="",
result="- **var** (`object`... | 27.217391 | 85 | 0.622471 | [
"MIT"
] | tkamenoko/inari | tests/_internal/test_format.py | 1,878 | Python |
from tkinter import *
from time import *
## 전역 변수 선언 부분 ##
fnameList = ["jeju1.gif", "jeju2.gif", "jeju3.gif", "jeju4.gif", "jeju5.gif", "jeju6.gif", "jeju7.gif", "jeju8.gif", "jeju9.gif", "jeju10.gif"]
photoList = [None] * 9
num1,num2,num3 = 0,1,2
## 함수 선언 부분 ##
def clickNext() :
global num1,num2,num3
num1... | 27.696296 | 143 | 0.635999 | [
"Apache-2.0"
] | define16/Class | 4-1/WIndow Programing/20180502/p1.py | 3,809 | Python |
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
import pytest
import asyncio
from unittest.mock import patch, call, MagicMock
from foglamp.common import logger
from foglamp.common.storage_client.storage_client import ReadingsStorageClient, StorageClient
from foglamp.common.... | 50.726923 | 116 | 0.600804 | [
"Apache-2.0"
] | ThyagOSI/FogLAMP | tests/unit/python/foglamp/tasks/purge/test_purge.py | 13,189 | Python |
T = int(input())
if 1 <= T <= 100:
for i in range(T):
A = int(input())
B = int(input())
C = int(input())
if (1 <= A <= 10 ** 16) and (1 <= B <= 10 ** 16) and (1 <= C <= 10 ** 16):
for x in range(A, B + 1):
if x % C == 0:
print(x)
| 26.25 | 82 | 0.336508 | [
"MIT"
] | thisIsShikhar/subeen_52problemsSolve | Problem 33.py | 315 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.