max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
models/multi_emnist.py | OpenXAIProject/dac | 17 | 12769451 | <filename>models/multi_emnist.py
import os
import argparse
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision.utils import make_grid
from torch.nn.utils import weight_norm
from utils.misc import add_args
from utils.paths imp... | 1.953125 | 2 |
app/file_helpers.py | lokalise-document-preview/docx-to-pdf | 0 | 12769452 | from io import BytesIO
from zipfile import ZipFile
import urllib.request
ALLOWED_EXTENSIONS = set(['docx'])
def is_file_allowed(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
def unzip_into_bytes(url):
zip = urllib.request.urlopen(url)
archive = Z... | 3.359375 | 3 |
pysot/models/non_local/__init__.py | eldercrow/tracking-pytorch | 0 | 12769453 | # Copyright (c) SenseTime. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
import torch.nn as nn
import torch.nn.functional as F
from pysot.models.non_local.non_local import APNB, Mu... | 1.710938 | 2 |
ETL/north_south_etl.py | Jonas2019/car-accident-analysis | 0 | 12769454 | import pyspark
from pyspark.sql import SparkSession
from pyspark.sql.types import *
from pyspark.sql.functions import *
import os
# Configure spark session
# ?readPreference=primaryPreferred
spark = SparkSession\
.builder\
.master('local[2]')\
.appName('accidents_etl')\
.config("spark.mongodb.input.uri... | 2.5 | 2 |
tensorflow/python/ops/ragged/ragged_split_op_test.py | TheRakeshPurohit/tensorflow | 7 | 12769455 | <reponame>TheRakeshPurohit/tensorflow
# Copyright 2021 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/LICE... | 2 | 2 |
lims/codonusage/serializers.py | sqilz/LIMS-Backend | 12 | 12769456 | from rest_framework import serializers
from .models import CodonUsageTable, CodonUsage
class CodonUsageTableSerializer(serializers.ModelSerializer):
species = serializers.SlugRelatedField(read_only=True, slug_field='name')
class Meta:
model = CodonUsageTable
fields = '__all__'
class CodonU... | 2.125 | 2 |
0110.balanced_binary_tree/solution.py | WZMJ/Algorithms | 5 | 12769457 | from utils import TreeNode
class Solution:
def is_balance(self, root: TreeNode):
if not root:
return True
left = self.depth(root.left)
right = self.depth(root.right)
return abs(left - right) <= 1 and self.is_balance(root.left) and self.is_balance(root.right)
def de... | 3.65625 | 4 |
DSAE_PBHL/Model.py | RyoOzaki/SparseAutoencoder | 1 | 12769458 | <filename>DSAE_PBHL/Model.py
from abc import ABCMeta
class Model(metaclass=ABCMeta):
pass
class PB_Model(Model, metaclass=ABCMeta):
pass
| 1.875 | 2 |
web/__init__.py | DJBnjack/docker-server | 0 | 12769459 | <reponame>DJBnjack/docker-server
__author__ = 'Johannes'
| 1.023438 | 1 |
packages/grid/backend/alembic/versions/2022-03-31_f712122fe780.py | jackbandy/PySyft | 0 | 12769460 | """add a boolean flag for proxy dataset in ObjectMetadata
Revision ID: f712122fe780
Revises: <PASSWORD>
Create Date: 2022-03-31 07:20:49.411961
"""
# third party
from alembic import op # type: ignore
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f712122fe780"
down_revision = "70fcad0b... | 0.867188 | 1 |
cpdb/data_importer/tests/management/test_crawl_copa_data.py | invinst/CPDBv2_backend | 25 | 12769461 | from django.test import TestCase
from django.core.management import call_command
from mock import patch
from robber import expect
from data.factories import AttachmentFileFactory
from data.constants import AttachmentSourceType
class CrawlCopaPortalDataTestCase(TestCase):
@patch('data_importer.copa_crawler.impor... | 2.109375 | 2 |
_django/migrations/0001_initial.py | zzzeek/imdbench | 50 | 12769462 | # Generated by Django 2.1 on 2018-09-21 16:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Cast',
fields=[
... | 1.875 | 2 |
src/patcher.py | MustangYM/xia0LLDB | 464 | 12769463 | <filename>src/patcher.py
#! /usr/bin/env python3
# ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______
# |______|______|______|______|______|______|______|______|______|______|______|______|______|______|______|______|______|
# _ _... | 1.710938 | 2 |
python/set_pin.py | swimmadude66/RestEasy | 1 | 12769464 | <filename>python/set_pin.py
import os
import sys
import json
from Pin import pin, pin_power
def set_pin_info(pin_obj):
pin_id = pin_obj['ID']
if not (os.path.isdir('/sys/class/gpio/gpio'+str(pin_id))):
print('{\n\tsuccess: false, \n\tmessage: "pin ' + pin_id +' does not exist"\n}')
exit(-1)
... | 2.875 | 3 |
neutron_taas/services/taas/agents/extensions/taas.py | deepak-dt/tap-as-a-service | 68 | 12769465 | <gh_stars>10-100
# Copyright 2017 FUJITSU LABORATORIES LTD.
# Copyright 2016 NEC Technologies India Pvt. Ltd.
#
# 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/licen... | 1.828125 | 2 |
cyclicmapper.py | jcwoods/CyclicMapper | 0 | 12769466 | #!/usr/bin/python
import sys
import math
# this class is intended to map a linear set of values into (x,y) coordinates
# translated onto the circumference of a circle.
#
# In particular, this is useful for mapping data which is cyclic in nature.
#
# Consider the geometry of building vectors for k-means clustering. S... | 3.78125 | 4 |
gae/handlers/__init__.py | ibagrak/algae | 3 | 12769467 | import os
import jinja2
from webapp2_extras import i18n
jinja_environment = jinja2.Environment(loader=jinja2.FileSystemLoader('static/templates'),extensions=['jinja2.ext.i18n'])
jinja_environment.install_gettext_callables(
i18n.gettext,
i18n.ngettext,
newstyle=True)
jinja_environment.filters.update({
'format_d... | 2.359375 | 2 |
doc/source/EXAMPLES/mu_toworld4.py | kapteyn-astro/kapteyn | 3 | 12769468 | <reponame>kapteyn-astro/kapteyn
from kapteyn import maputils
f = maputils.FITSimage("ngc6946.fits")
# Get an XV slice at DEC=51
#f.set_imageaxes(1, 3, slicepos=51)
annim = f.Annotatedimage()
x = [10, 50, 300, 399]
y = [1, 44, 88, 401]
# Convert these to world coordinates
lon, velo = annim.toworld(x, y)
print("lon, v... | 2.78125 | 3 |
snippet/example/python/template.py | yp2800/snippet | 94 | 12769469 | <filename>snippet/example/python/template.py
#!/usr/bin/env python3
# -*- coding: utf8 -*-
#
# Support Python 3+
#
# Install:
# $ pip3 install gevent requests sqlalchemy pymysql
#
# Run:
# $ python template.py -h
#
import gevent.pool
import gevent.monkey
gevent.monkey.patch_all(Event=True, sys=True)
taskpool = gevent.... | 2.171875 | 2 |
SimCompanies/kind_ids.py | Gunak/SimCompaniesCLI | 4 | 12769470 | <filename>SimCompanies/kind_ids.py
KIND_IDS = {
} | 1.101563 | 1 |
API_Hardware/migrations/0001_initial.py | MTC-Hack/API_Mobile | 0 | 12769471 | <filename>API_Hardware/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-29 04:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [... | 1.585938 | 2 |
tensorflow_1_x/7_kaggle/learntools/pandas/grouping_and_sorting.py | amitbcp/machine_learning_with_Scikit_Learn_and_TensorFlow | 11 | 12769472 | <filename>tensorflow_1_x/7_kaggle/learntools/pandas/grouping_and_sorting.py
import pandas as pd
from learntools.core import *
reviews = pd.read_csv("../input/wine-reviews/winemag-data-130k-v2.csv", index_col=0)
class ReviewsWritten(EqualityCheckProblem):
_var = 'reviews_written'
_expected = reviews.groupby('... | 3.21875 | 3 |
tests/compas/datastructures/test_halfedge.py | duchaoyu/compas | 0 | 12769473 | <reponame>duchaoyu/compas<filename>tests/compas/datastructures/test_halfedge.py
import pytest
import compas
from compas.datastructures import HalfEdge
# ==============================================================================
# Fixtures
# ========================================================================... | 2.1875 | 2 |
ipydatawidgets/ndarray/widgets.py | consideRatio/ipydatawidgets | 29 | 12769474 | <reponame>consideRatio/ipydatawidgets
#!/usr/bin/env python
# coding: utf-8
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
"""
Data widgets for numpy arrays.
"""
from contextlib import contextmanager
from ipywidgets import register
from traitlets import Unicode,... | 2.421875 | 2 |
src/python/ag1k/phase1_ar3.py | wtsi-team112/agam-report-base | 0 | 12769475 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import os
import pyfasta
import allel
import seaborn as sns
import petl as etl
import h5py
import pandas
title = 'Phase 1 AR3 release'
pop_ids = 'AOM', 'BFM', 'GWA', 'GNS', 'BFS', 'CMS', 'GAS', 'UGS', 'KES'
pop_labels = {
... | 1.890625 | 2 |
np/reference/ch6code/determinant.py | focusunsink/study_python | 0 | 12769476 | import numpy as np
A = np.mat("3 4;5 6")
print "A\n", A
print "Determinant", np.linalg.det(A)
| 3.015625 | 3 |
core/views.py | techacademypython/hackaton_amada | 0 | 12769477 | <gh_stars>0
from django.shortcuts import render
# Create your views here.
from .models import *
from django.http import JsonResponse
def cordinates(request):
my_model = Device.objects.filter(id=1).last()
temp = my_model.get_cordinates()
temp = temp.split(",")
newtemp = []
for i in temp :
... | 2.359375 | 2 |
python/22.py | kylekanos/project-euler-1 | 0 | 12769478 | <gh_stars>0
#!/usr/bin/env python
# ad hoc, just do what it says to do
names = sorted([name.strip('"') for name in raw_input().split(',')])
print sum((i+1)*sum(ord(c)-ord('A')+1 for c in names[i]) for i in xrange(len(names)))
| 3.21875 | 3 |
idm_lp/database/chat_enter.py | lper1/dgm-. | 47 | 12769479 | from typing import Optional
from pydantic import BaseModel
class ChatEnterModel(BaseModel):
peer_id: int
hello_text: Optional[str]
| 2.4375 | 2 |
tests/tabnet/test_utils.py | clemens33/thesis | 0 | 12769480 | <filename>tests/tabnet/test_utils.py
import pytest
import torch
class TestGhostBatchNorm1d():
@pytest.mark.parametrize("batch_size, input_size, momentum, virtual_batch_size",
[
(128, 32, 0.1, 4),
(1024, 512, 0.01, 128)... | 2.328125 | 2 |
tests/post/steps/test_salt_api.py | CPT-Jack-A-Castle/metalk8s | 1 | 12769481 | import ast
import base64
import json
import requests
import pytest
from pytest_bdd import parsers, scenario, then, when
def _negation(value):
"""Parse an optional negation after a verb (in a Gherkin feature spec)."""
if value == "":
return False
elif value in [" not", "not"]:
return True... | 2.546875 | 3 |
roles/systemd_monitor/templates/scripts/monitor.py | ekaparulin/systemd-monitor | 1 | 12769482 | <gh_stars>1-10
#!/usr/bin/python3
from pydbus import SystemBus
from gi.repository import GLib
import yaml
import sys
import os
import urllib.request
import urllib.error
import json
import time
import platform
class OpsGenieApi:
def __init__(self):
self.genie_key = os.environ.get('OPSGENIE_APIKEY')
... | 2.34375 | 2 |
ClassificationAndRegression/EnsembleMethods/BaggingClassifier.py | kopok2/machine-learning-algorithms | 0 | 12769483 | # coding=utf-8
"""Comparison of various classifiers acting alone and inside an bagging ensemble."""
from sklearn import datasets, model_selection, metrics, tree, ensemble
if __name__ == "__main__":
print("Loading data...")
X, y = datasets.load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = model... | 2.75 | 3 |
lv3/2xn.py | 5joon2/algorithm_programmers | 0 | 12769484 | import sys
sys.setrecursionlimit(60000)
def solution(n):
# must recursive dp
# dp = [-1 for i in range(60001)]
# dp[1] = 1
# dp[2] = 2
# for i in range(3, (n+1)):
# dp[i] = dp[i-1] + dp[i-2]
# return dp[n] % 1000000007
dp = [-1 for i in range(60001)]
dp[1] = 1
dp[2] = 2
... | 2.625 | 3 |
utils/label_collection.py | SteveXWu/face_attribute_label_tool | 0 | 12769485 | from PySide2 import QtWidgets, QtCore
class LabelCollector(object):
def __init__(self, ui):
self.ui = ui
self.label_buttons = {}
self.occluded_buttons = {}
self.names = {}
for name, value in vars(self.ui).items():
if isinstance(value, QtWidgets.QButtonGroup):
... | 2.75 | 3 |
source/main.py | wanghongsilver/34465A_dfh5_parsing | 1 | 12769486 | <reponame>wanghongsilver/34465A_dfh5_parsing
#-*- coding: utf-8 -*-
import h5py
def getDataFromH5py(fileName,target,start,length):
h5f = h5py.File(fileName, 'r')
list(h5f.keys())
print(l)
if not h5f.__contains__(target):
res = []
elif(start+length>=h5f[target].shape[0]):
res = h5f[... | 2.828125 | 3 |
tests/ingestion/transformers/monosi/test_monitors.py | monosidev/monosi | 156 | 12769487 | <gh_stars>100-1000
import pytest
import ingestion.transformers.monosi.monitors as monitors
@pytest.fixture
def schema():
return {
'columns': ['NAME', 'COL_NAME', 'COL_TYPE', 'COL_DESCRIPTION', 'COL_SORT_ORDER', 'DATABASE', 'SCHEMA', 'DESCRIPTION', 'IS_VIEW'],
'rows': [
{
... | 2.125 | 2 |
TensorFlow/_BasicsReference/ref_tensors.py | superjamesmccafferty/DeepLearning-PersonalExamples | 0 | 12769488 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def write_event_file():
writer = tf.summary.FileWriter('.')
writer.add_graph(tf.get_default_graph())
print("Event Written")
def execute():
"""
Tensor programs... | 3.640625 | 4 |
ocimatic/solutions.py | OCIoficial/ocimatic | 0 | 12769489 | <gh_stars>0
from pathlib import Path
from typing import Iterable, List, Optional, Tuple
from ocimatic import ui
from ocimatic.checkers import Checker
from ocimatic.dataset import Dataset
from ocimatic.source_code import CppSource, JavaSource, SourceCode
class Solution:
"""Abstract class to represent a solution
... | 2.3125 | 2 |
openvpp-agents/tests/test_mosaik.py | mtroeschel/isaac | 8 | 12769490 | <filename>openvpp-agents/tests/test_mosaik.py
from asyncio import coroutine
import json
import lzma
import arrow
import dateutil.tz
import pytest
from openvpp_agents import mosaik
from openvpp_agents import util
demand_meta = {
'start_time': '2009-12-31T23:00:00+00:00',
'interval_minutes': 60,
'cols': [... | 2.203125 | 2 |
Old/Python-Advanced-Preliminary-Homeworks/Multidimensional Lists/07E. Bombs.py | MNikov/Python-Advanced-September-2020 | 4 | 12769491 | def create_matrix(size):
matrix = []
for _ in range(size):
matrix.append([int(x) for x in input().split()])
return matrix
def is_valid_cell(position, size):
row = position[0]
col = position[1]
return 0 <= row < size and 0 <= col < size
def print_matrix(matrix):
for row in matrix:... | 3.46875 | 3 |
decoy/pytest_plugin.py | mcous/decoy | 8 | 12769492 | """Pytest plugin to setup and teardown a Decoy instance.
The plugin will be registered with pytest when you install Decoy. It adds a
fixture without modifying any other pytest behavior. Its usage is optional
but highly recommended.
"""
import pytest
from typing import Iterable
from decoy import Decoy
@pytest.fixture... | 2.546875 | 3 |
algorithm/k-community_detection/graph_kClusterAlgorithm_functions.py | lanl/Quantum_Graph_Algorithms | 1 | 12769493 | #!/usr/bin/env python
import matplotlib.pyplot as plt
import re, os, sys
from dwave_qbsolv import QBSolv
from dwave.system.samplers import DWaveSampler, DWaveCliqueSampler
from dwave.system.composites import EmbeddingComposite, FixedEmbeddingComposite
import dimod
import hybrid
import minorminer
import networkx as n... | 2.15625 | 2 |
sep/loaders/__init__.py | Fafa87/SEP | 0 | 12769494 | <reponame>Fafa87/SEP<gh_stars>0
from .files import FilesLoader
from .images import ImagesLoader
from .loader import Loader
from .movies import MoviesLoader, FrameByGroupSelector, FrameByIntervalSelector
from .youtube import YoutubeLoader
| 1.265625 | 1 |
mesen-s/labels-readme.py | adam-larson-lee/demons-crest | 0 | 12769495 | import os
LABELS_FILE_NAME = 'labels.msl'
README_FILE_NAME = 'README.md'
if os.path.exists(README_FILE_NAME):
os.remove(README_FILE_NAME)
labelsFile = open(LABELS_FILE_NAME, 'r')
readmeFile = open(README_FILE_NAME, 'a+')
readmeFile.write('# WORK\n')
readmeFile.write('\n')
readmeFile.write('|Address|Label|Comment|... | 2.515625 | 3 |
merlin/config/results_backend.py | ben-bay/merlin | 0 | 12769496 | <gh_stars>0
###############################################################################
# Copyright (c) 2019, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory
# Written by the Merlin dev team, listed in the CONTRIBUTORS file.
# <<EMAIL>>
#
# LLNL-CODE-797170
# All ... | 1.328125 | 1 |
app/__init__.py | landportal/landbook-data-access-api | 0 | 12769497 | # -*- coding: utf-8 -*-
# landportal-data-access-api
# Copyright (c)2014, WESO, Web Semantics Oviedo.
# Written by <NAME>.
# This file is part of landportal-data-access-api.
#
# landportal-data-access-api is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as... | 1.242188 | 1 |
dotnet/private/rules/libraryset.bzl | wbiker/rules_dotnet | 0 | 12769498 | <gh_stars>0
load(
"@io_bazel_rules_dotnet//dotnet/private:context.bzl",
"dotnet_context",
)
load(
"@io_bazel_rules_dotnet//dotnet/private:providers.bzl",
"DotnetLibrary",
)
load("@io_bazel_rules_dotnet//dotnet/private:rules/common.bzl", "collect_transitive_info")
def _libraryset_impl(ctx):
"""_libr... | 1.5625 | 2 |
label_smooth.py | chizhu/pytorch-loss | 1 | 12769499 | #!/usr/bin/python
# -*- encoding: utf-8 -*-
import torch
import torch.nn as nn
class LabelSmoothSoftmaxCEV1(nn.Module):
'''
This is the autograd version, you can also try the LabelSmoothSoftmaxCEV2 that uses derived gradients
'''
def __init__(self, lb_smooth=0.1, reduction='mean', ignore_index=-10... | 2.71875 | 3 |
src/python/pants/bsp/goal.py | danxmoran/pants | 0 | 12769500 | # Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import json
import logging
import os
import shlex
import sys
import textwrap
from typing import Mapping
from pants.base.build_root import BuildRoot
from... | 2.015625 | 2 |
datasets/youtube_caption_corrections/youtube_caption_corrections.py | BobbyManion/datasets | 1 | 12769501 | # coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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... | 2.390625 | 2 |
mx.wasm/mx_wasm_benchmark.py | Gwandalff/SelfAdaptableWASM | 0 | 12769502 | <filename>mx.wasm/mx_wasm_benchmark.py
#
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# The Universal Permissive License (UPL), Version 1.0
#
# Subject to the condition set forth below, permission is hereby granted to any
# pe... | 1.445313 | 1 |
web/api/auth/views.py | FrankyTerra/broadcast | 0 | 12769503 | <reponame>FrankyTerra/broadcast
from api.auth.mixins import GetRequestUserAsObjectMixin
from api.auth.serializers import ProfileRetrieveSerializer
from core.api.views import CustomRetrieveAPIView
from user.models import User
class UserProfileRetrieveView(GetRequestUserAsObjectMixin, CustomRetrieveAPIView):
"""
... | 1.835938 | 2 |
global_custom/custom/python/delivery_note.py | VPS-Consultancy/global_custom | 0 | 12769504 | from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
import frappe
from frappe import _
@frappe.whitelist()
def uom_list(item):
uom_list=frappe.db.get_list('UOM Conversion Detail',{"parent":item},'uom')
new_uoms = []
for uom in uom_list:
new_uoms.append(uom['uom'])
r... | 2.03125 | 2 |
src/schemas/WordSchema.py | jodiefostersarmy/T4A2 | 0 | 12769505 | from main import ma
from models.Word import Word
from marshmallow.validate import Length
class WordSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Word
word = ma.String(required=True, validate=Length(min=3))
definition = ma.String(required=True, validate=Length(min=5))
pronunciation = ma... | 2.578125 | 3 |
src/config.py | gustavodsf/dokcer-py-gmail | 1 | 12769506 | import json
import logging
class Config(object):
def __init__(self):
self.logger = logging.getLogger('CONFIG')
def read(self):
with open("config.json") as file:
data = json.load(file)
file.close()
self.logger.info("Success on reading configuration file.")
r... | 3.109375 | 3 |
src/sql_alchemy/01_start_vc5_data_auto_service/restful_auto_service/data/car.py | turing4ever/restful-services-in-pyramid | 58 | 12769507 | from dateutil.parser import parse
class Car:
def __init__(self, brand, name, price, year, damage, last_seen, image, id=None):
self.image = image
self.last_seen = parse(last_seen)
self.damage = damage
self.year = year
self.price = price
self.name = name
self.b... | 3.0625 | 3 |
Computer_science/B05_Python/01_Basics/S01_Basic_syntax.py | Polirecyliente/SGConocimiento | 0 | 12769508 |
# Basic syntax
#T# Table of contents
#C# Blocks of code
#C# Variables, constants, literals
#C# - Type hints
#C# Escape sequences and escaped chars
#C# Expressions
#C# Function calls
#C# Statements
#C# Multiline statements
#C# Multistatement lines
#C# Metadata
#T# Beginning of content
# |-------------------------... | 3.390625 | 3 |
TweakApi/apis/data_source_rest_api.py | tweak-com-public/tweak-api-client-python | 0 | 12769509 | <reponame>tweak-com-public/tweak-api-client-python
# coding: utf-8
"""
tweak-api
Tweak API to integrate with all the Tweak services. You can find out more about Tweak at <a href='https://www.tweak.com'>https://www.tweak.com</a>, #tweak.
OpenAPI spec version: 1.0.8-beta.0
Generated by: http... | 1.429688 | 1 |
machete/machete/spiders/versioninspector.py | jsvanilla/machete | 0 | 12769510 | import scrapy
import re
from scrapy.loader import ItemLoader
from machete.items import VersionItem
class versionSpider(scrapy.Spider):
name = 'versioninspector'
custom_settings = {
'USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/71.0.3578.80 Chrome/... | 2.5 | 2 |
thermosteam/_stream.py | yoelcortes/thermodynamics | 0 | 12769511 | # -*- coding: utf-8 -*-
# BioSTEAM: The Biorefinery Simulation and Techno-Economic Analysis Modules
# Copyright (C) 2020-2021, <NAME> <<EMAIL>>
#
# This module is under the UIUC open-source license. See
# github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/LICENSE.txt
# for license details.
"""
"""
import numpy ... | 2.15625 | 2 |
lombscargle/utils.py | jakevdp/nfftls | 2 | 12769512 | <filename>lombscargle/utils.py
from __future__ import division
import numpy as np
from pynfft.nfft import NFFT
def complex_exponential_sum(t, y, f0, Nf, df, method='auto'):
"""Compute a trigonometric sum over frequencies f = f0 + df * range(Nf)
The computed sum is S_m = sum_k [y_k * exp(2 * i * f_m * t_k)]
... | 2.8125 | 3 |
mushroom_rl/environments/mujoco_envs/humanoid_gait/humanoid_gait.py | PuzeLiu/mushroom-rl | 344 | 12769513 | import mujoco_py
from pathlib import Path
from mushroom_rl.utils import spaces
from mushroom_rl.environments.mujoco import MuJoCo, ObservationType
from mushroom_rl.utils.running_stats import *
from ._external_simulation import NoExternalSimulation, MuscleSimulation
from .reward_goals import CompleteTrajectoryReward, ... | 2.25 | 2 |
tests/test_shellcraft.py | maebert/shellcraft | 14 | 12769514 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_shellcraft.
Tests for `shellcraft` module.
"""
from __future__ import unicode_literals
import os
import pytest
from click.testing import CliRunner
import pkg_resources
from shellcraft.cli import get_game, cli
from shellcraft.shellcraft import Game
@pytest.fix... | 2.296875 | 2 |
iot_device/env.py | iot49/iot-device | 0 | 12769515 | <reponame>iot49/iot-device
# env.py
from .utilities import cd
import os
"""
Environment Variables
Name Default
* IOT_PROJECTS ~/projects
* IOT_DEVICES $IOT_PROJECTS/devices
* IOT_LIBS $IOT_PROJECTS/libs
* IOT_SECRETS $IOT_LIBS/secrets.py
"""
class Env:
@staticmethod
def expand_path(pat... | 2.4375 | 2 |
CodeWars/Python/Dashatize it.py | nirgn975/CodeWars | 28 | 12769516 | <reponame>nirgn975/CodeWars<gh_stars>10-100
"""
Given a number, return a string with dash `'-'` marks before and after each odd integer, but do not begin or end the string with a dash mark.
"""
def dashatize(num):
if not num and not (num == 0):
return 'None'
result = '-'.join(str(abs(num)))
copy_r... | 3.875 | 4 |
data_processing/prepare_validation_data.py | saverymax/qdriven-chiqa-summarization | 10 | 12769517 | """
Module for classes to prepare validation dataset from MedInfo dataset.
Data format will be {key: {'question': question, 'summary':, summ, 'articles': articles} ...}
Additionally, format for question driven summarization. For example:
python prepare_validation_data.py -t --add-q
"""
import json
import argparse
im... | 3.21875 | 3 |
algorithms/sorting_algorithms/merge_sort.py | onyonkaclifford/data-structures-and-algorithms | 0 | 12769518 | <gh_stars>0
from typing import List
def merge_sort(x: List) -> List:
"""Merge sort divides a list into two smaller lists, and recursively repeats the process on the two smaller lists
till lists of single elements are obtained. These smaller lists are then combined to form a single sorted list of
the origi... | 4.15625 | 4 |
TTI_computing/test.py | XDZhelheim/TrafficDataAnalysis | 0 | 12769519 | <reponame>XDZhelheim/TrafficDataAnalysis
import matplotlib.pyplot as plt
import numpy as np
from scipy import interpolate
# 设置距离
x = np.array([0, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 70, 8, 9, 10])
# 设置相似度
y = np.array([0.8579087793827057, 0.8079087793827057, 0.7679087793827057, 0.679087793827057,
... | 2.609375 | 3 |
dcclient/tests/test_rpc.py | asgard-lab/driver | 0 | 12769520 | <filename>dcclient/tests/test_rpc.py<gh_stars>0
import testtools
import mock
import neutron.plugins.ml2.drivers.datacom.dcclient.rpc as rpc
import neutron.plugins.ml2.drivers.datacom.dcclient.xml_manager.\
data_structures as ds
from StringIO import StringIO as sio
import gzip... | 2.40625 | 2 |
logger/logger_meta/__init__.py | JiahuiLei/Pix2Surf | 26 | 12769521 | from .metric_logger import MetricLogger
from .image_logger import ImageLogger
from .model_logger import ModelLogger
from .xls_logger import XLSLogger
from .obj_logger import ObjectLogger
LOGGER_REGISTED = {
'metric': MetricLogger,
'image': ImageLogger,
'model': ModelLogger,
'xls': XLSLogger,
'obj':... | 1.234375 | 1 |
casino/test/test_roulette_cancellation.py | gauravvazirani/ooad | 0 | 12769522 | import wheel
from src import roulette_cancellation
from src import bet
from src import table
from src import wheel
from src import roulette_game
import unittest
class TestCancellation(unittest.TestCase):
def setUp(self):
self.wheel = wheel.Wheel()
self.table = table.Table(minimum=10, maximum=1000)
... | 3 | 3 |
code/gini_calculator.py | leifos/retrievability | 0 | 12769523 | # AUTHOR: <NAME>
# 13-02-2022
# calculate the gini coefficient give the retrievability file
import os
import argparse
from collections import defaultdict
def check_file_exists(filename):
if filename and not os.path.exists(filename):
print("{0} Not Found".format(filename))
quit(1)
def calculate_g... | 3.578125 | 4 |
ycimpute/imputer/iterforest.py | egemenzeytinci/ycimpute | 74 | 12769524 | from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import RandomForestClassifier
from sklearn.utils import check_array
import numpy as np
from ..utils.tools import Solver
class MissForest(Solver):
def __init__(
self,
n_estimators=300,
max_depth=None,
... | 2.96875 | 3 |
zisan/Seg/davisinteractive/metrics/__init__.py | JintuZheng/zisan | 40 | 12769525 | from __future__ import absolute_import
from .jaccard import batched_f_measure, batched_jaccard
| 1.007813 | 1 |
Algorithm/jump_step.py | FYPYTHON/method | 0 | 12769526 | <reponame>FYPYTHON/method
# coding=utf-8
import time
# nums = [2, 3, 1, 1, 4]
# nums = [1, 2, 3]
# nums = [2, 0, 1]
# nums = [1, 1, 1, 1]
nums = [2, 1, 1, 1, 1]
class Solution(object):
def jump(self, nums):
"""
nums = [2,3,1,1,4]
数组的每一项为能跳跃的步数,求最小跳跃次数到达数组末端。
:type nums: List[int]... | 3.75 | 4 |
discretize/utils/code_utils.py | ngodber/discretize | 123 | 12769527 | <filename>discretize/utils/code_utils.py
import numpy as np
import warnings
SCALARTYPES = (complex, float, int, np.number)
def is_scalar(f):
"""Determine if the input argument is a scalar.
The function **is_scalar** returns *True* if the input is an integer,
float or complex number. The function returns... | 3.765625 | 4 |
libs/python/stupendous_cow/importer/generic_ss/director.py | tomault/stupendous-cow | 0 | 12769528 | <filename>libs/python/stupendous_cow/importer/generic_ss/director.py
from stupendous_cow.data_model import Article, ArticleType, Category, Venue
from stupendous_cow.extractors import ExtractedDocument
from stupendous_cow.util import normalize_title
from stupendous_cow.builders import ArticleBuilder, BooleanPropertyBind... | 2.046875 | 2 |
pptx_template/__init__.py | skar404/pptx-template | 1 | 12769529 | <reponame>skar404/pptx-template<gh_stars>1-10
# coding=utf-8
__version__ = '0.2.7.6'
| 0.945313 | 1 |
Multidimensional_Lists/09E_ot_kolejka_github.py | MihailMarkovski/Python-Advanced-2020 | 4 | 12769530 | <filename>Multidimensional_Lists/09E_ot_kolejka_github.py<gh_stars>1-10
(rows_count, columns_count) = map(int, input().split())
matrix = []
new_matrix = []
player_position = []
player_wins = False
for i in range(rows_count):
row = [x for x in input()]
if "P" in row:
player_position = [i, row.index("P")... | 2.9375 | 3 |
mute_alsa.py | bkrishnamachari/musiclifx | 1 | 12769531 | <filename>mute_alsa.py
# code to mute alsa error messages
# taken entirely from * http://stackoverflow.com/questions/36956083/how-can-the-terminal-output-of-executables-run-by-python-functions-be-silenced-i/36966379#36966379
# license file does not apply to this code
import ctypes
ERROR_HANDLER_FUNC = ctypes.CFUNCTYP... | 2.234375 | 2 |
test/fx2trt/converters/acc_op/test_unsqueeze.py | batzner/pytorch | 0 | 12769532 | <reponame>batzner/pytorch
import torch
import torch.fx
import torch.fx.experimental.fx_acc.acc_ops as acc_ops
import torch.nn as nn
from caffe2.torch.fb.fx2trt.tests.test_utils import AccTestCase, InputTensorSpec
class TestUnsqueeze(AccTestCase):
def test_unsqueeze(self):
class Unsqueeze(nn.Module):
... | 2.34375 | 2 |
reinvent_scoring/scoring/enums/rocs_specific_parameters_enum.py | MolecularAI/reinvent-scoring | 0 | 12769533 | <filename>reinvent_scoring/scoring/enums/rocs_specific_parameters_enum.py
from dataclasses import dataclass
@dataclass(frozen=True)
class ROCSSpecificParametersEnum():
ROCS_INPUT = "rocs_input"
INPUT_TYPE = "input_type"
SHAPE_WEIGHT = "shape_weight"
COLOR_WEIGHT = "color_weight"
SIM_MEASURE = "sim... | 2.3125 | 2 |
paranestamol/__init__.py | appetrosyan/paranestamol | 2 | 12769534 | import os
from paranestamol.utils import Legend, cleanupFileRoot
if os.getenv('QT_API') != "PySide2":
raise RuntimeError(f'TL;DR \n\n`QT_API=PySide2 python3 -m paranestamol `\n\n The moron who\
designed `matplotlib_backend_qtquick` hard-coded a preference for\
pyqt5 for their backend, despite supporting PySide2 ... | 2.03125 | 2 |
units.py | solomondg/ModSim_Proj2 | 0 | 12769535 | <gh_stars>0
from pint import UnitRegistry
units = UnitRegistry()
| 1.242188 | 1 |
dmarc_reporting/__init__.py | virtualtam/django-dmarc-reporting | 4 | 12769536 | """django-dmarc-reporting"""
__author__ = "VirtualTam"
__title__ = "django-dmarc-reporting"
__version__ = '0.1'
default_app_config = 'dmarc_reporting.apps.DmarcReportingConfig'
| 1.125 | 1 |
tgs/scripts/train_keras.py | zaxcie/TGS-Salt-identification-Kaggle | 0 | 12769537 | <gh_stars>0
from tgs.models.UNet import get_unet
from tgs.data.images import HEIGHT, WIDTH, Image, ImageSet
from tgs.data.split import get_train_val_ids
from tgs.utils.mlflow import find_or_create_experiment
from tgs.utils.metrics import tf_mean_iou
from keras.callbacks import ModelCheckpoint, TensorBoard, EarlyStoppi... | 2.15625 | 2 |
date.py | himanshushukla254/Python_Semantics | 0 | 12769538 | <gh_stars>0
from semantic.dates import DateService
service = DateService()
date = service.extractDate("On March 3 at 12:15pm...")
print(date);
| 2.40625 | 2 |
tricolor/tricolor.py | nathanrooy/tricolor-map-legend | 1 | 12769539 | #------------------------------------------------------------------------------+
#
# <NAME>
# Create a three color triangle
# 2017-DEC
#
#------------------------------------------------------------------------------+
#--- IMPORT DEPENDENCIES ------------------------------------------------------+
from __future... | 3.765625 | 4 |
python/pythonrc.py | inky/dotfiles | 2 | 12769540 | <reponame>inky/dotfiles
# -----------------------------------------------------------------------------
# Python repl config
# -----------------------------------------------------------------------------
import datetime
import math
import os
import random
import re
import sys
from math import *
from pydoc import page... | 2.140625 | 2 |
styrobot/cogs/finance.py | ThatRedKite/styrobot | 1 | 12769541 | import yfinance
import discord
from discord.ext import commands
import threading
import asyncio
import traceback
import requests
import time
class Asset(object):
def __init__(self, symbol=None, name=None, price=None, url=None):
self.symbol = symbol
self.name = name
self.price = price
... | 2.90625 | 3 |
git-code/SDNN_python-master/src/main.py | mmaximiliano/SDNN | 0 | 12769542 | <filename>git-code/SDNN_python-master/src/main.py
"""
__author__ = <NAME>
__email__ = <EMAIL>
SDNN Implementation based on Kheradpisheh, S.R., et al. 'STDP-based spiking deep neural networks
for object recognition'. arXiv:1611.01421v1 (Nov, 2016)
"""
from SDNN_cuda import SDNN
from Classifier import Classifier
impor... | 2.53125 | 3 |
feature_detection/nms_test/test_num_v1.py | hadleyhzy34/point_cloud | 0 | 12769543 | import numpy as np
import time
from nms.nums_py2 import py_cpu_nms # for cpu
# from nms.gpu_nms import gpu_nms # for gpu
np.random.seed( 1 ) # keep fixed
num_rois = 6000
minxy = np.random.randint(50,145,size=(num_rois ,2))
maxxy = np.random.randint(150,200,size=(num_rois ,2))
score = 0.8*np.random.random_sample... | 2.265625 | 2 |
examples/apps/simple_imaging_app/__init__.py | jlvahldiek/monai-deploy-app-sdk | 28 | 12769544 | <reponame>jlvahldiek/monai-deploy-app-sdk
import os
import sys
_current_dir = os.path.abspath(os.path.dirname(__file__))
if sys.path and os.path.abspath(sys.path[0]) != _current_dir:
sys.path.insert(0, _current_dir)
del _current_dir
| 1.523438 | 2 |
tests/MPUSensor/MPURollPitch.py | murrayireland/Rover-Code | 0 | 12769545 | #!/usr/bin/env python
"""MPURollPitch.py: Receives raw data from MPU 9DOF click IMU+Magnetometer and calculates roll and pitch angles."""
import smbus
import math
# Power management registers
power_mgmt_1 = 0x6b
power_mgmt_2 = 0x6c
def read_byte(adr):
return bus.read_byte_data(address, adr)
def read_word(adr):... | 3.078125 | 3 |
tests/test_utils/test_mqtt_broker.py | jordan-hamilton/petnet-feeder-service | 47 | 12769546 | def test_mqtt_broker_default_config():
from feeder.util.mqtt.broker import FeederBroker
from feeder import settings
broker = FeederBroker()
assert broker.config["listeners"]["tcp-1"] == {
"bind": f"0.0.0.0:{settings.mqtt_port}"
}
assert broker.config["listeners"]["tcp-ssl-1"] == {
... | 2.3125 | 2 |
network/layer_implementations/ConvLSTMCell.py | DesperateMaker/TrackR-CNN | 522 | 12769547 | import tensorflow as tf
from network.Util import smart_shape
RNNCell = tf.nn.rnn_cell.RNNCell
LSTMStateTuple = tf.nn.rnn_cell.LSTMStateTuple
def _conv2d(x, W, strides=None):
if strides is None:
strides = [1, 1]
return tf.nn.conv2d(x, W, strides=[1] + strides + [1], padding="SAME")
def dynamic_conv_rnn(cell,... | 2.921875 | 3 |
pyserval/connection.py | umr-ds/pyserval | 1 | 12769548 | <reponame>umr-ds/pyserval
"""
pyserval.connection
~~~~~~~~~~~~~~~~~~~
"""
from pyserval.lowlevel.connection import RestfulConnection
from pyserval.exceptions import UnauthorizedError
from typing import Any
from requests.models import Response
class CheckedConnection(RestfulConnection):
"""Encapsulates HTTP-calls... | 2.875 | 3 |
models/recipe_nutrient.py | nikgun1984/ketolife_backend | 1 | 12769549 | <gh_stars>1-10
from models import db
class RecipeNutrient(db.Model):
"""Recipe-Nutrient Model Association table"""
__tablename__ = 'recipe_has_nutrients'
id = db.Column(
db.Integer,
primary_key=True,
autoincrement=True
)
recipe_id = db.Column(
db.Integer,
... | 2.921875 | 3 |
route.py | 1306298019/YOLOV4 | 0 | 12769550 | <gh_stars>0
import scipy
from scipy import misc
import os
import time
import glob
from scipy import ndimage
def get_image_paths(folder):
return glob.glob(os.path.join(folder, '*.png'))
def create_read_img(filename):
im = misc.imread(filename)
img_rote_90 = ndimage.rotate(im, 90)
... | 2.625 | 3 |