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 |
|---|---|---|---|---|---|---|
appmap/_implementation/configuration.py | applandinc/appmap-python | 34 | 52600 | """
Manage Configuration AppMap recorder for Python.
"""
import inspect
import logging
from os.path import realpath
from pathlib import Path
import re
import sys
from textwrap import dedent
import importlib_metadata
import yaml
from yaml.parser import ParserError
from . import utils
from .env import Env
from .instru... | 2.3125 | 2 |
civic_sandbox/serializers.py | hackoregon/housing-2018 | 1 | 52601 | from rest_framework_gis.serializers import GeoFeatureModelSerializer
from rest_framework.serializers import ModelSerializer
from .models import Permit
class PermitSerializer(GeoFeatureModelSerializer):
class Meta:
model = Permit
geo_field = 'point'
fields = '__all__'
| 1.59375 | 2 |
tf2_api/tf_diffs.py | acproject/learningTF2 | 0 | 52602 | <gh_stars>0
import matplotlib as mpl
import matplotlib.pyplot as plt
# 如果需要在Jupyter的Notebook中显示matplotlib的图像需要使用下面的语句
# %matplotlib inline
import numpy as np
import sklearn
import pandas as pd
import os
import sys
import time
import tensorflow as tf
from tensorflow import keras
# import paddle.fluid
# paddle.fluid.ins... | 2.75 | 3 |
pydis_site/constants.py | hannah-m-moore/site | 700 | 52603 | <filename>pydis_site/constants.py
import os
GIT_SHA = os.environ.get("GIT_SHA", "development")
GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN")
# How long to wait for synchronous requests before timing out
TIMEOUT_PERIOD = int(os.environ.get("TIMEOUT_PERIOD", 5))
| 2.5 | 2 |
sscutils/invoke_commands.py | papsebestyen/sscutils | 0 | 52604 | <filename>sscutils/invoke_commands.py
from dataclasses import asdict
from shutil import rmtree
from dvc.repo import Repo
from invoke import Collection, task
from invoke.exceptions import UnexpectedExit
from structlog import get_logger
from .artifact_context import ArtifactContext
from .config_loading import DatasetCo... | 1.71875 | 2 |
david/modules/pages/homepage/model.py | ktmud/david | 2 | 52605 | <reponame>ktmud/david
# -*- coding: utf-8 -*-
import re
from sqlalchemy.sql import or_
from david.lib.store import redis_store as rs
from david.core.article import Article
from david.modules.news.model import News
DB_HOMEPAGE_ARTICLES = 'homepage_articles'
RE_SPLITTER = re.compile(r'\s+')
def get_homepage_articles(... | 2.421875 | 2 |
question/q6_1_ronri_enzan_equal.py | breeze-shared-inc/python_training_01 | 0 | 52606 | <gh_stars>0
"""
次のLESSONで行う条件分岐(IF文)処理を扱う上で重要です。
論理演算とは
00は真である(正しい)
や
00は偽である(正しくない)
をプログラミングで表現します。
プログラミングでは
真と偽をそれぞれTrueとFalseで
表現します。
例
print(A == A)
=>True
print(1 == 2)
=>False
次のLESSONの条件分岐は
もし00が真なら〜
と言う処理が行われます。
まずは論理演算で扱う記号を活用できるようにしましょう!
論理演算子一覧
AとBが等しい
==
is
AとBが異なる
!=
is not
問題:次のように出力せよ
AとBが等し... | 3.3125 | 3 |
unit_bot/bot.py | trimailov/unit-conversion-bot | 1 | 52607 | <filename>unit_bot/bot.py
import logging
import praw
from unit_bot import creds
from unit_bot.finder import Finder
def scan_and_respond(reply=False, sub='test_unitbot'):
logging.basicConfig(filename="info.log", level=logging.INFO)
r = praw.Reddit(user_agent=creds.USER_AGENT)
r.login(creds.USERNAME, cre... | 2.8125 | 3 |
sciencebeam/pipeline_runners/beam_pipeline_runner.py | elifesciences/sciencebeam | 272 | 52608 | <filename>sciencebeam/pipeline_runners/beam_pipeline_runner.py
from __future__ import absolute_import
import argparse
import logging
import mimetypes
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions, SetupOptions
from apache_beam.metrics.metric import Metrics
from sciencebe... | 2.03125 | 2 |
spkcspider/apps/spider_webcfg/models.py | devkral/spkbspider | 5 | 52609 | <reponame>devkral/spkbspider
__all__ = ["WebConfig"]
from django.urls import reverse
from django.utils.translation import pgettext
from spkcspider.apps.spider.models import DataContent
from spkcspider.apps.spider import registry
from spkcspider.constants import ActionUrl, VariantType
from spkcspider.utils.fields impor... | 1.96875 | 2 |
recipe_app/forms.py | Yesenia152710/Recipes | 0 | 52610 | from django import forms
from recipe_app.models import Author
# class AddAuthorForm(forms.ModelForm):
# class Meta:
# model = Author
# fields = ['au_name']
class AddAuthorForm(forms.Form):
au_name = forms.CharField(max_length=50)
username = forms.CharField(max_length=50)
password = fo... | 2.21875 | 2 |
AutoGrade/forms.py | bilalzaib/AutoGrader | 23 | 52611 | from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.forms import ModelForm
from .models import Course, Submission, Assignment
class SignUpForm(UserCreationForm):
def clean_email(self):
email = self.cleaned_data.get('email')... | 2.5625 | 3 |
Missing_data.py | itskhagendra/Mortality-Rate- | 1 | 52612 | # -*- coding: utf-8 -*-
"""
Created on Sun Oct 15 18:47:17 2017
@author: Khagendra
The following fills the missing data
"""
from sklearn.preprocessing import Imputer
from numba import jit
@jit
def MisDat(X):
#Filling the most frequent value in place of empty values
imputer=Imputer(missing_values="NaN",str... | 3 | 3 |
tests/test_semantic_faster.py | flying-sheep/goatools | 477 | 52613 | #!/usr/bin/env python
"""Test faster version of sematic similarity"""
from __future__ import print_function
# Computing basic semantic similarities between GO terms
# Adapted from book chapter written by _<NAME> and <NAME>_
# How to compute semantic similarity between GO terms.
# First we need to write a function ... | 2.53125 | 3 |
main.py | w4123/CoolQErrorDetector | 14 | 52614 | #!/usr/bin/env python3
import sqlite3
import time
import smtplib
import sys
from email.mime.text import MIMEText
from email.header import Header
from email.utils import formataddr
import traceback
# -------------------请修改以下部分的配置-------------------
# QQ号
qq = 1840686745
# 检测间隔时间(秒)
sleep_time = 60
... | 2.25 | 2 |
testsuite/modulegraph-dir/pkg_d/__init__.py | xoviat/modulegraph2 | 9 | 52615 | e = 1
| 1.445313 | 1 |
ThingsConnectorTests/ThingsConnectorBaseTests.py | huvermann/MyPiHomeAutomation | 0 | 52616 | import unittest
import sys
import json
sys.path.append("..\ThingsConnector")
from ThingsConnectorBase import ThingsConectorBase
#from .. import module # Import module from a higher directory.
from ThingsItemBase import ThingsItemBase
class FunctionMock(object):
def __init__(self, ):
self.mockCalled = Fals... | 2.484375 | 2 |
linuxOperation/app/rpt/views.py | zhouli121018/core | 0 | 52617 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import re
import time
import json
from django.shortcuts import render, get_object_or_404, redirect, get_list_or_404
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_... | 1.4375 | 1 |
kafka/consumers.py | anderscui/nlpy3 | 0 | 52618 | <reponame>anderscui/nlpy3<filename>kafka/consumers.py
# coding=utf-8
from kafka import KafkaConsumer
consumer = KafkaConsumer('CDC', bootstrap_servers='ec2-54-223-226-77.cn-north-1.compute.amazonaws.com.cn:9092', group_id='cdcgrp')
for msg in consumer:
print(msg)
| 2.171875 | 2 |
homework/HW05/imp_roved.py | emaballarin/DSSC_DL_2021 | 0 | 52619 | <reponame>emaballarin/DSSC_DL_2021
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ==============================================================================
#
# :: IMProved ::
#
# Improved tools for Iterative Magnitude Pruning and PyTorch model masking
# with minimal-memory impact, device invariance, O(1) amort... | 2.578125 | 3 |
src/pyapp/conf/helpers/bases.py | pyapp-org/pyapp | 5 | 52620 | """
Conf Helper Bases
~~~~~~~~~~~~~~~~~
"""
import abc
import threading
from abc import ABCMeta
from typing import Any
from typing import Generic
from typing import TypeVar
class DefaultCache(dict):
"""
Very similar to :py:class:`collections.defaultdict` (using __missing__)
however passes the specified k... | 2.6875 | 3 |
pingback/files/pingback.py | conradjones/winstall | 1 | 52621 | <gh_stars>1-10
#!/usr/local/bin/python3
from getmac import get_mac_address
import requests
import socket
def guess_local_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
s.connect(('10.255.255.255', 1))
ip = s.getsockname()[0]
except:
ip = '127.0.0.1'
finally:
... | 2.75 | 3 |
layouts/community/ergodox/algernon/tools/log-to-heatmap.py | fzf/qmk_toolbox | 2 | 52622 | #! /usr/bin/env python3
import json
import os
import sys
import re
import argparse
import time
from math import floor
from os.path import dirname
from subprocess import Popen, PIPE, STDOUT
from blessings import Terminal
class Heatmap(object):
coords = [
[
# Row 0
[ 4, 0], [ 4, 2]... | 2.171875 | 2 |
utils/build_aligner_index.py | VCCRI/Scavenger | 4 | 52623 | #!/usr/bin/python3
import argparse
import logging
import os
import re
import shlex
import sys
from subprocess import Popen, PIPE
# Main function
def build_index(parser_result):
aligner = parser_result.aligner.lower()
global quiet
quiet = parser_result.quiet
check_tools(aligner)
if not quiet:
... | 2.34375 | 2 |
artemis/general/profile.py | peteroconnor-bc/artemis | 235 | 52624 | from tempfile import mkstemp
import cProfile
import pstats
from artemis.general.display import surround_with_header
import os
def what_are_we_waiting_for(command, sort_by ='time', max_len = 20, print_here = True):
"""
An easy way to show what is taking all the time when you run something.
Taken from docs:... | 2.859375 | 3 |
unstable_baselines/lib/envs/vec/__init__.py | Ending2015a/unstable_baselines | 10 | 52625 | from .base import *
from .dummy import *
from .subproc import * | 1.046875 | 1 |
MITx6.00/pset1e2.py | dpanayotov/CS1314 | 0 | 52626 | s = 'azcbobobegghakl'
sub = 'bob'
count = 0
for i in range(0, len(s)):
if sub in s[i:i+3]:
count+=1
print "Number of times bob occurs is: " + str(count)
| 3.75 | 4 |
assignment3.py | munaibalhelali/mpc-course-assignments | 0 | 52627 | import numpy as np
from sim.sim2d import sim_run
# Simulator options.
options = {}
options['FIG_SIZE'] = [8,8]
options['OBSTACLES'] = True
class ModelPredictiveControl:
def __init__(self):
self.horizon = 20
self.dt = 0.2
# Reference or set point the controller will achieve.
self.r... | 2.75 | 3 |
sbpl_perception/src/scripts/tools/fat_dataset/lib/pair_matching/data_pair.py | Tacha-S/perception | 17 | 52628 | <reponame>Tacha-S/perception<gh_stars>10-100
# --------------------------------------------------------
# Deep Iterative Matching Network
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Written by <NAME>, <NAME>
# --------------------------------------------------------
from __future__ import print_... | 1.851563 | 2 |
src/compas_rhino/helpers/artists/mixins/edgeartist.py | gonzalocasas/compas | 0 | 52629 | <filename>src/compas_rhino/helpers/artists/mixins/edgeartist.py
from compas.utilities import color_to_colordict
import compas_rhino
__author__ = ['<NAME>', ]
__copyright__ = 'Copyright 2016 - Block Research Group, ETH Zurich'
__license__ = 'MIT License'
__email__ = '<EMAIL>'
__all__ = ['EdgeArt... | 2.265625 | 2 |
.github/docBuild.py | KubaBoi/CheeseFramework | 2 | 52630 | <filename>.github/docBuild.py
import os
import inspect
import json
import sys
import shutil
from datetime import datetime, timedelta, timezone
sourcePath = os.path.abspath(os.path.join(os.path.dirname( __file__ ), "..", "src", "Cheese"))
docPath = os.path.abspath(os.path.join(os.path.dirname( __file__ ), "..", "DOC.m... | 2.453125 | 2 |
2/week13/Lesson_13.py | briannice/logiscool-python | 0 | 52631 | import matplotlib.pyplot as plt
import csv
import pandas as pd
desired_width = 320
pd.set_option('display.width', desired_width)
pd.set_option('display.max_columns', 10)
# Task 1 - Open and read a csv file
def openCSV():
csvfile = open("./csv/oscar_age_female.csv", newline='')
data = csv.reader(csvfile, del... | 3.875 | 4 |
WhatsappChatAnalyser/author.py | aishwarya-singh25/WhatsApp-Chat-Analyser | 0 | 52632 | <filename>WhatsappChatAnalyser/author.py<gh_stars>0
# importing required libraries
import pandas as pd
import numpy as np
import datetime
import re
import emoji
import nltk
import whatsapp_chat_sentiment as wcs
import whatsapp_chat_visualizer as wcv
from nltk.corpus import stopwords
nltk.data.path.append('/Users/stlp/D... | 3.25 | 3 |
surfaces6.0/villager.py | heyuhowudoin/Isometric-Map_game | 0 | 52633 | <gh_stars>0
import pygame, var, pathfind
from calculations import calculations
class villager:
def __init__(self):
self.coords_g = [0, 0]
self.offset = [0, 0]
self.speed = 0.25
self.speed = [self.speed * 2, self.speed]
self.move_count = 0
self.path_found = False
self.path = []
def get_exact_coords(sel... | 2.96875 | 3 |
pep8radius/main.py | GoodRx/pep8radius | 1 | 52634 | """This module does the argument and config parsing, and contains the main
function (that is called when calling pep8radius from shell)."""
from __future__ import print_function
import os
import sys
try:
from configparser import ConfigParser as SafeConfigParser, NoSectionError
except ImportError: # py2, pragma:... | 2.5625 | 3 |
seagulls-engine/src/seagulls/engine/_pygame.py | codeghetti/seagulls-py | 2 | 52635 | <reponame>codeghetti/seagulls-py
import pygame
# We create our own versions of these because the pygame engine has some typing bugs.
# https://github.com/pygame/pygame/issues/839#issuecomment-812919220
Rect = pygame.rect.Rect
Surface = pygame.surface.Surface
Color = pygame.color.Color
PixelArray = pygame.pixelarray.Pi... | 2.03125 | 2 |
ArkDiscordBot/bot_commands/ark.py | Jackybeat/ArkDiscordBot | 1 | 52636 | # -*- coding: utf-8 -*-
'''
Created on 2 mars 2017
@author: Jacky
'''
import logging
from discord.ext import commands
from ArkDiscordBot.apps import bot
from ArkDiscordBot.discord.utils import parse_context
logger = logging.getLogger('BOT.{}'.format(__name__))
class Commons:
@commands.command(pass_conte... | 2.65625 | 3 |
myproject/boards/tests/test_templatetags.py | xiaohui100/AlfonsBlog | 0 | 52637 | <gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
"""
@author: Alfons
@contact: <EMAIL>
@file: test_templatetags.py
@time: 18-3-25 上午11:38
@version: v1.0
"""
from django import forms
from django.test import TestCase
from ..templatetags.form_tags import field_type, input_class
class ExampleForm(forms.Form):
nam... | 2.53125 | 3 |
research/carls/context.py | srihari-humbarwadi/neural-structured-learning | 939 | 52638 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 2.0625 | 2 |
plugins/modules/fios_dhcp_static_lease.py | nbr23/fiosrouter-ansible | 0 | 52639 | #!/usr/bin/python
# Copyright: nbr23
# License: MIT
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: fios_dhcp_static_lease
short_description: Manage Fios Verizon Router DHCP static leases
description:
- Manage Fios Verizon Router DHCP static ... | 2.078125 | 2 |
tests/helpers/random_utils.py | aeskincbr/kesher-backend | 1 | 52640 | <filename>tests/helpers/random_utils.py
import random
import string
from ipaddress import IPv4Address
def random_ip_address():
random.seed(random.randint(1, 10001))
return str(IPv4Address(random.getrandbits(32)))
def random_string(n=8):
return ''.join(random.choices(string.ascii_letters, k=n))
def ra... | 2.75 | 3 |
solutions/030_solution_06.py | UFResearchComputing/py4ai | 0 | 52641 | # Answer 1 and 4. | 1.429688 | 1 |
mesh/scale_test.py | melonwan/sphereHand | 53 | 52642 | # to test the gradient back-propagation
from __future__ import absolute_import, division, print_function
import torch
import pickle
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
import numpy as np
import cv2
import torch.utils.data as data
from mesh.multiview_utility import Mutua... | 2.171875 | 2 |
ghcontribs/__init__.py | dwhswenson/ghcontribs | 0 | 52643 | <reponame>dwhswenson/ghcontribs
from . import contrib
from . import json_utils
from .contrib import GitHubContrib, ContribType
from .json_utils import write_json_file, load_json_file
from .monthly import get_monthly_contribs, write_all_contrib_files
| 1.015625 | 1 |
login.py | changyuejia/PY04 | 1 | 52644 | number1=10
number2=20
number4=40
number3=30
print('hello world')
print('镜湖')
| 3.234375 | 3 |
djangobmf/migrations/0002_removed_notification_and_watch.py | dmatthes/django-bmf | 1 | 52645 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('djangobmf', '0001_initial'),
]
operations = [
migrations.DeleteModel(
... | 1.453125 | 1 |
tmdprimer/stop_classification/data_loaders/s3_loader.py | dragoon/lstm-primer | 2 | 52646 | import io
import json
from typing import Iterable
from zipfile import ZipFile
import boto3
import pandas as pd
from tmdprimer.stop_classification.data_loaders import DataLoader
from tmdprimer.stop_classification.datasets.dvdt_dataset import DVDTFile, DVDTDataset
from tmdprimer.stop_classification.datasets.sensorlog_d... | 2.234375 | 2 |
by-session/ta-921/j10/a1.py | amiraliakbari/sharif-mabani-python | 2 | 52647 | a = []
def f(n, k):
if k == 0:
if n == 0:
print a
return
if n < 0:
print "invalid:", a
return
a.append(0)
f(n, k-1)
a.pop()
a.append(1)
f(n-1, k-1)
a.pop()
a.append(2)
f(n-2, k-1)
a.pop()
f(5, 3) | 3.296875 | 3 |
05-object_detection/040_finding_corners.py | megatran/selflearning_openCV_ComputerVision | 3 | 52648 | <reponame>megatran/selflearning_openCV_ComputerVision
import cv2
import numpy as np
"""
Corner matching in images is tolerant of:
- Rotations
- Translation
- Slight photometric changes e.g brightness or affine intensity
It is INTOLERANT OF:
- large changes in intensity or photometric changes
- scaling
"""
#import i... | 3.203125 | 3 |
ABC181/ABC181_A.py | consommee/AtCoder | 0 | 52649 | n=int(input())%2
if n==0:
print("White")
else:
print("Black") | 3.5625 | 4 |
web/foi_requests/tests/conftest.py | okfn-brasil/pedidosanonimos | 33 | 52650 | import pytest
from django.db import transaction
from django.utils import timezone
from ..models import Message, FOIRequest, Esic, PublicBody
@pytest.fixture
def public_body(esic):
return PublicBody(
name='example',
esic=esic
)
@pytest.fixture
def esic():
return Esic(
url='http:/... | 2 | 2 |
lmi_utils/plot_labels.py | fringe-ai/LMI_AI_Solutions | 3 | 52651 | import numpy as np
import random
import cv2
import os
import json
from csv_utils import load_csv
import rect
import mask
def plot_one_box(x, img, color=None, label=None, line_thickness=None):
"""
description: Plots one bounding box on image img,
this function comes from YoLov5 project.
ar... | 3.140625 | 3 |
binding.gyp | immuta/node-libhdfs3 | 0 | 52652 | <reponame>immuta/node-libhdfs3
{
'targets' : [
{
'target_name' : 'hdfs3_bindings',
'sources' : [
'src/addon.cc',
'src/HDFileSystem.cc',
'src/HDFile.cc'
],
'xcode_settings': {
'OTHER_CFLAGS': ['-Wn... | 0.761719 | 1 |
epf/src/pipelines/im_color_modifier.py | MLReef/mlreef | 1,607 | 52653 | <reponame>MLReef/mlreef
# MLReef-2020: Color modifications for data augmentation.
from PIL import Image, ImageEnhance
import argparse
import sys
import os
from pathlib import Path
class ColorModifier:
def __init__(self,params):
self.input_dir = params['input_path']
self.output_dir = params['output... | 3 | 3 |
SendTaskToTrello.py | LoicYvinec/PoliCal | 0 | 52654 | <reponame>LoicYvinec/PoliCal
from trello import TrelloClient
import connectSQLite
import configuration
from datetime import datetime
import logging
logging.basicConfig(filename='Running.log',level=logging.INFO, format = '%(asctime)s:%(levelname)s:%(message)s')
config = configuration.load_config_file('polical.yaml')
... | 2.46875 | 2 |
dgp/genera/transform/analyzers/taxonomies/taxonomy_guesser.py | dataspot/dgp | 1 | 52655 | from collections import Counter
from .....core import BaseAnalyzer, Validator, Required
from .....taxonomies import Taxonomy
from .....config.consts import CONFIG_HEADER_FIELDS, CONFIG_TAXONOMY_ID
class TaxonomyGuesserAnalyzer(BaseAnalyzer):
REQUIRES = Validator(
Required(CONFIG_HEADER_FIELDS)
)
... | 2.5625 | 3 |
cli_code/cli_doc_auto/lib/common/argparse/cli.py | s3dawyXD/cli_code | 9 | 52656 | <gh_stars>1-10
#!/usr/bin/env python
import sys
import argparse
"""
snippets:
.add('--crawl', dest='crawl', action='append', default=[])\
.add('--refetch', dest='refetch', action='store_true')\
.sub('init')\
.add('dbname', help='ie:"local" or "myapp00.myservice"')\
.add('configpath', nargs='?', default=Non... | 2.390625 | 2 |
tools/cp.py | onecoolx/picasso | 269 | 52657 | <filename>tools/cp.py<gh_stars>100-1000
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Copy a file.
This module works much like the cp posix command - it takes 2 arguments:
(... | 2.75 | 3 |
mallet/sample.py | undeadpixel/mallet | 1 | 52658 | <gh_stars>1-10
import random
import state
import sequence as seq
import alignment
# NOTE: This function can't be tested, it is completely random :(
def sample(hmm, observations):
"""
Samples a finite number of times (observations) the given HMM. returns two sequences: State path and Emission sequence.
""... | 2.984375 | 3 |
tests/test_tallies/test_mesh_tally_2d.py | fusion-energy/paramak-neutronics | 4 | 52659 | <gh_stars>1-10
import tarfile
import unittest
import urllib.request
from pathlib import Path
import openmc
import openmc_dagmc_wrapper as odw
from openmc_plasma_source import FusionRingSource
class TestMeshTally2D(unittest.TestCase):
"""Tests the MeshTally2D class functionality"""
def setUp(self):
... | 2.328125 | 2 |
src/_abc247.py | nullputra/nlptr-lib | 0 | 52660 | <filename>src/_abc247.py<gh_stars>0
#!/usr/bin/python3
# region abc247 A.
# '''
# verification-helper: PROBLEM https://atcoder.jp/contests/abc247/tasks/abc247_a
import sys
n = int(input())
a = list(map(int, input().split()))
print(*a)
# '''
# endregion
# region abc247 B.
'''
# verification-helper: PROBLEM https://atc... | 2.640625 | 3 |
core/import_csv.py | uktrade/fadmin2 | 3 | 52661 | import csv
"""Set of functions used to import from
csv into the FIDO model. The import is
specified as a dictionary, defining the
model, the name of the primary key and
the list of fields. Recursions are used
to defind foreign keys."""
IMPORT_CSV_MODEL_KEY = "model"
IMPORT_CSV_PK_NAME_KEY = "pk_name"
IMPORT_CSV_PK_KE... | 3.78125 | 4 |
src/settings.py | Hojland/paid-media-db-ingestion | 0 | 52662 | import os
# RESOURCES_PATH = 'resources/'
# UPDATE_FREQUENCY = 60 * 60 * 6 # deprecated. Controlled in Jenkins
MARIADB_CONFIG = {
"user": os.environ["MARIADB_USR"],
"psw": os.environ["MARIADB_PSW"],
"host": "cubus.cxxwabvgrdub.eu-central-1.rds.amazonaws.com",
"port": 3306,
"db": "input",
}
## GO... | 1.515625 | 2 |
Secao7_ColecoesPython/Exercicios/Exerc.3.py | PauloFTeixeira/curso_python | 0 | 52663 | """
Ler um conjunto de números reais, armazenando-o em vetor e calcular o quadrado dos componentes deste vetor,
armazenando o resultado em outro vetor. Os conjuntos têm 10 elementos cada. Imprima todos os elementos.
"""
vetor = set(range(1, 11))
vetor1 = set({})
for numero in vetor:
numero = numero ** 2
vetor... | 3.921875 | 4 |
googleTranslate/main2.py | guimaraf/python-studies | 0 | 52664 | from googletrans import Translator
translator = Translator()
print(translator.translate(' ' + '안녕하세요.', dest='pt')) | 2.03125 | 2 |
Parsing/ParseBCSL.py | sybila/eBCSgen | 1 | 52665 | <filename>Parsing/ParseBCSL.py<gh_stars>1-10
import collections
import json
from numpy import inf
import numpy as np
from copy import deepcopy
from lark import Lark, Transformer, Tree, Token
from lark import UnexpectedCharacters, UnexpectedToken
from lark.load_grammar import _TERMINAL_NAMES
import regex
from sortedcont... | 2.28125 | 2 |
ingestors/misc/jsonfile.py | simonwoerpel/ingest-file | 23 | 52666 | <reponame>simonwoerpel/ingest-file<filename>ingestors/misc/jsonfile.py
import json
from followthemoney import model
from followthemoney.util import MEGABYTE
from ingestors.ingestor import Ingestor
from ingestors.support.encoding import EncodingSupport
from ingestors.exc import ProcessingException
class JSONIngestor... | 2.421875 | 2 |
data_generation/nlp.py | haeseung81/PyTorchStepByStep | 170 | 52667 | import requests
import zipfile
import os
import errno
import nltk
from nltk.tokenize import sent_tokenize
ALICE_URL = 'https://ota.bodleian.ox.ac.uk/repository/xmlui/bitstream/handle/20.500.12024/1476/alice28-1476.txt'
WIZARD_URL = 'https://ota.bodleian.ox.ac.uk/repository/xmlui/bitstream/handle/20.500.12024/1740/wizo... | 3.078125 | 3 |
src/ai/backend/client/cli/admin/sessions.py | dexterastin/backend.ai-client-py | 0 | 52668 | import sys
import click
from tabulate import tabulate
import textwrap
from . import admin
from ...helper import is_admin
from ...session import Session, is_legacy_server
from ...versioning import get_naming, apply_version_aware_fields
from ..pretty import print_error, print_fail
# Lets say formattable options are:
... | 2.0625 | 2 |
dplhooks/deploys/urls.py | cschlay/dplhooks | 0 | 52669 | from django.urls import path
from dplhooks.deploys import views
urlpatterns = [
path('p/deploy', views.DeployView.as_view())
]
| 1.546875 | 2 |
digicert_express/platforms/ubuntu_platform.py | digicert/digicert_express | 2 | 52670 | <reponame>digicert/digicert_express
from base_platform import BasePlatform
class UbuntuPlatform(BasePlatform):
APACHE_SERVICE = 'apache2ctl'
APACHE_RESTART_COMMAND = 'service apache2 restart'
| 1.8125 | 2 |
lophi-automation/lophi_automation/dataconsumers/logfile.py | patriotemeritus/LO-PHI | 28 | 52671 | """
Classes to handle logging
(c) 2015 Massachusetts Institute of Technology
"""
# Native
import time
import logging
logger = logging.getLogger(__name__)
# LO-PHI
import lophi.globals as G
class LogFile:
"""
This class will handle all of the writing to files for LO-PHI. Simply
initialize... | 3 | 3 |
leonardo/module/web/models/__init__.py | timgates42/django-leonardo | 102 | 52672 |
from leonardo.module.web.models.page import *
from leonardo.module.web.models.widget import *
from leonardo.module.web.widget.icon.models import IconWidget
from leonardo.module.web.widget.application.models import ApplicationWidget
from leonardo.module.web.widget.markuptext.models import MarkupTextWidget
from leonard... | 1.1875 | 1 |
python/atlasPH.py | ferguman/OpenAg-MVP-II | 2 | 52673 | import smbus2, time
address = 0x63 #Atlas PH Probe standard I2C address is 99 decimal.
class atlasPH(object):
def __init__(self):
self.bus = smbus2.SMBus(1)
def write(self, command):
self.bus.write_byte(address, ord(command))
def readBlock(self, numBytes):
retur... | 2.859375 | 3 |
nodeprep/bd_vlib/__init__.py | maduhu/KubeDirector-v0.1.0 | 0 | 52674 | <gh_stars>0
# Copyright 2018 BlueData Software, 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
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or a... | 1.140625 | 1 |
tests/test_provider_MissionCriticalCloud_cosmic.py | mjuenema/python-terrascript | 507 | 52675 | # tests/test_provider_MissionCriticalCloud_cosmic.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:14:40 UTC)
def test_provider_import():
import terrascript.provider.MissionCriticalCloud.cosmic
def test_resource_import():
from terrascript.resource.MissionCriticalCloud.cosmic import cosmic_a... | 1.601563 | 2 |
src/signal_based_analysis.py | ban-m/dyss | 0 | 52676 | """ This is a modified version of simple.py script bundled with Read Until API"""
import argparse
import logging
import sys
import traceback
import time
import numpy
import read_until
import cffi
import os
import h5py
import glob
import concurrent.futures
import dyss
def _get_parser():
parser = argparse.ArgumentPa... | 2.25 | 2 |
sdk/python/pulumi_gcp/kms/registry.py | 23doors/pulumi-gcp | 1 | 52677 | <filename>sdk/python/pulumi_gcp/kms/registry.py
# 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 json
import warnings
import pulumi
import pulumi.runtime
from typing import Unio... | 1.742188 | 2 |
simplewrapmat/__init__.py | yasutow/simplewrapmat | 0 | 52678 | <reponame>yasutow/simplewrapmat<filename>simplewrapmat/__init__.py
from .func import (
plot_X,
)
__version__='0.0.1'
| 1.078125 | 1 |
bin/devel/get_name_from_intervals.py | genomecuration/JAM | 0 | 52679 | <reponame>genomecuration/JAM<gh_stars>0
import argparse, re, sys, os
from gff_utils import read_gff, by_key, add_ID
import urllib
def read_interval( infasta, lineRE=re.compile(r'>([^:]+):([0-9]+)-([0-9]+)\(([+-])\)') ):
intervals = {}
for line in infasta:
m = lineRE.match( line )
if m:
... | 2.625 | 3 |
logiq/src/Qbits.py | Bnz-0/logiq | 1 | 52680 | from .abs_Qstate import _Qstate, unreal
from .Basis import Basis
from .Operator import MeasureOp, Op
from .Qerrors import IllegalOperationError, InitializationError
from .Qmath import ket, math, matrix, roundedVector
from .qtils import Vdigit, equal, formatProbs, mod_square, prod, val2str
#### Qbits.py
#
# This file c... | 2.546875 | 3 |
metrics/heron/tmaster/client.py | LaudateCorpus1/caladrius | 16 | 52681 | # Copyright 2018 Twitter, Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
""" This module contains classes and methods for extracting metrics from the
Heron Topology Master instance. """
import logging
import warnings
import datetime as dt
from typing import Dict, ... | 2.34375 | 2 |
gcpy/grid.py | sdeastham/gcpy | 33 | 52682 | import numpy as np
import xarray as xr
from numpy import asarray
import scipy.sparse
from itertools import product
from .util import get_shape_of_data
from .grid_stretching_transforms import scs_transform
from .constants import R_EARTH_m
def get_troposphere_mask(ds):
"""
Returns a mask array for picking out t... | 2.78125 | 3 |
src/situation.py | StevenBaby/chess | 10 | 52683 | <gh_stars>1-10
'''
(C) Copyright 2021 Steven;
@author: Steven <EMAIL>
@date: 2021-06-22
用于局面 以及 走法生成 的数据结构
'''
# coding=utf-8
import copy
import re
import itertools
import numpy as np
from chess import Chess
from logger import logger
from method import Method
class Generator(object):
'''走法生成器'''
def fil... | 3.171875 | 3 |
modules/yats/migrations/0014_auto_20180911_1440.py | gthreepwood/yats | 54 | 52684 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-09-11 12:40
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import yats.models
class Migration(migrations.Migration):
depe... | 1.679688 | 2 |
model/training/sweep.py | Aalanli/ARTR | 0 | 52685 | <gh_stars>0
# %%
import os
from typing import Callable, List, Generator, Set, Tuple
import torch
from torch.nn import Module
import data.dataset as data
import utils.misc as misc
from utils.loss import HungarianMatcher, SetCriterion
from model.trainer import TrainerWandb
def build_loss(HungarianMatcher: Module, Se... | 1.890625 | 2 |
iis-3rdparty-madis/src/main/resources/eu/dnetlib/iis/3rdparty/scripts/madis/functions/vtable/queryplan.py | mpol/iis | 20 | 52686 | """
.. function:: queryplan(query) -> Query plan
Returns the query plan of the input query.
Examples::
>>> sql("queryplan select 5")
operation | paramone | paramtwo | databasename | triggerorview
------------------------------------------------------------------
SQLITE_SELECT | None | None ... | 3.15625 | 3 |
setup.py | AlliedCrowds/bitso-py | 1 | 52687 | <filename>setup.py
import os
from setuptools import setup
if os.path.exists('README.md'):
long_description = open('README.md').read()
else:
long_description = 'A python wrapper for the Bitso API.'
setup(
name='bitso-py',
version='3.0.0',
author='<NAME>',
author_email='<EMAIL>',
packages=['... | 1.53125 | 2 |
tekdrive/session.py | tektronix/tekdrive-sdk-python | 1 | 52688 | """Provide Session class."""
import logging
from time import sleep
from copy import deepcopy
from typing import TYPE_CHECKING, Dict, Optional, Tuple, Union
from urllib.parse import urljoin
from .authorizer import BaseAuthorizer
from .request_wrapper import RequestWrapper
from .retry import RetryPolicy, RateLimit
from... | 2.4375 | 2 |
pyreach/impl/thread_util.py | google-research/pyreach | 13 | 52689 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 2.96875 | 3 |
publications/migrations/0001_initial.py | ForumDev/djangocms-publications | 0 | 52690 | <filename>publications/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Type'
d... | 2.109375 | 2 |
src/dumas.py | sajtizsolt/dumas | 3 | 52691 | from discord import Client
from discord.ext import tasks
from configurationparser import ConfigurationParser
from message import Message
import asyncio, logging, random, time
logger = logging.getLogger(__name__)
HELP='''```
Usage:
&help - show this help page
&start [author_id] - start sending mes... | 2.46875 | 2 |
purge/admin.py | gregschmit/django-purge | 1 | 52692 | from django.contrib import admin
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.contrib.contenttypes.models import ContentType
from django.forms import ModelMultipleChoiceField
from django.utils.html import format_html
from . import models
class CustomModelMCF(ModelMultipleChoiceField):
... | 1.96875 | 2 |
rle_to_tiff.py | sgtell/brother-scand | 7 | 52693 | #!/usr/bin/env python3
"""Creates a standard tiff image from RLENGTH data sent by Brother scanners."""
import struct
import sys
def rle_decode(data):
"""Decodes PackBits encoded data."""
i = 0
output = bytearray()
while i < len(data):
val = data[i]
i += 1
if val == 0x80:
... | 2.890625 | 3 |
src/genie/libs/parser/ios/tests/ShowEthernetServiceInstanceStats/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 52694 | <filename>src/genie/libs/parser/ios/tests/ShowEthernetServiceInstanceStats/cli/equal/golden_output_expected.py<gh_stars>100-1000
expected_output = {
"max_num_of_service_instances": 32768,
"service_instance": {
2051: {
"pkts_out": 0,
"pkts_in": 0,
"interface": "Gigabit... | 1.375 | 1 |
src/dnd/types.py | s-zhang/DnDnProbabilities | 0 | 52695 | from typing import Union
from pmf.Pmf import Pmf
IntDist = Union[int, Pmf[int]]
| 1.53125 | 2 |
classification/tests/test_classifier.py | magesh-technovator/serverless-transformers-on-aws-lambda | 103 | 52696 | <gh_stars>100-1000
from src.classifier import Classifier
pipeline = Classifier()
def test_response(requests, response):
assert response == pipeline(requests)
| 1.804688 | 2 |
scphylo/commands/caller/_4rsem.py | faridrashidi/scphylo-tools | 0 | 52697 | <gh_stars>0
import glob
import subprocess
import click
import pandas as pd
import scphylo as scp
from scphylo.ul._servers import cmd, write_cmds_get_main
@click.command(short_help="Run RSEM.")
@click.argument(
"outdir",
required=True,
type=click.Path(
exists=True, file_okay=False, dir_okay=True,... | 2 | 2 |
interface.py | rswgnu/rsw_interface | 0 | 52698 | <reponame>rswgnu/rsw_interface
# FILE: interface.py
#
# SUMMARY: Inheritable class interface/protocol support for Python; implements class `Interface' and conformance functions
# USAGE: from interface import *; inherit from `Interface'; call one of the conformance functions described below
# KEYWORD... | 2.8125 | 3 |
tools/wptrunner/wptrunner/executors/executoropera.py | meyerweb/wpt | 14,668 | 52699 | <gh_stars>1000+
from ..webdriver_server import OperaDriverServer
from .base import WdspecExecutor, WdspecProtocol
class OperaDriverProtocol(WdspecProtocol):
server_cls = OperaDriverServer
class OperaDriverWdspecExecutor(WdspecExecutor):
protocol_cls = OperaDriverProtocol
| 1.765625 | 2 |