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 |
|---|---|---|---|---|---|---|
projects/models.py | maattss/tdt4242-agreelance | 0 | 12765851 | <gh_stars>0
from django.db import models
from user.models import Profile
from taggit.managers import TaggableManager
from django.core.files.storage import FileSystemStorage
from django.conf import settings
import os
class OverwriteStorage(FileSystemStorage):
def get_available_name(self, name, max_length):
... | 2.109375 | 2 |
generate_result.py | SeitaroShinagawa/chainer-partial_convolution_image_inpainting | 116 | 12765852 | <gh_stars>100-1000
#!/usr/bin/env python
import argparse
import os
import chainer
from chainer import training
from chainer import cuda, serializers
from chainer.training import extension
from chainer.training import extensions
import sys
import common.net as net
import datasets
from updater import *
from evaluation im... | 2.1875 | 2 |
3. Python Advanced (September 2021)/3.1 Python Advanced (September 2021)/10. Exercise - Functions Advanced/05_even_or_odd.py | kzborisov/SoftUni | 1 | 12765853 | def even_odd(*args):
args = list(args)
command = args.pop()
if command == "even":
return [x for x in args if x % 2 == 0]
return [x for x in args if not x % 2 == 0]
print(even_odd(1, 2, 3, 4, 5, 6, "even"))
print(even_odd(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, "odd"))
| 4.03125 | 4 |
applications/interface/test.py | beckerrh/simfemsrc | 0 | 12765854 | <reponame>beckerrh/simfemsrc<filename>applications/interface/test.py
from __future__ import print_function
import sys, os, shutil
from argparse import ArgumentParser
sys.path.append("@simfempythonpath@")
sys.path.append("@libpythonpath@")
import mesh.geometry
import tools.plot
import tools.testerrors
import numpy as ... | 2.109375 | 2 |
examples/issues/issue529_obj.py | tgolsson/appJar | 666 | 12765855 | <reponame>tgolsson/appJar
import sys
sys.path.append("../../")
from numpy import sin, pi, arange
from appJar import gui
from matplotlib.backends.backend_tkagg import NavigationToolbar2TkAgg as addToolbar
import random
from mpl_toolkits.mplot3d import Axes3D
with gui() as app:
fig = app.addPlotFig("p1", showNav=... | 2.1875 | 2 |
ttarray/core/creation.py | sonnerm/ttarray | 0 | 12765856 | from .array import TensorTrainArray
from .slice import TensorTrainSlice
from .dispatch import implement_function
from ..raw import find_balanced_cluster,trivial_decomposition
import numpy as np
def _get_cluster_chi_array(shape,cluster,chi):
if cluster is None:
cluster=find_balanced_cluster(shape)
if isi... | 2.6875 | 3 |
dcms/media/urls.py | yifei-fu/dcms | 1 | 12765857 | from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from .views import *
router = DefaultRouter()
router.register('image', ImageViewSet)
router.register('file', FileViewSet)
urlpatterns = [
url(r'', include(router.urls)),
url(r'^upload_image/(?P<filename>[^/]+)$', Image... | 1.914063 | 2 |
werf_chart_repo_doit_tasks/__init__.py | ilya-lesikov/werf-chart-repo-tasks | 0 | 12765858 | <filename>werf_chart_repo_doit_tasks/__init__.py
"""werf_chart_repo_doit_tasks - Doit Tasks for managing Werf chart repo"""
__version__ = '1.0.6'
__author__ = '<NAME> <<EMAIL>>'
__all__ = []
| 1.039063 | 1 |
signal_processing.py | sydneyhill3901/Heart-rate-measurement-using-camera | 0 | 12765859 | import os, csv
import numpy as np
import pandas as pd
from pathlib import Path
from sklearn.model_selection import train_test_split
from scipy import signal
class ProcessSignalData(object):
def __init__(self):
# path to video data from signal_output.py
self.dir = './processed_new/videos'
s... | 2.4375 | 2 |
m31hst/paths.py | jonathansick/m31hst | 0 | 12765860 | <filename>m31hst/paths.py<gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
"""
Access to HST data sets.
The environment variables $PHATDATA and $BROWNDATA should point to root
directories for the PHAT and Brown HLSP datasets.
2013-12-02 - Created by <NAME>
"""
import os
import glob
BROWNFIELDS = ('halo11', 'strea... | 2.40625 | 2 |
Nas/auto_keras.py | motkeg/experimental | 0 | 12765861 | import autokeras as ak
import tensorflow as tf
from tensorflow.keras.preprocessing import image
from tensorflow.keras.callbacks import ModelCheckpoint, TensorBoard
EPOCHS = 50
BATCH = 5
NAME = "autokeras_classification"
DATASET_PATH = "/hdd/4celebs_training_set"
def build_train_set(image_size):
def make_train_ge... | 2.5625 | 3 |
tests/test_core.py | yanglbme/actions-toolk | 10 | 12765862 | import asyncio
import io
import os
import sys
from actions_toolkit import core
from actions_toolkit.utils import to_command_properties, AnnotationProperties
test_env_vars = {
'my var': '',
'special char var \r\n];': '',
'my var2': '',
'my secret': '',
'special char secret \r\n];': '',
'my secr... | 2.234375 | 2 |
test/test_meal_plan_sections.py | kingo55/pygrocy | 0 | 12765863 | import datetime
import pytest
class TestMealPlanSections:
@pytest.mark.vcr
def test_get_sections_valid(self, grocy):
sections = grocy.meal_plan_sections()
assert len(sections) == 2
section = sections[1]
assert section.id == 1
assert section.name == "Breakfast"
... | 2.265625 | 2 |
problems/chapter15/nicetak/aoj1350.py | tokuma09/algorithm_problems | 1 | 12765864 | class UnionFind():
def __init__(self, n) -> None:
self.par = [-1] * n
self.siz = [1] * n
# return root of x
def root(self, x):
if self.par[x] == -1:
return x
else:
self.par[x] = self.root(self.par[x])
return self.par[x]
# ret... | 3.21875 | 3 |
BacterialTyper/scripts/assembly_stats_caller.py | HCGB-IGTP/BacterialTyper | 2 | 12765865 | <reponame>HCGB-IGTP/BacterialTyper
#!/usr/bin/env python3
############################################################
## <NAME> ##
## Copyright (C) 2019-2021 <NAME>, IGTP, Spain ##
############################################################
from pandas.tests.io.json.conftest i... | 2.078125 | 2 |
examples/mock_pipe.py | phip123/glimmer | 1 | 12765866 | <reponame>phip123/glimmer
import logging
import multiprocessing
import os
import sys
from examples.mock_nodes import DevSource, DevSink, DevOperator, DevAvgOperator
from glimmer.processing.operator import LogOperator
from glimmer.processing.sync import SynchronousEnvironment, SynchronousTopology
logger = logging.getL... | 1.929688 | 2 |
Web_Server/webapps/bemoss_applications/migrations/0001_initial.py | ajfar-bem/wisebldg | 0 | 12765867 | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-07-17 19:38
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
... | 1.75 | 2 |
cerebralcortex/data_import_export/export_diagnostic_data.py | MD2Korg/CerebralCortex-2.0-legacy | 0 | 12765868 | <filename>cerebralcortex/data_import_export/export_diagnostic_data.py
# Copyright (c) 2017, MD2K Center of Excellence
# 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 sourc... | 1.648438 | 2 |
simplemfa/structures.py | mwhawkins/django-simple-mfa | 3 | 12765869 | <filename>simplemfa/structures.py<gh_stars>1-10
"""
A custom immutable dictionary data structure
"""
class CustomImmutableDict(dict):
def __getattr__(self, key):
try:
return self[key]
except KeyError as k:
raise AttributeError(k)
def __setattr__(self, key, value):
... | 2.84375 | 3 |
Python3/Books/Douson/chapter08/attribute_critter_ru.py | neon1ks/Study | 0 | 12765870 | # Attribute Critter
# Demonstrates creating and accessing object attributes
# Зверюшка с атрибутами
# Демонстрирует создание атрибутов объекта и доступ к ним
class Critter(object):
"""Виртуальный питомец"""
# """A virtual pet"""
def __init__(self, name):
# print("A new critter has been born!")
... | 4.46875 | 4 |
scripts/lelantos_show_qso_catalog.py | corentinravoux/lelantos | 4 | 12765871 | #!/usr/bin/env python3
import matplotlib.pyplot as plt
import argparse
from lelantos import tomographic_objects
parser = argparse.ArgumentParser(description='Plot the QSO catalog')
parser.add_argument('-i',
'--input', help='Input QSO catalog',required=True)
parser.add_argument('-bins', help='Output... | 2.609375 | 3 |
tests/node_2_kern_2_1.py | sharm294/shoal | 1 | 12765872 | <reponame>sharm294/shoal<gh_stars>1-10
import os
from sonar.testbench import Testbench, Module, TestVector, Thread
from sonar.interfaces import AXIS
from sonar.profile import Profiler
node_2_kern_2_1 = Testbench.default('node_2_kern_2_1')
filepath = os.path.join(os.path.dirname(__file__), 'build/node_2_kern_2_1/')
d... | 1.992188 | 2 |
tests/plugins/test_dplay.py | fuglede/streamlink | 0 | 12765873 | import unittest
from streamlink.plugins.dplay import Dplay
class TestPluginDplay(unittest.TestCase):
def test_can_handle_url(self):
should_match = [
'https://www.dplay.dk/videoer/studie-5/season-2-episode-1',
'https://www.dplay.no/videoer/danskebaten/sesong-1-episode-1',
... | 3.015625 | 3 |
canbeta/__main__.py | FROM-THE-EARTH/canbeta | 1 | 12765874 | <gh_stars>1-10
import argparse
import subprocess
import os
import sys
sys.path.append(os.path.join(os.getcwd()))
PATH_CMD_RUN = os.path.join(os.getcwd(), "can09", "cmd", "run.py")
parser = argparse.ArgumentParser()
parser.add_argument("command", choices=["run"])
parser.add_argument("args")
args = parser.parse_args(... | 2.484375 | 2 |
tests/test_types.py | CAENels/frugy | 2 | 12765875 | """
SPDX-License-Identifier: BSD-3-Clause
Copyright (c) 2020 Deutsches Elektronen-Synchrotron DESY.
See LICENSE.txt for license details.
"""
import unittest
from frugy.types import FixedField, StringField, StringFmt, GuidField, ArrayField, FruAreaBase
class TestString(unittest.TestCase):
def test_null(self):
... | 2.15625 | 2 |
bcs-ui/backend/tests/container_service/cluster_tools/conftest.py | kayinli/bk-bcs | 0 | 12765876 | <reponame>kayinli/bk-bcs
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not u... | 1.601563 | 2 |
makahiki/apps/widgets/status/DWGG/views.py | justinslee/Wai-Not-Makahiki | 1 | 12765877 | <filename>makahiki/apps/widgets/status/DWGG/views.py
"""Handle the rendering of the water DEGG widget."""
from apps.widgets.status import status
def supply(request, page_name):
"""Supply the view_objects content."""
_ = request
_ = page_name
return status.resource_goal_status("water")
| 1.914063 | 2 |
utils/test_images_generator/random_image_generator.py | pgolab/mosaic-maker-opencv-python | 2 | 12765878 | import cv2
import numpy as np
from utils.test_images_generator.generator_config import AVAILABLE_SHAPES_DICT
from utils.test_images_generator.generator_utils import generate_random_color, generate_random_image_points
def generate_random_image(width, height):
# ToDo generate white image
# https://numpy.org/do... | 2.828125 | 3 |
Answers Of The Questions.py | denizgurzihin/Python-Encryption | 0 | 12765879 | <filename>Answers Of The Questions.py
import random
import hashlib
import os
import time
from cryptography.hazmat.primitives import serialization, hashes
from cryptography.hazmat.primitives.asymmetric import rsa, padding
from cryptography.hazmat.backends import default_backend
from Cryptodome.Cipher import DES
... | 3.296875 | 3 |
test/test_23_filterproplist.py | growell/svnhook | 1 | 12765880 | <filename>test/test_23_filterproplist.py
#!/usr/bin/env python
######################################################################
# Test Property List Filter
######################################################################
import os, re, sys, unittest, time
# Prefer local modules.
mylib = os.path.normpath(os... | 2.15625 | 2 |
accelerator/tests/factories/application_factory.py | masschallenge/django-accelerator | 6 | 12765881 | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from __future__ import unicode_literals
from datetime import (
datetime,
timedelta,
)
import swapper
from factory import SubFactory
from factory.django import DjangoModelFactory
from pytz import utc
from accelerator.tests.factories.application_type_fact... | 1.976563 | 2 |
etd_drop/wsgi.py | MetaArchive/etd-drop | 1 | 12765882 | """
WSGI config for etd_drop project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "etd_drop.settings")
#Attempt to set... | 1.84375 | 2 |
utils/pylib/flow.py | jianzi123/contrail-vrouter | 0 | 12765883 | <reponame>jianzi123/contrail-vrouter
#
# Copyright (c) 2019 Juniper Networks, Inc. All rights reserved.
#
import constants
from object_base import *
from vr_py_sandesh.vr_py.ttypes import *
class Flow(ObjectBase, vr_flow_req):
"""Base class to create flows"""
def __init__(
self,
sip_... | 2.03125 | 2 |
kbcqa/method_sp/grounding/_2_1_grounded_graph/node_linking/entity_linking_aqqu_vocab/u.py | nju-websoft/SkeletonKBQA | 6 | 12765884 | """
Copyright 2015, University of Freiburg.
<NAME> <<EMAIL>>
"""
import re
def normalize_entity_name(name):
name = name.lower()
name = name.replace('!', '')
name = name.replace('.', '')
name = name.replace(',', '')
name = name.replace('-', '')
name = name.replace('_', '')
name = name.repl... | 3.203125 | 3 |
test.py | nmningmei/simple_tensorflow_logistic_regression_classifier | 0 | 12765885 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 19 11:30:56 2022
@author: adowa
"""
import numpy as np
import tensorflow as tf
from utils import (build_logistic_regression,
compile_logistic_regression)
from tensorflow.keras import regularizers
from sklearn.datasets import make_... | 2.859375 | 3 |
libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice_factory.py | awaemmanuel/botbuilder-python | 1 | 12765886 | <filename>libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice_factory.py
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from typing import List
from botbuilder.core import CardFactory, MessageFactory
from botbuilder.schema import ActionTypes, Activity, CardAct... | 2.515625 | 3 |
The_Basics/The_Basics_Data_Types.py | vishu22314558/py-code | 0 | 12765887 | import datetime
mynow = datetime.datetime.now()
print("My datetime is " , mynow)
mynumber = 10
mytext = "Hello"
print(mynumber, mytext)
x = 10
y = "10"
z = 10.1
sum1 = x+x
sum2 = y+y
print(sum1 , sum2)
print(type(x), type(y), type(z))
## List Type
grade = [9.5,8.5,6.45]
## range - We can use ragne to create lis... | 3.921875 | 4 |
Basics/flask_send_email.py | abondar24/FlaskDemo | 0 | 12765888 | <filename>Basics/flask_send_email.py
# flask db and email demo
# I have combined db adding ans sending emails demo as it has been done in the book
# Before run setup MAIL_USERNAME,MAIL_PASSWORD
import os
from flask import Flask
from flask_mail import Mail
from flask_mail import Message
from flask import redirect
from f... | 2.96875 | 3 |
4.3/src/vnfd/dnsserver_vnf/scripts/dnsserver_initial_config.py | RIFTIO/RIFT.io-Descriptor-Packages | 3 | 12765889 | #!/usr/bin/env python3
import argparse
import logging
import os
import stat
import subprocess
import sys
import time
import yaml
import paramiko
'''
config-agent: {}
nsr_name: ccore_testbed_nsd
parameter: {}
vnfr:
1:
connection_point:
- ip_address: 172.16.58.3
name: homesteadprov_vnfd/sigport
mgmt_i... | 1.5625 | 2 |
python/sheet_meshing.py | jpanetta/Inflatables | 10 | 12765890 | import scipy
import scipy.sparse.csgraph
import wall_generation, mesh
import mesh_operations
import utils
import triangulation, filters
from mesh_utilities import SurfaceSampler, tubeRemesh
import numpy as np
def meshComponents(m, cutEdges):
"""
Get the connected components of triangles of a mesh cut along the... | 2.359375 | 2 |
days/day24.py | Kurocon/AdventOfCode2020 | 0 | 12765891 | <gh_stars>0
from days import AOCDay, day
import re
from collections import defaultdict
@day(24)
class Day24(AOCDay):
test_input = """sesenwnenenewseeswwswswwnenewsewsw
neeenesenwnwwswnenewnwwsewnenwseswesw
seswneswswsenwwnwse
nwnwneseeswswnenewneswwnewseswneseene
swweswneswnenwsewnwneneseenw
eesenwseswswnenwswnwn... | 3.03125 | 3 |
mse.py | BrightLamp/PyLearningCodes | 0 | 12765892 | import numpy as np
from sklearn import linear_model
np.random.seed(123)
np.set_printoptions(suppress=True, linewidth=120)
X = np.random.random([10, 5]).astype(np.float)
y = np.random.random(10).astype(np.float)
# sklearn
linear = linear_model.LinearRegression()
linear.fit(X, y)
# Pure Python
X = np.hstack([np.ones(... | 3.515625 | 4 |
RareVariants/ResultCollector.py | afif-elghraoui/CorrelatedVariants | 0 | 12765893 | <filename>RareVariants/ResultCollector.py
#################################################################################
# Copyright (c) 2011-2013, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted pro... | 0.960938 | 1 |
tests/test_oauth2.py | amehta1/t1-python | 24 | 12765894 | <reponame>amehta1/t1-python<filename>tests/test_oauth2.py
"""Test OAuth2 methods."""
import unittest
from terminalone import T1
import responses
mock_credentials = {
'client_id': 'client_id',
'client_secret': 'secret',
'username': 'username',
'password': '<PASSWORD>'
}
class TestOauth2ResourceOwnerL... | 3.078125 | 3 |
test_lzhw.py | MNoorFawi/lzhw | 4 | 12765895 | import lzhw
from sys import getsizeof
from random import sample, choices
import pandas as pd
def test_weather():
weather = ["Sunny", "Sunny", "Overcast", "Rain", "Rain", "Rain", "Overcast", "Sunny", "Sunny",
"Rain", "Sunny", "Overcast", "Overcast", "Rain", "Rain", "Sunny", "Sunny"]
comp_weather... | 2.84375 | 3 |
homeassistant/components/switch/netio.py | smilepc/Home-assistant | 0 | 12765896 | """
The Netio switch component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.netio/
"""
import logging
from collections import namedtuple
from datetime import timedelta
from homeassistant import util
from homeassistant.components.http import Hom... | 2.296875 | 2 |
split_check.py | joicejoseph3198/Hard-Hat-Detection | 1 | 12765897 | import os
image_dir ="H:/Python Space/Hard_Hat _Detection/images"
label_dir= "H:/Python Space/Hard_Hat _Detection/labels"
print("No. of Training images", len(os.listdir(image_dir + "/train")))
print("No. of Training labels", len(os.listdir(label_dir + "/train")))
print("No. of valid images", len(os.listdir(image_dir... | 2.703125 | 3 |
open_spiel/python/algorithms/psro_v2/ars_ray/workers.py | wyz2368/open_spiel3 | 0 | 12765898 | import numpy as np
import ray
import pyspiel
from open_spiel.python.algorithms.psro_v2.ars_ray.shared_noise import *
from open_spiel.python.algorithms.psro_v2.ars_ray.utils import rewards_combinator
from open_spiel.python.algorithms.psro_v2 import rl_policy
from open_spiel.python import rl_environment
import tens... | 2.15625 | 2 |
microbial_deep_learning/butterfree/analysis/classification.py | kellylab/Metagenomic-Disease-Classification-With-Deep-Learning | 7 | 12765899 | import clusters as c
import tensorflow as tf
import pandas as pd
import re
def one_hot(i, n):
""" Makes a one-hot vector of length n with 1 in position i. """
one_hot = [0 for x in range(n)]
one_hot[i] = 1
return one_hot
datasets = c.datasets
data_type = 'metaphlan_bugs_list'
body_site = 'stool'
df,... | 2.609375 | 3 |
hybrid.py | peractio/hybrid_ml_model | 1 | 12765900 | # credit card default dataset: https://archive.ics.uci.edu/ml/datasets/default+of+credit+card+clients
# kaggle link: https://www.kaggle.com/uciml/default-of-credit-card-clients-dataset
import pandas as pd
from fim import fpgrowth#,fim
import numpy as np
#import math
#from itertools import chain, combinations
import it... | 2.640625 | 3 |
leetcode-algorithms/146. LRU Cache/lrucache.py | rongpenl/algorithms-and-oj | 0 | 12765901 | <reponame>rongpenl/algorithms-and-oj
class Node:
def __init__(self, k, v):
self.key = k
self.val = v
self.pre = None
self.nxt = None
class LRUCache:
def __init__(self, capacity: int):
self.store = {}
self.curCap = 0
self.cap = capacity
self.tail... | 3.640625 | 4 |
AI/home/views.py | Phong940253/math-word-problem | 1 | 12765902 | <filename>AI/home/views.py<gh_stars>1-10
from django.shortcuts import render
from django.http import HttpResponse
from .EngineCKB import Engine
def home(request):
return render(request, 'page/page.html')
def thread(request):
return render(request, 'page/thread.html')
def about(request):
return render(... | 2.21875 | 2 |
tests/sett/test_strategy_flow_unitrenbtc.py | mushroomsforest/badger-system | 0 | 12765903 | <reponame>mushroomsforest/badger-system
from helpers.time_utils import days, hours
import brownie
import pytest
from brownie import *
from helpers.constants import *
from helpers.sett.SnapshotManager import SnapshotManager
from tests.conftest import badger_single_sett, settTestConfig
from tests.helpers import distribut... | 2.21875 | 2 |
spillway/mixins.py | timgates42/django-spillway | 62 | 12765904 | <filename>spillway/mixins.py<gh_stars>10-100
from rest_framework import exceptions
from rest_framework.renderers import TemplateHTMLRenderer
from rest_framework.settings import api_settings
class ModelSerializerMixin(object):
"""Provides generic model serializer classes to views."""
model_serializer_class = N... | 2.15625 | 2 |
addons/website_forum_visibility/models/ir_http.py | marionumza/vocal_v12 | 0 | 12765905 | # © 2017 <NAME> <<EMAIL>>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import re
from odoo.http import request
from odoo import models
class IRHttp(models.AbstractModel):
_inherit = 'ir.http'
@classmethod
def _serve_404(cls):
req_page = request.httprequest.path
... | 2.078125 | 2 |
XcomLAN/thingsboard/thingsboard_client.py | Mustafa-Abu-Ghazy/XcomLAN | 0 | 12765906 | <reponame>Mustafa-Abu-Ghazy/XcomLAN
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
This file contains definition/implementation of a ThingsBoardClient Class
that Manages dealing with / pushing data to ThingsBoard server.
"""
import csv
import logging
import re
import threading
from datetime import datetime
from ... | 1.9375 | 2 |
maskrcnn_benchmark/data/collate_batch.py | worldlife123/maskrcnn-benchmark | 0 | 12765907 | <reponame>worldlife123/maskrcnn-benchmark
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from maskrcnn_benchmark.structures.image_list import to_image_list
import torch
class BatchCollator(object):
"""
From a list of samples from the dataset,
returns the batched images and targets.... | 2.390625 | 2 |
multistep_utils.py | UtkarshMishra04/pixel-representations-RL | 2 | 12765908 | <gh_stars>1-10
import torch
from torch import nn
from torch import distributions as pyd
import torch.nn.functional as F
import gym
import os
from collections import deque
import random
import math
import time
from gym import spaces
def get_params(models):
for m in models:
for p in m.parameters():
... | 2.296875 | 2 |
bii_webapp/apps/accounts/models.py | ISA-tools/bii-webapp | 2 | 12765909 | <gh_stars>1-10
from django.db import models
from django.contrib.auth.models import User
# class B(models.Model):
# b1=models.CharField(max_length=200)
#
class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True)
website = models.URLField("Website", blank=True)
company = model... | 2.265625 | 2 |
BiblioPixelAnimations/circle/hyperspace.py | jessicaengel451/BiblioPixelAnimations | 36 | 12765910 | <gh_stars>10-100
from bibliopixel.animation.circle import Circle
from bibliopixel.colors import COLORS
from bibliopixel.colors.arithmetic import color_scale
import random
class Hyperspace(Circle):
COLOR_DEFAULTS = ('colors', [COLORS.Green]),
def __init__(self, layout, tail=4, growthRate=4, angleDiff... | 3.0625 | 3 |
parallel/__init__.py | santiagobasulto/parallel | 22 | 12765911 | import os
import enum
import functools
import itertools
import collections
import concurrent.futures as cf
from . import errors
from . import utils
from . import exceptions
from .models import (
ParallelJob,
ParallelArg,
ParallelStatus,
FailedTask,
SequentialMapResult,
NamedMapResult,
)
# __... | 2.28125 | 2 |
twominutejournal/journal.py | tjmcginnis/tmj | 2 | 12765912 | """
twominutejournal.journal
~~~~~~~~~~~~~~~~~~~~~~~~
A daily gratitude journal library.
"""
import uuid
import datetime
from .errors import EntryAlreadyExistsError
def create_prompt(question: str, responses: int) -> dict:
'''Create a new journal prompt.'''
if not isinstance(question, str):
... | 2.953125 | 3 |
herbieapp/models/message_models_and_serializers.py | merltron-pa/herbie-test | 0 | 12765913 | <reponame>merltron-pa/herbie-test
from rest_framework import serializers
from rest_framework.fields import JSONField
from herbieapp.constants import MessageActionConstants as Constants
class EntityUpdateMessage:
def __init__(self, _type, key, version, payload, created, modified, tags):
self.tags = tags
... | 2.1875 | 2 |
lab5/graph.py | casseyshao/CSC190 | 0 | 12765914 | <reponame>casseyshao/CSC190<gh_stars>0
# Lab 5
'''
G=(V,E)
Let V be the set v0,v1,v2,...
(i.e., with ascending non-negative indices)
and E be the set e0,e1,e2,...
(i.e., with ascending non-negative indices)
'''
class stack:
def __init__(self):
self.lifo = []
def push(self,ele):
self.lifo = self.li... | 3.40625 | 3 |
codewars/omnibool.py | TimothyDJones/learn-python | 0 | 12765915 | # omnibool.py
# https://www.codewars.com/kata/5a5f9f80f5dc3f942b002309/train/python
class Omnibool():
def __eq__(self, x):
return True
if __name__ == "__main__":
omnibool = Omnibool()
print(omnibool == True and omnibool == False)
| 2.921875 | 3 |
refresh_resources.py | Modosmart/modosmart-api | 0 | 12765916 | <gh_stars>0
import requests
import time
import json
while True:
time.sleep(1800) # wait for 30 minutes
# response = requests.get('http://localhost:3030/api/scan')
# get public resources
public_resources = requests.get(
'https://symbioteweb.eu.ngrok.io/innkeeper/public_resources')
resources ... | 2.90625 | 3 |
djangobmf/contrib/task/workflows.py | dmatthes/django-bmf | 1 | 12765917 | #!/usr/bin/python
# ex:set fileencoding=utf-8:
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from djangobmf.workflows import Workflow, State, Transition
from djangobmf.settings import CONTRIB_TIMESHEET
from djangobmf... | 2.15625 | 2 |
sagar/io/vasp.py | unkcpz/sagar | 2 | 12765918 | # -*- coding: utf-8 -*-
import numpy
import warnings
import operator
import collections
from sagar.crystal.structure import Cell
from sagar.element.base import get_symbol
def read_vasp(filename='POSCAR'):
"""
Import POSCAR/CONTCAR or filename with .vasp suffix
parameter:
filename: string, the filena... | 2.515625 | 3 |
tests/test_data/test_accounts.py | TomVollerthun1337/logsmith | 19 | 12765919 | def get_test_accounts() -> dict:
return {
'development': {
'color': '#388E3C',
'team': 'awesome-team',
'region': 'us-east-1',
'profiles': [
{
'profile': 'developer',
'account': '123495678901',
... | 2.125 | 2 |
deepext_with_lightning/models/classification/__init__.py | pei223/deepext_with_lightning | 1 | 12765920 | from .mobilenet_v3.mobilenet_v3 import MobileNetV3
from .efficientnet.efficientnet import EfficientNet
from .abn.attention_branch_network import AttentionBranchNetwork
from .customnet.custom_classification import CustomClassificationNetwork
from . import functions
| 1.140625 | 1 |
install.py | ktiwary2/nerf_pl | 0 | 12765921 | import os
from os.path import exists, join, basename
project_name = "pyrender"
if not exists(project_name):
# clone and install
!git clone -q https://github.com/mmatl/pyrender.git
#requirements file gives the wrong pyglet
#ERROR: pyrender 0.1.23 has requirement pyglet==1.4.0b1, but you'll have pyglet 1.4.0a1 w... | 2.109375 | 2 |
api/api/de_ws.py | weng-lab/SCREEN | 5 | 12765922 |
# SPDX-License-Identifier: MIT
# Copyright (c) 2016-2020 <NAME>, <NAME>, <NAME>, <NAME>
import sys
import os
from models.de import DE
sys.path.append(os.path.join(os.path.dirname(__file__), '../common/'))
from common.pg_search import PGsearch
sys.path.append(os.path.join(os.path.dirname(__file__), '../../'))
from ... | 2.109375 | 2 |
league_bot.py | a-camarillo/league-bot | 1 | 12765923 | import discord
from discord.ext import commands
import league
import matplotlib.pyplot as plt
import seaborn as sns
import os
client = commands.Bot(command_prefix='?')
token = os.environ.get('DISCORD_TOKEN')
@client.event
async def on_ready():
print('Bot is ready.')
@client.command()
async def rank(ctx, name, r... | 2.90625 | 3 |
src/com/python/demo/tuple_Demo.py | Leeo1124/pythonDemo | 0 | 12765924 | '''
Created on 2016年7月27日
@author: Administrator
元组:tuple。tuple和list非常类似,但是tuple一旦初始化就不能修改
'''
classmates = ('Michael', 'Bob', 'Tracy')
print(classmates)
print(len(classmates))
print(classmates[0])
print(classmates[-1])
#只有1个元素的tuple定义时必须加一个逗号,,来消除歧义
t = (1,)
print(t)
t = ('a', 'b', ['A', 'B'])
t[2][0] = 'X'
t[2][1... | 4.21875 | 4 |
parlai/tasks/taskmaster3/agents.py | twstewart42/ParlAI | 1 | 12765925 | #!/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.
"""
Taskmaster-3 implementation for ParlAI.
No official train/valid/test splits are available as of 2020-05-18, so we m... | 1.789063 | 2 |
create_db.py | nalbarr/hello-neo4j-gdsl | 0 | 12765926 | <reponame>nalbarr/hello-neo4j-gdsl
from neo4j import GraphDatabase
from neo4j.exceptions import ClientError
import os
import altair
bolt_url = os.getenv("NEO4J_BOLT_URL", "bolt://localhost")
user = os.getenv("NEO4J_USER", "neo4j")
password = os.getenv("NEO4J_PASSWORD", "<PASSWORD>")
driver = GraphDatabase.driver("bolt... | 2.609375 | 3 |
topnum/scores/calinski_harabasz.py | machine-intelligence-laboratory/OptimalNumberOfTopics | 5 | 12765927 | import logging
import dill
from sklearn.metrics import calinski_harabasz_score
from topicnet.cooking_machine import Dataset
from topicnet.cooking_machine.models import (
BaseScore as BaseTopicNetScore,
TopicModel
)
from .base_custom_score import BaseCustomScore
_Logger = logging.getLogger()
class Calinsk... | 2.25 | 2 |
app.py | ikhichar/toplay | 2 | 12765928 | <reponame>ikhichar/toplay
from flask import Flask
app = Flask("toplay")
import random
choices=['Hilary','Trump','Jill','Gary']
@app.route('/')
def is_nuts():
return "{} is nuts!".format(random.choice(choices))
@app.route('/<person>')
def is_nuts_person(person):
return "{} is nuts!".format(person)
if __name_... | 2.828125 | 3 |
setup.py | kreneskyp/ixian | 0 | 12765929 | <reponame>kreneskyp/ixian
from setuptools import setup
setup(setup_requires=["pbr"], pbr=True, long_description_content_type="text/markdown")
| 0.910156 | 1 |
apps/quotas/views.py | ecognize-hub/ecognize | 1 | 12765930 | from crum import get_current_user
from django.views.generic import TemplateView
from apps.quotas.models import UsageLimitations, Quota, Plans
class PlanOverview(TemplateView):
template_name = "plans_overview.html"
def get_context_data(self, **kwargs):
context = super(PlanOverview, self).get_context_d... | 1.898438 | 2 |
backend/utils/models/fields.py | xingxingzaixian/python-django-online-exam | 47 | 12765931 | <filename>backend/utils/models/fields.py
from django.db.models import CharField
| 1.195313 | 1 |
oui.py | ejohnfel/ouisearch | 0 | 12765932 | #!/usr/bin/env python3.8
# You might want to change the line above to generic python, however, it does require python 3.8 or above to run correctly.
# You MIGHT get away with older versions... but... no warranty here.
import os, sys, io, re
import argparse
import json, csv
import requests
from datetime import dateti... | 2.171875 | 2 |
tests/test_shape.py | wesselb/matrix | 3 | 12765933 | <gh_stars>1-10
import lab as B
import pytest
from matrix.shape import (
compatible,
assert_compatible,
assert_vector,
assert_matrix,
assert_square,
broadcast,
expand_and_broadcast,
)
# noinspection PyUnresolvedReferences
from .util import dense1
def _shapes(*xs):
return tuple(B.shape... | 2.3125 | 2 |
acs/acs/Core/CatalogParser/CatalogParser.py | wangji1/test-framework-and-suites-for-android | 0 | 12765934 | """
:copyright: (c)Copyright 2013, Intel Corporation All Rights Reserved.
The source code contained or described here in and all documents related
to the source code ("Material") are owned by Intel Corporation or its
suppliers or licensors. Title to the Material remains with Intel Corporation
or its suppliers and licen... | 1.375 | 1 |
sdk/python/test/test_v1alpha3_file_system_path.py | PoornimaDevii/katib | 0 | 12765935 | <reponame>PoornimaDevii/katib<filename>sdk/python/test/test_v1alpha3_file_system_path.py
# coding: utf-8
"""
katib
swagger description for katib # noqa: E501
OpenAPI spec version: v0.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
... | 2 | 2 |
api/serializers.py | backdev96/yamdb_final | 0 | 12765936 | from rest_framework import serializers
from .models import Category, Comment, Genre, Review, Title
class CategorySerializer(serializers.ModelSerializer):
'''Serializer for Category model'''
class Meta:
fields = ('name', 'slug')
model = Category
lookup_field = 'slug'
class GenreSeri... | 2.453125 | 2 |
questions/question#11.py | seunghk1206/1-Manhattan-FullStack-Development | 1 | 12765937 | def NoC():
paid = int(input())
moneyL = [500, 100, 50, 10, 5, 1]
count = 0
leftOver = 1000 - paid
for each in moneyL:
n = leftOver//each
if n > 0:
count += n
leftOver -= n * each
elif n == 0:
pass
return count
print(NoC()) | 3.28125 | 3 |
test/data/test_AnyValue.py | pip-services-python/pip-services-commons-python | 0 | 12765938 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
tests.config.test_AnyValue
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) Conceptual Vision Consulting LLC 2015-2016, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from pip_services3_commons.convert import TypeCode
from pip_serv... | 2.1875 | 2 |
example/download_stories.py | arthus-leroy/novelai-api | 6 | 12765939 | <reponame>arthus-leroy/novelai-api
from sys import path
from os import environ as env
from os.path import join, abspath, dirname
path.insert(0, abspath(join(dirname(__file__), '..')))
from novelai_api import NovelAI_API
from novelai_api.utils import get_encryption_key, decrypt_user_data
from aiohttp import ClientSess... | 2.0625 | 2 |
core/modules/OTModule.py | UmSenhorQualquer/workflow-editor | 2 | 12765940 | from PyQt4 import uic
import uuid
import os
class OTModule(object):
"""
Module abstract class implementation
"""
def __init__(self, name):
self._unique_id = uuid.uuid1() #: Module name
self._name = name #: Module unique identifier
def save(self, saver):
... | 2.859375 | 3 |
src/models/random_forest.py | mgarzon/BOERGER-CSI4900-VPN-Detection | 0 | 12765941 | from datetime import datetime
from sklearn.ensemble import RandomForestClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import cross_val_score
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.model_selection import train_test_split
import src.confi... | 2.125 | 2 |
testscripts/RDKB/component/TAD/TS_TAD_IPPingTest_InvalidInterface_CheckSuccessAndResponse.py | rdkcmf/rdkb-tools-tdkb | 0 | 12765942 | <reponame>rdkcmf/rdkb-tools-tdkb<gh_stars>0
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
# Copyright 2019 RDK Management
#
# Licensed under the Apache License, Versi... | 1.398438 | 1 |
aea/configurations/base.py | cyenyxe/agents-aea | 0 | 12765943 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... | 1.703125 | 2 |
python_scripts/01_tabular_data_exploration.py | mehrdad-dev/scikit-learn-mooc | 0 | 12765944 | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.6.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
# # First look at our dataset
#
# In ... | 3.6875 | 4 |
pycalc/MAVProxy/modules/mavproxy_mmap/mmap_server.py | joakimzhang/python-electron | 0 | 12765945 | import BaseHTTPServer
import json
import os.path
import thread
import urlparse
DOC_DIR = os.path.join(os.path.dirname(__file__), 'mmap_app')
class Server(BaseHTTPServer.HTTPServer):
def __init__(self, handler, address='', port=9999, module_state=None):
BaseHTTPServer.HTTPServer.__init__(self, (address, port), ... | 2.59375 | 3 |
Flo et toto/solo/project/constants.py | geverartsdev/TechnofuturTIC | 0 | 12765946 | import pygame
# Constantes de jeu
MAX_TIRS = 10 # nombre maximum de boulets sur l'ecran
MAX_ALIEN = 10
PROBA_ALIEN = 22 # probabilité qu'un alien apparaisse
NOUVEL_ALIEN = 12 # Rafraichissement de l'ecran entre chaque alien
ECRAN = pygame.Rect(0, 0, 1825, 900)
SONS = True # Mettre a True si on veut activer le so... | 2.21875 | 2 |
code/RNC/read_noise_calculation.py | claudiavr/AIS | 0 | 12765947 | # -*- coding: utf-8 -*-
"""
Read Noise Calculation Class
============================
This software has the ReadNoiseCalc class. This class calculates the read noise
of the SPARC4 EMCCDs as a function of their operation mode. The calculations
are done based on a series of characterization of the SPARC4 cameras. For th... | 2.953125 | 3 |
src/ralph_scrooge/plugins/collect/ralph3_profit_center.py | ar4s/ralph_pricing | 0 | 12765948 | <reponame>ar4s/ralph_pricing
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from django.db import transaction
# TODO(xor-xor): BusinessLine should be renamed to BusinessSegmen... | 1.78125 | 2 |
lowercase.py | dash219/linux-pipe-spellcheck | 0 | 12765949 | #!/usr/bin/python3
import sys
while True:
for line in sys.stdin:
lline = line.lower()
sys.stdout.write(lline)
sys.stdout.write("\n")
break | 2.953125 | 3 |
alipay/aop/api/domain/StageGroupInfoVO.py | antopen/alipay-sdk-python-all | 213 | 12765950 | <filename>alipay/aop/api/domain/StageGroupInfoVO.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.StageCateInfoVO import StageCateInfoVO
class StageGroupInfoVO(object):
def __init__(self):
self._group_name = None... | 1.90625 | 2 |