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 |
|---|---|---|---|---|---|---|
peek_storage/_private/service/sw_install/PeekSwInstallManager.py | Synerty/peek-storage | 0 | 12779551 | from peek_platform import PeekPlatformConfig
from peek_platform.sw_install.PeekSwInstallManagerABC import PeekSwInstallManagerABC
__author__ = 'synerty'
class PeekSwInstallManager(PeekSwInstallManagerABC):
def _stopCode(self):
PeekPlatformConfig.pluginLoader.stopOptionalPlugins()
PeekPlatformCon... | 1.726563 | 2 |
tests/test_team.py | aspic2/NCAABB | 1 | 12779552 |
import unittest
from ncaabb import team
class TestTeam(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.team_one = team.Team(["Team One", "Region", 1, True, 30, 30])
def test_calculate_rating(self):
self.assertNotEqual(self.team_one, self.team_one.calculate_rating()... | 3.21875 | 3 |
test_hash_to_curve.py | ANSIIRU/BLS12_381-small_memory_c- | 0 | 12779553 | <gh_stars>0
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Name: H2C_BLS381G1.py
# Purpose:
#
# Author: <NAME>
#
# Created: 2/3/2022
# Copyright: (c) sakamoto 2022
# Licence: <your licence>
#-----------------------------------------------... | 1.945313 | 2 |
assn5/palindrome.py | vardhan2000/1st-sem-python-assignments | 0 | 12779554 | def recurse(n, i):
## Your code - begin
n1 = [j.lower() for j in n] # converting each of the element to lowercase
if i == int((len(n1) - 1) / 2) and (n1[i] == n1[len(n1) - i - 1]):
return True
elif i <= int((len(n1) - 1) / 2) and (n1[i] != n1[len(n1) - i - 1]):
return False
else:
return recurse(n, i + 1)
#... | 3.875 | 4 |
bot.py | newkozlukov/cian_bot | 0 | 12779555 | <reponame>newkozlukov/cian_bot<filename>bot.py
import argparse
import collections
import copy
import datetime
import hashlib
import io
import itertools
import json
import logging
import os
import os.path as osp
from contextlib import ExitStack
import attr
import requests
import cian_parser
from cian_parser import get... | 2.078125 | 2 |
source/utils/__init__.py | LukasErlenbach/active_learning_bnn | 2 | 12779556 | <reponame>LukasErlenbach/active_learning_bnn
from .global_variables import set_global_var, get_global_var
from .timing import secs_to_str
from .yaml_load_dump import load_complete_config_yaml, dump_complete_config_yaml
from .default_configs import (
default_al_schedule,
default_train_schedule,
default_net_c... | 1.28125 | 1 |
plugins/lookup/netbox.py | loganbest/ansible_modules | 1 | 12779557 | # -*- coding: utf-8 -*-
# Copyright: (c) 2019. <NAME> <<EMAIL>>
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
netbox.py
A lookup function designed to return data from the Netbox application
"""
from __future__ import absolute_import, division, print_function
from... | 2.453125 | 2 |
icekit/utils/search/views.py | ic-labs/django-icekit | 52 | 12779558 | from django.conf import settings
from haystack.backends import SQ
from haystack.generic_views import SearchView
from haystack.inputs import AutoQuery
from haystack.query import SearchQuerySet
# convert the subfacet settings to Facet objects
from facets import Facet
SEARCH_SUBFACETS = getattr(settings, "SEARCH_SUBFAC... | 2.359375 | 2 |
pre_proc/tests/test_file_fix/test_copy_attribute.py | PRIMAVERA-H2020/pre-proc | 0 | 12779559 | <reponame>PRIMAVERA-H2020/pre-proc<gh_stars>0
"""
test_attribute_add.py
Unit tests for all FileFix concrete classes from attribute_add.py
"""
import subprocess
import unittest
import mock
from pre_proc.exceptions import AttributeNotFoundError
from pre_proc.file_fix import (ParentSourceIdFromSourceId,
... | 2.140625 | 2 |
src/stray/segmentation.py | StrayRobots/stray | 1 | 12779560 | import os
from stray.scene import Scene
from stray.renderer import Renderer
import numpy as np
import pycocotools.mask as mask_util
import pickle
def write_segmentation_masks(scene_path):
scene = Scene(scene_path)
renderer = Renderer(scene)
segmentation_parent_path = os.path.join(scene_path, "segmentation... | 2.421875 | 2 |
lizty-liztz.py | sgriffith3/2020-12-07-PyNDE | 1 | 12779561 | <gh_stars>1-10
#!/usr/bin/env python3
pets = [["dogs", "cats", "fish"], ["iguana", "tortoise", "llama"]]
# index 0 1
print(pets[0])
# pets[0] = ['dogs', 'cats', 'fish']
# index 0 1 2
normal_pets = pets[0]
print(normal_pets[2])
print(pets[0][1])
print(pets[1])... | 3.171875 | 3 |
05_python_intermedio/modulo_IV_conceptos_avanzados_de_funciones/complementos/pildorasinformaticas/funciones_lambda/practica00.py | EdinsonRequena/articicial-inteligence-and-data-science | 30 | 12779562 | <filename>05_python_intermedio/modulo_IV_conceptos_avanzados_de_funciones/complementos/pildorasinformaticas/funciones_lambda/practica00.py
"""
Tema: Funciones Lambda
Curso: Python.
Plataforma: Youtube.
Profesor: <NAME> (Pildoras informaticas)
Alumno: @edinsonrequena.
"""
# Calcular el area de un triangulo
area_tria... | 3.296875 | 3 |
src/oauth/user_auth/views.py | GoelJatin/django_oauth | 0 | 12779563 | <reponame>GoelJatin/django_oauth
from django.contrib import messages
from django.shortcuts import render, redirect
from django.views import View
from .models import User, UserAuth
from .forms import LoginForm, SignupForm
from .encrypt import encrypt
from google_auth.auth_helper import GoogleOauth
GOOGLE_OAUTH = ... | 2.453125 | 2 |
app/migrations/0013_auto_20220203_1618.py | Maryan23/Moringa-Alumni-Backend | 0 | 12779564 | # Generated by Django 3.2.9 on 2022-02-03 13:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0012_auto_20220203_1617'),
]
operations = [
migrations.AlterField(
model_name='fundraiser',
name='end_date',
... | 1.507813 | 2 |
examinator/scratch/20190407_rdir.py | brl0/examinator | 0 | 12779565 | <gh_stars>0
#%%
import os
def rdir(path):
if os.path.isdir(path):
return {path: [rdir(p) if p.is_dir() else p for p in os.scandir(path)]}
return [path]
rdir('.')
| 2.234375 | 2 |
setup.py | mortele/MP-sort | 7 | 12779566 | from setuptools import setup
from Cython.Build import cythonize
from distutils.extension import Extension
from distutils.command.build_ext import build_ext
import numpy
import mpi4py
import os
class build_ext_subclass(build_ext):
user_options = build_ext.user_options + \
[
('mpicc', None, ... | 1.789063 | 2 |
plugs_payments/signals.py | solocompt/plugs-payments | 0 | 12779567 | <gh_stars>0
"""
Plugs Payments Signals
"""
from django.dispatch import Signal
# sent when a validated ifthen payment received
valid_ifthen_payment_received = Signal()
# sent when an invalid payment received
# could be an error with a reference, value or entity
# cannot be the anti phishing key
invalid_ifthen_payment... | 1.75 | 2 |
valueIterationAgents.py | abhinavcreed13/ai-reinforcement-learning | 0 | 12779568 | <reponame>abhinavcreed13/ai-reinforcement-learning<gh_stars>0
# valueIterationAgents.py
# -----------------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you prov... | 2.5625 | 3 |
get_level_data.py.py | wjsutton/super_mario_bros_level_details | 0 | 12779569 | <reponame>wjsutton/super_mario_bros_level_details
import requests
from bs4 import BeautifulSoup
import pandas as pd
from time import sleep
# read csv of all page urls
worlds = pd.read_csv('world_pages.csv')
worlds_pages = worlds['world'].tolist()
# function to turn html tables into dataframes
def tableDataText(table)... | 2.90625 | 3 |
tests/rules/test_garbage_symbols.py | gitter-badger/arche | 0 | 12779570 | <gh_stars>0
from arche import SH_URL
from arche.rules.garbage_symbols import garbage_symbols
from arche.rules.result import Level
from conftest import create_result
import pytest
dirty_inputs = [
(
[
{
"_key": f"{SH_URL}/112358/13/21/item/0",
"name": " <NAME>",
... | 2.0625 | 2 |
src/python/defs.py | sloorush/ebpf-keylogger | 0 | 12779571 | import os, sys
ticksleep = 0.1
project_path = os.path.realpath(os.path.join(os.path.dirname(__file__), "../.."))
| 1.539063 | 2 |
music_random.py | rnsribeiro/RenomearEmMassa | 0 | 12779572 | import os
from random import randint
for name in os.listdir('pendrive'):
newname='{}.mp3'.format(randint(0,1000000))
os.rename("pendrive/"+name,"pendrive/"+newname)
| 2.6875 | 3 |
app/python/zbrank/src/rank_start.py | fengshiyou/live | 0 | 12779573 | # -*- coding: UTF-8 -*-
# 自定义py导入开始
# from getList import getList
import zbrank
# 导入拓展包开始
import json
import time
# 导入拓展包结束
# 自定义py导入结束
now = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
class status_start:
def __init__(self):
# 主url
self.main_url = "http://www.zbrank.com/ra... | 2.609375 | 3 |
krake/krake/api/app.py | rak-n-rok/Krake | 1 | 12779574 | <filename>krake/krake/api/app.py
"""This module defines the bootstrap function for creating the aiohttp server
instance serving Krake's HTTP API.
Krake serves multiple APIs for different technologies, e.g. the core
functionality like roles and role bindings are served by the
:mod:`krake.api.core` API where as the Kube... | 2.5 | 2 |
tensornetwork/backends/tensorflow/tensorflow_tensornetwork_test.py | khanhgithead/TensorNetwork | 1,681 | 12779575 | """Tests for graphmode_tensornetwork."""
import numpy as np
import tensorflow as tf
from tensornetwork import (contract, connect, flatten_edges_between,
contract_between, Node)
import pytest
class GraphmodeTensorNetworkTest(tf.test.TestCase):
def test_basic_graphmode(self):
# pylint:... | 2.4375 | 2 |
book-code/numpy-ml/numpy_ml/rl_models/agents.py | yangninghua/code_library | 0 | 12779576 | <reponame>yangninghua/code_library
"""Reinforcement learning agents that can be run on OpenAI gym environs"""
from abc import ABC, abstractmethod
from collections import defaultdict
import numpy as np
from .rl_utils import EnvModel, env_stats, tile_state_space
from ..utils.data_structures import Dict
class AgentBa... | 2.84375 | 3 |
wirehome.services.tradfri.gateway_manager/1.0.0/script.py | chkr1011/Wirehome.Repository | 0 | 12779577 | <reponame>chkr1011/Wirehome.Repository<filename>wirehome.services.tradfri.gateway_manager/1.0.0/script.py
import json
import sys
from time import sleep
TIMER_ID = "wirehome.tradfri.gateway_manager.polling"
config = {}
wirehome = {}
_devices = {}
_gateway_is_connected = False
def initialize():
# wirehome.debugge... | 2.09375 | 2 |
py/optimisation_update_heating_cooling_cop.py | Tokarzewski/db-scripts | 0 | 12779578 | <reponame>Tokarzewski/db-scripts
import ctypes
from eppy import modeleditor
from eppy.modeleditor import IDF
def show_message(title, text):
ctypes.windll.user32.MessageBoxW(0, text, title, 0)
def before_energy_simulation():
IDF.setiddname(api_environment.EnergyPlusInputIddPath)
idf_file = IDF(api_envir... | 2.484375 | 2 |
basic-python/code.py | abidraza451/greyatom-python-for-data-science | 0 | 12779579 | # --------------
class_1 =['<NAME>','<NAME>','<NAME>','<NAME>']
class_2 =['<NAME>','<NAME>','<NAME>']
new_class = class_1 + class_2
print(new_class)
new_class.append('<NAME>')
print(new_class)
new_class.remove('<NAME>')
print(new_class)
courses ={'Math':65,'English':70,'History':80,'French':70,'Science':60}
... | 3.625 | 4 |
month01/day06/exercise01.py | Amiao-miao/all-codes | 1 | 12779580 | <filename>month01/day06/exercise01.py
"""
根据月日,计算是这一年的第几天.
公式:前几个月总天数 + 当月天数
例如:5月10日
计算:31 29 31 30 + 10
"""
year=int(input("请输入年:"))
month=int(input("输入月:"))
day=int(input("输入日:"))
day_of_month02=29 if year % 4 == 0 and year % 100 != 0 or year % 400 == 0 else 28
days_of_month=(31,29,31,30,31,30,31... | 3.75 | 4 |
runtests.py | prohfesor/tapiriik | 1,445 | 12779581 | <reponame>prohfesor/tapiriik
import tapiriik.database
tapiriik.database.db = tapiriik.database._connection["tapiriik_test"]
tapiriik.database.cachedb = tapiriik.database._connection["tapiriik_cache_test"]
from tapiriik.testing import *
import unittest
unittest.main()
tapiriik.database._connection.drop_database("tapir... | 1.703125 | 2 |
django_job/users/admin.py | Mohitkaushal97/File | 0 | 12779582 | <filename>django_job/users/admin.py
# from allauth.account.models import EmailAddress
# from django.contrib import admin
# from django.contrib.auth import admin as auth_admin
# from django.contrib.auth import get_user_model
# from django_job.users.forms import UserCreationForm, UserChangeForm
#
# User = get_user_... | 2.15625 | 2 |
hpvm/test/dnn_benchmarks/keras/resnet50_imagenet.py | vzyrianov/hpvm-autograd | 0 | 12779583 | import os
import sys
import glob
import numpy as np
import tensorflow as tf
import scipy
import scipy.io
import keras
from keras.models import Model, Sequential
from keras.layers import *
from keras.optimizers import Adam
from keras import regularizers
from keras import backend as K
from keras.utils import to_categori... | 2.546875 | 3 |
parser_cnpj_raw_files_c.py | cadu-leite/CNPJ_cad_pub | 0 | 12779584 | from resource import *
import psutil
from collections import defaultdict
# FILE_IN_PATH = 'K3241.K03200DV.D00422.L00001'
FILE_IN_PATH = '/Users/cadu/Downloads/datasets/dadosabertos_CNPjs/K3241.K03200DV.D00422.L00001'
FILE_OUT_PATH = 'output.txt'
# head
# posicao de inicio da linha e TAMANHO de registros
# ini = acc(... | 2.140625 | 2 |
connect_youtube_uploader/core.py | linaro-marketing/connect_youtube_uploader | 0 | 12779585 |
#!/usr/bin/python3
from apiclient.http import MediaFileUpload
from apiclient.errors import HttpError
from apiclient.discovery import build
import time
import sys
import random
import os
import httplib2
import json
import boto3
import requests
try:
import httplib
except ImportError: # python3 compatibility
f... | 2.515625 | 3 |
koku/providers/azure/client.py | rubik-ai/koku | 157 | 12779586 | #
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Azure Client Configuration."""
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.costmanagement import CostManagementClient
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.storage import St... | 2.1875 | 2 |
year_2020/day23/test_day23.py | mjalkio/advent-of-code | 0 | 12779587 | import pytest
from year_2020.day23.crab_cups import get_crab_cups
TEST_INPUT = "389125467"
@pytest.mark.parametrize("num_moves, expected", [(10, "92658374"), (100, "67384529")])
def test_get_crap_cups(num_moves, expected):
assert get_crab_cups(TEST_INPUT, num_moves=num_moves) == expected
@pytest.mark.slow
def... | 2.65625 | 3 |
meetings/osf_oauth2_adapter/adapter.py | CenterForOpenScience/osf-meetings | 0 | 12779588 | from allauth.account.adapter import DefaultAccountAdapter
from django.conf import settings
import urlparse
class OsfMeetingsAdapter(DefaultAccountAdapter):
def get_login_redirect_url(self, request):
try:
refererUrl = request.environ['HTTP_REFERER']
nextUrl = urlparse.parse_qs(
... | 1.757813 | 2 |
django_digest/test/__init__.py | gushil/django-digest | 5 | 12779589 | <reponame>gushil/django-digest
from __future__ import absolute_import
from __future__ import unicode_literals
import django.test
from django_digest.test.methods.basic import BasicAuth
from django_digest.test.methods.detect import DetectAuth
from django_digest.test.methods.digest import DigestAuth
class Client(django... | 2.359375 | 2 |
Deeplabv3_Ensemble/model/backbone/__init__.py | jackyjsy/CVPR21Chal-Agrivision | 5 | 12779590 | <filename>Deeplabv3_Ensemble/model/backbone/__init__.py
from . import resnet, xception, drn, mobilenet
from .efficientnet import EfficientNet
from .sw import backbones
def build_backbone(backbone, output_stride, ibn_mode, BatchNorm):
if backbone == 'resnet50':
return resnet.ResNet50(output_stride, ibn_mode... | 1.90625 | 2 |
build_scene.py | hengwang322/small_scale_PV_data_viz | 1 | 12779591 | """
This script is written and tested in Blender 2.83.1 & BlenderGIS 1.0
"""
import bpy, bmesh, json, os, re
from pathlib import Path
def load_data(data_file):
with open(data_file) as f:
data = json.load(f)
f.close()
return data
def clean_mesh(obj_name):
# Clean up the mesh by delete some... | 2.109375 | 2 |
workspace/models/GLM/model.py | rynpssss/data_science | 0 | 12779592 | # encoding utf-8
import pandas as pd
import numpy as np
import statsmodels.api as sm
from statsmodels.tools import eval_measures
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
class Preprocessing:
def __init__(self, data_raw):
self.data_clean = data_r... | 2.703125 | 3 |
hdrpy/tmo/linear.py | popura/hdrpy | 5 | 12779593 | <filename>hdrpy/tmo/linear.py
from typing import Union, Optional
import numpy as np
from hdrpy.stats import gmean
from hdrpy.image import get_luminance
from hdrpy.tmo import ColorProcessing, LuminanceProcessing
def multiply_scalar(
intensity: np.ndarray,
factor: float,
nan_sub: Optional[float] = 0,
... | 2.703125 | 3 |
tests/test_latest_window.py | omri374/fossa | 0 | 12779594 | <gh_stars>0
"""Tests for the LatestWindowAnomalyDetector."""
import pytest
from sklearn.exceptions import NotFittedError
from fossa import LatestWindowAnomalyDetector
from fossa.utils import dummy_data
def test_base():
num_categ = 8
clf = LatestWindowAnomalyDetector(p_threshold=0.00001)
history = dummy_... | 2.359375 | 2 |
Aulas_2/Aula45/Aula50a.py | Sofista23/Aula2_Python | 0 | 12779595 | <filename>Aulas_2/Aula45/Aula50a.py
import sqlite3
from sqlite3 import Error
#Criar Conexão
def conexaoBanco():
path="C:\\Users\\<NAME>\\Documents\\PROGRAMAÇÃO\\Python\\Aulas_2\\Aula45\\Agenda.db"
con=None
try:
con=sqlite3.connect(path)
except Error as ex:
print(ex)
return con
v... | 3.1875 | 3 |
stellar_sdk/signer.py | bantalon/py-stellar-base | 1 | 12779596 | from .__version__ import __issues__
from .exceptions import ValueError
from .strkey import StrKey
from .xdr import Xdr
__all__ = ["Signer"]
class Signer:
"""The :class:`Signer` object, which represents an account signer on Stellar's network.
:param signer_key: The XDR signer object
:param weight:
""... | 2.1875 | 2 |
pyplot_eps/offdiag_eps.py | marvinlenk/subsystem_entropy_epsplots | 0 | 12779597 | <filename>pyplot_eps/offdiag_eps.py
import numpy as np
import os
from mpEntropy import mpSystem
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy.integrate import cumtrapz
# This is a workaround until scipy fixes the issue
import warnings
warnings.filterwarnings(action="ignore", module="scipy", messa... | 2.078125 | 2 |
setup.py | hanneshapke/pyzillow | 88 | 12779598 | <reponame>hanneshapke/pyzillow<gh_stars>10-100
#!/usr/bin/env python
#
"""
Distutils setup script for pyzillow.
"""
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == "publish":
os.system("python setup.py sdist upload")
... | 1.554688 | 2 |
high-availability-endpoint/python/region_lookup.py | fortunecookiezen/aws-health-tools | 825 | 12779599 | <filename>high-availability-endpoint/python/region_lookup.py
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import dns.resolver
class RegionLookupError(Exception):
"""Rasied when there was a problem when looking up the active region"""
pass
def activ... | 2.890625 | 3 |
django_hits/models.py | bung87/django_hits | 0 | 12779600 | # -*- coding: utf-8 -*-
from django.contrib.contenttypes.models import ContentType
from django.db import models
import django
if (hasattr(django,"version") and django.version > 1.8) or (hasattr(django,"get_version") and django.get_version()):
from django.contrib.contenttypes.fields import GenericForeignKey
from... | 2.0625 | 2 |
understat/constants.py | arkjinli/understat | 0 | 12779601 | BASE_URL = "https://understat.com/"
LEAGUE_URL = "https://understat.com/league/{}/{}"
PLAYER_URL = "https://understat.com/player/{}"
TEAM_URL = "https://understat.com/team/{}/{}"
PATTERN = r"{}\s+=\s+JSON.parse\(\'(.*?)\'\)"
| 1.46875 | 1 |
tests/test_add_metaphor.py | KyleMaclean/Poetry-Generator | 0 | 12779602 | <reponame>KyleMaclean/Poetry-Generator<filename>tests/test_add_metaphor.py<gh_stars>0
from unittest import TestCase
from agents.add_metaphor import do
class Test(TestCase):
# reported
def test_do(self):
actual_line = do('you are beautiful')
self.assertEqual(actual_line, 'you are beautiful as ... | 2.4375 | 2 |
test/utils/expocat_test.py | emthompson-usgs/pager | 9 | 12779603 | #!/usr/bin/env python
# stdlib imports
import urllib.request as request
import tempfile
import os.path
import sys
from datetime import datetime
# third party imports
import numpy as np
# local imports
from losspager.utils.expocat import ExpoCat
def commify(value):
if np.isnan(value):
return 'NaN'
r... | 2.328125 | 2 |
test/python/WMCore_t/JobSplitting_t/Generators_t/AutomaticSeeding_t.py | khurtado/WMCore | 21 | 12779604 | #!/usr/bin/env python
# encoding: utf-8
"""
AutomaticSeeding_t.py
Created by <NAME> on 2010-08-30.
Copyright (c) 2010 Fermilab. All rights reserved.
"""
from __future__ import print_function
import sys
import os
import unittest
from WMCore.JobSplitting.Generators.AutomaticSeeding import AutomaticSeeding
from WMCore... | 2.109375 | 2 |
Z - Tool Box/x2john/ccache2john.py | dfirpaul/Active-Directory-Exploitation-Cheat-Sheet-1 | 1,290 | 12779605 | #!/usr/bin/env python2
"""
This script extracts crackable hashes from krb5's credential cache files (e.g.
/tmp/krb5cc_1000).
NOTE: This attack technique only works against MS Active Directory servers.
This was tested with CentOS 7.4 client running krb5-1.15.1 software against a
Windows 2012 R2 Active Directory serve... | 2.46875 | 2 |
libs/utils/utils.py | niryarden/lyrics_bot | 0 | 12779606 | import configparser
def get_base_url():
parser = configparser.ConfigParser()
parser.read('token.cfg')
token = parser.get('creds', 'token')
return f"https://api.telegram.org/bot{token}/"
| 2.5 | 2 |
companies_app/models.py | sabuhish/document-transfer | 0 | 12779607 | <reponame>sabuhish/document-transfer
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Company(models.Model):
voen = models.IntegerField(verbose_name="Vöen", unique=True)
name = models.CharField(max_length=255, verbose_name="<NAME>")
ceo_first_name ... | 2.390625 | 2 |
server.py | tunicashashi/IBM_Cloud_Flask | 0 | 12779608 | import os
from flask import Flask
from flask import request
try:
from SimpleHTTPServer import SimpleHTTPRequestHandler as Handler
from SocketServer import TCPServer as Server
except ImportError:
from http.server import SimpleHTTPRequestHandler as Handler
from http.server import HTTPServer as Server
# Read por... | 2.953125 | 3 |
DailyProgrammer/DP20121103B.py | DayGitH/Python-Challenges | 2 | 12779609 | """
[11/3/2012] Challenge #110 [Intermediate] Creepy Crawlies
https://www.reddit.com/r/dailyprogrammer/comments/12k3xt/1132012_challenge_110_intermediate_creepy_crawlies/
**Description:**
The web is full of creepy stories, with Reddit's /r/nosleep at the top of this list. Since you're a huge fan of not
sleeping (we a... | 4 | 4 |
sistercities/web/sistercities/sister_graph.py | displayn/sistercities | 2 | 12779610 | # -*- coding: utf-8 -*-
import networkx as nx
from networkx.readwrite import json_graph
import json
def read_json_file(filename: object) -> object:
# from http://stackoverflow.com/a/34665365
"""
:type filename: object
"""
with open(filename.name) as f:
js_graph = json.load(f)
return jso... | 2.84375 | 3 |
source/tagger/dataset/cleaning.py | chrka/cip-tagging-exercise | 0 | 12779611 | import numpy as np
import pandas as pd
import fasttext
from sklearn.preprocessing import MultiLabelBinarizer
from skmultilearn.model_selection import IterativeStratification, \
iterative_train_test_split
from functools import reduce
CIP_TAGS = list(map(lambda x: x.strip(),
"gratis, mat, musik, ... | 2.453125 | 2 |
scripts/parse_plateplan.py | jcbird/ppv | 1 | 12779612 | <filename>scripts/parse_plateplan.py
from astropy.table import Table
from astropy.io.registry import (register_identifier, register_reader,
register_writer)
from pydl.pydlutils.yanny import (is_yanny, read_table_yanny,
write_table_yanny, yanny)
from pat... | 2.25 | 2 |
azure/mgmt/monitor/models/monitor_management_client_enums.py | EnjoyLifeFund/py36pkgs | 2 | 12779613 | <reponame>EnjoyLifeFund/py36pkgs
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) Au... | 2.09375 | 2 |
tests/test_cmd.py | gLhookniano/autoargparse | 0 | 12779614 | <filename>tests/test_cmd.py
#!coding:utf-8
from sys import path as sys_path
from os import path as os_path
import subprocess
import pytest
sys_path.append(os_path.abspath(os_path.join(os_path.dirname(__file__), "../")))
import autoargparse
@pytest.mark.inner
@pytest.mark.parametrize(
"input,stdin,expected",
... | 2.53125 | 3 |
epidag/monitor.py | TimeWz667/PyEpiDAG | 2 | 12779615 | <gh_stars>1-10
import logging
import pandas as pd
__author__ = 'TimeWz667'
__all__ = ['Monitor']
class Monitor:
def __init__(self, name):
self.Title = name
self.Logger = logging.getLogger(name)
self.Logger.setLevel(logging.INFO)
self.Records = []
self.Time = 0
self... | 2.671875 | 3 |
test/dragon/test_autograph.py | seetaresearch/Dragon | 81 | 12779616 | <filename>test/dragon/test_autograph.py<gh_stars>10-100
# ------------------------------------------------------------
# Copyright (c) 2017-present, SeetaTech, Co.,Ltd.
#
# Licensed under the BSD 2-Clause License.
# You should have received a copy of the BSD 2-Clause License
# along with the software. If not, See,
#
# ... | 2.4375 | 2 |
ros_messaging/scripts/message_subscriber.py | emilyxzhou/github-actions-docker | 0 | 12779617 | #!/usr/bin/env python
import rospy
from std_msgs.msg import String
class MessageSubscriber:
def __init__(
self,
node_name,
topic_name
):
rospy.init_node(node_name)
self._topic_name = topic_name
self._subscriber = rospy.Subscriber(
sel... | 2.5625 | 3 |
app/__init__.py | R-Rijnbeek/IFC_WebViewer | 0 | 12779618 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__init__.py: This module define the the webservice function build with Flask
"""
# =============== IMPORTS ==============
from .utils import DeleteJSONFilesFromDirectory, CreateDirectoryIfItNotExist
from .shared import APP, LOG
# =============== PROCESS =============... | 2.546875 | 3 |
mercury/services/custom_exceptions.py | CoffeePerry/mercury-py | 0 | 12779619 | <gh_stars>0
# coding=utf-8
from werkzeug.exceptions import HTTPException
class MethodVersionNotFound(HTTPException):
"""*400* `Method Version Not Found` (Bad Request)
Raise if the browser request method through an invalid method version ('Accept-Version').
(Raise if the browser sends something to the ap... | 2.734375 | 3 |
auxein/playgrounds/__init__.py | auxein/auxein | 1 | 12779620 | # flake8: noqa
from .static import Static
| 0.996094 | 1 |
source/faltas simples no drive/fazerGrafico.py | andrevier/mestrado_ElePot | 0 | 12779621 | <filename>source/faltas simples no drive/fazerGrafico.py
import scipy.io
import matplotlib.pyplot as plt
# Captar os arquivos .mat para um dicionário e do dicionario para uma lista.
fig1 = plt.figure('Valor da corrente média em faltas simples',figsize = (6.3,6.3))
ax = fig1.add_subplot(111)
ax.spines['left'].set_posit... | 2.90625 | 3 |
examples/her/her_sac_gym_fetch_reach.py | Lucaskabela/rlkit | 0 | 12779622 | import gym
import rlkit.torch.pytorch_util as ptu
from rlkit.data_management.obs_dict_replay_buffer import ObsDictRelabelingBuffer, WeightedObsDictRelabelingBuffer
from rlkit.launchers.launcher_util import setup_logger
from rlkit.samplers.data_collector import GoalConditionedPathCollector
from rlkit.torch.her.her impo... | 2.125 | 2 |
dual_encoder/keras_layers_test.py | garyxcheng/federated | 330 | 12779623 | # 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 agreed to in writing... | 2.109375 | 2 |
src/stub_libraries/stub_numpy/stub_numpy.py | sunblaze-ucb/privguard-artifact | 6 | 12779624 | <filename>src/stub_libraries/stub_numpy/stub_numpy.py
# MIT License
# Copyright (c) 2021 sunblaze-ucb
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without ... | 1.984375 | 2 |
main.py | Poojap19create/Sampling-distribution | 0 | 12779625 | <reponame>Poojap19create/Sampling-distribution
import plotly.figure_factory as ff
import plotly.graph_objects as go
import statistics
import random
import pandas as pd
import csv
df = pd.read_csv("data.csv")
data = df["temp"].tolist()
#function to get the mean of the given data samples
# pass the number of data poi... | 3.984375 | 4 |
Examples/Multi-Agent_Examples/OpenAI-Repo/multiagent/scenarios/electricty_market/simple_market2.py | alexanderkell/reinforcement-learning-examples | 0 | 12779626 | <reponame>alexanderkell/reinforcement-learning-examples<filename>Examples/Multi-Agent_Examples/OpenAI-Repo/multiagent/scenarios/electricty_market/simple_market2.py
# import sys
# sys.path.insert(0, '/Users/b1017579/Documents/PhD/Projects/10. ELECSIM')
#
# from src.plants.plant_costs.estimate_costs.estimate_costs import... | 3.453125 | 3 |
eltyer_investing_algorithm_framework/configuration/constants.py | ELTYER/eltyer-investing-algorithm-framework | 0 | 12779627 | <gh_stars>0
ELTYER_CLIENT = "ELTYER_CLIENT"
ELTYER_API_KEY = "ELTYER_API_KEY"
| 0.984375 | 1 |
pcbmode/utils/footprint.py | Hylian/pcbmode | 370 | 12779628 | #!/usr/bin/python
import os
import re
import json
from lxml import etree as et
import pcbmode.config as config
from . import messages as msg
# pcbmode modules
from . import svg
from . import utils
from . import place
import copy
from .style import Style
from .point import Point
from .shape import Shape
class Fo... | 2.75 | 3 |
pysome/maybe.py | mdagaro/pysome | 0 | 12779629 | from typing import (
Any,
Callable,
cast,
Generic,
Mapping,
NoReturn,
Optional,
TypeVar,
Union,
)
from abc import ABC, abstractmethod
from functools import wraps
import math
import collections
from util import *
__all__ = ["Maybe", "Some", "Nothing", "maybe"]
class Maybe(Generic[... | 3.46875 | 3 |
PySort/main.py | Cet500/PythonSorter | 1 | 12779630 | # программа сортировки файлов по папкам по их типу или расширению
import os
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
from conf import conf_ext
print( ' PythonSorter by SI ver 0.5' )
print( '-----------------------------------------------------------' )
... | 2.1875 | 2 |
hepynet/common/common_utils.py | Hepynet/hepynet | 1 | 12779631 | import glob
import logging
import platform
import re
import socket
from typing import Any
logger = logging.getLogger("hepynet")
def get_current_platform_name() -> str:
"""Returns the name of the current platform.
Returns:
str: name of current platform
"""
return platform.platform()
def get... | 2.8125 | 3 |
Binary_Search/162_Find_Peak_Element.py | hren-ron/LeetCode | 0 | 12779632 | '''
A peak element is an element that is greater than its neighbors.
Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return its index.
The array may contain multiple peaks, in that case return the index to any one of the peaks is fine.
You may imagine that nums[-1] = nums[n] = -∞.
Exam... | 3.546875 | 4 |
aether/sdk/auth/utils.py | eHealthAfrica/aether-django-sdk-library | 1 | 12779633 | # Copyright (C) 2019 by eHealth Africa : http://www.eHealthAfrica.org
#
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with
# the License. Y... | 2.109375 | 2 |
tencent/tencent/pipelines.py | huzing2524/spider | 0 | 12779634 | <reponame>huzing2524/spider<gh_stars>0
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
from pymongo import MongoClient
client = MongoClient()
collection = client["tencent"][... | 2.5 | 2 |
src/mdv/plugins/theme_base16.py | AXGKl/terminal_markdown_viewer | 0 | 12779635 | <filename>src/mdv/plugins/theme_base16.py
rules = [
('em', {'font-style': 'italic'}),
('strong', {'font-weight': 'bold'}),
('code', {'font-style': 'italic', 'background-color': 'grey'}),
]
hcs = ['lime', 'maroon', 'purple', 'teal', 'yellow', 'red', 'green', 'silver', 'navy']
for level, hc in zip(range(1, l... | 2.109375 | 2 |
core/function.py | vcowwy/CvT_paddle | 0 | 12779636 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import time
import paddle
from paddle.amp import auto_cast
from .mixup import Mixup
from core.evaluate import accuracy
from utils.comm import comm
def train_one_epoch(config,... | 2.15625 | 2 |
app/controllers/commands.py | pedroermarinho/Dominik | 0 | 12779637 | <filename>app/controllers/commands.py
# -*- coding:utf-8 -*-
import logging
from datetime import datetime
from app.controllers import key_words, functions_db
from fuzzywuzzy import fuzz
from fuzzywuzzy import process
from threading import Thread
class Comando:
logging.warning(__name__)
def __init__(self, _a... | 2.421875 | 2 |
train/losses.py | m2lines/subgrid | 1 | 12779638 | <filename>train/losses.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 2 23:08:26 2020
@author: arthur
In this module we define custom loss functions. In particular we define
a loss function based on the Gaussian likelihood with two parameters,
mean and precision.
"""
import torch
from torch... | 2.8125 | 3 |
rpython/jit/backend/x86/detect_sse2.py | kantai/passe-pypy-taint-tracking | 2 | 12779639 | <filename>rpython/jit/backend/x86/detect_sse2.py
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.rlib.rmmap import alloc, free
def detect_sse2():
data = alloc(4096)
pos = 0
for c in ("\xB8\x01\x00\x00\x00" # MOV EAX, 1
"\x53" # PUSH EBX
... | 2.4375 | 2 |
src/sympy_utilities.py | daschaich/SUSY_QuantumComputing | 0 | 12779640 | <reponame>daschaich/SUSY_QuantumComputing
import src.HamiltonianTerms as hmats
import sympy as sp
import numpy as np
p, q = sp.symbols('p, q', commutative=False)
a, adag = sp.symbols('a, ad', commutative=False)
b, bdag = sp.symbols('b, bd', commutative=False)
m = sp.Symbol('m')
g = sp.Symbol('g')
qp_to_ada = {q: 0... | 2.21875 | 2 |
app/cesium/router.py | code-lab-org/tatc | 0 | 12779641 | <reponame>code-lab-org/tatc<filename>app/cesium/router.py
from fastapi import APIRouter
from fastapi.responses import PlainTextResponse
def get_cesium_router(token):
router = APIRouter()
@router.get("/token", response_class=PlainTextResponse)
async def get_cesium_token():
return token
return ... | 2.3125 | 2 |
tests/test_examples.py | banesullivan/localtileserver | 105 | 12779642 | from localtileserver import examples
def test_get_blue_marble():
client = examples.get_blue_marble()
assert client.metadata()
def test_get_virtual_earth():
client = examples.get_virtual_earth()
assert client.metadata()
def test_get_arcgis():
client = examples.get_arcgis()
assert client.met... | 1.71875 | 2 |
migrations/versions/4dbf686f4380_added_location_to_pr.py | jace/goafunnel | 0 | 12779643 | """Added location to proposal
Revision ID: 4dbf686f4380
Revises: <PASSWORD>
Create Date: 2013-11-08 23:35:43.433963
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '1<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic... | 1.335938 | 1 |
DP/minimumTotal.py | saai/LeetcodePythonSolutions | 0 | 12779644 | class Solution:
# @param triangle, a list of lists of integers
# @return an integer
def minimumTotal(self, triangle):
n = len(triangle)
row = [0 for i in xrange(n)]
row[0] = triangle[0][0]
for i in range(1,n):
m = i+1
pre = row[0] + triangle[i][0]
... | 3.078125 | 3 |
words.py | ColinTing/Python-Specialization | 2 | 12779645 | <gh_stars>1-10
# name = input('Enter file:')
# handle = open(name)
# counts = dict()
# for line in handle:
# words = line.split()
# for word in words:
# counts[word] = counts.get(word,0)+1
# bigcount = None
# bigword = None
# for word,count in counts.items():
# if bigcount is None or count > bigc... | 3.546875 | 4 |
0095_Unique_Binary_Search_Trees_II.py | imguozr/LC-Solutions | 0 | 12779646 | import functools
from typing import List
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
"""
Same thought as LC96, we can generate trees recursively.
If the root of tree is i
The left subtree has a sequenc... | 4.0625 | 4 |
src/transformers/criterions/entropic_regularizer.py | ashim95/wordsalad | 13 | 12779647 | <filename>src/transformers/criterions/entropic_regularizer.py<gh_stars>10-100
import torch
import numpy as np
import math
import torch.nn as nn
class EntropicRegularizer(nn.Module):
def __init__(self, entropy_lambda, ignore_index=None):
super().__init__()
# Specifies a target value that is ignor... | 2.546875 | 3 |
anasymod/viewer/scansion.py | SubjeBilisim/anasymod | 20 | 12779648 | <gh_stars>10-100
from anasymod.viewer.viewer import Viewer
from anasymod.util import call
class ScansionViewer(Viewer):
def view(self):
# build command
#cmd = ['open', '/Applications/Scansion.app', self.target.cfg['vcd_path']]
cmd = ['open', '/Applications/Scansion.app']
# run comm... | 2.203125 | 2 |
example.py | flywheel-apps/safe-python | 0 | 12779649 | <filename>example.py
#!/usr/bin/env python
# Note:
# The above shebang, and setting the file's executable bit, allows the manifest's "command" key to be "./example.py".
# This is ideal as it removes any further bash processing of the gear command.
import json
invocation = json.loads(open('config.json').read())
# No... | 2.5 | 2 |
coworker/services/views.py | upstar77/spacemap | 0 | 12779650 | <reponame>upstar77/spacemap<filename>coworker/services/views.py
from django.shortcuts import render, get_object_or_404, redirect
# Create your views here.
from django.template.response import TemplateResponse
from django.views.generic import DetailView, ListView
from .models import Category, Service
def category_in... | 2.375 | 2 |