max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
gen_board_sudoku.py | DazEB2/SimplePyScripts | 117 | 1788801 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# http://habrahabr.ru/post/192102/
# http://www.cs.mcgill.ca/~aassaf9/python/algorithm_x.html
def gen_sudoku(n: int=3) -> object:
return [[((i*n + i//n + j) % (n*n) + 1) for j in range(n*n)] for i in range(n*n)]
for row in gen_sudoku():
... | 1 | 1 | 0 | 0 | 2 | 0 |
lib/carbon/management.py | hessu/carbon | 961 | 1788826 | <filename>lib/carbon/management.py
import traceback
from carbon import log, state
def getMetadata(metric, key):
try:
value = state.database.getMetadata(metric, key)
return dict(value=value)
except Exception:
log.err()
return dict(error=traceback.format_exc())
def setMetadata(metric, key, value):... | 0 | 0 | 0 | 0 | 0 | 0 |
geopyspark/tests/geotrellis/tiled_layer_tests/stitch_test.py | geotrellis/geotrellis-python | 182 | 1788855 | import os
import unittest
import numpy as np
import pytest
from geopyspark.geotrellis import SpatialKey, Tile
from shapely.geometry import Point
from geopyspark.geotrellis.layer import TiledRasterLayer
from geopyspark.tests.base_test_class import BaseTestClass
from geopyspark.geotrellis.constants import LayerType
cl... | 0 | 0 | 4 | 0 | 4 | 0 |
ch08/myproject_virtualenv/src/django-myproject/myproject/apps/categories1/views.py | PacktPublishing/Django-3-Web-Development-Cookbook | 159 | 1788864 | <gh_stars>100-1000
from django.views.generic import ListView
from .models import Category
class IdeaCategoryList(ListView):
model = Category
template_name = "categories1/category_list.html"
context_object_name = "categories"
| 0 | 0 | 0 | 0 | 0 | 0 |
spyder/plugins/tours/api.py | Earthman100/spyder | 7,956 | 1788869 | <reponame>Earthman100/spyder<gh_stars>1000+
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Tours API."""
from spyder.api.panel import Panel
# TODO: Known issues
# How to handle if an specific dockwidget does ... | 0 | 0 | 0 | 0 | 0 | 0 |
evennia/comms/tests.py | Jaykingamez/evennia | 1,544 | 1788876 | <gh_stars>1000+
from evennia import DefaultChannel
from evennia.utils.create import create_message
from evennia.utils.test_resources import EvenniaTest
class ObjectCreationTest(EvenniaTest):
def test_channel_create(self):
description = "A place to talk about coffee."
obj, errors = DefaultChannel.... | 0 | 0 | 0 | 0 | 0 | 0 |
features/steps/api.py | revvsales/python-docx-1 | 3,031 | 1788885 | <gh_stars>1000+
# encoding: utf-8
"""
Step implementations for basic API features
"""
from behave import given, then, when
import docx
from docx import Document
from helpers import test_docx
# given ====================================================
@given('I have python-docx installed')
def given_I_have_pyth... | 0 | 0 | 0 | 0 | 0 | 0 |
nuplan/planning/training/preprocessing/features/agents_trajectories.py | motional/nuplan-devkit | 128 | 1788886 | from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Dict, List
import torch
from nuplan.planning.training.preprocessing.features.abstract_model_feature import (
AbstractModelFeature,
FeatureDataType,
to_tensor,
)
@dataclass
class AgentsTrajectories(AbstractModel... | 5 | 21 | 1 | 0 | 27 | 0 |
data_collection/gazette/spiders/sc_balneario_picarras.py | kaiocp/querido-diario | 454 | 1788932 | <filename>data_collection/gazette/spiders/sc_balneario_picarras.py
from gazette.spiders.base.fecam import FecamGazetteSpider
class ScBalnearioPicarrasSpider(FecamGazetteSpider):
name = "sc_balneario_picarras"
FECAM_QUERY = "cod_entidade:33"
TERRITORY_ID = "4212809"
| 0 | 0 | 0 | 0 | 0 | 0 |
padatious/intent_manager.py | DodoHan/mycroft-core-zh | 144 | 1788984 | # Copyright 2017 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 writ... | 0 | 1 | 0 | 0 | 1 | 0 |
bw_plex/chromecast.py | Hellowlol/bw_plex | 371 | 1788994 | <filename>bw_plex/chromecast.py
from urllib.parse import urlparse
import threading
from bw_plex import LOG
def media_to_chromecast_command(media, **kw): # pragma: no cover
"""Create the message that chromecast requires."""
# py3 only with cba ws pychromecast is 3.4
server_url = urlparse(media._server.... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/communication/azure-communication-sms/tests/_shared/utils.py | rsdoherty/azure-sdk-for-python | 2,728 | 1789036 | # ------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -------------------------------------------------------------------------
from azure.... | 0 | 1 | 0 | 0 | 1 | 0 |
Programming Languages/Python/Theory/100_Python_Exercises/Exercises/Exercise 13/13.py | jaswinder9051998/Resources | 101 | 1789037 | <reponame>jaswinder9051998/Resources
#Create a script that converts all items of the range to strings
my_range = range(1, 21)
print(map(str, my_range))
for i in map:
print(i)
| 0 | 0 | 0 | 0 | 0 | 0 |
install.py | ankitsejwal/Lyndor | 146 | 1789054 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
''' Install Lyndor software and dependencies '''
import os, sys, shutil, json, zipfile
real_path = os.path.realpath(__file__)
LYNDOR_PATH = real_path[:real_path.find('install.py')]
def check_os() -> str:
'''Check operating system'''
platform = sys.platform.... | 0 | 4 | 0 | 0 | 4 | 0 |
process_data/process_data.py | vdaytona/statistical-arbitrage-18-19 | 163 | 1789056 | <reponame>vdaytona/statistical-arbitrage-18-19
import sys
sys.path.append("../model")
sys.path.append('./model')
import os
from os.path import isfile, isdir, join, splitext
import glob
import shutil
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from collections import Counter, defaultdict
i... | 0 | 0 | 0 | 0 | 0 | 0 |
autosklearn/regression.py | Louquinze/auto-sklearn | 6,390 | 1789096 | <filename>autosklearn/regression.py
from autosklearn.estimators import AutoSklearnRegressor # noqa (imported but unused)
| 0 | 0 | 0 | 0 | 0 | 0 |
api/features/migrations/0040_add_change_request_to_feature_state.py | SolidStateGroup/Bullet-Train-API | 126 | 1789105 | # Generated by Django 3.2.12 on 2022-03-25 14:59
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('workflows_core', '0001_initial'),
('features', '0039_allow_null_version'),
]
operat... | 0 | 0 | 2 | 0 | 2 | 0 |
virtual/lib/python3.8/site-packages/django_bootstrap5/components.py | Calebu6214/Instagram-clone | 118 | 1789106 | <filename>virtual/lib/python3.8/site-packages/django_bootstrap5/components.py<gh_stars>100-1000
from django.template.defaultfilters import capfirst
from django.utils.html import format_html
from django.utils.translation import gettext as _
from .css import merge_css_classes
from .html import render_tag
from .size impo... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/Armstrong.py | OluSure/Hacktoberfest2021-1 | 215 | 1789123 | <filename>Python/Armstrong.py
i=0
result=0
n = int(input("please give a number : "))
number1 = n
temp = n
while n!=0:
n = (n//10)
i=i+1;
while number1!=0:
n=number1%10
result=result+pow(n,i)
number1=number1//10
if temp==result:
print("number is armstrong")
else:
print("number is not armstron... | 0 | 0 | 0 | 0 | 0 | 0 |
state/test/trie/test_api.py | andkononykhin/plenum | 148 | 1789140 | import pytest
from common.exceptions import PlenumTypeError, PlenumValueError
from state.db.persistent_db import PersistentDB
from state.trie.pruning_trie import Trie
from storage.kv_in_memory import KeyValueStorageInMemory
def test_set_root_hash():
trie = Trie(PersistentDB(KeyValueStorageInMemory()))
for v... | 0 | 0 | 0 | 0 | 0 | 0 |
timemachines/skaters/gk/allgreykiteskaters.py | iklasky/timemachines | 253 | 1789149 | <reponame>iklasky/timemachines
from timemachines.skaters.gk.greykitebasicskater import GREYKITE_BASIC_SKATERS
GREYKITE_SKATERS = GREYKITE_BASIC_SKATERS | 0 | 0 | 0 | 0 | 0 | 0 |
pyjswidgets/pyjamas/ui/Focus.mshtml.py | takipsizad/pyjs | 739 | 1789184 | <reponame>takipsizad/pyjs
# emulate behaviour of other browsers
def focus(elem):
# i know this looks weird, but it's to catch the exceptions
# that might happen on focus and ignore them (the names of which
# we don't know) but otherwise to create standard errors.
if elem and hasattr(elem, 'focus'):
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/medmentions/prepare_data.py | louni-g/MedCAT | 243 | 1789192 | from medcat.utils.medmentions import original2concept_csv
from medcat.utils.medmentions import original2json
from medcat.utils.medmentions import original2pure_text
_ = original2json("../../examples/medmentions/medmentions.txt", '../../examples/medmentions/tmp_medmentions.json')
_ = original2concept_csv("../../example... | 0 | 0 | 0 | 0 | 0 | 0 |
287 Find the Duplicate Number.py | ChiFire/legend_LeetCode | 872 | 1789246 | """
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one
duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one.
Note:
You must not modify the array (assume the array is read only).
You must use only consta... | 0 | 1 | 0 | 0 | 1 | 0 |
module_utils/oracle/resourcehelpers/oci_auto_scaling_configuration_helper.py | slmjy/oci-ansible-modules | 106 | 1789248 | <gh_stars>100-1000
# Copyright (c) 2019 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for detail... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/cairns_excel/user_functions.py | samcom12/anuga_core | 136 | 1789322 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Home for various 'user-defined' functions.
The user can define any new functions they need in this script, and make
small modifications to the main scripts to use it.
This is usually nicer than making detailed hacky changes to the main scripts
If you have a nice functi... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/KoubeiQualityTestShieldResultSyncModel.py | antopen/alipay-sdk-python-all | 213 | 1789334 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.CheckResultList import CheckResultList
class KoubeiQualityTestShieldResultSyncModel(object):
def __init__(self):
self._batch_no: No... | 0 | 9 | 0 | 7 | 16 | 0 |
ParlAI/parlai/zoo/convai2/kvmemnn.py | UmaTaru/run | 258 | 1789347 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""KvMemNN model for ConvAI2 (personachat data).
"""
from parlai.core.build_data import download_models
def download(d... | 0 | 0 | 0 | 0 | 0 | 0 |
bmtk/utils/reports/spike_trains/core.py | aaberbach/bmtk | 216 | 1789359 | # Copyright 2020. <NAME>. All rights reserved
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
# dis... | 0 | 2 | 4 | 0 | 6 | 0 |
tutorial-reference/Day 23/raw_input.py | LilianaArguello/30-Days-of-Python | 2,044 | 1789372 | <gh_stars>1000+
from getpass import getpass
name = input("What's your name?\n")
pw = getpass("<PASSWORD>")
print(name, pw)
| 0 | 0 | 0 | 0 | 0 | 0 |
300-400q/328.py | rampup01/Leetcode | 990 | 1789376 | from __future__ import annotations
'''
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.
You should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complex... | 0 | 1 | 0 | 0 | 1 | 0 |
server/auvsi_suas/models/access_log.py | RMMichael/interop | 175 | 1789396 | from __future__ import annotations
"""Model for an access log."""
import functools
import logging
import numpy as np
from django.conf import settings
from django.db import models
from django.utils import timezone
logger = logging.getLogger(__name__)
class AccessLogMixin(models.Model):
"""Base class which logs a... | 5 | 4 | 2 | 0 | 11 | 0 |
tests/requirements/egg-info/dephell/__init__.py | OliverHofkens/dephell | 1,880 | 1789431 | <filename>tests/requirements/egg-info/dephell/__init__.py
# app
from .controllers import * # noQA
from .converters import * # noQA
from .models import Requirement # noQA
| 0 | 0 | 0 | 0 | 0 | 0 |
reddit2telegram/channels/~inactive/idiots_in_cars/app.py | CaringCat/reddit2telegram | 187 | 1789454 | <gh_stars>100-1000
#encoding:utf-8
subreddit = 'IdiotsInCars'
t_channel = '@Idiots_In_Cars'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| 0 | 0 | 0 | 0 | 0 | 0 |
kitsune/wiki/management/commands/check_parser_diff.py | erdal-pb/kitsune | 929 | 1789541 | <filename>kitsune/wiki/management/commands/check_parser_diff.py<gh_stars>100-1000
import difflib
from django.core.management.base import BaseCommand
from kitsune.wiki.models import Document
from kitsune.wiki.parser import wiki_to_html
class Command(BaseCommand):
help = "Diffs the current wiki parsing code with t... | 0 | 0 | 0 | 0 | 0 | 0 |
src/netius/common/socks.py | timgates42/netius | 107 | 1789591 | <filename>src/netius/common/socks.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Netius System
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Netius System.
#
# Hive Netius System is free software: you can redistribute it and/or modify
# it under the terms of the Apache Licen... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/filewrapper.py | rbanffy/bjoern | 2,326 | 1789639 | <filename>tests/filewrapper.py
import sys
import os
import bjoern
W = {
'callable-iterator': lambda f, _: iter(lambda: f.read(64*1024), b''),
'xreadlines': lambda f, _: f,
'filewrapper': lambda f, env: env['wsgi.file_wrapper'](f),
'filewrapper2': lambda f, env: env['wsgi.file_wrapper'](f, 1),
'pseu... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/terraform/context_parsers/mock_context_parser.py | cclauss/checkov | 4,013 | 1789650 | <filename>tests/terraform/context_parsers/mock_context_parser.py
from checkov.terraform.context_parsers.base_parser import BaseContextParser
class MockContextParser(BaseContextParser):
def __init__(self):
definition_type = 'mock'
self.definition_type = definition_type
def enrich_definition_bl... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/ti_deps/deps/test_prev_dagrun_dep.py | npodewitz/airflow | 8,092 | 1789732 | #
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/release18/CallUVCommand.py | tdapper/cinema4d_py_sdk | 113 | 1789755 | <reponame>tdapper/cinema4d_py_sdk
# This example shows how to call BodyPaint 3D UV commands
import c4d
from c4d import utils
from c4d.modules import bodypaint
def main():
# Retrieves active UVSet
handle = bodypaint.GetActiveUVSet(doc, c4d.GETACTIVEUVSET_ALL)
if not handle:
print "No active UVSet!... | 0 | 0 | 0 | 0 | 0 | 0 |
test-data/samples/hello.py | jag426/mypy | 12,496 | 1789803 | import typing
print('Hello, world')
| 0 | 0 | 0 | 0 | 0 | 0 |
nightly/embedding/utils.py | Zrealshadow/ark-nlp | 258 | 1789810 | <reponame>Zrealshadow/ark-nlp<gh_stars>100-1000
"""
# Copyright <NAME>, 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
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/freedb/extract.py | neoremind/luceneutil | 164 | 1789821 | import tarfile
import re
import codecs
fromLatin1 = codecs.getdecoder('Latin1')
fromUTF8 = codecs.getdecoder('UTF-8')
toUTF8 = codecs.getencoder('UTF-8')
ascii = re.compile('^[ -z]+$')
def isascii(s):
return ascii.match(s) is not None
t = tarfile.open('freedb-complete-20121101.tar', encoding='UTF-8')
fOut = open('... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/mnist/inference/mxnet/mnist_cnn_inference.py | shuigj-bupt/machine-learning-using-k8s | 139 | 1789837 | # Copyright 2019 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://www.apache.org/licenses/LICENSE-2.0
# or in the "license" file... | 0 | 4 | 0 | 8 | 12 | 0 |
python/seldon/xgb.py | smsahu/seldon-server | 1,645 | 1789864 | <gh_stars>1000+
import sys
import numpy as np
import xgboost as xgb
from sklearn.datasets import load_svmlight_file
import scipy.sparse
import math
import pandas as pd
from sklearn.feature_extraction import DictVectorizer
from seldon.pipeline.pandas_pipelines import BasePandasEstimator
from collections import OrderedD... | 0 | 0 | 0 | 0 | 0 | 0 |
pysb/examples/tools/run_sensitivity_analysis_tyson.py | FFroehlich/pysb | 105 | 1789868 | <filename>pysb/examples/tools/run_sensitivity_analysis_tyson.py
import numpy as np
from pysb.simulator.scipyode import ScipyOdeSimulator
from pysb.tools.sensitivity_analysis import \
InitialsSensitivity
from pysb.examples.tyson_oscillator import model
tspan = np.linspace(0, 200, 5001)
def obj_func_cell_cycle(tr... | 0 | 0 | 0 | 0 | 0 | 0 |
support/go-NN-master/engine/TreeSearch.py | sjkim04/AlphaGOZero-python-tensorflow | 325 | 1789929 | <filename>support/go-NN-master/engine/TreeSearch.py
#!/usr/bin/python
import copy
from Engine import BaseEngine
from GTP import Move
# want policy network to influence evaluation????
# could modify score by policy probability, possibly in a depth-dependent way
def get_board_after_move(board, move):
ret = copy.dee... | 0 | 0 | 0 | 0 | 0 | 0 |
paysage/backends/read_config.py | fyumoto/RBMs | 124 | 1789960 | <reponame>fyumoto/RBMs
import json
import os
# load the configuration file with the backend specification
filedir = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(filedir,"config.json"), "r") as infile:
config = json.load(infile)
# read the processor type
PROCESSOR = config['processor']
BACKEND... | 0 | 0 | 0 | 0 | 0 | 0 |
causallib/tests/test_marginal_outcome.py | liranszlak/causallib | 350 | 1790010 | """
(C) IBM Corp, 2019, All rights reserved
Created on Aug 25, 2019
@author: <NAME>
"""
import unittest
import pandas as pd
import numpy as np
from causallib.estimation import MarginalOutcomeEstimator
class TestMarginalOutcomeEstimator(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.X = pd... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/terraform/checks/resource/gcp/test_GoogleBigQueryDatasetPublicACL.py | cclauss/checkov | 4,013 | 1790023 | <reponame>cclauss/checkov
import unittest
from checkov.terraform.checks.resource.gcp.GoogleBigQueryDatasetPublicACL import check
from checkov.common.models.enums import CheckResult
class TestBigQueryDatasetPublicACL(unittest.TestCase):
def test_failure_special_group(self):
resource_conf = {"dataset_id":... | 0 | 0 | 0 | 0 | 0 | 0 |
chapter6/mongodb/app.py | GoodMonsters/Building-Data-Science-Applications-with-FastAPI | 107 | 1790030 | <filename>chapter6/mongodb/app.py
from typing import List, Tuple
from bson import ObjectId, errors
from fastapi import Depends, FastAPI, HTTPException, Query, status
from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorDatabase
from chapter6.mongodb.models import (
PostDB,
PostCreate,
PostParti... | 0 | 0 | 0 | 0 | 0 | 0 |
Algorithms/Programs/currenttime.py | TeacherManoj0131/HacktoberFest2020-Contributions | 256 | 1790056 | import datetime
x=datetime.datetime.now()
y=x+datetime.timedelta(0,5)
print(x.time())
print(y.time())
| 0 | 0 | 0 | 0 | 0 | 0 |
vaas-app/src/vaas/purger/views.py | allegro/vaas | 251 | 1790096 | <gh_stars>100-1000
from django.contrib import messages
from django.contrib.auth.decorators import user_passes_test
from django.shortcuts import render
from django.http import HttpResponseRedirect
from vaas.cluster.cluster import ServerExtractor
from vaas.cluster.models import LogicalCluster
from .forms import PurgeFor... | 0 | 0 | 0 | 0 | 0 | 0 |
census_data_downloader/__init__.py | JoeGermuska/census-data-downloader | 170 | 1790101 | #! /usr/bin/env python
# -*- coding: utf-8 -*
# flake8: NOQA
import jinja2
import logging
import pathlib
from .tables import TABLE_LIST
logger = logging.getLogger(__name__)
def download_everything(*args, **kwargs):
"""
Download all the data.
"""
logger.debug("Downloading all datasets for all geographi... | 0 | 0 | 0 | 0 | 0 | 0 |
doubleml/tests/_utils_iivm_manual.py | SvenKlaassen/doubleml-for-py | 103 | 1790119 | <gh_stars>100-1000
import numpy as np
from sklearn.base import clone
from ._utils_boot import boot_manual, draw_weights
from ._utils import fit_predict, fit_predict_proba, tune_grid_search
def fit_iivm(y, x, d, z,
learner_g, learner_m, learner_r, all_smpls, dml_procedure, score,
n_rep=1, g0... | 0 | 0 | 0 | 0 | 0 | 0 |
thirdparty/his_evaluators/his_evaluators/evaluators/appearance_transfer.py | tj-eey/impersonator | 1,717 | 1790186 | <gh_stars>1000+
from abc import ABC
import torch
from multiprocessing import Process, Manager
from tqdm import tqdm
from typing import List, Dict, Any
import os
import glob
from his_evaluators.metrics import TYPES_QUALITIES
from .base import PairedMetricRunner, Evaluator
from ..utils.io import mkdir
from ..utils.vide... | 0 | 0 | 0 | 0 | 0 | 0 |
qf_lib/common/utils/dateutils/date_to_datetime.py | webclinic017/qf-lib | 198 | 1790233 | <reponame>webclinic017/qf-lib<filename>qf_lib/common/utils/dateutils/date_to_datetime.py<gh_stars>100-1000
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/olympia/addons/migrations/0013_auto_20200625_1139.py | shashwatsingh/addons-server | 843 | 1790257 | <filename>src/olympia/addons/migrations/0013_auto_20200625_1139.py
# Generated by Django 2.2.13 on 2020-06-25 11:39
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('addons', '0012_remove_addon_public_stats'),
]
o... | 0 | 0 | 0 | 0 | 0 | 0 |
migrations/versions/dce7a95190f6_.py | uetchy/moa | 238 | 1790260 | <reponame>uetchy/moa
"""empty message
Revision ID: dce7a95190f6
Revises: <PASSWORD>
Create Date: 2018-09-30 15:54:15.610080
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'dce7a95190f6'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_inflect.py | rajeshkumargp/TextBlob | 6,608 | 1790295 | <gh_stars>1000+
from nose.tools import assert_equals, assert_true
from unittest import TestCase
from textblob.en.inflect import (
plural_categories,
singular_ie,
singular_irregular,
singular_uncountable,
singular_uninflected,
singularize,
pluralize
)
class InflectTestCase(TestCase):
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_likelihood.py | cheginit/spotpy | 182 | 1790327 | # -*- coding: utf-8 -*-
"""
Copyright (c) 2017 by <NAME>
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: <NAME>, <NAME>
This code tests the likelihood framework and present all existing function.
"""
import numpy as np
try:
import spotpy
except ImportError:
import sys
sys.p... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/build/nasm_installer.py | lcrh/falken | 213 | 1790343 | <gh_stars>100-1000
# Copyright 2021 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 agr... | 0 | 0 | 0 | 0 | 0 | 0 |
Packs/PrismaCloud/Scripts/PrismaCloudAttribution/PrismaCloudAttribution.py | diCagri/content | 799 | 1790353 | import demistomock as demisto
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
"""PrismaCloudAttribution
"""
from typing import Dict, List, Any, Iterable, Union
import traceback
IPADDRESS_KEYS = ['publicIpAddress', 'natIP', 'publicIp', 'i... | 5 | 3 | 2 | 0 | 10 | 0 |
python/ql/src/Functions/ExplicitReturnInInit.py | vadi2/codeql | 4,036 | 1790361 | class ExplicitReturnInInit(object):
def __init__(self, i) -> object:
self.i = i
return self | 0 | 1 | 0 | 0 | 1 | 0 |
torchsso/curv/fisher/batchnorm.py | jjxu217/pytorch-sso | 121 | 1790363 | import torch
from torchsso import DiagCovBatchNorm2d, Fisher
class DiagFisherBatchNorm2d(DiagCovBatchNorm2d, Fisher):
def __init__(self, *args, **kwargs):
DiagCovBatchNorm2d.__init__(self, *args, **kwargs)
Fisher.__init__(self)
def update_in_backward(self, grad_out):
if self.do_backw... | 0 | 0 | 0 | 0 | 0 | 0 |
cape_privacy/spark/transformations/rounding_test.py | vismaya-Kalaiselvan/cape-python | 144 | 1790376 | <filename>cape_privacy/spark/transformations/rounding_test.py
import datetime
import numpy as np
import pandas as pd
from pyspark.sql import functions
from cape_privacy.spark import dtypes
from cape_privacy.spark import utils
from cape_privacy.spark.transformations import rounding as rnd
# Utils
def _make_and_apply... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/cli/__init__.py | longhuei/floyd-cli | 162 | 1790388 | <reponame>longhuei/floyd-cli<filename>tests/cli/__init__.py<gh_stars>100-1000
import traceback
import pytest
def assert_exit_code(cli_run_result, expected_code):
if expected_code != cli_run_result.exit_code:
pytest.fail(
"Got unexpected exit code: %s, expects: %s.\n\n[CLI output]\n%s\n[Trace]\... | 0 | 0 | 0 | 0 | 0 | 0 |
alembic/versions/4ad568a7a84e_liketopic.py | AngelLiang/hacking-june | 680 | 1790389 | <gh_stars>100-1000
"""LikeTopic
Revision ID: <KEY>
Revises: <KEY>
Create Date: 2013-12-12 12:35:12.253544
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<KEY>'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
'like_topic',
sa.Colu... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/python/fullscriptsupport/scripteval.py | vc2014/server-side-extension | 147 | 1790390 | <reponame>vc2014/server-side-extension
import logging
import logging.config
import ServerSideExtension_pb2 as SSE
import grpc
import numpy
from ssedata import ArgType, FunctionType, ReturnType
class ScriptEval:
"""
Class for SSE plugin ScriptEval functionality.
"""
def EvaluateScript(self, header, r... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/fontbakery/commands/build_contributors.py | thundernixon/fontbakery | 351 | 1790414 | <reponame>thundernixon/fontbakery
import argparse
import codecs
import os
import re
import sys
import git
CONTRIBUTORS_HEAD = (
'''# This is the list of people who have contributed to this project,
# and includes those not listed in AUTHORS.txt because they are not
# copyright authors. For example, company employ... | 0 | 0 | 0 | 0 | 0 | 0 |
theseus/core/cost_weight.py | facebookresearch/theseus | 236 | 1790425 | <reponame>facebookresearch/theseus
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import abc
import warnings
from typing import List, Optional, Sequence, Tuple, Union, cast
import torch
... | 0 | 0 | 0 | 0 | 0 | 0 |
moto/cloudfront/__init__.py | gtourkas/moto | 5,460 | 1790432 | from .models import cloudfront_backend
from ..core.models import base_decorator
cloudfront_backends = {"global": cloudfront_backend}
mock_cloudfront = base_decorator(cloudfront_backends)
| 0 | 0 | 0 | 0 | 0 | 0 |
avg.py | undeadinu/deep-fonts | 775 | 1790442 | <reponame>undeadinu/deep-fonts
import numpy
import model
avg = numpy.mean(model.get_data()[:], axis=0)
model.draw_grid(avg / 255.).save('avg.png')
| 0 | 0 | 0 | 0 | 0 | 0 |
tools/convert/convert.py | BrickSchema/brick | 146 | 1790443 | <gh_stars>100-1000
import sys
from argparse import ArgumentParser
from logging import getLogger
from os.path import dirname
from rdflib import Graph, Namespace
from utils import (
find_conversions,
execute_conversions,
standardize_namespaces,
get_output_filename,
)
"""
Argument Parsing:
source: source... | 0 | 0 | 0 | 0 | 0 | 0 |
real_robots/utils.py | anonymous-authors-2018/robotics-repo | 524 | 1790447 | from __future__ import print_function, absolute_import, division
import sys
import zmq
import numpy as np
if sys.version_info > (3,):
buffer = memoryview
def recvMatrix(socket) -> object:
"""
Receive a numpy array over zmq
:param socket: (zmq socket)
:return: (Numpy matrix)
"""
metadata... | 0 | 4 | 0 | 0 | 4 | 0 |
tools/exodus2hashcat.py | fengjixuchui/hashcat | 13,663 | 1790453 | #!/usr/bin/env python
# Author......: See docs/credits.txt
# License.....: MIT
# Target......: Exodus wallet extractor
# Example.....: exodus2hashcat.py <path to exodus seed seco file>
import binascii
import sys
import hashlib
from Crypto.Cipher import AES
import base64
import os.path
METADATA_LEN = 256
HEADER_LEN =... | 0 | 0 | 0 | 0 | 0 | 0 |
vilya/views/api/repos/commits.py | mubashshirjamal/code | 1,582 | 1790465 | # -*- coding: utf-8 -*-
from __future__ import annotations
from vilya.libs import api_errors
from vilya.views.api.utils import RestAPIUI
from vilya.views.api.repos.extra_status import ExtraStatusUI
class CommitsUI(RestAPIUI):
_q_exports: list[object] = []
_q_methods: list[str] = ['get']
def __init__(sel... | 0 | 4 | 4 | 0 | 8 | 0 |
setup.py | stormymcstorm/condensa | 153 | 1790481 | <filename>setup.py
# Copyright 2019 NVIDIA 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... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/python/src/ledger.py | absltkaos/indy-sdk | 636 | 1790503 | <gh_stars>100-1000
import json
import time
from indy import ledger, did, wallet, pool
from src.utils import get_pool_genesis_txn_path, run_coroutine, PROTOCOL_VERSION
import logging
logger = logging.getLogger(__name__)
async def demo():
logger.info("Ledger sample -> started")
# Set protocol version 2 to wo... | 0 | 0 | 0 | 0 | 0 | 0 |
mask2former/test_time_augmentation.py | Niklas-AD/Mask2Former | 143 | 1790517 | # Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import annotations
import copy
import logging
from itertools import count
import numpy as np
import torch
from fvcore.transforms import HFlipTransform
from torch import nn
from torch.nn.parallel import DistributedDataParallel
from detectron2.data.dete... | 2 | 4 | 0 | 0 | 6 | 0 |
instant/tests/test_producers.py | synw/django-instant | 103 | 1790527 | from cent import CentException
from .base import InstantBaseTest
from instant.producers import publish
class InstantTestProducers(InstantBaseTest):
def test_publish(self):
with self.assertRaises(ValueError):
publish("chan")
with self.assertRaises(CentException):
publish("... | 0 | 0 | 0 | 0 | 0 | 0 |
osr2mp4/ImageProcess/PrepareFrames/Scores/ScoreCounter.py | siveroo/osr2mp4-core | 103 | 1790550 | <reponame>siveroo/osr2mp4-core
from osr2mp4.ImageProcess import imageproc
def prepare_scorecounter(scorenumber):
"""
:param scorenumber: ScoreNumber
:return: [PIL.Image]
"""
img = []
for image in scorenumber.score_images:
imgscore = imageproc.change_size(image.img, 0.87, 0.87)
img.append(imgscore)
return i... | 0 | 0 | 0 | 0 | 0 | 0 |
gryphon/dashboards/handlers/fees.py | qiquanzhijia/gryphon | 1,109 | 1790558 | import logging
import tornado.web
from gryphon.dashboards.handlers.admin_base import AdminBaseHandler
from gryphon.dashboards.handlers.mixins.start_and_end_time import StartAndEndTimeMixin
from gryphon.lib.gryphonfury import fees
logger = logging.getLogger(__name__)
class FeesDashboardHandler(AdminBaseHandler, Sta... | 0 | 0 | 0 | 0 | 0 | 0 |
styleframe/tests/series_tests.py | Jacaranda-Health/StyleFrame | 308 | 1790591 | <gh_stars>100-1000
import unittest
import pandas as pd
from pandas.testing import assert_frame_equal
from styleframe import StyleFrame, Styler, Container, Series, utils
class SeriesTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.pandas_series = pd.Series((None, 1))
cls.sf_seri... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/KmeanLibVersion.py | nifex007/Numerical-Analysis-Examples | 389 | 1790611 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 6 20:12:30 2018
@author: <NAME>
K-mean from sklearn.cluster import KMeans version
Input:
example dataset by make_blobs of four clusters
Output:
kmeans: fitted kmean model with cluter = 4
y_kmeans: kmean prediection
"""
import matplotlib.pyplot as plt
... | 0 | 0 | 0 | 0 | 0 | 0 |
autograder/tests/__init__.py | elihschiff/Submitty | 411 | 1790620 | <gh_stars>100-1000
"""Test module for Submitty autograder."""
| 0 | 0 | 0 | 0 | 0 | 0 |
pymaging/colors.py | zckevin/webtorrent-stellarplayer-plugin | 319 | 1790638 | # -*- coding: utf-8 -*-
# Copyright (c) 2012, <NAME>
# 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 ... | 1 | 11 | 1 | 0 | 13 | 0 |
pycket/hash/equal.py | namin/pycket | 129 | 1790648 | <gh_stars>100-1000
from pycket import config
from pycket import values, values_string
from pycket.base import SingletonMeta, UnhashableType
from pycket.hash.base import W_HashTable, get_dict_item, next_valid_index, w_missing
from pycket.error import ... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/blink/renderer/build/scripts/run_with_pythonpath.py | zealoussnow/chromium | 14,668 | 1790716 | #!/usr/bin/env python
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
# python run_with_pythonpath.py -I path1 ... -I pathN foo/bar/baz.py args...
# ==> Run "pyth... | 0 | 0 | 0 | 0 | 0 | 0 |
caffe-grid/src/main/python/com/yahoo/ml/caffe/CaffeOnSpark.py | gridgentoo/CaffeOnSpark | 1,436 | 1790748 | <reponame>gridgentoo/CaffeOnSpark
'''
Copyright 2016 Yahoo Inc.
Licensed under the terms of the Apache 2.0 license.
Please see LICENSE file in the project root for terms.
'''
from ConversionUtil import wrapClass
from RegisterContext import registerContext
from pyspark.sql import DataFrame,SQLContext
class CaffeOnSpar... | 0 | 0 | 0 | 0 | 0 | 0 |
datapackage/helpers.py | chris48s/datapackage-py | 183 | 1790751 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import os
import re
import six
import json
import requests
import jsonpointer
from . import config
from . import exce... | 0 | 0 | 0 | 0 | 0 | 0 |
dvol_python/dockercontainers.py | ClusterHQ/dvol | 276 | 1790777 | from __future__ import annotations
import docker
from twisted.python import log
RETRIES = 5
class NeverLocked(Exception):
pass
class AlreadyLocked(Exception):
pass
class Containers(object):
"""
Operations on the set of containers which pertain to dvol. Also maintain
state on which containers we... | 0 | 4 | 0 | 1 | 5 | 0 |
examples/image/cath/datasets/cath/cath.py | mariogeiger/se3cnn | 170 | 1790828 | <reponame>mariogeiger/se3cnn
# pylint: disable=C,R,E1101
import torch
import os
import numpy as np
from scipy.stats import special_ortho_group
class Cath(torch.utils.data.Dataset):
url = 'https://github.com/deepfold/cath_datasets/blob/master/{}?raw=true'
def __init__(self, dataset, split, download=False,
... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/perf/page_sets/rendering_mobile.py | zipated/src | 2,151 | 1790842 | # Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import shared_page_state
from telemetry import story
from page_sets import key_mobile_sites_smooth
from page_sets import top_25_smooth
... | 1 | 0 | 0 | 0 | 1 | 0 |
historian/cli/backup.py | bit0fun/plugins | 173 | 1790847 | <reponame>bit0fun/plugins<gh_stars>100-1000
import click
from .common import db_session, split_gossip
import os
from pyln.proto.primitives import varint_decode, varint_encode
@click.group()
def backup():
pass
@backup.command()
@click.argument('destination', type=click.File('wb'))
@click.option('--db', type=str,... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/deco_provide_arg.py | scholer/clize | 390 | 1790850 | from __future__ import annotations
from sigtools.wrappers import decorator
from clize import run
def get_branch_object(repository, branch_name) -> tuple[object, object]:
return repository, branch_name
@decorator
def with_branch(wrapped, *args, repository: str='.', branch: str='master', **kwargs) -> object:
... | 5 | 5 | 0 | 0 | 10 | 0 |
Download_Raw_EEG_Data/MIND_Get_EDF.py | XiaoZheng-YY/EEG-DL | 389 | 1790856 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
def download_file(url, index) -> object:
local_filename = url.split('/')[-1]
# NOTE the stream=True parameter
r = requests.get(url, stream=True)
with open(local_filename, 'wb') as f:
for chunk in r.iter_content(c... | 0 | 1 | 0 | 0 | 1 | 0 |
pygsp/tests/test_utils.py | jafluri/pygsp | 341 | 1790860 | # -*- coding: utf-8 -*-
"""
Test suite for the utils module of the pygsp package.
"""
import unittest
import numpy as np
from scipy import sparse
from pygsp import graphs, utils
class TestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls)... | 0 | 0 | 0 | 0 | 0 | 0 |
micropython/examples/breakout_bmp280/demo_bmp280.py | sstobbe/pimoroni-pico | 425 | 1790874 | <gh_stars>100-1000
import time
from breakout_bmp280 import BreakoutBMP280
from pimoroni_i2c import PimoroniI2C
PINS_BREAKOUT_GARDEN = {"sda": 4, "scl": 5}
PINS_PICO_EXPLORER = {"sda": 20, "scl": 21}
i2c = PimoroniI2C(**PINS_BREAKOUT_GARDEN)
bmp = BreakoutBMP280(i2c)
while True:
reading = bmp.read()
print(rea... | 0 | 0 | 0 | 0 | 0 | 0 |
configs/_base_/schedules/sgd_150e_warmup.py | Naoki-Wake/mmaction2 | 1,870 | 1790880 | # optimizer
optimizer = dict(
type='SGD', lr=0.01, momentum=0.9,
weight_decay=0.0001) # this lr is used for 8 gpus
optimizer_config = dict(grad_clip=dict(max_norm=40, norm_type=2))
# learning policy
lr_config = dict(
policy='step',
step=[90, 130],
warmup='linear',
warmup_by_epoch=True,
warm... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.