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 |
|---|---|---|---|---|---|---|
samle_python.py | sarum90/langmapper | 0 | 31100 | def process(record):
ids = (record.get('idsurface', '') or '').split(' ')
if len(ids) > 4:
return {'language': record['language'],
'longitude': float(record['longitude'] or 0),
'latitude': float(record['latitude'] or 0),
'idsurface': ids}
| 2.765625 | 3 |
aulas/sqldb.py | thiagonantunes/Estudos | 1 | 31101 | import mysql.connector
mydb = mysql.connector.connect(
host ='127.0.0.1',
port = 3306,
user ='root',
password = '',
database="cadastro"
)
cursor = mydb.cursor()
cursor.execute("SELECT * FROM gafanhotos LIMIT 3")
resultado = cursor.fetchall()
for x in resultado:
print(x) | 2.96875 | 3 |
main.py | YunPC/branch-practice | 0 | 31102 | # print function on main branch
result = ['main' if i%5==0 else i for i in range(1, 10+1)]
print(result)
| 3.078125 | 3 |
billing/views.py | SiddhantNaik17/TheBashTeam_website | 0 | 31103 | from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from billing.utils import initiate_transaction
PAYTM_MERCHANT_ID = 'SNeEfa79194346659805'
PAYTM_MERCHANT_KEY = '<KEY>'
def initiate(request):
order_id = request.session['order_id']
response = initiate_transaction(order_... | 1.929688 | 2 |
requests__examples/yahoo_api__rate_currency.py | DazEB2/SimplePyScripts | 117 | 31104 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# TODO: использовать http://www.cbr.ru/scripts/Root.asp?PrtId=SXML или разобраться с данными от query.yahooapis.com
# непонятны некоторые параметры
# TODO: сделать консоль
# TODO: сделать гуй
# TODO: сделать сервер
import requests
rs = requests.... | 2.765625 | 3 |
pexecute/runner_wrapper.py | mikevromen/parallel-execute | 66 | 31105 | import abc
import logging
from datetime import datetime
from .log_adapter import adapt_log
LOGGER = logging.getLogger(__name__)
class RunnerWrapper(abc.ABC):
""" Runner wrapper class """
log = adapt_log(LOGGER, 'RunnerWrapper')
def __init__(self, func_runner, runner_id, key, tracker, log_exception=Tru... | 3.234375 | 3 |
pythonExercicios/desafio027.py | GuilhermeKAC/cursoemvideo-python | 1 | 31106 | nome = input('Dgigite seu nome completo: ')
| 1.71875 | 2 |
src/lib/data_collect/mushroomObserver/api/taxon.py | DCEN-tech/Mushroom_Py-cture_Recognition | 0 | 31107 | # -*- coding: utf-8 -*-
# Import Librairies
#
# Python
import requests
#
# User
from data_collect.mushroomObserver.api import api
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Constants
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TAXON_TABLE_NAME = 'names'
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | 2.4375 | 2 |
hidrocomp/graphics/genpareto.py | clebsonpy/HydroComp | 4 | 31108 | import scipy.stats as stat
import pandas as pd
import plotly.graph_objs as go
from hidrocomp.graphics.distribution_build import DistributionBuild
class GenPareto(DistributionBuild):
def __init__(self, title, shape, location, scale):
super().__init__(title, shape, location, scale)
def cumulative(se... | 2.640625 | 3 |
plugins/misc.py | gorpo/manicomio_bot_heroku | 0 | 31109 | <reponame>gorpo/manicomio_bot_heroku
import html
import re
import random
import amanobot
import aiohttp
from amanobot.exception import TelegramError
import time
from config import bot, sudoers, logs, bot_username
from utils import send_to_dogbin, send_to_hastebin
async def misc(msg):
if msg.get('t... | 2.203125 | 2 |
Sprint1Lecture/Module2/demo1_retrievesElement.py | marianvinas/CS_Notes | 0 | 31110 | """
Challenge #1:
Write a function that retrieves the last n elements from a list.
Examples:
- last([1, 2, 3, 4, 5], 1) ➞ [5]
- last([4, 3, 9, 9, 7, 6], 3) ➞ [9, 7, 6]
- last([1, 2, 3, 4, 5], 7) ➞ "invalid"
- last([1, 2, 3, 4, 5], 0) ➞ []
Notes:
- Return "invalid" if n exceeds the length of the list.
- Return an emp... | 4.0625 | 4 |
PyEngine3D/OpenGLContext/Texture.py | ubuntunux/PyEngine3D | 121 | 31111 | import traceback
import copy
import gc
from ctypes import c_void_p
import itertools
import array
import math
import numpy as np
from OpenGL.GL import *
from PyEngine3D.Common import logger
from PyEngine3D.Utilities import Singleton, GetClassName, Attributes, Profiler
from PyEngine3D.OpenGLContext import OpenGLContex... | 2.03125 | 2 |
flask_app/server.py | lychengr3x/twitter-sentiment-service | 0 | 31112 | <gh_stars>0
"""
A server that responds with two pages, one showing the most recent
100 tweets for given user and the other showing the people that follow
that given user (sorted by the number of followers those users have).
For authentication purposes, the server takes a commandline argument
that indicates the file con... | 3.5625 | 4 |
samples/entity_management.py | czahedi/dialogflow-python-client-v2 | 3 | 31113 | <filename>samples/entity_management.py
#!/usr/bin/env python
# Copyright 2017 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
#... | 1.84375 | 2 |
tests/model/library/api/test_casestep_resource.py | Mozilla-GitHub-Standards/2a028a7541b867ed4d376d6d9a172a6885fe44030078c12a2b9428efabf22ab7 | 0 | 31114 | <reponame>Mozilla-GitHub-Standards/2a028a7541b867ed4d376d6d9a172a6885fe44030078c12a2b9428efabf22ab7
"""
Tests for CaseStepResource api.
"""
from tests.case.api.crud import ApiCrudCases
import logging
mozlogger = logging.getLogger('moztrap.test')
class CaseStepResourceTest(ApiCrudCases):
@property
def fact... | 2.21875 | 2 |
match_shull21.py | drvdputt/dust_fuse_h2 | 0 | 31115 | """Find stars that are both in our sample and in Shull+21"""
import numpy as np
import get_data
from matplotlib import pyplot as plt
data = get_data.get_merged_table()
shull = get_data.get_shull2021()
matches = [name for name in data["Name"] if name in shull["Name"]]
print(len(matches), " matches found")
print(matche... | 3.046875 | 3 |
plot/include/states_lib.py | ABRG-Models/Wilson2018EvoGene | 1 | 31116 | import numpy as np
import matplotlib.pyplot as plt
from collections import Iterable
mrkr1 = 12
mrkr1_inner = 8
fs = 18
# FUNCTION TO TURN NESTED LIST INTO 1D LIST
def flatten(lis):
for item in lis:
if isinstance(item, Iterable) and not isinstance(item, str):
for x in flatten(item):
... | 3.171875 | 3 |
tests/forms/test_dm_boolean_field.py | ramya-chan/digitalmarketplace-utils | 3 | 31117 | import pytest
import wtforms
from dmutils.forms.fields import DMBooleanField
from dmutils.forms.widgets import DMSelectionButtonBase
class BooleanForm(wtforms.Form):
field = DMBooleanField()
@pytest.fixture
def form():
return BooleanForm()
def test_value_is_a_list(form):
assert isinstance(form.field... | 2.40625 | 2 |
Slide21/calculadora_python.py | yuutognr/MiniCursoPython2020 | 2 | 31118 | a = 2 ** 50
b = 2 ** 50 * 3
c = 2 ** 50 * 3 - 1000
d = 400 / 2 ** 50 + 50
print(a,b,c,d) | 2.34375 | 2 |
onadata/libs/models/base_model.py | gushil/kobocat | 38 | 31119 | from django.db import models
class BaseModel(models.Model):
class Meta:
abstract = True
def reload(self):
new_self = self.__class__.objects.get(pk=self.pk)
# Clear and update the old dict.
self.__dict__.clear()
self.__dict__.update(new_self.__dict__)
| 2.625 | 3 |
vikitext/get_text.py | CristinaGHolgado/vikitext | 0 | 31120 | # -*- coding: utf-8 -*-
from bs4 import BeautifulSoup, SoupStrainer
import bs4
import requests
import csv
import pandas as pd
import os
import re
"""
Module 3 : retrieve text from each article & basic preprocess
"""
ignore_sents = ['Les associations Vikidia', 'Répondre au sondage', 'Aller à :',
'Récupérée de « ht... | 2.765625 | 3 |
graph_dataset.py | lvrcek/assembly_graph_utils | 0 | 31121 | <reponame>lvrcek/assembly_graph_utils
import os
import pickle
import subprocess
import dgl
from dgl.data import DGLDataset
import graph_parser
class AssemblyGraphDataset(DGLDataset):
"""
A dataset to store the assembly graphs.
A class that inherits from the DGLDataset and extends the
functionality ... | 2.625 | 3 |
cwa_qr/poster.py | MaZderMind/cwa-qr | 16 | 31122 | import io
import os
from svgutils import transform as svg_utils
import qrcode.image.svg
from cwa_qr import generate_qr_code, CwaEventDescription
class CwaPoster(object):
POSTER_PORTRAIT = 'portrait'
POSTER_LANDSCAPE = 'landscape'
TRANSLATIONS = {
POSTER_PORTRAIT: {
'file': 'poster/p... | 2.28125 | 2 |
nvchecker/api.py | ypsilik/nvchecker | 0 | 31123 | <reponame>ypsilik/nvchecker
# MIT licensed
# Copyright (c) 2020 lilydjwg <<EMAIL>>, et al.
from .httpclient import session, TemporaryError, HTTPError
from .util import (
Entry, BaseWorker, RawResult, VersionResult,
AsyncCache, KeyManager, GetVersionError,
)
from .sortversion import sort_version_keys
from .ctxvars ... | 1.226563 | 1 |
examples/psi4_interface/ccsd.py | maxscheurer/pdaggerq | 37 | 31124 | # pdaggerq - A code for bringing strings of creation / annihilation operators to normal order.
# Copyright (C) 2020 <NAME>
#
# This file is part of the pdaggerq package.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... | 2.421875 | 2 |
pageviews.py | priyankamandikal/arowf | 7 | 31125 | from datetime import date, datetime, timedelta
from traceback import format_exc
from requests import get
pageviews_url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article'
def format_date(d):
return datetime.strftime(d, '%Y%m%d%H')
def article_views(article, project='en.wikipedia', access='all-acce... | 3.046875 | 3 |
nikola/data/themes/base/messages/messages_eo.py | vault-the/nikola | 1 | 31126 | <filename>nikola/data/themes/base/messages/messages_eo.py
# -*- encoding:utf-8 -*-
"""Autogenerated file, do not edit. Submit translations on Transifex."""
MESSAGES = {
"%d min remaining to read": "%d minutoj por legi",
"(active)": "(aktiva)",
"Also available in:": "Ankaŭ disponebla en:",
"Archive": "A... | 1.570313 | 2 |
certbot_dns_desec/dns_desec.py | desec-io/certbot-dns-desec | 4 | 31127 | """DNS Authenticator for deSEC."""
import json
import logging
import time
import requests
import zope.interface
from certbot import errors
from certbot import interfaces
from certbot.plugins import dns_common
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
@zope.interface.implementer(interfaces.... | 2.671875 | 3 |
eeg_project/plot_data.py | nickrose/eeg_ML | 0 | 31128 | <filename>eeg_project/plot_data.py<gh_stars>0
""" some tools for plotting EEG data and doing visual comparison """
from eeg_project.read_data import (my_read_eeg_generic, SAMP_FREQ,
pass_through, accumulate_subject_file_list, files_skip_processing,
sample_file_list, match_types)
import numpy as np
import pandas... | 2.640625 | 3 |
megumin/modulos/admin/mute.py | davitudoplugins1234/WhiterKang | 2 | 31129 | <reponame>davitudoplugins1234/WhiterKang
import asyncio
from pyrogram import filters
from pyrogram.errors import PeerIdInvalid, UserIdInvalid, UsernameInvalid
from pyrogram.types import ChatPermissions, Message
from megumin import megux
from megumin.utils import (
check_bot_rights,
check_rights,
extract_t... | 2.265625 | 2 |
conftest.py | juju-solutions/kubeflow | 0 | 31130 | <reponame>juju-solutions/kubeflow
import argparse
import os
# Use a custom parser that lets us require a variable from one of CLI or environment variable,
# this way we can pass creds through CLI for local testing but via environment variables in CI
class EnvDefault(argparse.Action):
"""Argument parser that accep... | 2.765625 | 3 |
fumi/deployer.py | rmed/fumi | 4 | 31131 | # -*- coding: utf-8 -*-
#
# fumi deployment tool
# https://github.com/rmed/fumi
#
# The MIT License (MIT)
#
# Copyright (c) 2016 <NAME> <<EMAIL>>
#
# 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 Soft... | 1.109375 | 1 |
artap/tests/_test_scikit.py | tamasorosz/artap | 5 | 31132 | import math
import unittest
from scipy import integrate
from ..problem import Problem
from ..algorithm_genetic import NSGAII
from ..algorithm_sweep import SweepAlgorithm
from ..benchmark_functions import Booth
from ..results import Results
from ..operators import LHSGenerator
from ..surrogate_scikit import SurrogateM... | 1.859375 | 2 |
sdk/python/pulumi_kong/_inputs.py | pulumi/pulumi-kong | 4 | 31133 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... | 1.851563 | 2 |
common/__init__.py | timmartin19/pycon-ripozo-tutorial | 0 | 31134 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from logging import config
config.dictConfig({
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'standard': {
'format': '%... | 1.859375 | 2 |
2019_618_PickMaomao/2019_618_PickMaomao.py | yanaizhen/PythonApps | 1 | 31135 | <gh_stars>1-10
# @Time : 2019/06/14 7:55AM
# @Author : HGzhao
# @File : 2019_618_PickMaomao.py
import os,time
def pick_maomao():
print(f"点 合合卡 按钮")
os.system('adb shell input tap 145 1625')
time.sleep(1)
print(f"点 进店找卡 按钮")
os.system('adb shell input tap 841 1660')
time.sleep(13)
pr... | 2.328125 | 2 |
examples/helix-example/helix_example/components/python.py | HELIX-Datasets/helix | 7 | 31136 | from helix import component
class ExamplePythonComponent(component.Component):
"""An example Python component."""
name = "example-python-component"
verbose_name = "Example Python Component"
type = "example"
version = "1.0.0"
description = "An example Python component"
date = "2020-10-20 1... | 2.421875 | 2 |
cdap-stream-clients/python/cdap_stream_client/streamwriter.py | caskdata/cdap-ingest | 5 | 31137 | <filename>cdap-stream-clients/python/cdap_stream_client/streamwriter.py
# -*- coding: utf-8 -*-
# Copyright © 2014 Cask Data, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# ht... | 2.375 | 2 |
ACDCDataManipulator.py | ACDC-paper-double-review/ACDC | 0 | 31138 | <gh_stars>0
import numpy as np
import pandas
import pandas as pd
import torch
import torchvision
import ssl
import gzip
import json
from tqdm import tqdm
from torchvision.datasets.utils import download_url
from MySingletons import MyWord2Vec
from nltk.tokenize import TweetTokenizer
import os
import tarfile... | 2.484375 | 2 |
functions/email_habit_survey.py | jamesshapiro/aws-habit-tracker | 0 | 31139 | import os
import json
import boto3
import datetime
import hashlib
import secrets
import time
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
table_name = os.environ['DDB_TABLE']
ses_client = boto3.client('ses')
ddb_client = boto3.client('dynamodb')
unsubscribe_url = os.environ['UNS... | 1.921875 | 2 |
doc/generate_examples_rst.py | stj/asynctest | 0 | 31140 | # coding: utf-8
import fnmatch
import pathlib
import os.path
import re
import logging
logging.basicConfig(level=logging.INFO)
INCLUDED_SOURCES = ("*.py", )
EXCLUDED_SOURCES = ("__*__.py", )
INCLUDED_SOURCES_REGEX = tuple(re.compile(fnmatch.translate(pattern))
for pattern in INCLUDED_SO... | 2.578125 | 3 |
ml-conversational-analytic-tool/runDataExtraction.py | difince/ml-conversational-analytic-tool | 1 | 31141 | # Copyright 2021 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
import argparse
import os
from githubDataExtraction import GithubDataExtractor
def getRepos(access_token, organization, reaction):
"""
Method to extract data for all repositories in organization
"""
extractor = GithubDataExtractor(a... | 2.671875 | 3 |
src/features/text/build_text_features.py | ClaasM/VideoArticleRetrieval | 0 | 31142 | <gh_stars>0
"""
Reads (article_id, [tokens]) from tokens.pickle and writes:
(article_id, w2v)
(article_id, bow)
"""
import json
import sys
import os
import pickle
import psycopg2
from multiprocessing.pool import Pool
import numpy as np
import zlib
# from gensim.models import Word2Vec
from gensim.models import Word2Ve... | 2.625 | 3 |
2. funcoes/angulo_de_regracao.py | andrebrito16/python-academy | 1 | 31143 | <reponame>andrebrito16/python-academy
from math import sin, radians, asin, degrees
def snell_descartes(n1, n2, teta1):
# n1*sin(teta1) = n2 * sin(teta2)
# teta2 = n1
teta2 = (n1 * sin(radians(teta1)))/n2
return degrees(asin(teta2))
| 3.828125 | 4 |
project/GUI/SlaveGUI/PresentationLayout.py | RemuTeam/Remu | 2 | 31144 | <gh_stars>1-10
from kivy.app import App
from kivy.properties import StringProperty
from kivy.uix.screenmanager import Screen
from Constants.ContentType import ContentType
from Domain.PresentationElement import PresentationElement
class PresentationLayout(Screen):
"""
Fullscreen layout for presenting content
... | 2.640625 | 3 |
src/api/serializers.py | mp5maker/djangoninja | 0 | 31145 | <reponame>mp5maker/djangoninja<filename>src/api/serializers.py
from rest_framework.serializers import (
ModelSerializer,
HyperlinkedIdentityField,
SerializerMethodField,
ValidationError,
)
from django_elasticsearch_dsl_drf.serializers import DocumentSerializer
from .documents import (
ArticleDocum... | 2.171875 | 2 |
apps/core/services/variables.py | Praetorian-Defence/praetorian-api | 2 | 31146 | <gh_stars>1-10
from http import HTTPStatus
from django.http import HttpRequest
from django.utils.translation import gettext_lazy as _
from apps.api.errors import ApiException
from apps.core.models import ApiKey
class VariablesService(object):
def __init__(
self,
request: HttpRequest,
var... | 2.15625 | 2 |
pm4pygpu/format.py | mnghiap/pm4pygpu | 0 | 31147 | from pm4pygpu.constants import Constants
from numba import cuda
import numpy as np
def post_grouping_function(custom_column_activity_code, custom_column_timestamp, custom_column_case_idx, custom_column_pre_activity_code, custom_column_pre_timestamp, custom_column_pre_case, custom_column_variant_number, custom_colu... | 2.203125 | 2 |
userserver/userserver_app/main_app/urls.py | tuvrai/votechain | 0 | 31148 | <reponame>tuvrai/votechain
from django.urls import path, register_converter
from . import views
from django.shortcuts import redirect
app_name = 'main_app'
urlpatterns = [
path('', lambda request: redirect('voting/')),
path('voting/',
views.voting,
name='voting'),
]
| 1.648438 | 2 |
database.py | DevEliran/PokeAPI | 0 | 31149 | <reponame>DevEliran/PokeAPI
from database_utils import PokeDatabase, DB_FILENAME
def get_poke_by_name(poke_name: str) -> dict:
with PokeDatabase(DB_FILENAME) as cursor:
cursor.execute('''SELECT name, type1, type2, sum_stats,
hp, attack, special_attack, defense,
special_defense FROM Po... | 2.609375 | 3 |
python/module/calc/example.py | wjiec/packages | 0 | 31150 | #!/usr/bin/python35
import calc
from calc import mult
print(calc.add(1, 2))
print(calc.dec(2, 3))
print(calc.div(1, 2))
print(mult(2, 3))
| 2.5625 | 3 |
asva/restoring_force/Elastic.py | adc21/asva | 4 | 31151 | <reponame>adc21/asva<gh_stars>1-10
from asva.restoring_force.RestoringForce import RestoringForce
class Elastic(RestoringForce):
def step(self, dis: float) -> None:
# init
self.init_step(dis)
# end
self.end_step(self.k0)
| 2.125 | 2 |
ann_three_body/physics/constants.py | mruijzendaal/python_ann_three_body | 0 | 31152 | <reponame>mruijzendaal/python_ann_three_body<gh_stars>0
G = 6.67408e-11 # N-m2/kg2
#
# Normalize the constants such that m, r, t and v are of the order 10^1.
#
def get_normalization_constants_alphacentauri():
# Normalize the masses to the mass of our sun
m_nd = 1.989e+30 # kg
# Normalize distances ... | 3.015625 | 3 |
assigner/roster_util.py | joshessman/assigner | 24 | 31153 | <reponame>joshessman/assigner
from assigner.backends.base import RepoError
from assigner.config import DuplicateUserError
import logging
logger = logging.getLogger(__name__)
def get_filtered_roster(roster, section, target):
if target:
roster = [s for s in roster if s["username"] == target]
elif sect... | 2.59375 | 3 |
examples/knapsack01.py | rawg/levis | 42 | 31154 | """
Genetic solution to the 0/1 Knapsack Problem.
usage: knapsack01.py [-h] [--data-file DATA_FILE]
[--population-size POPULATION_SIZE]
[--iterations MAX_ITERATIONS] [--mutation MUTATION_PROB]
[--crossover CROSSOVER_PROB] [--seed SEED]
... | 3.4375 | 3 |
Tests/Plot/LamWind/test_Slot_60_plot.py | PMSMcqut/pyleecan-of-manatee | 2 | 31155 | # -*- coding: utf-8 -*-
"""
@date Created on Tue Jan 12 13:54:56 2016
@copyright (C) 2015-2016 EOMYS ENGINEERING.
@author pierre_b
"""
from os.path import join
from unittest import TestCase
import matplotlib.pyplot as plt
from numpy import array, pi, zeros
from pyleecan.Classes.Frame import Frame
from pyleecan.Class... | 2.171875 | 2 |
search/views.py | ashwin31/opensource-job-portal | 1 | 31156 | import json
import math
import re
from django.urls import reverse
from django.http.response import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect, render
from django.template.defaultfilters import slugify
from django.db.models import Q, F
from haystack.query import SQ, SearchQuerySet
from dja... | 1.890625 | 2 |
IslandGIS/feedback/forms.py | eRestin/MezzGIS | 0 | 31157 | <gh_stars>0
from flexipage.forms import FlexiModelForm
from mezzanine.core.forms import Html5Mixin
from django import forms
from models import Feedback
class FeedbackForm(FlexiModelForm, Html5Mixin):
class Meta:
model = Feedback
name = forms.CharField(widget=forms.TextInput(attrs = {'placeholder': 'Na... | 1.984375 | 2 |
research_site/blog/models.py | MatthewTe/research_site | 0 | 31158 | # Importing default django packages:
from django.db import models
from django.template.defaultfilters import slugify
# Importing models from the research core:
from research_core.models import Topic
# Importing 3rd party packages:
from tinymce import models as tinymce_models
class BlogPost(models.Model):
"""The ... | 2.546875 | 3 |
pythonlearn/input.py | kuljotbiring/Python | 0 | 31159 | <filename>pythonlearn/input.py
# Write a program that asks the user what kind of rental car they
# would like. Print a message about that car, such as “Let me see if I can find you
# a Subaru.”
car = input("What type of rental rental car would you like? ")
print(f"Checking database to find a {car}")
# Write a program... | 4.5 | 4 |
compression/nn.py | andiac/localbitsback | 28 | 31160 | from contextlib import contextmanager
import torch
import torch.nn.functional as F
from torch.nn import Module, Parameter
from torch.nn import init
_WN_INIT_STDV = 0.05
_SMALL = 1e-10
_INIT_ENABLED = False
def is_init_enabled():
return _INIT_ENABLED
@contextmanager
def init_mode():
global _INIT_ENABLED
... | 2.578125 | 3 |
dreamerv2/common/nets.py | footoredo/dreamerv2 | 0 | 31161 | <filename>dreamerv2/common/nets.py
import re
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers as tfkl
from tensorflow_probability import distributions as tfd
from tensorflow.keras.mixed_precision import experimental as prec
import common
class EnsembleRSSM(common.Module):
def __in... | 2.078125 | 2 |
catkin_ws/src/00-infrastructure/easy_logs/include/easy_logs/cli/__init__.py | yxiao1996/dev | 2 | 31162 | from .easy_logs_summary_imp import *
from .dropbox_links import *
from .require import * | 1 | 1 |
client/verta/tests/test_versioning/test_code.py | CaptEmulation/modeldb | 0 | 31163 | import pytest
from google.protobuf import json_format
import verta.code
from verta._internal_utils import _git_utils
class TestGit:
def test_no_autocapture(self):
code_ver = verta.code.Git(_autocapture=False)
# protobuf message is empty
assert not json_format.MessageToDict(
... | 2.125 | 2 |
2020/python/day3.py | majormunky/advent_of_code | 0 | 31164 | <gh_stars>0
import sys
import common
import math
def get_filename():
filename = sys.argv[0]
filename = filename.split("/")[-1]
filename = filename.split(".")[0]
return filename
data = common.get_file_contents("data/{}_input.txt".format(get_filename()))
def run_slop_test(right, down):
# holds th... | 3.640625 | 4 |
app/forms.py | makkenno/django_blog | 0 | 31165 | from django import forms
class PostForm(forms.Form):
title = forms.CharField(max_length=30, label='タイトル')
content = forms.CharField(label='内容', widget=forms.Textarea()) | 2.03125 | 2 |
grievance/urls.py | AdarshNandanwar/CMS | 0 | 31166 | from django.urls import path
from django.conf.urls import url
from django.urls import path,include
import grievance.views as VIEWS
from django.conf.urls.static import static
from django.conf import settings
app_name = 'grievance'
urlpatterns =[
# path('', VIEWS.HomeView.as_view())
path('level1/', VIEWS.level1HomeVi... | 1.929688 | 2 |
fgsd_keras_sparse_implementation.py | ethaharikanaidu/FGSD | 0 | 31167 | <filename>fgsd_keras_sparse_implementation.py
'''This is the deep learning implementation in Keras for graph classification based on FGSD graph features.'''
import numpy as np
import scipy.io
import networkx as nx
from grakel import datasets
from scipy import sparse
from sklearn.utils import shuffle
from scipy... | 3.03125 | 3 |
exercicios/exercicio046.py | TayAntony/python | 0 | 31168 | from time import sleep
from cores import *
print(f'{cores["azul"]}Em breve a queima de fogos irá começar...{limpar}')
for c in range(10, -1, -1):
print(c)
sleep(1)
print(f'{cores["vermelho"]}{fx["negrito"]}Feliz ano novo!{limpar} 🎆 🎆')
| 3.09375 | 3 |
database_files/management/commands/database_files_cleanup.py | Edge-On-Demand/django-database-files-3000 | 0 | 31169 | from optparse import make_option
from django.apps import apps
from django.conf import settings
from django.core.files.storage import default_storage
from django.core.management.base import BaseCommand
from django.db.models import FileField, ImageField
from database_files.models import File
class Command(BaseCommand... | 2.046875 | 2 |
tests/test_utils.py | rahultesla/spectacles | 1 | 31170 | from spectacles import utils
from spectacles.logger import GLOBAL_LOGGER as logger
from unittest.mock import MagicMock
import pytest
import unittest
TEST_BASE_URL = "https://test.looker.com"
def test_compose_url_one_path_component():
url = utils.compose_url(TEST_BASE_URL, ["api"])
assert url == "https://test... | 2.28125 | 2 |
Language_Proficiency/Python/06_Itertools/04_itertools-combinations-with-replacement-English.py | canbecerik/HackerRank_solutions | 1 | 31171 | from itertools import combinations_with_replacement
S, k = [i for i in input().split(" ")]
k = int(k)
combs = list(combinations_with_replacement(sorted(S), k))
combs.sort()
[print("".join(i)) for i in combs] | 2.953125 | 3 |
Python files/Utilities.py | Dawlau/adugo | 0 | 31172 | '''
Service class for utility functions that I need throught the app
'''
class Utilities:
@staticmethod
def clickedOn(onScreenCoordinates, grid, cell, clickCoords):
i, j = cell
cellX, cellY = onScreenCoordinates[i][j]
x, y = clickCoords
import math, constants
radius = math.sqrt((cellX - x) * (cellX - x)... | 2.6875 | 3 |
tests/unit_tests/conftest.py | kurumuz/datacrunch-python | 9 | 31173 | import pytest
from unittest.mock import Mock
from datacrunch.http_client.http_client import HTTPClient
BASE_URL = "https://api-testing.datacrunch.io/v1"
ACCESS_TOKEN = "<PASSWORD>"
CLIENT_ID = "0123456789xyz"
@pytest.fixture
def http_client():
auth_service = Mock()
auth_service._access_token = ACCESS_TOKEN
... | 2.46875 | 2 |
apps/cadastro/models/__init__.py | AlcindoSchleder/ERPi-City | 0 | 31174 | # -*- coding: utf-8 -*-
from .base import (
Pessoa,
PessoaFisica,
PessoaJuridica,
Endereco,
Telefone,
Email,
Site,
Banco,
Documento,
COD_UF,
UF_SIGLA,
)
from .empresa import Empresa, MinhaEmpresa
from .cliente import Cliente
from .fornecedor import Fornecedor
from .transport... | 1.125 | 1 |
dnfal/persons/__init__.py | altest-com/dnfal | 0 | 31175 | from .detection import BodyDetector
from .encoding import BodyEncoder | 1.007813 | 1 |
irc.py | entuland/fogibot | 0 | 31176 | import asyncio
import re
from base64 import b64encode
# pattern taken from:
# https://mybuddymichael.com/writings/a-regular-expression-for-irc-messages.html
IRC_MSG_PATTERN = "^(?:[:](\S+) )?(\S+)(?: (?!:)(.+?))?(?: [:](.+))?$"
# class adapted from a sample kindly provided by https://github.com/emersonveenstra
class ... | 2.4375 | 2 |
NaiveNeurals/MLP/activation_functions.py | stovorov/NaiveNeurals | 1 | 31177 | """Module containing definitions of arithmetic functions used by perceptrons"""
from abc import ABC, abstractmethod
import numpy as np
from NaiveNeurals.utils import ErrorAlgorithm
class ActivationFunction(ABC):
"""Abstract function for defining functions"""
label = ''
@staticmethod
@abstractmeth... | 3.640625 | 4 |
alevel.py | youxinweizhi/micropython-nano-gui | 0 | 31178 | # alevel.py Test/demo program for Adafruit ssd1351-based OLED displays
# Adafruit 1.5" 128*128 OLED display: https://www.adafruit.com/product/1431
# Adafruit 1.27" 128*96 display https://www.adafruit.com/product/1673
# The MIT License (MIT)
# Copyright (c) 2018 <NAME>
# Permission is hereby granted, free of charge, ... | 2.046875 | 2 |
postmark_incoming/models.py | hkhanna/django-postmark-incoming | 0 | 31179 | import logging
from django.db import models
logger = logging.getLogger(__name__)
class PostmarkWebhook(models.Model):
received_at = models.DateTimeField(auto_now_add=True)
body = models.JSONField()
headers = models.JSONField()
note = models.TextField(blank=True)
class Status(models.TextChoices):... | 2.140625 | 2 |
models/ClassicNetwork/blocks/resnext_block.py | Dou-Yu-xuan/deep-learning-visal | 150 | 31180 | <filename>models/ClassicNetwork/blocks/resnext_block.py<gh_stars>100-1000
# -*- coding: UTF-8 -*-
"""
@<NAME> 2020_09_08
"""
import torch.nn as nn
import torch.nn.functional as F
from models.blocks.SE_block import SE
from models.blocks.conv_bn import BN_Conv2d
class ResNeXt_Block(nn.Module):
"""
ResNeXt bloc... | 2.421875 | 2 |
email_api/api/migrations/0001_initial.py | PawlikMateusz/DjangoEmailRestApi | 0 | 31181 | <reponame>PawlikMateusz/DjangoEmailRestApi
# Generated by Django 2.0.13 on 2019-02-28 19:18
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operation... | 1.75 | 2 |
snekcord/objects/base.py | asleep-cult/snekcord | 9 | 31182 | from .. import json
from ..exceptions import UnknownObjectError
from ..snowflake import Snowflake
__all__ = ('BaseObject', 'ObjectWrapper')
class _IDField(json.JSONField):
def __init__(self) -> None:
super().__init__('id', repr=True)
def construct(self, value: str) -> Snowflake:
return Snowf... | 2.359375 | 2 |
pyseus/ui/sidebar.py | impergator493/PySeus | 2 | 31183 | """GUI elements for use in the sidebar of the main window.
Classes
-------
**InfoWidget** - Sidebar widget for basic file information.
**MetaWidget** - Sidebar widget for basic metadata.
**ConsoleWidget** - Sidebar widget for basic text output.
"""
from PySide2.QtCore import QSize
from PySide2.QtWidgets import QForm... | 2.828125 | 3 |
problems/bfs/Solution909.py | akalu/cs-problems-python | 0 | 31184 | <filename>problems/bfs/Solution909.py<gh_stars>0
"""
BFS
"""
class Solution909:
pass
| 0.878906 | 1 |
class4/exercise7.py | linkdebian/pynet_course | 0 | 31185 | # Use Netmiko to change the logging buffer size (logging buffered <size>) on pynet-rtr2.
from getpass import getpass
from netmiko import ConnectHandler
def main():
password = <PASSWORD>pass()
pynet_rtr2 = {'device_type': 'cisco_ios', 'ip': '172.16.17.32', 'username': 'pyclass', 'password': password, 'port'... | 2.625 | 3 |
textX-LS/core/setup.py | ipa-mdl/textX-LS | 30 | 31186 | <gh_stars>10-100
# flake8: noqa
import codecs
import os
from platform import python_version
from setuptools import find_packages, setup
PACKAGE_NAME = "textx-ls-core"
VERSION = "0.2.0"
AUTHOR = "<NAME>"
AUTHOR_EMAIL = "<EMAIL>"
DESCRIPTION = (
"a core language server logic for domain specific languages based on t... | 1.671875 | 2 |
tests/tokenizer_spacy.py | tevnpowers/thesis | 2 | 31187 | import string
import spacy
from text_studio.utils.timer import timer
from text_studio.transformer import Transformer
class SpacyTokenizer(Transformer):
def setup(self, stopwords=None, punct=None, lower=True, strip=True):
spacy.cli.download("en_core_web_sm")
self.nlp = spacy.load(
"en_... | 2.671875 | 3 |
lib/ndk/extypes.py | clayne/syringe-1 | 0 | 31188 | import ptypes
from ptypes import *
from . import umtypes, ketypes, mmtypes
from .datatypes import *
class SYSTEM_INFORMATION_CLASS(pint.enum):
_values_ = [(n, v) for v, n in [
(0, 'SystemBasicInformation'),
(1, 'SystemProcessorInformation'),
(2, 'SystemPerformanceInformation'),
(3,... | 2.140625 | 2 |
spyke/enginePreview.py | m4reQ/spyke | 0 | 31189 | from OpenGL import GL
from PIL import Image
from pathlib import Path
import numpy as np
import gc
import os
import ctypes
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1
VBO = None
VAO = None
TEXTURE = None
SHADER = None
vertexData = [
-1.0, -1.0, 0.0, 0.0, 1.0,
-1.0, 1.0, 0.0, 0.0, 0.0,
1.0, 1.0, 0.0, 1.0,... | 2.015625 | 2 |
cses-problem-set/1629 Movie Festival.py | jaredliw/python-question-bank | 1 | 31190 | # Time: 0.72 s
movies = []
for _ in range(int(input())):
movies.append(tuple(map(int, input().split())))
movies.sort(key=lambda x: x[1])
last_end_time = 0
movie_count = 0
for start_time, end_time in movies:
if start_time >= last_end_time:
last_end_time = end_time
movie_count += 1
print(movi... | 3.140625 | 3 |
YOLOv1/config.py | SkyLord2/Yolo-v1-by-keras | 0 | 31191 | import os
'''
path and dataset parameter
配置文件
'''
DATA_PATH = 'data'
PASCAL_PATH = os.path.join(DATA_PATH, 'pascal_voc')
CACHE_PATH = os.path.join(PASCAL_PATH, 'cache')
OUTPUT_DIR = os.path.join(PASCAL_PATH, 'output') # 存放输出文件的地方,data/pascal_voc/output
WEIGHTS_DIR = os.path.join(PASCAL_PATH, 'weights') # ... | 2.21875 | 2 |
sarna/auxiliary/user_helpers.py | rsrdesarrollo/sarna | 25 | 31192 | <reponame>rsrdesarrollo/sarna<filename>sarna/auxiliary/user_helpers.py
from typing import List
from wtforms import ValidationError
from sarna.core.roles import valid_auditors, valid_managers
from sarna.model import User
def users_are_managers(_, field):
users: List[User] = field.data
if type(users) != list... | 2.53125 | 3 |
geo/bms/old/models.py | Tamlyn78/geo | 0 | 31193 | from os.path import join, splitext
from uuid import uuid4
import datetime
from django.db import models
#from django.utils.encoding import python_2_unicode_compatible
from django.utils import timezone
from django.urls import reverse
from django.contrib.auth.models import User
# Create your models here.
#@... | 2.21875 | 2 |
2020_April_Leetcode_30_days_challenge/Week_1_Happy Number/by_cycle_detection.py | coderMaruf/leetcode-1 | 32 | 31194 | <filename>2020_April_Leetcode_30_days_challenge/Week_1_Happy Number/by_cycle_detection.py<gh_stars>10-100
'''
Description:
Write an algorithm to determine if a number n is "happy".
A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the sq... | 4.03125 | 4 |
waimai/libs/shopping.py | xucheng11/test | 0 | 31195 | <gh_stars>0
"""
-------------------------------------------------
# @Project :外卖系统
# @File :shopping
# @Date :2021/8/8 10:21
# @Author :小成
# @Email :<PASSWORD>
# @Software :PyCharm
-------------------------------------------------
"""
import requests,os
from conf.host import *
from libs.login import *
fro... | 3.078125 | 3 |
winsniffer/gui/frame_formatting.py | netaneld122/winsniffer | 0 | 31196 | import binascii
from winsniffer.gui.parsing.default_parser import DefaultParser
def prettify_mac_address(mac_address):
return ':'.join(map(binascii.hexlify, mac_address))
def get_protocol_stack(frame):
protocols = []
while hasattr(frame, 'data'):
protocols.append(frame.__class__.__name__)
... | 2.609375 | 3 |
matury/2020pr/zad42.py | bartekpacia/informatyka-frycz | 2 | 31197 | <filename>matury/2020pr/zad42.py<gh_stars>1-10
from typing import List
from reader import read_nums
nums = read_nums()
longest_reg_fragment: List[int] = []
reg_fragment: List[int] = []
current_gap = nums[1] - nums[0]
for i in range(1, len(nums)):
num1 = nums[i - 1]
num2 = nums[i]
gap = abs(num1 - num2)
... | 3.15625 | 3 |
satchmo/apps/satchmo_store/shop/satchmo_settings.py | predatell/satchmo | 16 | 31198 | """A central mechanism for shop-wide settings which have defaults.
Repurposed from Sphene Community Tools: http://sct.sphene.net
"""
from django.conf import settings
satchmo_settings_defaults = {
# Only settings for core `satchmo` applications are defined here,
# (or global settings) -- all other defaults sh... | 2.234375 | 2 |
utils/postprocessing/__init__.py | bdvllrs/misinformation-detection-tensor-embeddings | 7 | 31199 | from utils.postprocessing.PostProcessing import PostProcessing
from utils.postprocessing.SelectLabelsPostprocessor import SelectLabelsPostprocessor
| 1.09375 | 1 |