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 |
|---|---|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0026_event_image'),
]
operations = [
migrations.CreateModel(
name='EventParticipation',
field... | 36.589744 | 114 | 0.585144 | [
"Apache-2.0"
] | MagiCircles/SchoolIdolAPI | api/migrations/0027_auto_20150227_2321.py | 1,427 | Python |
# import the definition of the steps and input files:
from Configuration.PyReleaseValidation.relval_steps import *
# here only define the workflows as a combination of the steps defined above:
workflows = Matrix()
# each workflow defines a name and a list of steps to be done.
# if no explicit name/label given for ... | 50.5 | 99 | 0.649175 | [
"Apache-2.0"
] | AlionaD/cmssw | Configuration/PyReleaseValidation/python/relval_2017.py | 3,030 | Python |
import MPS_class as MPS
import MPO_class as MPO
from ncon import ncon
import numpy as np
from scipy.linalg import expm
#%%
def TEBD_evo(MPS_,Lx,Ly,J=1,epsilon=0.1,etrunc=0,chiMAX=256,chiMAXswap=256,info=True):
L = Lx*Ly
config = np.arange(0,L).reshape(Lx,Ly)
theta = (np.pi+2*epsilon)
flip_op = np.e... | 34.27686 | 94 | 0.563472 | [
"MIT"
] | alessandro-santini/Tensor-Network | tebd_floquet.py | 8,295 | Python |
"""
link: https://leetcode-cn.com/problems/smallest-rectangle-enclosing-black-pixels
problem: 给定 0, 1 矩阵,以及一个矩阵中为 1 的点坐标,求包含矩阵中所有的1的最小矩形面积
solution: 暴搜。忽略坐标,直接遍历所有节点,找到上下左右四个边界点,时间O(nm)。
solution-fix: 二分。将x轴投影到y轴,y轴投影到x轴,形成两个一维数组。显然数组形如下图。而 x, y 坐标为界,两侧各为非严格递增和递减
1: +------+
0: ----... | 31.053333 | 80 | 0.396737 | [
"Apache-2.0"
] | windniw/just-for-fun | leetcode/302.py | 2,601 | Python |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... | 43.037838 | 114 | 0.706104 | [
"BSD-3-Clause"
] | VictorAtPL/openthread | tests/scripts/thread-cert/Cert_5_3_03_AddressQuery.py | 7,962 | Python |
import re
from haystack.inputs import Exact, Clean, BaseInput
from api.helpers.parse_helper import has_balanced_parentheses, matched_parens
class ElasticSearchExtendedAutoQuery(BaseInput):
"""
A convenience class that handles common user queries.
In addition to cleaning all tokens, it handles double qu... | 34.5 | 101 | 0.630952 | [
"MIT"
] | geometalab/G4SE-Compass | compass-api/G4SE/api/helpers/input.py | 1,932 | Python |
"""Mark channels in an existing BIDS dataset as "bad".
example usage:
$ mne_bids mark_bad_channels --ch_name="MEG 0112" --description="noisy" \
--ch_name="MEG 0131" --description="flat" \
--subject_id=01 --task=experiment --session=test \
... | 43.690265 | 79 | 0.569374 | [
"BSD-3-Clause"
] | adam2392/mne-bids | mne_bids/commands/mne_bids_mark_bad_channels.py | 4,940 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import json
import os
from pymisp import ExpandedPyMISP
from settings import url, key, ssl, outputdir, filters, valid_attribute_distribution_levels
try:
from settings import with_distribution
except ImportError:
with_distribution = False
try:
from ... | 31.431373 | 134 | 0.639426 | [
"BSD-2-Clause"
] | JMoretS21Sec/PyMISP | examples/feed-generator/generate.py | 3,206 | Python |
#!/usr/bin/env python3
from hopla.hoplalib.user.usermodels import HabiticaUser
class TestHabiticaUser:
def test_get_stats(self):
user_test_stat_values = {
"buffs": {
"str": 50, "int": 50, "per": 3206, "con": 50, "stealth": 0, "streaks": False,
"snowball": False... | 41.086957 | 98 | 0.544709 | [
"Apache-2.0"
] | rickie/hopla | src/tests/hoplalib/user/test_usermodels.py | 3,780 | Python |
import os
from celery import Celery
from django.conf import settings
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myshop.settings')
app = Celery('myshop')
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: set... | 28.583333 | 67 | 0.781341 | [
"MIT"
] | BendalPrathmesh/E-commerce--site | myshop/celery.py | 343 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
币安推荐码: 返佣10%
https://www.binancezh.pro/cn/register?ref=AIR1GC70
币安合约推荐码: 返佣10%
https://www.binancezh.com/cn/futures/ref/51bitquant
if you don't have a binance account, you can use the invitation link to register one:
https://www.binancezh.com/... | 44.110553 | 179 | 0.586238 | [
"MIT"
] | xgy560501/binance_grid_trader | trader/binance_trader.py | 9,326 | Python |
# -*- coding: utf-8 -*- #
# Copyright 2017 Google LLC. 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 requir... | 36.762128 | 85 | 0.722277 | [
"Apache-2.0"
] | bopopescu/cndw | mac/google-cloud-sdk/lib/googlecloudsdk/api_lib/compute/daisy_utils.py | 23,491 | Python |
# ----------------------------------------------------------------------
# Distributed Lock
# ----------------------------------------------------------------------
# Copyright (C) 2007-2021 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# Python m... | 30.495798 | 92 | 0.532929 | [
"BSD-3-Clause"
] | sbworth/getnoc | core/lock/distributed.py | 3,629 | Python |
# Copyright (c) 2020 Aiven, Helsinki, Finland. https://aiven.io/
from .object_storage.gcs import GCSProvider
from argparse import ArgumentParser
from tempfile import TemporaryDirectory
import codecs
import datetime
import dateutil
import gzip
import json
import kafka
import logging
import os
import re
class KafkaRe... | 37.462366 | 120 | 0.548794 | [
"Apache-2.0"
] | AlexAmin/aiven-kafka-restore | kafka_restore/__main__.py | 6,968 | Python |
# Generated by Django 4.0 on 2022-01-10 10:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('funblog', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='fblog',
name='DOC',
field=m... | 26.689655 | 91 | 0.582687 | [
"MIT"
] | larryw3i/osp | fun/funblog/migrations/0002_alter_fblog_doc_alter_fblog_dou_alter_fblog_comment.py | 774 | Python |
try:
xrange
except:
xrange = range
def totalvalue(comb):
' Totalise a particular combination of items'
totwt = totval = 0
for item, wt, val in comb:
totwt += wt
totval += val
return (totval, -totwt) if totwt <= 400 else (0, 0)
items = (
("map", 9, 150), ("compass", 13, 35)... | 31.518519 | 87 | 0.509988 | [
"MIT"
] | ethansaxenian/RosettaDecode | lang/Python/knapsack-problem-0-1-2.py | 1,702 | Python |
#
# voice-skill-sdk
#
# (C) 2020, Deutsche Telekom AG
#
# This file is distributed under the terms of the MIT license.
# For details see the file LICENSE in the top directory.
#
#
# Circuit breaker for skills requesting external services
#
from .config import config
from circuitbreaker import CircuitBreaker
from requ... | 27.172414 | 82 | 0.777919 | [
"MIT"
] | Anrufliste/voice-skill-sdk | skill_sdk/circuit_breaker.py | 788 | Python |
from itertools import combinations
f = open("input.txt")
d = f.readlines()
nog = []
for l in d:
nog.append(int(l))
combos = 0
min_num = 0
do_break = False
for nog_len in range(len(nog)):
for c in combinations(nog, nog_len):
combo_sum = sum(c)
if combo_sum == 150:
min_num = nog_len
... | 18.586207 | 40 | 0.580705 | [
"MIT"
] | pwicks86/adventofcode2015 | day17/p2.py | 539 | Python |
import logging
from angr_platforms.msp430 import arch_msp430, lift_msp430, simos_msp430
import angr
import os
def test_new_orleans():
thebin = str(os.path.join(os.path.dirname(os.path.realpath(__file__)),
'../test_programs/msp430/microcorruption_new_orleans/out.elf'))
p = angr.Pr... | 38.571429 | 93 | 0.724691 | [
"BSD-2-Clause"
] | shahinsba/angr-platforms | tests/test_msp430_mc_new_orleans.py | 810 | Python |
import pytest
from django.contrib.auth import get_user_model
from rest_framework.test import APIClient
@pytest.fixture
def client():
return APIClient()
@pytest.fixture
def db_user():
user_data = {
'email': 'test@example.com',
'password': 'testpass123',
'first_name': 'Jack',
'... | 20.65 | 60 | 0.670702 | [
"MIT"
] | thehomebrewnerd/react-django-template | backend/user/tests/conftest.py | 413 | Python |
from django.apps import AppConfig
class ActivityFeedConfig(AppConfig):
"""App config for activity_feed."""
name = 'datahub.activity_feed'
| 18.625 | 39 | 0.738255 | [
"MIT"
] | Staberinde/data-hub-api | datahub/activity_feed/apps.py | 149 | Python |
#crie um tupla com o nome dos produtos, seguidos do preço.
#mostre uma listagem de preços, de forma tabular.
lista = ('Lápis', 1.5, 'Borracha', 2.5, 'Caderno', 10.8,
'Estojo', 20, 'Mochila', 100.5)
print('\033[31m--'*20)
print(f'{"LISTAGEM DE PREÇOS":^40}')
print('--'*20, '\033[m')
for i in range(0, len(lis... | 30.347826 | 58 | 0.637536 | [
"MIT"
] | NataliaNasu/cursoemvideo-python3 | PacoteDownload/ex076.py | 711 | Python |
#!/usr/bin/env python
import os
import json
import pprint as pp
from time import time
import torch
import torch.optim as optim
from tensorboard_logger import Logger as TbLogger
from nets.critic_network import CriticNetwork
from options import get_options
from train import train_epoch, validate, get_inner_model
from ... | 36.334694 | 120 | 0.601887 | [
"MIT"
] | angela18199/CORL_hyperparameter_search | hyper_attention/run.py | 8,902 | Python |
# pylint:disable=unused-variable
# pylint:disable=unused-argument
# pylint:disable=redefined-outer-name
import pytest
from models_library.basic_types import LogLevel
from simcore_service_director_v2.core.settings import (
AppSettings,
BootModeEnum,
DynamicSidecarProxySettings,
DynamicSidecarSettings,
... | 31.015625 | 80 | 0.70529 | [
"MIT"
] | ITISFoundation/osparc-simcore | services/director-v2/tests/unit/test_core_settings.py | 1,985 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 51.702703 | 210 | 0.68437 | [
"MIT"
] | AriZavala2/azure-sdk-for-python | sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py | 19,130 | Python |
# coding: utf-8
# In[ ]:
def choice():
print("1-create,2-update,3-read,4-delete")
try:
x=int(input("\nEnter your choice:"))
except ValueError:
print("Enter integer choice:....")
choice()
else:
if(x==1):
create()
elif(x==2):
update()
... | 25.625 | 80 | 0.48223 | [
"MIT"
] | AbhishekSalian/Database | database.py | 2,870 | Python |
# !/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault(
'DJANGO_SETTINGS_MODULE', 'bootstrap_components.tests.settings'
)
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| 20.461538 | 65 | 0.793233 | [
"MIT"
] | IshanManchanda/dj-bootstrap-components | manage.py | 266 | Python |
#!/usr/bin/python3
import socket
import re
import time
pattern = re.compile('N=\d+\sC=\d+')
s = socket.socket()
s.connect(('localhost', 9007))
s.recv(1024) # what received is just a introduction, we do not need it.
time.sleep(4)
while True:
received = s.recv(1024).decode('ascii')
print(received, end='... | 25.388889 | 78 | 0.504741 | [
"MIT"
] | IdanBanani/Pwnable.kr-CTF-Writeups | pwnable.kr/Toddler's Bottle/coin1/coin1.py | 1,371 | Python |
import pymysql
db = pymysql.connect('localhost', 'root', 'password', 'login')
cursor = db.cursor()
def sign_up():
userid = input('Enter UserID : ')
query = "select * from login;"
try:
cursor.execute(query)
fetch = cursor.fetchall()
n = len(fetch)
flag = 0
... | 30.715596 | 113 | 0.433393 | [
"Unlicense"
] | vinay-yadav/Login_system | db_login_system.py | 3,348 | Python |
import os
from pathlib import Path
import numpy as np
import pandas as pd
import tensorflow as tf
from skimage import io
from tensorflow import keras
class BimodalDenoiseDataGen(keras.utils.Sequence):
'''
Generate train/validation/test samples for our multimodal
denoise network. Inpu... | 35.69863 | 83 | 0.560054 | [
"MIT"
] | yaochenzhu/MMDQEN | data.py | 10,424 | Python |
# -*- coding: utf-8 -*-
"""layers.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1fCQ_zLCcWNzgE99LK9B2cWrql8J3HgBO
"""
# Author : Vedant Shah
# E-mail : vedantshah2012@gmail.com
import torch
import torch.nn as nn
from torch.nn.parameter import P... | 32.6 | 84 | 0.638718 | [
"MIT"
] | veds12/aihaven | gcn/layers.py | 1,467 | Python |
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
PROJECT_NAME = "Perceptron_PyPi_package"
USER_NAME = "Jap_patel"
setuptools.setup(
name=f"{PROJECT_NAME}-{USER_NAME}",
version="0.0.2",
author=USER_NAME,
author_email="jappatel1704@gmail.com",
... | 29.272727 | 79 | 0.650104 | [
"MIT"
] | jap-patel/Perceptron_PyPi_package | setup.py | 966 | Python |
import os
import portalocker
from deep_architect.contrib.communicators.communicator import Communicator
from deep_architect.contrib.communicators.file_utils import (consume_file,
read_file,
write_f... | 36.393258 | 85 | 0.574251 | [
"MIT"
] | aspratyush/deep_architect | deep_architect/contrib/communicators/file_communicator.py | 3,239 | Python |
"""passes the credits"""
class Settings:
login_username = ''
login_password = ''
| 10.75 | 24 | 0.662791 | [
"MIT"
] | imansh77/instagram_unfollower | crawler/conf.py | 86 | Python |
"""Tensorflow trainer class."""
import datetime
import math
import os
import warnings
from typing import Callable, Dict, Optional, Tuple
import numpy as np
import tensorflow as tf
from packaging.version import parse
from tensorflow.python.distribute.values import PerReplica
from .integrations import is_comet_availab... | 43.88622 | 169 | 0.617013 | [
"Apache-2.0"
] | AdrienDS/transformers | src/transformers/trainer_tf.py | 34,717 | Python |
from logbunker.contexts.bunker.logs.domain.LogRepository import LogRepository
from logbunker.contexts.bunker.logs.domain.entities.Log import Log
from logbunker.contexts.bunker.logs.domain.entities.LogContent import LogContent
from logbunker.contexts.bunker.logs.domain.entities.LogCreationDate import LogCreationDate
fro... | 44.375 | 93 | 0.75493 | [
"MIT"
] | parada3desu/logbunker | logbunker/contexts/bunker/logs/application/createone/LogCreator.py | 1,420 | Python |
"""
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
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 ... | 48.663043 | 132 | 0.6587 | [
"MIT-0"
] | janssenivo/cfn-python-lint | src/cfnlint/rules/resources/properties/AllowedValue.py | 4,477 | Python |
#!/usr/bin/env python3
import os
import sys
from utils import config, logger, env
from librarian.librarian import Librarian
log = logger.get_log('KodiLibrarian')
kodi = Librarian(config.hosts, update_while_playing=config.update_while_playing)
if env.event == 'download':
if env.calledBy == 'radarr':
log.... | 34.558824 | 116 | 0.700426 | [
"MIT"
] | jsaddiction/SharedLibraryManager | KodiLibrarian.py | 1,175 | Python |
from textsimilarity import clean_text, rankers, text_models
__all__ = ['clean_text', 'rankers', 'text_models']
| 28 | 59 | 0.776786 | [
"MIT"
] | NalaniKai/TextSimilarity | textsimilarity/__init__.py | 112 | Python |
import layers
import wrappers
import replay_buffer | 16.666667 | 20 | 0.9 | [
"MIT"
] | charleneeboo/flatland | common/__init__.py | 50 | Python |
from .access_code import SubmitterAccessCode
from .cfp import CfP
from .feedback import Feedback
from .question import Answer, AnswerOption, Question, QuestionTarget, QuestionVariant
from .resource import Resource
from .review import Review, ReviewPhase
from .submission import Submission, SubmissionError, SubmissionSta... | 23.965517 | 85 | 0.719424 | [
"Apache-2.0"
] | MaximilianKindshofer/pretalx | src/pretalx/submission/models/__init__.py | 695 | Python |
import json
import platform
from django.db.models import Q
from django.http import HttpResponse
from django.http import HttpResponseNotFound
from morango.models import InstanceIDModel
from rest_framework import viewsets
from rest_framework.decorators import api_view
from rest_framework.response import Response
import... | 32.5 | 99 | 0.664359 | [
"MIT"
] | MikiasEphrem/kolibri | kolibri/core/public/api.py | 3,900 | Python |
def power(x, y, serialId):
r = x + 10
p = r * y
p += serialId
p *= r
p = (p%1000)//100
return p-5
if __name__ == '__main__':
serialId = 1788
# serialId = 42
# serialId = 18
cum_sum_square = {}
for i in range(0, 301):
cum_sum_square[(0,i)] = 0
cum_sum_square[(... | 30.948718 | 137 | 0.487158 | [
"MIT"
] | antonydeepak/AdventOfCode2018 | 11/2.py | 1,207 | Python |
"""Tests for 2d flow around a cylinder with a conforming mesh and rans3p"""
from builtins import range
from builtins import object
from proteus.iproteus import *
from proteus import Comm
from proteus import Context
import tables
import importlib
comm = Comm.get()
Profiling.logLevel = 7
Profiling.verbose = False
import... | 38.666667 | 172 | 0.592325 | [
"MIT"
] | burgreen/proteus | proteus/tests/HotStart_3P/test_HotStart_rans3p.py | 3,596 | Python |
import json
import hashlib
import os
import pickle
import re
import shutil
class Block:
def __init__(self, numberBlock, data, previousHash, idHash):
self._idBlock = numberBlock
self._data = data
self._previousHash = previousHash
self._idHash = idHash
self._checker = True
... | 33.848958 | 120 | 0.550085 | [
"MIT"
] | jorgeisa/Respaldo_EDD_Fase2 | storage/fase2/team13/Blockchain.py | 6,499 | Python |
from d2lbook2 import notebook
from d2lbook2 import rst
import unittest
import nbconvert
_markdown_src = r'''
# Test
:label:`test`
first para
python is good
another para
This is :eqref:`sec_1`
```python2
1+2+3
```
python3 is better
- here
- haha
```{.input .python}
1+2+3
```
```{.input .python}
#@tab python2
... | 12.5375 | 67 | 0.601196 | [
"Apache-2.0"
] | aieye-top/d2l-book2 | d2lbook2/rst_test.py | 1,003 | Python |
from .default import DefaultAttackEval
from ..classifier import Classifier
from ..attacker import Attacker
import json
from tqdm import tqdm
class InvokeLimitException(Exception):
pass
class InvokeLimitClassifierWrapper(Classifier):
def __init__(self, clsf, invoke_limit):
self.__invoke_limit = invoke_... | 33.451613 | 100 | 0.623915 | [
"MIT"
] | agcopenhaver/OpenAttack | OpenAttack/attack_evals/invoke_limit_eval.py | 4,148 | Python |
"""
Common utilities for the library
"""
import shutil
import sys
import os
import logging
from aws_lambda_builders.architecture import X86_64, ARM64
LOG = logging.getLogger(__name__)
def copytree(source, destination, ignore=None, include=None):
"""
Similar to shutil.copytree except that it removes the lim... | 33.686486 | 127 | 0.652599 | [
"Apache-2.0"
] | awslabs/aws-lambda-builders | aws_lambda_builders/utils.py | 6,232 | Python |
import tensorflow as tf
import os
import json
import subprocess
from scipy.misc import imread, imresize
from scipy import misc
from train import build_forward
from utils.annolist import AnnotationLib as al
from utils.train_utils import add_rectangles, rescale_boxes
import cv2
import argparse
def get_image_dir(args):... | 45.358491 | 161 | 0.656614 | [
"Apache-2.0",
"MIT"
] | lilohuang/TensorBox | evaluate.py | 4,808 | Python |
# -*- coding: utf-8 -*-
# # How long does a Computron take?
#
# - [build model of computron\-to\-wallclock relationship · Issue \#3459 · Agoric/agoric\-sdk](https://github.com/Agoric/agoric-sdk/issues/3459)
# ## Preface: Python Data Tools
#
# See also [shell.nix](shell.nix).
# +
import pandas as pd
import numpy as n... | 30.668827 | 417 | 0.625632 | [
"CC0-1.0"
] | Agoric/testnet-notes | nb4/slogfiles.py | 52,047 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the CPIO extracted file-like object."""
from __future__ import unicode_literals
import unittest
from dfvfs.file_io import cpio_file_io
from dfvfs.path import cpio_path_spec
from dfvfs.path import os_path_spec
from dfvfs.resolver import context
from tests.fi... | 31.080214 | 75 | 0.75086 | [
"Apache-2.0"
] | Acidburn0zzz/dfvfs | tests/file_io/cpio_file_io.py | 5,812 | Python |
import time
import json
from anchore_engine.subsys import logger
def get_docker_registry_userpw(registry_record):
user = pw = None
try:
if 'registry_type' in registry_record and registry_record['registry_type'] == 'awsecr':
try:
ecr_creds = json.loads(registry_record['regis... | 42.421875 | 254 | 0.628729 | [
"Apache-2.0"
] | Mattlk13/anchore-engine | anchore_engine/auth/common.py | 2,715 | Python |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
from collections import defaultdict
from typing import TYPE_CHECKING, Dict, List,... | 43 | 88 | 0.630767 | [
"MIT"
] | danielcohenlive/Ax-1 | ax/modelbridge/transforms/power_transform_y.py | 8,041 | Python |
#
# Copyright 2019 Jonas Berg
#
# 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... | 32.866412 | 120 | 0.61166 | [
"Apache-2.0"
] | edgar-bonet/minimalmodbus | dummy_serial.py | 8,611 | Python |
#!/usr/bin/env python
import os
from setuptools import setup
from setuptools import find_packages
import sys
from financialdatapy import __version__ as VERSION
# 'setup.py publish' shortcut.
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist bdist_wheel')
os.system('twine upload dist/*')
sys.ex... | 25.928571 | 62 | 0.660468 | [
"MIT"
] | choi-jiwoo/financialdatapy | setup.py | 1,452 | Python |
# IMPORT MANAGEMENT
try:
import gevent.monkey
except ModuleNotFoundError:
import os
os.system('pip install -r requirements.txt')
import gevent.monkey
gevent.monkey.patch_all() # patch everything
import colorama
colorama.init(autoreset=True)
import discord.commands
import asyncio
import discord
import... | 25.754098 | 87 | 0.741566 | [
"MIT"
] | nsde/novalix | src/bot.py | 1,573 | Python |
from dataclasses import dataclass, field
from typing import List, Optional
@dataclass
class Regex:
att: Optional[str] = field(
default=None,
metadata={
"type": "Attribute",
"pattern": r"\p{IsSpacingModifierLetters}+",
}
)
@dataclass
class Doc:
class Meta:
... | 17.785714 | 56 | 0.53012 | [
"MIT"
] | tefra/xsdata-w3c-tests | output/models/ms_data/regex/re_l6_xsd/re_l6.py | 498 | Python |
from __future__ import unicode_literals, division, absolute_import
import logging
import re
from datetime import datetime
from sqlalchemy import Column, Unicode, Integer
from flexget import plugin
from flexget.event import event
from flexget.utils import requests
from flexget.utils.soup import get_soup
from flexget.u... | 40.72549 | 116 | 0.596052 | [
"MIT"
] | RSully/flexget-flexget | flexget/plugins/services/pogcal_acquired.py | 4,154 | Python |
import copy
import datetime
import decimal
import inspect
import json
import logging
import traceback
import uuid
import warnings
from collections import Counter, defaultdict, namedtuple
from collections.abc import Hashable
from functools import wraps
from typing import List
from dateutil.parser import parse
from gre... | 41.271407 | 134 | 0.599392 | [
"Apache-2.0"
] | BSofo/great_expectations | great_expectations/data_asset/data_asset.py | 53,983 | Python |
"""update liscence colum to hash
Revision ID: 0a769c5cda0a
Revises: 1de63d54c3b7
Create Date: 2018-06-21 17:57:36.549097
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0a769c5cda0a'
down_revision = '1de63d54c3b7'
branch_labels = None
depends_on = None
def u... | 34.373134 | 65 | 0.597916 | [
"MIT"
] | todhm/wicarproject | wicarproject/migrations/versions/0a769c5cda0a_update_liscence_colum_to_hash.py | 2,303 | Python |
import os
from plugins import BaseAssessment
from yapsy.IPlugin import IPlugin
from asmtypes import ArastDataOutputError
class ReaprAssessment(BaseAssessment, IPlugin):
OUTPUT = 'contigs'
def run(self):
"""
Build the command and run.
Return list of file(s)
"""
contigs =... | 33.255319 | 82 | 0.602047 | [
"MIT"
] | levinas/assembly | lib/assembly/plugins/reapr.py | 1,563 | Python |
#!/usr/bin/env python3
# Northcliff Airconditioner Controller Version 3.48 Gen
import RPi.GPIO as GPIO
import time
from datetime import datetime
#import requests
#from threading import Thread
import paho.mqtt.client as mqtt
import struct
import json
import serial
import binascii
import sys
import spidev
import math
imp... | 58.285714 | 322 | 0.644634 | [
"MIT"
] | roscoe81/Aircon-Controller | Northcliff_Aircon_Controller.py | 38,352 | Python |
from django.utils.version import get_version
VERSION = (3, 1, 6, "final", 0)
__version__ = get_version(VERSION)
def setup(set_prefix=True):
"""
Configure the settings (this happens as a side effect of accessing the
first setting), configure logging and populate the app registry.
Set the thread-local... | 31.96 | 85 | 0.732165 | [
"MIT"
] | nverbois/TFE21-232 | Thesis@3.9.1/Lib/site-packages/django/__init__.py | 799 | Python |
# coding=utf-8
from __future__ import unicode_literals
from .. import Provider as AutomotiveProvider
class Provider(AutomotiveProvider):
# from
# https://en.wikipedia.org/wiki/Vehicle_registration_plates_of_the_United_Kingdom
license_formats = (
'??## ???',
'??##???'
)
| 21.785714 | 85 | 0.67541 | [
"BSD-3-Clause"
] | AMuratTuran/mkn | oscar/lib/python2.7/site-packages/faker/providers/automotive/en_GB/__init__.py | 305 | Python |
import mysql_conn
class BaseField:
def __init__(self,name,column_type,primary_key,default):
self.name=name
self.column_type=column_type
self.primary_key=primary_key
self.default=default
class StringField(BaseField):
def __init__(self,name,column_type='varchar(200)',primary_key=... | 28.816901 | 118 | 0.571114 | [
"MIT"
] | miaoqinian/myorm | orm1.py | 4,126 | Python |
import copy
import os
import logging
import pickle
from typing import Dict, List, Optional, Union
try:
import sigopt as sgo
Connection = sgo.Connection
except ImportError:
sgo = None
Connection = None
from ray.tune.suggest import Searcher
logger = logging.getLogger(__name__)
class SigOptSearch(Sear... | 36.090253 | 79 | 0.571371 | [
"Apache-2.0"
] | Actexpler/ray | python/ray/tune/suggest/sigopt.py | 9,997 | Python |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/13a_learner.ipynb (unless otherwise specified).
__all__ = ['CancelFitException', 'CancelEpochException', 'CancelTrainException', 'CancelValidException',
'CancelBatchException', 'replacing_yield', 'mk_metric', 'save_model', 'load_model', 'Learner',
'... | 43.911197 | 126 | 0.644245 | [
"Apache-2.0"
] | akashpalrecha/fastai2 | fastai2/learner.py | 22,746 | Python |
from django import template
from ..rocketchat import get_rc_id, get_rc_url, get_rc_ws_url
register = template.Library()
@register.inclusion_tag("rocketchat/chat.html", takes_context=True)
def chat(context):
user = getattr(context.get("request"), "user")
return {
"rocketchat_url": get_rc_url(),
... | 26.76 | 71 | 0.68012 | [
"BSD-3-Clause"
] | leprikon-cz/leprikon | leprikon/templatetags/rocketchat.py | 669 | Python |
class dotnetPointList_t(object):
""" dotnetPointList_t(Size: int) """
def FromStruct(self, PointList):
""" FromStruct(self: dotnetPointList_t,PointList: PointList) """
pass
def ToStruct(self, PointList):
""" ToStruct(self: dotnetPointList_t,PointList: PointList) """
... | 22.642857 | 73 | 0.604101 | [
"MIT"
] | YKato521/ironpython-stubs | release/stubs.min/Tekla/Structures/ModelInternal_parts/dotnetPointList_t.py | 634 | Python |
from typing import List, Optional
from google.cloud import ndb
from pyre_extensions import none_throws
from backend.common.models.event import Event
from backend.common.models.event_team import EventTeam
from backend.common.models.keys import EventKey
from backend.common.models.team import Team
from backend.common.qu... | 30.4 | 84 | 0.615461 | [
"MIT"
] | guineawheek/ftc-data-take-2 | src/backend/common/queries/tests/event_teams_query_test.py | 3,040 | Python |
"""Test case that checks the working of the utils/command/gen_uml.py module."""
from utils.model.gen_uml import generate
import importlib_metadata
class PseudoFile:
def __init__(self):
self.data = ""
def write(self, data):
self.data += data
def close(self):
pass
def test_loadi... | 32.081633 | 102 | 0.721374 | [
"Apache-2.0"
] | MarianelaSena/gaphor | tests/test_gen_uml.py | 1,572 | Python |
import tensorflow as tf
from current_net_conf import *
class RnnDropoutPlaceholders:
probability = tf.placeholder(tf.float32, [])
@staticmethod
def feed(prob=1.0):
return {RnnDropoutPlaceholders.probability: prob}
class MultiRnnWithDropout(tf.nn.rnn_cell.DropoutWrapper):
def __init__(self,... | 30.641509 | 88 | 0.708128 | [
"MIT"
] | Saloed/PythonGenerator | model/rnn_with_dropout.py | 1,624 | Python |
import pytest
def test_1():
...
@pytest.mark.slow
def test_2():
...
@pytest.mark.skip
def test_3():
...
| 7.625 | 17 | 0.54918 | [
"MIT"
] | twotwo/python-pytest | tests/test_markers.py | 122 | Python |
import _plotly_utils.basevalidators
class SizeValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(
self, plotly_name="size", parent_name="histogram2dcontour.ybins", **kwargs
):
super(SizeValidator, self).__init__(
plotly_name=plotly_name,
parent_name=pare... | 29.642857 | 82 | 0.653012 | [
"MIT"
] | 1abner1/plotly.py | packages/python/plotly/plotly/validators/histogram2dcontour/ybins/_size.py | 415 | Python |
"""
This file offers the methods to automatically retrieve the graph Acidocella sp. MX-AZ02.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protein... | 33.142857 | 223 | 0.675862 | [
"MIT"
] | AnacletoLAB/ensmallen | bindings/python/ensmallen/datasets/string/acidocellaspmxaz02.py | 3,480 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright © 2018 Michael J. Hayford
""" Support creation of an iPython console, with rayoptics environment
.. Created on Wed Nov 21 21:48:02 2018
.. codeauthor: Michael J. Hayford
"""
from qtconsole.rich_jupyter_widget import RichJupyterWidget
from qtconsole.inprocess... | 28.158416 | 78 | 0.639592 | [
"BSD-3-Clause"
] | NelisW/ray-optics | src/rayoptics/qtgui/ipyconsole.py | 2,845 | Python |
"""Phonopy QHA module."""
# Copyright (C) 2012 Atsushi Togo
# All rights reserved.
#
# This file is part of phonopy.
#
# 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 th... | 36.903019 | 80 | 0.556068 | [
"BSD-3-Clause"
] | SeyedMohamadMoosavi/phonopy | phonopy/qha/core.py | 40,335 | Python |
import os
from argparse import ArgumentParser
from time import time
import yaml
import numpy as np
from fx_replicator import (
build_model, load_wave, save_wave, sliding_window, LossFunc
)
import nnabla as nn
#import nnabla_ext.cudnn
import nnabla.functions as F
import nnabla.parametric_functions as PF
import nnabl... | 26.090909 | 74 | 0.637282 | [
"MIT"
] | kmwebnet/Audio-Effect-replicator-nnabla | predict.py | 2,870 | Python |
"""
This module contains utiliy functions for fields which are used by both the
:mod:`~sphinxcontrib_django2.docstrings.attributes` and
:mod:`~sphinxcontrib_django2.docstrings.classes` modules.
"""
from django.apps import apps
from django.contrib import contenttypes
from django.db import models
from django.utils.encodi... | 43.318519 | 99 | 0.639193 | [
"Apache-2.0"
] | mkalioby/sphinxcontrib-django2 | sphinxcontrib_django2/docstrings/field_utils.py | 5,848 | Python |
"""Python wrappers around TensorFlow ops.
This file is MACHINE GENERATED! Do not edit.
"""
import collections as _collections
import six as _six
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
from tensorflow.python.eager import context as _context
from tensorflow.python.eager import core as _c... | 32.107527 | 78 | 0.739786 | [
"MIT"
] | caiovini/Image_reader_api | venv/Lib/site-packages/tensorflow/python/ops/gen_user_ops.py | 2,986 | Python |
#!/usr/bin/env python3
# md_lj_module.py
#------------------------------------------------------------------------------------------------#
# This software was written in 2016/17 #
# by Michael P. Allen <m.p.allen@warwick.ac.uk>/<m.p.allen@bristol.ac.uk> ... | 48.116279 | 109 | 0.478879 | [
"CC0-1.0"
] | Allen-Tildesley/examples | python_examples/md_lj_module.py | 10,345 | Python |
# Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
"""Tool to find or compare big functions in a js or ll file
"""
impo... | 32.875 | 146 | 0.604563 | [
"MIT"
] | 0x53A/emscripten | tools/find_bigfuncs.py | 3,945 | Python |
from datetime import date
from argparse import Namespace
from django.contrib import admin
from django_q.tasks import async_task
from import_export.admin import ImportExportModelAdmin
from .models import (
MunicipalStaffContactsUpdate,
IncomeExpenditureV2Update,
CashFlowV2Update,
RepairsMaintenanceV2U... | 30.346341 | 81 | 0.766436 | [
"MIT"
] | Code4SA/municipal-data-api | municipal_finance/admin.py | 6,221 | Python |
# Author: Mainak Jas <mainak@neuro.hut.fi>
# Romain Trachel <trachelr@gmail.com>
#
# License: BSD (3-clause)
import warnings
import os.path as op
import numpy as np
from nose.tools import assert_true, assert_raises
from numpy.testing import assert_array_equal
from mne import io, read_events, Epochs, pick_typ... | 36.791411 | 79 | 0.679006 | [
"BSD-3-Clause"
] | ARudiuk/mne-python | mne/decoding/tests/test_transformer.py | 5,997 | Python |
from flask import render_template
from flask import redirect
from flask import request
from flask import url_for
from flask import flash
from flask_login import login_user
from flask_login import logout_user
from flask_login import login_required
from flask_login import current_user
from . import auth
from .forms impor... | 33.505208 | 78 | 0.655215 | [
"MIT"
] | qimiaoxue/flash_card | app/auth/views.py | 6,433 | Python |
from dataclasses import dataclass
from cannabis.types.blockchain_format.sized_bytes import bytes32
from cannabis.util.ints import uint32
from cannabis.util.streamable import Streamable, streamable
@dataclass(frozen=True)
@streamable
class PoolTarget(Streamable):
puzzle_hash: bytes32
max_height: uint32 # A m... | 27.769231 | 69 | 0.814404 | [
"Apache-2.0"
] | CannabisChain/cannabis-blockchain | cannabis/types/blockchain_format/pool_target.py | 361 | Python |
import logging
LOG = logging.getLogger(__name__)
def export_transcripts(adapter, build="37"):
"""Export all transcripts from the database
Args:
adapter(scout.adapter.MongoAdapter)
build(str)
Yields:
transcript(scout.models.Transcript)
"""
LOG.info("Exporting all transcri... | 20 | 51 | 0.675 | [
"BSD-3-Clause"
] | Clinical-Genomics/scout | scout/export/transcript.py | 400 | Python |
import pandas as pd
import numpy as np
import math
import matplotlib.pyplot as plt
from .metrics import mse_score, rmse_score, r2_score, mae_score
from ..features.build_features import StandardScaler, MinMaxScaler
class LinearRegressor():
"""Linear regressor"""
def __init__(self, method='normal_equation', nor... | 34.197917 | 152 | 0.573865 | [
"MIT"
] | orsdanilo/ml-from-scratch | src/models/_linear.py | 3,283 | Python |
from copy import deepcopy
from quest.quest_manager import QuestManager
import settings
from twitch.channel import Channel
class QuestChannel(Channel):
def __init__(self, owner, channel_manager):
super().__init__(owner, channel_manager)
self.quest_manager = QuestManager(self)
self.mod_co... | 39.404255 | 92 | 0.666307 | [
"MIT"
] | Xelaadryth/Xelabot | quest_bot/quest_channel.py | 1,852 | Python |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Centralized catalog of paths."""
import os
class DatasetCatalog(object):
DATA_DIR = "./datasets"
DATASETS = {
"coco_2017_train": {
"img_dir": "coco/train2017",
"ann_file": "coco/annotations/instances_tr... | 40.585 | 121 | 0.605026 | [
"BSD-2-Clause"
] | choasup/FCOS | fcos_core/config/paths_catalog.py | 8,117 | Python |
import sys
from jennie.jennie_tools.command_handler import *
from jennie.ubuntu import *
def execute():
arguments = sys.argv[1:]
commands = CommandHandler().start(arguments)
if not commands or commands == None:
return
elif commands == True:
return
elif commands[0] == "ubuntu":
... | 29.028571 | 65 | 0.554134 | [
"MIT"
] | Ask-Jennie/ask-jennie | jennie/__init__.py | 1,016 | Python |
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
text = """<form method="post" action="/add/">
<input type="text" name="a" value="%d"> + <input type="text" name="b" value="%d">
<input type="submit" value="="> <input type="text" value="%d">
</form>"""
# @csrf_exempt
# ... | 25.793103 | 85 | 0.550802 | [
"MIT"
] | feonixsmj/Django-Python | newtest/newtest/add.py | 748 | 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 ... | 45.438596 | 133 | 0.660746 | [
"MIT"
] | AFengKK/azure-sdk-for-python | sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_compliance_results_operations.py | 7,770 | Python |
# -*- coding: utf-8 -*-
import argparse, json, os
import numpy as np
import h5py
import codecs
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input_txt', default='half_obama_weeklys.txt')
parser.add_argument('-o', '--output_h5', default='half_obama_weeklys.h5')
parser.add_argument('-oj', '--output_j... | 32.861702 | 78 | 0.668177 | [
"MIT"
] | nateGeorge/obama_bot | scrape-prez-vids/scrapy/scrape_prez/preprocess.py | 3,089 | Python |
import psycopg2
import os
from dotenv import load_dotenv
load_dotenv() # Adds .env to memory
# postgres db connection
postgres_options = {
"host": os.getenv("POSTGRES_HOST"),
"database": os.getenv("POSTGRES_DATABASE"),
"user": os.getenv("POSTGRES_USER"),
"password": os.getenv("POSTGRES_PASSWORD")
... | 22.04 | 61 | 0.715064 | [
"MIT"
] | MujyKun/IreneAPI | resources/keys.py | 551 | Python |
# Generated by Django 2.2.8 on 2019-12-24 12:45
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Redirect',
fields=[
('id', models.AutoField... | 25.26087 | 114 | 0.585198 | [
"MIT"
] | SharifAIChallenge/AIC21-Backend | apps/go/migrations/0001_initial.py | 581 | Python |
from xml.dom import minidom
from django.utils.datastructures import MultiValueDict
from django import forms
from django.utils.html import format_html, mark_safe
from django.forms.utils import flatatt
class SelectMultipleSVG(forms.SelectMultiple):
class Media:
js = ('django_svgselect.js',)
def __init_... | 34.390244 | 118 | 0.634752 | [
"MIT"
] | jmickela/django_svgselect | django_svgselect/forms.py | 1,410 | Python |
""" Python 'unicode-internal' Codec
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
import codecs
### Codec APIs
class Codec(codecs.Codec):
# Note: Binding these as C functions will result in the class not
# converting them to methods. This is in... | 26 | 69 | 0.728261 | [
"MIT"
] | JacobMiske/nuclear-database-APIs | env/lib/python3.7/encodings/unicode_internal.py | 1,196 | Python |
import cv2
import numpy as np
from faster_rcnn import network
from faster_rcnn.faster_rcnn import FasterRCNN
from faster_rcnn.utils.timer import Timer
def test():
import os
im_file = 'demo/004545.jpg'
# im_file = 'data/VOCdevkit2007/VOC2007/JPEGImages/009036.jpg'
# im_file = '/media/longc/Data/data/2D... | 34.93617 | 113 | 0.668697 | [
"MIT"
] | princeward/faster_rcnn_pytorch | demo.py | 1,642 | Python |
#importieren aller notwenigen Bibliotheken
import tensorflow.compat.v1 as tf
#Die Hauptbibliothek Tensorflow wird geladen
from tensorflow.keras.models import Sequential, save_model
from tensorflow.keras.layers import Conv2D, BatchNormalization, MaxPool2D, MaxPooling2D, Dense, Dropout, Activation, Flatten
from tens... | 41.183673 | 125 | 0.734721 | [
"MIT"
] | Tom-Haustein/GTSRB_Neural_Network | Programme/Trainingsprogramm_mit_Messdaten.py | 6,065 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.