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 |
|---|---|---|---|---|---|---|---|---|
"""
Django settings for Punyadaan_Website project.
Generated by 'django-admin startproject' using Django 2.2.6.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
im... | 25.793388 | 91 | 0.697853 | [
"Apache-2.0"
] | dushyant1singh1/Punyadaan-Website | Punyadaan_Website/Punyadaan_Website/settings.py | 3,121 | Python |
# *- coding: utf-8 -*
# Created by: ZhaoDongshuang
# Created on: 2018/1/27
import unittest
from others.survey import AnonymousSurvey
class TestAnonymousSurvey(unittest.TestCase):
def setUp(self):
question = "What language did you first learn to speak?"
self.my_survey = AnonymousSurvey(question)
... | 28.724138 | 66 | 0.696279 | [
"Apache-2.0"
] | imtoby/LearnPythonRecord | others/test_survey.py | 833 | Python |
import unittest, sys
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts, h2o_import as h2i
# test some random csv data, and some lineend combinations
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
global loc... | 28.709677 | 91 | 0.673034 | [
"Apache-2.0"
] | jhsrcmh/h2o | py/testdir_single_jvm/notest_parse3.py | 890 | Python |
import torch
import time
from math import pi
import numpy as np
from os.path import join
from ..utils.tensorboard import Tensorboard
from ..utils.output import progress
from .convergence import Convergence
from ..model.deepmod import DeepMoD
from typing import Optional
def train(model: DeepMoD,
data: torch... | 48.967433 | 263 | 0.58734 | [
"MIT"
] | GJBoth/MultiTaskPINN | src/multitaskpinn/training/training.py | 25,561 | Python |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test decoding scripts via decodescript RPC command."""
from test_framework.messages import CTransactio... | 71.302128 | 761 | 0.760444 | [
"MIT"
] | Black-NET/erexcoin-source | test/functional/rpc_decodescript.py | 16,756 | Python |
# Copyright 2018, OpenCensus 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 applicable law or agreed to in w... | 31.369318 | 74 | 0.638834 | [
"Apache-2.0"
] | kshithijiyer/opencensus-python | tests/unit/trace/test_blank_span.py | 5,521 | Python |
import os
import shutil
cur_dir= os.getcwd()
def make_folder(name): #Checks to see if a folder exists, makes it if it doesn't.
if (os.path.exists('.\\'+name)):
return
else:
os.makedirs('.\\'+name)
def notepad(name):
if os.path.exists(os.path.join(cur_dir,name)) == False:... | 34.09589 | 251 | 0.634592 | [
"MIT"
] | Satvik2101/Clean-Folder | clean_folder_v4.py | 4,978 | Python |
from datetime import datetime, timedelta
from typing import Callable
def create_batch_list(n_batches: int) -> list:
return list(map(lambda x: x, range(1, n_batches + 1)))
def create_batch_dictionary(batch_lst: list, duration_lst: list, expected_finish_lst: list) -> dict:
batch_dict = {batch_lst[i]: (duratio... | 40.745763 | 114 | 0.720882 | [
"MIT"
] | jkomyno/amplrestapi | ampljit/utils.py | 4,808 | Python |
from tkinter import messagebox, Tk, Menu, ttk
news = ['Mid Day News', 'Evening News']
features = ['Calling Farmers', 'Round About Ja', 'You and the Law', 'Get the Facts',
'Career Talk', 'Economy and you', 'Arts Page', 'Tourism Roundup',
'Jeep','Jamaica Promise', 'House Matters', 'Jamaica H... | 37.571429 | 114 | 0.661054 | [
"MIT"
] | UncleEngineer/TkinterTrick | 000-combobox1.py | 1,841 | Python |
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def home():
return render_template("index.html")
if __name__ == "__main__":
app.run(debug=True) | 14.461538 | 40 | 0.68617 | [
"Apache-2.0"
] | nurmatthias/100DaysOfCode | day48/server.py | 188 | Python |
#
# Copyright 2018 Expedia 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... | 29.653465 | 84 | 0.543239 | [
"Apache-2.0"
] | ExpediaGroup/neaps | neaps-api/neaps_lib/bootstrap_test.py | 2,995 | Python |
# coding: utf-8
# Copyright 2020. ThingsBoard
# #
# 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
# #
# Unl... | 24.435013 | 183 | 0.53528 | [
"Apache-2.0"
] | CSTC-WTCB-BBRI/python_tb_rest_client | tb_rest_client/models/models_pe/url.py | 9,212 | Python |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import json
from abc import abstractmethod
from argparse import ArgumentParser, Namespace
from typing import Any, List, NamedTuple, Optional, Tuple
from idb.cli.commands.base import TargetCommand
from idb.client.client impo... | 30.996753 | 88 | 0.627527 | [
"MIT"
] | BalestraPatrick/idb | idb/cli/commands/file.py | 9,547 | Python |
from __future__ import print_function
import numpy as np
import scipy.linalg
import torch
import torch.nn as nn
import torch.nn.functional as F
from flow_modules.misc import cpd_sum, cpd_mean
def squeeze2d(input, factor=2):
#assert factor >= 1 and isinstance(factor, int)
if factor == 1:
return input
size = inp... | 28.222222 | 106 | 0.653543 | [
"Apache-2.0"
] | Catherine0505/mar-scf-flow | flow_modules/common_modules.py | 6,858 | Python |
# -*- coding: utf-8 -*-
from __future__ import division
import os
import pytest
from ethereum import _solidity
from ethereum._solidity import compile_file
from ethereum.utils import denoms
from pyethapp.rpc_client import JSONRPCClient
from pyethapp.jsonrpc import default_gasprice
from raiden.network.rpc.client impor... | 33.647273 | 85 | 0.711985 | [
"MIT"
] | nicksavers/raiden | raiden/tests/integration/test_blockchainservice.py | 9,253 | Python |
# coding: utf-8
from __future__ import absolute_import
from __future__ import print_function
import warnings
from ruamel.yaml.error import MarkedYAMLError, ReusedAnchorWarning
from ruamel.yaml.compat import utf8
from ruamel.yaml.events import (
StreamStartEvent, StreamEndEvent, MappingStartEvent, MappingEndEven... | 37.603261 | 92 | 0.599798 | [
"MIT"
] | mpercich/Calendarize | ios/dateparser/lib/python2.7/site-packages/ruamel/yaml/composer.py | 6,919 | Python |
import argparse
import locale
import sys
from datetime import datetime
from model import *
from sql import *
from common import *
from util import *
def parse_arguments():
'''
Parse input arguments. Passing the API key is defined as mandatory.
'''
parser = argparse.ArgumentParser(description='... | 39.9375 | 201 | 0.691706 | [
"MIT"
] | hailpam/data-crunching | scripts/orders-exporter.py | 2,556 | Python |
# -*- coding: utf-8 -*-
import QUANTAXIS as QA
from QUANTAXIS.QAFetch import QATusharePro as pro
import pandas as pd
import numpy as np
from pyspark.sql.functions import pandas_udf, PandasUDFType
from pyspark import SparkContext,SparkConf
from pyspark.sql.session import SparkSession
from QUANTAXIS.ML import RegUtil
fro... | 55.97561 | 310 | 0.666993 | [
"MIT"
] | lkaiser/QUANTAXIS | EXAMPLE/test_backtest/example/indicator/simple_valued_spark2.py | 9,180 | Python |
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import pytest
from datadog_checks.postgres.relationsmanager import ALL_SCHEMAS, IDX_METRICS, LOCK_METRICS, RelationsManager
from .common import SCHEMA_NAME
pytestmark = pytest.mark.unit
@pytest.mark.paramet... | 38.35 | 119 | 0.618774 | [
"BSD-3-Clause"
] | Kyle-Neale/integrations-core | postgres/tests/test_relationsmanager.py | 3,835 | Python |
"""Common classes and elements for Omnilogic Integration."""
from datetime import timedelta
import logging
from omnilogic import OmniLogicException
from homeassistant.const import ATTR_NAME
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
... | 28.386076 | 84 | 0.611371 | [
"Apache-2.0"
] | 123dev/core | homeassistant/components/omnilogic/common.py | 4,485 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-03-20 21:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('librarian', '0108_dataset_is_external_missing'),
]
operations = [
migratio... | 25.142857 | 111 | 0.643939 | [
"BSD-3-Clause"
] | cfe-lab/Kive | kive/librarian/migrations/0109_dataset_is_uploaded.py | 528 | Python |
"""
MODULE : code_generation.py
Purpose : * Class for parsing the text and launching the basic block algorithm.
Also houses the code generation algorithm
"""
# List of Imports Begin
import debug as DEBUG
import instr3ac as INSTRUCTION
import basic_blocks as BB
import mips_assembly as ASM
import global_... | 30.096 | 97 | 0.597023 | [
"MIT"
] | vaishious/comperler | project/src/codegen/code_generation.py | 3,762 | Python |
# terrascript/provider/alertmixer/amixr.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:11:40 UTC)
import terrascript
class amixr(terrascript.Provider):
""""""
__description__ = ""
__namespace__ = "alertmixer"
__name__ = "amixr"
__source__ = "https://github.com/alertmixer/terra... | 22.85 | 73 | 0.691466 | [
"BSD-2-Clause"
] | mjuenema/python-terrascript | terrascript/provider/alertmixer/amixr.py | 457 | Python |
import pytest
from django.test import RequestFactory
from tslhub_accounts_api.users.api.views import UserViewSet
from tslhub_accounts_api.users.models import User
pytestmark = pytest.mark.django_db
class TestUserViewSet:
def test_get_queryset(self, user: User, rf: RequestFactory):
view = UserViewSet()
... | 25.470588 | 67 | 0.633949 | [
"MIT"
] | vvvti/tslhub-accounts-api | tslhub_accounts_api/users/tests/test_drf_views.py | 866 | Python |
#!/usr/bin/env python
# not used in this project.
import sys
sys.path.append('../gen-py')
from EyePi.ttypes import EyePiInput
from EyePi.ttypes import ConfirmInput
from GenericStruct.ttypes import ActionEnum
from WeatherPi.ttypes import WeatherInput
from ConnectionHelpers.DeviceRegistrator import DeviceRegistrator
... | 30.493333 | 96 | 0.716659 | [
"Apache-2.0"
] | emschimmel/BrainPi | 1IntegrationTests/py-impl/PythonEyePiClient.py | 2,287 | Python |
import json
from copy import deepcopy
from time import time
from asynctest import TestCase as AsyncTestCase
from asynctest import mock as async_mock
from .....core.in_memory import InMemoryProfile
from .....indy.holder import IndyHolder
from .....indy.sdk.holder import IndySdkHolder
from .....indy.issuer import Indy... | 37.860366 | 88 | 0.517031 | [
"Apache-2.0"
] | wadeking98/aries-cloudagent-python | aries_cloudagent/protocols/present_proof/v2_0/tests/test_manager.py | 62,091 | Python |
import setuptools
with open('README.md', 'r') as file:
long_description = file.read()
setuptools.setup(
name='anvil-parser',
version='0.5.2',
author='mat',
description='A Minecraft anvil file format parser',
long_description=long_description,
long_description_content_type='text/markdown',
... | 25.92 | 55 | 0.640432 | [
"MIT"
] | MrMallIronmaker/anvil-parser | setup.py | 648 | Python |
# Script that cuts the greet string into chunks and prints it out
greet = "Hello World!"
print(greet)
print("Start: ", greet[0:3])
print("Middle: ", greet[3:6])
print("End: ", greet[-3:])
a = greet.find(",")
print("Portion before comma", greet[:a])
| 19.461538 | 65 | 0.652174 | [
"Unlicense"
] | Memeklos/Programming-Code-Snippets | Python/CTF/greet.py | 253 | Python |
# -*- coding: utf-8 -*-
""" NETWORK
This module defines the BlendHunter class which can be used to retrain the
network or use predefined weights to make predictions on unseen data.
:Author: Samuel Farrens <samuel.farrens@cea.fr>
"""
import os
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns... | 31.537313 | 79 | 0.555419 | [
"MIT"
] | CosmoStat/BlendHunter | blendhunter/network.py | 21,130 | Python |
"""
TimeSeries is a generic time series class from which all other TimeSeries
classes inherit from.
"""
import copy
import warnings
from collections import OrderedDict
import pandas as pd
import matplotlib.pyplot as plt
import astropy
import astropy.units as u
from astropy.table import Table, Column
from sunpy impor... | 33.719355 | 107 | 0.604802 | [
"BSD-2-Clause"
] | yashrsharma44/sunpy | sunpy/timeseries/timeseriesbase.py | 20,906 | Python |
# Copyright 2018 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.117647 | 80 | 0.671094 | [
"Apache-2.0"
] | 01-vyom/keras | keras/engine/base_preprocessing_layer_test.py | 8,358 | 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... | 31 | 79 | 0.762903 | [
"Apache-2.0"
] | 1AB9502/incubator-superset | superset/migrations/versions/ca69c70ec99b_tracking_url.py | 1,240 | Python |
"""An abstract class for entities."""
from __future__ import annotations
from abc import ABC
import asyncio
from collections.abc import Awaitable, Iterable, Mapping, MutableMapping
from dataclasses import dataclass
from datetime import datetime, timedelta
from enum import Enum, auto
import functools as ft
import loggi... | 34.177203 | 133 | 0.642247 | [
"Apache-2.0"
] | algra4/core | homeassistant/helpers/entity.py | 35,681 | Python |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | 69.734177 | 623 | 0.754674 | [
"Apache-2.0"
] | extremenetworks/pybind | pybind/slxos/v17s_1_02/routing_system/router/router_bgp/address_family/ipv4/ipv4_unicast/default_vrf/neighbor/af_ipv4_neighbor_peergroup_holder/af_ipv4_neighbor_peergroup/prefix_list/direction_out/__init__.py | 11,018 | Python |
import os
import pytest
import radical.utils as ru
import radical.pilot as rp
import radical.pilot.constants as rpc
from radical.pilot.agent.scheduler.hombre import Hombre
try:
import mock
except ImportError:
from tasktest import mock
# -----------------------------------------------... | 33.906475 | 80 | 0.462232 | [
"MIT"
] | eirrgang/radical.pilot | old_tests/test_hombre_scheduler.py | 9,426 | Python |
import pytest
from app.models.user import User
from datetime import date
@pytest.fixture(scope='module')
def new_user():
user = User('test', date(day=1, month=12, year=1989))
return user
def test_new_user(new_user):
"""
GIVEN a User model
WHEN a new User is created
THEN check the username a... | 22.333333 | 69 | 0.690832 | [
"CC0-1.0"
] | atsikham/flask-test-app | tests/unit/test_app.py | 469 | Python |
class BitVector:
"""
This class uses an int called dec_rep as a vector of self.len many bits,
where self.len <= self.max_len. The class wraps some common bitwise
operations, and some less common ones too (like Gray coding that is
needed by Qubiter). In some cases, the bitwise manipulation might be
... | 25.684478 | 78 | 0.521795 | [
"Apache-2.0"
] | yourball/qubiter | qubiter/BitVector.py | 10,094 | Python |
import os
import os.path as osp
import pickle
import random
from collections import deque
from datetime import datetime
import gym
import numpy as np
import scipy.stats as stats
import torch
import torch.optim as optim
from mpi4py import MPI
import dr
from dr.ppo.models import Policy, ValueNet
from dr.ppo.train impor... | 35.169096 | 111 | 0.603167 | [
"MIT"
] | quanvuong/domain_randomization | dr/experiment/ppo_pytorch.py | 12,063 | Python |
import os
import sys
sys.path.insert(0, os.path.abspath('../../'))
project = 'Domain Trails'
copyright = '2021, iAbdullahMughal'
author = 'iAbdullahMughal'
release = '1.0.0'
extensions = [
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.int... | 21.030303 | 62 | 0.675793 | [
"MIT"
] | iAbdullahMughal/domain-trails | docs/source/conf.py | 694 | Python |
"""Api calls for sync."""
import asyncio
import logging
from aiohttp import ClientResponseError
from august.api_common import (
API_LOCK_URL,
API_RETRY_ATTEMPTS,
API_RETRY_TIME,
API_UNLOCK_URL,
HEADER_AUGUST_ACCESS_TOKEN,
ApiCommon,
_api_headers,
_convert_lock_result_to_activities,
... | 34.480144 | 90 | 0.653335 | [
"MIT"
] | THATDONFC/py-august | august/api_async.py | 9,551 | Python |
#!/usr/bin/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
# "Licens... | 33.970954 | 164 | 0.703188 | [
"Apache-2.0"
] | 10088/hive | testutils/gen-report.py | 8,187 | Python |
from terminusdb_client.woqlclient.api_endpoint_const import APIEndpointConst
from .connectCapabilitiesResponse import ConnectResponse
from .getSchemaTurtleResponse import RESPONSE
def mocked_requests(*args, **kwargs):
class MockResponse:
def json(self):
if self._json_data is None:
... | 33.607595 | 94 | 0.616196 | [
"Apache-2.0"
] | Morijarti/terminusdb-client-python | terminusdb_client/tests/mockResponse.py | 2,655 | Python |
def main():
with open('inputs/01.in') as f:
data = [int(line) for line in f]
print(sum(data))
result = 0
seen = {0}
while True:
for item in data:
result += item
if result in seen:
print(result)
return
seen.add(resu... | 18.2 | 40 | 0.46978 | [
"MIT"
] | Wattleninja/Advent-of-Code | 2018/day_01.py | 364 | Python |
################################################################################
#
# Author: Diego Montufar
# Date: Apr/2015
# Name: __init__.py
# Description: Here we define the available web services which can be accessed by
# following the app.route path as URL. The inde... | 53.181467 | 145 | 0.675476 | [
"MIT",
"Unlicense"
] | diogonal/SentimentAnalyser | web/__init__.py | 13,774 | Python |
# reference_metric.py: Define all needed quantities
# for a reference metric.
# Given uniform (reference metric) coordinate
# (xx[0],xx[1],xx[2]), you must define:
# 1) xxmin[3],xxmax[3]: Valid ranges for each
# uniform coordinate xx0,xx1,xx2
# 2) xxSph[3]: Spherical coordinate (r,theta,phi),
# ... | 50.764476 | 176 | 0.590695 | [
"BSD-2-Clause"
] | Harmohit-Singh/nrpytutorial | reference_metric.py | 78,025 | Python |
if __name__ == "__main__":
assert currentProgram is None
assert state.getProject() is not None
print("programless_script executed successfully")
| 26.333333 | 53 | 0.740506 | [
"MIT"
] | Defense-Cyber-Crime-Center/pyhidra | tests/programless_script.py | 158 | Python |
from ..config import config
import logging
import os
import shutil
import subprocess
from subprocess import CalledProcessError, Popen
from time import sleep
logging.basicConfig(
level=config.log_level, format='%(asctime)s | %(levelname)s | %(message)s')
PORT = config.port
def rm_gen_dir():
try:
shut... | 23.628571 | 82 | 0.602177 | [
"MIT"
] | fijshion/insights_connexion | insights_connexion/test/oatts.py | 1,654 | Python |
import os
import numpy as np
import random
from nn_activations import sigmoid, sigmoid_prime
class NeuralNetwork(object):
def __init__(self, sizes=list(), learning_rate=1.0, mini_batch_size=16,
epochs=10):
"""Initialize a Neural Network model.
Parameters
----------
... | 37.164251 | 80 | 0.579488 | [
"MIT"
] | fredwangwang/webcam-sudoku-solver | src/nn_model.py | 7,693 | Python |
import numpy as np
import logging
import os, errno
from datetime import datetime
from ..abstract import Environment
from maddux.environment import Environment
from maddux.objects import Ball
from maddux.robots import simple_human_arm
class RobotArm(Environment):
def __init__(self, env, training_directory, config):
... | 30.302083 | 115 | 0.702991 | [
"MIT"
] | callaunchpad/MOR | environments/robot_arm/robot_arm.py | 2,909 | Python |
"""
This module enables the clustering of DataFrame headers into
like clusters based on correlations between columns
"""
from typing import List
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.cluster.hierarchy as sch
from gretel_synthetics.utils import stats
LEFT = 0
RIGHT = 1
... | 30.398058 | 140 | 0.626956 | [
"Apache-2.0"
] | andrewnc/gretel-synthetics | src/gretel_synthetics/utils/header_clusters.py | 6,262 | Python |
"""
Plugin architecture, based on decorators
References:
1. https://play.pixelblaster.ro/blog/2017/12/18/a-quick-and-dirty-mini-plugin-system-for-python/
"""
| 23.285714 | 100 | 0.736196 | [
"MIT"
] | huuhoa/colusa | src/colusa/plugins/__init__.py | 163 | Python |
# Generated by Django 2.2.10 on 2020-03-20 15:01
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import src.auth.models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_updat... | 56.741379 | 266 | 0.637496 | [
"BSD-3-Clause"
] | SerhatTeker/django-bank-allauth-rest | src/auth/migrations/0001_initial.py | 3,291 | Python |
import os
# system parameters
GPUS = [0]
DATALOADER_WORKERS = 8
# optimization parameters
BATCH_SIZE = 1
EPOCHS = 50
LR = 0.0001
WEIGHT_DECAY = 0.0005
MOMENTUM = 0.9
# image pre-processing parameters
GAUSSIAN_VALUE = 0
# directory locations
HOME_DIR = "/home/mbc2004"
DATASET_DIR = "/home/mbc2004/datasets"
MODEL_SRC... | 44.601896 | 132 | 0.551376 | [
"MIT"
] | AssistiveRoboticsUNH/temporal_feature_lfd | parameter_parser.py | 9,411 | 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.5
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
import typing
from .... | 38.238462 | 524 | 0.616375 | [
"BSD-2-Clause"
] | Flav-STOR-WL/py-pure-client | pypureclient/flasharray/FA_2_5/models/policy_rule_smb_client_get_response.py | 4,971 | Python |
from util.dc_verilog_parser import *
def main():
folder = "../dc/sub/adder8/"
# folder = "../dc/boom/implementation/"
total_nodes = 0
total_edges = 0
ntype = set()
for v in os.listdir(folder):
if v.startswith("hier"):
continue
vf = os.path.join(folder, v)
pri... | 34.309524 | 86 | 0.574601 | [
"Apache-2.0"
] | ZeayW/graph-contrastive-learning | util1/find_central.py | 1,441 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tablo', '0003_auto_20160106_1509'),
]
operations = [
migrations.CreateModel(
name='FeatureServiceLayerRelations'... | 31.961538 | 95 | 0.602888 | [
"BSD-3-Clause"
] | nrdsdata/tablo | tablo/migrations/0004_featureservicelayerrelations.py | 831 | Python |
# Library of fault injection functions called at runtime for common operations in TensorFlow
# NOTE: These are called by the corresponding functions inserted in the TensorFlow graph at RUNTIME
import tensorflow as tf
import numpy as np
import logging
from fiConfig import *
from fiLog import *
from threading import c... | 34.922449 | 105 | 0.736746 | [
"MIT"
] | PhuongLe/PilotNet | TensorFI/injectFault.py | 42,780 | Python |
import glob
import yaml
import os
from generators import intermediate_files
from schema import cleaner
# This script takes all ECS and custom fields already loaded, and lets users
# filter out the ones they don't need.
def filter(fields, subset_file_globs, out_dir):
subsets = load_subset_definitions(subset_file_... | 42.056452 | 153 | 0.640652 | [
"Apache-2.0"
] | 6un9-h0-Dan/ecs | scripts/schema/subset_filter.py | 5,215 | Python |
# Copyright 2020 The Kubric 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | 39.900826 | 112 | 0.713546 | [
"Apache-2.0"
] | Xtuden-com/kubric | kubric/renderer/blender.py | 19,312 | Python |
from bs4 import BeautifulSoup
from spotipy.oauth2 import SpotifyOAuth
import requests
import spotipy
SPOTIFY_CLIENT_ID = "YOUR_SPOTIFY_CLIENT_ID"
SPOTIFY_CLIENT_SECRET = "YOUR_SPOTIFY_CLIENT_SECRET"
sp = spotipy.Spotify(
auth_manager=SpotifyOAuth(
client_id=SPOTIFY_CLIENT_ID,
client_secret=SPOTIF... | 31.294118 | 100 | 0.718672 | [
"MIT"
] | gabrielmdr/100-days-of-code | projects/day046/music-time-machine.py | 1,596 | Python |
"""
config_objects.py
By: John-Michael O'Brien
Date: 7/25/2020
Data structures that define and load configuration information for the
wallpaper watcher.
"""
from typing import List, Dict, Optional
from dataclasses import dataclass, field
import jsons
import yaml
@dataclass
class SubredditConfig():
""" Holds any ... | 27.346667 | 93 | 0.695758 | [
"MIT"
] | JimTheCactus/RedditWallpaperWatcher | config_objects.py | 2,051 | Python |
# Copyright 2021 Research Institute of Systems Planning, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 38.52 | 77 | 0.680685 | [
"Apache-2.0"
] | tier4/ros2caret | ros2caret/verb/message_flow.py | 1,926 | Python |
# -*- coding: utf-8 -*-
"""
unifonicnextgen
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
class GetScheduledMessageResponse(object):
"""Implementation of the 'Get Scheduled Message response' model.
GetsDetails of specified scheduled message, If Me... | 29.56962 | 84 | 0.581336 | [
"MIT"
] | masaar/unifonic_python_sdk | unifonicnextgen/models/get_scheduled_message_response.py | 2,336 | Python |
# Copyright 2019, OpenCensus 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 applicable law or agreed to in w... | 37.444444 | 127 | 0.66815 | [
"Apache-2.0"
] | census-instrumentation/opencensus-python | contrib/opencensus-ext-pymongo/setup.py | 2,022 | Python |
# encoding: utf-8
import json
from .. import (
DatabaseTest,
sample_data
)
from lxml import etree
from core.coverage import CoverageFailure
from core.model import Contributor, Identifier, Measurement
from core.metadata_layer import *
from oclc.classify import (
IdentifierLookupCoverageProvider,
OCLCCla... | 41.454023 | 154 | 0.661237 | [
"Apache-2.0"
] | NYPL-Simplified/metadata_wrangler | tests/oclc_/test_identifier_lookup_coverage_provider.py | 14,426 | Python |
from django.shortcuts import redirect, render
from django.views.generic import TemplateView
from ..models import Student
class SignUpView(TemplateView):
template_name = 'registration/signup.html'
def home(request):
if request.user.is_authenticated:
if request.user.is_teacher:
return redir... | 31.76 | 63 | 0.672544 | [
"MIT"
] | netomo/django-schools | django_school/classroom/views/classroom.py | 794 | Python |
import pytorchresearch as ptr
import torch
import torchvision
if __name__ == "__main__":
# transform for data
transform = torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize(
mean=(0.485, 0.456, 0.406),
std=(0.229, 0.224... | 33.053571 | 80 | 0.600216 | [
"MIT"
] | VoIlAlex/pytorchresearch | docs/example_1/back.py | 1,851 | Python |
from django.db.models import Q
from .base import EntityType
TYPE_VIDEO = "video"
class VideoEntity(EntityType):
name = TYPE_VIDEO
@classmethod
def filter_date_lte(cls, qs, dt):
return qs.filter(publication_date__lte=dt)
@classmethod
def filter_date_gte(cls, qs, dt):
return qs.f... | 26.966667 | 82 | 0.673671 | [
"CC0-1.0"
] | iamnkc/tournesol | backend/tournesol/entities/video.py | 809 | Python |
import logging
import random
import time
from jobcontrol.exceptions import SkipBuild
def job_simple_echo(*args, **kwargs):
return (args, kwargs)
_cached_words = None
def _get_words():
global _cached_words
if _cached_words is not None:
return _cached_words
try:
with open('/usr/sh... | 25.80695 | 75 | 0.637193 | [
"Apache-2.0"
] | rshk/jobcontrol | jobcontrol/utils/testing.py | 6,684 | Python |
"""
Django settings for HedgeFund project.
Generated by 'django-admin startproject' using Django 3.2.8.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathl... | 26.741007 | 91 | 0.708905 | [
"MIT"
] | atreyasinha/Heptra-Capital | HedgeFund/base.py | 3,717 | Python |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2013 Nathanael C. Fritz, Lance J.T. Stout
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
from sleekxmpp.jid import JID
from sleekxmpp.xmlstream import ElementBase, register_stanza_plugin
class NoSave(ElementBase):
... | 24.566667 | 67 | 0.650611 | [
"BSD-3-Clause"
] | Dunedan/SleekXMPP | sleekxmpp/plugins/google/nosave/stanza.py | 1,474 | Python |
from sklearn.model_selection import cross_val_score
import pandas as pd
import matplotlib.pyplot as plt
def CrossValidationFolds_Traversal(estimator, vdataset):
"""
Arguments:
- estimator = classifer of model
- vdataset = vehicld dataset
This function computes acccuracy score w... | 28.535714 | 86 | 0.617647 | [
"MPL-2.0"
] | Bolaji61/PRESC | dev/shiza16/Calibration plot/CrossValidationFold_Traversal.py | 1,598 | Python |
#!/usr/bin/env python
import os
import sys
def addPath(rel_path, prepend=False):
""" Adds a directory to the system python path, either by append (doesn't
override default or globally installed package names) or by prepend
(overrides default/global package names).
"""
path = lambda *paths: os.path.... | 34.586207 | 79 | 0.735793 | [
"MIT"
] | Locu/djoauth2 | example/manage.py | 1,003 | Python |
# TODO: your agent here!
import numpy as np
from agents.actor import Actor
from agents.critic import Critic
from agents.buffer import ReplayBuffer
from agents.ou_noise import OUNoise
class DDPG():
"""Reinforcement Learning agent that learns using DDPG."""
def __init__(self, task):
self.task = task
... | 43.096 | 125 | 0.668832 | [
"MIT"
] | GabrielTourinho/dlnd-teach-a-quadcopter-how-to-fly | home/agents/agent.py | 5,387 | Python |
# -*- coding: utf-8 -*-
"""PageParser tests."""
import httpx # noqa: F401
import pytest
from core.database import ProductGinoModel
from core.services import get_product_name
pytestmark = [pytest.mark.asyncio, pytest.mark.api_full]
API_URL_PREFIX = "/api/v1"
@pytest.fixture
def no_css_response() -> bytes:
min... | 35.497076 | 181 | 0.668369 | [
"MIT"
] | devalv/yawm | backend/tests/test_page_parser.py | 6,070 | Python |
print('running module1.py...')
a = 100
| 13 | 30 | 0.641026 | [
"Apache-2.0"
] | AadityaGupta/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | python-tuts/0-beginner/8-Modules_Packages_Namespaces/module1.py | 39 | Python |
#
# Copyright 2019 The FATE 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 appli... | 35.561798 | 106 | 0.661927 | [
"Apache-2.0"
] | AustinNeverPee/FedRec | fate_flow/utils/setting_utils.py | 3,165 | Python |
import os
from easydict import EasyDict
import torch
# architecture
from basicts.archs.DCRNN_arch import DCRNN
# runner
from basicts.runners.DCRNN_runner import DCRNNRunner
from basicts.data.base_dataset import BaseDataset
from basicts.metrics.mae import masked_mae
from basicts.metrics.mape import masked_mape
from bas... | 29.206349 | 112 | 0.628804 | [
"Apache-2.0"
] | zezhishao/BasicTS | basicts/options/DCRNN/DCRNN_PEMS07.py | 3,680 | Python |
import pylab as pl
import numpy as np
from os import path
from numpy import abs, linspace, sin, pi, int16
import pandas
def plotfft(s, fmax, doplot=False):
""" This functions computes the fft of a signal, returning the frequency
and their magnitude values.
Parameters
----------
s: ar... | 30.503597 | 80 | 0.60684 | [
"MIT"
] | novabiosignals/novainstrumentation | novainstrumentation/tools.py | 4,240 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2018-09-26 01:53
from __future__ import unicode_literals
import ckeditor.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('posts', '0001_initial'),
]
operations = [
migrations.AlterField... | 21.409091 | 72 | 0.626327 | [
"MIT"
] | COAStatistics/aprp | src/apps/posts/migrations/0002_auto_20180926_0953.py | 471 | Python |
import os
import copy
import pytest
from jikken.api import Experiment
import git
@pytest.fixture(autouse=True, scope='module')
def experiment_setup(tmpdir_factory):
expected_variables = {
"training_parameters":
{"batch_size": 100,
"algorithm": "Seq2Seq",
"attention": ... | 40.408805 | 112 | 0.74179 | [
"MIT"
] | outcastofmusic/jikken | tests/unit/test_experiment.py | 6,425 | Python |
# Copyright © 2020 Hashmap, 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 i... | 41.794118 | 115 | 0.620338 | [
"Apache-2.0"
] | hashmapinc/hdm | hdm/core/orchestrator/declared_orchestrator.py | 2,843 | Python |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | 33.533981 | 91 | 0.618587 | [
"Apache-2.0"
] | Anshika-Gautam/st2 | st2common/tests/unit/test_logger.py | 17,270 | Python |
import os
from enum import IntEnum
from typing import Dict, Union, Callable, List, Optional
from cereal import log, car
import cereal.messaging as messaging
from common.conversions import Conversions as CV
from common.realtime import DT_CTRL
from selfdrive.locationd.calibrationd import MIN_SPEED_FILTER
from selfdrive.... | 35.066272 | 152 | 0.69515 | [
"MIT"
] | GregorKikelj/openpilot | selfdrive/controls/lib/events.py | 29,631 | Python |
from rest_framework import views
from rest_framework.response import Response
from sponsors.models import Sponsor, OpenRole
class SponsorAPIView(views.APIView):
def get(self, request):
sponsor_data = Sponsor.objects.order_by('level')
level_dict = {}
for sponsor in sponsor_data:
... | 37.033898 | 106 | 0.595423 | [
"MIT"
] | DoubleTakoMeat/pycon.tw | src/sponsors/api/views.py | 2,185 | Python |
import copy
import rdtest
import renderdoc as rd
class D3D11_Vertex_Attr_Zoo(rdtest.TestCase):
demos_test_name = 'D3D11_Vertex_Attr_Zoo'
def check_capture(self):
draw = self.find_draw("Draw")
self.check(draw is not None)
self.controller.SetFrameEvent(draw.eventId, False)
# ... | 36.568421 | 130 | 0.527634 | [
"MIT"
] | DmitrySoshnikov/renderdoc | util/test/tests/D3D11/D3D11_Vertex_Attr_Zoo.py | 3,474 | Python |
"""
Django settings for orders project.
Generated by 'django-admin startproject' using Django 3.0.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
# Bu... | 24.638462 | 91 | 0.690603 | [
"MIT"
] | rafaeltardivo/micro-order | services/orders/orders/settings.py | 3,203 | Python |
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 et:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ### ... | 36.740741 | 116 | 0.660007 | [
"MIT"
] | soichih/datalad | datalad/customremotes/tests/test_archives.py | 10,912 | Python |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Author: Endre Karlson <endre.karlson@hp.com>
#
# 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/lice... | 33.4 | 75 | 0.641807 | [
"Apache-2.0"
] | infobloxopen/designate | designate/storage/impl_sqlalchemy/migrate_repo/versions/054_allow_duplicate_domains.py | 1,837 | Python |
from flask import Flask, jsonify, request, render_template, redirect, url_for
import datetime
from alarm import AlarmService
app = Flask(__name__, static_url_path='/static')
app.config.from_pyfile('config.py')
# status file for motion detection
motionfile = "motion.txt"
# enable temperature sensor (if library is ava... | 32.842593 | 93 | 0.581054 | [
"MIT"
] | tommykoch/pyhome | web/home.py | 3,547 | Python |
"""Support for RFXtrx lights."""
import logging
import RFXtrx as rfxtrxmod
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
LightEntity,
)
from homeassistant.const import CONF_DEVICES, STATE_ON
from homeassistant.core import callback
from . import (
CONF_AUTOMATIC_ADD... | 28.311765 | 84 | 0.633493 | [
"Apache-2.0"
] | 1e1/core-1 | homeassistant/components/rfxtrx/light.py | 4,813 | Python |
# TODO:
#
# A handler/formatter that can replace django.utils.log.AdminEmailHandler
#
# Needed:
# * A dump of locals() on each affected line in the stacktrace
| 22.714286 | 73 | 0.742138 | [
"Apache-2.0"
] | Uninett/python-logging-humio | src/humiologging/handlers/django.py | 159 | Python |
import unittest
import parameterized
import numpy as np
from rlutil.envs.tabular_cy import q_iteration, tabular_env
from rlutil.envs.tabular_cy import q_iteration_py
class QIterationTest(unittest.TestCase):
def setUp(self):
self.num_states = 128
self.env = tabular_env.RandomTabularEnv(num_states=... | 33.071429 | 141 | 0.646868 | [
"MIT"
] | alexlioralexli/diagnosing_qlearning | rlutil/envs/tabular_cy/test_random_env.py | 1,852 | Python |
import json
from pathlib import Path
from typing import List
import criticus.py.edit_settings as es
def get_file(filename):
with open(filename, 'r', encoding='utf-8') as f:
text = f.readlines()
return text
def get_info_from_filename(filename):
filename = filename.split('/')[-1]
f = filename.s... | 35.629032 | 152 | 0.640109 | [
"MIT"
] | d-flood/Criticus | criticus/py/txt2json/convert_text_to_json.py | 4,418 | Python |
"""
Settings file, which is populated from the environment while enforcing common
use-case defaults.
"""
import os
from os.path import join, dirname
from dotenv import load_dotenv
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
# OR, the same with increased verbosity:
load_dotenv(dotenv... | 27.045455 | 81 | 0.72437 | [
"MIT"
] | theodesp/flask-golang-grpc-example | src/client/settings.py | 595 | Python |
# -*- coding: utf8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from pylero.base_polarion import BasePolarion
class Change(BasePolarion):
"""Object to handle the Polarion WSDL tns3:Change class
Attrib... | 29.121212 | 59 | 0.556712 | [
"MIT"
] | RedHatQE/pylero | src/pylero/change.py | 961 | Python |
import tabulate
import matplotlib.pyplot as plt
import math
import numpy as np
Data=[]
data=[]
x_axis=[]
y_axis=[]
def falci(func,a,b,error_accept):
def f(x):
f = eval(func)
return f
error=b-a
if(f(a)*f(b)>=0 and a>=b):
print("wrong a,b")
return
x=a
n... | 22.745763 | 86 | 0.517139 | [
"MIT"
] | Shakil-Mahmud-Programmer/Regular-Falsi-Method-or-False-Position-Method | 1st_formula.py | 1,342 | Python |
from .LocalDispatcher import LocalDispatcher, LocalDispatcherExecutionError
| 38 | 75 | 0.907895 | [
"MIT"
] | chilopodaHQ/chilopoda | src/lib/kombi/TaskHolder/Dispatcher/Local/__init__.py | 76 | Python |
import json
from django.core.urlresolvers import reverse
from rest_framework.compat import patterns, url
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework import status
from rest_framework.test import APITestCase
from fluent_contents.models import Placeho... | 33.618421 | 104 | 0.749511 | [
"BSD-3-Clause"
] | maykinmedia/bluebottle | bluebottle/pages/tests/test_api.py | 2,555 | Python |
import wx
from . import UIManager
from . import UIControllerObject
from . import UIViewObject
from . import MainWindowController
class ToolBarController(UIControllerObject):
tid = 'toolbar_controller'
_singleton_per_parent = True
_ATTRIBUTES = {
'id': {'default_value': wx.ID_ANY,
... | 30.636364 | 73 | 0.583383 | [
"Apache-2.0"
] | adrianopls/UIManager | tool_bar.py | 1,685 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.