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 |
|---|---|---|---|---|---|---|---|---|
cipher = [75, 203, 190, 126, 184, 169, 27, 74, 35, 83, 113, 65, 207, 193, 27, 137, 37, 98, 0, 68, 219, 113, 21, 180, 223, 135, 5, 129, 189, 200, 245, 100, 117, 62, 192, 101, 239, 92, 182, 136, 159, 235, 166, 90, 74, 133, 83, 78, 6, 225, 101, 103, 82, 78, 144, 205, 130, 238, 175, 245, 172, 62, 157, 176]
key = b"SECCON20... | 31 | 303 | 0.507858 | [
"Apache-2.0"
] | SECCON/SECCON2021_online_CTF | reversing/pyast64++.rev/solver/solve.py | 1,209 | Python |
import asyncio
import logging
import pytest
from clvm.casts import int_to_bytes
from flax.consensus.blockchain import Blockchain
from flax.full_node.hint_store import HintStore
from flax.types.blockchain_format.coin import Coin
from flax.types.condition_opcodes import ConditionOpcode
from flax.types.condition_with_arg... | 33.402174 | 118 | 0.66645 | [
"Apache-2.0"
] | Flax-Network/flax-blockchain | tests/core/full_node/test_hint_store.py | 3,073 | Python |
from __future__ import absolute_import, division, unicode_literals
import socket
from .base import StatsClientBase, PipelineBase
class Pipeline(PipelineBase):
def __init__(self, client):
super(Pipeline, self).__init__(client)
self._maxudpsize = client._maxudpsize
def _send(self):
d... | 30.019608 | 66 | 0.594383 | [
"MIT"
] | alanhamlett/pystatsd | statsd/client/udp.py | 1,531 | Python |
"""grpc service.
Reliably launch and connect to grpc process.
"""
import datetime
import enum
import logging
import os
import subprocess
import sys
import tempfile
import time
from typing import Any, Dict, Optional
from typing import TYPE_CHECKING
import grpc
from wandb.proto import wandb_server_pb2 as spb
from wand... | 31.070513 | 99 | 0.592119 | [
"MIT"
] | KnightZhang625/client | wandb/sdk/service/service.py | 4,847 | Python |
import numpy as np
from sklearn.metrics import r2_score
np.random.seed(42)
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
figsize = (8, 4)
def show_r2(results):
data_size = results["data_size"]
test_scores = results["test_scores"]
test_scores_exp = results["test_scores_exp"]
... | 38.203608 | 208 | 0.644134 | [
"MIT"
] | researchuser7/QWAugmenter | generator_labeler/paper_results/custom_plots.py | 14,825 | Python |
###
# Copyright (c) 2004, Daniel DiPaolo
# 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 of condition... | 40.8 | 79 | 0.768854 | [
"BSD-3-Clause"
] | Alcheri/Limnoria | plugins/QuoteGrabs/__init__.py | 2,652 | Python |
#!/usr/bin/python
# configure mini-split heat pumps for E files
# uses NRCan CSV list converted to TSV
# https://oee.nrcan.gc.ca/pml-lmp/index.cfm?language_langue=en&action=app.search-recherche&appliance=ASHP2_GH
import math, os, sys
import xml.etree.ElementTree as ET
if len(sys.argv) < 3:
print(sys.argv[0], "E-f... | 36.533333 | 373 | 0.693796 | [
"MIT"
] | nerdralph/h2k | ghwiz/mshp.py | 2,747 | Python |
from __future__ import absolute_import, unicode_literals
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from tracpro.test.cases import TracProDataTest
class ManageUserCreateTest(TracProDataTest):
def test_create_as_non_superu... | 36.324561 | 94 | 0.594482 | [
"BSD-3-Clause"
] | rapidpro/tracpro | tracpro/profiles/tests/test_views.py | 16,564 | Python |
from machin.parallel.thread import Thread, ThreadException
import time
def test1():
time.sleep(1)
print("Exception occurred at {}".format(time.time()))
raise RuntimeError("Error")
if __name__ == "__main__":
t1 = Thread(target=test1)
t1.start()
while True:
try:
t1.watch()
... | 22.772727 | 63 | 0.590818 | [
"MIT"
] | ikamensh/machin | examples/tutorials/parallel_distributed/mth_exception.py | 501 | Python |
from libra_client.cli.command import Command, blocking_cmd
class AccountCommand(Command):
def get_aliases(self):
return ["account", "a"]
def get_description(self):
return "Account operations"
def execute(self, client, params, **kwargs):
commands = [
Accoun... | 31.436893 | 93 | 0.617356 | [
"MIT"
] | yuan-xy/libra-client | libra_client/shell/account_commands.py | 3,238 | Python |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 35.425719 | 89 | 0.69116 | [
"Apache-2.0"
] | Najah-lshanableh/tensorflow | tensorflow/contrib/learn/python/learn/monitors.py | 44,353 | Python |
'''
Image
=====
The :class:`Image` widget is used to display an image::
Example in python::
wimg = Image(source='mylogo.png')
Kv Example::
Image:
source: 'mylogo.png'
size: self.texture_size
Asynchronous Loading
--------------------
To load an image asynchronously (for example from an ex... | 30.435185 | 140 | 0.625114 | [
"MIT"
] | eman1can/kivy | kivy/uix/image.py | 13,148 | Python |
#!/usr/bin/env python
#
# Copyright 2016 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... | 34.72549 | 79 | 0.730661 | [
"Apache-2.0"
] | SoungMo/googleads-python-lib | examples/ad_manager/v201811/activity_service/get_all_activities.py | 1,771 | Python |
#!/usr/bin/env python
from __future__ import print_function
import sys
from Configuration.PyReleaseValidation.MatrixReader import MatrixReader
from Configuration.PyReleaseValidation.MatrixRunner import MatrixRunner
from Configuration.PyReleaseValidation.MatrixInjector import MatrixInjector,performInjectionOptionTest
... | 41.390313 | 216 | 0.489744 | [
"Apache-2.0"
] | AdrianoDee/cmssw | Configuration/PyReleaseValidation/scripts/runTheMatrix.py | 14,528 | Python |
import re
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.networks.sync_batchnorm import SynchronizedBatchNorm2d
import torch.nn.utils.spectral_norm as spectral_norm
# Returns a function that creates a normalization function
# that does not condition on semantic map
def get_nonspade_norm... | 38.098901 | 87 | 0.651284 | [
"MIT"
] | atmacvit/meronymnet | baselines/scripts/segvae/models/networks/normalization.py | 3,467 | Python |
from client.util.html.tooling.base.HTMLElement import HTMLElement
class ScriptElement(HTMLElement):
def __init__(self, src):
super().__init__('script')
self.set_attribute('src', src)
| 25.625 | 65 | 0.712195 | [
"MIT"
] | vincihb/stock-price-predictor | client/util/html/tooling/base/document/ScriptElement.py | 205 | Python |
import io
import copy
import uuid
import numpy as np
try:
# pip install pycollada
import collada
except BaseException:
collada = None
try:
import PIL.Image
except ImportError:
pass
from .. import util
from .. import visual
from ..constants import log
def load_collada(file_obj, resolver=None, ... | 32.231144 | 86 | 0.566619 | [
"MIT"
] | BerkeleyAutomation/trimesh | trimesh/exchange/dae.py | 13,247 | Python |
#!/usr/bin/env python
"""
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
import string
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.NORMAL
def tamper(payload, **kwargs):
"""
Unicode-escapes non-encoded characters in a given pa... | 30.35 | 213 | 0.57084 | [
"Unlicense"
] | 6un9-h0-Dan/CTF-Heaven | Toolz/sqlmap/tamper/charunicodeescape.py | 1,214 | Python |
# Copyright 2018 ZTE 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 agreed to in ... | 32.896907 | 102 | 0.65246 | [
"Apache-2.0"
] | onap/archive-vfc-nfvo-catalog | catalog/packages/serializers/vnf_pkg_software_image_info.py | 3,191 | Python |
#!/usr/bin/env python
import numpy as np
import socket, curses, json, traceback, math, argparse, math, sys, os, stat
from operator import itemgetter, attrgetter
from configutils.dfmux_config_constructor import get_physical_id, sq_phys_id_to_info
from configutils.dfmux_config_constructor import uniquifyList, generate_d... | 37.401504 | 323 | 0.56051 | [
"BSD-2-Clause"
] | simonsobs/lyrebird | bin/kookaburra.py | 24,872 | Python |
import os
from spirl.models.closed_loop_spirl_mdl import GoalClSPiRLMdl
from spirl.components.logger import Logger
from spirl.utils.general_utils import AttrDict
from spirl.configs.default_data_configs.kitchen import data_spec
from spirl.components.evaluator import TopOfNSequenceEvaluator
from spirl.data.kitchen.src.k... | 30.873016 | 112 | 0.759897 | [
"BSD-3-Clause"
] | kouroshHakha/fist | spirl/configs/few_shot_imitation_learning/kitchen/hierarchical_cl_gc_top_bot_excluded_demo_topknob_bot_hinge_slide_oneshot/conf.py | 1,945 | Python |
"""
Script for copying back xml junit files from tests
"""
import argparse # pylint: disable=minimum-python-version
import os
import subprocess
import paramiko
import salt.utils.yaml
class DownloadArtifacts:
def __init__(self, instance, artifacts):
self.instance = instance
self.artifacts = arti... | 33.033708 | 88 | 0.593537 | [
"Apache-2.0"
] | 0x416e746f6e/salt | tests/support/copyartifacts.py | 2,940 | Python |
#!/usr/bin/env python
"""pattern.py: An example like <Rolling an image> in Pillow document.
"""
import os.path
from PIL import Image
def run(filepath):
"""Create a wallpaper image from a PNG file."""
src = Image.open(filepath)
target = swap_quadrants(src)
paste_with_alpha(target, src, (0, 0), 0x10)
... | 28.943396 | 71 | 0.632334 | [
"MIT"
] | showa-yojyo/note | source/_sample/pillow/pattern.py | 1,534 | Python |
from rest_framework.permissions import BasePermission, SAFE_METHODS
class IsOwnerOrReadOnly(BasePermission):
message = 'You must be the owner of this object.'
def has_object_permission(self, request, view, obj):
# member = Membership.objects.get(user=user.request)
# member.is_active
if... | 37.818182 | 67 | 0.706731 | [
"MIT"
] | imran110219/Book_Review_App | Book/api/permissions.py | 416 | Python |
"""View representations of Product Active docs pages"""
from widgetastic_patternfly4 import PatternflyTable
from widgetastic.widget import View, Text
from testsuite.ui.views.admin.product import BaseProductView
from testsuite.ui.widgets.buttons import ThreescaleDeleteButton, ThreescaleEditButton
from testsuite.ui.widg... | 37.6 | 100 | 0.683178 | [
"Apache-2.0"
] | 3scale-qe/3scale-tests | testsuite/ui/views/admin/product/active_docs.py | 3,008 | Python |
import os
import json
import logging
import serial
from serial.tools import list_ports
import time
CONFIG_FILENAME_DEFAULT = 'olfa_config.json'
def get_olfa_config(config_filename=''):
"""
Find and parse olfactometer configuration JSON.
:param config_filename: string with path to configuration.
:re... | 36.921569 | 115 | 0.674456 | [
"MIT"
] | mohamedelgohary1/PyBpodGUI | olfactometry/utils.py | 3,766 | 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 use ... | 30.971429 | 74 | 0.74262 | [
"Apache-2.0"
] | enricorusso/incubator-ariatosca | aria/parser/__init__.py | 1,084 | Python |
import os, sys
CHOICES = 'ignore', 'fail', 'warn', 'warn_once'
DEFAULT = 'warn_once'
ACTION = None
HELP = """
Specify what to do when a project uses deprecated features:
ignore: do nothing
warn: print warning messages for each feature
warn_once: print a warning message, but only once for each type of feature
... | 23.696629 | 76 | 0.598388 | [
"MIT"
] | 8cH9azbsFifZ/BiblioPixel | bibliopixel/util/deprecated.py | 2,109 | Python |
#!/usr/bin/env python
'''
Created on Apr 12, 2017
@author: Brian Jimenez-Garcia
@contact: brian.jimenez@bsc.es
'''
import sys
import os
if len(sys.argv[1:]) != 2:
raise SystemExit("usage: %s pdb_file1 pdb_file2" % os.path.basename(sys.argv[0]))
pdb_file1 = sys.argv[1]
pdb_file2 = sys.argv[2]
# Panda3D imports... | 23.196078 | 85 | 0.715976 | [
"MIT"
] | brianjimenez/emol | launch.py | 1,183 | Python |
# (c) Copyright [2018-2021] Micro Focus or one of its affiliates.
# 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 applicabl... | 37.536295 | 200 | 0.462391 | [
"Apache-2.0"
] | MiConnell/VerticaPy | verticapy/learn/tsa.py | 69,298 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 14 08:23:08 2017
Author: Zachary W. Mikus
"""
#These are testing variables
d1 = {1:30, 2:20, 3:30, 5:80}
d2 = {1:40, 2:50, 3:60, 4:70}
def f(x, y):
k = x + y
return k
def commonKeys(longerList, shorterList):
commonKeyList = []
#Va... | 31.633929 | 82 | 0.686988 | [
"MIT"
] | Zafara1/MITx-6.00.1x | dict_interdiff.py | 3,543 | Python |
n1 = float(input('Digite sua primera nota: '))
n2 = float(input('Digite sua segunda nota: '))
media = (n1 + n2) / 2
if media <= 5:
print('Sua média é {} e você está REPROVADO!'.format(media))
elif media >= 7:
print('Sua média é {} e você está APROVADO!'.format(media))
elif media >5 or media <6.9:
print('Sua... | 37.6 | 69 | 0.646277 | [
"MIT"
] | tiagosm1/Pyhton_CEV | Desafios/Desafio 040.py | 390 | Python |
# Generated by Django 4.0 on 2021-10-12 22:38
import blog.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations = [
migr... | 38 | 134 | 0.590643 | [
"MIT"
] | Nemwel-Boniface/Farmblr | farmblr/blog/migrations/0001_initial.py | 1,368 | Python |
import urllib.parse
from datetime import datetime
from unittest.mock import patch
from django.contrib.auth.models import User
from django.test import TestCase
from django.utils import timezone
from dfirtrack_artifacts.models import (
Artifact,
Artifactpriority,
Artifactstatus,
Artifacttype,
)
from dfi... | 39.993651 | 147 | 0.658358 | [
"Apache-2.0"
] | cclauss/dfirtrack | dfirtrack_config/tests/status/test_status_views.py | 12,598 | Python |
import sys
import getopt
import os
import subprocess
import shutil
import logging as log
def Initialize(platform):
print "Initializing Workspace"
global workspace
workspace = os.environ['WORKSPACE']
if platform == "windows":
# Jenkins puts quotes in the path, which is wrong. Remove quotes.
... | 28.714286 | 135 | 0.563255 | [
"MIT"
] | AaronRobinsonMSFT/coreclr | src/pal/automation/util.py | 2,814 | Python |
#games module
import Kabaddi.raider
Kabaddi.raider.name_raider()
| 16.25 | 28 | 0.830769 | [
"MIT"
] | Anancha/Programming-Techniques-using-Python | Chapter 05/Chap05_Example5.33.py | 65 | Python |
import robocup
import constants
import main
import math
import skills.touch_ball
import skills._kick
import skills.pass_receive
## AngleReceive accepts a receive_point as a parameter and gets setup there to catch the ball
# It transitions to the 'aligned' state once it's there within its error thresholds and is stead... | 42.691781 | 153 | 0.636932 | [
"Apache-2.0"
] | Alex-Gurung/robocup-software | soccer/gameplay/skills/angle_receive.py | 6,233 | Python |
import argparse
import functools
import operator
import os
import numpy as np
import tensorflow as tf
from kungfu.tensorflow.v1.helpers.mnist import load_datasets
from tensorflow.python.util import deprecation
deprecation._PRINT_DEPRECATION_WARNINGS = False
def parse_args():
p = argparse.ArgumentParser(descript... | 34.58 | 79 | 0.589358 | [
"Apache-2.0"
] | DingtongHan/KungFu-1 | examples/mnist_elastic_docker/mnist_slp_estimator.py | 3,458 | Python |
from big_ol_pile_of_manim_imports import *
import os
import pyclbr
class Shapes(Scene):
#A few simple shapes
#Python 2.7 version runs in Python 3.7 without changes
def construct(self):
#circle = Circle()
#square = Square()
line=Line(UP,DOWN)
#line2=Line
#triangle=P... | 33.250333 | 245 | 0.593528 | [
"MIT"
] | CadenScharpf/manim-cs | examples/tutorial.py | 24,971 | Python |
#!/usr/bin/env python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the follo... | 38.620853 | 124 | 0.63382 | [
"MIT"
] | ALLMINER/elli | contrib/devtools/update-translations.py | 8,149 | Python |
# Copyright 2020 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 41.629367 | 80 | 0.676327 | [
"Apache-2.0"
] | kontesanjana/oppia | core/domain/wipeout_service_test.py | 182,295 | Python |
from unittest.mock import call, PropertyMock, MagicMock
import pytest
from analytical_validation.exceptions import DataWasNotFitted
from src.analytical_validation.validators.linearity_validator import LinearityValidator
@pytest.fixture(scope='function')
def fitted_result_obj(mocker):
mock = mocker.Mock(create=T... | 54.140884 | 222 | 0.643247 | [
"MIT"
] | abxsantos/analytical-validation | tests/unit/test_validators/test_linearity_validator.py | 19,599 | 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 u... | 37.509383 | 99 | 0.67715 | [
"Apache-2.0"
] | Jacob-ru/superset | superset/dashboards/commands/importers/v0.py | 13,991 | Python |
from datetime import datetime
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth.backends import RemoteUserBackend
from django.contrib.auth.middleware import RemoteUserMiddleware
from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import ... | 39.717842 | 87 | 0.66496 | [
"BSD-3-Clause"
] | 2roy999/django | django/contrib/auth/tests/test_remote_user.py | 9,572 | Python |
import pandas as pd
import numpy as np
from torch.utils.data import Dataset
import os
from PIL import Image
class CXRDataset(Dataset):
def __init__(
self,
path_to_images,
fold,
transform=None,
sample=0,
finding="any",):
self.transfo... | 31 | 113 | 0.518987 | [
"Apache-2.0"
] | edupooch/cxr-domain-shift | nih/loader.py | 2,449 | Python |
from job import *
class NoncookingJob(Job):
def __init__(self, name, prefs, maxMatches):
Job.__init__(self, name, prefs, maxMatches)
# remove pairs & underclassmen
self.prefs = filter(lambda x: x.numPeople != 1 and x.semsCooked < 4, self.prefs)
# sort all the people by number of semesters cooked, high to low... | 37.6 | 83 | 0.728723 | [
"MIT"
] | vmlane/jobMatcher | noncookingjob.py | 376 | Python |
import math
import pandas as pd
import spacy # Requires: python -m spacy download en_core_web_sm
from spacy import displacy
from nltk import sent_tokenize, word_tokenize, PorterStemmer
from nltk.corpus import stopwords
from data import load_model
import streamlit as st
class tf_idf():
nlp = load_model('en_cor... | 35.704403 | 136 | 0.611414 | [
"Apache-2.0"
] | asehmi/Data-Science-Meetup-Oxford | TextSummarization/TF_IDF.py | 5,677 | Python |
from ttv_api import *
@dataclass
class Channel:
broadcaster_id: str
broadcaster_login: str
broadcaster_name: str
game_name: str
game_id: str
broadcaster_language: str
title: str
delay: int
def get_channels(*channel_ids: str) -> Optional[list[Channel]]:
params = "?"
for channe... | 23.446809 | 63 | 0.554446 | [
"MIT"
] | Atheridis/aptbot | ttv_api/channel.py | 1,102 | Python |
"""
========================================================
Statistic the SV Stat after AGE Process
========================================================
Author: Shujia Huang & Siyang Liu
Date : 2014-03-07 0idx:54:15
"""
import sys
import re
import os
import string
import numpy as np
import matplotlib.pyplot as pl... | 46.207407 | 177 | 0.511783 | [
"MIT"
] | ShujiaHuang/AsmVar | src/AsmvarVarScore/FeatureToScore2.py | 12,476 | Python |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 31.253521 | 245 | 0.68274 | [
"Apache-2.0",
"BSD-3-Clause"
] | LaudateCorpus1/oci-python-sdk | src/oci/management_agent/models/work_submission_key.py | 2,219 | Python |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# ... | 39.098507 | 79 | 0.612193 | [
"Apache-2.0"
] | NewpTone/stacklab-nova | debian/python-nova/usr/lib/python2.7/dist-packages/nova/tests/api/openstack/compute/test_extensions.py | 90 | Python |
VERSION = __version__ = '0.1.1'
| 16 | 31 | 0.65625 | [
"BSD-3-Clause"
] | adailson2/linguist | linguist/__init__.py | 32 | Python |
#!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
from pyscf import gto
from pyscf import scf
from pyscf import mcscf
from pyscf.dmrgscf import dmrgci
'''
Block code for active space N-particle density matrices.
'''
b = 1.2
mol = gto.M(
verbose = 4,
atom = 'N 0 0 0; N 0 0 %f'%b,
basis... | 20.2 | 64 | 0.679455 | [
"BSD-2-Clause"
] | gmwang18/pyscf | examples/dmrg/03-density_matrix.py | 808 | Python |
import os
import re
import shutil
import sys
import urllib.error
import urllib.parse
import urllib.request
from zipfile import ZipFile
import helpers.config as config
from helpers.logger import Logger
class Updater:
__instance = None
@staticmethod
def Get():
if Updater.__instance is None:
... | 44.213115 | 269 | 0.602645 | [
"MIT"
] | daavofficial/Launcher | frontend/update.py | 8,093 | Python |
from django.contrib import admin
from django.contrib.auth import admin as auth_admin
from django.contrib.auth import get_user_model
from django.utils.translation import gettext_lazy as _
from my_site.users.forms import UserAdminChangeForm, UserAdminCreationForm
User = get_user_model()
@admin.register(User)
class Us... | 29.057143 | 74 | 0.564405 | [
"MIT"
] | pshortt/my_site | my_site/users/admin.py | 1,017 | Python |
# -*- coding:utf-8 -*-
#
# Author : TangHanYi
# E-mail : thydeyx@163.com
# Create Date : 2016-12-11 09:33:17 AM
# Last modified : 2016-12-11 10:48:50 AM
# File Name : Super_Pow.py
# Desc :
class Solution(object):
def superPow(self, a, b):
if len(b) == 0:
return a
tmp = a
ret = 1... | 69.358974 | 2,008 | 0.497597 | [
"MIT"
] | thydeyx/LeetCode-Python | Super_Pow.py | 2,705 | Python |
"""
Création des images pour la tâche de détermination numérique
(pour évaluer l'impact de la configuration sur le subitizing)
Victor ANTOINE - victor.antoine@ens.fr
"""
import pygame
from random import sample
from numpy import random, sort
from os import path
from itertools import product
W, H = 960, 540
pygame... | 32.505495 | 80 | 0.64165 | [
"MIT"
] | Vantoine2019/PCBS_experience_subitizing | create_pictures.py | 2,966 | Python |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2014 Thomas Voegtlin
#
# 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... | 35.177273 | 151 | 0.628117 | [
"MIT"
] | KomodoPlatform/electrum-komodo | plugins/cosigner_pool/qt.py | 7,739 | Python |
"""mgear.core.vector test"""
def test_get_distance(run_with_maya_pymel, setup_path):
# Maya imports
from maya import OpenMaya
import pymel.core as pm
# mGear imports
from mgear.core.vector import get_distance
v_1 = [0, 0, 0]
v_2 = [1, 0, 0]
assert get_distance(v_1, v_2) == 1.0
v_... | 31.989474 | 62 | 0.657782 | [
"MIT"
] | FXTD-ODYSSEY/mgear4 | tests/test_mgear/test_core/test_vector.py | 3,039 | Python |
from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay
from sklearn.metrics import accuracy_score
from sklearn.model_selection import TimeSeriesSplit
from keras.layers import Dropout
from keras.layers import Dense, LSTM
from keras.models import Sequential
import numpy as np
from sklearn.preprocessing impo... | 26.414141 | 254 | 0.781043 | [
"MIT"
] | susumOyaji/chaquopy-matplotlib-master | app/src/main/python/KinoCode.py | 33,041 | Python |
#
# (C) Copyright 2020 Pavel Tisnovsky
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Pavel... | 20.367347 | 72 | 0.624248 | [
"EPL-1.0"
] | tisnik/most-popular-python-libs | pygame_zero/39_animation_framework.py | 998 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Daniel Standage <daniel.standage@gmail.com>
# Copyright (c) 2008 Sascha Steinbiss <steinbiss@zbh.uni-hamburg.de>
# Copyright (c) 2008 Center for Bioinformatics, University of Hamburg
#
# Permission to use, copy, modify, and distribute this software fo... | 37.178947 | 91 | 0.656569 | [
"BSD-2-Clause"
] | ggonnella/genometools | gtpython/gt/annotationsketch/image_info.py | 3,532 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import six
from django import http
from django.urls import reverse
from django.utils.http import unquote
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
MiddlewareMixin = object
class AngularUrlMiddleware(MiddlewareM... | 45.391892 | 116 | 0.650789 | [
"MIT"
] | BluABK/django-angular | djng/middleware.py | 3,359 | Python |
import pytest
from migri.backends.postgresql import PostgreSQLConnection
from test import QUERIES
@pytest.mark.parametrize(
"query_element,expected_query,expected_values",
[
(QUERIES[0], "INSERT INTO mytable (a) VALUES ($1), ($2)", [150, 300]),
(QUERIES[1], "UPDATE tbl SET info=$2 WHERE id=$1... | 30.333333 | 78 | 0.589744 | [
"MIT"
] | RonquilloAeon/migri | test/asyncpg/test_postgresql.py | 819 | Python |
from tests.base_case import ChatBotTestCase
from chatterbot.logic import LogicAdapter
from chatterbot.conversation import Statement
class ChatterBotResponseTestCase(ChatBotTestCase):
def test_conversation_values_persisted_to_response(self):
response = self.chatbot.get_response('Hello', persist_values_to_... | 38.464115 | 123 | 0.668056 | [
"BSD-3-Clause"
] | nadimpayak/ChatBot | tests/test_chatbot.py | 16,176 | Python |
from django.contrib import admin
from api.models import Citation
class CitationAdmin(admin.ModelAdmin):
list_display = ('id', 'citation_number', 'citation_date', 'first_name', 'last_name', 'date_of_birth', 'defendant_address', 'defendant_city', 'defendant_state', 'drivers_license_number', 'court_date', 'court_loca... | 60.666667 | 238 | 0.762637 | [
"MIT"
] | emeth-/globalhack5-revamped | api/admin.py | 910 | Python |
__I_MSG = { # ASMAxxxI
33 : lambda info, line: 'Storage alignment for {0} unfavorable'.format(line[info[1]:info[2]]),
}
__N_MSG = { # ASMAxxxN
}
__W_MSG = { # ASMAxxxW
45 : lambda info, line: 'Register or label not previously used - {0}'.fo... | 59.933333 | 141 | 0.63337 | [
"BSD-3-Clause"
] | T-Tony-T/mainframe-env-simulator | zPE/base/pgm/asma90_err_code_rc.py | 4,495 | Python |
import pytest
from rate.users.forms import UserCreationForm
from rate.users.tests.factories import UserFactory
pytestmark = pytest.mark.django_db
class TestUserCreationForm:
def test_clean_username(self):
# A user with proto_user params does not exist yet.
proto_user = UserFactory.build()
... | 26.380952 | 59 | 0.590253 | [
"MIT"
] | Jeongkiwon/rate_everything | rate/users/tests/test_forms.py | 1,108 | Python |
"""Animations that try to transform Mobjects while keeping track of identical parts."""
__all__ = ["TransformMatchingShapes", "TransformMatchingTex"]
from typing import TYPE_CHECKING, List, Optional
import numpy as np
from .._config import config
from ..mobject.mobject import Group, Mobject
from ..mobject.opengl_mo... | 34.521277 | 87 | 0.642732 | [
"MIT"
] | Pragyaan-6988/ManimCE | manim/animation/transform_matching_parts.py | 9,735 | Python |
from pygin.components.animation import Animation
from pygin.key_frame import KeyFrame
class ParticleFadeAnimation(Animation):
def __init__(self, game_obj, duration):
key_frame_list = list()
key_frame_list.append(KeyFrame(0.0, alpha=255, interpolation="in_cubic"))
key_frame_list.append(Key... | 35.916667 | 84 | 0.74942 | [
"MIT"
] | CarlosMatheus/Engine | pygin/example_games/Balance/animations/particle_fade_animation.py | 431 | Python |
"""Tests for distutils.
The tests for distutils are defined in the distutils.tests package;
the test_suite() function there returns a test suite that's ready to
be run.
"""
import distutils.tests
import test.support
def load_tests(*_):
# used by unittest
return distutils.tests.test_suite()
def tearDownMod... | 17.782609 | 68 | 0.731051 | [
"Apache-2.0"
] | LawrenceZ1A/MultipurposeProject | pypy3.9-v7.3.9-win64/Lib/test/test_distutils.py | 409 | Python |
import unittest
from pyats.topology import loader
from genie.libs.sdk.apis.iosxe.interface.get import get_interface_mac_address
class TestGetInterfaceMacAddress(unittest.TestCase):
@classmethod
def setUpClass(self):
testbed = """
devices:
R1_xe:
connections:
... | 30.483871 | 93 | 0.621164 | [
"Apache-2.0"
] | CiscoTestAutomation/genielibs | pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/interface/get/get_interface_mac_address/test_api_get_interface_mac_address.py | 945 | Python |
# Copyright 2018 Mycroft 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 in writin... | 39.288344 | 78 | 0.626327 | [
"Apache-2.0"
] | AIIX/mycroft-core | mycroft/skills/common_query_skill.py | 6,404 | Python |
import numpy as np
from .. import ArrayStringReader
def test_arraystringreader():
"""here is my test code
https://docs.pytest.org/en/stable/getting-started.html#create-your-first-test
"""
size = 8
sample_array = np.random.rand(size).astype('float32')
text = ','.join([str(x) for x in sample_a... | 25.95 | 81 | 0.687861 | [
"Apache-2.0"
] | Gracegrx/jina-hub | crafters/numeric/ArrayStringReader/tests/test_arraystringreader.py | 519 | Python |
from __future__ import unicode_literals
import json
import collections
import string
from django.http import JsonResponse, HttpResponseRedirect, HttpResponseNotFound
from django.http import Http404
from django.shortcuts import render
import threading
import json
from django.views.decorators.csrf import csrf_exempt
from... | 42.580931 | 145 | 0.64221 | [
"Apache-2.0"
] | alonlevko/seminarmiddleeast | app/views.py | 19,204 | Python |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.tools.mo.front.extractor import FrontExtractorOp
from openvino.tools.mo.ops.lrn import AttributedLRN
class LRNExtractor(FrontExtractorOp):
"""
TF and IE(CAFFE) parameters in LRN differs in several places :
... | 39.96875 | 124 | 0.630962 | [
"Apache-2.0"
] | IndiraSalyahova/openvino | tools/mo/openvino/tools/mo/front/tf/lrn_ext.py | 1,279 | Python |
import simpy
import logging
"""
Recursive GraphQL schema for JSON StructureItem - passed as Python dictionary
type StructureItem {
id: ID!
type: StructureType
# optional annotation for a Branch
annotation: String
# reference UUID / Name / Num for: Function, Exit / ExitCondition (Exit), Replicate (DomainSet... | 39.925532 | 103 | 0.572342 | [
"BSD-3-Clause"
] | tsherburne/ma-simpy | simmbse/structure_item.py | 3,753 | Python |
global_var = 'spam'
def enclosing(p1, p2):
x = 42
local(p1, x, 'foo')
def local(p1, x, p):
def nested():
print(p, x)
print(p1, p) | 11.357143 | 23 | 0.503145 | [
"Apache-2.0"
] | 06needhamt/intellij-community | python/testData/refactoring/makeFunctionTopLevel/localFunctionSimple.after.py | 159 | Python |
import asyncio
import contextlib
import email.utils
import functools
import logging
import os
import time
import unittest
DATE = email.utils.formatdate(usegmt=True)
class GeneratorTestCase(unittest.TestCase):
def assertGeneratorRunning(self, gen):
"""
Check that a generator-based coroutine hasn'... | 30.698276 | 79 | 0.663016 | [
"BSD-3-Clause"
] | LiaoSteve/websockets | tests/utils.py | 3,561 | Python |
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | 39.336957 | 116 | 0.678088 | [
"Apache-2.0"
] | alex-chew/aws-encryption-sdk-python | test/functional/test_f_xcompat.py | 7,238 | Python |
import os
import sys
import gen_database as gendb
import json
from shutil import copyfile
def run_cmd(cmd):
cmd_pipe = os.popen(cmd)
cmd_print = cmd_pipe.read()
print(cmd_print)
if __name__ == '__main__':
print("")
root_read_dir = sys.argv[1]
if root_read_dir[-1] != r"/" or r... | 36.133333 | 141 | 0.642681 | [
"Apache-2.0"
] | ChillingVan/LocalHtmlSearchBox | doc/gen_javadoc.py | 1,626 | Python |
from django.core.validators import BaseValidator
from django.utils.deconstruct import deconstructible
from django.utils.translation import ungettext_lazy
@deconstructible
class ByteLengthValidator(BaseValidator):
compare = lambda self, a, b: a > b
clean = lambda self, x: len(x.encode('utf8'))
message = un... | 34.352941 | 63 | 0.681507 | [
"MIT"
] | motiejus/tictactoe | tictactoe/tools/validators.py | 584 | Python |
# Copyright (C) 2011 Google Inc. All rights reserved.
# Copyright (C) 2019 Apple 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 ... | 39.229885 | 113 | 0.730735 | [
"BSD-2-Clause"
] | jacadcaps/webkitty | Tools/Scripts/webkitpy/tool/mocktool.py | 3,413 | Python |
"""
This script implements an outlier interpretation method of the following paper:
"Beyond Outlier Detection: Outlier Interpretation by Attention-Guided Triplet Deviation Network". in WWW'21.
@ Author: Hongzuo Xu
@ email: hongzuo.xu@gmail.com or leogarcia@126.com or xuhongzuo13@nudt.edu.cn
"""
import numpy as np
imp... | 36.135135 | 120 | 0.639616 | [
"Apache-2.0"
] | xuhongzuo/Outlier-Interpretation | model_aton/datasets.py | 8,022 | Python |
# Defines a bluetooth exception
class BluetoothException(Exception):
pass | 25.666667 | 36 | 0.805195 | [
"MIT"
] | jjoyce0510/autonomous-shipping-vessel | src/main/python/exceptions/BluetoothException.py | 77 | Python |
from unittest import TestCase
import torch
from model.lstm2d_cell import LSTM2dCell
class LSTM2dCellTest(TestCase):
"""
Unit tests for the 2D-LSTM cell.
"""
embed_dim = 50
encoder_state_dim = 20
input_dim = 2 * encoder_state_dim + embed_dim
cell_state_dim = 25
batch_size = 42
def ... | 42.450704 | 115 | 0.675514 | [
"MIT"
] | FlorianPfisterer/2D-LSTM-Seq2Seq | test/test_lstm2d_cell.py | 3,014 | Python |
# Copyright (c) 2020, NVIDIA CORPORATION. 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 appli... | 45.308219 | 125 | 0.639153 | [
"Apache-2.0"
] | JINHXu/NeMo | nemo/collections/asr/metrics/rnnt_wer.py | 19,845 | Python |
'''
Created on 2021-08-19
@author: wf
'''
from unittest import TestCase
import time
import getpass
import os
class BaseTest(TestCase):
'''
base test case
'''
def setUp(self,debug=False,profile=True):
'''
setUp test environment
'''
TestCase.setUp(self)
self.... | 25.25 | 70 | 0.571782 | [
"Apache-2.0"
] | WolfgangFahl/pyOnlineSpreadSheetEditing | tests/basetest.py | 1,616 | Python |
# Auto-generated at 2021-09-27T17:12:31.553030+08:00
# from: Justice Iam Service (4.1.0)
# Copyright (c) 2018 - 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
# pylint: disable=duplicate-code
# pylint: ... | 33.540541 | 123 | 0.665861 | [
"MIT"
] | encyphered/accelbyte-python-sdk | accelbyte_py_sdk/api/iam/models/model_get_users_response_with_pagination_v3.py | 3,723 | Python |
from svs.models import Customer
from django.db import models
from django.utils import timezone
from svs.models import Customer, Machine
from core.models import CoreUser
from markdownx.models import MarkdownxField
STATUSES = (
("pending_our", "Pending - Our Side"),
("pending_their", "Pending - Their Side"),
... | 30.744186 | 75 | 0.715582 | [
"MIT"
] | mariofix/optisortcreator | issues/models.py | 1,325 | Python |
# Generated by Django 2.1.3 on 2019-01-07 17:44
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import services.models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | 33.333333 | 123 | 0.606364 | [
"MIT"
] | KeoH/orchestrapi | services/migrations/0001_initial.py | 1,100 | Python |
from flask_alembic import Alembic
from flask_sqlalchemy import SQLAlchemy
database = SQLAlchemy()
alembic = Alembic()
| 19.833333 | 39 | 0.823529 | [
"BSD-3-Clause"
] | wikimedia/cloud-metricsinfra-prometheus-manager | prometheus_manager/database.py | 119 | Python |
#!/usr/bin/python3
import pymysql
db = pymysql.connect("localhost","root","123456","tboxdb" )
cursor = db.cursor()
#create table
cursor.execute("DROP TABLE IF EXISTS EMPLOYEE")
sql = """CREATE TABLE EMPLOYEE (
FIRST_NAME CHAR(20) NOT NULL,
LAST_NAME CHAR(20),
AGE INT,
... | 21.109589 | 67 | 0.53926 | [
"Apache-2.0"
] | harveywangdao/car | scripts/mysql.py | 1,541 | Python |
# Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk)
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.
"""The structure cla... | 31.029851 | 76 | 0.647908 | [
"BSD-3-Clause"
] | AaronLi/biopython | Bio/PDB/Structure.py | 2,079 | Python |
import unittest
from code import instance as i
from code import datamapping as dm
class TestProblemInstance(unittest.TestCase):
def setUp(self):
raw_data = dm.Importer()
raw_data.import_data("./tests/cvrp1.test")
data = dm.DataMapper(raw_data)
self.problem = i.ProblemInstance(dat... | 19.380952 | 50 | 0.668305 | [
"MIT"
] | Antash696/VRP | tests/tests_instance.py | 407 | Python |
#!/usr/bin/env python
import os
from matplotlib.path import Path
import numpy as np
import pandas as pd
from scipy.interpolate import griddata
from qcore import geo
DATA = os.path.join(os.path.dirname(os.path.abspath(__file__)), "zdata")
# constant regions and max bounds for faster processing
POLYGONS = [
(os.... | 32.37931 | 145 | 0.636493 | [
"MIT"
] | ucgmsim/gmhazard | calculation/gmhazard_calc/gmhazard_calc/nz_code/nzs1170p5/nzs_zfactor_2016/ll2z.py | 2,817 | Python |
#!/usr/bin/env python3
# Copyright (c) 2019 MindAffect B.V.
# Author: Jason Farquhar <jason@mindaffect.nl>
# This file is part of pymindaffectBCI <https://github.com/mindaffect/pymindaffectBCI>.
#
# pymindaffectBCI is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public... | 38.649677 | 150 | 0.566207 | [
"MIT"
] | CkiChen/pymindaffectBCI | mindaffectBCI/decoder/UtopiaDataInterface.py | 53,839 | Python |
"""
Module to read / write wav files using NumPy arrays
Functions
---------
`read`: Return the sample rate (in samples/sec) and data from a WAV file.
`write`: Write a NumPy array as a WAV file.
"""
from __future__ import division, print_function, absolute_import
import sys
import numpy
import struct
import warnings... | 31.334783 | 78 | 0.548009 | [
"BSD-3-Clause"
] | AKuederle/scipy | scipy/io/wavfile.py | 14,414 | Python |
def module_name():
print("Soy el módulo 4")
if __name__ == "__main__":
print(module_name()) | 20 | 28 | 0.65 | [
"MIT"
] | soytupadrrre/Master_Python_Eip | programacion_avanzada/06.paquetes_y_modulos/package/sub_package2/mod4.py | 101 | Python |
class Config:
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
ACL = 'public-read'
FLASKS3_BUCKET_NAME = os.environ.get('FLASKS3_BUCKET_NAME')
FLASKS3_REGION = os.environ.get('FLASKS3_REGION') | 47.166667 | 67 | 0.756184 | [
"MIT"
] | adrianaarcia/YPool | serverless/flask-server/config.py | 283 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.