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 cv2
import numpy as np
# from scipy import ndimage
maskgridL = np.meshgrid(np.r_[0:359],np.r_[0:130])
maskgridR = np.meshgrid(np.r_[0:359],np.r_[639-130:639])
# key value
# cam.set(3 , 640) # width
# cam.set(4 , 480) # height
# cam.set(10, 120) # brightness min... | 33.027397 | 93 | 0.62754 | [
"Apache-2.0"
] | garethnisbet/T-BOTS | Python/Development/T-Bot_Tracking/getHSVThresh.py | 2,411 | Python |
from __future__ import absolute_import, print_function
import sys
def _verbose_message(message, *args, **kwargs):
"""Print the message to stderr if -v/PYTHONVERBOSE is turned on."""
verbosity = kwargs.pop('verbosity', 1)
if sys.flags.verbose >= verbosity:
if not message.startswith(('#', 'import '... | 30.8 | 71 | 0.637662 | [
"MIT"
] | asmodehn/lark_import | palimport/_utils.py | 770 | Python |
# -*- coding: utf-8 -*-
#
# ns-3 documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 14 09:00:39 2010.
#
# 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 co... | 32.267281 | 80 | 0.716938 | [
"BSD-3-Clause"
] | maxvonhippel/snake | ns-3-dev/doc/models/source/conf.py | 7,002 | Python |
# Generated by Django 3.2.8 on 2022-01-04 10:37
import datetime
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('amcm', '0031_auto_20220104_0431'),
]
operations = [
m... | 40.637931 | 159 | 0.614765 | [
"MIT"
] | agsneutron/asociacion_mexicana_cuarto_milla | apps/amcm/migrations/0032_auto_20220104_0437.py | 2,357 | Python |
"""Support for Australian BOM (Bureau of Meteorology) weather service."""
import datetime
import ftplib
import gzip
import io
import json
import logging
import os
import re
import zipfile
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor... | 33.880466 | 86 | 0.61234 | [
"Apache-2.0"
] | 5mauggy/home-assistant | homeassistant/components/bom/sensor.py | 11,621 | Python |
class BaseORMException(Exception):
"""
Base ORM Exception.
"""
class FieldError(BaseORMException):
"""
The FieldError exception is raised when there is a problem with a model field.
"""
class ParamsError(BaseORMException):
"""
The ParamsError is raised when function can not be run wi... | 24.236111 | 102 | 0.716905 | [
"Apache-2.0"
] | Abnormally/tortoise-orm | tortoise/exceptions.py | 1,745 | Python |
import logging
log = logging.getLogger("MPP-Solar")
class baseoutput:
def __str__(self):
return "baseoutput - the base class for the output processors, not used directly"
def get_kwargs(self, kwargs, key, default=None):
if not key in kwargs or not kwargs[key]:
return default
... | 22.933333 | 89 | 0.665698 | [
"MIT"
] | 20after4/mpp-solar | mppsolar/outputs/baseoutput.py | 344 | Python |
# -*- coding: utf-8 -*-
#
# FHash documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 21 20:02:16 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | 29.609756 | 79 | 0.682043 | [
"Unlicense"
] | aditya-a-patil/FHash | docs/source/conf.py | 4,856 | Python |
import setuptools
import label_studio
print('Label Studio', label_studio.__version__)
# Readme
with open('README.md', 'r') as f:
long_description = f.read()
# Module dependencies
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setuptools.setup(
name='label-studio',
version=l... | 27.666667 | 57 | 0.674699 | [
"Apache-2.0"
] | Dingbro/label-studio | setup.py | 1,079 | Python |
from caffe_all import *
def parseProtoString(s):
from google.protobuf import text_format
proto_net = pb.NetParameter()
text_format.Merge(s, proto_net)
return proto_net
def get_param(l, exclude=set(['top', 'bottom', 'name', 'type'])):
if not hasattr(l,'ListFields'):
if hasattr(l,'__delitem... | 34.315789 | 77 | 0.506646 | [
"BSD-2-Clause"
] | jeffdonahue/voc-classification | src/load.py | 1,956 | Python |
def deal(infilename,outfilename):
infile = open(infilename)
lines = infile.readlines()
out = []
for line in lines:
line = line.split(',')
val = line[-1][0]
line = line[:-1]
line.insert(0,val)
out.append(line)
print(out)
str = ''
for line in out:
... | 27.95 | 52 | 0.545617 | [
"Apache-2.0"
] | hrsu/disturb | Haberman Data/deal_data.py | 559 | Python |
import secrets
import os
from PIL import Image
from flask import render_template, url_for, flash, redirect, request, abort
from blog import app, db, bcrypt, mail
from blog.forms import (RegistrationForm, LoginForm, UpdateAccountForm, PostForm, \
RequestResetForm, ResetPasswordForm)
from blog.mod... | 37.283654 | 100 | 0.676209 | [
"Apache-2.0"
] | mlewan01/flaskblog01 | blog/routes.py | 7,755 | Python |
# Copyright The PyTorch Lightning team.
#
# 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 i... | 42.735119 | 119 | 0.654874 | [
"Apache-2.0"
] | dcfidalgo/pytorch-lightning | pytorch_lightning/trainer/training_loop.py | 43,077 | Python |
# coding: utf-8
import gettext
# Make the gettext function _() available in the global namespace, even if no i18n is in use
gettext.install("bookworm", names=["ngettext"])
| 24.857143 | 92 | 0.741379 | [
"MIT"
] | blindpandas/bookworm | bookworm/__init__.py | 174 | Python |
# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING
from ...utils.api_object import APIObject
if TYPE_CHECKING:
from ..message.emoji import Emoji
@dataclass
class... | 19.6875 | 65 | 0.706349 | [
"MIT"
] | gillesigot/Pincer | pincer/objects/message/reaction.py | 630 | Python |
"""
.. module:: category_encoders
:synopsis:
:platform:
"""
from category_encoders.backward_difference import BackwardDifferenceEncoder
from category_encoders.binary import BinaryEncoder
from category_encoders.count import CountEncoder
from category_encoders.hashing import HashingEncoder
from category_encoders.h... | 28.96 | 75 | 0.812155 | [
"BSD-3-Clause"
] | Fayel-cyber/category_encoders | category_encoders/__init__.py | 1,448 | Python |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 43.661157 | 80 | 0.678087 | [
"Apache-2.0"
] | 05259/tensorflow | tensorflow/python/kernel_tests/signal/spectral_ops_test.py | 15,849 | Python |
import pytest
from api.providers.permissions import GroupHelper
from osf_tests.factories import (
ReviewActionFactory,
AuthUserFactory,
PreprintFactory,
PreprintProviderFactory,
)
from osf.utils import permissions as osf_permissions
@pytest.mark.django_db
class ReviewActionCommentSettingsMixin(object... | 32.861702 | 75 | 0.620913 | [
"Apache-2.0"
] | listinc/osf.io | api_tests/reviews/mixins/comment_settings.py | 3,089 | Python |
import unittest
from streamlink.buffers import Buffer, RingBuffer
class TestBuffer(unittest.TestCase):
def setUp(self):
self.buffer = Buffer()
def test_write(self):
self.buffer.write(b"1" * 8192)
self.buffer.write(b"2" * 4096)
self.assertEqual(self.buffer.length, 8192 + 4096... | 33.072727 | 71 | 0.628642 | [
"BSD-2-Clause"
] | 18928172992817182/streamlink | tests/test_buffer.py | 3,638 | Python |
import os
import rasterio
import mercantile
import numpy as np
import pytest
from tempfile import NamedTemporaryFile, TemporaryDirectory
from affine import Affine
from unittest import TestCase
from unittest.mock import patch
from datetime import datetime
from shapely.geometry import Polygon
from rasterio.enums impo... | 41.684746 | 113 | 0.654591 | [
"MIT"
] | AmitAronovitch/telluric | tests/test_georaster_tiling.py | 24,594 | Python |
from plotly.basedatatypes import BaseTraceType
import copy
class Splom(BaseTraceType):
# customdata
# ----------
@property
def customdata(self):
"""
Assigns extra data each datum. This may be useful when
listening to hover, click and selection events. Note that,
"scatt... | 36.773866 | 89 | 0.572273 | [
"MIT"
] | 180Studios/LoginApp | venv/lib/python3.7/site-packages/plotly/graph_objs/_splom.py | 54,315 | Python |
import time
from bs4 import BeautifulSoup
import requests
import json
from datetime import datetime, timedelta
import psycopg2
import smtplib
import os
DATABASE = os.environ["DATABASE"]
USER = os.environ["USER"]
PASSWORD = os.environ["PASSWORD"]
HOST = os.environ["HOST"]
def send_email(message: str)... | 32.46729 | 161 | 0.582614 | [
"MIT"
] | Karalius/get-vaccine-vilnius | vaccines.py | 3,474 | 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 ... | 38.875 | 94 | 0.588424 | [
"MIT"
] | 00Kai0/azure-sdk-for-python | sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/__init__.py | 622 | Python |
# Lint as: python3
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | 42.138347 | 82 | 0.721019 | [
"Apache-2.0"
] | Bobgy/model-analysis | tensorflow_model_analysis/api/model_eval_lib.py | 45,383 | Python |
#coding:utf-8
#
# id: bugs.core_5275
# title: CORE-5275: Expression index may become inconsistent if CREATE INDEX was interrupted after b-tree creation but before commiting
# decription:
# This test (and CORE- ticket) has been created after wrong initial implementation of test for ... | 39.711712 | 452 | 0.556148 | [
"MIT"
] | artyom-smirnov/firebird-qa | tests/bugs/core_5275_test.py | 17,632 | Python |
from odroid_go import GO
from .Block import Block
from .Snake import Snake
SNAKE_COLOR = GO.lcd.colors.GREEN
BACKGROUND_COLOR = GO.lcd.colors.BLACK
FOOD_COLOR = GO.lcd.colors.RED
BORDER_COLOR = GO.lcd.colors.WHITE
SCREEN_WIDTH = 320
SCREEN_HEIGHT = 240
BLOCK_SIZE = 10
#Where borders are drawn
INIT_X = 0
INIT_Y = 20
... | 23.155172 | 116 | 0.711095 | [
"MIT"
] | willemserruys/Snake | src/snake/Entities/Globals.py | 1,343 | Python |
"""
Tests for Reactions
"""
from src.common import constants as cn
from src.common.simple_sbml import SimpleSBML
from src.common import simple_sbml
from src.common.function_definition import FunctionDefinition
from tests.common import helpers
import copy
import libsbml
import numpy as np
import unittest
IGNORE_TEST ... | 21.368421 | 69 | 0.716749 | [
"MIT"
] | ModelEngineering/kinetics_validator | tests/common/test_function_definition.py | 812 | Python |
from typing import FrozenSet
from collections import Iterable
from math import log, ceil
from mathsat import msat_term, msat_env
from mathsat import msat_make_constant, msat_declare_function
from mathsat import msat_get_integer_type, msat_get_rational_type, msat_get_bool_type
from mathsat import msat_make_and, msa... | 38.388889 | 89 | 0.577049 | [
"MIT"
] | EnricoMagnago/F3 | benchmarks/f3_wrong_hints/scaling_ltl_timed_transition_system/15-sender_receiver_10.py | 18,657 | Python |
'''
Deals with the actual detection of signals in multichannel audio files.
There are two problems that need to solved while detecting a signal of interest.
#. within-channel signal detection
#. across-channel correspondence matching
Within-channel signal detection
-------------------------------
This task in... | 33.912134 | 128 | 0.672424 | [
"MIT"
] | thejasvibr/batracker | batracker/signal_detection/detection.py | 8,105 | Python |
import unittest
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
from ansiblelints.stage.IncompleteConditional import IncompleteConditional
class TestIncompleteConditional(unittest.TestCase):
collection = RulesCollection()
def setUp(self):
self.collection.register... | 27.05 | 74 | 0.770795 | [
"Apache-2.0"
] | SODALITE-EU/defect-prediction | ansible/tests/TestIncompleteConditional.py | 541 | Python |
# coding: utf-8
"""
Run the tests.
$ pip install nose (optional)
$ cd swagger_client-python
$ nosetests -v
"""
import os
import sys
import time
import unittest
import swagger_client
from swagger_client.rest import ApiException
class ApiExceptionTests(unittest.TestCase):
def setUp(self):
self.api_clien... | 30.164835 | 78 | 0.622222 | [
"Apache-2.0"
] | DigitalInnovation/swagger-codegen | samples/client/petstore/python/tests/test_api_exception.py | 2,745 | Python |
# reimplementation of https://github.com/guillaumegenthial/tf_ner/blob/master/models/lstm_crf/main.py
import functools
import json
import logging
from pathlib import Path
import sys
import numpy as np
import tensorflow as tf
# tf.enable_eager_execution()
from tf_metrics import precision, recall, f1
DATADIR = "../../.... | 38.647273 | 142 | 0.691664 | [
"Apache-2.0"
] | vikasbahirwani/SequenceTagging | src/model/lstm_crf/main.py | 10,628 | Python |
# -*- coding: utf-8 -*-
"""Assignment Day :13
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1hCwbVUHmWUKYdN7xNNeZcze9aGEmlGKz
"""
# Q1.
#Remove the hardcoded part from the code with the help of configparser
import os
from configparser import Con... | 25.22449 | 132 | 0.68123 | [
"Apache-2.0"
] | anjali0503/Letsupgrade_Advance_Python_Django | assignment_day_13.py | 1,236 | Python |
import invoke
from pathlib import Path
PACKAGE = "src"
REQUIRED_COVERAGE = 90
BASE_DIR = Path(__file__).resolve().parent
@invoke.task(name="format")
def format_(arg):
autoflake = "autoflake -i --recursive --remove-all-unused-imports --remove-duplicate-keys --remove-unused-variables"
arg.run(f"{autoflake} {... | 26.569231 | 120 | 0.62652 | [
"Apache-2.0"
] | brainfukk/fiuread | tasks.py | 1,727 | Python |
# -*- coding: utf-8 -*-
"""
pygments.lexers.smalltalk
~~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for Smalltalk and related languages.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, include, bygroups, defa... | 36.811224 | 88 | 0.427859 | [
"MIT"
] | 0x008800/Sandbox | Python/Django/rest_framework/1_serialization/env/lib/python2.7/site-packages/pygments/lexers/smalltalk.py | 7,215 | Python |
import optparse
import Utils
import gensim
def main():
parser = optparse.OptionParser()
parser.add_option('-d', '--dataset', default='sample')
parser.add_option('--size', default=300, type='int', help='vectors dimension. Default: %default')
parser.add_option('--window', default=5, type='int', help='wi... | 38.65 | 136 | 0.702458 | [
"MIT"
] | mathieu-lacage/sophiaconf2018 | do-word-vector-model.py | 773 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import time
import numpy as np
import math
import os
# gene[f][c] f:function type, c:connection (nodeID)
class Individual(object):
def __init__(self, net_info, init):
self.net_info = net_info
self.gene = np.zeros((self.net_info.node_num + ... | 47.862534 | 120 | 0.584108 | [
"MIT"
] | Pavan-Samtani/CGP-CNN-v2 | cgp.py | 17,757 | Python |
import graphene
from ..translations.mutations import ShopSettingsTranslate
from .mutations import (
AuthorizationKeyAdd,
AuthorizationKeyDelete,
HomepageCollectionUpdate,
ShopAddressUpdate,
ShopDomainUpdate,
ShopFetchTaxRates,
ShopSettingsUpdate,
StaffNotificationRecipientCreate,
St... | 33.65 | 82 | 0.801634 | [
"BSD-3-Clause"
] | croolicjah/saleor-platform | saleor/saleor/graphql/shop/schema.py | 1,346 | Python |
# -*- coding: utf-8 -*-
r'''
Manage the Windows registry
===========================
Many python developers think of registry keys as if they were python keys in a
dictionary which is not the case. The windows registry is broken down into the
following components:
-----
Hives
-----
This is the top level of the regis... | 32.427056 | 117 | 0.594438 | [
"Apache-2.0"
] | Feeeenng/salt | salt/states/reg.py | 12,225 | Python |
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from recipe import views
router = DefaultRouter()
router.register('tags', views.TagViewSet)
router.register('ingredients', views.IngredientViewSet)
router.register('recipe', views.RecipeViewSet)
app_name = 'recipe'
urlpatterns = [... | 23.866667 | 55 | 0.77933 | [
"MIT"
] | Webins/recipe-app-api | app/recipe/urls.py | 358 | Python |
import os
import click
import numpy as np
from tqdm import tqdm
from models.model_loader import load_model
from torchvision.transforms import Compose
from dataset.data_transform import Resize, Rotation, ElasticAndSine, ColorGradGausNoise, AddWidth, Normalize, ToGray, OnlyElastic, OnlySine, ColorGrad, ColorGausNoise
fro... | 55.190031 | 166 | 0.561526 | [
"MIT"
] | alexeypechorin/tibetan-transductive | train.py | 35,432 | Python |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 49.333333 | 129 | 0.675676 | [
"MIT"
] | Arkanayan/azure-cli-extensions | src/image-gallery/azext_image_gallery/custom.py | 5,772 | Python |
from unittest.mock import MagicMock
from django.core.exceptions import ValidationError
from users.backends import DakaraModelBackend
from users.tests.base_test import UsersAPITestCase, config_email_disabled
class DakaraModelBackendTestCase(UsersAPITestCase):
"""Test the authentication backend."""
def setUp... | 35.551724 | 88 | 0.66602 | [
"MIT"
] | DakaraProject/dakara-server | dakara_server/users/tests/test_backends.py | 3,093 | Python |
#!/usr/bin/env python3
# Macaw
#
# Testing file open and string concatenation.
import random
import pkgutil
def main():
# This dictionary of words is for testing only and should *not* be considered secure.
# Courtesy of https://gist.github.com/deekayen/4148741
#f = open('dictionary.txt')
f = pkgutil... | 30.913043 | 93 | 0.466245 | [
"MIT"
] | dcchambers/macaw | macaw/macaw.py | 1,422 | Python |
"""
Django settings for hotelrooms project.
Generated by 'django-admin startproject' using Django 3.0.6.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os... | 27.751724 | 91 | 0.65333 | [
"MIT"
] | atombrella/hotel-room-reservation | hotelrooms/hotelrooms/settings.py | 4,024 | Python |
import time
print("What shall I remind you about?")
text = str(input())
print("In how many minutes ?")
local_time = float(input())
local_time = local_time * 60
time.sleep(local_time)
print(text)
| 21.666667 | 39 | 0.728205 | [
"MIT"
] | Awesome12-arch/Python-Reminder-Application | Code.py | 195 | Python |
from math import ceil
import datetime
from altair import Chart # type: ignore
import pandas as pd # type: ignore
import numpy as np
from .parameters import Parameters
from .utils import add_date_column
from .presentation import DATE_FORMAT
def new_admissions_chart(
alt, projection_admits: pd.DataFrame, param... | 29.893258 | 113 | 0.584852 | [
"MIT"
] | degerli/chime-1 | src/penn_chime/charts.py | 5,321 | Python |
import shlex
import string
import sys
from contextlib import contextmanager
from typing import Any, Callable, Generic, List, Optional, Tuple, Type, TypeVar, cast
import pytest
import simple_parsing
from simple_parsing import ConflictResolution, DashVariant, ParsingError
from simple_parsing.utils import camel_case
fro... | 33.767717 | 104 | 0.670164 | [
"MIT"
] | idoby/SimpleParsing | test/testutils.py | 8,577 | Python |
from __future__ import annotations
import copy
import logging
from collections import defaultdict
from pathlib import Path
from rasa.nlu.featurizers.featurizer import Featurizer
import numpy as np
import scipy.sparse
import tensorflow as tf
from typing import Any, Dict, List, Optional, Text, Tuple, Union, Type
from ... | 38.309951 | 88 | 0.625901 | [
"Apache-2.0"
] | Adarshsng/rasa | rasa/nlu/classifiers/diet_classifier.py | 70,452 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Entry',
fields=[
('id', models.AutoField(verbos... | 24.12 | 114 | 0.538972 | [
"MIT"
] | bwarren2/django-basic-blog | blog/migrations/0001_initial.py | 603 | Python |
# Copyright 2020 The FedLearner Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 40.559028 | 80 | 0.606712 | [
"Apache-2.0"
] | 0400H/fedlearner | fedlearner/trainer/sparse_estimator.py | 11,681 | Python |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals
import math
from warnings import warn
try:
import numpy
except ImportError:
numpy = None
try:
from numpy.linalg import svd as singular_value_decomposition
except ImportError:... | 34.983871 | 113 | 0.639696 | [
"MIT"
] | Sohone-Guo/Pointer-Generator | util_common/nlp/Sumy/summarizers/lsa.py | 4,340 | Python |
#!/usr/bin/env python
# Copyright (c) 2015 Freescale Semiconductor, Inc.
# Copyright 2016-2017 NXP
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
import struct
from .codec import (MessageType, MessageInfo, Codec, CodecError)
class BasicCodec(Codec):
## Version of this codec.
BASIC_CODEC_VER... | 25.559211 | 93 | 0.60592 | [
"MIT"
] | Sir-Branch/k64f-starter-template | sdk_k64f/middleware/multicore/erpc/erpc_python/erpc/basic_codec.py | 3,885 | Python |
class Employee:
def __init__(self, fname, lname):
self.fname = fname
self.lname = lname
# self.email = f"{fname}.{lname}@sandy.com"
def explain(self):
return f"This employee is {self.fname} {self.lname}"
def email(self):
return f"{self.fname}.{self.lname} @parker.com... | 24.842105 | 68 | 0.616525 | [
"MIT"
] | codewithsandy/Python-Basic-Exp | 47 Setters_Property Decorators/main1.py | 472 | Python |
import os
import subprocess
import jinja2
import json
import openchemistry as oc
def run_calculation(geometry_file, output_file, params, scratch_dir):
# Read in the geometry from the geometry file
# This container expects the geometry file to be in .xyz format
with open(geometry_file) as f:
xyz_s... | 36.068182 | 127 | 0.640832 | [
"BSD-3-Clause"
] | OpenChemistry/mongochemdeploy | docker/nwchem/src/run.py | 3,174 | Python |
# coding: utf-8
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
import matplotlib.pyplot as plt
from ch08.deep_convnet import DeepConvNet
from dataset.mnist import load_mnist
(x_train, t_train), (x_test, t_test) = load_mnist(flatten=False)
network = DeepConvNet()
network.loa... | 25.310345 | 64 | 0.757493 | [
"MIT"
] | gangigammo/deep-learning-1 | ch08/half_float_network.py | 804 | Python |
# Generated by Django 2.1.7 on 2019-03-16 10:46
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='is_donor',
),
]
| 17.666667 | 47 | 0.578616 | [
"MIT"
] | paceite/Seelife---An-NGO-Website | src/accounts/migrations/0002_remove_user_is_donor.py | 318 | Python |
"""
A validator for a frontend failure model. The model contains all
the failing web frontends and their status, as well as the virtual
machines they run on.
"""
from vuluptuous import Schema
schema = Schema({
'web_frontends_failures'
})
| 21.727273 | 66 | 0.769874 | [
"MIT"
] | lmontrieux/MAPE-validators | frontend-failure-model/frontend_failure.py | 239 | Python |
"""
Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test.lldbutil import get_stopped_thread, state_type_to_str
class ProcessAPITestCase(TestBase... | 40.22807 | 106 | 0.629089 | [
"Apache-2.0"
] | AaronBallman/llvm | lldb/test/API/python_api/process/TestProcessAPI.py | 18,344 | Python |
import uvicorn
from fastapi import (FastAPI, File, UploadFile)
from starlette.responses import RedirectResponse
from tensorflow.python.keras.preprocessing import image as imgx
import requests
from PIL import Image
from application.components import predict, read_imagefile
from application.schema import Symptom
from app... | 28.821429 | 79 | 0.724907 | [
"MIT"
] | EgoPro1/InceptionV2 | application/server/main.py | 1,614 | Python |
import os
import sys
path = os.getcwd()
package_path = (os.path.abspath(os.path.join(path, os.pardir))).replace('\\', '/')+'/'
sys.path.insert(1, package_path)
from config.config import *
##############################################Scrape-1###################################################
def contains(text , su... | 34.12 | 107 | 0.611958 | [
"MIT"
] | sai-krishna-msk/KickAssist | scripts/processing_scripts/raw_scrape_processing.py | 1,706 | Python |
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
from obspy.core.stream import Stream
def plot_gll(x, y, z):
""" Plots values on 2D unstructured GLL mesh
"""
r = (max(x) - min(x))/(max(y) - min(y))
rx = r/np.sqrt(1 + r**2)
ry = 1/np.sqrt(1 + r**2)
f ... | 23.878641 | 102 | 0.61049 | [
"BSD-2-Clause"
] | fanwu8/SeisFlowsQ | seisflows/tools/graphics.py | 4,919 | Python |
# Generated by Django 3.0.6 on 2020-05-24 13:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('grid', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Image',
fiel... | 37.37037 | 114 | 0.60555 | [
"MIT"
] | greatdaniels/gallery-app | grid/migrations/0002_image.py | 1,009 | Python |
a = []
# append element at the end.
a.append(2)
a.append(3)
print(a)
# insert at a specific location.
a.insert(0, 5)
a.insert(10, 5)
print(a)
# when specified a position not in list, it inserts at the end.
a.insert(100, 6)
print(a)
# Deleting elements from a list.
a.remove(5) # removes the first occurence of value pa... | 22.227273 | 66 | 0.604294 | [
"MIT"
] | archeranimesh/fantastic-waffle | SRC/December-Batch/02_class/01_list.py | 978 | Python |
import os
import sys
import yaml
import argparse
from kubernetes import client, config
import urllib3
from jinja2 import FileSystemLoader, Environment
urllib3.disable_warnings()
KERNEL_POD_TEMPLATE_PATH = '/kernel-pod.yaml.j2'
def generate_kernel_pod_yaml(keywords):
"""Return the kubernetes pod spec as a yaml ... | 49.242718 | 123 | 0.699921 | [
"Apache-2.0"
] | spotinst/wave-operator | tools/kernelspecs/kernels/R_kubernetes/scripts/launch_kubernetes.py | 5,072 | Python |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 34.756757 | 107 | 0.667963 | [
"Apache-2.0"
] | steffnay/python-datacatalog | google/cloud/datacatalog_v1beta1/types/table_spec.py | 3,858 | Python |
# coding=utf-8
from __future__ import print_function
import json
from data_packer import err, DataPacker, container
g_src = {
'a': 1,
'b': 'hello',
'c': ['a', 'b', 'c'],
'd': {
'1': 1,
'2': 2,
},
'e': {
'1': ['a', 'b'],
'2': {
'a': 'a',
... | 17.118644 | 60 | 0.50297 | [
"MIT"
] | ideascf/data-packer | example/demo/common.py | 1,020 | Python |
"""
Django settings for workstation project.
Generated by 'django-admin startproject' using Django 4.0.1.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
from dote... | 25.75 | 91 | 0.705026 | [
"MIT"
] | cindy21td/WorkStation | workstation-backend/workstation/settings.py | 3,502 | Python |
from __future__ import annotations
import re
import pkg_resources
VERSION_FORMAT = re.compile('([0-9]+)\\.([0-9]+)\\.([0-9]+)')
class Version(object):
def __init__(self, major: int, minor: int, revision: int):
self.major = major
self.minor = minor
self.revision = revision
def __str__... | 26.416667 | 69 | 0.624606 | [
"Apache-2.0"
] | ProgHaj/cowait | cowait/utils/version.py | 951 | Python |
"""
Django settings for BlogProject project.
Generated by 'django-admin startproject' using Django 1.11.20.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
impo... | 25.911111 | 91 | 0.69697 | [
"MIT"
] | lwpdzq/BlogProject | BlogProject/settings.py | 3,558 | Python |
import numpy as np
import time
import matplotlib.pyplot as plt
from MuellerBrownPotential import MuellerBrownPotential
from LogExpOfHarmonicWellsPotential import LogExpOfHarmonicWellsPotential
from MonteCarloSimulator import MonteCarloSimulator
from MetadynamicsBias import MetadynamicsBias
T = 1.0
NumMCmoves = 10000
... | 23.791667 | 73 | 0.718914 | [
"MIT"
] | valsson/MD-MC-Codes-2016 | Particle-On-Potential-MC-sampling/Run_MuellerBrownPotential-WithMetaD.py | 1,142 | Python |
"""
Test command line commands.
"""
from pathlib import Path
from subprocess import PIPE, Popen
__author__ = "Sergey Vartanov"
__email__ = "me@enzet.ru"
from xml.etree import ElementTree
from xml.etree.ElementTree import Element
from map_machine.ui.cli import COMMAND_LINES
LOG: bytes = (
b"INFO Constructing way... | 32.274074 | 80 | 0.614184 | [
"MIT"
] | LaoshuBaby/map-machine | tests/test_command_line.py | 4,358 | Python |
from colab_ssh.utils.packages.installer import create_deb_installer
from colab_ssh.utils.ui.render_html import render_template
from subprocess import Popen, PIPE
import shlex
from colab_ssh._command import run_command, run_with_pipe
import os
import time
from colab_ssh.get_tunnel_config import get_argo_tunnel_config
fr... | 32.806122 | 147 | 0.670295 | [
"MIT"
] | CharleoY/colab-ssh | colab_ssh/launch_ssh_cloudflared.py | 3,215 | Python |
import logging
from openstack_internal.nova.hypervisor_details import OSHypervisor
from topology.link import Link
from topology.node import Node
LOG = logging.getLogger(__name__)
class Server(Node):
def __init__(self, int_id: int, hypervisor: OSHypervisor):
super().__init__(int_id=int_id, _id=hyperviso... | 29.888889 | 109 | 0.705081 | [
"Apache-2.0"
] | kukkalli/orchestrator | app/topology/server.py | 807 | Python |
import json
from girder.constants import AccessType
from girder_client import HttpError
import pytest
from .conftest import getClient, getTestFolder, localDataRoot, users, wait_for_jobs
@pytest.mark.integration
@pytest.mark.parametrize("user", users.values())
@pytest.mark.run(order=3)
def test_reset_integration_env... | 38.180723 | 97 | 0.546229 | [
"Apache-2.0"
] | maxpark/dive | server/tests/integration/test_dataset_upload.py | 3,169 | Python |
import Celula
class Labirinto:
def __init__(self, num_rows, num_columns, order_to_check):
# Indica a ordem que vai os vizinhos vao ser checados
self.order_to_check = order_to_check
# Numero de linhas no grid
self.num_rows = num_rows
# Numero de colunas no grid
s... | 38.339286 | 126 | 0.581742 | [
"MIT"
] | RafaelAmauri/Projeto-e-Analise-de-Algoritmos | Trabalho 02/Resolucao/code/backtracking/Labirinto.py | 4,294 | Python |
import json
import logging
import os
from typing import Optional, List
from checkov.common.checks_infra.registry import get_graph_checks_registry
from checkov.common.graph.graph_builder.graph_components.attribute_names import CustomAttributes
from checkov.common.output.record import Record
from checkov.common.output.... | 50.116438 | 129 | 0.632636 | [
"Apache-2.0"
] | BenjaDiaz/checkov | checkov/terraform/plan_runner.py | 7,317 | Python |
import os
import logging
import json
from typing import Union, Dict, List
from documentstore_migracao.utils.isis2json import isis2json
logger = logging.getLogger(__name__)
class OutputContainer:
"""Classe que mimetiza a escrita de arquivos para a escrita em uma estrutura
de lista. Cada linha em um arquivo r... | 25.104651 | 82 | 0.633164 | [
"BSD-2-Clause"
] | patymori/document-store-migracao | documentstore_migracao/utils/extract_isis.py | 2,168 | Python |
#/usr/bin/env python
from paraview.simple import *
import sys
wavelet1 = Wavelet()
wavelet2 = Wavelet()
pythonCalculator1 = PythonCalculator(Input=wavelet2)
pythonCalculator1.ArrayName = 'RTData'
pythonCalculator1.Expression = 'RTData+200'
pythonCalculator1.CopyArrays = 0
# this one should be ignored in the output s... | 35.862069 | 92 | 0.755288 | [
"Apache-2.0",
"BSD-3-Clause"
] | ChristianWitzler/ParaView | Applications/ParaView/Testing/Python/AppendAttributes.py | 2,080 | 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 warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | 46.496104 | 171 | 0.669572 | [
"ECL-2.0",
"Apache-2.0"
] | pulumi/pulumi-alicloud | sdk/python/pulumi_alicloud/bastionhost/host_group_account_user_group_attachment.py | 17,901 | Python |
# cdiazbas@iac.es
import numpy as np
# Return the angles in the plane of the sky given angles with respect
# to the vertical for observations on the limb (in degrees!)
def absolute_to_sky(thetaB, chiB):
thetaB = np.deg2rad(thetaB)
chiB = np.deg2rad(chiB)
t1 = np.sin(thetaB) * np.sin(chiB)
t2 = -np.co... | 28.754386 | 69 | 0.655583 | [
"MIT"
] | aasensio/hazel | pyRoutines/angle_transformation.py | 3,278 | Python |
# encoding: utf-8
import os
import os.path
from pkg_resources import parse_version
# Avoid problem releasing to pypi from vagrant
if os.environ.get('USER', '') == 'vagrant':
del os.link
try:
from setuptools import (setup, find_packages,
__version__ as setuptools_version)
except I... | 60.603922 | 151 | 0.752103 | [
"Apache-2.0"
] | OCHA-DAP/hdx-ckan | setup.py | 15,454 | Python |
from __future__ import print_function
import random
import logging
import argparse
import grpc
import object_detection_pb2
import object_detection_pb2_grpc
BLOCK_SIZE = 40000
class ImageDataBlockRequestIterable(object):
def __init__(self, img_data):
self.data = img_data
self.pos = 0
def ... | 27.62963 | 118 | 0.637623 | [
"MIT"
] | gouchicao/darknet-serving | darknet_model_client.py | 2,238 | Python |
# coding=utf-8
# Copyright 2021 The OneFlow 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 require... | 36.804569 | 99 | 0.603614 | [
"Apache-2.0"
] | Oneflow-Inc/libai | libai/data/datasets/bert_dataset.py | 14,501 | Python |
from django.conf.urls import url, include
from django.contrib import admin
from .views import *
urlpatterns = [
url(r'^index$',index,name='index'),
url(r'^langs$',langs,name='langs'),
url(r'^newindex$',new_index),
url(r'^myindex/(\d+)$',
myindex_with_param,
name='myindex_with_... | 27.85 | 42 | 0.59246 | [
"Apache-2.0"
] | General-Coder/Django-Introduction | day04/app04/urls.py | 557 | Python |
from setuptools import setup
setup(
name='pusher',
version='0.8',
description='A Python library for sending messages to Pusher',
author='Pusher',
author_email='support@pusher.com',
url='http://pusher.com',
packages=['pusher'],
classifiers=[
"License :: OSI Approved :: MIT Licens... | 27.428571 | 66 | 0.616319 | [
"MIT"
] | tkhieu/pusher_client_python | setup.py | 576 | Python |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 39.220833 | 75 | 0.564432 | [
"Apache-2.0"
] | enovance/managesf | managesf/tests/test_resources_storyboard.py | 9,413 | Python |
from __future__ import unicode_literals
default_app_config = 'mayan.apps.dependencies.apps.DependenciesApp'
| 27.25 | 67 | 0.862385 | [
"Apache-2.0"
] | BajacDev/Mayan-EDMS | mayan/apps/dependencies/__init__.py | 109 | Python |
import os.path
import time
from moler.config import load_config
from moler.device.device import DeviceFactory
from moler.util.moler_test import MolerTest
def outage_callback(device_name, ping_times):
MolerTest.info("Network outage on {}".format(device_name))
ping_times["lost_connection_time"] = time.time()
... | 38.6 | 118 | 0.658031 | [
"BSD-3-Clause"
] | AdamKlekowski/moler | trainings/workshop1/step13/network_outage.py | 3,474 | Python |
# -*- coding: utf-8 -*-
#@+leo-ver=5-thin
#@+node:ekr.20181028052650.1: * @file leowapp.py
#@@first
'''
This file is deprecated/obsolete. It may be removed soon.
leoflexx.py implements LeoWapp using flexx.
'''
#@+<< imports >>
#@+node:ekr.20181028052650.3: ** << imports >>
import leo.core.leoGlobals as g
import leo.c... | 30.700855 | 71 | 0.609131 | [
"MIT"
] | Anu082000/leo-editor | leo/plugins/leowapp.py | 3,592 | Python |
from __future__ import absolute_import
from __future__ import unicode_literals
from dateutil.relativedelta import relativedelta
from custom.icds_reports.const import AGG_CHILD_HEALTH_THR_TABLE
from custom.icds_reports.utils.aggregation_helpers import month_formatter
from custom.icds_reports.utils.aggregation_helpers.d... | 40.967213 | 111 | 0.687875 | [
"BSD-3-Clause"
] | MaciejChoromanski/commcare-hq | custom/icds_reports/utils/aggregation_helpers/distributed/thr_forms_child_health.py | 2,499 | Python |
# Generated by Django 2.1.5 on 2019-02-08 20:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='post',
name='image',
field=m... | 21.315789 | 86 | 0.582716 | [
"MIT"
] | muntakim1/mblog | blog/migrations/0002_auto_20190209_0235.py | 405 | Python |
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'hospital.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are... | 33.75 | 73 | 0.687037 | [
"Apache-2.0"
] | thirdgroup/Hospital | hospital/manage.py | 540 | Python |
# Natural Language Toolkit - Range
# Represents a range of numbers, not an immutable object and can be modified by include
# Capable of performing operations on ranges
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://nltk.sf.net>
# This software is distributed under GPL, for license inf... | 38.328571 | 135 | 0.611256 | [
"Apache-2.0"
] | hectormartinez/rougexstem | taln2016/icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk_contrib/classifier/numrange.py | 2,683 | Python |
"""
Django settings for locallibrary project.
Generated by 'django-admin startproject' using Django 3.2.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pa... | 29.070064 | 103 | 0.724803 | [
"Unlicense"
] | TheRedemp7ion/DjangoLocalLibrary | locallibrary/settings.py | 4,564 | Python |
"""
SAM CLI version
"""
__version__ = "1.23.0"
| 8 | 22 | 0.583333 | [
"BSD-2-Clause",
"Apache-2.0"
] | HiteshMah-Jan/aws-sam-cli | samcli/__init__.py | 48 | Python |
from bokeh.plotting import figure, show
# prepare some data
x = [1, 2, 3, 4, 5]
y = [4, 5, 5, 7, 2]
# create a plot
p = figure(
title="Background colors example",
sizing_mode="stretch_width",
max_width=500,
height=250,
)
# add a renderer
p.line(x, y, line_color="green", line_width=2)
# change the fi... | 18.92 | 46 | 0.668076 | [
"BSD-3-Clause"
] | ABODFTW/bokeh | sphinx/source/docs/first_steps/examples/first_steps_4_background.py | 473 | Python |
import sys
class Solution:
# Write your code here
def __init__(self):
self.stack = []
self.queue = []
def popCharacter(self):
return self.stack.pop()
def pushCharacter(self, char):
self.stack.append(char)
def dequeueCharacter(self):
char = self.queue[0]
... | 22.854167 | 54 | 0.646308 | [
"MIT"
] | SayanBan/HackerRank-30-Days-of-code | Day 18/Queue and stacks.py | 1,097 | Python |
###############################################################################
##
## Copyright (C) 2013-2014 Tavendo GmbH
##
## 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
##
## h... | 31.212635 | 360 | 0.633132 | [
"BSD-3-Clause"
] | Crimson-MITK-ThirdParty/VTK-7.0.0 | ThirdParty/AutobahnPython/autobahn/wamp/message.py | 86,459 | Python |
# parse list of objects
import csv
file = "basic_objects.txt"
objects = []
with open(file) as f:
for line in f:
if line[0:2] == '//' or line[0:2] == None: # skip empties, comments
pass
else:
obj = line.rstrip() # strip Newli... | 30 | 91 | 0.523529 | [
"MIT"
] | rckmnt/How-Big-Is-A-Thing- | py/parse_sort_objects.py | 1,020 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.