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 |
|---|---|---|---|---|---|---|---|---|
from setuptools import setup, find_packages
setup(
name='simplefb',
version='0.2.0a1',
description='A simple facebook graph api and auth Mixins',
url='https://github.com/fm100/simplefb',
author='Freddie Park',
author_email='sorelove@gmail.com',
license='MIT',
# See https://pypi.python... | 31.736842 | 77 | 0.631012 | [
"MIT"
] | fm100/simplefb | setup.py | 1,206 | Python |
#
# Copyright (c) 2019-2020 Intel Corporation
#
# 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 agre... | 36.43299 | 91 | 0.658083 | [
"Apache-2.0"
] | BrightTux/model_server | example_client/multi_inputs.py | 10,602 | Python |
from sys import maxsize
class Contact:
def __init__(self, firstname=None, lastname=None, homephone=None, mobilephone=None,workphone=None, secondaryphone=None, id=None):
self.firstname=firstname
self.lastname=lastname
self.homephone=homephone
self.workphone = workphone
sel... | 31.230769 | 134 | 0.64532 | [
"Apache-2.0"
] | Valeryiar/python_training | model/contact.py | 812 | Python |
import asyncio
import logging
import types
import typing
import enum
from dataclasses import dataclass
from ..types import ASGIApp, Message
from ..exceptions import LifespanUnsupported, LifespanFailure, UnexpectedMessage
class LifespanCycleState(enum.Enum):
"""
The state of the ASGI `lifespan` connection.
... | 39.443878 | 87 | 0.644289 | [
"MIT"
] | IlyaSukhanov/mangum | mangum/protocols/lifespan.py | 7,731 | Python |
from django.contrib.auth.models import User
from django.test import TestCase
from .models import Conf, Site, SitePermission
class ConfTestCase(TestCase):
def test_conf_created(self):
site = Site.objects.create(domain='test.site', name='Test Site')
self.assertIsInstance(site.conf, Conf)
class S... | 35.96875 | 74 | 0.67159 | [
"BSD-2-Clause"
] | dyndeploy-test/timestrap | conf/tests.py | 1,151 | Python |
import json
import socket
def is_jsonable(obj):
try:
json.dumps(obj)
return True
except (TypeError, OverflowError, ValueError):
return False
def sanitize_meta(meta):
keys_to_sanitize = []
for key, value in meta.items():
if not is_jsonable(value):
keys_to_s... | 22.702703 | 74 | 0.591667 | [
"MIT"
] | markcurtis1970/python | logdna/utils.py | 840 | Python |
# Copyright 2017 IBM Corp.
#
# 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 a... | 35.12 | 78 | 0.730068 | [
"Apache-2.0"
] | openstack/nova-powervm | nova_powervm/virt/powervm/volume/gpfs.py | 878 | Python |
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from jupyter_core.paths import jupyter_data_dir
import subprocess
import os
import errno
import stat
c = get_config() # noqa: F821
c.NotebookApp.ip = "0.0.0.0"
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = F... | 31.422535 | 142 | 0.636934 | [
"BSD-3-Clause"
] | colinjbrown/dfext-dockerstack | jupyter_notebook_config.py | 2,231 | Python |
#!/usr/bin/env python
#
# Copyright (C) 2013 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | 35.454183 | 90 | 0.627374 | [
"BSD-3-Clause"
] | FLOSSBoxIN/src | third_party/android_platform/development/scripts/stack.py | 8,899 | Python |
import FWCore.ParameterSet.Config as cms
process = cms.Process("DQM")
# message logger
process.MessageLogger = cms.Service("MessageLogger",
destinations = cms.untracked.vstring('cout'),
cout = cms.untracked.PSet(threshold = cms.untracked.string('... | 39.485294 | 106 | 0.664804 | [
"Apache-2.0"
] | 7quantumphysics/cmssw | DQM/Integration/python/clients/info_dqm_sourceclient-live_cfg.py | 2,685 | Python |
"""CategoricalMLPPolicy."""
import akro
import tensorflow as tf
from metarl.tf.distributions import Categorical
from metarl.tf.models import MLPModel
from metarl.tf.policies import StochasticPolicy
class CategoricalMLPPolicy(StochasticPolicy):
"""CategoricalMLPPolicy
A policy that contains a MLP to make pre... | 39.71831 | 78 | 0.623227 | [
"MIT"
] | icml2020submission6857/metarl | src/metarl/tf/policies/categorical_mlp_policy.py | 5,640 | Python |
# Copyright (c) 2015 OpenStack Foundation
#
# 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 ... | 46.102132 | 79 | 0.616817 | [
"Apache-2.0"
] | 1pintbeer/neutron | neutron/tests/unit/agent/l3/test_dvr_local_router.py | 41,077 | Python |
import os
import pickle
import string
import time
import logging
import numpy as np
def get_logger(name=__file__, level=logging.INFO):
logger = logging.getLogger(name)
if getattr(logger, "_init_done__", None):
logger.setLevel(level)
return logger
logger._init_done__ = True
logger.pr... | 22 | 75 | 0.63843 | [
"MIT"
] | SebastianMacaluso/ClusterTrellis | src/ClusterTrellis/utils.py | 1,452 | Python |
"""
sphinx.util.cfamily
~~~~~~~~~~~~~~~~~~~
Utility functions common to the C and C++ domains.
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import warnings
from copy import deepcopy
from typing import (
Any, Callable, L... | 33.050228 | 91 | 0.550014 | [
"BSD-2-Clause"
] | OliverSieweke/sphinx | sphinx/util/cfamily.py | 14,476 | Python |
from app import create_app
app = create_app()
if __name__ == '__main__':
app.run(debug=True, port=5000) | 18.166667 | 34 | 0.706422 | [
"MIT"
] | simonwuchj/docker-nginx-uwsgi-flask-mysql | nginx-flask/webapp/run.py | 109 | Python |
#!/usr/bin/env python
"""
Generate Sequence from a pdbfile and to modify the squences.
Author: {0} ({1})
This module is part of CADEE, the framework for
Computer-Aided Directed Evolution of Enzymes.
"""
from __future__ import print_function
import logging
import os
import sys
import time
import config
__author_... | 30.851563 | 79 | 0.443024 | [
"MIT"
] | kamerlinlab/cadee | cadee/prep/genseqs.py | 7,898 | Python |
from sklearn.cluster import MiniBatchKMeans
import numpy as np
import torch
from models import TransformerModel, Seq2SeqTransformer, generate_square_subsequent_mask
from models import LM_NAME, MLM_NAME, MT_NAME, NLAYERS, NUM2WORD
import os
from data_preprocessing import DATA_DIR_DEV, SAVE_DATA_MT_TRAIN
from data_prepr... | 48.347015 | 154 | 0.713668 | [
"MIT"
] | Superhzf/PaperImplementation | NLP/The_Bottom_up_Evolution_of_Representations_in_the_Transformer/analytics.py | 12,957 | Python |
# coding: utf-8
"""
ThingsBoard REST API
ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501
OpenAPI spec version: 3.3.3PAAS-RC1
Contact: info@thingsboard.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_impo... | 47.564299 | 824 | 0.655179 | [
"Apache-2.0"
] | D34DPlayer/thingsboard-python-rest-client | tb_rest_client/api/api_pe/widgets_bundle_controller_api.py | 24,781 | Python |
#!/usr/bin/env python
# Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list ... | 42.863636 | 72 | 0.792683 | [
"BSD-3-Clause"
] | TribeMedia/sky_engine | sky/engine/build/scripts/make_element_factory.py | 1,886 | Python |
"""
Module to handle gamma matrices expressed as tensor objects.
Examples
========
>>> from sympy.physics.hep.gamma_matrices import GammaMatrix as G, LorentzIndex
>>> from sympy.tensor.tensor import tensor_indices
>>> i = tensor_indices('i', LorentzIndex)
>>> G(i)
GammaMatrix(i)
N... | 33.739554 | 180 | 0.588483 | [
"MIT"
] | CatTiger/vnpy | venv/lib/python3.7/site-packages/sympy/physics/hep/gamma_matrices.py | 24,225 | Python |
"""
Test Contacts API Endpoint | Cannlytics API
Author: Keegan Skeate
Contact: <keegan@cannlytics.com>
Created: 7/19/2021
Updated: 7/19/2021
License: MIT License <https://opensource.org/licenses/MIT>
"""
import os
import requests
from dotenv import load_dotenv
# Test using development server.
BASE = 'http://127.0.0.1... | 29.543478 | 79 | 0.513245 | [
"MIT"
] | mathematicalmichael/cannlytics | tests/api/test_contacts_endpoint.py | 2,718 | Python |
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pysnmp/license.html
#
# ASN.1 source http://mibs.snmplabs.com:80/asn1/SNMPv2-TM
# Produced by pysmi-0.4.0 at Sun Feb 17 08:56:38 2019
#
# Parts of otherwise autogenerated MIB has been u... | 28.92233 | 109 | 0.71176 | [
"BSD-2-Clause"
] | BurgundyWillow/pysnmp | pysnmp/smi/mibs/SNMPv2-TM.py | 8,937 | Python |
from .mail import (MSGraphMailSource, MSGraphMailAccountHandle,
MSGraphMailAccountResource, MSGraphMailAccountSource,
MSGraphMailMessageResource, MSGraphMailMessageHandle) # noqa
from . import files # noqa
| 44.8 | 69 | 0.794643 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | bellcom/os2datascanner | src/os2datascanner/engine2/model/msgraph/__init__.py | 224 | Python |
# coding=utf-8
"""Tests for certbot._internal.main."""
# pylint: disable=too-many-lines
import datetime
from importlib import reload as reload_module
import io
import itertools
import json
import shutil
import sys
import tempfile
import traceback
import unittest
from typing import List
import josepy as jose
import pyt... | 48.66326 | 103 | 0.659459 | [
"Apache-2.0"
] | I-Cat/certbot | certbot/tests/main_test.py | 90,467 | Python |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 51.592284 | 119 | 0.581462 | [
"Apache-2.0"
] | Rossil2012/mindspore | mindspore/nn/layer/conv.py | 49,477 | Python |
# uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: encodings.cp1026
import codecs
class Codec(codecs.Codec):
def encode(self, input, errors='strict'):
return codecs.charmap_... | 48.878049 | 767 | 0.749501 | [
"Apache-2.0"
] | theclashingfritz/Cog-Invasion-Online-Dump | encodings/cp1026.py | 2,004 | Python |
"""
WSGI config for lacuna project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` s... | 39.692308 | 79 | 0.805556 | [
"BSD-3-Clause"
] | Murithi/lacuna | config/wsgi.py | 1,548 | Python |
# Undirected Graph from demo represented as Adjacency List
graph = {
"a": [("b", 7), ("c", 9), ("f", 14)],
"b": [("a", 7), ("c", 10), ("d", 15)],
"c": [("a", 9), ("b", 10), ("d", 11), ("f", 2)],
"d": [("b", 15), ("c", 11), ("e", 6)],
"e": [("d", 6), ("f", 9)],
"f": [("a", 14), ("c", 2), ("e", 9... | 24.958333 | 58 | 0.435726 | [
"MIT"
] | PacktPublishing/Python-Data-Structures-and-Algorithms-v- | Section4/graph_adj_list.py | 599 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import *
from tensorlayer.models import Model
from tests.utils import CustomTestCase
class Laye_BatchNorm_Test(CustomTestCase):
... | 32.736585 | 124 | 0.573387 | [
"Apache-2.0"
] | JingqingZ/tensorlayer2 | tests/layers/test_layers_normalization.py | 6,711 | Python |
#!/usr/bin/env python3
#author markpurcell@ie.ibm.com
"""RabbitMQ helper class.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses th... | 35 | 116 | 0.74424 | [
"Apache-2.0"
] | IBM/castor-messaging | tests/conftest.py | 2,170 | Python |
from unittest.mock import call
from sls.completion.complete import Completion
from sls.completion.context import CompletionContext
from sls.document import Document
import sls.sentry as sentry
def test_complete(magic, patch):
patch.init(Document)
patch.many(Document, ["line_to_cursor", "word_to_cursor"])
... | 29.880597 | 76 | 0.653846 | [
"Apache-2.0"
] | wilzbach/storyscript-sls | tests/unittests/completion/complete.py | 2,002 | Python |
import json
import numpy as np
from tune._utils import normalize_hp
def test_normalize_hp():
assert isinstance(np.int64(10), np.int64)
assert 10 == normalize_hp(np.int64(10))
assert not isinstance(normalize_hp(np.int64(10)), np.int64)
assert json.dumps(dict(a=[0, 1], b=1.1, c="x")) == json.dumps(
... | 26.466667 | 72 | 0.657431 | [
"Apache-2.0"
] | fugue-project/tune | tests/tune/_utils/test_values.py | 397 | 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... | 45.642857 | 122 | 0.676056 | [
"MIT"
] | 00Kai0/azure-cli-extensions | src/stack-hci/azext_stack_hci/generated/commands.py | 1,278 | Python |
from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
def index(request):
return HttpResponse("Check URL => /admin") | 27.666667 | 46 | 0.771084 | [
"MIT"
] | pradyneel/xtreme-weather | emailautomate/views.py | 166 | Python |
# -*- coding: utf-8 -*-
#
# This document is free and open-source software, subject to the OSI-approved
# BSD license below.
#
# Copyright (c) 2011 - 2013 Alexis Petrounias <www.petrounias.org>,
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted p... | 46.925 | 80 | 0.773042 | [
"BSD-3-Clause"
] | kordian-kowalski/django-cte-forest | cte_forest/__init__.py | 1,877 | Python |
"""CveException Class"""
import cloudpassage.sanity as sanity
from .halo_endpoint import HaloEndpoint
from .http_helper import HttpHelper
class CveExceptions(HaloEndpoint):
"""Initializing the CveException class:
Args:
session (:class:`cloudpassage.HaloSession`): This will define how you
... | 32.366412 | 79 | 0.619811 | [
"BSD-3-Clause"
] | cloudpassage/cloudpassage-halo-python-sdk | cloudpassage/cve_exception.py | 4,240 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayUserAccountBindingSyncModel(object):
def __init__(self):
self._alipay_user_id = None
self._create_time = None
self._data_version = None
self._havana_user_id ... | 30.244275 | 79 | 0.59364 | [
"Apache-2.0"
] | Anning01/alipay-sdk-python-all | alipay/aop/api/domain/AlipayUserAccountBindingSyncModel.py | 3,962 | Python |
h = input('Digite algo: ')
print(type(h))
print('É alfanumérico?',h.isalnum())
print('É decimal?',h.isdecimal())
print('É maiúsculo?',h.isupper())
print('É minúsculo?',h.islower())
print('É imprimível?',h.isprintable())
| 24.555556 | 38 | 0.674208 | [
"MIT"
] | miguelsndc/Exercicios-Python | primeiros-exercicios/lpc002.py | 230 | Python |
"""
JunOSLikeDevice Class is abstract class for using in Juniper JunOS like devices
Connection Method are based upon AsyncSSH and should be running in asyncio loop
"""
import re
from netdev.logger import logger
from netdev.vendors.base import BaseDevice
class JunOSLikeDevice(BaseDevice):
"""
... | 40.10274 | 119 | 0.644236 | [
"Apache-2.0"
] | ColinSix/netdev | netdev/vendors/junos_like.py | 5,855 | Python |
"""
Finance-specific data cleaning functions.
"""
import json
from datetime import date
from functools import lru_cache
import pandas as pd
import pandas_flavor as pf
import requests
from janitor.errors import JanitorError
from .utils import check, deprecated_alias, is_connected
currency_set = {
"AUD",
"B... | 29.384718 | 107 | 0.57356 | [
"MIT"
] | aliavni/pyjanitor | janitor/finance.py | 21,921 | Python |
from __future__ import annotations
from uuid import uuid4
import pytest
from protean import BaseCommandHandler, BaseEvent, BaseEventSourcedAggregate, handle
from protean.core.command import BaseCommand
from protean.core.event_sourced_aggregate import apply
from protean.fields import Identifier, String
from protean.g... | 24.988764 | 84 | 0.657824 | [
"BSD-3-Clause"
] | mpsiva89/protean | tests/event_sourced_aggregates/test_raising_events_from_within_aggregates.py | 2,224 | Python |
from datetime import datetime
import json
from unittest import TestCase
from celery.schedules import schedule, crontab
try: # celery 3.x
from celery.utils.timeutils import timezone
except ImportError: # celery 4.x
from celery.utils.time import timezone
from redbeat.decoder import RedBeatJSONDecoder, RedBeat... | 26.006369 | 104 | 0.546657 | [
"Apache-2.0"
] | NextChance/redbeat | tests/test_json.py | 4,083 | Python |
from typing import Optional, Any, Dict, List, Text, Tuple
from collections import defaultdict
SUBJECT_WITH_BRANCH_TEMPLATE = u'{repo} / {branch}'
SUBJECT_WITH_PR_OR_ISSUE_INFO_TEMPLATE = u'{repo} / {type} #{id} {title}'
EMPTY_SHA = '0000000000000000000000000000000000000000'
COMMITS_LIMIT = 20
COMMIT_ROW_TEMPLATE = u'... | 39.930556 | 133 | 0.704464 | [
"Apache-2.0"
] | roberthoenig/zulip | zerver/lib/webhooks/git.py | 8,625 | Python |
import random
import unittest
from typing import Tuple
import torch
import numpy as np
from src.utilities import set_random_seed
_RANDOM_SEED: int = random.randint(0, 100)
_TEST_ARRAY_SIZE: Tuple[int, int] = (2, 2)
_TEST_TENSOR_SIZE: Tuple[int, int] = (2, 2)
def _set_random_seed():
set_random_seed(
ra... | 24.764706 | 72 | 0.684086 | [
"MIT"
] | iblamedom/kuenstliche-intelligenz | tests/test_set_random_seed.py | 1,263 | Python |
import re
from typing import Any
from typing import Awaitable
from typing import Callable
from typing import Dict
from typing import List
class CommandRouter:
def __init__(self, subrouters: List["CommandRouter"] = []) -> None:
self.command_handlers: Dict[str, Callable[..., Awaitable[Any]]] = dict()
... | 32.451613 | 80 | 0.637177 | [
"MIT"
] | asymmetric/marvin-mk2 | marvin/command_router.py | 1,006 | Python |
# coding: utf-8
import sys
from collections import Counter
import numpy as np
import tensorflow.contrib.keras as kr
import tensorflow as tf
if sys.version_info[0] > 2:
is_py3 = True
else:
# reload(sys)
sys.setdefaultencoding("utf-8")
is_py3 = False
def native_word(word, encoding='utf-8'):
"""如果在... | 32.739645 | 114 | 0.646665 | [
"MIT"
] | a414351664/Bert-THUCNews | data/cnews_loader_bert.py | 6,073 | Python |
import os
import pandas as pd
COMPETITION_NAME = "tabular-playground-series-sep-2021"
SUBMISSION_DIR = "."
SUBMISSION_FILE = "sub_blending_1_my_rank_004-2o-lightgbm-colsample_81830_my_ranking_81790_0926_1918.csv"
SUBMISSION_MESSAGE = '"004-2o-lightgbm-colsample-tps-sep-2021 + stacking_lgb_xbg_cat_imputer_no_impute... | 29.3 | 130 | 0.812287 | [
"Apache-2.0"
] | arnabbiswas1/k_tab_sept_roc_auc_binary_classification_KFold | submissions/submissions_22.py | 586 | Python |
from dataclasses import field, dataclass
from pathlib import Path
from typing import Any
from .anki_deck_archiver import AnkiDeckArchiver
from .archiver import AllDeckArchiver
from .dulwich_repo import DulwichAnkiRepo
from ..anki.adapters.deck_manager import AnkiStaticDeckManager, DeckManager
from ..anki.ui.utils impo... | 40.290909 | 121 | 0.678249 | [
"MIT"
] | evandroforks/CrowdAnki | history/archiver_vendor.py | 2,216 | Python |
import hiplot
import lwa_antpos
def get_exp(uri):
df = lwa_antpos.lwa_df.reset_index()
df.drop(0, inplace=True) # remove antnum=0
df.antname = df.antname.apply(lambda x: int(x.split('-')[1]))
df.rename(columns={'antname': 'antnum'}, inplace=True)
df = df[['antnum', 'pola_fee', 'polb_fee', 'arx_add... | 38.461538 | 119 | 0.69 | [
"BSD-3-Clause"
] | jaycedowell/mnc_python | mnc/lwa_hiplot.py | 500 | Python |
#
# This file is part of Orchid and related technologies.
#
# Copyright (c) 2017-2021 Reveal Energy Services. All Rights Reserved.
#
# LEGAL NOTICE:
# Orchid contains trade secrets and otherwise confidential information
# owned by Reveal Energy Services. Access to and use of this information is
# strictly limited and... | 36.811321 | 87 | 0.678626 | [
"Apache-2.0"
] | Reveal-Energy-Services/orchid-python-api | examples.py | 1,951 | Python |
import os
import subprocess
from tempfile import NamedTemporaryFile
from jinja2 import Template
# This file designed in a way that is independent of Django
# in order to be easy (but changes are required) to be used
# outside Django in the future
# That's why is using jinja2 as a template language instead of
# Djang... | 27.355932 | 108 | 0.656753 | [
"MIT"
] | Swiss-Polar-Institute/schema-collaboration-arctic-century | SchemaCollaboration/datapackage_to_documentation/main.py | 3,228 | Python |
# ========================================================================= #
# Copyright 2018 National Technology & Engineering Solutions of Sandia,
# LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS,
# the U.S. Government retains certain rights in this software.
#
# Licensed under the Apache... | 32.293638 | 121 | 0.547181 | [
"Apache-2.0"
] | DaveDRoberts/PECOS | pecos/qeccs/surface_medial_4444/instructions.py | 19,796 | Python |
# Copyright 2021 AIPlan4EU project
#
# 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 wri... | 44.885906 | 170 | 0.638906 | [
"Apache-2.0"
] | aiplan4eu/unified-planning | unified_planning/engines/parallel.py | 6,688 | Python |
# coding: utf-8
"""
Purity//FB REST Client
Client for Purity//FB REST API (1.0), developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/).
OpenAPI spec version: 1.5
Contact: info@purestorage.com
Gene... | 27.701299 | 197 | 0.585795 | [
"Apache-2.0"
] | unixtreme/purity_fb_python_client | purity_fb/purity_fb_1dot5/models/hardware_connector_response.py | 4,266 | Python |
#####################
# IMPORT DEPENDENCIES
######################
# flask (server)
from flask import(
Flask,
render_template,
jsonify,
request,
redirect)
#######################
# FLASK SET-UP
#######################
app = Flask(__name__)
#######################
# FLASK ROUTES
###############... | 17.483871 | 45 | 0.479705 | [
"MIT"
] | risatino/seadogz | app.py | 542 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015 Felix Wunsch, Communications Engineering Lab (CEL) / Karlsruhe Institute of Technology (KIT) <wunsch.felix@googlemail.com>.
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | 37.666667 | 140 | 0.670703 | [
"BSD-2-Clause"
] | xueyuecanfeng/C-LQI | gr-ieee802-15-4/python/qa_dqpsk_soft_demapper_cc.py | 2,147 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2021 Snowflake Computing Inc. All right reserved.
#
from snowflake.connector.util_text import construct_hostname
def test_construct_hostname_basic():
assert (
construct_hostname("eu-central-1", "account1")
== "account1.eu-centra... | 28.477273 | 85 | 0.672785 | [
"Apache-2.0"
] | Fayel-cyber/snowflake-connector-python | test/unit/test_construct_hostname.py | 1,253 | Python |
#
# -*- coding: utf-8 -*-
#
import unittest
import os
import shutil
import yaml
import tensorflow as tf
from neural_compressor.experimental import model_conversion
tf.compat.v1.enable_eager_execution()
from tensorflow import keras
from tensorflow.python.framework import graph_util
from neural_compressor.adaptor.tf_u... | 35.808219 | 146 | 0.666985 | [
"Apache-2.0"
] | huggingface/neural-compressor | test/test_model_conversion.py | 5,228 | Python |
"""Template helper methods for rendering strings with Home Assistant data."""
from __future__ import annotations
from ast import literal_eval
import asyncio
import base64
import collections.abc
from contextlib import suppress
from contextvars import ContextVar
from datetime import datetime, timedelta
from functools im... | 31.853752 | 269 | 0.627608 | [
"Apache-2.0"
] | apapadopoulou/core | homeassistant/helpers/template.py | 49,660 | Python |
import threading, queue
import time
import random
import logging
logging.basicConfig(level=logging.DEBUG, format='(%(threadName)-9s) %(message)s',)
NUMBER_OF_THREADS = 4
TIMEOUT_SECONDS = 5
class SampleThread(threading.Thread):
def __init__(self, group=None, target=None, name=None, id=None, kwargs=None):
... | 27.918367 | 82 | 0.645468 | [
"MIT"
] | guneykayim/python-examples | multithreading/multithreading_simple.py | 1,368 | Python |
'''
Class Name: File
Purpose: The purpose of this class is represent data of a particular file
in a file system.
'''
class File:
def __init__(self, name = None, directory = None, date = None, fId = None, folderId = None, extension = ""):
self.__name = name
self.__directory = directory
self.__date = date
... | 23 | 109 | 0.717391 | [
"MIT"
] | tanvirtin/Cloud-Backup | scripts/File.py | 1,380 | Python |
import csv
import numpy as np
import os
import sys
import time
import jismesh.utils as ju
import pandas as pd
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
sys.path.append(rootPath)
from common.datastructure.Point import Point
from common.datastructure.Mesh imp... | 36.542135 | 110 | 0.547506 | [
"MIT"
] | deepkashiwa/DeepUrbanEvent | meshdynamic/meshDynamic-Density.py | 26,018 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Test the quoted APOGEE uncertainties from individual (rebinned) spectra. """
__author__ = "Andy Casey <arc@ast.cam.ac.uk>"
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
from glob import glob
from itertools import combinations
def ge... | 28.142857 | 87 | 0.606368 | [
"MIT"
] | andycasey/luminosity-cannon | data/check_apogee_spectra.py | 2,167 | Python |
import praw
c_id='34kxuaxc4yWiKw'
c_secret='8bJqHqNHFdB6NKV9sHzFbo4_Dl4'
ua='my user agent'
un='the_ugly_bot'
pwd='whatever930'
def login():
r = praw.Reddit(client_id=c_id,
client_secret=c_secret,
user_agent=ua,
username=un,
passwor... | 22.4 | 44 | 0.58631 | [
"MIT"
] | MrTsRex/Reddit_bot | obot.py | 336 | Python |
from __future__ import annotations
import abc
from dataclasses import asdict as asdict_, fields, is_dataclass
from pathlib import Path
from typing import Dict, Union, Tuple
from pprint import pformat
from covid_shared import ihme_deps
import numpy as np
import pandas as pd
import yaml
class YamlIOMixin:
"""Mixi... | 29.612613 | 79 | 0.634621 | [
"BSD-3-Clause"
] | ihmeuw/covid-model-seiir-pipeline | src/covid_model_seiir_pipeline/lib/utilities.py | 3,287 | Python |
import tensorflow as tf
from tensorflow.contrib.losses.python.metric_learning.metric_loss_ops import pairwise_distance
def dist_weighted_sampling(labels, embeddings, high_var_threshold=0.5, nonzero_loss_threshold=1.4, neg_multiplier=1):
"""
Distance weighted sampling.
# References
- [sampling matt... | 45.948864 | 128 | 0.632497 | [
"Apache-2.0"
] | miroozyx/Magin-Based-loss | loss.py | 8,087 | Python |
import tensorflow as tf
import numpy as np
class WindowGenerator():
def __init__(self, input_width, label_width, shift,
train_df, val_df, test_df, label_columns=None):
# Store the raw data.
self.train_df = train_df
self.val_df = val_df
self.test_df = test_df
# Work out the label ... | 31.387097 | 83 | 0.666667 | [
"MPL-2.0"
] | EFR-AI/AIBSIF | src/data_cleaning/window_generator.py | 2,919 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-10 14:38
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('studies', '0015_auto_20170707_1820'),
]
operations = [
migrations.AlterModelOptions... | 62.8 | 890 | 0.700637 | [
"MIT"
] | enrobyn/lookit-api | studies/migrations/0016_auto_20170710_1438.py | 1,256 | Python |
from src.analysis.QQZoneAnalysis import QQZoneAnalysis
import json
from src.util.constant import BASE_DIR
from src.util.util import get_mktime2
import pandas as pd
import re
from src.analysis.SentimentClassify import SentimentClassify
class TrainMood(QQZoneAnalysis):
"""
生成各种训练需要的数据集
"""
def __init_... | 43.269231 | 141 | 0.627232 | [
"MIT"
] | 343695222/QQZoneMood | src/analysis/TrainMood.py | 12,717 | Python |
from __future__ import absolute_import, unicode_literals
from django import forms
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from mayan.apps.common.classes import ModelProperty
from mayan.apps.common.forms import FilteredSelectionForm
from mayan.apps.documents... | 36.191489 | 79 | 0.678424 | [
"Apache-2.0"
] | BajacDev/Mayan-EDMS | mayan/apps/document_indexing/forms.py | 1,701 | Python |
import io
import json
import os
from django.conf import settings
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from cms.menu_bases import CMSAttachMenu
from menus.base import NavigationNode
from menus.menu_pool import menu_pool
class DocumentationMenu(CMSAttachMenu):
... | 32.589744 | 94 | 0.623131 | [
"MIT"
] | beeduino/djangocms-cascade | cmsplugin_cascade/sphinx/cms_menus.py | 1,271 | Python |
"""Constants for Airly integration."""
from __future__ import annotations
from typing import Final
from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT
from homeassistant.const import (
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
DEVICE_CLASS_AQI,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_PM1,
... | 31.666667 | 76 | 0.73985 | [
"Apache-2.0"
] | Airzzz0801/core | homeassistant/components/airly/const.py | 3,325 | Python |
#!/usr/bin/env python3
# Copyright 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Ignore indention messages, since legacy scripts use 2 spaces instead of 4.
# pylint: disable=bad-indentation,docstring-section-... | 31.832402 | 103 | 0.663449 | [
"BSD-3-Clause"
] | DHowett/fw-ectool | chip/mchp/util/pack_ec.py | 17,094 | Python |
#!/usr/bin/env python
"""Configuration parameters for the client."""
from grr.lib import config_lib
from grr.lib import rdfvalue
from grr.lib.rdfvalues import crypto
# General Client options.
config_lib.DEFINE_string("Client.name", "GRR",
"The name of the client. This will be used as a base "... | 40.506757 | 80 | 0.643453 | [
"Apache-2.0"
] | theGreenJedi/grr | grr/config/client.py | 11,990 | Python |
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="inference-tools",
version="0.5.2",
author="Chris Bowman",
author_email="chris.bowman.physics@gmail.com",
description="A collection of python tools for Bayesian data analysis... | 31.761905 | 74 | 0.677661 | [
"MIT"
] | Shimwell/inference-tools | setup.py | 667 | Python |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
i... | 62.94069 | 1,390 | 0.645665 | [
"Apache-2.0"
] | MiaoRachelYu/python | kubernetes/client/apis/batch_v1_api.py | 91,264 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-12-06 16:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('roster', '0021_auto_20180825_1843'),
]
operations = [
migrations.AlterField... | 26.857143 | 164 | 0.597518 | [
"MIT"
] | AmoleR/otis-web | roster/migrations/0022_auto_20181206_1148.py | 564 | Python |
import argparse
import logging
import json
import os
def submission(origin_file, topics, runtag, output_file):
with open(output_file, 'a') as fout, open(origin_file, 'r') as fin:
for line in fin:
data = line.strip().split(' ')
if data[0] in topics:
continue
... | 36.016667 | 92 | 0.574734 | [
"Apache-2.0"
] | AceZhan/anserini | src/main/python/ecir2019_ccrf/generate_runs.py | 2,161 | Python |
# author : chenxi
# encoding:utf-8
import time
import run
if __name__ == "__main__":
mutex = 1
user = 0
users = []
while True:
if mutex == 1:
mutex = mutex - 1
try:
users.append(user)
users[user] = run.Score()
users[user].run_server()
user = user + 1
mutex = mutex +1
... | 16.851852 | 30 | 0.564835 | [
"MPL-2.0"
] | atomchan/CCUScore | main.py | 455 | Python |
# -*- coding: utf-8 -*-
#
# Submittable API Client documentation build configuration file, created by
# sphinx-quickstart on Mon Jun 9 15:21:21 2014.
#
# 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
# autogenera... | 31.961977 | 112 | 0.721865 | [
"MIT"
] | shawnr/submittable-api-client | docs/source/conf.py | 8,406 | Python |
"""Carbon Scraper Plugin for Userbot. //text in creative way.
usage: .karb //as a reply to any text message
Thanks to @r4v4n4 for vars,,, Random RGB feature by @PhycoNinja13b"""
from selenium.webdriver.support.ui import Select
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
fr... | 20.615764 | 235 | 0.590203 | [
"MIT"
] | Fregiant16/fregiantuserbot | userbot/plugins/carbonRGB (2).py | 4,229 | Python |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
__author__ = 'Andreas Bader'
__version__ = "0.01"
# db_folders -> List of DB Folder (for space check)
# db_client -> name of ycsb client
# db_args -> special ycsb arguments for this db
# db_name -> name of this db (e.g. for workload file)
# db_desc -> more detailed name/... | 83.816327 | 230 | 0.660701 | [
"Apache-2.0"
] | TSDBBench/Overlord | vagrant_files/generator/files/databases/druid_cl5_rf1.py | 8,214 | Python |
"""Tensorflow trainer class."""
import logging
import math
import os
from typing import Callable, Dict, Optional
import numpy as np
import tensorflow as tf
from .modeling_tf_utils import TFPreTrainedModel, shape_list
from .optimization_tf import GradientAccumulator, create_optimizer
from .trainer_utils import PREFIX... | 39.844394 | 119 | 0.608086 | [
"Apache-2.0"
] | 52Pig/transformers | src/transformers/trainer_tf.py | 17,412 | Python |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Unselected(_BaseTraceHierarchyType):
# marker
# ------
@property
def marker(self):
"""
The 'marker' property is an instance of Marker
that may be specified as:
... | 37.224723 | 85 | 0.552 | [
"MIT"
] | Jonathan-MW/plotly.py | plotly/graph_objs/scattergeo/__init__.py | 104,192 | Python |
"""MxShop URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | 31.938776 | 91 | 0.755911 | [
"BSD-2-Clause"
] | ScorpioDoctor/DjangoVueShop | MxShop/MxShop/urls.py | 3,226 | Python |
from inspect import isclass
from django.conf import settings
from django.core.files.storage import get_storage_class
from celery.datastructures import AttributeDict
from tower import ugettext_lazy as _
__all__ = ('LOG', 'LOG_BY_ID', 'LOG_KEEP',)
class _LOG(object):
action_class = None
class CREATE_ADDON(_LOG... | 23.909209 | 79 | 0.628241 | [
"BSD-3-Clause"
] | muffinresearch/zamboni | apps/amo/log.py | 18,434 | Python |
# -*- coding: latin-1 -*-
#
# Turn off logging in extensions (too loud!)
from vb2py.test.testframework import *
import vb2py.extensions
import vb2py.utils
vb2py.extensions.disableLogging()
from vb2py.vbparser import buildParseTree, VBParserError
#
# Set some config options which are appropriate for testing
import vb... | 16.757576 | 67 | 0.623418 | [
"BSD-3-Clause"
] | ceprio/xl_vb2py | vb2py/test/testdotnet.py | 2,212 | Python |
# -*- coding: utf-8 -*-
"""
pyvisa-py.protocols.usbtmc
~~~~~~~~~~~~~~~~~~~~~~~~~~
Implements Session to control USBTMC instruments
Loosely based on PyUSBTMC:python module to handle USB-TMC(Test and
Measurement class) devices.
by Noboru Yamamot, Accl. Lab, KEK, JAPAN
This file is an offsp... | 31.393519 | 145 | 0.595045 | [
"MIT"
] | circuitfox/pyvisa-py | pyvisa-py/protocols/usbtmc.py | 13,564 | Python |
print('-'*20)
print('CADASTRE UMA PESSOA')
print('-'*20)
total = totalm = totalf = 0
while True:
idade = int(input('Idade: '))
if idade >= 18:
total += 1
sexo = ' '
while sexo not in 'MF':
sexo = str(input('Sexo: [M/F]')).strip().upper()[0]
# observações!
if sexo == 'M':
... | 25.9 | 73 | 0.537967 | [
"MIT"
] | GabrielSantos25/Python | Exercicios em python/ex69.py | 779 | Python |
import os
import moderngl
import numpy as np
from objloader import Obj
from PIL import Image
from pyrr import Matrix44
import data
from window import Example, run_example
class CrateExample(Example):
title = "Crate"
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.prog = self.... | 27.604396 | 111 | 0.513137 | [
"MIT"
] | einarf/ModernGL | examples/crate.py | 2,512 | Python |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | 22.355556 | 105 | 0.72167 | [
"Apache-2.0"
] | MiaoRachelYu/python | kubernetes/test/test_v1_scale_io_volume_source.py | 1,006 | Python |
import datetime
import json
import os
import re
import time
import uuid
import warnings
from pathlib import Path
from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Union
from urllib.parse import urljoin
# if simplejson is installed, `requests` defaults to using it instead of json
# this allows th... | 35.985834 | 101 | 0.55071 | [
"Apache-2.0"
] | zmac12/prefect | src/prefect/client/client.py | 55,892 | Python |
# Enter your code here. Read input from STDIN. Print output to STOUT
import re
for _ in range(int(input())):
try:
re.compile(input())
print (True)
except re.error:
print (False)
| 24.666667 | 69 | 0.581081 | [
"MIT"
] | 3agwa/Competitive-Programming-1 | Hackerrank_python/9.erros and exceptions/66.Incorrect Regex.py | 222 | Python |
cor = {'traço': '\033[35m', 'ex': '\033[4;31m', 'título': '\033[1;34m', 'str': '\033[1;33m', 'reset': '\033[m'}
print('{}-=-{}'.format(cor['traço'], cor['reset'])*18, '{} Exercício 026 {}'.format(cor['ex'], cor['reset']),
'{}-=-{}'.format(cor['traço'], cor['reset'])*18)
print('{}Faça um programa que leia uma fra... | 76.615385 | 118 | 0.593373 | [
"MIT"
] | WesleyOlliver/CursoPython | ex026.py | 1,014 | Python |
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from .agent import agent
from .ci import ci
from .clean import clean
from .config import config
from .create import create
from .dep import dep
from .docs import docs
from .env import env
from .meta import... | 28.052632 | 101 | 0.763602 | [
"BSD-3-Clause"
] | 0gajun/integrations-core | datadog_checks_dev/datadog_checks/dev/tooling/commands/__init__.py | 533 | Python |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: mediapipe/framework/formats/annotation/rasterization.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import... | 35.547619 | 405 | 0.763563 | [
"MIT"
] | mesquita97/HandTalks | GestureVolume/venv/lib/python3.8/site-packages/mediapipe/framework/formats/annotation/rasterization_pb2.py | 4,479 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | 34.988981 | 123 | 0.596016 | [
"BSD-2-Clause"
] | LR-FGMM/weblabdeusto | server/src/experiments/ud_xilinx/watertank_simulation.py | 12,701 | 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/creature/npc/base/shared_dantari_base_male.iff"
result.attribute_template_id... | 26.764706 | 74 | 0.731868 | [
"MIT"
] | SWGANHServices/GameServer_Legacy | data/scripts/templates/object/creature/npc/base/shared_dantari_base_male.py | 455 | Python |
import datetime
import itertools
import logging
import os
import platform
import time
from collections import defaultdict
from operator import itemgetter
from typing import (
AbstractSet,
Any,
Callable,
Dict,
Iterable,
List,
Mapping,
MutableMapping,
Optional,
Sequence,
Set,
... | 43.178697 | 133 | 0.659801 | [
"Apache-2.0"
] | gutalavijay1111/zulip-vijay | zerver/lib/actions.py | 257,820 | Python |
from hashedml.hashedml import *
| 16 | 31 | 0.8125 | [
"MIT"
] | mtingers/hashedml | hashedml/__init__.py | 32 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.