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 |
|---|---|---|---|---|---|---|---|---|
# Created by MechAviv
# ID :: [140010000]
# Snow Island : Dangerous Forest
if not "o" in sm.getQuestEx(21019, "arr"):
sm.avatarOriented("Effect/OnUserEff.img/guideEffect/aranTutorial/tutorialArrow3")
sm.setQuestEx(21019, "arr", "o") | 40 | 85 | 0.720833 | [
"MIT"
] | Bia10/MapleEllinel-v203.4 | scripts/field/rienArrow.py | 240 | Python |
import json
import random
import uuid
import numpy as np
import time
import requests
import traceback
import pdb
import math
import ast
import pandas as pd
import pickle
from qwikidata.linked_data_interface import get_entity_dict_from_api
from qwikidata.sparql import return_sparql_query_results
from urllib3.exceptions... | 37.780347 | 109 | 0.54896 | [
"CC0-1.0"
] | gabrielmaia7/WDV | WikidataClaims/wikidata_utils.py | 6,536 | Python |
# Generated by Django 3.2.3 on 2021-05-26 11:31
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spa', '0003_alter_servic... | 35.484848 | 130 | 0.624253 | [
"MIT"
] | zhumakova/Django | django_project/user_profile/migrations/0003_auto_20210526_1731.py | 1,171 | Python |
from pypy.module.clr.interp_clr import split_fullname
def test_split_fullname():
split = split_fullname
assert split('Foo') == ('', 'Foo')
assert split('System.Foo') == ('System', 'Foo')
assert split('System.Foo.Bar') == ('System.Foo', 'Bar')
assert split('System.Foo.A+B') == ('System.Foo', 'A+B')
... | 33.727273 | 59 | 0.606469 | [
"MIT"
] | benoitc/pypy | pypy/module/clr/test/test_interp_clr.py | 371 | Python |
#climber.py
#Robot Code For BlueCrew 6153
import wpilib
#Commands to make the robot climb.
class Climber:
climb_motor = wpilib.Talon
#Set robot to climb when motor is on.
def climb(self):
self.climb_motor.set(1)
#Stops the robot from climbing when motor is off.
def stop_climb(self... | 21.952381 | 53 | 0.657267 | [
"MIT"
] | BlueCrewRobotics/2017Robot | components/climber.py | 461 | 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 us... | 40.271635 | 100 | 0.685429 | [
"BSD-2-Clause",
"Apache-2.0",
"CC0-1.0",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Chinazhanhuli/spark | python/pyspark/pandas/data_type_ops/base.py | 16,753 | Python |
#! python
from nose.tools import assert_true, assert_raises
import random
from networkx import random_reference, lattice_reference, sigma, omega
import networkx as nx
rng = random.Random(0)
rng = 42
def test_random_reference():
G = nx.connected_watts_strogatz_graph(50, 6, 0.1, seed=rng)
Gr = random_referenc... | 31.059701 | 77 | 0.694858 | [
"BSD-3-Clause"
] | fanglab/6mASCOPE | SLpackage/private/thirdparty/pythonpkgs/networkx/networkx_2.2/lib/python2.7/site-packages/networkx/algorithms/tests/test_smallworld.py | 2,081 | Python |
from setuptools import find_packages, setup
def find_required():
with open("requirements.txt") as f:
return f.read().splitlines()
def find_dev_required():
with open("requirements-dev.txt") as f:
return f.read().splitlines()
setup(
name="vedro-allure-reporter",
version="0.2.4",
... | 30.243243 | 69 | 0.662198 | [
"Apache-2.0"
] | nikitanovosibirsk/vedro-allure-reporter | setup.py | 1,119 | Python |
# Copyright (c) 2015 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the S... | 32.583851 | 106 | 0.629527 | [
"MIT"
] | JoanAzpeitia/lp_sg | install/app_store/tk-multi-shotgunpanel/v1.4.8/python/app/work_area_button.py | 10,492 | Python |
#!/usr/bin/env python
"""The setup script."""
from setuptools import find_packages, setup
with open('requirements.txt') as f:
INSTALL_REQUIREs = f.read().strip().split('\n')
with open('README.md', encoding='utf8') as f:
LONG_DESCRIPTION = f.read()
CLASSIFIERS = [
'Development Status :: 4 - Beta',
'Lic... | 37.390244 | 119 | 0.700587 | [
"BSD-3-Clause"
] | andersy005/repo2singularity | setup.py | 1,533 | Python |
from functools import partial
from itertools import product
import numpy as np
from tlz import curry
from ..base import tokenize
from ..utils import funcname
from .blockwise import BlockwiseCreateArray
from .core import Array, normalize_chunks
from .utils import (
meta_from_array,
empty_like_safe,
full_l... | 27.896552 | 87 | 0.645705 | [
"BSD-3-Clause"
] | BlueOwlDev/dask | dask/array/wrap.py | 6,472 | Python |
"""
Tests for lyrics_tagger
"""
from __future__ import unicode_literals
from __future__ import print_function
import unittest
import mock
import lyricstagger.misc as misc
import test.fakers as fakers
# pylint: disable=R0904
class MiscCheck(unittest.TestCase):
"""Test miscelanous functions"""
def test_get_tags... | 41.280488 | 79 | 0.612703 | [
"MIT"
] | abulimov/lyricstagger | test/test_misc.py | 3,385 | Python |
import copy
import torch
import logging
import numpy as np
from sacred import Experiment
from noge.data_loaders import get_datasets, get_test_loader, get_train_generator
from noge.factory import make_env, make_memory
from noge.network import make_network
from noge.agent import Actor, main_loop, loop_ing
from noge.trai... | 38.987013 | 115 | 0.673051 | [
"MIT"
] | johny-c/noge | scripts/train_dqn.py | 6,004 | Python |
from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.http import JsonResponse
from Constants import *
from Gifts.getRecommendations.RS import Users, Recommendations
import json
# Create your views here.
def... | 39.085714 | 99 | 0.6197 | [
"Apache-2.0"
] | exarus/GiftRecommenderSystem | backend/Gifts/views.py | 5,472 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutTuples(Koan):
def test_creating_a_tuple(self):
count_of_three = (1, 2, 5)
self.assertEqual(5, count_of_three[2])
def test_tuples_are_immutable_so_item_assignment_is_not_possible(self):
count_of_three =... | 33.985915 | 91 | 0.590137 | [
"MIT"
] | rhgraysonii/python_koan_solutions | koans/koans/about_tuples.py | 2,413 | Python |
# NLP written by GAMS Convert at 04/21/18 13:51:47
#
# Equation counts
# Total E G L N X C B
# 73 73 0 0 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... | 48.913194 | 120 | 0.632001 | [
"MIT"
] | ouyang-w-19/decogo | tests/examples/minlplib/ex8_3_13.py | 14,087 | Python |
from setuptools import setup
from requests_tor import __version__
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name="requests_tor",
version=__version__,
author="deedy5",
description="Multithreading requests via TOR with automatic TOR new identity",
l... | 35.393939 | 82 | 0.638699 | [
"MIT"
] | Omarnabk/requests_tor | setup.py | 1,168 | Python |
# coding=utf-8
# Copyright 2020 The Google Research 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 applicab... | 34.330275 | 80 | 0.736772 | [
"Apache-2.0"
] | 3rd/google-research | stochastic_to_deterministic/hashing.py | 3,742 | Python |
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.tools.mo.front.common.partial_infer.elemental import copy_shape_infer
from openvino.tools.mo.graph.graph import Graph
from openvino.tools.mo.ops.op import Op
class PReLU(Op):
op = 'PReLU'
enabl... | 26.075 | 83 | 0.57814 | [
"Apache-2.0"
] | 3Demonica/openvino | tools/mo/openvino/tools/mo/ops/prelu.py | 1,043 | Python |
import sys, os
import pytest
import tenseal.sealapi as sealapi
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from utils import *
@pytest.mark.parametrize(
"compr_type",
[sealapi.COMPR_MODE_TYPE.NONE, sealapi.COMPR_MODE_TYPE.ZLIB, sealapi.COMPR_MODE_TYPE.ZSTD],
)
def test_serialization_compressi... | 30.472803 | 95 | 0.679665 | [
"Apache-2.0"
] | CerineBnsd/TenSEAL | tests/python/sealapi/test_sanity.py | 7,283 | Python |
import assemblyline_client
import mocks
import mock
from base64 import b64decode
def test_bad_cert():
"""Make sure that the client detects that the test cert is self signed."""
with mocks.Server() as server:
try:
assemblyline_client.get_client(server.address)
assert False
... | 38 | 108 | 0.662152 | [
"MIT"
] | IanLee1521/assemblyline_client | test/test_v3_client.py | 2,584 | Python |
from datetime import datetime, timedelta
from typing import List, Optional
from sqlalchemy import or_
from dispatch.plugin import service as plugin_service
from dispatch.event import service as event_service
from dispatch.incident import flows as incident_flows
from dispatch.incident.flows import incident_service
fro... | 34.613402 | 108 | 0.656739 | [
"Apache-2.0"
] | WouldYouKindly/dispatch | src/dispatch/task/service.py | 6,715 | Python |
import logging
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.logging import LoggingIntegration
from sentry_sdk.integrations.celery import CeleryIntegration
from .base import * # noqa
from .base import env
# GENERAL
# -----------------------------------... | 39.256881 | 89 | 0.6276 | [
"MIT"
] | Musyimi97/veritasLtd | config/settings/production.py | 8,558 | Python |
#!/usr/bin/env python3
import boto3
s3_client = boto3.client('s3')
raw_response = s3_client.list_buckets()
for bucket in raw_response['Buckets']:
print(bucket['Name'])
| 24.571429 | 39 | 0.738372 | [
"MIT"
] | sw33tr0ll/aws-training | labs/lab2.py | 172 | Python |
# -*- coding: utf-8 -*-
import os
import sys
import datetime
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from django.conf import settings
from app1.models import Thing
class Command(BaseCommand):
args = '<id name>'
help = 'create or update thing model.... | 27.318182 | 76 | 0.460344 | [
"BSD-2-Clause"
] | dictoss/proto | python-django/djmultidb/app1/management/commands/set_thing.py | 1,803 | Python |
import os
import yaml
from .cassette import Cassette
def load_cassette(cassette_path):
try:
pc = yaml.load(open(cassette_path))
cassette = Cassette(pc)
return cassette
except IOError:
return None
def save_cassette(cassette_path, cassette):
dirname, filename = os.path.spli... | 24.571429 | 60 | 0.689922 | [
"MIT"
] | charlax/vcrpy | vcr/files.py | 516 | Python |
from audio import Stream, AudioSettings
class PhraseRecognizer(object):
def __init__(self, config, audio_settings: AudioSettings):
self._config = config
self._audio_settings = audio_settings
def get_config(self):
return self._config
def get_audio_settings(self) -> AudioSettings:
... | 28.719298 | 70 | 0.717776 | [
"Apache-2.0"
] | ReanGD/smart-home | recognition/base.py | 1,637 | Python |
import datetime as dt
from airflow.models import DAG
from airflow.operators.dummy import DummyOperator
from airflow.operators.python import PythonOperator
default_args = {
'start_date': dt.datetime.now() - dt.timedelta(days=7),
'owner': 'airflow'
}
def throw_error():
raise Exception('It failed!')
with... | 23.586207 | 148 | 0.717836 | [
"MIT"
] | GrokData/grok-airflow-dags | dags/test_dag_failure.py | 684 | Python |
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings
from django.utils import timezone
# Create your models here.
class Article(models.Model):
title=models.CharField(max_length=100)
slug=models.SlugField(blank=True)
body= models.TextField()
... | 31.809524 | 77 | 0.685629 | [
"MIT"
] | Blaise-design/Django-Hospital-Project | articles/models.py | 668 | Python |
import pygad
import functools
import operator
import numpy
def fitness_func(genes, solution_idx):
group1Sum = sum(genes[0:5])
group2Product = functools.reduce(operator.mul, genes[5:10])
duplicateCount = (len(genes) - len(set(genes)))
return 1 / ((abs(36 - group1Sum) + abs(360 - group2Product)) + 1) - ... | 35.863636 | 86 | 0.581749 | [
"Apache-2.0"
] | monfared01/GeneticAlgorithmsWithPython | withPyGAD/ch06/cardTests.py | 1,578 | Python |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from botbuilder.dialogs.memory import scope_path
from .memory_scope import MemoryScope
class SettingsMemoryScope(MemoryScope):
def __init__(self):
super().__init__(scope_path.SETTINGS)
self._empty_setti... | 29.5 | 77 | 0.680085 | [
"MIT"
] | Ask-Waldo/botbuilder-python | libraries/botbuilder-dialogs/botbuilder/dialogs/memory/scopes/settings_memory_scope.py | 944 | Python |
# coding: utf-8
"""
FlashArray REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.11
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
import typing
from ... | 28.992308 | 105 | 0.529053 | [
"BSD-2-Clause"
] | Flav-STOR-WL/py-pure-client | pypureclient/flasharray/FA_2_11/models/port_common.py | 3,769 | Python |
# Generated by Django 3.0.6 on 2020-06-22 13:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('src', '0010_temporaryuser'),
]
operations = [
migrations.RemoveField(
model_name='admin',
name='username',
)... | 21.217391 | 52 | 0.567623 | [
"MIT"
] | DipikaPawar12/Visitor-Management-System | visitor_manage/src/migrations/0011_auto_20200622_1909.py | 488 | Python |
# # Python Week-7 Day-42
# Python Classes and Objects 2
print(" -- Let us create a method in the Person class --")
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def myfunc(self):
print("Hello my name is " + self.name )
p1 = Person("John", "36")
p1.myfunc(... | 20.847222 | 77 | 0.588941 | [
"Unlicense"
] | abusamrah2005/Python | Week-7/Day-42.py | 1,501 | Python |
"""
@brief Pure python implementation of the Bayesian Blocks algorithm
described by Jackson, Scargle et al. 2005, IEEE Signal Processing
Letters, 12, 105. (http://arxiv.org/abs/math/0309285)
@author J. Chiang <[email protected]>
"""
#
# $Id: BayesianBlocks_python.py,v 1.1.1.1 2011/09/03 00:55:59 jchiang Exp $
... | 35.171875 | 77 | 0.554568 | [
"BSD-3-Clause"
] | fermi-lat/BayesianBlocks | python/BayesianBlocks_python.py | 6,753 | Python |
#!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
"""Entry point for cwltool."""
import argparse
import copy
import functools
import io
import logging
import os
import signal
import subprocess # nosec
import sys
import time
import urllib
import warnings
from codecs import StreamWriter, getwriter
from collections.abc imp... | 35.69103 | 88 | 0.574365 | [
"Apache-2.0"
] | suecharo/cwltool | cwltool/main.py | 53,715 | Python |
from scrapy import Spider
from scrapy.spiders import CrawlSpider, Rule
from scrapy.selector import Selector
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.linkextractors import LinkExtractor
import scrapy
from scrapy.spidermiddlewares.ht... | 29.2 | 133 | 0.638177 | [
"MIT"
] | Nouldine/CrawlerSystems | UW_Madison/UW_Madison/spiders/uw_madison_courses3.py | 3,358 | Python |
import unittest
import pandas as pd
import numpy as np
from resources.backend_scripts.is_data import DataEnsurer
from resources.backend_scripts.load_data import LoaderCreator
from resources.backend_scripts.split_data import SplitterReturner
class MyTestCase(unittest.TestCase):
_loader_creator = LoaderCreator()
... | 45.368932 | 117 | 0.673015 | [
"BSD-3-Clause"
] | Noczio/VoorSpelling | AppVoor/tests/split_data_test.py | 4,673 | Python |
import sys
import os
import json
import re
import numpy as np
import pandas as pd
from ... | 35.93038 | 199 | 0.42223 | [
"MIT"
] | kbasecollaborations/MotifFinderalgoMFMD | lib/MotifFindermfmd/Utils/obsolete/parser.py | 5,677 | 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... | 38.533654 | 152 | 0.675234 | [
"Apache-2.0"
] | 8bitmp3/datasets | tensorflow_datasets/object_detection/open_images_challenge2019.py | 8,015 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2021-10-02 20:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0017_user_email_subscribed'),
]
operations = [
migrations.CreateMo... | 28.28 | 114 | 0.591231 | [
"MIT"
] | EncryptEx/myhackupc | user/migrations/0018_loginrequest.py | 707 | Python |
import logging
from typing import Text, List, Optional, Dict, Any
from rasa.nlu.config import RasaNLUModelConfig
from rasa.nlu.training_data import TrainingData, Message
from rasa.nlu.components import Component
from rasa.nlu.constants import (
RESPONSE_ATTRIBUTE,
TEXT_ATTRIBUTE,
CLS_TOKEN,
TOKENS_NAM... | 31.644928 | 88 | 0.608198 | [
"Apache-2.0"
] | Ali-vohra/final_project | rasa/nlu/tokenizers/tokenizer.py | 4,367 | Python |
from importlib import import_module
from rest_framework import status
from rest_framework.response import Response
from rest_framework.viewsets import GenericViewSet
class HookViewSet(GenericViewSet):
def post(self, request, *args, **kwargs):
data = request.data
action = data['action']
e... | 33.8 | 73 | 0.648521 | [
"MIT"
] | PythonBenin/sphinx-bot | hook/viewsets.py | 845 | Python |
import os
imagedir = "/Users/titlis/cogsci/projects/stanford/projects/overinformativeness/experiments/5_norming_object_typicality/images"
for t in os.listdir(imagedir):
if not t.startswith("."):
for i in os.listdir(imagedir+"/"+t):
if not i.startswith("."):
print "{"
print "\"item\": \""+i[0:-4]+"\","
... | 30.916667 | 127 | 0.638814 | [
"MIT"
] | thegricean/overinformativeness | experiments/5_norming_object_typicality_phrasing1/results/scripts/makeItemList.py | 371 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-04 21:24
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('registration', '0013_eventresult_scoresubmittedby'),
]
... | 24.590909 | 90 | 0.661738 | [
"MIT"
] | arpanpathak/college-fest-management | registration/migrations/0014_eventresult_timestamp.py | 541 | Python |
# Copyright 2019, 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 agreed to in writing... | 41.086643 | 80 | 0.734645 | [
"Apache-2.0"
] | houcharlie/federated | utils/training_loop.py | 11,381 | Python |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nba_stats.settings.base")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| 23.363636 | 78 | 0.774319 | [
"MIT"
] | sparbz/nba-stats | nba_stats/manage.py | 257 | Python |
def setup_inp(inp):
"""Convert list of strings into list of lists, with glves/goblins replaced by tuples"""
grid = []
for rowI,row in enumerate(inp.split("\n")):
grid.append([x for x in row])
for colI,col in enumerate(row):
if col in ["G","E"]:
#Replace ene... | 33.359223 | 117 | 0.511641 | [
"MIT"
] | mark-inderhees/aoc | 2018/15/helpme.py | 13,744 | Python |
#!/usr/bin/env python3
import math
import csv
import itertools
from pprint import pprint
import func
INPUTFILE = './task04.input'
def main():
accept = 0
with open(INPUTFILE, mode='r') as csvfile:
reader = csv.reader(csvfile, delimiter=" ")
lines = list(reader)
for line in lines:
... | 20.5 | 67 | 0.533875 | [
"MIT"
] | mboehn/aoc2017 | task04_a.py | 738 | Python |
# Date 3/10/2020
# __Author__ : AdityaLata
# __Package__ : Python 3
# __GitHub__ : https://www.github.com/adityalata
from Python.DataStructure.TreeDS.Node import Node
# A utility function to check if 'c' is an operator
def isOperator(c):
if c == '+' or c == '-' or c == '*' or c == '/' or c == '^':
... | 25.258824 | 84 | 0.615277 | [
"MIT"
] | adityalata/AlgorithmsAndDataStructure | Python/DataStructure/TreeDS/ExpressionTree.py | 2,147 | Python |
# Copyright (c) 2019 by LatentAI Inc.
# All rights reserved.
# This file is part of the LEIP(tm) SDK,
# and is released under the "LatentAI Commercial Software License".
# Please see the LICENSE file that should have been included as part of
# this package.
#
# @file tf_inference.py
#
# @author Videet Parekh
... | 33.673267 | 113 | 0.69362 | [
"Apache-2.0"
] | videetparekh/latentai-sdk-examples | inference/tf_inference.py | 3,401 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
評価用のテストパターン作成ツール集
"""
import os
import cv2
import matplotlib.pyplot as plt
import numpy as np
from colour.colorimetry import CMFS, ILLUMINANTS
from colour.models import XYZ_to_xy, xy_to_XYZ, XYZ_to_RGB, RGB_to_XYZ
from colour.models import xy_to_xyY, xyY_to_XYZ, Lab... | 29.806202 | 105 | 0.573112 | [
"BSD-3-Clause"
] | colour-science/sample_code | ty_lib/test_pattern_generator2.py | 54,415 | Python |
__license__ = "MIT"
__copyright__ = r"""
MIT License
Copyright (c) 2017 Gregor Engberding
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the ri... | 24.810185 | 147 | 0.717485 | [
"Unlicense"
] | KOLANICH-tools/WindowsTelemetryViewer.py | WindowsTelemetryViewer/PyQtJsonModel.py | 5,359 | Python |
"""
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
Ontology Engineering Group
http://www.oeg-upm.net/
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
Copyright (C) 2016 Ontology Engineering Group.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-... | 39.571429 | 108 | 0.581743 | [
"Apache-2.0"
] | fserena/kg-search | setup.py | 1,939 | Python |
"""
The primary specified return wavefunction quantities.
"""
result_wavefunction = {}
# Orbitals
result_wavefunction["orbitals_a"] = {
"type": "string",
"description": "Alpha-spin orbitals in the AO basis of the primary return. "
}
result_wavefunction["orbitals_b"] = {
"type": "string",
"descripti... | 22.782609 | 82 | 0.683206 | [
"BSD-3-Clause"
] | MolSSI/QCSchema | qcschema/dev/wavefunction/result_wavefunction.py | 1,572 | Python |
# Copyright 2017 Red Hat, Inc.
# 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... | 39.688034 | 78 | 0.676214 | [
"Apache-2.0"
] | dulek/kuryr-kubernetes | kuryr_kubernetes/tests/unit/cni/test_binding.py | 9,287 | Python |
# -*- coding: utf-8 -*- #
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | 43.813433 | 81 | 0.732925 | [
"Apache-2.0"
] | bshaffer/google-cloud-sdk | lib/surface/compute/instances/create_with_container.py | 17,613 | Python |
"""Utility functions and classes
"""
import sys
import inspect
import warnings
import importlib.util
from enum import Enum
from pathlib import Path
from weakref import WeakSet
from collections import namedtuple
from functools import partial, wraps
from types import ModuleType, MethodType
from typing import Union, Calla... | 32.636719 | 105 | 0.596848 | [
"BSD-3-Clause"
] | VolkerBergen/scanpy | scanpy/_utils.py | 25,073 | Python |
# -*- coding: utf-8 -*-
import warnings
from datetime import datetime, timedelta
import operator
import pytest
import numpy as np
import pandas as pd
from pandas.compat.numpy import np_datetime64_compat
import pandas.util.testing as tm
from pandas.errors import PerformanceWarning, NullFrequencyError
from pandas impo... | 40.126904 | 79 | 0.559089 | [
"BSD-3-Clause"
] | wla80/pandas | pandas/tests/indexes/datetimes/test_arithmetic.py | 39,525 | Python |
def user_display_name(user):
"""
Returns the preferred display name for the given user object: the result of
user.get_full_name() if implemented and non-empty, or user.get_username() otherwise.
"""
try:
full_name = user.get_full_name().strip()
if full_name:
return full_na... | 33.894737 | 103 | 0.661491 | [
"BSD-3-Clause"
] | icanbwell/wagtail-review | wagtail_review/text.py | 644 | Python |
#
# Tencent is pleased to support the open source community by making Angel available.
#
# Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of ... | 31.967742 | 102 | 0.744702 | [
"Apache-2.0",
"BSD-3-Clause"
] | 20100507/angel | angel-ps/python/build/lib/pyangel/running_mode.py | 991 | Python |
#!/usr/bin/env python2
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2015,2017
# [+] International Business Machines Corp.
#
#
# 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 th... | 49.617647 | 330 | 0.625766 | [
"Apache-2.0"
] | jk-ozlabs/op-test-framework | testcases/FWTS.py | 10,122 | Python |
all=['optvaedatasets','optvaemodels','optvaeutils']
| 26 | 51 | 0.769231 | [
"MIT"
] | rahulk90/inference_introspection | __init__.py | 52 | Python |
"""
My Data My Consent - Developer API
Unleashing the power of data consent by establishing trust. The Platform Core Developer API defines a set of capabilities that can be used to request, issue, manage and update data, documents and credentials by organizations. The API can be used to request, manage and upd... | 33.783784 | 469 | 0.7448 | [
"Apache-2.0"
] | My-Data-My-Consent/python-sdk | test/test_data_protection_officer.py | 1,250 | Python |
from .encoder import CKKSEncoder # noqa: F401
from .encrypter import CKKSEncrypter # noqa: F401
from .plaintext import CKKSPlaintext # noqa: F401
| 37.25 | 50 | 0.778523 | [
"MIT"
] | Koukyosyumei/AIJack | src/aijack/defense/ckks/__init__.py | 149 | Python |
"""Base classes for an Ambianic Edge device abstraction"""
from pydantic import BaseModel, Field
class DeviceInfo(BaseModel):
version: str = Field(None, description="Ambianic Edge software version.")
display_name: str = Field(
None, description="User friendly display name for this device."
)
n... | 34.076923 | 80 | 0.722348 | [
"Apache-2.0"
] | ambianic/ambianic | src/ambianic/device.py | 443 | Python |
#!/usr/bin/env python
##############################################################
# $Id$
# Project: MiSeq Metagenomic Assembly pipeline for Nephele project
# Language: Python 2.7
# Author: Alex Levitsky
# History: July 2015 Start of development
##############################################################
... | 33.515464 | 131 | 0.557521 | [
"Unlicense"
] | niaid/Nephele | Pipes/pipeline-scripts/NGOPT/ngopt.py | 6,502 | Python |
from django.shortcuts import render
from django.http import HttpResponseRedirect
# <HINT> Import any new Models here
from .models import Course, Enrollment, Question, Choice, Submission , Lesson
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404, render, redirect
from django.url... | 36.654971 | 153 | 0.690651 | [
"Apache-2.0"
] | Givindu98/Givindu-Final-Cloud-App-With-Database | onlinecourse/views.py | 6,268 | Python |
import os
import numpy as np
import rasterio
aggregate_forest = np.vectorize(lambda x: np.where(0 < x < 6, 1, x))
aggregate_agriculture = np.vectorize(lambda x: np.where(11 < x < 21, 21, x))
for dirs, subdirs, files in os.walk('../output/ceara/'):
for file in files:
wp_raster = rasterio.open('../output/... | 33.541667 | 118 | 0.643478 | [
"MIT"
] | olga-turkovska/2019-egu-poster | scripts/2-aggregate-land-cover.py | 805 | Python |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
'''
In this file, we define the classes that live inside 'worker 0', the worker
responsible for orchestration and aggregation. The main class is the
OptimizationServer, which sends clients to the other workers to process and
combines the resulting... | 45.271973 | 121 | 0.590534 | [
"MIT"
] | simra/msrflute | core/server.py | 27,299 | Python |
from .civet import Civet
from .building_blocks import *
from .builtin_scenario_sources import *
from .builtin_analyzers import *
from .builtin_outputs import *
| 26.666667 | 39 | 0.81875 | [
"MIT"
] | PMKielstra/Civet | civet/__init__.py | 160 | Python |
KEYBOARD_INTERRUPT = 1
ARGUMENT_ERROR = 2
# When playlists, albums, artists, users aren't found.
URI_NOT_FOUND_ERROR = 5
| 17.571429 | 54 | 0.772358 | [
"MIT"
] | DARHALL/spotify-downloader | spotdl/command_line/exitcodes.py | 123 | Python |
import random
import numpy as np
def write_to_file(filename,no_locations,no_agents):
info_dict={}
#ID enumerates from 0 to n-1
header='Location Index:Agents:Time Interval'
n=random.randint(10,20)
f=open(filename,'w')
f.write(str(n)+'\n')
f.write(header+'\n')
for i in range(n):
line=str(random.randint(0,no... | 27.064516 | 51 | 0.72944 | [
"BSD-3-Clause"
] | healthbadge/episimmer | examples/Basic_Disease_Models/Example_1/generate_events.py | 839 | Python |
# Generated by Django 2.2.2 on 2019-09-01 09:08
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
migrations.CreateModel(
name='User',
f... | 50.029412 | 266 | 0.637272 | [
"MIT"
] | Huxteen/Django-recipe-app-API-Docker-TDD-CI-CD | app/core/migrations/0001_initial.py | 1,701 | Python |
"""
Thank you Funkwhale for inspiration on the HTTP signatures parts <3
https://funkwhale.audio/
"""
import datetime
import logging
from typing import Union
import pytz
from Crypto.PublicKey.RSA import RsaKey
from requests_http_signature import HTTPSignatureHeaderAuth
from federation.types import RequestType
from fe... | 31.769231 | 97 | 0.734867 | [
"BSD-3-Clause"
] | jaywink/federation | federation/protocols/activitypub/signing.py | 1,652 | Python |
# -*- coding=utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from ctypes import c_uint64
import numpy as np
from .utils import CxxPointer, _call_with_growing_buffer
from .ffi import chfl_match
class Selection(CxxPointer):
"""
Select atoms in a :py:class:`Frame` with a sele... | 34.390805 | 88 | 0.612634 | [
"BSD-3-Clause"
] | Luthaf/Chemharp-python | chemfiles/selection.py | 2,992 | Python |
from rest_framework import serializers
from .models import Canteen
from accounts.serializers import UserForSerializer
from model_location.serializers import CityViewSerializer
from model_media.serializers import MediaViewSerializer
# Canteen model serializer
class CanteenSerializer(serializers.ModelSerializer):
c... | 29 | 59 | 0.777299 | [
"Apache-2.0"
] | SanjarbekSaminjonov/Musofirlar.Backend | models/model_canteen/serializers.py | 696 | Python |
# MIT License
#
# Copyright (c) 2019 Red Hat, Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... | 50.318182 | 80 | 0.775971 | [
"MIT"
] | FilipSchad/packit | packit/cli/__init__.py | 1,107 | Python |
from subprocess import Popen as pop
pop('gcc --version', shell=False)
pop('/bin/gcc --version', shell=False)
pop(var, shell=False)
pop(['ls', '-l'], shell=False)
pop(['/bin/ls', '-l'], shell=False)
pop('../ls -l', shell=False)
pop('c:\\hello\\something', shell=False)
pop('c:/hello/something_else', shell=False)
| 22.571429 | 43 | 0.655063 | [
"Apache-2.0"
] | Appleinc123/bandit | examples/partial_path_process.py | 316 | Python |
import os
import random
from riscv_definitions import *
NONE = 0
CF_J = 1
CF_BR = 2
CF_RET = 3
MEM_R = 4
MEM_W = 5
CSR = 6
PREFIX = '_p'
MAIN = '_l'
SUFFIX = '_s'
class Word():
def __init__(self, label: int, insts: list, tpe=NONE, xregs=[], fregs=[], imms=[], symbols=[], populated=False):
se... | 28.525097 | 116 | 0.525311 | [
"BSD-3-Clause"
] | compsec-snu/difuzz-rtl | Fuzzer/src/word.py | 7,388 | Python |
"""URLs for the ``django-frequently`` application."""
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$',
views.EntryCategoryListView.as_view(),
name='frequently_list'),
url(r'^your-question/$',
views.EntryCreateView.as_view(),
name='frequently_sub... | 22.85 | 53 | 0.625821 | [
"MIT"
] | bitlabstudio/django-frequently | frequently/urls.py | 457 | Python |
# Support various prediction methods for predicting cluster membership
# of new or unseen points. There are several ways to interpret how
# to do this correctly, so we provide several methods for
# the different use cases that may arise.
import numpy as np
from sklearn.neighbors import KDTree, BallTree
from .dist_met... | 37.967509 | 99 | 0.636256 | [
"BSD-3-Clause"
] | CKrawczyk/hdbscan | hdbscan/prediction.py | 21,034 | Python |
"""
Views for PubSite app.
"""
from django.conf import settings
from django.contrib.auth.views import (
PasswordResetView,
PasswordResetDoneView,
PasswordResetConfirmView,
PasswordResetCompleteView,
)
from django.shortcuts import render
import requests
import logging
logger = logging.getLogger(__name__... | 27.440476 | 86 | 0.652061 | [
"MIT"
] | Jacobvs/sigmapi-web | sigmapiweb/apps/PubSite/views.py | 4,610 | Python |
import requests
import datetime
class BearerAuth(requests.auth.AuthBase):
def __init__(self, token):
self.token = token
def __call__(self, r):
r.headers["authorization"] = "Bearer " + self.token
return r
class MintMobile:
def __init__(self, phone_number, password):
self.pho... | 41.347368 | 152 | 0.643075 | [
"MIT"
] | KTibow/HA-Mint-Mobile | custom_components/mintmobile/api.py | 3,928 | Python |
import argparse
import json
import insomniac.__version__ as __version__
from insomniac import network
from insomniac.activation import activation_controller
from insomniac.network import HTTP_OK
from insomniac.params import parse_arguments
from insomniac.utils import *
def run(activation_code="", starter_conf_file_p... | 34.922078 | 113 | 0.755299 | [
"MIT"
] | felipe4334/Insomniac | insomniac/__init__.py | 2,689 | Python |
from marshmallow import fields
from .base import BaseSchema
class ScheduledAnalysisSchema(BaseSchema):
analysis_system_instance = fields.Url(required=True)
sample = fields.Url(required=True)
analysis_scheduled = fields.DateTime(required=True)
priority = fields.Int(required=True)
| 27.181818 | 56 | 0.782609 | [
"MIT"
] | mass-project/mass_api_client | mass_api_client/schemas/scheduled_analysis.py | 299 | Python |
import re
class Normalizer:
"""Normalizer return the text replaced with 'repl'.
If 'repl' is None, normalization is not applied to the pattern corresponding to 'repl'.
Args:
url_repl (str): replace all urls in text with this
tag_repl (str): replace all tags in text with this
emoji_... | 946.587629 | 87,778 | 0.831418 | [
"Apache-2.0"
] | awesome-archive/prenlp | prenlp/data/normalizer.py | 91,819 | Python |
"""BERT Training Script."""
import functools
from typing import Any, Callable, Dict, Tuple, Optional, Type
from absl import logging
from clu import metric_writers
from clu import periodic_actions
from flax import jax_utils
import flax.linen as nn
import jax
from jax.experimental import optimizers as jax_optimizers
im... | 41.412475 | 81 | 0.694782 | [
"Apache-2.0"
] | YYCOCO/scenic | scenic/projects/baselines/bert/trainer.py | 20,582 | Python |
__source__ = 'https://leetcode.com/problems/delete-node-in-a-linked-list/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/delete-node-in-a-linked-list.py
# Time: O(1)
# Space: O(1)
#
# Description: Leetcode # 237. Delete Node in a Linked List
#
# Write a function to delete a node (except the tai... | 27.085366 | 100 | 0.642954 | [
"Apache-2.0"
] | JulyKikuAkita/PythonPrac | cs15211/DeleteNodrinaLinkedList.py | 2,221 | Python |
from unittest import TestCase
from btcmagic import transaction, convert
import os
import json
class TestTransaction(TestCase):
def setUp(self):
self.tx_bin = convert.hex_to_bytes(
'0100000001637aaf20d708fcff67bb688af6e41d1807e6883f736c50eacb6042bf6e6c829c010000008c493046022100da1e59d78bb88ca7c... | 44.733333 | 571 | 0.613115 | [
"MIT"
] | Dirbaio/btcmagic | btcmagic/test_transaction.py | 3,355 | Python |
from os import environ
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent.parent
DEBUG = True
CRON_ENABLED = False
if 'SIMONE_DB_NAME' in environ:
DATABASES = {
'default': {
'ENGINE': 'mysql.connector.d... | 25.727273 | 73 | 0.490577 | [
"MIT"
] | ross/simone | simone/settings/dev.py | 1,698 | Python |
"""Nyamuk event."""
import socket
import nyamuk_const as NC
#mqtt event
EV_CONNACK = NC.CMD_CONNACK
EV_PUBLISH = NC.CMD_PUBLISH
EV_SUBACK = NC.CMD_SUBACK
#non mqtt event
EV_NET_ERR = 1000
class BaseEvent:
"""Event Base Class."""
def __init__(self, tipe):
self.type = tipe
class EventConnack(BaseEven... | 25.432099 | 54 | 0.653883 | [
"BSD-2-Clause"
] | MasterScott/nyamuk | nyamuk/event.py | 2,060 | Python |
# Generated by Django 2.2.7 on 2019-11-20 17:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quiz', '0002_question_image'),
]
operations = [
migrations.RemoveField(
model_name='question',
name='answer',
... | 23.521739 | 105 | 0.5878 | [
"MIT"
] | chgo19/KnowledgeAppOne | quiz/migrations/0003_auto_20191120_2238.py | 541 | Python |
import uuid
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_countries.fields import CountryField
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
uuid = models.UUIDField(default=uuid.uuid4, editable=Fal... | 42.5 | 133 | 0.780882 | [
"MIT"
] | BeDjango/bedjango-starter | project_name/users/models.py | 680 | Python |
#!/usr/bin/python
# coding: utf-8
"""A simple webserver."""
# python 2.7 compatibility
from __future__ import print_function, unicode_literals
# based on tornado
import tornado.ioloop
import tornado.web
import tornado.websocket
import sys
import json
def make_app():
"""Create and return the main Tornado web app... | 31.627907 | 74 | 0.606985 | [
"CC0-1.0"
] | mesilliac/multitude | 6/server.py | 2,720 | Python |
"""Dataset, producer, and config metadata."""
import logging
import warnings
import sqlalchemy as sa
from .._globals import REGISTRY as registry
from .. import _tools
from .. import backend as _backend
__all__ = ['Dataset', 'Producer', 'Config']
log = logging.getLogger(__name__)
@registry.mapped
class Dataset:... | 38.083333 | 89 | 0.586265 | [
"MIT"
] | glottolog/treedb | treedb/backend/models.py | 5,941 | Python |
import logging
import multiprocessing
import os
import signal
import sys
import time
from typing import Any
from datastore.reader.app import register_services
from gunicorn.app.base import BaseApplication
from .shared.env import is_dev_mode
from .shared.interfaces.logging import LoggingModule
from .shared.interfaces.... | 34.591241 | 101 | 0.643807 | [
"MIT"
] | GabrielInTheWorld/openslides-backend | openslides_backend/main.py | 4,739 | Python |
import logging
from datetime import datetime
from dateutil import parser as DatetimeParser
def dicom_name(names: list) -> str:
s = "^".join(names).upper()
return s
def dicom_date(dt: datetime) -> str:
s = dt.strftime("%Y%m%d")
return s
def dicom_time(dt: datetime) -> str:
s = dt.strftime("%H%M... | 20.969697 | 64 | 0.604769 | [
"MIT"
] | derekmerck/diana2 | package/diana/utils/dicom/strings.py | 1,384 | Python |
# -*- encoding: utf-8 -*-
#
# Copyright © 2013 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 requi... | 27.968254 | 78 | 0.646425 | [
"Apache-2.0"
] | ChantYuCN/cgts-client | cgtsclient/v1/sm_service_nodes.py | 1,763 | Python |
import codecs
import csv
import datetime
import logging
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from todo.models import Task, TaskList
log = logging.getLogger(__name__)
class CSVImporter:
"""Core upsert functionality for CSV import, for re-use by `import_csv`... | 37.737624 | 114 | 0.543093 | [
"BSD-3-Clause"
] | paiuolo/django-todo | todo/operations/csv_importer.py | 7,623 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.