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 |
|---|---|---|---|---|---|---|
danbooru/utils.py | Hiroshiba/danbooru-library | 0 | 12774351 | # -*- coding: utf-8 -*-
# Copyright 2012 codestation
#
# 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 app... | 2.609375 | 3 |
src/blog/sitemap.py | manyunkai/dannysite4 | 22 | 12774352 | # -*-coding:utf-8 -*-
"""
Created on 2015-05-21
@author: Danny<<EMAIL>>
DannyWork Project
"""
from __future__ import unicode_literals
from django.contrib.sitemaps import Sitemap
from django.core.urlresolvers import reverse
from .models import Blog
class BlogSitemap(Sitemap):
"""
博客 Sitemap
"""
ch... | 2.125 | 2 |
plot.py | andylitalo/ccls_analysis | 0 | 12774353 | """
plot.py defines functions for plotting phase diagrams of complex
coacervate liquid separation.
"""
# standard libraries
import matplotlib.pyplot as plt
from matplotlib import cm # colormap
import numpy as np
import pandas as pd
# custom libraries
import pe
import salt as nacl
# plotting libraries
import plotly.... | 2.8125 | 3 |
tutorial.py | tlmolane/Volt | 0 | 12774354 | <gh_stars>0
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import serialization
private_key = rsa.generate_private_key(
public_exponent = 65537,
key_size = 4096,
back... | 2.296875 | 2 |
algorithms/pripel/tracematcher.py | samadeusfp/ELPaaS | 4 | 12774355 | <filename>algorithms/pripel/tracematcher.py
import sys
from levenshtein import levenshtein as levenshtein
from collections import deque
from pm4py.objects.log import log as event_log
from scipy.optimize import linear_sum_assignment
import random
import numpy as np
class TraceMatcher:
def __init__(self,tv_query_log... | 2.25 | 2 |
internal/nodejs_jest_test/test_sources_aspect.bzl | ColinHeathman/bazel_rules_nodejs_contrib | 14 | 12774356 | <reponame>ColinHeathman/bazel_rules_nodejs_contrib<filename>internal/nodejs_jest_test/test_sources_aspect.bzl<gh_stars>10-100
def _test_sources_aspect_impl(target, ctx):
result = depset()
if hasattr(ctx.rule.attr, "tags") and "NODE_MODULE_MARKER" in ctx.rule.attr.tags:
return struct(node_test_sources=r... | 1.882813 | 2 |
api/data/models/concept_class.py | CO-CONNECT/mapping-pipeline | 4 | 12774357 | from django.db import models
class ConceptClass(models.Model):
concept_class_id = models.CharField(
primary_key=True, max_length=20
)
concept_class_name = models.CharField(
max_length=255
)
concept_class_concept_id = models.IntegerField(
)
class Me... | 2.046875 | 2 |
test/test_bridge.py | jasonpjacobs/systemrdl-compiler | 141 | 12774358 | from unittest_utils import RDLSourceTestCase
class TestBridge(RDLSourceTestCase):
def test_bridge(self):
top = self.compile(
["rdl_src/bridge.rdl"],
"some_bridge"
)
self.assertEqual(
top.find_by_path("some_bridge.ahb.ahb_credits").absolute_address,
... | 2.734375 | 3 |
PYTHON/Fibanacci_numbers_by_replacing_prime_numbers_and_multiples_of_5_by_0.py | ayushyado/HACKTOBERFEST2021-2 | 125 | 12774359 | <gh_stars>100-1000
def is_prime(n):
if n > 1:
for i in range(2, n // 2 + 1):
if (n % i) == 0:
return False
else:
return True
else:
return False
def fibonacci(n):
n1, n2 = 1, 1
count = 0
if n == 1:
print(n1)
else:
... | 4.03125 | 4 |
hackerrank/Algorithms/Lego Blocks/solution.py | ATrain951/01.python-com_Qproject | 4 | 12774360 | <gh_stars>1-10
#!/bin/python3
import os
#
# Complete the legoBlocks function below.
#
def legoBlocks(n, m):
#
# Write your code here.
#
mod = 1000000007 # 10 ** 9 + 7
height = n % mod
width = m % mod
# The number of combinations to build a single row
row_combinations = [1, 1, 2, 4]
... | 3.546875 | 4 |
src/atcoder/abc014/d/sol_6.py | kagemeka/competitive-programming | 1 | 12774361 | import typing
import sys
import numpy as np
import numba as nb
@nb.njit
def csgraph_to_directed(g: np.ndarray) -> np.ndarray:
m = len(g)
g = np.vstack((g, g))
g[m:, :2] = g[m:, 1::-1]
return g
@nb.njit
def sort_csgraph(
n: int,
g: np.ndarray,
) -> typing.Tuple[np.ndarray, np.ndarray, np.ndarra... | 2.609375 | 3 |
cross3d/motionbuilder/motionbuilderscene.py | vedantirb/cross3d | 129 | 12774362 | ##
# \namespace cross3d.softimage.motionbuilderscene
#
# \remarks The MotionBuilderScene class will define all the operations for Motion Builder scene interaction.
#
# \author douglas
# \author Blur Studio
# \date 06/21/12
#
import pyfbsdk as mob
from cross3d.abstract.abstractscene import AbstractScene
from PyQt... | 2.359375 | 2 |
src/secimtools/visualManager/module_scatter.py | GalaxyDream/SECIMTools | 0 | 12774363 | <reponame>GalaxyDream/SECIMTools<filename>src/secimtools/visualManager/module_scatter.py<gh_stars>0
######################################################################################
# Date: 2016/July/11
#
# Module: module_2DScatter.py
#
# VERSION: 0.9
#
# AUTHOR: <NAME> (<EMAIL>);
# edited by <NAME>(<EM... | 2.5625 | 3 |
stix_shifter_modules/csa/stix_translation/data_mapper.py | remkohdev/stix-shifter | 0 | 12774364 | from os import path
import json
import re
from stix_shifter_utils.stix_translation.src.utils.exceptions import DataMappingException
from stix_shifter_utils.modules.base.stix_translation.base_data_mapper import BaseDataMapper
def _fetch_mapping(dialect=''):
try:
if dialect != '':
dialect = dial... | 2.25 | 2 |
models/RSA.py | judithfan/graphcomm | 2 | 12774365 | <reponame>judithfan/graphcomm
from __future__ import division
import os
import thread
import subprocess
import numpy as np
import sys
analysis_path = '../analysis'
if analysis_path not in sys.path:
sys.path.append(analysis_path)
import analysis_helpers as h
### python RSA.py --wppl BDA --perception human multimoda... | 2.046875 | 2 |
flask_secret_generator.py | amahlaka/SpotifyPythonControl | 1 | 12774366 | <filename>flask_secret_generator.py
import random
import string
def generate_activation_token():
secret = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(64))
print(secret)
generate_activation_token() | 2.9375 | 3 |
categories/urls.py | aykutgk/GoNaturalistic | 0 | 12774367 | from django.conf.urls import patterns, url
from categories import views
urlpatterns = patterns('',
# /categories/
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<slug>[-_\w]+)/$', views.CategoryPageView.as_view(), name='categoryPage'),
)
| 1.90625 | 2 |
LeetCode/algorithms/best-time-to-buy-and-sell-stock-iii/solution.py | cuihaoleo/exercises | 1 | 12774368 | <filename>LeetCode/algorithms/best-time-to-buy-and-sell-stock-iii/solution.py
class Solution:
def maxProfit(self, prices: List[int]) -> int:
running_min = prices[0]
best_trans1 = [0]
for p in prices[1:]:
if p < running_min:
running_min = p
best_trans... | 3.53125 | 4 |
tests/test_views.py | art1415926535/django-rest-framework-include-mixin | 0 | 12774369 | <gh_stars>0
# Third Party
from model_mommy import mommy
# Django
from django.contrib.auth.models import Group, User
from django.test import TransactionTestCase
# Rest Framework
from rest_framework import status
from rest_framework.test import APIClient
# Project apps
from tests.models import UserProfile
class Test... | 2.140625 | 2 |
craftassist/agent/voxel_models/detection-transformer/datasets/voc2012.py | kandluis/droidlet | 669 | 12774370 | """
Copyright (c) Facebook, Inc. and its affiliates.
"""
from .voc import VOCDetection
from typing import Iterable
import to_coco_api
VOC_PATH = "/datasets01/VOC/060817/"
class VOCDetection2012(VOCDetection):
def __init__(self, image_set: str = "train", transforms: Iterable = None):
super(VOCDetection, ... | 2.28125 | 2 |
make_splits.py | yandex-research/crosslingual_winograd | 6 | 12774371 | <filename>make_splits.py
import argparse
import random
import numpy as np
from sklearn.model_selection import train_test_split
def set_seed(s):
random.seed(s)
np.random.seed(s)
def get_examples(filename, use_lang, split=0., seed=1):
texts = []
with open(filename, encoding='utf-8') as ifh:
f... | 2.8125 | 3 |
templates/document-a4/etc/settings.py | mayersre/sphinx-gitlab-quickstart | 0 | 12774372 | <reponame>mayersre/sphinx-gitlab-quickstart
'''
General settings for the Sphinx-Gitlab-Quickstart (SGQ) project
(c) <NAME>, 2020
MIT License
The Variables are used in the User interfaces. They should reflect your standard setup
GIT_ROOT in this place the new Project will be created
LIB_DIR place things here that a... | 1.765625 | 2 |
reles/modificators.py | GermerCarsten/RelES | 0 | 12774373 | from __future__ import absolute_import
from collections import namedtuple
from time import time
from flask import g
from jsonschema import ValidationError
from reles.references import resolve_field_reference
ProcessingContext = namedtuple(
'ProcessingContext',
('datastore', 'doc_id', 'full_entity', 'full_sc... | 2.34375 | 2 |
examples/tmva/plot_multiclass.py | douglasdavis/root_numpy | 83 | 12774374 | """
=============================================
Multiclass Classification with NumPy and TMVA
=============================================
"""
from array import array
import numpy as np
from numpy.random import RandomState
from root_numpy.tmva import add_classification_events, evaluate_reader
from root_numpy import ... | 2.96875 | 3 |
contact/models.py | deepindo/DoPython | 4 | 12774375 | <reponame>deepindo/DoPython
from django.db import models
from django.utils import timezone
from datetime import datetime
class JD(models.Model):
"""企业招聘信息"""
title = models.CharField(max_length=50, verbose_name='招聘岗位')
description = models.TextField(verbose_name='招聘要求')
publish_date = models.DateTime... | 2.484375 | 2 |
drl_negotiation/scenarios/scml.py | YueNing/tn_source_code | 0 | 12774376 | from drl_negotiation.scenario import BaseScenario
from drl_negotiation.core import TrainWorld, MySCML2020Agent
from drl_negotiation.myagent import MyComponentsBasedAgent
from drl_negotiation.hyperparameters import *
from negmas.helpers import get_class
from scml.scml2020 import (
DecentralizingAgent,
... | 2.15625 | 2 |
python/smurff/cmdline.py | ExaScience/smurff | 65 | 12774377 | <reponame>ExaScience/smurff
#!/usr/bin/env python
import argparse
import smurff.matrix_io as mio
import smurff
def read_list(cfg, prefix):
return [ cfg[d] for d in cfg.keys() if d.startswith(prefix) ]
def read_data(cfg, section):
pos = cfg.get(section, "pos", fallback = None)
if pos is not None:
... | 2.234375 | 2 |
setup.py | erickvneri/st-schema-python | 0 | 12774378 | # MIT License
#
# Copyright (c) 2021 <NAME>
#
# 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 limitation the rights
# to use, copy, modify, merge, publi... | 1.296875 | 1 |
month_time_day.py | camrit/SupplyChainAnalytics | 0 | 12774379 | <gh_stars>0
import datetime
list=["209223000","211409100","211822000","211881000","212048000","215058000","218019000","218779000","219008000","219010252","219082000",
"220018000","220289000","220552000","220609000","220614000","228330600","236216000","240244000","240891000","244013009","244267000",
"244678000","24... | 1.617188 | 2 |
repair/featurize/occurefeatfusion.py | HoloClean/RecordFusion | 2 | 12774380 | from .featurizer import Featurizer
from dataset import AuxTables
from dataset.dataset import dictify
import pandas as pd
import itertools
import torch
from tqdm import tqdm
#GM
class OccurFeaturizerfusion(Featurizer):
def specific_setup(self):
self.name = "OccurFeaturizerfusion"
if not self.setup_do... | 2.375 | 2 |
src/encoded/tests/test_upgrade_organism.py | procha2/encoded | 102 | 12774381 | <filename>src/encoded/tests/test_upgrade_organism.py
import pytest
def test_organism_upgrade(upgrader, organism_1_0):
value = upgrader.upgrade('organism', organism_1_0, target_version='2')
assert value['schema_version'] == '2'
assert value['status'] == 'current'
def test_organism_upgrade_4_5(upgrader, o... | 2.234375 | 2 |
scripts/caffe/convert_caffe_weights_to_npy.py | nnmhuy/flownet2-tf | 438 | 12774382 | <reponame>nnmhuy/flownet2-tf<gh_stars>100-1000
"""
Please read README.md for usage instructions.
Extracts Caffe parameters from a given caffemodel/prototxt to a dictionary of numpy arrays,
ready for conversion to TensorFlow variables. Writes the dictionary to a .npy file.
"""
import argparse
import caffe
import numpy ... | 2.484375 | 2 |
contests_atcoder/abc180/abc180f.py | takelifetime/competitive-programming | 0 | 12774383 | """
dp[i][j][k] = i頂点n辺グラフ長さ最大値kの組み合わせ数
dp[i][j][k] = dp[i - k][n - usededge][_] for _ in range(k + 1)
よくわからん
"""
import math
from operator import mul
from functools import reduce
def comb(n, r):
r = min(r, n - r)
numer = reduce(mul, range(n, n - r, -1), 1)
denom = reduce(mul, range(1, r + 1), 1)
... | 2.53125 | 3 |
methodMap.py | DunderBird/dpylsp | 2 | 12774384 | '''
This file should not be exposed to the user
'''
from . import param as p
from enum import IntEnum
class WorkerType(IntEnum):
'''
select which worker to respond this event
'''
EDITOR = 1
NORMAL = 2
URGENT = 3 # events we need to respond immediately(shutdown...)
class MessageMap:
... | 2.765625 | 3 |
python/app/plugins/http/Tomcat/ajpy.py | taomujian/linbing | 351 | 12774385 | <gh_stars>100-1000
#!/usr/bin/env python
import socket
import struct
def pack_string(s):
if s is None:
return struct.pack(">h", -1)
l = len(s)
return struct.pack(">H%dsb" % l, l, s.encode('utf8'), 0)
def unpack(stream, fmt):
size = struct.calcsize(fmt)
buf = stream.read(size)
return struct.unpack(fmt, buf)
de... | 2.640625 | 3 |
pypStag/stagError.py | AlexandrePFJanin/pypStag | 1 | 12774386 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 30 16:46:12 2019
@author: <NAME>
"""
"""Exceptions raised by pypStag"""
class PypStagError(Exception):
""" Main class for all pypStag """
pass
class PackageWarning(PypStagError):
"""Raised when a precise package is needed"""
def __init__(self,pack)... | 2.234375 | 2 |
context.py | E-tanok/NLTK_stackoverflow_recommender | 1 | 12774387 | import os
dir_path = os.path.dirname(os.path.realpath(__file__))
if dir_path.split('\\')[0] == 'D:':
datasources_path = dir_path+"\datasources\\"
enrichment_path = dir_path+"\enrichment\\"
pickles_path = dir_path+"\pickles\\"
learning_models_path = dir_path+"\learning_models\\"
temp_files_path = dir... | 2.5 | 2 |
Question-05/main.py | gajrajgchouhan/alcyone | 0 | 12774388 | <reponame>gajrajgchouhan/alcyone<filename>Question-05/main.py<gh_stars>0
from astropy.constants import *
import astropy.units as u
from math import sqrt
time_correction_on_earth = 1 / ( 1 - (2 * G * M_earth / (c*c*R_earth)) )**0.5
for _ in range(int(input())):
distance = float(input())
distance = u.Quantity(d... | 2.96875 | 3 |
pythonTFlite/tfliteclassify.py | lkk688/AndroidIntelligentApp | 1 | 12774389 | <reponame>lkk688/AndroidIntelligentApp<gh_stars>1-10
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import argparse
from PIL import Image
import time
import io
import tflite_runtime.interpreter as tflite
def load_labels(filename):
wi... | 2.171875 | 2 |
tests/integration/test_weights_loading.py | jina-ai/encoder-image-torch | 4 | 12774390 | <filename>tests/integration/test_weights_loading.py<gh_stars>1-10
__copyright__ = "Copyright (c) 2021 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
import os
from executor.torch_encoder import ImageTorchEncoder
from pytest_mock import MockerFixture
from torch import hub
def test_load_from_url(tm... | 1.851563 | 2 |
tests/test_coin.py | AustEcon/bitcoinX | 0 | 12774391 | import pytest
from bitcoinx import (
hex_str_to_hash, bits_to_work, bits_to_target, hash_to_value, hash_to_hex_str,
)
from bitcoinx.coin import *
header_400k = (
b'\x04\x00\x00\x009\xfa\x82\x18Hx\x1f\x02z.m\xfa\xbb\xf6\xbd\xa9 \xd9'
b'\xaea\xb64\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\xec\xaeSj0@B\xe3'
... | 2.09375 | 2 |
tensorflow_lattice/python/estimators/calibrated_etl_test.py | agiledots/study-lattice | 0 | 12774392 | # Copyright 2017 The TensorFlow Lattice Authors.
#
# 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 a... | 2 | 2 |
mjolnir/utilities/training_pipeline.py | kdhingra307/ncm | 0 | 12774393 | """
Example script demonstrating the training portion of the MLR pipeline.
This is mostly to demonstrate how everything ties together
To run:
PYSPARK_PYTHON=venv/bin/python spark-submit \
--jars /path/to/mjolnir-with-dependencies.jar \
--artifacts 'mjolnir_venv.zip#venv' \
path/to/training_... | 2.625 | 3 |
accounts/forms.py | dertrockx/social-media-rant | 1 | 12774394 | from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import UserCreationForm
from . import models
class UserCreateForm(UserCreationForm):
class Meta:
fields = ('username', 'email', '<PASSWORD>', '<PASSWORD>')
model = get_user_model()
class UserProfileForm(forms.M... | 2.296875 | 2 |
base/media.py | danielecook/upvote.pub | 1 | 12774395 | # -*- coding: utf-8 -*-
"""
All code for scraping images and videos from posted
links go in this file.
"""
#import BeautifulSoup
import requests
from urllib.parse import urlparse, urlunparse, urljoin
img_extensions = ['jpg', 'jpeg', 'gif', 'png', 'bmp']
def make_abs(url, img_src):
domain = urlparse(url).netloc
... | 3.03125 | 3 |
keyword_annotator.py | ecohealthalliance/grits-api | 3 | 12774396 | <reponame>ecohealthalliance/grits-api<filename>keyword_annotator.py
#!/usr/bin/env python
"""Keyword Annotator"""
from __future__ import absolute_import
from collections import defaultdict
from epitator.annotator import Annotator, AnnoTier, AnnoSpan
from epitator.ngram_annotator import NgramAnnotator
import os
import p... | 2.265625 | 2 |
FaceSwap/Code/traditional/main.py | akathpal/ComputerVision-CMSC733 | 1 | 12774397 | <filename>FaceSwap/Code/traditional/main.py
from tps import thinPlateSpline
from triangulation import triangulation
from facial_landmarks import *
import numpy as np
import cv2
def blending(img1Warped,hull2,img2):
# Calculate Mask
hull8U = []
for i in xrange(0, len(hull2)):
hull8U.append((hull2[i][... | 2.40625 | 2 |
tasks.py | JJ/More-mangas | 0 | 12774398 | from invoke import task, run
@task
def check(c):
'''
Comprobador de la sintaxis del proyecto
'''
print("Comprobando sintaxis...")
run("pyflakes code") # El directorio con todo el código de la aplicación
@task
def test(c):
'''
Realiza los tests del proyecto
'''
print("Realizando los... | 1.945313 | 2 |
metadata/resources/ibis.py | bmampaey/SDA | 0 | 12774399 | <reponame>bmampaey/SDA
# Generated by command write_metadata_files version 1
from metadata.models import Ibis
from .base_metadata import BaseMetadataResource
__all__ = ['IbisResource']
class IbisResource(BaseMetadataResource):
'''RESTful resource for model Ibis'''
class Meta(BaseMetadataResource.Meta):
abstrac... | 1.726563 | 2 |
binstar_client/tests/runner.py | rpk101/anaconda-client | 98 | 12774400 | <gh_stars>10-100
'''
Created on Sep 23, 2013
@author: sean
'''
from unittest.runner import TextTestRunner, TextTestResult
from unittest.signals import registerResult
import time
import sys
WARNING = '\033[33m'
OKBLUE = '\033[34m'
OKGREEN = '\033[32m'
FAIL = '\033[31m'
ENDC = '\033[0m'
BOLD = "\033[1m"
def green(text... | 2.5625 | 3 |
products/tests/factories.py | kevin-ci/janeric2 | 1 | 12774401 | # From hacksoft.io/improve-your-tests-django-fakes-and-factories/
import factory
from faker import Faker
from factory import lazy_attribute
fake = Faker()
class CategoryFactory(factory.django.DjangoModelFactory):
class Meta:
model = 'products.Category'
id = factory.Sequence(lambda n: n)
name = f... | 2.484375 | 2 |
tifa/apps/admin/app.py | twocucao/tifa | 71 | 12774402 | from fastapi_utils.api_model import APIModel
from tifa.apps.admin.local import g
from tifa.apps.admin.router import bp
from tifa.models.app import App
class TApp(APIModel):
id: str
name: str
@bp.list("/apps", out=TApp, summary="App", tags=["App"])
def apps_list():
ins = g.adal.first_or_404(App)
ret... | 2.1875 | 2 |
cadnano/views/pathview/__init__.py | sherwoodyao/cadnano2.5 | 69 | 12774403 | # -*- coding: utf-8 -*-
from cadnano.util import to_dot_path
pp = to_dot_path(__file__)
PathNucleicAcidPartItemT = pp + '.nucleicacidpartitem.PathNucleicAcidPartItem'
PathVirtualHelixItemT = pp + 'virtualhelixitem.PathVirtualHelixItem'
PathStrandItemT = pp + 'strand.stranditem.StrandItem'
PathEndpointItemT = pp + 'stra... | 1.335938 | 1 |
app/bda_core/entities/file/json_handler.py | bda-19fs/bda-chatbot | 1 | 12774404 | <filename>app/bda_core/entities/file/json_handler.py
import json
def from_str_to_json(line):
'''
Converts the given json string to a python dict.
:param line: The input json string
:return: A python dict
'''
return json.loads(line, encoding='utf8')
def dump_json(json_doc):
'''
Conver... | 3.234375 | 3 |
discordbot/utils/torrent.py | he305/discordbot | 0 | 12774405 | import asyncio
import aiohttp
from urllib.parse import urlparse
import shutil
from discordbot.hidden_data import USER_TORRENT, PASSWORD_TORRENT
import transmissionrpc
from discordbot.utils.proxy import Proxy
import logging
log = logging.getLogger(__name__)
class Torrent:
def __init__(self):
try:
... | 2.71875 | 3 |
day060/server.py | avholloway/100DaysOfCode | 0 | 12774406 | <reponame>avholloway/100DaysOfCode<filename>day060/server.py
import json
import requests
from flask import Flask, request, render_template
app = Flask(__name__)
def fetch_posts():
resp = requests.get("https://api.npoint.io/43644ec4f0013682fc0d")
resp.raise_for_status()
return resp.json()
@app.route("/"... | 2.9375 | 3 |
.vim/.ycm_extra_conf.py | artemMur/dotfiles | 0 | 12774407 | <filename>.vim/.ycm_extra_conf.py
from distutils.sysconfig import get_python_inc
import platform
import os
import subprocess
import ycm_core
DIR_OF_THIS_SCRIPT = os.path.abspath( os.path.dirname( __file__ ) )
SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
flags = [
'-Wall',
'-Wextra',
'-... | 2.40625 | 2 |
zeropassweb/passes/forms.py | andreatulimiero/netsec-hs18 | 0 | 12774408 | <reponame>andreatulimiero/netsec-hs18<gh_stars>0
from django import forms
class UsernamePasswordForm(forms.Form):
username = forms.CharField(label='Username')
password = forms.CharField(label='Password', widget=forms.PasswordInput())
class TransactionForm(forms.Form):
from_user = forms.CharField(label='Se... | 2.375 | 2 |
readability/syllables.py | jdkato/readability | 0 | 12774409 | <reponame>jdkato/readability
import re
from typing import Tuple, List
def is_complex(word: str, syllables: int) -> bool:
for suffix in ["es", "ed", "ing"]:
if word.endswith(suffix):
syllables -= 1
return syllables > 2
def count_syllables(word: str) -> int:
"""Return the number of sy... | 3.890625 | 4 |
translator/conf/__init__.py | mail2nsrajesh/heat-translator | 76 | 12774410 | #
# 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, software
# distributed under the ... | 2.25 | 2 |
core.py | jonnelafin/JFUtils-python | 0 | 12774411 | version = "dev 0.0"
running = False
def init():
global running
if not running:
print("JFUtils-python \"" + version + "\" by jonnelafin")
running = True
| 1.65625 | 2 |
dueros/directive/AppLauncher/LaunchApp.py | ayxue/BaiduSaxoOpenAPI | 0 | 12774412 | #!/usr/bin/env python2
# -*- encoding=utf-8 -*-
# description:
# author:jack
# create_time: 2018/1/2
from dueros.directive.BaseDirective import BaseDirective
import logging
class LaunchApp(BaseDirective):
"""
用于调用app的指令类
"""
def __init__(self, app_name='', package_name='', deep_link=''):
... | 2.328125 | 2 |
specification/scripts/spec_tools/util.py | SteveSmithEpic/OpenXR-SDK-Source | 0 | 12774413 | <filename>specification/scripts/spec_tools/util.py
"""Utility functions not closely tied to other spec_tools types."""
# Copyright (c) 2018-2019 Collabora, Ltd.
# Copyright (c) 2013-2019 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in comp... | 1.921875 | 2 |
utils/build_server.py | ZQPei/Huster | 6 | 12774414 | <reponame>ZQPei/Huster
#!/home/pzq/anaconda3/bin/python
import sys
from huster.server import build_server, parse_args
def huster():
args = parse_args()
build_server(port=args.port, base_dir=args.base_dir)
sys.exit()
if __name__ == "__main__":
huster() | 1.804688 | 2 |
tests/convert/test_converters.py | arkataev/text_normalizer | 0 | 12774415 | import json
import os
from contextlib import contextmanager
import pytest
from text_normalizer.convert import text2int, ord_unfold, is_ordfold, MONTHS, month2num
from text_normalizer.convert._convert import _numerics
from ..settings import TESTS_PATH
with open(os.path.join(TESTS_PATH, 'convert/data/numerics_ds.json'... | 2.65625 | 3 |
doctor_tests/consumer/__init__.py | hashnfv/hashnfv-doctor | 0 | 12774416 | ##############################################################################
# Copyright (c) 2017 ZTE Corporation and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is avail... | 2.046875 | 2 |
chapter-3/classifier_predict_v1.py | outerbounds/dsbook | 27 | 12774417 | from metaflow import FlowSpec, step, Flow, Parameter, JSONType
class ClassifierPredictFlow(FlowSpec):
vector = Parameter('vector', type=JSONType, required=True)
@step
def start(self):
run = Flow('ClassifierTrainFlow').latest_run
self.train_run_id = run.pathspec
self.model = run['e... | 2.40625 | 2 |
src/unicef_snapshot/migrations/0001_initial.py | unicef/unicef-snapshot | 0 | 12774418 | <filename>src/unicef_snapshot/migrations/0001_initial.py
# Generated by Django 1.10.8 on 2018-03-26 16:05
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initi... | 1.726563 | 2 |
indad/train_patchcore.py | ChengIC/my_patchcore | 2 | 12774419 | from models import PatchCore
from save_utils import saveModelPath
import numpy
import torch
import warnings
from torch import tensor
from torchvision import transforms
import json
import numpy
from PIL import Image, ImageFilter
import os
from torch.utils.data import DataLoader,TensorDataset
warnings.filterwarnings("... | 2.140625 | 2 |
user/migrations/0011_alter_post_interacted_plusone.py | 64Digits/SixtyFour | 1 | 12774420 | # Generated by Django 4.0.1 on 2022-01-13 19:25
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.manager
import user.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.A... | 1.71875 | 2 |
dnsaas/api/v2/serializers.py | mike-johnson-jr/django-powerdns-dnssec | 32 | 12774421 | """Serializer classes for DNSaaS API"""
import ipaddress
from django.conf import settings
from django.contrib.auth import get_user_model
from powerdns.utils import find_domain_for_record
from powerdns.models import (
RECORD_A_TYPES,
CryptoKey,
Domain,
DomainMetadata,
DomainTemplate,
Record,
... | 2.15625 | 2 |
lab4_2/helpers/FA.py | cinnamonbreakfast/flcd | 0 | 12774422 | <reponame>cinnamonbreakfast/flcd
class FiniteAutomataState:
def __init__(self, structure):
self.states = []
self.alphabet = []
self.initial = []
self.finals = []
self.transitions = {}
self._file = open(structure, "r")
self._load()
# print(self.vali... | 2.703125 | 3 |
send.py | MikeRyan56/Flask-RabbitMQ | 0 | 12774423 | <reponame>MikeRyan56/Flask-RabbitMQ<gh_stars>0
import pika
import json
import config as cfg
import silly
from random import randint, SystemRandom
import datetime
time_start = datetime.datetime.now()
count_id = 0
for x in range(0, 1000):
# credentials = pika.PlainCredentials(username=cfg.USER, password=cfg.USER)
... | 2.640625 | 3 |
cask/cask/schema.py | dcramer/cask-server | 2 | 12774424 | import graphene
from graphene_django.types import DjangoObjectType
from cask.accounts.models import Follower
from cask.utils import optimize_queryset
from .models import CheckIn
class CheckInScope(graphene.Enum):
class Meta:
name = "CheckInScope"
public = "public"
friends = "friends"
class Ch... | 2.21875 | 2 |
pyScript/custom_src/Node.py | Shirazbello/Pyscriptining | 0 | 12774425 | <gh_stars>0
from PySide2.QtGui import QColor
class Node:
def __init__(self):
# general attributes
# static:
self.title = ''
self.type = '' # kind of extends the title with further information, f.ex.: 'function input node'
self.description = ''
self.package = None... | 2.640625 | 3 |
pipeline/coann/brents_bpbio/blasttools/blast_misc/test_b.py | gturco/find_cns | 4 | 12774426 | import sys
sys.path.insert(0,".")
import blast_misc
import time
import operator
blast_file = 'data/t.blast'
b = blast_misc.blast_array(blast_file, best_hit=0, maxkeep=999999, dopickle=0)
print b
print b.shape
| 1.609375 | 2 |
sentiment_analysis/sentiment_analysis.py | mFarouki/tensorflow | 0 | 12774427 | import os
from download_and_view import download_and_unzip, check_directory_contents, read_random_review, \
remove_unneeded_directories
from load_raw_datasets import build_raw_datasets, view_dataset
from preprocess_data import apply_vectorisation, view_sample_vectorisation, preprocess_dataset
from train_model impo... | 2.28125 | 2 |
tests/__init__.py | jcs-lambda/lambdata-jcs-lambda | 0 | 12774428 | <reponame>jcs-lambda/lambdata-jcs-lambda<gh_stars>0
"""Unit tests for df_utils"""
| 1.046875 | 1 |
introduccion_algoritmos/1-introduccion/uddt.py | cristian-rincon/escuela-datascience | 0 | 12774429 | <gh_stars>0
"""
User Defined Data Type
"""
from dataclasses import dataclass
@dataclass
class Client:
name: str
id: str
credit: float
address: str
def main():
user1 = Client("Cristian", "00001", 4400000, "Cr 1 nro 1 01")
print(f'The client name is: {user1.name}')
print(f'The client id... | 3.546875 | 4 |
src/anmi/T3/__init__.py | alexmascension/ANMI | 1 | 12774430 | <reponame>alexmascension/ANMI
from sympy import symbols, poly, zeros, simplify
from anmi.T2 import factorizacion_QR
def matriz_krylov(A, x, n_iters=None):
"""Genera una matriz de krylov dada una matriz A y un vector x. Cada columna de la matriz es la iteración i de A^i*x.
Args:
A (matriz): Matriz de ... | 3.109375 | 3 |
Tests/test_KDTree.py | erpeg/biopython | 1 | 12774431 | <gh_stars>1-10
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests for KDTree module."""
import unittest
try:
import numpy
del numpy
except ImportError:
from Bio import MissingExt... | 2.390625 | 2 |
tests/gbe/scheduling/test_rehearsal_wizard.py | bethlakshmi/gbe-divio-djangocms-python2.7 | 1 | 12774432 | from django.test import TestCase
from django.test import Client
from django.urls import reverse
from tests.factories.gbe_factories import (
ConferenceFactory,
GenericEventFactory,
PersonaFactory,
ProfileFactory,
)
from tests.contexts import (
StaffAreaContext,
VolunteerContext,
)
from scheduler.... | 1.984375 | 2 |
main.py | CornellDataScience/ssbm-gym | 1 | 12774433 | <reponame>CornellDataScience/ssbm-gym<gh_stars>1-10
import argparse
import torch
import torch.optim as optim
from StateNet import StateNet
from ppo_model import Actor
from envs import GoHighEnvVec
from ssbm_gym.ssbm_env import EnvVec, SSBMEnv, HierEnv
import train
import train_state
parser = argparse.ArgumentParser(d... | 1.921875 | 2 |
day3/day3a-dbg.py | fseraphine/aoc2020 | 0 | 12774434 | <reponame>fseraphine/aoc2020
#!/usr/bin/python
compteur = 0
i,j = 3,1
terrain = []
fichier = open('day3_input.txt')
for l in fichier:
terrain.append(fichier.readline().strip('\n'))
nblig = len(terrain)
nbcol = len(terrain[0])
print('nblig : %s / nbcol : %s' % (nblig,nbcol))
for f in terrain:
print(f)
while ... | 3.140625 | 3 |
logsearch/zuul.py | gibizer/zuul-log-search | 0 | 12774435 | <reponame>gibizer/zuul-log-search
import logging
from typing import List, Dict, Optional, Set
import os
import requests
LOG = logging.getLogger(__name__)
class ZuulException(BaseException):
pass
class API:
def __init__(self, zuul_url: str) -> None:
self.zuul_url = zuul_url
def get_build(self,... | 2.421875 | 2 |
nets/mish.py | HirataYurina/yolov4-tiny-keras | 13 | 12774436 | <filename>nets/mish.py
# -*- coding:utf-8 -*-
# author:平手友梨奈ii
# e-mail:<EMAIL>
# datetime:1993/12/01
# filename:mish.py
# software: PyCharm
import keras.backend as K
import keras
class Mish(keras.layers.Layer):
"""mish activation
Mish: A Self Regularized Non-Monotonic Activation Function
https://arxiv.... | 2.96875 | 3 |
budget_nanny/budgets.py | Pepedou/budget-nanny | 0 | 12774437 | import itertools
from budget_nanny.api_requests import APIRequester, BUDGETS_ENDPOINT, BUDGET_ENDPOINTS
DEFAULT_BUDGET = 'Personal'
class BudgetRequester:
def __init__(self, budget):
self.budget = budget
self.api_requester = APIRequester()
def create_transaction(self, transaction_data):
... | 2.296875 | 2 |
tools/arrays.py | fakufaku/doamm | 7 | 12774438 | <gh_stars>1-10
import numpy as np
from pyroomacoustics import MicrophoneArray
_pyramic_loc = np.array(
[
[-0.014433756729740652, -0.02500000000000001, -0.14288690166235207],
[-0.02598076211353317, -0.04500000000000001, -0.11022703842524302],
[-0.037527767497325684, -0.06500000000000002, -0.... | 1.796875 | 2 |
kalman/quadrotor.py | jlrandulfe/drone-swarm | 8 | 12774439 | import numpy as np
from scipy import linalg as la
class quadrotor:
def __init__(self, tag, m, l, J, CDl, CDr, kt, km, kw, att, \
pqr, xyz, v_ned, w):
# physical constants
self.tag = tag
self.m = m # [Kg]
self.l = l # [m]
self.J = J # Inertia matrix [Kg/m^2... | 2.734375 | 3 |
mb_aligner/dal/common.py | Gilhirith/mb_aligner_SH | 3 | 12774440 | import cv2
import numpy as np
from .fs_access import FSAccess
def read_image_file(fname_url):
with FSAccess(fname_url, True) as image_f:
img_buf = image_f.read()
np_arr = np.frombuffer(img_buf, np.uint8)
img = cv2.imdecode(np_arr, 0)
return img
def write_image_file(fname_url, img):
... | 3.03125 | 3 |
Chapter08/qt08_winStyle02.py | csy1993/PythonQt | 0 | 12774441 | # -*- coding: utf-8 -*-
# 导入模块
import sys
from PyQt5.QtWidgets import QMainWindow , QApplication
from PyQt5.QtCore import Qt
### 自定义窗口类
class MyWindow( QMainWindow):
'''自定义窗口类'''
### 构造函数
def __init__(self,parent=None):
'''构造函数'''
# 调用父类构造函数
super(MyWindow,self).__init__(parent... | 2.5625 | 3 |
examples/test_global_catalog_v1_examples.py | nathan-hekman/platform-services-python-sdk | 0 | 12774442 | # -*- coding: utf-8 -*-
# (C) Copyright IBM Corp. 2021.
#
# 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 l... | 1.78125 | 2 |
Katari/sip/response/_1xx.py | KalbiProject/Katari | 13 | 12774443 | <gh_stars>10-100
from Katari.sip import SipMessage
class Trying100(SipMessage):
def __init__(self):
super().__init__()
self.method_line = "SIP/2.0 100 Trying\r\n"
class Ringing180(SipMessage):
def __init__(self):
super().__init__()
self.method_line = "SIP/2.0 180 Ringing\r\n"... | 2.203125 | 2 |
pre_process.py | foamliu/Chatbot-v2 | 7 | 12774444 | <reponame>foamliu/Chatbot-v2
import pickle
import numpy as np
from tqdm import tqdm
from config import train_filename, vocab_file, maxlen_in, maxlen_out, sos_id, \
eos_id, unk_id, data_file
from utils import encode_text
def build_vocab(token):
if token not in char2idx:
next_index = len(char2idx)
... | 2.703125 | 3 |
chemicalmatcher/__init__.py | ericmbell1/standardizedinventories | 14 | 12774445 | <gh_stars>10-100
# __init__.py (chemicalmatcher)
# !/usr/bin/env python3
# coding=utf-8
"""
Public API for chemicalymatcher. Functions to allow retrieval of chemical and
substance matches from precompiled chemical match lists or the EPA
SRS web service
"""
from chemicalmatcher.programsynonymlookupbyCAS import program... | 2.578125 | 3 |
exercises/exercise04_underdamped_free_plot.py | WangKBJames/cobem2019-modal-analysis-python | 6 | 12774446 | import sympy
from sympy import Function, dsolve, Symbol
# symbols
t = Symbol('t', positive=True)
zeta = Symbol('\zeta', constant=True, positive=True)
# unknown function
u = Function('u')(t)
# assumed values
u0 = 1
v0 = 0
wn = 4.
wd = wn*sympy.sqrt(1-zeta**2)
ics = {u.subs(t, 0): u0, u.diff(t).subs(t, 0): v0}
sol = ... | 2.765625 | 3 |
events/models.py | 0xelectron/mhtportal-web | 0 | 12774447 | import datetime
from django.db import models
from django.utils.translation import ugettext as _
from django.core.validators import RegexValidator
from base.models import (Address, Center, Participant)
class EventCategory(models.Model):
category = models.CharField(max_length=50, default="", help_text=_("Event Categ... | 2.484375 | 2 |
ibmcloud_image_uploader/ibmcloud_cos_image_uploader.py | tsanghan/tmos-cloudinit | 0 | 12774448 | #!/usr/bin/env python
# coding=utf-8
# pylint: disable=broad-except,unused-argument,line-too-long, unused-variable
# Copyright (c) 2016-2018, F5 Networks, 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 ... | 1.84375 | 2 |
napari/_qt/widgets/qt_extension2reader.py | MaksHess/napari | 0 | 12774449 | from qtpy.QtCore import Qt, Signal
from qtpy.QtWidgets import (
QHBoxLayout,
QLabel,
QPushButton,
QTableWidget,
QTableWidgetItem,
QVBoxLayout,
QWidget,
)
from ...settings import get_settings
from ...utils.translations import trans
class Extension2ReaderTable(QWidget):
"""Table showing... | 1.96875 | 2 |
TAT_setup.py | jacob975/TATIRP | 0 | 12774450 | <filename>TAT_setup.py
#!/usr/bin/python
'''
Program:
This is a program to setup tat python code.
For Linux and macOS only
Usage:
1. TAT_setup.py
editor Jacob975
20170809
#################################
update log
20170809 version alpha 1
It can run properly
20170830 version alpha 2
1. combine the linux ve... | 2.640625 | 3 |