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 |
|---|---|---|---|---|---|---|
daily.py | apiforfun/theforexapi | 2 | 12786551 | <gh_stars>1-10
from sys import displayhook
import xml.etree.ElementTree as ET
import urllib.request
import xmltodict
import json
import requests
from bs4 import BeautifulSoup
from pymongo import MongoClient
client = MongoClient('mongodb://localhost:27017/')
db = client['theforexapi']
collection = db['currency']
curre... | 2.59375 | 3 |
ads/helpers.py | sinisaos/starlette-piccolo-rental | 3 | 12786552 | <filename>ads/helpers.py
from .tables import Ad, Review
def get_ads():
a = Ad
qs = a.select(
a.id,
a.slug,
a.title,
a.content,
a.created,
a.view,
a.room,
a.visitor,
a.price,
a.city,
a.address,
a.ad_user.username,
... | 2.5 | 2 |
backend/models/location.py | DavidLee0216/SWOOSH | 0 | 12786553 | <gh_stars>0
from sqlalchemy import Column, String, DateTime
from config.DBindex import Base
class LaunchLocations(Base):
__tablename__ = "launch_location"
observate_location = Column(String(100))
location = Column(String(100), primary_key=True, unique=True)
country = Column(String(50))
| 2.171875 | 2 |
0801-0850/0804-UniqueMorseCodeWords/UniqueMorseCodeWords.py | Sun-Zhen/leetcode | 3 | 12786554 | # -*- coding:utf-8 -*-
"""
@author: Alden
@email: <EMAIL>
@date: 2018/3/29
@version: 1.0.0.0
"""
class Solution(object):
def uniqueMorseRepresentations(self, words):
"""
:type words: List[str]
:rtype: int
"""
tmp_list = [".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "...... | 3.421875 | 3 |
backend/poolguybackend/api/migrations/0001_initial.py | dotchetter/poolguy | 0 | 12786555 | <reponame>dotchetter/poolguy<gh_stars>0
# Generated by Django 3.2.3 on 2021-05-23 12:54
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_... | 1.921875 | 2 |
netta/model.py | zhangdafu12/web | 0 | 12786556 | # -*- encoding:utf8 -*-
# author: Shulei
# e-mail: <EMAIL>
# time: 2019/4/2 11:56
import random
import re
from _datetime import datetime
from collections import Counter
import jieba
import operator
import pymysql
import requests
from flask import Flask, json
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy impo... | 2.25 | 2 |
secret-handshake/secret_handshake.py | amalshehu/exercism-python | 2 | 12786557 | # File : secret_handshake.py
# Purpose : Write a program that will take a decimal number, and
# convert it to the sequence of events for a secret handshake.
# Programmer : <NAME>
# Course : Exercism
# Date : Monday 3 October 2016, 12:50 AM
actions = {1: 'wink',
2: 'doub... | 3.953125 | 4 |
test.py | csev/tsugi-python-test | 0 | 12786558 | import pymysql
import random
from urllib.parse import urlparse
import urllib
import databaseconfig as CFG
import post as POST
import util as U
inp = input('Test Java, Node, PHP, pGphp, or pYthon? ')
if inp.lower().startswith('j') :
url = 'http://localhost:8080/tsugi-servlet/hello'
elif inp.lower().startswith('n')... | 2.546875 | 3 |
configlighthouse.py | ntfshard/build-status-semaphore | 0 | 12786559 | #!python3
# config-lighthouse.py
user='user'
password='<PASSWORD>' # token from https://HOSTNAME/user/USERNAME/configure `API Token`
comport='/dev/ttyUSB0'
| 1.390625 | 1 |
src/test_eorzea_time.py | Indanaiya/ffoverlay | 0 | 12786560 | <filename>src/test_eorzea_time.py
import unittest
import eorzea_time
from eorzea_time import getEorzeaTime, getEorzeaTimeDecimal, timeUntilInEorzea
from unittest import mock
class EorzeaTimeTests(unittest.TestCase):
def test_type_of_getEorzeaTimeDecimal(self):
self.assertEqual(type(getEorzeaTimeDecimal())... | 2.859375 | 3 |
PythonWallet/post_balance_address.py | IOTAplus/SMART-ENERGY-CONTROLL | 0 | 12786561 | <filename>PythonWallet/post_balance_address.py
'''
In this example we generate 1 address with a security level of 2 (default)
for a given seed. This is the first available, unused address for this seed.
'''
from iota import Iota
import pprint
import time
import json
import requests
# This is a demonstration seed, alw... | 2.890625 | 3 |
internal/handlers/andorra.py | fillingthemoon/cartogram-web | 0 | 12786562 | <filename>internal/handlers/andorra.py
import settings
import handlers.base_handler
import csv
class CartogramHandler(handlers.base_handler.BaseCartogramHandler):
def get_name(self):
return "Andorra"
def get_gen_file(self):
return "{}/and_processedmap.json".format(settings.CARTOGRAM_DATA_DIR)... | 2.609375 | 3 |
tests/test_token_revocation.py | yaal-fr/canaille | 3 | 12786563 | <reponame>yaal-fr/canaille
from . import client_credentials
def test_token_revocation(testclient, user, client, token, slapd_connection):
assert not token.oauthRevokationDate
res = testclient.post(
"/oauth/revoke",
params=dict(token=token.oauthAccessToken,),
headers={"Authorization": ... | 2.125 | 2 |
teelib/network/msg_packer.py | edg-l/teelib | 0 | 12786564 | <filename>teelib/network/msg_packer.py
from .packer import Packer
from .constants import OFFSET_UUID
from teelib.uuid.util import get_uuid
class MsgPacker(Packer):
def __init__(self, packet_type: int):
super().__init__()
if packet_type < OFFSET_UUID:
self.add_int(packet_type)
e... | 2.359375 | 2 |
blocks/templatetags/blocks_admin.py | kimus/django-blocks | 3 | 12786565 | from django import template
from django.conf import settings
register = template.Library()
@register.assignment_tag
def get_language_byindex(index):
lang = ('', '')
try:
lang = settings.LANGUAGES[index]
except KeyError:
pass
except IndexError:
pass
return lang
| 2 | 2 |
src/bootstrap_run.py | AminJavari/ROSE | 0 | 12786566 |
from collections import namedtuple
from src import bootstrap
import settings
import const
if __name__ == "__main__":
argsClass = namedtuple('argsClass', 'build predict')
buildClass = namedtuple('argsClass', 'input directed sample method dimension windowsize walklen nbofwalks embedtype classificationfunc opti... | 2.328125 | 2 |
Spanners/Treeify.py | eddo888/Spanners | 0 | 12786567 | <reponame>eddo888/Spanners<gh_stars>0
#!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
import io, sys, os, json, xmltodict, yaml
from collections import OrderedDict as OD
from collections import deque
from asciitree import LeftAligned
from asciitree.drawing import BoxStyle, BOX_LIGHT, BOX_BLANK
from io import StringIO... | 2.375 | 2 |
hamiltonian_chain/hamiltonian_chain_solution.py | bzliu94/algorithms | 0 | 12786568 | # 2015-12-14
# solves hamiltonian chain enumeration problem
# usage: python hamiltonian_chain_solution.py W H
# where W is grid width and H is grid height
# takes O(2 ^ L * L ^ 2) time
# involves memoizing using a surface key
# inspired by <NAME>
# algorithm comes from a paper by <NAME>
import math
from collecti... | 3.140625 | 3 |
recommender/export.py | google/article-recommender | 8 | 12786569 | <gh_stars>1-10
# Copyright 2020 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 ... | 2.203125 | 2 |
pluto/coms/client/protos/account_state_pb2.py | chalant/pluto | 0 | 12786570 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: contrib/coms/client/protos/account_state.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.pro... | 0.953125 | 1 |
src/main.py | AndreaRoss96/gym-cricket-robot | 0 | 12786571 | <filename>src/main.py
import os
import numpy as np
import argparse
import matplotlib.pyplot as plt
import pywavefront as pw
from copy import deepcopy
import torch
from numpy.lib.polynomial import RankWarning
import time
from utils.util import get_output_folder
from gym_cricket.envs.cricket_env import CricketEnv
from d... | 2.15625 | 2 |
projects/ephys_passive_opto.py | int-brain-lab/project_extraction | 0 | 12786572 | <gh_stars>0
from collections import OrderedDict
import numpy as np
import one.alf.io as alfio
from ibllib.io.extractors import ephys_fpga
from ibllib.dsp.utils import sync_timestamps
from ibllib.plots import squares, vertical_lines
from ibllib.pipes import tasks
from ibllib.pipes.ephys_preprocessing import (
Eph... | 2.046875 | 2 |
gan_model_data/train.py | Monnoroch/generative | 1 | 12786573 | import argparse
import sys
import tensorflow as tf
from gan_model_data import model
from common.experiment import Experiment, load_checkpoint
from common.training_loop import TrainingLoopParams, training_loop
def print_graph(session, model, step, nn_generator):
"""
A helper function for printing key trainin... | 2.640625 | 3 |
element-frame-based/OCR/eval.py | dymbe/ad-versarial | 43 | 12786574 | <gh_stars>10-100
import os
import cv2
from OCR.tf_tesseract.my_vgsl_model import MyVGSLImageModel, ctc_decode
from OCR.tf_tesseract.read_params import read_tesseract_params
from OCR.ocr_utils import *
from OCR.l2_attack import init
from tensorflow import app
from tensorflow.python.platform import flags
from timeit i... | 2.34375 | 2 |
hknweb/studentservices/forms.py | Boomaa23/hknweb | 0 | 12786575 | <reponame>Boomaa23/hknweb
import datetime
from django import forms
from hknweb.studentservices.models import DepTour, Resume, ReviewSession
class DocumentForm(forms.ModelForm):
class Meta:
model = Resume
fields = ("name", "document", "notes", "email")
class ReviewSessionForm(forms.ModelForm):
... | 2.1875 | 2 |
settings.py | DiogoKramel/SailPy | 3 | 12786576 | import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/assets/'
# Extra places to collect and find static files
# STATICFIL... | 2.09375 | 2 |
tests/pruebas_funcionales/login.py | Javier-Alonso29/conalep | 2 | 12786577 | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from selenium.webdriver.chrome.options import Options
options = Options()
extset = ['enable-automation', 'ignore-certificate-errors']
options.add_argument("--window-size=600,600")
options.add_argument("--headless")
options.add_e... | 2.25 | 2 |
crud/models.py | TownOneWheel/townonewheel | 0 | 12786578 | <reponame>TownOneWheel/townonewheel
from django.db import models
from django.db.models.fields import NullBooleanField
from django.contrib.auth.models import User, update_last_login
from behavior import BaseField
class Cat(BaseField):
catname = models.CharField(max_length=64)
gender = models.CharField(max_len... | 2.1875 | 2 |
online/online_detection/hmm_online_endpose_detection.py | birlrobotics/bnpy | 3 | 12786579 | <gh_stars>1-10
#!/usr/bin/env python
import sys
import os
import pandas as pd
import numpy as np
from hmmlearn.hmm import *
from sklearn.externals import joblib
import ipdb
from math import (
log,
exp
)
from sklearn.preprocessing import (
scale,
normalize
)
#######-----ros module----##########
import r... | 1.976563 | 2 |
test_day07/test_ex13.py | anxodio/aoc2021 | 0 | 12786580 | <filename>test_day07/test_ex13.py
from pathlib import Path
from typing import List
from statistics import median
def get_minimum_alignement_fuel(positions: List[int]) -> int:
best_position = int(median(positions))
return sum(abs(pos - best_position) for pos in positions)
def test_get_minimum_alignement_fuel... | 3.515625 | 4 |
namecheapapi/api/whoisguard.py | porfel/namecheapapi | 23 | 12786581 | from namecheapapi.api.session import Session
class WhoisguardAPI:
def __init__(self, session: Session) -> None:
self.session = session
def change_email_address(self):
pass
def enable(self):
pass
def disable(self):
pass
def unallot(self):
pass
def d... | 1.882813 | 2 |
utilities/data_cleaning.py | Araualla/Cell_health | 0 | 12786582 | from utilities.constants import TREAT, CONC
from utilities.counts import count_cells_per_well, normalise_count_cells
# labels for concentration of treatments in the experiment
number2conc = {2: '0 ug/mL',
3: '0.137 ug/mL',
4: '0.412 ug/mL',
5: '1.235 ug/mL',
... | 2.4375 | 2 |
plc_io/core_libraries/mqtt_current_monitor_interface_py3.py | bopopescu/docker_images_a | 2 | 12786583 | import paho.mqtt.client as mqtt
import ssl
from redis_support_py3.graph_query_support_py3 import Query_Support
from redis_support_py3.construct_data_handlers_py3 import Generate_Handlers
import time
import msgpack
class MQTT_Current_Monitor_Publish(object):
def __init__(self,redis_site,topic_prefix,qs ) :
... | 2.15625 | 2 |
tests/testlibraries/parametrizer/file_path_with_resource_factories.py | yukihiko-shinoda/fixture-file-handler | 0 | 12786584 | <gh_stars>0
"""This module implements factory for file path with file."""
from abc import abstractmethod
from pathlib import Path
from typing import Generic, Type, TypeVar
from fixturefilehandler.file_paths import RelativeDeployFilePath, RelativeVacateFilePath
from tests.testlibraries.parametrizer.file_states import M... | 2.65625 | 3 |
courses/models.py | Cent-Luc/University_Portal | 0 | 12786585 | from django.db import models
from django.contrib.auth.models import User
from django.urls import reverse
class Course(models.Model):
title = models.CharField(max_length=200)
code = models.SlugField(max_length=200, unique=True)
summary = models.TextField(blank=True)
class Meta:
ordering = ['ti... | 2.203125 | 2 |
tools/versioncmp/examples/static_web/w_vordir_deterministic.py | dtip/magics | 0 | 12786586 | # (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergov... | 1.960938 | 2 |
tests/factories.py | omni-digital/omni-wagtail-library | 2 | 12786587 | <gh_stars>1-10
# -*- coding:utf8 -*-
from __future__ import unicode_literals
from factory import Sequence
from wagtail_factories import PageFactory
from wagtail_library.models import LibraryIndex, LibraryDetail
class LibraryIndexFactory(PageFactory):
title = Sequence("Library index {}".format)
body = Sequ... | 1.898438 | 2 |
ocr/form_recognizer.py | PrynsTag/oneBarangay | 0 | 12786588 | """Recognize and extract forms."""
import os
from statistics import fmean
from azure.ai.formrecognizer.aio import FormRecognizerClient, FormTrainingClient
from azure.core.credentials import AzureKeyCredential
class RecognizeCustomFormsSampleAsync:
"""Class to recognize forms in async mode."""
async def reco... | 2.671875 | 3 |
src/yews/transforms/base.py | Lchuang/yews | 6 | 12786589 | <reponame>Lchuang/yews<gh_stars>1-10
def is_transform(obj):
"""Verfy if a object is a ``transform-like`` object.
Args:
obj: Object to be determined.
Returns:
bool: True for ``transform-like`` object, false otherwise.
"""
return hasattr(obj, '__call__')
class BaseTransform(object)... | 3.40625 | 3 |
recipes/timit_v2/local/timit-norm-trans.py | RobinAlgayres/beer | 46 | 12786590 | <filename>recipes/timit_v2/local/timit-norm-trans.py
'''Normalize the TIMIT transcription by mapping the set of phones
to a smaller subset.
'''
import argparse
import sys
import logging
logging.basicConfig(format='%(levelname)s: %(message)s')
def run():
parser = argparse.ArgumentParser(description=__doc__)
... | 2.703125 | 3 |
modules/launch_module.py | BigFlubba/Reco-PC-Server | 1 | 12786591 | # Module: launch
# Description: Lauches a custom shortcut in the shortcuts directory
# Usage: !launch [shortcut]
# Dependencies: os, time, glob
import os, configs,time
from lib.helpers import checkfolder
from lib.reco_embeds import recoEmbeds as rm
from glob import glob
async def launch(ctx,client, shortcut=None):
... | 2.890625 | 3 |
pre_poetry/enum_annotator.py | noelmcloughlin/linkml-model-enrichment | 6 | 12786592 | #!/usr/bin/env python3
from __future__ import print_function
import json
import sys
import urllib.error
import urllib.parse
import urllib.request
from strsimpy.cosine import Cosine
import yaml
import re
import pandas as pds
import requests
import click
import logging
import click_log
import random
logger = logging.ge... | 2.1875 | 2 |
surrortg/devices/udp/udp_switch.py | SurrogateInc/surrortg-sdk | 21 | 12786593 | import asyncio
import logging
import struct
from surrortg.inputs import Switch
from . import UdpInput
class UdpSwitch(Switch, UdpInput):
"""Class for udp-controlled switch.
:param cmd: udp byte that identifies the control id
:type cmd: int
:param multiplier: multiplier of the value, defaults to 1.0... | 2.78125 | 3 |
src/convert.py | vinid223/gtkoutkeeptomd | 0 | 12786594 | import argparse
import errno
import json
import logging
import os
import textwrap
from os import walk
def load_json_file(path: str):
f = open(path, "r")
data = f.read()
f.close()
return json.loads(data)
def save_markdown_file(path: str, data):
f = open(path, "w")
f.writelines(data)
f.cl... | 2.953125 | 3 |
redpanda/orm.py | amancevice/redpanda | 24 | 12786595 | """
Custom ORM behavior.
"""
import pandas
import sqlalchemy.orm
from redpanda import dialects
class Query(sqlalchemy.orm.Query):
"""
RedPanda SQLAlchemy Query.
Adds the frame() method to queries.
"""
def __init__(self, entities, session=None, read_sql=None):
super(Query, self).__init__(... | 2.875 | 3 |
Unit5/HomeWorks/p1.py | yuhao1998/PythonStudy | 0 | 12786596 | '''
任意累积
描述
请根据编程模板补充代码,计算任意个输入数字的乘积。
注意,仅需要在标注...的地方补充一行或多行代码。
'''
def cmul(a, *b):
input(a)
m = a
for i in b:
m *= i
return m
print(eval("cmul({})".format(input())))
'''
该程序需要注意两个内容:
1. 无限制数量函数定... | 3.6875 | 4 |
tests/apitest/test_user_api.py | Eternity-labs/eternity-backend-server | 0 | 12786597 | <filename>tests/apitest/test_user_api.py
from . import ApiTestCase
class TestUserApi(ApiTestCase):
def test_accountinfo(self):
payload = self.client.get("/user/accountinfo/0x123124")
AccountId = payload["AccountId"]
assert AccountId | 2.3125 | 2 |
client.py | ucipass/sio | 0 | 12786598 | <gh_stars>0
from socketIO_client_nexus import SocketIO, LoggingNamespace
import time
host = "127.0.0.1"
port = 8080
def sioCallback(*args):
print('socket.io reply', args, "on:", time.strftime('%X'))
socketIO = SocketIO(host, port, LoggingNamespace)
while True:
socketIO.emit('echo', {'xxx': 'yyy'}, sioCallba... | 2.8125 | 3 |
frappe/tests/test_webform.py | oryxsolutions/frappe | 0 | 12786599 | <gh_stars>0
import unittest
import frappe
from frappe.utils import set_request
from frappe.website.serve import get_response
from frappe.www.list import get_list_context
class TestWebform(unittest.TestCase):
def test_webform_publish_functionality(self):
edit_profile = frappe.get_doc("Web Form", "edit-profile")
... | 2.046875 | 2 |
hw2/Duelling.py | suyash622/Random | 0 | 12786600 | import tensorflow as tf
import keras
from keras.models import Sequential
from keras.layers import Dense, Activation
import numpy as np
import argparse
import random
import gym
import sys
from collections import deque
from keras import backend as K
from keras.layers import Input, Dense
from keras.models import Model
fro... | 2.484375 | 2 |
web/api_rest/mini_facebook/python_users_relationships_service_api_llano/controllers/PersonsApi.py | CALlanoR/virtual_environments | 0 | 12786601 | <gh_stars>0
from flask import Blueprint, request
from services.PersonsService import PersonsService
from flask import jsonify
persons_api = Blueprint('persons_api', __name__)
persons_service = PersonsService()
@persons_api.route('/persons/', methods=['POST'])
def add_person():
try:
_json = request.json
... | 2.890625 | 3 |
data/train/python/d961160e69c3b9c624baed9fdc6dfac21f4188e3urls.py | harshp8l/deep-learning-lang-detection | 84 | 12786602 | <filename>data/train/python/d961160e69c3b9c624baed9fdc6dfac21f4188e3urls.py<gh_stars>10-100
from django.conf.urls import patterns, include, url
from django.contrib import admin
from api import *
from tastypie.api import Api
v1_api = Api(api_name='v1')
v1_api.register(AddressResource())
v1_api.register(PersonResource()... | 1.578125 | 2 |
.ipynb_checkpoints/pyKinectProjectilePrediction-checkpoint.py | PMcGloin/pyKinectProjectilePrediction | 0 | 12786603 | from pykinect2 import PyKinectV2
from pykinect2.PyKinectV2 import *
from pykinect2 import PyKinectRuntime
import ctypes
import _ctypes
import pygame
import sys
import numpy as np
import cv2
#if sys.hexversion >= 0x03000000:
# import _thread as thread
#else:
# import thread
class DepthRuntime(object):
def __i... | 2.609375 | 3 |
nablapps/meeting_records/admin.py | Amund211/nablaweb | 17 | 12786604 | <filename>nablapps/meeting_records/admin.py
"""
Admin interface for meeting record app
"""
from django.contrib import admin
from nablapps.core.admin import ChangedByMixin
from .models import MeetingRecord
@admin.register(MeetingRecord)
class MeetingRecordAdmin(ChangedByMixin, admin.ModelAdmin):
"""Admin interfa... | 1.875 | 2 |
project/controllers/pilotConsoleController.py | MattiaPeiretti/TVG | 0 | 12786605 | # Libs
import flask
# Modules
from project.visionGrabber.device import Device
def get_vision_feed():
return flask.Response(generate_frame_from_view(Device()), mimetype='multipart/x-mixed-replace; boundary=frame')
def generate_frame_from_view(camera):
while True:
#get camera frame
... | 2.53125 | 3 |
CombinedList/main.py | rishidevc/stkovrflw | 0 | 12786606 | <reponame>rishidevc/stkovrflw
# https://stackoverflow.com/questions/51165779/combine-2-lists-of-pairs#51165779
def get_combined_users(list1, list2):
usernames = set()
combined = []
for user in sorted(list2 + list1, key=lambda user: user[0]): # Do not use => list1 + list2
if not user[0] in usernames:
usernames... | 2.578125 | 3 |
tests/test_ghoclient.py | fccoelho/ghoclient | 1 | 12786607 | #!/usr/bin/env python
"""Tests for `ghoclient` package."""
import unittest
from click.testing import CliRunner
import ghoclient
from ghoclient import cli
from ghoclient import Index
import pandas as pd
from whoosh.searching import Hit
class TestGhoclient(unittest.TestCase):
"""Tests for `ghoclient` package."""... | 2.421875 | 2 |
src/ptide/main.py | ptphp/PyLib | 1 | 12786608 | <reponame>ptphp/PyLib
# -*- coding: utf-8 -*-
#!/usr/bin/env python
from PySide import QtCore, QtGui,QtWebKit
from ptpy.pyside.webkit.webview import WebView
from ptpy.dir.tree import listFiles
from ptpy.file.main import getContent
from ptpy.offline.main import download
import json
PREVIEW_URL = "http://dev.game110.cn... | 2.109375 | 2 |
pos_tagger/trained_model.py | ashwoolford/BNLTK | 14 | 12786609 | <reponame>ashwoolford/BNLTK
# Bangla Natural Language Toolkit: Parts of Speech Tagger
#
# Copyright (C) 2019 BNLTK Project
# Author: <NAME> <<EMAIL>>
from keras.models import load_model
from string import punctuation
import numpy as np
from sklearn.feature_extraction import DictVectorizer
from sklearn.preprocessing i... | 2.578125 | 3 |
query_strategies/core_set.py | HUTTON9453/Active-DA | 0 | 12786610 | import numpy as np
from .strategy import Strategy
from sklearn.neighbors import NearestNeighbors
import pickle
from datetime import datetime
class CoreSet(Strategy):
def __init__(self, X, Y, idxs_lb, net, handler, args, tor=1e-4):
super(CoreSet, self).__init__(X, Y, idxs_lb, net, handler, args)
self.tor = tor
d... | 2.5 | 2 |
CheckIO/Elementary/15_Common_Words.py | marshallhumble/Project_Euler | 3 | 12786611 | <reponame>marshallhumble/Project_Euler<filename>CheckIO/Elementary/15_Common_Words.py<gh_stars>1-10
#!/usr/bin/env python
"""
Let's continue examining words. You are given two string with words separated by commas. Try to find what is common
between these strings. The words are not repeated in the same string.
Your... | 4.03125 | 4 |
msax/optimize.py | nagyatka/msax | 2 | 12786612 | <reponame>nagyatka/msax<gh_stars>1-10
from abc import ABC, abstractmethod
from functools import partial
from multiprocessing.pool import Pool
import numpy as np
import cma
import pyswarms
from msax.error import sax_error
def sax_objective_fun(params, x_source, m_size, l_1, use_inf=False):
a = int(np.round(params... | 2.15625 | 2 |
tests/test_supplier_image_upload.py | MartyDiaz/IT_Automation_Project | 0 | 12786613 | import os.path
import pytest
from unittest import mock
from it_automation.supplier_image_upload import post_images
@pytest.mark.parametrize(
"_input, expected",
[(201, "Success"), (400, "POST error status=400")]
)
@mock.patch("it_automation.run.requests.post")
def test_post_images(mock_requests_post, _input, e... | 2.421875 | 2 |
pybatfish/client/commands.py | li-ch/pybatfish | 1 | 12786614 | <filename>pybatfish/client/commands.py
# coding=utf-8
# Copyright 2018 The Batfish Open Source Project
#
# 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/... | 1.96875 | 2 |
components/collector/src/source_collectors/sonarqube/complex_units.py | kargaranamir/quality-time | 33 | 12786615 | """SonarQube complex units collector."""
from .violations import SonarQubeViolationsWithPercentageScale
class SonarQubeComplexUnits(SonarQubeViolationsWithPercentageScale):
"""SonarQube complex methods/functions collector."""
rules_configuration = "complex_unit_rules"
total_metric = "functions"
| 1.539063 | 2 |
lab/to_str.py | cleac/bool_to_algeb | 0 | 12786616 | from .const import ITERABLE_TYPES
from .exceptions import OperatorNotFoundError
TRANSLATIONS = {
'and': lambda x, y: '{} and {}'.format(x, y),
'or': lambda x, y: '{} or {}'.format(x, y),
'not': lambda x: 'not {}'.format(x),
'*': lambda x, y: '{} * {}'.format(x, y),
'/': lambda x, y: '{} / {}'.forma... | 2.875 | 3 |
ontology/neural_network/sherlock/listify_length.py | ehbeam/neuro-knowledge-engine | 15 | 12786617 | #!/usr/bin/python
import os, math
import pandas as pd
import numpy as np
np.random.seed(42)
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torch.optim as optim
torch.manual_seed(42)
from sklearn.metrics import roc_auc_score
from sklearn.model_selection i... | 2.234375 | 2 |
bg2feed/parser.py | knikolla/bg2feed | 0 | 12786618 | # 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 Li... | 2.25 | 2 |
connect4game.py | kkanodia7/Connect-4 | 0 | 12786619 | <reponame>kkanodia7/Connect-4
# Created by <NAME> on Feb 2, 2019
import random
import sys
players = {1: "+", -1: "x"} # One player is +, other is x
funcs = {1: max, -1: min}
# Board spaces' weights for AI
move_matrix = [0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 10, 20, 30, 20, 10, 0, 0,
... | 3.46875 | 3 |
functions/instance_scheduler/state_service_test.py | lmaczulajtys/gcp-instance-scheduler | 0 | 12786620 | from datetime import datetime
from config.period import Period
from config.schedule import Schedule
from config.scheduler_config import SchedulerConfig
from schedulers.state_service import StateService, State
config = SchedulerConfig(
periods={
"period1": Period(
name="period1",
beg... | 2.5625 | 3 |
ckanext/example_theme/v14_more_custom_css/plugin.py | okfde/ckankrzn | 2,805 | 12786621 | <gh_stars>1000+
../v13_custom_css/plugin.py | 1.101563 | 1 |
Problems/Logistic function/task.py | gabrielizalo/jetbrains-academy-python-credit-calculator | 0 | 12786622 | <gh_stars>0
import math
my_int = int(input())
sigmoid = math.exp(my_int) / (math.exp(my_int) + 1)
print(round(sigmoid, 2))
| 2.875 | 3 |
examples/docStrings/metric_reduce_npy.py | mathieulagrange/doce | 1 | 12786623 | import explanes as el
import numpy as np
import pandas as pd
np.random.seed(0)
experiment = el.experiment.Experiment()
experiment.project.name = 'example'
experiment.path.output = '/tmp/'+experiment.project.name+'/'
experiment.factor.f1 = [1, 2]
experiment.factor.f2 = [1, 2, 3]
experiment.metric.m1 = ['mean', 'std']
... | 2.5625 | 3 |
pybinding/greens.py | lise1020/pybinding | 159 | 12786624 | """Green's function computation and related methods
Deprecated: use the chebyshev module instead
"""
import warnings
from . import chebyshev
from .support.deprecated import LoudDeprecationWarning
__all__ = ['Greens', 'kpm', 'kpm_cuda']
Greens = chebyshev.KPM
def kpm(*args, **kwargs):
warnings.warn("Use pb.kpm(... | 2.375 | 2 |
src/debugpy/_vendored/pydevd/tests_python/resources/_debugger_case_source_mapping_and_reference.py | r3m0t/debugpy | 695 | 12786625 | def full_function():
# Note that this function is not called, it's there just to make the mapping explicit.
a = 1 # map to cEll1, line 2
b = 2 # map to cEll1, line 3
c = 3 # map to cEll2, line 2
d = 4 # map to cEll2, line 3
def create_code():
cell1_code = compile(''' # line 1
a = 1 # lin... | 2.9375 | 3 |
hope-note-module/hope-python-2.7-note/Chapter1.py | Hope6537/hope-battlepack | 5 | 12786626 | <reponame>Hope6537/hope-battlepack
# encoding:utf-8
# !/usr/bin/env python
# Python语法层面
__author__ = 'Hope6537'
print "Hi,My name is %s , I am %d years old " % ("hope6537", 20)
programLanguages = ["java", "c#", "c++"];
programLanguages.append("python")
programLanguages.insert(1, "javascript")
programLanguages.pop()
... | 3.53125 | 4 |
dmwmclient/datasvc.py | FernandoGarzon/dmwmclient | 1 | 12786627 | import httpx
import pandas
from .util import format_dates
BLOCKARRIVE_BASISCODE = {
-6: "no_source",
-5: "no_link",
-4: "auto_suspend",
-3: "no_download_link",
-2: "manual_suspend",
-1: "block_open",
0: "routed",
1: "queue_full",
2: "rerouting",
}
class DataSvc:
"""PhEDEx dat... | 2.609375 | 3 |
_unittests/ut_sphinxext/test_mathdef_extension.py | Pandinosaurus/pyquickhelper | 18 | 12786628 | <filename>_unittests/ut_sphinxext/test_mathdef_extension.py<gh_stars>10-100
"""
@brief test log(time=4s)
@author <NAME>
"""
import sys
import os
import unittest
from docutils.parsers.rst import directives
from pyquickhelper.loghelper.flog import fLOG
from pyquickhelper.pycode import get_temp_folder
from pyqu... | 2.234375 | 2 |
src/utilities/paths.py | ab3llini/BlindLess | 1 | 12786629 | <reponame>ab3llini/BlindLess
import os
import re
def __robust_respath_search():
"""
Resolve the path for resources from anywhere in the code.
:return: The real path of the resources
"""
curpath = os.path.realpath(__file__)
basepath = curpath
while os.path.split(basepath)[1] != 'src':
... | 2.859375 | 3 |
tests/create_golden_values.py | jond01/dicom-numpy | 89 | 12786630 | """
Generate a golden NPZ file from a dicom ZIP archive.
"""
import argparse
import numpy as np
from dicom_numpy.zip_archive import combined_series_from_zip
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('-o', '--output', help='Output golden NPZ file', required=False)
parser.ad... | 3.046875 | 3 |
test/test_2_garage_compact_parking.py | jlarkin21/parking-garage-python | 0 | 12786631 | <reponame>jlarkin21/parking-garage-python
from typing import List
from garage.garage import Garage
from garage.parking_level import ParkingLevel
from garage.parking_space import ParkingSpace
from garage.vehicle import Vehicle
from garage.vehicle_type import VehicleType
from test.utils import TestHelpers
def test_sta... | 3.34375 | 3 |
Start.py | OmarGSharaf/Multithreaded-socket-server | 0 | 12786632 | <gh_stars>0
import sys, os, signal
from subprocess import Popen
if __name__ == "__main__" :
for i in range (0,5):
Popen(['python', 'Client.py'], stdin=None, stdout=None, stderr=None, close_fds=True)
| 2.234375 | 2 |
setup.py | Bridgeconn/mt2414 | 10 | 12786633 | <filename>setup.py
from setuptools import setup
setup(
name="mt2414",
description="MT2414",
version="0.1.0",
install_requires=[
"nltk",
"polib",
"Flask",
"Flask-RESTful",
"PyJWT",
"Flask-Cors",
"requests",
"psycopg2",
"scrypt",
... | 1.171875 | 1 |
normalization.py | kuredatan/taxocluster | 0 | 12786634 | <filename>normalization.py
#Centralization-reduction for a list of values
import numpy as np
from misc import inf
#Hypothesis of uniform probability for the occurrence of any bacteria whatever the clinic data may be (which is a strong hypothesis...)
def expectList(vList):
n = len(vList)
if not n:
prin... | 3.3125 | 3 |
ruco/clicker.py | nizig/ruco | 10 | 12786635 | """
clicker - rapid command-line user interface development
- Provides convenient syntax and semantics for constructing command-line
interfaces definitions, and tools to speed up development of command-line
applications.
- Define all commands, options, and arguments accepted by an application using
a straight-f... | 2.78125 | 3 |
reservoirpy/nodes/concat.py | ariwanski/reservoirpy | 1 | 12786636 | <gh_stars>1-10
# Author: <NAME> at 08/07/2021 <<EMAIL>>
# Licence: MIT License
# Copyright: <NAME> (2018) <<EMAIL>>
from typing import Sequence
import numpy as np
from ..node import Node
from ..utils.validation import check_node_io
def concat_forward(concat: Node, data):
axis = concat.axis
if not isinstanc... | 2.578125 | 3 |
allennlp/semparse/domain_languages/common/__init__.py | schmmd/allennlp | 17 | 12786637 | <filename>allennlp/semparse/domain_languages/common/__init__.py
from allennlp.semparse.domain_languages.common.date import Date
| 1.210938 | 1 |
entities.py | nav/rbac-abac | 1 | 12786638 | <reponame>nav/rbac-abac<filename>entities.py
import abc
import typing
from dataclasses import dataclass
@dataclass(frozen=True)
class Subject(abc.ABC):
identity: str
@dataclass(frozen=True)
class Role(Subject):
@property
def urn(self):
return f"role:{self.identity}"
@dataclass(frozen=True)
cla... | 2.5625 | 3 |
AgeOfBarbarians/etl.py | jymsq/bigdata_analyse | 1 | 12786639 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2020/12/30 14:40
# @Author : way
# @Site :
# @Describe: 数据处理
import os
import pandas as pd
import numpy as np
from sqlalchemy import create_engine
############################################# 合并数据文件 ##########################################################
... | 2.296875 | 2 |
src/nefelibata/builders/index.py | betodealmeida/nefelibata | 22 | 12786640 | import logging
from typing import Optional
from jinja2 import Environment
from jinja2 import FileSystemLoader
from nefelibata import __version__
from nefelibata.builders import Builder
from nefelibata.builders import Scope
from nefelibata.builders.utils import hash_n
from nefelibata.builders.utils import random_color... | 2.203125 | 2 |
tests/test_mixed.py | rentbrella/janus | 0 | 12786641 | <filename>tests/test_mixed.py<gh_stars>0
import asyncio
import contextlib
import sys
import threading
import pytest
import janus
class TestMixedMode:
@pytest.mark.skipif(
sys.version_info < (3, 7),
reason="forbidding implicit loop creation works on "
"Python 3.7 or higher only",
)
... | 2.171875 | 2 |
MainOperatorExmaple.py | ZnoKunG/PythonProject | 0 | 12786642 | <reponame>ZnoKunG/PythonProject
money = 150
incomePerDay = 200
costPerday = 175
result = money + 30 * incomePerDay - 30 * costPerday
print(result) | 3.078125 | 3 |
scripts/publish_to_a_topic.py | kscottz/owi_arm | 0 | 12786643 | #!/usr/bin/env python
# THIS SHEBANG IS REALLY REALLY IMPORTANT
import rospy
import time
from std_msgs.msg import Int16MultiArray
if __name__ == '__main__':
try:
rospy.init_node('simple_publisher')
# Tell ros we are publishing to the robot topic
pub = rospy.Publisher('/robot', Int16MultiAr... | 2.5 | 2 |
scripts/hello.py | SabrinaMB/pacote_python | 0 | 12786644 | <filename>scripts/hello.py
#!/usr/bin/env python3
from dev_aberto import hello
import gettext
gettext.install('pacote_python', localedir='locale')
if __name__ == '__main__':
date, name = hello()
print(_('Último commit feito em:'), date, _(' por'), name)
| 2.046875 | 2 |
server/mausam.py | HackBots1111/flask-server-bot | 0 | 12786645 | <gh_stars>0
from weather import Weather, Unit
def result(query):
weather = Weather(unit= Unit.CELSIUS)
location = weather.lookup_by_location(query)
condition = location.condition
return condition.text
| 2.75 | 3 |
code/mutual_information.py | Rockysed/PSC_classification | 0 | 12786646 | <filename>code/mutual_information.py
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 13 10:27:51 2018
@author: 754672
"""
#import libraries
import h5py
import numpy as np
from sklearn.feature_selection import mutual_info_classif
#import csdb data
new_file = h5py.File("../data/csdb_blabeled_reinhold_fea... | 2.3125 | 2 |
rotv_apps/partners/admin.py | ivellios/django-rotv-apps | 1 | 12786647 | # -*- coding: utf-8 -*-
from django.contrib import admin
from .models import Partner, MediaPatron, MediaPatronage, NormalMediaPatronage, Colaborator
def activate_event(modeladmin, request, queryset):
for event in queryset.iterator():
event.active = True
event.save()
activate_event.short_descri... | 2.125 | 2 |
manage.py | francismuk/blog | 0 | 12786648 | from app import create_app, db
from flask_script import Manager, Server
# Connect to models
from app.models import User, Category
# Set up migrations
from flask_migrate import Migrate,MigrateCommand
import os
# SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://francis:1234@localhost/blog'
# Creating app instance
# ap... | 2.484375 | 2 |
discord_client.py | rsandrini/random_image_sender | 0 | 12786649 | <reponame>rsandrini/random_image_sender
#!/usr/bin/env python3
import json
from datetime import datetime
from discord.ext import commands
import discord
from get_file import rdm
import os
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)
# read our environment variables
with open("... | 2.28125 | 2 |
server/apps/api/serializers.py | htmercury/GLselector | 0 | 12786650 | <filename>server/apps/api/serializers.py
from rest_framework import serializers
from .models import *
class UserSerializer(serializers.ModelSerializer):
"""A user serializer to aid in authentication and authorization."""
class Meta:
"""Map this serializer to the default django user model."""
mo... | 2.65625 | 3 |