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 |
|---|---|---|---|---|---|---|---|---|
#!/usr/bin/env python
# import general use modules
import os
from pprint import pprint as pp
# import nornir specifics
from nornir import InitNornir
from nornir.plugins.functions.text import print_result
from nornir.core.filter import F
nr = InitNornir()
hosts = nr.inventory.hosts
arista1_filter = nr.filter(name="ari... | 21.617647 | 55 | 0.794558 | [
"MIT"
] | papri-entropy/nornir-course | class3/exercise2/exercise2.py | 735 | Python |
# -*- coding: utf-8 -*-
#
# Political Dynamics documentation build configuration file, created by
# sphinx-quickstart.
#
# 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 configuration va... | 32.420408 | 127 | 0.709178 | [
"MIT"
] | aryamccarthy/ANES | docs/conf.py | 7,943 | Python |
# Copyright 2020 University of New South Wales, University of Sydney, Ingham Institute
# 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
# Unle... | 35.918436 | 103 | 0.613339 | [
"Apache-2.0"
] | RadiotherapyAI/platipy | platipy/imaging/projects/cardiac/run.py | 32,147 | Python |
from behave import *
import requests
from django.contrib.auth.models import User
from rest_framework.authtoken.models import Token
from host.models import Event
use_step_matcher("re")
# @given("that I am a registered host of privilege walk events and want to create questions and answer choices for the event")
# de... | 29.925926 | 126 | 0.591894 | [
"MIT"
] | Privilege-walk/back-end | behave_tests/steps/create_question.py | 6,464 | Python |
import logging
import unittest
import random
from math import sqrt
from scipy.stats import chisquare
from type_system import Type, PolymorphicType, PrimitiveType, Arrow, List, UnknownType, INT, BOOL, STRING
from program import Program, Function, Variable, BasicPrimitive, New
from program_as_list import evaluation_from... | 35.025641 | 105 | 0.640922 | [
"MIT"
] | agissaud/DeepSynth | unit_tests_programs.py | 2,732 | Python |
from enum import Enum
class ProcMessage(Enum):
SYNC_MODEL = 1
class JobCompletions():
SENDER_ID = 1
STATUS = True
RESULTS = {}
ERRORS = ""
| 13.5 | 24 | 0.623457 | [
"Apache-2.0"
] | rharish101/RecoEdge | fedrec/communications/messages.py | 162 | Python |
import os
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
def prerelease_local_scheme(version):
"""
Return local scheme version unless building on master in CircleCI.
This function returns the local scheme version number
(e.g. 0.0.0... | 32.920635 | 70 | 0.653809 | [
"Apache-2.0"
] | abcsFrederick/HistomicsUI | setup.py | 2,074 | Python |
import copy
import functools
import warnings
from types import MethodType
from typing import Dict, List, Optional, Type, Union
import dill
import pandas as pd
from feast.base_feature_view import BaseFeatureView
from feast.data_source import RequestSource
from feast.errors import RegistryInferenceFailure, SpecifiedFea... | 42.14188 | 111 | 0.612461 | [
"Apache-2.0"
] | aurobindoc/feast | sdk/python/feast/on_demand_feature_view.py | 24,653 | Python |
#!/usr/bin/env python
# coding=utf8
from copy import deepcopy
class Deque:
def __init__(self):
self.data = []
def addFront(self, item):
self.data.insert(0, item)
def addTail(self, item):
self.data.append(item)
def removeFront(self):
if self.size() == 0:
... | 21.6 | 72 | 0.564815 | [
"MIT"
] | igelfiend/Python.Structures.Deque | palindrome_check.py | 1,080 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from PyQt5 import QtWidgets, QtGui, QtCore
import sys, os.path as op
path1 = op.join( op.abspath(op.dirname(__file__)), '..', 'Structure')
path2 = op.join( op.abspath(op.dirname(__file__)), '..')
sys.path.append(path1)
sys.path.append(path2)
from Structure import *
from V... | 38.885246 | 85 | 0.643339 | [
"MIT"
] | bochkovoi/AHP | src/gui/SubVision.py | 2,955 | Python |
#!/usr/bin/env python
#version 2.1
from PyQt4 import QtGui
from PyQt4 import QtCore
from PyQt4 import Qt
import PyQt4.Qwt5 as Qwt
from PyQt4.QtCore import pyqtSignal
class control_button_frame(QtGui.QFrame):
def __init__(self, parent=None, az_el = None):
super(control_button_frame, self).__init__()
... | 34.217391 | 83 | 0.694197 | [
"MIT"
] | vt-gs/tracking | gui/v2.1/control_button_frame.py | 2,361 | Python |
'''base config for emanet'''
# config for dataset
DATASET_CFG = {
'train': {
'type': '',
'set': 'train',
'rootdir': '',
'aug_opts': [('Resize', {'output_size': (2048, 512), 'keep_ratio': True, 'scale_range': (0.5, 2.0)}),
('RandomCrop', {'crop_size': (512, 512), ... | 27.457364 | 109 | 0.474873 | [
"MIT"
] | skydengyao/sssegmentation | ssseg/cfgs/emanet/base_cfg.py | 3,542 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-05-29 06:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djeddit', '0001_initial'),
]
operations = [
migrations.AddField(
... | 21 | 53 | 0.60771 | [
"Apache-2.0"
] | EatEmAll/django-djedd | djeddit/migrations/0002_thread_locked.py | 441 | Python |
from collections import defaultdict
class Graph:
def __init__(self, numberOfNodes):
self.numberOfNodes = numberOfNodes+1
self.graph = [[0 for x in range(numberOfNodes+1)]
for y in range(numberOfNodes+1)]
def withInBounds(self, v1, v2):
return (v1 >= 0 and v1 <= s... | 25 | 96 | 0.575484 | [
"MIT"
] | PawanRamaMali/LeetCode | Graphs/graphs creation/directed graph/adjacency matrix/index.py | 775 | Python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import logging
import re
import os
import requests
from builtins import str
from typing import Text, List, Dict, Any
logger = logging.getLogger(__name__)
I... | 34.890756 | 108 | 0.53408 | [
"Apache-2.0"
] | RocketChat/rasa_core | rasa_core/interpreter.py | 8,304 | Python |
# Copyright 2022 The SeqIO 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 applicable law or agreed to in wr... | 38.483539 | 107 | 0.647989 | [
"Apache-2.0"
] | 00mjk/seqio | seqio/dataset_providers_test.py | 56,109 | Python |
from copy import copy
from typing import Optional
import torch
import pytorch_lightning as pl
from transformers import (
EncoderDecoderModel,
RobertaModel,
RobertaConfig,
GPT2LMHeadModel,
GPT2Config,
RobertaTokenizer,
GPT2Tokenizer,
AdamW,
get_linear_schedule_with_warmup,
)
import ... | 42.313433 | 124 | 0.663139 | [
"MIT"
] | saridormi/commit_message_generation | src/model/encoder_decoder_module.py | 8,505 | Python |
from soup import soup_collector
def name_collector(spl_id, spl_type):
soup = soup_collector(spl_id, spl_type)
sample_info_type = soup.findAll('a')
#unwanted till now START
try:
sample_info_name1 = sample_info_type[0].get('name').split('_')[1].strip()
sample_info_name2 = sample_info... | 33.588235 | 81 | 0.677758 | [
"MIT"
] | 0x0is1/drhelp | src/name_collect.py | 571 | Python |
import os
import numpy as np
from glob import glob
from scipy import optimize, spatial, ndimage
from tifffile import imread, imsave
from skimage.segmentation import find_boundaries
from skimage.morphology import remove_small_objects
from skimage.draw import line
from utils import random_colormap
import pdb
# define bi... | 35.741784 | 105 | 0.574544 | [
"BSD-2-Clause"
] | MMV-Lab/cell_movie_analysis | run_tracking.py | 7,613 | Python |
from __future__ import print_function
import sys
import datetime
import random
def main(n):
start = -86400 * 365 * 20
end = 86400 * 365
filename = 'testdata-' + str(n) + '.txt'
with open(filename, 'w') as fp:
now = datetime.datetime.now()
for i in range(n):
d = datetime.tim... | 26.692308 | 70 | 0.573487 | [
"MIT"
] | Paradise02/Interviews | Beijin-Tuiwen/Python/gen_data.py | 694 | Python |
import ast
import csv
import logging
import math
import os
from nose_parameterized import parameterized
import numpy
import SimpleITK as sitk
import six
from radiomics import getTestCase, imageoperations
# Get the logger. This is done outside the class, as it is needed by both the class and the custom_name_func
log... | 36.228792 | 122 | 0.67679 | [
"BSD-3-Clause"
] | NPCC-Joe/Radiomics-pyradiomics | tests/testUtils.py | 14,093 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# IntegrityError Exception for checking duplicate entry,
# connection import to establish connection to database
from django.db import IntegrityError, connection
# Used for serializing object data to json string
from django.core.serializers.json impor... | 33.545455 | 104 | 0.714995 | [
"MIT"
] | lawrence-gandhar/data_security_project | app/views/combiners_views.py | 2,214 | Python |
# -*- coding: utf-8 -*-
# This script was written by Takashi SUGA on April-August 2017
# You may use and/or modify this file according to the license described in the MIT LICENSE.txt file https://raw.githubusercontent.com/suchowan/watson-api-client/master
"""『重要文抽出によるWebページ要約のためのHTMLテキスト分割』
http://harp.lib.hiroshim... | 36.413793 | 168 | 0.566288 | [
"CC0-1.0"
] | suchowan/bookmarks | scripts/python/html2plaintext.py | 6,788 | Python |
from django.contrib import admin
from graphite.events.models import Event
class EventsAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'fields': ('when', 'what', 'data', 'tags',)
}),
)
list_display = ('when', 'what', 'data',)
list_filter = ('what',)
search_fields = ('tag... | 22.9375 | 55 | 0.594005 | [
"Apache-2.0"
] | drax68/graphite-web | webapp/graphite/events/admin.py | 367 | Python |
# coding: utf-8
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 34.312217 | 245 | 0.66148 | [
"Apache-2.0"
] | revnav/sandbox | darling_ansible/python_venv/lib/python3.7/site-packages/oci/waas/models/update_http_redirect_details.py | 7,583 | Python |
#sum = 10
def func1():
#sum = 20
print('Local1:', sum)
def func2():
#sum = 30
print('Local 2:', sum)
func2()
func1()
print("Global:", sum([1, 2, 3]))
| 11.6875 | 32 | 0.459893 | [
"Apache-2.0"
] | zevgenia/Python_shultais | Course/functions/example_12.py | 187 | Python |
from __future__ import annotations
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri
from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode
from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType
# This file is auto-generated by generate_classes so do not edi... | 30.941176 | 84 | 0.773764 | [
"Apache-2.0"
] | icanbwell/SparkAutoMapper.FHIR | spark_auto_mapper_fhir/value_sets/contract_resource_asset_availiability_codes.py | 1,052 | Python |
# -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... | 38.863636 | 106 | 0.65731 | [
"MIT"
] | NiuRc/vega | vega/datasets/transforms/RandomMirrow_pair.py | 1,710 | Python |
import pytest
import autofit as af
from autofit.mock import mock as m
@pytest.fixture(
name="target_gaussian"
)
def make_target_gaussian():
return af.PriorModel(
m.Gaussian
)
@pytest.fixture(
name="prior"
)
def make_prior():
return af.UniformPrior()
@pytest.fixtu... | 20.335616 | 60 | 0.616201 | [
"MIT"
] | rhayes777/PyAutoF | test_autofit/mapper/test_take_attributes.py | 5,938 | Python |
#
# Copyright 2017 Alsanium, SAS. 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | 28.205882 | 92 | 0.727842 | [
"Apache-2.0"
] | LIVEauctioneers/aws-lambda-go-shim | tests/sig_param_count/test.py | 959 | Python |
# USAGE
# python hard_negative_mine.py --conf conf/cars.json
# import the necessary packages
from __future__ import print_function
from pyimagesearch.object_detection import ObjectDetector
from pyimagesearch.descriptors import HOG
from pyimagesearch.utils import dataset
from pyimagesearch.utils import Conf
from imutil... | 37.369863 | 96 | 0.752933 | [
"Apache-2.0"
] | CactusJackFX/PyImageSearch_Guru | Module_02_Building_Your_Own_Custom_Object_Detector/2.10_Re-Training_and_Running_your_Classifier/hard_negative_mine.py | 2,728 | Python |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2022 Valory AG
# Copyright 2018-2021 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... | 35.404494 | 95 | 0.671215 | [
"Apache-2.0"
] | valory-xyz/agents-aea | tests/test_docs/test_standalone_transaction/test_standalone_transaction.py | 3,151 | Python |
"""Python wrappers around TensorFlow ops.
This file is MACHINE GENERATED! Do not edit.
"""
import collections as _collections
from tensorflow.python.eager import execute as _execute
from tensorflow.python.eager import context as _context
from tensorflow.python.eager import core as _core
from tensorflow.python.framew... | 38.891026 | 247 | 0.647602 | [
"Apache-2.0"
] | gian1312/suchen | tensorflow/contrib/periodic_resample/python/ops/gen_periodic_resample_op.py | 6,067 | Python |
import os
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY')
SQLALCHEMY_TRACK_MODIFICATIONS = False
UPLOADED_PHOTOS_DEST = 'app/static/photos'
# email configurations
MAIL_SERVER = 'smtp.googlemail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.get("MAIL_USER... | 22.791667 | 100 | 0.707495 | [
"Unlicense"
] | AnnabelNkir/My_Hello_World | config.py | 1,094 | Python |
import os
import re
import sys
import uuid
import redis
from cryptography.fernet import Fernet
from flask import abort, Flask, render_template, request
from redis.exceptions import ConnectionError
from werkzeug.urls import url_quote_plus
from werkzeug.urls import url_unquote_plus
NO_SSL = os.environ.get('NO_SSL', Fa... | 27.292929 | 80 | 0.690044 | [
"MIT"
] | 47Billion/snappass | snappass/main.py | 5,404 | Python |
# Copyright 2021 Hathor Labs
#
# 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... | 33.397059 | 93 | 0.69749 | [
"Apache-2.0"
] | HathorNetwork/hathor-core | hathor/p2p/states/base.py | 2,271 | Python |
"""This module contains wunderkafka producer's boilerplate."""
| 31.5 | 62 | 0.777778 | [
"Apache-2.0"
] | severstal-digital/wunderkafka | wunderkafka/producers/__init__.py | 63 | Python |
from typing import List, Optional
from pydantic import BaseModel
from typing_extensions import Literal
from .request import BaseResponseData, CountOffsetParams, ListRequestParams, ListResponseData
from .tag import Tag
from .user import CommonUserDetails
class Comment(BaseModel):
# The ID of the post
aweme_i... | 22.630952 | 93 | 0.696476 | [
"MIT"
] | MikeOwino/tiktok_bot | tiktok_bot/models/comment.py | 1,901 | Python |
import pytest
from datetime import datetime, timedelta
import pytz
from bs4 import BeautifulSoup
from src.events import Events
from src.users import Users
from src.user import USER_ACCESS_MANAGER
from src.stores import MemoryStore
from src.email_generators import EventLocationChangedEmail
def test_event_location_chan... | 38.375 | 85 | 0.664495 | [
"MIT"
] | fjacob21/mididecweb | backend/tests/email_generators/test_event_location_changed.py | 1,228 | Python |
import mmcv
def wider_face_classes():
return ['face']
def voc_classes():
return [
'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat',
'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person',
'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor'
]
... | 46.834711 | 84 | 0.575437 | [
"Apache-2.0"
] | UESTC-Liuxin/TianChi | my_configs/new/mmdet/core/evaluation/class_names.py | 5,827 | Python |
# /usr/bin/env python3
"""Benchmark of handling PDB files comparing multiple libraries."""
import argparse
import glob
import os
import re
import subprocess
import sys
from pathlib import Path
def gather_libs(selected_libs):
libs = []
for path in sorted(glob.iglob("bench/*")):
lib = os.path.basename... | 29.409524 | 84 | 0.589702 | [
"MIT"
] | franciscoadasme/pdb-bench | run.py | 3,088 | Python |
#!/usr/bin/env python3
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Various small unit tests
import io
import itertools
import json
import xml.etree.ElementTree
from yt_dlp.compat import (
compat_chr,
compat_e... | 46.417534 | 382 | 0.604141 | [
"Unlicense"
] | Yessssman/yt-dlp | test/test_utils.py | 84,977 | Python |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#pylint: skip-file
from nose.tools import assert_equal
from iot_message.cryptor.plain import Cryptor
from iot_message.message import Message
__author__ = 'Bartosz Kościów'
import iot_message.factory as factory
class TestCryptorPlain(object):
def setUp(self):
... | 33.95122 | 166 | 0.630747 | [
"MIT"
] | bkosciow/python_iot-1 | iot_message/tests/test_plain_cryptor.py | 1,394 | Python |
#! /usr/bin/env python
import os
os.mkdir('_testing')
os.chdir('_testing')
os.environ['MPLBACKEND'] = 'Agg'
from pymt.components import FrostNumberGeoModel as Model
model = Model()
for default in model.defaults:
print('{name}: {val} {units}'.format(
name=default[0], val=default[1][0], units=default[1][1... | 21.6 | 65 | 0.682099 | [
"MIT"
] | csdms-stack/permamodel-frostnumbergeo-csdms-recipe | recipe/run_test.py | 324 | Python |
__author__ = 'tinglev'
import logging
import requests
from requests import HTTPError, ConnectTimeout, RequestException
from modules import environment
from modules.subscribers.slack import slack_util
from modules.event_system.event_system import subscribe_to_event, unsubscribe_from_event
from modules import deployment... | 31.561404 | 117 | 0.740411 | [
"MIT"
] | KTH/alvares | modules/subscribers/flottsbro/flottsbro.py | 1,799 | Python |
"""
This module stores constants used during the operations of the UI.
"""
# Application info.
CM_NAME = "CovertMark"
CM_VER = "0.1"
CM_RELEASE = "alpha"
CM_AUTHOR = "C Shi"
CM_LINK = "https://github.com/chongyangshi"
CM_LICENSE = "Please see LICENSE.md for terms of usage of this program."
CM_TITLE = """\
_____ ... | 33.367347 | 180 | 0.582875 | [
"MIT"
] | chongyangshi/CovertMark | CovertMark/constants.py | 1,635 | Python |
import matplotlib.pyplot as plt
import numpy as np
def gen_data(n, start=0, end=10):
x = np.linspace(start, end, n)
y = np.sin(10*x) - x*x
return y
def gen_data_osc(n):
return np.array([1024 + (-2)**(-i/100) for i in range(n)])
def gen_data_rand(n):
return np.random.randn(n) + 0.3*np.... | 24.862069 | 78 | 0.613731 | [
"MIT"
] | Raphael-C-Almeida/Wireless-Sensor-Network | Data Fusion Test/Minimos Quadrados Puro.py | 1,446 | Python |
import numpy as np
from time import sleep
import torch
import torch.nn as nn
import torch.nn.functional as F
from core.models.common_layers import batch_norm, get_nddr
from core.tasks import get_tasks
from core.utils import AttrDict
from core.utils.losses import poly
class SingleTaskNet(nn.Module):
def __init__... | 36.414773 | 124 | 0.559058 | [
"Apache-2.0"
] | WZzhaoyi/MTLNAS | core/models/nddr_net.py | 6,409 | Python |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class SteamScrapeSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# sc... | 34.663462 | 78 | 0.666852 | [
"MIT"
] | argwood/IndieP | steam-scrapy/steam_scrape/middlewares.py | 3,607 | Python |
"""The tests for the Canary sensor platform."""
import copy
import unittest
from unittest.mock import Mock
from homeassistant.components.canary import DATA_CANARY
from homeassistant.components.sensor import canary
from homeassistant.components.sensor.canary import CanarySensor, \
SENSOR_TYPES, ATTR_AIR_QUALITY, ST... | 34.219512 | 79 | 0.648753 | [
"Apache-2.0"
] | 27tech/home-assistant | tests/components/sensor/test_canary.py | 7,016 | Python |
import linelib
import datetime
import signal
def handler(x, y):
pass
signal.signal(signal.SIGUSR1, handler)
signal.signal(signal.SIGALRM, handler)
while True:
linelib.sendblock("date", {"full_text": datetime.datetime.now().strftime(
"%Y-%m-%e %H:%M:%S"
)})
linelib.sendPID("date")
linelib... | 18.444444 | 77 | 0.671687 | [
"MIT"
] | 5225225/bar | modules/timeblock.py | 332 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-07 21:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0002_auto_20160706_2232'),
]
operations = [
migrations.AlterField(
... | 23 | 74 | 0.6294 | [
"MIT"
] | otherland8/market-place | market_place/users/migrations/0003_auto_20160708_0036.py | 483 | Python |
# Copyright (c) 2020 DDN. All rights reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
from collections import defaultdict
import json
from django.db.models import Q
from django.contrib.contenttypes.models import ContentType
class LockCache(object):
... | 33.028571 | 103 | 0.632353 | [
"MIT"
] | beevans/integrated-manager-for-lustre | chroma_core/services/job_scheduler/lock_cache.py | 4,624 | Python |
from django.urls import path, include
urlpatterns = [
path('', include(('rest_friendship.urls', 'rest_friendship'), namespace='rest_friendship')),
]
| 25.666667 | 96 | 0.720779 | [
"ISC"
] | sflems/django-rest-friendship | tests/urls.py | 154 | Python |
#for fixture loading
| 10.5 | 20 | 0.809524 | [
"BSD-2-Clause"
] | chalkchisel/django-rest-framework | examples/permissionsexample/models.py | 21 | Python |
"""
Support for interfacing with the XBMC/Kodi JSON-RPC API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.kodi/
"""
import asyncio
import logging
import urllib
import aiohttp
import voluptuous as vol
from homeassistant.components.media_p... | 33.4 | 78 | 0.621876 | [
"MIT"
] | sbidoul/home-assistant | homeassistant/components/media_player/kodi.py | 12,525 | Python |
## DQN Tutorial
## Implementation from https://github.com/FitMachineLearning
import torch
import gym
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
from dataclasses import dataclass
from typing import Any
from random import random
@dataclass
class sa... | 34.992063 | 99 | 0.608528 | [
"MIT"
] | FitMachineLearning/FitML | Pytorch/ActorCritic/agent_and_model.py | 4,409 | Python |
""" library to take autodiff and execute a computation graph """
from __future__ import absolute_import
import numpy as np
from .Node import Op
from .. import ndarray
from ..stream import *
import ctypes
import os
from pynvml import *
FLAG_SHOW_GRAPH = False
G_NODE_ID = 0
NAME_RULE = 1
def communicate_init(worker_nu... | 40.091973 | 116 | 0.591074 | [
"Apache-2.0"
] | DMALab/TSplit | python/athena/gpu_ops/StreamExecutor.py | 23,975 | Python |
"""
TickerHandler
This implements an efficient Ticker which uses a subscription
model to 'tick' subscribed objects at regular intervals.
The ticker mechanism is used by importing and accessing
the instantiated TICKER_HANDLER instance in this module. This
instance is run by the server; it will save its status across
s... | 38.568966 | 125 | 0.60903 | [
"BSD-3-Clause"
] | orkim/evennia | evennia/scripts/tickerhandler.py | 22,370 | Python |
# ======================================================================
# The Stars Align
# Advent of Code 2018 Day 10 -- Eric Wastl -- https://adventofcode.com
#
# Python implementation by Dr. Dean Earl Wright III
# ======================================================================
# ==========================... | 35.179641 | 91 | 0.372936 | [
"MIT"
] | deanearlwright/AdventOfCode | 2018/10_TheStarsAlign/aoc_10.py | 5,875 | Python |
from pyecharts import options as opts
from pyecharts.charts import Map
import pandas as pd
import namemap
def read_country_code():
"""
获取国家中英文字典
:return:
"""
country_dict = {}
for key, val in namemap.nameMap.items(): # 将 nameMap 列表里面键值互换
country_dict[val] = key
return ... | 60.101266 | 1,829 | 0.624684 | [
"MIT"
] | DearCasper/python-learning | python-data-analysis/2019-nCoV-global/global_map.py | 5,031 | Python |
"""
2. Categorical Predictors
=========================
"""
###############################################################################
# The syntax for handling categorical predictors is **different** between standard regression models/two-stage-models (i.e. :code:`Lm` and :code:`Lm2`) and multi-level models (:co... | 69.398496 | 843 | 0.638245 | [
"MIT"
] | Shotgunosine/pymer4 | docs/auto_examples/example_02_categorical.py | 9,230 | Python |
# print('Reading templates/__init__.py')
from .errors import *
import logging
logging.debug('Reading src/templates/__init__.py')
| 18.714286 | 50 | 0.770992 | [
"MIT"
] | honzatomek/pythonFEA | src/pythonFEA/templates/__init__.py | 131 | Python |
from raw.ndfd import *
| 11.5 | 22 | 0.73913 | [
"Apache-2.0"
] | EliteUSA/pyxb | examples/ndfd/ndfd.py | 23 | Python |
import multiprocessing
import warnings
import six
from chainer.backends import cuda
from chainer.dataset import convert
from chainer import reporter
from chainer.training.updaters import standard_updater
try:
from cupy.cuda import nccl
_available = True
except Exception:
_available = False
import numpy... | 33.567623 | 79 | 0.561687 | [
"MIT"
] | Lynkzhang/Chainer-UM | chainer/training/updaters/multiprocess_parallel_updater.py | 16,381 | Python |
import libtmux
def ensure_server() -> libtmux.Server:
'''
Either create new or return existing server
'''
return libtmux.Server()
def spawn_session(name: str, kubeconfig_location: str, server: libtmux.Server):
if server.has_session(name):
return
else:
session = server.new_ses... | 32.421053 | 109 | 0.719156 | [
"MIT"
] | kiemlicz/kmux | kmux/tmux.py | 616 | Python |
import numpy as np
import cv2
from PIL import Image
img_form = "jpg"
img_out_dir = "./output_images"
vid_form = "mp4"
vid_out_dir = "./test_videos_output"
class array_image:
def __init__(self):
self.image = None
self.binary_image = None
def store(self, name):
name = img_out_dir + "/" ... | 34.615385 | 128 | 0.563492 | [
"MIT"
] | mhhm2005eg/CarND-Advanced-Lane-Lines | color.py | 3,150 | Python |
import numpy as np
from network.activation import Activation
from network.layer import Layer
from network.utils.im2col_cython import im2col_cython, col2im_cython
class Convolution(Layer):
def __init__(self, filter_shape, stride, padding, dropout_rate: float = 0, activation: Activation = None,
la... | 40.384 | 133 | 0.602813 | [
"MIT"
] | metataro/DirectFeedbackAlignment | network/layers/convolution_im2col.py | 5,048 | Python |
#!/usr/bin/python
#
# Copyright 2018-2022 Polyaxon, 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 ... | 39.448718 | 88 | 0.702632 | [
"Apache-2.0"
] | polyaxon/cli | cli/tests/test_cli/test_artifacts.py | 3,077 | Python |
#encoding:utf-8
subreddit = 'rainbow6'
t_channel = '@r_rainbow6'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| 15.444444 | 38 | 0.741007 | [
"MIT"
] | AliannejadiPourya/reddit2telegram | reddit2telegram/channels/r_rainbow6/app.py | 139 | Python |
version = '2.9.0'
| 9.5 | 18 | 0.526316 | [
"MIT"
] | pozi/PoziConnect | app/PoziConnect/version.py | 19 | Python |
import asyncio
import logging
from typing import Dict, List, Optional, Set, Tuple
from seno.types.blockchain_format.sized_bytes import bytes32
from seno.util.ints import uint32, uint128
log = logging.getLogger(__name__)
class SyncStore:
# Whether or not we are syncing
sync_mode: bool
long_sync: bool
... | 35.992701 | 119 | 0.653012 | [
"Apache-2.0"
] | AcidBurnSB/seno-blockchain | seno/full_node/sync_store.py | 4,931 | Python |
# coding: utf-8
"""
Mailchimp Marketing API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 3.0.74
Contact: apihelp@mailchimp.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import... | 31.934426 | 273 | 0.61345 | [
"Apache-2.0"
] | RWiggers/mailchimp-marketing-asyncio | mailchimp_marketing_asyncio/models/add_list_members1.py | 15,584 | Python |
#Curso Python #06 - Condições Aninhadas
#Primeiro Exemplo
#nome = str(input('Qual é seu Nome: '))
#if nome == 'Jefferson':
# print('Que Nome Bonito')
#else:
# print('Seu nome é bem normal.')
#print('Tenha um bom dia, {}'.format(nome))
#Segundo Exemplo
nome = str(input('Qual é seu Nome: '))
if nome == 'Jeffers... | 27.478261 | 60 | 0.648734 | [
"MIT"
] | ElHa07/Python | Curso Python/Aula06/CondicoesAinhada.py | 640 | Python |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_space_comm_station_talus.iff"
result.attribute_template_id = 9... | 26.588235 | 70 | 0.734513 | [
"MIT"
] | SWGANHServices/GameServer_Legacy | data/scripts/templates/object/mobile/shared_space_comm_station_talus.py | 452 | Python |
"""Config flow to configure Xiaomi Miio."""
import logging
from re import search
from micloud import MiCloud
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import SOURCE_REAUTH
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_TOKEN
from homeassistant.core... | 36.502564 | 88 | 0.606631 | [
"Apache-2.0"
] | 0xFEEDC0DE64/homeassistant-core | homeassistant/components/xiaomi_miio/config_flow.py | 14,236 | Python |
#!/usr/bin/env python
import os
import re
import pickle
import json
import glob
import numpy as np
from abc import ABC, abstractmethod
from concurrent.futures import ProcessPoolExecutor
from contextlib import contextmanager
from collections import namedtuple, OrderedDict
from tqdm import tqdm
from .utils import img... | 32.685824 | 143 | 0.614582 | [
"MIT"
] | kiyoon/GulpIO2 | src/gulpio2/fileio.py | 17,062 | Python |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | 36.686047 | 79 | 0.675436 | [
"Apache-2.0"
] | Atlas-Sailed-Co/oppia | extensions/rich_text_components/Video/Video.py | 3,155 | Python |
# Copyright 2012 Anton Beloglazov
#
# 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 writ... | 42.294737 | 79 | 0.595819 | [
"Apache-2.0"
] | MisterPup/OpenStack-Neat-Ceilometer | tests/locals/underload/test_trivial.py | 4,018 | Python |
# coding=utf-8
# Copyright 2019 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... | 36.573864 | 139 | 0.645332 | [
"Apache-2.0"
] | Alex-Fabbri/datasets | tensorflow_datasets/audio/nsynth.py | 12,874 | Python |
# --------------------------------------------------------------------------
# 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 cause incor... | 42.109244 | 85 | 0.50908 | [
"MIT"
] | 00Kai0/azure-cli | src/azure-cli/azure/cli/command_modules/databoxedge/manual/custom.py | 5,011 | Python |
# -*- coding:utf-8 -*-
import csv
import fileinput
import sys
import numpy
from pynm.feature.metric.itml import learn_metric, convert_data
class ItmlCommand:
name = 'itml'
help = 'Information Theoretic Metric Learning'
@classmethod
def build_arg_parser(cls, parser):
parser.add_argument('-i... | 37.270042 | 97 | 0.452621 | [
"MIT"
] | ohtaman/pynm | pynm/commands/metric.py | 8,833 | Python |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 45.388601 | 184 | 0.649201 | [
"MIT"
] | andyzhangx/azure-cli-extensions | src/aks-preview/azext_aks_preview/_validators.py | 8,760 | Python |
import os
import numpy as np
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import torch
from torch.utils.data import DataLoader
from tqdm import tqdm
import argparse
import cv2
import config
from utils import Mesh
from models import CMR
from models.smpl_from_lib import SMPL
from utils.pose_ut... | 52.824663 | 125 | 0.633353 | [
"BSD-3-Clause"
] | akashsengupta1997/GraphCMR | evaluate_3dpw_mine.py | 27,416 | Python |
# Copyright 2017-2020 EPAM Systems, Inc. (https://www.epam.com/)
#
# 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... | 40.529412 | 101 | 0.649057 | [
"Apache-2.0"
] | NShaforostov/cloud-pipeline | pipe-cli/src/api/user.py | 3,445 | Python |
import pytest
import numpy as np
import tensorflow as tf
import tensorflow.keras
import librosa
from kapre import STFT, Magnitude, Phase, Delta, InverseSTFT, ApplyFilterbank
from kapre.composed import (
get_melspectrogram_layer,
get_log_frequency_spectrogram_layer,
get_stft_mag_phase,
get_perfectly_reco... | 35.376045 | 112 | 0.682598 | [
"MIT"
] | Path-A/kapre | tests/test_time_frequency.py | 12,700 | Python |
#!/usr/bin/env python2
import sys
import re
import datetime
import hashlib
import optparse
import urllib2
# cheers Dirk :)
url = 'https://testssl.sh/mapping-rfc.txt'
for line in urllib2.urlopen(url):
cipher = line.split()
print cipher[1]+'(0'+cipher[0]+'),'
| 16.117647 | 42 | 0.686131 | [
"ECL-2.0",
"Apache-2.0"
] | Ameg-yag/TLS-Attacker | resources/cipher_suite_grabber.py | 274 | Python |
"""Ray constants used in the Python code."""
import logging
import math
import os
logger = logging.getLogger(__name__)
def env_integer(key, default):
if key in os.environ:
return int(os.environ[key])
return default
def direct_call_enabled():
return bool(int(os.environ.get("RAY_FORCE_DIRECT", "... | 39.673267 | 78 | 0.774644 | [
"Apache-2.0"
] | stephanie-wang/ray | python/ray/ray_constants.py | 8,014 | 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/.
from keras.preprocessing.sequence import pad_sequences
from keras.preprocessing.text import Toke... | 30.875 | 92 | 0.712551 | [
"MPL-2.0"
] | Delkhaz/bugbug | bugbug/nn.py | 1,482 | Python |
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 15 16:02:16 2018
@author: ning
"""
import os
working_dir = ''
import pandas as pd
pd.options.mode.chained_assignment = None
import numpy as np
from utils import (cv_counts)
saving_dir = '../results/cv_counts'
if not os.path.exists(saving_dir):
os.mkdir(saving_dir)
#... | 33.760234 | 126 | 0.411744 | [
"MIT"
] | nmningmei/metacognition | scripts/classifcation_pos_n_trials_back (cv counts).py | 5,773 | Python |
# -*- coding: utf-8 -*-
import os
import torch
import torch.nn as nn
from supar.models import (BiaffineDependencyModel, CRF2oDependencyModel,
CRFDependencyModel, VIDependencyModel)
from supar.parsers.parser import Parser
from supar.utils import Config, Dataset, Embedding
from supar.utils.com... | 45.484171 | 126 | 0.555988 | [
"MIT"
] | LiBinNLP/HOSDP | supar/parsers/dep.py | 48,850 | Python |
import argparse
import logging
from datetime import datetime
from python_liftbridge import ErrNoSuchStream
from python_liftbridge import ErrStreamExists
from python_liftbridge import Lift
from python_liftbridge import Stream
def parse_arguments():
'''Argument parsing for the script'''
parser = argparse.Argum... | 23.788889 | 93 | 0.554414 | [
"Apache-2.0"
] | LaPetiteSouris/python-liftbridge | examples/lift-sub.py | 2,141 | Python |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from telemetry.internal import story_runner
from telemetry.page import page
from telemetry.page import legacy_page_test
from telemetry.page ... | 38.646552 | 76 | 0.758867 | [
"BSD-3-Clause"
] | bopopescu/catapult-2 | telemetry/telemetry/page/shared_page_state_unittest.py | 4,483 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from .. import utilities, tables
class ProxyProtocolPolicy(pulumi.Cust... | 40.753623 | 124 | 0.68101 | [
"ECL-2.0",
"Apache-2.0"
] | lemonade-hq/pulumi-aws | sdk/python/pulumi_aws/ec2/proxy_protocol_policy.py | 2,812 | Python |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# ============================================================================ #
# Project : Airbnb #
# Version : 0.1.0 #
# File : split_names.py ... | 52.7 | 80 | 0.253004 | [
"BSD-3-Clause"
] | decisionscients/Airbnb | src/lab/split_names.py | 1,581 | Python |
import numpy as np
from scipy.optimize import curve_fit
from ..data_generation import interp_reflectivity, ReflectivityGenerator
def q_shift_variants(q_values_prediction, q_values_input, corrected_reflectivity, n_variants, scale=0.001):
"""Create ``n_variants`` interpolated reflectivity curve variants with rando... | 49.929577 | 120 | 0.725811 | [
"MIT"
] | schreiber-lab/mlreflect | mlreflect/curve_fitter/minimizer.py | 3,545 | Python |
from sys import maxsize
class Group:
def __init__(self, name=None, header=None, footer=None, id=None):
self.name = name
self.header = header
self.footer = footer
self.id = id
def __repr__(self):
return"%s:%s:%s:%s" % (self.id, self.name, self.header, self.footer)
... | 23.75 | 103 | 0.582456 | [
"Apache-2.0"
] | Docent321/python_traning | model/group.py | 570 | Python |
# -*- coding: utf-8 -*-
from datetime import datetime
import json
import time
import flask
from example.usermanagement.schema_marshmallow import AboutSchema
from example.usermanagement.schema_marshmallow import NoContentSchema
from example.usermanagement.schema_marshmallow import UserAvatarSchema
from example.userma... | 36.689189 | 98 | 0.707182 | [
"MIT"
] | algoo/hapic | example/usermanagement/serve_flask_marshmallow.py | 5,430 | Python |
import os
from aws_cdk import (
core,
aws_dynamodb as ddb,
aws_ec2 as ec2,
aws_ecs as ecs,
aws_ecr as ecr,
aws_iam as iam,
aws_logs as cwl,
aws_secretsmanager as sm,
aws_kinesis as ks,
)
class LogstashOutStack(core.Stack):
def __init__(self, scope: core.Construct, id: st... | 38.870813 | 169 | 0.58481 | [
"MIT"
] | originsecurity/telemetry | src/cdk/stacks/outbound/stack.py | 8,124 | 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... | 42.046154 | 80 | 0.71094 | [
"Apache-2.0"
] | qq1440837150/DeepSpeech | deepspeech/frontend/augmentor/noise_perturb.py | 2,733 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.