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 |
|---|---|---|---|---|---|---|---|---|
# MIT License, Copyright (c) 2020 Bob van den Heuvel
# https://github.com/bheuvel/transip/blob/main/LICENSE
"""Interface with the TransIP API, specifically DNS record management."""
import logging
from enum import Enum
from pathlib import Path
from time import sleep
from typing import Dict, Union
import requests
from... | 34.411458 | 87 | 0.595278 | [
"MIT"
] | bheuvel/transip_dns | transip_dns/transip_interface.py | 13,214 | Python |
# Generated by Django 2.2.1 on 2019-09-07 11:44
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('incidents', '0008_auto_20190829_1231'),
]
operations = [
migrations.AlterModelOptions(
name='incident',
options={'ordering':... | 30.611111 | 245 | 0.658802 | [
"Apache-2.0"
] | ECLK/IncidentManagement | backend/src/incidents/migrations/0009_auto_20190907_1144.py | 551 | Python |
id=732
f = open('sumo_script_pokes', 'r')
for lines in f:
print 'INSERT INTO pokemon_species_names (pokemon_species_id,local_language_id,name) VALUES('+str(id)+',7,"'+lines.strip('\n\r')+'");'
print 'INSERT INTO pokemon_species_names (pokemon_species_id,local_language_id,name) VALUES('+str(id)+',9,"'+lines.strip('\... | 49.76 | 136 | 0.678457 | [
"MIT"
] | thecano/VGCsets | script_utiles/sumo_script.py | 1,244 | Python |
# -*- coding: utf-8 -*-
from django import forms
from django.forms.widgets import RadioSelect
from .models import Rating
class FlagForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user')
self.object = kwargs.pop('object')
super().__init__(*args, **kwargs)
if not self.inst... | 26.95122 | 72 | 0.703167 | [
"MIT"
] | LinuxOSsk/Shakal-NG | rating/forms.py | 1,105 | Python |
from unittest import TestCase
from unittest.mock import patch
import boto3
from botocore.exceptions import ClientError
from moto import mock_iam
from altimeter.aws.resource.iam.iam_oidc_provider import IAMOIDCProviderResourceSpec
from altimeter.aws.scan.aws_accessor import AWSAccessor
from altimeter.core.graph.links ... | 41.793814 | 139 | 0.614208 | [
"MIT"
] | Cemito/altimeter | tests/unit/altimeter/aws/resource/iam/test_oidc_provider.py | 4,054 | Python |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
project... | 33.324324 | 78 | 0.642336 | [
"MIT"
] | ltk2118/imfpy | docs/conf.py | 1,233 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import nonebot
from nonebot.adapters.cqhttp import Bot as CQHTTPBot, message
# 初始化nb
nonebot.init()
# 连接驱动
driver = nonebot.get_driver()
driver.register_adapter("cqhttp", CQHTTPBot)
# 加载插件(除此处其他配置不建议更改)
nonebot.load_builtin_plugins()
nonebot.load_plugins('src/plugins')
... | 21.625 | 61 | 0.738439 | [
"MIT"
] | syhanjin/chizi_bot | bot.py | 744 | Python |
# -*- encoding: utf-8 -*-
"""
Created by eniocc at 11/10/2020
"""
from py_dss_interface.models.XYCurves.XYCurvesF import XYCurvesF
from py_dss_interface.models.XYCurves.XYCurvesI import XYCurvesI
from py_dss_interface.models.XYCurves.XYCurvesS import XYCurvesS
from py_dss_interface.models.XYCurves.XYCurvesV import XY... | 35.111111 | 115 | 0.787975 | [
"MIT"
] | PauloRadatz/py_dss_interface | src/py_dss_interface/models/XYCurves/XYCurves.py | 632 | Python |
import unittest
from typing import cast
from dataladmetadatamodel.common import get_top_level_metadata_objects
from dataladmetadatamodel.datasettree import DatasetTree
from dataladmetadatamodel.metadata import Metadata
from dataladmetadatamodel.metadatapath import MetadataPath
class TestRemote(unittest.TestCase):
... | 39.823529 | 82 | 0.714919 | [
"MIT"
] | christian-monch/metadata-model | dataladmetadatamodel/tests/test_remote.py | 1,354 | Python |
from test.integration.base import DBTIntegrationTest, use_profile
class BaseTestSimpleDependencyWithConfigs(DBTIntegrationTest):
def setUp(self):
DBTIntegrationTest.setUp(self)
self.run_sql_file("seed.sql")
@property
def schema(self):
return "simple_dependency_006"
@property... | 30.356436 | 117 | 0.520059 | [
"Apache-2.0"
] | ChristianKohlberg/dbt | test/integration/006_simple_dependency_test/test_simple_dependency_with_configs.py | 6,132 | Python |
import requests
from news_api.settings.Vespa_config import VESPA_IP, VESPA_PORT
import json
from ast import literal_eval
def GenerateDateParamYql(params):
"""[Check consistency in date parameterGenerate the date yql parameters]
Arguments:
params {[type]} -- [description]
Returns:
... | 32.75 | 107 | 0.539342 | [
"MIT"
] | rdoume/News_API | news_api/endpoints/vespaSearcher.py | 3,406 | Python |
from Good_Boids_module.Update_Boids import Boids
import numpy as np
from nose.tools import assert_almost_equal, assert_greater
from nose.tools import assert_less, assert_equal
from numpy.testing import assert_array_equal
import os
import yaml
from Good_Boids_module.tests.record_fixtures import configuration_file
fixt... | 51.16 | 108 | 0.788898 | [
"MIT"
] | anest1s/Refactoring_the_Bad_Boids | Good_Boids_module/tests/test_the_Good_Boids.py | 2,558 | Python |
#@title 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 agreed to in writing, software
# distribute... | 35.203488 | 131 | 0.663088 | [
"Apache-2.0"
] | Hammer7/Flowers-TF-Lite | flowers_tf_lite.py | 6,055 | Python |
import importlib
import json
from inspect import iscoroutine
from json import JSONDecodeError
from typing import Any, Callable, Dict, List, Union
from loguru import logger
from parse import parse
from pydantic import BaseModel, validator
class Moshi(BaseModel):
call: Union[str, Callable]
args: L... | 29.73494 | 85 | 0.561183 | [
"ISC"
] | CircleOnCircles/moshimoshi | moshimoshi/__init__.py | 2,468 | Python |
#!/usr/bin/python
r"""
Contains PLDM-related constants.
"""
PLDM_SUPPORTED_TYPES = ['base', 'platform', 'bios', 'fru', 'oem-ibm']
# PLDM types.
PLDM_TYPE_BASE = {'VALUE': '00', 'STRING': 'base'}
PLDM_TYPE_PLATFORM = {'VALUE': '02', 'STRING': 'platform'}
PLDM_TYPE_BIOS = {'VALUE': '03', 'STRING': 'bios'}
PLDM_TYPE_FR... | 35.028571 | 99 | 0.643828 | [
"Apache-2.0"
] | jcsteven/openbmc-test-automation | data/pldm_variables.py | 7,356 | Python |
from __future__ import annotations
from jsonclasses import jsonclass, types
@jsonclass
class SuperOneOf:
const: list[str] = types.listof(str).default(['abc', 'def', 'ghi']).required
valconst: str | None = types.str.oneof(['abc', 'def', 'ghi'])
valcallable: str | None = types.str.oneof(lambda o: o.const)
... | 35.272727 | 80 | 0.688144 | [
"MIT"
] | Wiosoft-Crafts/jsonclasses | tests/classes/super_oneof.py | 388 | Python |
import logging
import pytest
from collections import namedtuple, Counter
from tests.platform_tests.counterpoll.cpu_memory_helper import restore_counter_poll # lgtm [py/unused-import]
from tests.platform_tests.counterpoll.cpu_memory_helper import counterpoll_type # lgtm [py/unused-import]
from tests.platform_test... | 48.786026 | 176 | 0.735858 | [
"Apache-2.0"
] | jsanghra/sonic-mgmt | tests/platform_tests/test_cpu_memory_usage.py | 11,172 | Python |
#!/usr/bin/python
import sys
import os
import tkinter
import joblib
import pathlib
from PIL import Image, ImageTk
from PIL.ExifTags import TAGS
from pathlib import Path
from collections import deque
# Built based off of: https://github.com/Lexing/pyImageCropper
# ====================================================... | 34.855114 | 121 | 0.544706 | [
"MIT"
] | Writ3r/pyImageCropper | pyImageCropper/pyImageCropper.py | 12,269 | Python |
# -*- coding: utf-8 -*-
from gluon import *
from s3 import S3CustomController
THEME = "historic.CERT"
# =============================================================================
class index(S3CustomController):
""" Custom Home Page """
def __call__(self):
response = current.response
res... | 39.177083 | 145 | 0.346716 | [
"MIT"
] | AlexanderLaughlin/eden | modules/templates/historic/CERT/controllers.py | 3,761 | Python |
import pandas as pd
import gc
import transformers
from transformers import BertForSequenceClassification, BertTokenizerFast, Trainer, TrainingArguments
from nlp import load_dataset, Dataset
import torch
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.linear_... | 39.38024 | 157 | 0.69239 | [
"MIT"
] | lemay-ai/lazyTextPredict | lazytextpredict/basic_classification.py | 13,153 | Python |
import ray
from ray import workflow
import requests
@ray.remote
def compute_large_fib(M: int, n: int = 1, fib: int = 1):
next_fib = requests.post(
"https://nemo.api.stdlib.com/fibonacci@0.0.1/", data={"nth": n}
).json()
if next_fib > M:
return fib
else:
return workflow.continua... | 24.3 | 80 | 0.648148 | [
"Apache-2.0"
] | Anhmike/ray | python/ray/workflow/examples/comparisons/prefect/compute_fib_workflow.py | 486 | Python |
# blender imports
import bpy
# utility imports
import numpy as np
import csv
import random
import importlib
from src.TSSBase import TSSBase
class TSSMeshHandle(TSSBase):
"""docstring for TSSMeshHandle"""
def __init__(self):
super(TSSMeshHandle, self).__init__()
# class vars ##################... | 32.173611 | 120 | 0.455213 | [
"MIT"
] | 5trobl/oaisys | src/assets/handle/TSSMeshHandle.py | 4,633 | Python |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 41.936543 | 110 | 0.669032 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 0x68/airflow | tests/www/test_security.py | 19,165 | Python |
from typing import Any, Dict, Set
import orjson
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import EventInfo, capture_event
from zerver.lib.user_status import get_user_info_dict, update_user_status
from zerver.models import UserProfile, UserStatus, get_client
def get_away_user_ids... | 30.854077 | 94 | 0.607317 | [
"Apache-2.0"
] | Benocs/zulip | zerver/tests/test_user_status.py | 7,189 | Python |
'''
DCGAN - MNIST Grayscale Handwritten Digits.
Ref: https://machinelearningmastery.com/generative_adversarial_networks/
'''
# import tensorflow.python.ops.numpy_ops.np_config
from data import loadRealSamples
from generator import createGenerator
from discriminator import createDiscriminator
from gan import createGan... | 30 | 72 | 0.786667 | [
"MIT"
] | sem-onyalo/mlm-2-dcgan-digits | main.py | 600 | Python |
# -*- coding: utf-8 -*-
import io
import json
import re
import os
import urllib.error, urllib.parse
from collections import defaultdict
from contextlib import closing
from .. import biblio
from .. import config
from .. import constants
from ..h import *
from ..DefaultOrderedDict import DefaultOrderedDict
from ..messa... | 30.322222 | 96 | 0.584463 | [
"CC0-1.0"
] | agl/bikeshed | bikeshed/update/updateBackRefs.py | 2,729 | Python |
#!/usr/bin/env/python3
# Modified by contributors from Intel Labs
"""
Create json with config tag
"""
import os
import math
def create_json_file(config):
config_file = os.path.join(os.environ['TVM_HOME'],'3rdparty/vta-hw/config/vta_config.json')
vta_params = config.split('_')
gemm_params = vta_params[0].... | 42 | 102 | 0.649725 | [
"Apache-2.0"
] | ekiwi/incubator-tvm-vta | apps/params/create_json.py | 2,184 | Python |
# Generated by Django 2.2.20 on 2021-04-27 18:12
from django.db import migrations
class Migration(migrations.Migration):
"""
Clean records in the `CERTIFICATES_GENERATEDCERTIFICATE` table that are in the downloadable state but also have
old errors still part of their certificate record.
As part of t... | 35.580645 | 119 | 0.714415 | [
"MIT"
] | luque/better-ways-of-thinking-about-software | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/certificates/migrations/0025_cleanup_certificate_errors.py | 1,103 | Python |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | 44.743448 | 79 | 0.549317 | [
"Apache-2.0"
] | ISCAS-VDI/cinder-base | cinder/volume/manager.py | 153,649 | Python |
from __future__ import absolute_import, division, print_function
from six.moves import range
from psana import *
import sys
import numpy as np
from xfel.amo.pnccd_ana import pnccd_tbx
from xfel.amo.pnccd_ana import pnccd_hit
from xfel.amo.pnccd_ana import fxs
import matp... | 32.700743 | 265 | 0.493776 | [
"BSD-3-Clause"
] | jorgediazjr/dials-dev20191018 | modules/cctbx_project/xfel/amo/pnccd_ana/mpi_fxs_mask.py | 17,593 | Python |
"""
Provides `to_ltx` to convert numpy arrays to LaTeX.
"""
import numpy as np
from numpyarray_to_latex.utils import (
math_form,
)
def to_ltx(a,
fmt='{:6.4f}',
latexarraytype='array',
imstring='i',
is_row_vector=True,
mathform=True,
... | 29.115741 | 109 | 0.480204 | [
"MIT"
] | psychemedia/numpyarray_to_latex | numpyarray_to_latex/main.py | 6,289 | Python |
# -*- test-case-name: xmantissa.test.test_offering -*-
# Copyright 2008 Divmod, Inc. See LICENSE file for details
"""
Axiomatic commands for manipulating Mantissa offerings.
"""
from twisted.python import usage
from axiom.scripts import axiomatic
from xmantissa import offering, publicweb
class Install(axiomatic.Axio... | 28.697368 | 69 | 0.624484 | [
"MIT"
] | jonathanj/mantissa | axiom/plugins/offeringcmd.py | 2,181 | Python |
# -*- coding: utf-8 -*-
#
# RequestsThrottler documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 31 13:40:59 2013.
#
# 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 f... | 31.758491 | 81 | 0.72279 | [
"Apache-2.0"
] | a-tal/requests-throttler | docs/conf.py | 8,416 | Python |
# -*- coding: utf-8 -*-
from datetime import date
import json
from operator import itemgetter
import os
import warnings
from django.core.urlresolvers import NoReverseMatch
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.db import models
from django.db.models import signals, Model
fro... | 39.557411 | 111 | 0.639751 | [
"BSD-3-Clause"
] | stefanw/django-cms | cms/models/pluginmodel.py | 18,948 | Python |
from numpy import *
from scipy import ndimage
class RansacModel(object):
""" Class for testing homography fit with ransac.py from
http://www.scipy.org/Cookbook/RANSAC"""
def __init__(self,debug=False):
self.debug = debug
def fit(self, data):
""" Fit homography to ... | 28.349693 | 91 | 0.550747 | [
"BSD-2-Clause"
] | BeToMeve/PCV | PCV/geometry/homography.py | 4,621 | Python |
from django.core.paginator import InvalidPage, EmptyPage, Paginator, PageNotAnInteger
from django.http import HttpResponse
from django.shortcuts import render
from youtube.models import Youtube
# Create your views here.
def youtube(request):
is_login = None
try:
is_login = request.session['i... | 38.3 | 102 | 0.56658 | [
"MIT"
] | amdone/DjangoWebs | PythonWeb/apps/youtube/views.py | 2,103 | Python |
# ----------------------------------------------------------------------------
# Copyright 2021 MonaLabs.io
#
# 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.ap... | 35.72093 | 88 | 0.688232 | [
"Apache-2.0"
] | TalzMona/mona-sdk | mona_sdk/authentication.py | 12,288 | Python |
/usr/lib64/python3.5/_dummy_thread.py | 37 | 37 | 0.837838 | [
"MIT"
] | ndebuhr/thermo-state-solver | thermo-env/lib/python3.5/_dummy_thread.py | 37 | Python |
# Generated by Django 3.0.4 on 2020-04-08 18:23
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | 28.416667 | 118 | 0.615836 | [
"MIT"
] | bertelsm/recipe-app-api | app/core/migrations/0002_tag.py | 682 | Python |
"""
Exceptions interface.
Exceptions allow for ignoring detected issues. This is commonly done to
suppress false positives or to ignore issues that a group has no intention
of addressing.
The two types of exceptions are a list of filenames or regular expressions.
If using filename matching for the exception it is req... | 42.747368 | 99 | 0.571903 | [
"CC0-1.0"
] | axydes/statick | statick_tool/exceptions.py | 8,122 | Python |
#!/usr/bin/env python
# Decodes a given Caesar Cipher encoded string, provided on stdin
# Credit: http://stackoverflow.com/a/10792382
import sys
import string
# Frequency of each character (English)
frequency = dict(zip(string.ascii_uppercase,
[.0817,.0149,.0278,.0425,.1270,.0223,.0202,
... | 36.926829 | 92 | 0.655878 | [
"MIT"
] | AkenSec/scripts | caesar.py | 1,514 | Python |
#El módulo 'os' nos permitirá consultar si un archivo existe.
import os
def mostrar_bienvenida():
print("Bienvenido a ... ")
print("""
_ __
____ ___ (_) ________ ____/ /
/ __ `__ \/ / / ___/ _ \/ __ /
/ / / / / / / / / / __/ /_/ /
/_/ /_/ /_/_/... | 38.029197 | 117 | 0.597889 | [
"MIT"
] | rociof/community-starter-kit | s6red.py | 5,252 | Python |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1.20.7
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
fr... | 38.927184 | 312 | 0.673027 | [
"Apache-2.0"
] | mariusgheorghies/python | kubernetes/client/models/io_xk8s_cluster_infrastructure_v1alpha4_aws_cluster_template_list.py | 8,019 | Python |
"""Test the submodule “batchelper.py”."""
import unittest
import audiorename
import helper
class TestBatch(unittest.TestCase):
def setUp(self):
self.singles = helper.gen_file_list(
['album', 'compilation'],
helper.get_testfile('files'),
)
self.album_broken = help... | 31.427083 | 79 | 0.521545 | [
"MIT"
] | Josef-Friedrich/audiorename | test/test_batch.py | 6,038 | Python |
#!/usr/bin/env python
from __future__ import print_function
import unittest
import sys
import hashlib
import os
import numpy as np
import cv2
import cv2.cv as cv
# Python 3 moved urlopen to urllib.requests
try:
from urllib.request import urlopen
except ImportError:
from urllib import urlopen
class OpenCVTes... | 31.860215 | 139 | 0.570368 | [
"BSD-3-Clause"
] | 552103917/opcv3.4 | modules/python/test/tests_common.py | 5,926 | Python |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPycmd(PythonPackage):
"""pycmd is a collection of command line tools for helping with Py... | 33.25 | 93 | 0.718797 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 0t1s1/spack | var/spack/repos/builtin/packages/py-pycmd/package.py | 665 | Python |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Generates a dictionary file from the training data.
## Examples
```bash
# learn the vocabulary from one task, then ... | 31.339623 | 87 | 0.645194 | [
"MIT"
] | 418sec/ParlAI | parlai/scripts/build_dict.py | 4,983 | Python |
import pytest
from lcs import Perception
from lcs.agents.acs2 import Configuration, ClassifiersList, \
Classifier
class TestClassifierList:
@pytest.fixture
def cfg(self):
return Configuration(8, 8)
def test_should_deny_insertion_illegal_types(self, cfg):
population = ClassifiersList... | 29.013245 | 73 | 0.575439 | [
"MIT"
] | Gab0/pyalcs | tests/lcs/agents/acs2/test_ClassifierList.py | 4,381 | Python |
from django.contrib import admin
from adminsortable.admin import SortableAdmin, SortableTabularInline
from .models import SearchTermCategory, SearchTermItem
class SearchTermItemInline(SortableTabularInline):
model = SearchTermItem
extra = 1
@admin.register(SearchTermCategory)
class SearchTermCategoryAdmin... | 29.285714 | 111 | 0.743902 | [
"Apache-2.0"
] | invinst/CPDBv2_backend | cpdb/search_terms/admin.py | 820 | Python |
# Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
import csv
import os
import numpy as np
import PIL.Image
class ObjectType:
Dontcare, Car, Van, Truck, Bus, Pickup, VehicleWithTrailer, SpecialVehicle,\
Person, Person_fa, Person_unsure, People, Cyclist, Tram, Person_Sitting,\
... | 33.561514 | 117 | 0.560391 | [
"BSD-3-Clause"
] | dcmartin/digits | digits/extensions/data/objectDetection/utils.py | 10,639 | Python |
# -*- coding: utf-8 -*-
"""
This Python module provides various service functions.
Updated since version 1.1:
1. Added support for postprocess and visualization.
2. Added file path validation for parameters of all related methods.
Updated since version 1.2: Merge Code and Update GUI
1. Integrate ... | 49.40038 | 120 | 0.671814 | [
"Apache-2.0"
] | rhydar/Test | source/openwarpgui/openwarp/services.py | 26,034 | Python |
import scrapy
from scrapy.spiders import Rule, CrawlSpider
from scrapy.linkextractors import LinkExtractor
from sulekha.items import SulekhaItem, AddressItem, AddressItemLoader, SulekhaItemLoader
class SulekhaScrapy(CrawlSpider):
name = 'sulekha'
allowed_domains =['sulekha.com','yellowpages.sulekha.com']
s... | 54.022727 | 103 | 0.668069 | [
"BSD-2-Clause"
] | Dalibisi/Scraping-India-YellowPages | sulekha/sulekha/spiders/sulekha_spider.py | 2,377 | Python |
from datetime import datetime, timedelta
from uuid import uuid4
class Uploader:
def generate_token(self):
pass
def generate_download_link(self, object_name, filename) -> (dict, str):
pass
def object_name(self) -> str:
return str(uuid4())
class MockUploader(Uploader):
def __... | 33.525641 | 83 | 0.656214 | [
"MIT"
] | philip-dds/atst | atst/domain/csp/file_uploads.py | 2,615 | Python |
from Bio.Seq import Seq
def cMers(tSeq, k):
kFreq = {}
for x in range(0, len(tSeq) - k + 1):
kMer = tSeq[x : x+k]
if kMer in kFreq:
kFreq[kMer] += 1
else:
kFreq[kMer] = 1
return kFreq
f = open('dataSeq.txt', 'r')
mySeq = Seq(f.read())
cKmer = cMers(mySeq... | 16.85 | 41 | 0.510386 | [
"MIT"
] | AhmedNasser1601/AUG-Problem-Solving-For-Bioinformatics-Level-1- | Session 7/K-mers.py | 337 | Python |
import os
import os.path
import torch
import numpy as np
import pandas
import csv
import random
from collections import OrderedDict
from .base_video_dataset import BaseVideoDataset
from ltr.data.image_loader import jpeg4py_loader
from ltr.admin.environment import env_settings
class Lasot(BaseVideoDataset):
""" La... | 38.680473 | 130 | 0.634389 | [
"Apache-2.0"
] | 2021-DGSW-Ensemble/Ensemble-AI | Stark-main/external/AR/ltr/dataset/lasot.py | 6,537 | Python |
## 2. Introduction to the Data ##
import pandas as pd
all_ages = pd.read_csv('all-ages.csv')
recent_grads = pd.read_csv('recent-grads.csv')
print(all_ages.head())
print(recent_grads.head())
## 3. Summarizing Major Categories ##
# Unique values in Major_category column.
print(all_ages['Major_category'].unique())
aa_... | 30.707317 | 95 | 0.719619 | [
"MIT"
] | vipmunot/Data-Analysis-using-Python | Data Analysis with Pandas Intermediate/Challenge_ Summarizing Data-112.py | 1,259 | Python |
import pytest
from chispa import assert_df_equality
from cishouseholds.pipeline.generate_outputs import configure_outputs
def test_configure_outputs(spark_session):
input_df = spark_session.createDataFrame(
data=[
("England", 6, 2, "02-6SY"),
("NI", 9, 5, "02-6SY"),
("... | 36.95 | 102 | 0.567524 | [
"MIT"
] | ONS-SST/cis_households | tests/pipeline/test_configure_outputs.py | 3,695 | Python |
#!/usr/bin/python
from __future__ import absolute_import, division, print_function
# Copyright 2019-2020 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the ... | 31.968992 | 153 | 0.590204 | [
"MIT"
] | DiptoChakrabarty/nexus | venv/lib/python3.7/site-packages/ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_application_group.py | 8,248 | Python |
from __future__ import print_function, division
import os
from PIL import Image
import numpy as np
from torch.utils.data import Dataset
from mypath import Path
from torchvision import transforms
from dataloaders import custom_transforms as tr
from dataloaders import sp_transforms as tr_sp
class VOCSegmentation(Dataset... | 33.643678 | 100 | 0.571575 | [
"MIT"
] | ChenyanWu/seg_super_pixel | dataloaders/datasets/pascal.py | 5,854 | Python |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""spaCy ANN Linker, a pipeline component for generating spaCy KnowledgeBase Alias Candidates for Entity Linking."""
__version__ = '0.1.10'
from .ann_linker import AnnLinker
from .remote_ann_linker import RemoteAnnLinker
#... | 34.583333 | 116 | 0.772289 | [
"MIT"
] | jjjamie/spacy-ann-linker | spacy_ann/__init__.py | 830 | Python |
from scipy.optimize import minimize
import warnings
import numpy as np
from astropy.io import fits
from astropy.table import Table
from astropy.nddata import NDData
from photutils.psf import extract_stars
from astropy.stats import gaussian_sigma_to_fwhm
from ..core import Block
import matplotlib.pyplot as plt
from coll... | 32.358209 | 131 | 0.577768 | [
"MIT"
] | lgrcia/prose | prose/blocks/psf.py | 10,840 | Python |
import sys
from solc import link_code
from os.path import join
from web3 import Web3
from cobra.project.configuration import Configuration
from cobra.utils import file_reader, yaml_loader, json_loader
from cobra.utils.console_log import console_log
class Interfaces(Configuration):
def __init__(self, web3: Web3,... | 42.801802 | 100 | 0.594401 | [
"MIT"
] | Koritsuki/cobra | cobra/test/interfaces.py | 4,751 | Python |
from django.contrib import admin
from .models import PhoneModel, Phone, Part, Storage, Device
admin.site.register(PhoneModel)
admin.site.register(Phone)
admin.site.register(Part)
admin.site.register(Storage)
admin.site.register(Device)
| 23.8 | 60 | 0.810924 | [
"Unlicense",
"MIT"
] | SashaPoraiko/academy-storage | storage/admin.py | 238 | Python |
connection = {
"id": "1",
"name": "sample name",
"resource_name": "resource name",
"schema_name": "salesforce",
"db_key": "DATABASE_URL",
"state": "IDLE",
"mappings": [{"id": "XYZ", "object_name": "Account", "state": "SCHEMA_CHANGED"}],
}
connections = {"count": 1, "results": [connection]}
| 26.666667 | 85 | 0.575 | [
"Apache-2.0"
] | Thermondo/django-heroku-connect | tests/fixtures.py | 320 | Python |
# -*- coding: utf-8 -*-
from raw._ebutts import *
| 16.666667 | 25 | 0.6 | [
"BSD-3-Clause"
] | ebu/ebu-tt-live-toolk | ebu_tt_live/bindings/_ebutts.py | 50 | Python |
import glob, os
from .exac_parser import load_data
import biothings.hub.dataload.uploader as uploader
from hub.dataload.uploader import SnpeffPostUpdateUploader
class ExacBaseUploader(SnpeffPostUpdateUploader):
__metadata__ = {"mapper" : 'observed',
"assembly" : "hg19",
"src_meta" : {
... | 36.25355 | 98 | 0.205002 | [
"Apache-2.0"
] | raymond301/myvariant.info | src/hub/dataload/sources/exac/exac_upload.py | 17,873 | Python |
"""
"run_HAC.py" executes the training schedule for the agent. By default, the agent will alternate between exploration and testing phases. The number of episodes in the exploration phase can be configured in section 3 of "design_agent_and_env2.py" file. If the user prefers to only explore or only test, the user can... | 37.84375 | 468 | 0.631296 | [
"MIT"
] | erick-alv/Hierarchical-Actor-Critc-HAC- | run_HAC.py | 2,422 | Python |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import re
from marionette.by import By
from gaiatest.apps.base import Base
class Ftu(Base):
name = 'FTU'
_n... | 43.454286 | 143 | 0.738444 | [
"Apache-2.0"
] | EragonJ/gaia | tests/python/gaia-ui-tests/gaiatest/apps/ftu/app.py | 15,209 | Python |
import json
import os
from pyramid.settings import aslist
from kinto.core.decorators import cache_forever
HERE = os.path.abspath(os.path.dirname(__file__))
# Configured home page
@cache_forever
def admin_home_view(request):
settings = {
"authMethods": aslist(request.registry.settings.get('multiauth.pol... | 28.681818 | 90 | 0.721078 | [
"Apache-2.0"
] | g-k/kinto | kinto/plugins/admin/views.py | 631 | Python |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 56.776769 | 239 | 0.623646 | [
"MIT"
] | kceiw/azure-cli | src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py | 150,061 | Python |
'''
Timestamp util for parsing logs
'''
import datetime,sys
from dateutil.parser import parser
class TimeUtil:
def __init__(self, start_win=None, end_win=None):
self.parser = parser()
try:
self.start_win = datetime.datetime.fromtimestamp(start_win)
self.end_... | 33.938144 | 83 | 0.523694 | [
"MIT"
] | ksang/error-extractor | lib/timestamp.py | 3,292 | Python |
"""
[1,0,1,0,1] -> correct
[0,0,1,0] -> return 1
[1,1,0,0,1] -> return 2
"""
def solution2(S):
ans1, ans2 = 0, 0
check1, check2 = 0, 1
for i in S:
if i != check1:
ans1 +=1
if i != check2:
ans2 += 1
check1 = 0 if check1 == 1 else 1
check2 = 0 if check... | 25.292453 | 57 | 0.396121 | [
"MIT"
] | joshiaj7/CodingChallenges | python3/coin_flip.py | 2,681 | Python |
DEPS = [
'recipe_engine/context',
'recipe_engine/json',
'recipe_engine/path',
'recipe_engine/python',
'recipe_engine/raw_io',
'recipe_engine/step',
]
| 18 | 26 | 0.697531 | [
"BSD-3-Clause"
] | 1208460349/depot_tools | recipes/recipe_modules/gerrit/__init__.py | 162 | Python |
# Copyright 2015-2021 SWIM.AI inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | 34.926259 | 119 | 0.63546 | [
"Apache-2.0"
] | DobromirM/swim-system-python | test/recon/test_writers.py | 19,419 | Python |
from django.contrib.gis import admin
from django import forms
from django.utils.translation import gettext_lazy as _
from treebeard.forms import movenodeform_factory
from froide.helper.admin_utils import ForeignKeyFilter
from froide.helper.forms import get_fk_raw_id_widget
from .models import GeoRegion
class GeoRe... | 26.617021 | 77 | 0.704237 | [
"MIT"
] | krmax44/froide | froide/georegion/admin.py | 1,251 | Python |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | 31.941504 | 117 | 0.680736 | [
"Apache-2.0"
] | YangDong2002/datasets | tensorflow_datasets/core/github_api/github_path.py | 11,467 | Python |
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
#
# Copyright (c) 2015 Juniper Networks, Inc.
# All rights reserved.
#
# Use is subject to license terms.
#
# 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... | 37.132212 | 115 | 0.645433 | [
"Apache-2.0"
] | Juniper/wistar | images/views.py | 15,447 | Python |
# ############################################################################
#
# Copyright (c) Microsoft Corporation.
#
# Available under the Microsoft PyKinect 1.0 Alpha license. See LICENSE.txt
# for more information.
#
# ###########################################################################/
"""def... | 34.632166 | 227 | 0.646696 | [
"Apache-2.0"
] | howieraem/KinectActionDetection | pykinect/nui/structs.py | 21,749 | Python |
import _plotly_utils.basevalidators
class ArrowcolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="arrowcolor", parent_name="layout.scene.annotation", **kwargs
):
super(ArrowcolorValidator, self).__init__(
plotly_name=plotly_name,
... | 31.071429 | 87 | 0.664368 | [
"MIT"
] | labaran1/plotly.py | packages/python/plotly/plotly/validators/layout/scene/annotation/_arrowcolor.py | 435 | Python |
from sotd_indicators.indicators import *
from arcgis.gis import GIS
import configparser
import time
class Indicator:
def __init__(self):
# GIS Resources
self.pem = None
self.key = None
self.username = None
self.password = None
self.portal = None
... | 28.017897 | 98 | 0.453689 | [
"MIT"
] | twever/state-of-the-data | state-of-the-data-for-webgis/sotd_indicators/Indicator.py | 12,524 | Python |
# Generated by Django 3.1.2 on 2020-10-18 02:42
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rosters', '0035_auto_20200827_0124'),
]
operations = [
migrations.AlterUniqueTogether(
name='daygroupday',
unique_together={... | 19.944444 | 50 | 0.604457 | [
"MIT"
] | galojix/roster-wizard | rosters/migrations/0036_unique_together_daygroupday.py | 359 | Python |
# -*- coding: utf-8 -*-
from datetime import datetime
import pytest
from AIPscan.conftest import AIP_1_CREATION_DATE, AIP_2_CREATION_DATE
from AIPscan.conftest import ORIGINAL_FILE_SIZE as JPEG_1_01_FILE_SIZE
from AIPscan.conftest import PRESERVATION_FILE_SIZE as JPEG_1_02_FILE_SIZE
from AIPscan.Data import fields, ... | 38.044025 | 88 | 0.723425 | [
"Apache-2.0"
] | artefactual-labs/AIPscan | AIPscan/Data/tests/test_formats_count.py | 6,049 | Python |
import json
from kazoo.client import KazooClient
zk = KazooClient(hosts='127.0.0.1:2181')
zk.start()
value = json.dumps({'host': '127.0.0.2', 'port': 8080}).encode()
zk.ensure_path('/demo')
r = zk.create('/demo/rpc', value, ephemeral=True, sequence=True)
print(r)
zk.stop() | 23 | 64 | 0.688406 | [
"MIT"
] | ResolveWang/rpc_demo | zk/producer.py | 276 | Python |
import io
import os
import random
import textwrap
from PIL import Image, ImageDraw, ImageFont
from telethon.tl.types import InputMessagesFilterDocument
from uniborg.util import admin_cmd
@borg.on(admin_cmd(pattern="srgb (.*)"))
async def sticklet(event):
R = random.randint(0,256)
G = random.randint(0,256)
... | 24.61194 | 93 | 0.688902 | [
"MIT"
] | Fregiant16/fregiantuserbot | userbot/plugins/srgb.py | 1,649 | Python |
import platform
import json
import subprocess
import os
from urllib2 import urlopen
from lbryschema import __version__ as lbryschema_version
from lbryum import __version__ as LBRYUM_VERSION
from lbrynet import build_type, __version__ as lbrynet_version
from lbrynet.conf import ROOT_DIR
def get_lbrynet_version():
... | 31.106383 | 85 | 0.621067 | [
"MIT"
] | mrlucky9/lbry | lbrynet/core/system_info.py | 1,462 | Python |
from _std_inplace_ops import *
from _std_construct1_ops import *
from _std_construct2_ops import *
| 24.75 | 33 | 0.848485 | [
"Apache-2.0"
] | Alienmaster/pykaldi | kaldi/fstext/_std_ops.py | 99 | Python |
import gflags
import logging
import threading
import time
FLAGS = gflags.FLAGS
gflags.DEFINE_integer("probe_frequency_secs", 10*60,
"How often to probe the logs for updates")
from ct.client import log_client
from ct.client import monitor
from ct.client import state
from ct.crypto import merkle
... | 41.268293 | 80 | 0.581757 | [
"Apache-2.0"
] | DavadDi/archon | vendor/github.com/google/certificate-transparency/python/ct/client/prober.py | 5,076 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from api.tests.base import BaseTest
class IndexTest(BaseTest):
def test_index(self):
# Expected result from server.
expected_result = "Hello Flask Restful Example!"
# Send request to index.
response = self.client.get("/")
# This... | 22.761905 | 56 | 0.640167 | [
"MIT"
] | JackyCJ/flask-restful-login | api/tests/tests_index.py | 478 | Python |
# Generated by Django 3.0.10 on 2021-02-01 18:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0054_auto_20210201_1832'),
]
operations = [
migrations.AlterField(
model_name='bcmactivity',
name='MTPD',
... | 52.55102 | 237 | 0.530874 | [
"MIT"
] | ig0r45ure/recipe-app-api | app/core/migrations/0055_auto_20210201_1838.py | 2,610 | Python |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import sys
from xml.etree import ElementTree
from xml.etree.ElementTree import Element, SubElement
from lxml import etree
import codecs
from libs.constants import DEFAULT_ENCODING
from libs.ustr import ustr
XML_EXT = '.xml'
ENCODE_METHOD = DEFAULT_ENCODING
class PascalVo... | 37.555556 | 123 | 0.559993 | [
"MIT"
] | yuxluo/umtri_video_label | libs/pascal_voc_io.py | 12,168 | Python |
"""
Description: This file implements a wrapper around the original SLCT code in C
Author: LogPAI team
License: MIT
"""
import sys
sys.path.append('../')
import hashlib
import pandas as pd
import re
from datetime import datetime
from ..logmatch import regexmatch
import subprocess
import os
import logg... | 35.660194 | 155 | 0.59284 | [
"MIT"
] | LogAnalysisTeam/logparser | logparser/SLCT/SLCT.py | 7,346 | Python |
from discord.ext import commands, tasks
from collections import Counter, defaultdict
from .utils import checks, db, time, formats
from .utils.paginator import CannotPaginate
import pkg_resources
import logging
import discord
import textwrap
import datetime
import traceback
import itertools
import typing
import asyncp... | 37.937674 | 124 | 0.570532 | [
"MIT"
] | ymypengueni/RoboDanny | cogs/stats.py | 40,783 | Python |
# =================================================================
# IMPORT REQUIRED LIBRARIES
# =================================================================
import os
# =================================================================
# READ DATA
# ===============================================================... | 29.41573 | 77 | 0.395722 | [
"MIT"
] | priyalr/advent-of-code | 2021/day-06-lanternfish/day-06.py | 2,618 | Python |
from frappe import _
def get_data():
return [
{
"module_name": "Notice",
"color": "grey",
"icon": "octicon octicon-file-directory",
"type": "module",
"label": _("Notice")
}
]
| 15.153846 | 44 | 0.573604 | [
"MIT"
] | GreatDevelopers/Notice-gneEdu | noticeboard/config/desktop.py | 197 | Python |
from panda3d.core import *
from direct.distributed.DistributedObject import DistributedObject
from direct.interval.IntervalGlobal import *
from toontown.toonbase import ToontownGlobals
from otp.avatar import Emote
from toontown.toontowngui import TTDialog
import webbrowser, SafezoneInvasionGlobals
class DistributedSaf... | 45.923664 | 342 | 0.65625 | [
"MIT"
] | TTOFFLINE-LEAK/ttoffline | v2.5.7/toontown/election/DistributedSafezoneInvasion.py | 6,016 | Python |
from configparser import ConfigParser
# Initialize the Parser.
config = ConfigParser()
# Add the Section.
config.add_section('graph_api')
# Set the Values.
config.set('graph_api', 'client_id', '_______')
print('set client ID')
config.set('graph_api', 'client_secret', '_______')
print('set client secret')... | 24.454545 | 52 | 0.684015 | [
"Unlicense"
] | perrinromney/Teams_Status | write_config.py | 538 | Python |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import odoo.tests
@odoo.tests.tagged('post_install','-at_install')
class TestUi(odoo.tests.HttpCase):
def test_01_crm_tour(self):
self.start_tour("/web", 'crm_tour', login="admin")
| 24.727273 | 74 | 0.724265 | [
"MIT"
] | LucasBorges-Santos/docker-odoo | odoo/base-addons/crm/tests/test_crm_ui.py | 272 | Python |
import battery_test
if __name__ == '__main__':
#assert(EV_test.battery_is_ok(25, 70, 0.7) is True)
#assert(EV_test.battery_is_ok(50, 85, 0) is False)
assert(battery_test.check_battery_is_ok({'temperature' : 25,'soc' : 70,'charge_rate' : 0.9}) is False)
assert(battery_test.check_battery_is_ok({'tempera... | 53.111111 | 107 | 0.700837 | [
"MIT"
] | wanderer-soul92/functional-python-wanderer-soul92 | check_limits.py | 478 | Python |
"""Unit tests for comparison functions for geometry types.
Authors: Ayush Baid
"""
import unittest
from typing import List
from unittest.mock import patch
import numpy as np
from gtsam import Cal3_S2, Point3, Pose3, Rot3, Similarity3, Unit3
from gtsam.examples import SFMdata
import gtsfm.utils.geometry_comparisons a... | 40.373529 | 120 | 0.663801 | [
"Apache-2.0"
] | yuancaimaiyi/gtsfm | tests/utils/test_geometry_comparisons.py | 13,727 | Python |
#!/usr/bin/python
"""Code for backing up pictures and videos captured to Dropbox"""
import sys
import os
import glob
from os import listdir
from os.path import isfile, join
import subprocess
from Adafruit_IO import Client, RequestError
import base64
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dir... | 31.59434 | 113 | 0.637802 | [
"MIT"
] | ryhajlo/camera_backup | camera_backup.py | 3,349 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.