content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
#!/usr/bin/env python
# GenerateJSONOutput.py
#
# Command-line interface for turning output root files into JSON files for further processing.
#
# By: Larry Lee - Dec 2017
import argparse
import sys
import os
import ROOT
ROOT.gSystem.Load(f"{os.getenv('HISTFITTER')}/lib/libSusyFitter.so")
ROOT.gROOT.SetBatch()
pa... | 27.979058 | 137 | 0.554454 | [
"BSD-2-Clause"
] | HistFitter/HistFitter | scripts/GenerateJSONOutput.py | 5,344 | Python |
import csv
import logging
import random
import re
from collections import OrderedDict
from enum import IntEnum
from pathlib import Path
from typing import Optional, Tuple, List
import attr
from torch.utils.data import Dataset
from syntok import segmenter
from sklearn.model_selection import train_test_split
logger = ... | 30.74269 | 102 | 0.62393 | [
"MIT"
] | yasserglez/kaggle | gendered-pronoun-resolution/data.py | 5,257 | Python |
from operator import attrgetter
from go.base.utils import vumi_api_for_user
from go.config import configured_conversation_types
from go.vumitools.conversation.models import CONVERSATION_RUNNING
from django.core.mail import send_mail
from django.template.loader import render_to_string
from django.conf import settings
... | 42.39759 | 76 | 0.688832 | [
"BSD-3-Clause"
] | lynnUg/vumi-go | go/account/utils.py | 3,519 | Python |
# Generated by Django 2.2.24 on 2021-12-13 07:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("taskflow3", "0017_auto_20211116_1526"),
]
operations = [
migrations.AlterModelOptions(
name="autoretrynodestrategy",
... | 35.152174 | 116 | 0.512678 | [
"Apache-2.0"
] | brookylin/bk-sops | gcloud/taskflow3/migrations/0018_auto_20211213_1554.py | 1,695 | Python |
from django.contrib import admin
from models import Connection, Network
class ConnectionAdmin(admin.ModelAdmin):
list_display = ("id", 'device_1', 'device_2', 'network', 'concetion_type', )
list_filter = ['network', 'concetion_type']
search_fields = ['device_1__property_number', 'device_2__property_numbe... | 31 | 80 | 0.764268 | [
"MIT",
"Unlicense"
] | ShangShungInstitute/django-manage-it | manage_it/network/admin.py | 403 | Python |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 2.1.15.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# Bu... | 26.079137 | 91 | 0.688828 | [
"MIT"
] | Akshay-ch-dj/RESTapi-app-series | app/app/settings.py | 3,625 | Python |
"""
Provide classes to perform the groupby aggregate operations.
These are not exposed to the user and provide implementations of the grouping
operations, primarily in cython. These classes (BaseGrouper and BinGrouper)
are contained *in* the SeriesGroupBy and DataFrameGroupBy objects.
"""
from __future__ import annota... | 31.34114 | 88 | 0.584089 | [
"BSD-3-Clause"
] | CuteLemon/pandas | pandas/core/groupby/ops.py | 40,148 | Python |
#!/usr/bin/env python
import sys
from indicator import Indicator
def main():
stationId = sys.argv[1] if len(sys.argv) > 1 else Indicator.DEFAULT_STATION_ID
ind = Indicator(stationId)
print(ind.get_aqindex_url())
print(ind.get_all_stations_url())
print(ind.get_aqindex())
print(ind.get_data())
... | 22.411765 | 82 | 0.690289 | [
"MIT"
] | runningt/airquality_indicator | main.py | 381 | Python |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | 35.536813 | 121 | 0.669589 | [
"Apache-2.0"
] | minminsun/tensorflow | tensorflow/python/ops/math_ops.py | 129,354 | Python |
"""
Median and Mean for Cauchy distribution
---------------------------------------
This plot shows graphically that mean-based statistics are not robust for
the Cauchy distribution. Median-based statistics should be used instead.
"""
# Author: Jake VanderPlas
# License: BSD
# The figure produced by this code is pu... | 29.785714 | 79 | 0.626965 | [
"BSD-2-Clause"
] | larsmans/astroML | book_figures/chapter3/fig_cauchy_median_mean.py | 3,753 | Python |
"""
Utilities for fast persistence of big data, with optional compression.
"""
# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# Copyright (c) 2009 Gael Varoquaux
# License: BSD Style, 3 clauses.
import pickle
import traceback
import os
import zlib
import warnings
from io import BytesIO
from ._co... | 36.826638 | 79 | 0.611516 | [
"MIT"
] | Con-Mi/lambda-packs | Sklearn_scipy_numpy/source/sklearn/externals/joblib/numpy_pickle.py | 17,419 | Python |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
import contextlib
import itertools
impo... | 35.769748 | 120 | 0.608279 | [
"MIT"
] | 1130310223/fairseq | fairseq/data/data_utils.py | 21,283 | Python |
from flask import Flask
from flask_bootstrap import Bootstrap
from config import config_options
bootstrap = Bootstrap()
def create_app(config_name):
app = Flask(__name__)
# create ap configurations
app.config.from_object(config_options[config_name])
# initialize flask extensions
bootstrap.init... | 20.740741 | 55 | 0.755357 | [
"MIT"
] | AliKheirAbdi/NewsApp | app/__init__.py | 560 | Python |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from pathlib import Path
import pandas as pd
from watchdog.events import FileSystemEventHandler
from watchdog.observers ... | 29.547619 | 69 | 0.643836 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | jhrmnn/pybudget | src/budget/watcher.py | 1,241 | Python |
import numpy as np
np.random.seed(0)
import pandas as pd
df1 = pd.DataFrame(
{
"A": ["A0", "A1", "A2", "A3"],
"B": ["B0", "B1", "B2", "B3"],
},
index=[0, 1, 2, 3]
)
df2 = pd.DataFrame(
{
"A": ["A4", "A5", "A6", "A7"],
"B": ["B4", "B5", "B6", "B7"],
},
index=[0, ... | 16.655738 | 66 | 0.451772 | [
"MIT"
] | tkaya94/UdemyDataScience | 3_Pandas/ConcatAppendJoin.py | 1,016 | Python |
import os
from utils import yaml_stream
from sqlalchemy import Table
def importyaml(connection, metadata, source_path):
activityIDs = {
"copying": 5,
"manufacturing": 1,
"research_material": 4,
"research_time": 3,
"invention": 8,
"reaction": 11
}
industryB... | 46.635294 | 95 | 0.494198 | [
"MIT"
] | Caffe1neAdd1ct/yamlloader | tableloader/tableFunctions/blueprints.py | 3,964 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutTuples(Koan):
def test_creating_a_tuple(self):
count_of_three = (1, 2, 5)
self.assertEqual(5, count_of_three[2])
def test_tuples_are_immutable_so_item_assignment_is_not_possible(self):
count_of_three =... | 34.014493 | 91 | 0.611419 | [
"MIT"
] | Oulanos/Python_Koans | python3/koans/about_tuples.py | 2,347 | Python |
# Generated by Django 2.2.1 on 2019-05-17 22:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wells', '0088_fieldsprovided'),
('wells', '0088_remove_well_ems_id'),
]
operations = [
]
| 17.666667 | 47 | 0.637736 | [
"Apache-2.0"
] | bcgov/gwells | app/backend/wells/migrations/0089_merge_20190517_2255.py | 265 | Python |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.contrib.contenttypes import generic
class Migration(SchemaMigration):
def forwards(self, orm):
# renaming ExperimentACL to 'ObjectACL'
db.rename_table('tar... | 76.363636 | 182 | 0.562762 | [
"Apache-2.0"
] | nrmay/mytardis | tardis/tardis_portal/south_migrations/0022_object_acl_1.py | 21,000 | Python |
from features.models import Attempt, Feature
from jury.models import JudgeRequestAssigment, JudgeRequest
from teams.models import Team
for team in Team.objects.all():
for feature in Feature.objects.all():
request = JudgeRequest.objects.filter(team=team, feature=feature).last()
total, num = 0, 0
... | 45.695652 | 91 | 0.584206 | [
"MIT"
] | altostratous/gatuino-scoreboard | scripts/check_attempts.py | 1,051 | Python |
import discord
from discord.ext import commands
import asyncio
import wolframalpha
from aiohttp import ClientSession
from html2text import html2text
from random import choice, randint
from re import sub
#setup wolframalpha API
client = wolframalpha.Client(open('WA_KEY').readline().rstrip())
class Api(commands.Cog):
... | 37.523316 | 213 | 0.541011 | [
"MIT"
] | JoseFilipeFerreira/JBB.py | extensions/api.py | 7,242 | Python |
"""
Copyright 2020 Qiniu Cloud (qiniu.com)
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, softw... | 37.827586 | 106 | 0.741112 | [
"Apache-2.0"
] | Billseeyao/pandora-python-sdk.v2 | pdr_python_sdk/pdr_python_sdk/spl/spl_streaming_batch_command.py | 1,097 | Python |
import argparse
import configparser
import json
import os
import sys
import time
import requests
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from util import logger
class ConversationScraper:
"""Scraper that retrieves, process and stores all messages belonging to a specific Facebook conversat... | 44.210084 | 161 | 0.599316 | [
"Apache-2.0"
] | 5agado/conversation-analyzer | src/util/conversationScraper.py | 10,522 | Python |
# 033
# Ask the user to enter two numbers. Use whole number division to divide
# the first number by the second and also work out the remainder and
# display the answer in a user-friendly way
# (e.g. if they enter 7 and 2 display “7 divided by 2 is 3
# with 1 remaining”).
from typing import List
def check_num_list(p... | 33.959184 | 73 | 0.5625 | [
"Apache-2.0"
] | DGrifferty/Python | 150-Challenges/Challenges 27 - 34/Challenge 33.py | 1,668 | Python |
from django.urls import path
from .views import (
PostListView,
PostDetailView,
PostCreateView,
PostUpdateView,
PostDeleteView,
UserPostListView
)
from . import views
urlpatterns = [
path('', PostListView.as_view(), name = 'blog-home'),
path('user/<str:username>', UserPostListView.as_vi... | 34.142857 | 82 | 0.659693 | [
"MIT"
] | kgomathi2910/Blog-App | blog/urls.py | 717 | Python |
# Code made for Sergio Andrés Díaz Ariza
# 23 March 2021
# License MIT
# Transport Phenomena: Python Program-Assesment 3.3
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
sns.set()
class Wire_Param:
def Power_from_volt(self, V, R_Km, Dis_insul, Diameter_mm):
As = (np.pi * (Diam... | 27.911111 | 92 | 0.573248 | [
"MIT"
] | Daz-Riza-Seriog/Transport_Phenomena | Heat_Transfer/3.3-Wire_Isolation_Base__Fin.py | 2,514 | Python |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Factory method for easily getting imdbs by name."""
from __future__ ... | 35.272727 | 79 | 0.625552 | [
"BSD-2-Clause"
] | wangvation/torch-mobilenet | lib/datasets/factory.py | 2,716 | Python |
import platform
from re import I
import sys
from pprint import pp, pprint
if platform.system() == "Windows":
filename = ".\\packages\\react-app\\src\\App.jsx"
else:
filename = "./packages/react-app/src/App.jsx"
networkStruct = {
"localhost": "localhost",
"mainnet": "mainnet",
"kovan": "kovan",
... | 24.641509 | 118 | 0.606432 | [
"MIT"
] | WeLightProject/Tai-Shang-NFT-Wallet | changeReactAppNetwork.py | 1,344 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Script to upload the mappings of Freebase to Wikidata.
Can be easily adapted to upload other String identifiers as well
This bot needs the dump from
https://developers.google.com/freebase/data#freebase-wikidata-mappings
The script takes a single parameter:
-filename: th... | 32.920635 | 79 | 0.583173 | [
"MIT"
] | 5j9/pywikibot-core | scripts/freebasemappingupload.py | 4,148 | Python |
#!/usr/bin/python3.5
import yaml
import os.path
import logging
logger = logging.getLogger('rsync_backup')
config = None
cmd = '/usr/bin/rsync'
# load the configuration file in
def load_config(filepath):
global config
with open(filepath, "r") as file_descriptor:
config = yaml.load(fi... | 33.340659 | 148 | 0.658866 | [
"Apache-2.0"
] | krcooke/rsync_backup | bin/utils/config.py | 3,034 | Python |
"""
sphinx.domains.cpp
~~~~~~~~~~~~~~~~~~
The C++ language domain.
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from typing import (
Any, Callable, Dict, Generator, Iterator, List, Tuple, Type, TypeVar, Union
)
from do... | 39.700055 | 145 | 0.552608 | [
"BSD-2-Clause"
] | begolu2/sphinx | sphinx/domains/cpp.py | 288,143 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | 51.042328 | 1,345 | 0.671504 | [
"Apache-2.0"
] | pulumi-bot/pulumi-azure-native | sdk/python/pulumi_azure_native/web/v20200901/web_app_site_push_settings_slot.py | 9,647 | Python |
"""
This software was developed by the University of Tennessee as part of the
Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
project funded by the US National Science Foundation.
See the license text in license.txt
copyright 2008, 2009, University of Tennessee
"""
import wx
import sys
from sas.... | 38.269076 | 86 | 0.59597 | [
"BSD-3-Clause"
] | andyfaff/sasview | src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py | 9,529 | Python |
import unittest
from typing import Optional
from pathlib import Path
from time import strftime, gmtime
from github import Github
import json
import yaml
from .. import get_repo_meta, clone_and_archive
from ..get_github import dump_list
from pathlib import Path
class TestGetGithub(unittest.TestCase):
"""
Te... | 44.253247 | 151 | 0.650624 | [
"CC0-1.0"
] | hellkite500/github_archive | github_archive/test/test_get_github.py | 6,815 | Python |
# Copyright 2020 Google Research. All Rights Reserved.
#
# 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... | 39.967626 | 88 | 0.688327 | [
"Apache-2.0"
] | datawowio/automl | efficientdet/aug/autoaugment.py | 66,666 | Python |
"""
mbed SDK
Copyright (c) 2011-2015 ARM Limited
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 wr... | 31.708333 | 72 | 0.788436 | [
"Apache-2.0"
] | ARMmbed/mbed-os-tools | packages/mbed-host-tests/mbed_host_tests/host_tests_plugins/module_copy_silabs.py | 761 | Python |
""" Tests for the linecache module """
import linecache
import unittest
import os.path
from test import support
FILENAME = linecache.__file__
INVALID_NAME = '!@$)(!@#_1'
EMPTY = ''
TESTS = 'inspect_fodder inspect_fodder2 mapping_tests'
TESTS = TESTS.split()
TEST_PATH = os.path.dirname(__file__)
MODULES = "linecache ... | 31.911565 | 76 | 0.626519 | [
"Apache-2.0"
] | AnandEmbold/ironpython3 | Src/StdLib/Lib/test/test_linecache.py | 4,691 | Python |
import torch
import os
import os.path
import shutil
import numpy as np
import soundfile as sf
from pathlib import PurePath
from torch import nn
from torch.utils.data import DataLoader, random_split
from asteroid.data import TimitDataset
from asteroid.data.utils import CachedWavSet, RandomMixtureSet, FixedMixtureSet
fr... | 44.574074 | 121 | 0.753635 | [
"MIT"
] | flyingleafe/asteroid | notebooks/train_tasnet.py | 4,814 | Python |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import logging
import datetime
import sqlalchemy as sa
from random import randint
from flask import Blueprint
from f... | 44.5 | 100 | 0.693712 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | lundjordan/build-relengapi | relengapi/blueprints/archiver/__init__.py | 9,256 | Python |
# Copyright 2017 Google 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 agreed to in writing, ... | 28.202381 | 80 | 0.643309 | [
"Apache-2.0"
] | anishsingh20/tensor2tensor | tensor2tensor/bin/make_tf_configs.py | 2,369 | Python |
# coding: utf-8
from __future__ import unicode_literals
import re
import base64
from .common import InfoExtractor
from ..compat import (
compat_urlparse,
compat_parse_qs,
)
from ..utils import (
clean_html,
ExtractorError,
int_or_none,
unsmuggle_url,
smuggle_url,
)
class KalturaIE(InfoEx... | 40.911111 | 178 | 0.47094 | [
"Unlicense"
] | inshadsajeev143/utube | youtube_dl/extractor/kaltura.py | 14,728 | Python |
from conans import ConanFile, CMake, tools
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"
def build_requirements(self):
if self.settings.os == "Macos" and self.settings.arch == "armv8":
# ... | 37.333333 | 88 | 0.645833 | [
"MIT"
] | AnotherFoxGuy/conan-center-index | recipes/librasterlite/all/test_package/conanfile.py | 1,008 | Python |
""" Tests for grph.py """
import os
import platform
import random
import re
import string
from subprocess import getstatusoutput
PRG = './grph.py'
RUN = f'python {PRG}' if platform.system() == 'Windows' else PRG
SAMPLE1 = './tests/inputs/1.fa'
SAMPLE2 = './tests/inputs/2.fa'
SAMPLE3 = './tests/inputs/3.fa'
# ------... | 21.561151 | 64 | 0.414414 | [
"MIT"
] | BioPeterson/biofx_python | 09_grph/tests/grph_test.py | 2,997 | Python |
import six
import pytest
from pymemcache.test.utils import MockMemcacheClient
@pytest.mark.unit()
def test_get_set():
client = MockMemcacheClient()
assert client.get(b"hello") is None
client.set(b"hello", 12)
assert client.get(b"hello") == 12
@pytest.mark.unit()
def test_get_set_unicide_key():
... | 22.844828 | 74 | 0.619623 | [
"Apache-2.0"
] | FerasAlazzeh/pymemcache | pymemcache/test/test_utils.py | 2,650 | Python |
# Copyright 2021 Google LLC. All Rights Reserved.
#
# 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... | 35.337349 | 79 | 0.762359 | [
"Apache-2.0"
] | Avnish327030/tfx | tfx/orchestration/experimental/core/testing/test_async_pipeline.py | 2,933 | Python |
import os
import datetime
TOKEN = os.environ.get("TOKEN")
DB_PATH = os.environ.get("DB_PATH")
EXPIRATION_TIMEDELTA = datetime.timedelta(days=7)
| 18.25 | 49 | 0.767123 | [
"MIT"
] | QwertygidQ/ChessBot | chessbot/config.py | 146 | Python |
"""Reducing Functions in Python
These are functions that recombine an iterable recursively, ending up with a single return value
Also called accumulators, aggregators, or folding functions
Example: Finding the maximum value in an iterable
a0, a1, a2, ...,, aN-1
max(a, b) _> maximum of a and b
result =a0
r... | 25.543478 | 105 | 0.473759 | [
"Unlicense"
] | minefarmer/deep-Dive-1 | .history/my_classes/FirstClassFunctions/reducing_functions_20210707181157.py | 3,525 | Python |
def lcm(x, y):
if x > y:
greater = x
else:
greater = y
while(True):
if((greater % x == 0) and (greater % y == 0)):
lcm = greater
break
greater += 1
return lcm
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
pri... | 14.185185 | 62 | 0.496084 | [
"MIT"
] | mariamaafreen/python-exploring-battle-1 | lcm.py | 383 | Python |
'''Escreva um programa que receba um número inteiro na entrada e verifique
se o número recebido possui ao menos um dígito com um dígito adjacente
igual a ele. Caso exista, imprima "sim"; se não existir, imprima "não". '''
num = int(input('Digite um número inteiro: '))
alg1 = num % 10
while num > 0:
num = num //... | 25.8 | 76 | 0.581395 | [
"MIT"
] | eduardodarocha/Introducao_Ciencia_da_Computacao_com_Python_Parte_1_Coursera | Exercicios/digitos_adjacentes.py | 524 | Python |
#from fake_useragent import UserAgent
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
import os
# 订阅,0关闭
dingyue = 1
# 短信,0关闭
duanxin = 1
# 设置翻页范围
start_page = 1
end_page = 1
def main():
# 当前版本仅支持订阅一个手机号码
_list = [
['18888888888', '张三']
]
... | 53.621993 | 186 | 0.373878 | [
"Apache-2.0"
] | 006hjy/buy_house | main/JW/main.py | 16,048 | Python |
#!/usr/bin/env python
from django.urls import reverse_lazy
from django.shortcuts import Http404
from django.utils.translation import ugettext as _
from vanilla import ListView, CreateView, DetailView, UpdateView, DeleteView, TemplateView
from .forms import ArticleForm, ArticleSearchForm
from .models import Article, Fol... | 29.569767 | 90 | 0.672827 | [
"BSD-2-Clause"
] | joyinsky/pergamum | pergamum/bibloi/views.py | 2,543 | Python |
"""
Get absolute URLs for static assets.
"""
from urllib.parse import ParseResult, urlparse, urlunparse
from django import template
from django.templatetags.static import StaticNode
from django.urls import reverse
register = template.Library()
class AbstaticNode(StaticNode):
"""
{% abstatic %} is like Djan... | 29.988235 | 136 | 0.66889 | [
"Apache-2.0"
] | Madoshakalaka/morphodict | src/CreeDictionary/CreeDictionary/templatetags/url_extras.py | 2,553 | Python |
import pdf_to_json as p2j
import json
url = "file:data/multilingual/Latn.SUS/Serif_8/udhr_Latn.SUS_Serif_8.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
| 30.3 | 73 | 0.811881 | [
"BSD-3-Clause"
] | antoinecarme/pdf_to_json_tests | data/multilingual/Latn.SUS/Serif_8/pdf_to_json_test_Latn.SUS_Serif_8.py | 303 | Python |
"""
hubspot engagements api
"""
from hubspot3.base import BaseClient
from hubspot3.utils import get_log
from typing import Dict, List
ENGAGEMENTS_API_VERSION = "1"
class EngagementsClient(BaseClient):
"""
The hubspot3 Engagements client uses the _make_request method to call the API
for data. It returns... | 34.441176 | 97 | 0.575576 | [
"MIT"
] | benaduggan/hubspot3 | hubspot3/engagements.py | 3,513 | Python |
# coding: utf-8
"""
Copyright 2017 Square, 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 la... | 29.198347 | 104 | 0.579394 | [
"Apache-2.0"
] | reduceus/connect-python-sdk | squareconnect/models/v1_list_items_request.py | 3,533 | Python |
print(2012)
print(6)
print(16)
| 7.75 | 11 | 0.709677 | [
"MIT"
] | jaredliw/mcc-2015 | 9-days-of-code/day-1/02 Order of Evaluation.py | 31 | Python |
def valid(ps, a, n):
ps = set(ps)
for i in xrange(1, n):
for j in xrange(1, n):
for k in xrange(i):
for l in xrange(j):
if a[i][j] != -1 or i*n+j in ps: continue
if a[k][l] != -1 or k*n+l in ps: continue
if a[i][l] !... | 29.272727 | 61 | 0.431677 | [
"MIT"
] | mingweihe/kickstart | 2021/roundA/D_Checksum.py | 1,288 | Python |
# coding: utf-8
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unitte... | 45.403756 | 115 | 0.314859 | [
"MIT"
] | cliffano/jenkins-api-clients-generator | clients/python-legacy/generated/test/test_queue.py | 9,671 | Python |
import factory
from core.models import Instance
class InstanceFactory(factory.DjangoModelFactory):
class Meta:
model = Instance
| 15.888889 | 50 | 0.755245 | [
"BSD-3-Clause"
] | profesormig/quimica3a | api/tests/factories/instance_factory.py | 143 | Python |
# Code generated by lark_sdk_gen. DO NOT EDIT.
import typing
from pylark.lark_request import Response
from pylark.api_service_hire_job_get import (
GetHireJobReq,
GetHireJobResp,
_gen_get_hire_job_req,
)
from pylark.api_service_hire_job_manager_get import (
GetHireJobManagerReq,
GetHireJobManagerR... | 37.431227 | 88 | 0.761247 | [
"Apache-2.0"
] | chyroc/pylark | pylark/api_service_hire.py | 10,069 | Python |
from setuptools import find_packages, setup
setup(
author="Zackary Troop",
name="wave-reader",
version="0.0.10",
url="https://github.com/ztroop/wave-reader-utils",
license="MIT",
description="Unofficial package for Airthings Wave communication.",
long_description=open("README.md").read(),
... | 31.428571 | 71 | 0.614773 | [
"MIT"
] | ztroop/wave-reader | setup.py | 880 | Python |
"""Run experiment.
This module is intended to be run as a script:
$ python src/experiment.py
"""
import os
import pandas as pd
from bert import BERT
from constants import LANGUAGES, MASK, MISSING
from filenames import CLOZE_DIR, EXPERIMENTS_DIR, FEATURES_DIR
from utils import refresh
ENGLISH_MODEL = "bert-base... | 37.953333 | 85 | 0.610926 | [
"MIT"
] | geoffbacon/does-bert-agree | src/experiment.py | 5,693 | Python |
# Python Object Oriented Programming
import datetime
class Employee:
num_of_emps = 0 # Class Variable
raise_amount = 1.02 # Class Variable
def __init__(self, FirstName, LastName, salary):
self.FirstName = FirstName
self.LastName = LastName
self.salary = int(salary)
self.em... | 27.597826 | 94 | 0.606932 | [
"MIT"
] | Sudani-Coder/python | Object Oriented Programming/5 - Special Methods/index.py | 2,539 | Python |
# -*- coding: utf-8 -*-
"""
Key classification
using multiclass Support Vector Machine (SVM)
reference:
Date: Jun 05, 2017
@author: Thuong Tran
@Library: scikit-learn
"""
import os, glob, random
import numpy as np
from pandas import DataFrame
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransf... | 32.934132 | 100 | 0.668545 | [
"MIT"
] | xuanthuong/DOU-SI | TrainValue/multiclass_svm.py | 5,500 | Python |
import math
import collections
from gym_jsbsim import utils
class BoundedProperty(collections.namedtuple('BoundedProperty', ['name', 'description', 'min', 'max'])):
def get_legal_name(self):
return utils.AttributeFormatter.translate(self.name)
class Property(collections.namedtuple('Property', ['name', '... | 56.008333 | 117 | 0.724892 | [
"MIT"
] | songhyonkim/gym-ai-pilot | gym_jsbsim/properties.py | 6,721 | Python |
import re
import os
import time
import tweepy
import neologdn
import emoji
TRAINFILE = "./data/train.tsv"
DEVFILE = "./data/dev.tsv"
TESTFILE = "./data/test.tsv"
dup = []
if os.path.exists(TRAINFILE):
with open(TRAINFILE) as f:
dup += f.readlines()
if os.path.exists(DEVFILE):
with open(DEVFILE) as f:
... | 32.930556 | 88 | 0.471531 | [
"MIT"
] | laddge/gf-ai | collect_tweet.py | 4,746 | Python |
"""
WSGI config for kubeoperator project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_... | 23.588235 | 78 | 0.790524 | [
"Apache-2.0"
] | 2733284198/KubeOperator | core/apps/kubeoperator/wsgi.py | 401 | Python |
"""The tests for the MQTT switch platform."""
import json
from unittest.mock import ANY
from asynctest import patch
import pytest
from homeassistant.components import mqtt, switch
from homeassistant.components.mqtt.discovery import async_start
from homeassistant.const import (
ATTR_ASSUMED_STATE, STATE_OFF, STATE... | 33.128713 | 76 | 0.639171 | [
"Apache-2.0"
] | BobbyBleacher/home-assistant | tests/components/mqtt/test_switch.py | 20,076 | Python |
import torch
from utils.distmat import compute_distmat
def init_feedback_indices(q, g, device=None):
return torch.zeros((q, g), dtype=torch.bool, device=device)
def init_feedback_indices_qg(q, g, positive=False, device=None):
indices = torch.zeros(q, q + g, dtype=torch.bool, device=device)
if positive:... | 32.988506 | 114 | 0.699652 | [
"MIT"
] | itsnamgyu/reid-metric | hitl/feedback.py | 2,870 | Python |
from django.contrib import admin
from .models import User, Departament
admin.site.register(User)
admin.site.register(Departament)
| 21.833333 | 37 | 0.824427 | [
"MIT"
] | Bounty1993/rest-crm | src/accounts/admin.py | 131 | Python |
#Licenced under MIT License
#charset = "utf-8"
#Language = "Python3"
#Bot Framework = "python-telegram-bot"
#The Code is without Proxy, Actual code contains Proxy
#Proxy should be used is of the type SOCKS5
#Special thanks to cyberboySumanjay
#The bot will work till you press ctrl+c in the terminal or command line.,
#... | 36.658228 | 118 | 0.708909 | [
"MIT"
] | Bot361/Torrent_Searcher_Bot | mirror.py | 2,906 | Python |
#!/bin/env python3
import sys
import numpy as np
import pandas as pd
from pandas_plink import read_plink
import argparse
if __name__=='__main__':
parser = argparse.ArgumentParser(description="Calculate chi-squared selection statistics based on principal components from Galinsky et al. 2016")
parser.add_argument("o... | 28.571429 | 147 | 0.7155 | [
"MIT"
] | CreRecombinase/fastPPCA | misc/selection/galinsky.py | 2,000 | Python |
# -*- coding: utf-8 -*-
# This file is part of the Ingram Micro Cloud Blue Connect connect-cli.
# Copyright (c) 2021 Ingram Micro. All Rights Reserved.
import os
import sys
def unimport():
for m in ('connect.cli.plugins.play.commands', 'connect.cli.ccli'):
if m in sys.modules:
del sys.modules... | 26.861111 | 84 | 0.679421 | [
"Apache-2.0"
] | cloudblue/product-sync | tests/plugins/play/test_play_commands.py | 967 | Python |
import json
from urllib import urlencode
from corehq.apps.registration.utils import create_30_day_trial
from dimagi.utils.couch import CriticalSection
from dimagi.utils.couch.resource_conflict import retry_resource
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
f... | 37.044041 | 114 | 0.628575 | [
"BSD-3-Clause"
] | johan--/commcare-hq | corehq/apps/appstore/views.py | 14,299 | Python |
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, 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
#
# Unles... | 39.908072 | 115 | 0.600258 | [
"Apache-2.0"
] | Yard1/ludwig | ludwig/features/image_feature.py | 17,799 | Python |
alien_color = ['green', 'yellow', 'red']
alien = 'green'
if alien == 'green':
point = 5
elif alien == 'yellow':
point = 10
else:
point = 15
print('The player just earned ' + str(point) + ' points.')
| 15.357143 | 58 | 0.576744 | [
"BSD-3-Clause"
] | dantin/python-by-example | crash_course/ch05/exec/alien_color_3.py | 215 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: David McCue
import sqlite3, re, os
from bottle import route, run, debug, template, request, static_file, error, response
db_filename=os.path.dirname(os.path.realpath(__file__)) + '/db/kickstarter.db'
# Validate currency values
def valid_amount(amount):
amoun... | 27.410405 | 193 | 0.652467 | [
"Apache-2.0"
] | dmccue/ks-cli | server.py | 4,742 | Python |
from amaranth.sim import Simulator, Settle
from program_counter import ProgramCounter
dut = ProgramCounter()
def bench():
yield dut.countEnable.eq(0)
yield dut.writeAdd.eq(0)
yield dut.writeEnable.eq(0)
yield dut.dataIn.eq(0)
yield
yield dut.writeEnable.eq(1)
yield dut.dataIn.eq(1000)
... | 20.772727 | 50 | 0.657549 | [
"Apache-2.0"
] | racerxdl/riskow-python | program_counter_tb.py | 914 | Python |
from logs import logDecorator as lD
import jsonref, sqlite3
config = jsonref.load(open('../config/config.json'))
logBase = config['logging']['logBase'] + '.databaseIO.sqLiteIO'
@lD.log(logBase + '.getAllData')
def getAllData(logger, query, values=None, dbName=None):
'''query data from the database
... | 30.727273 | 113 | 0.573373 | [
"MIT"
] | madelinelimm/newcookiectest | src/lib/databaseIO/sqLiteIO.py | 11,830 | Python |
#!\usr\bin\python
from numpy import array
from scipy.special import erf
from scipy.optimize import minimize
from math import pi, sin, cos, exp, sqrt
#import dicom
line_array = [] ## global
def read_line (file_name ):
with open( file_name ) as f:
for line in f:
line_array.append( [float( lin... | 30.45614 | 111 | 0.541475 | [
"MIT"
] | oustling/dicom_profile_fitting | minimize/retic_xmm_2gauss/2minimize_4mv.py | 1,736 | Python |
import pandas as pd
import numpy as np
import scipy as sp
from scipy.optimize import linprog, minimize, NonlinearConstraint
from .pdf_quantile_functions import pdf_quantile_builder
from .support import diffMatMetalog, pdfMetalog, quantileMetalog, newtons_method_metalog
import time
import warnings
def a_vector_OLS_an... | 44.533923 | 195 | 0.571902 | [
"MIT"
] | sives5/pymetalog | pymetalog/a_vector.py | 15,097 | Python |
import urllib.request
from datetime import datetime
import os
date = datetime.today().strftime('%Y%m%d')
cycle = 0
for hour in range(1, 19):
url = "http://nomads.ncep.noaa.gov/pub/data/nccf/com/hrrr/prod/hrrr.{date}/conus/hrrr.t{:02d}z.wrfsubhf{:02d}.grib2".format(cycle, hour, date=date)
print(url)
filen... | 34.7 | 151 | 0.658501 | [
"MIT"
] | HydrologicEngineeringCenter/data-retrieval-scripts | retrieve_hrrr_subhourly.py | 694 | Python |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | 42.404834 | 96 | 0.578014 | [
"MIT"
] | MattePalte/Bugs-Quantum-Computing-Platforms | artifacts/old_dataset_versions/minimal_commits/qiskit-terra/qiskit-terra#2704/after/test_basic_scheduler.py | 14,036 | Python |
"""
>>> sd = SliceDump()
>>> sd[1]
1
>>> sd[2:5]
slice(2, 5, None)
>>> sd[:2]
slice(None, 2, None)
>>> sd[7:]
slice(7, None, None)
>>> sd[:]
slice(None, None, None)
>>> sd[1:9:3]
slice(1, 9, 3)
>>> sd[1:9:3, 2:3]
(slice(1, 9, 3), slice(2, 3, None))
>>> s ... | 16.117647 | 39 | 0.403285 | [
"MIT"
] | 1098994933/fluent_python | attic/sequences/slice_dump.py | 548 | Python |
from .breakpoint import Breakpoint
from .pesr_test import PESRTest
from .sr_test import SRTest, SRTestRunner
from .pe_test import PETest, PETestRunner
from .pesr_test import PESRTest, PESRTestRunner
| 33.166667 | 47 | 0.844221 | [
"BSD-3-Clause"
] | Genometric/gatk-sv | src/svtk/svtk/pesr/__init__.py | 199 | Python |
"""
utility functions for breaking down a given block of text
into it's component syntactic parts.
"""
import nltk
from nltk.tokenize import RegexpTokenizer
from . import syllables_en
TOKENIZER = RegexpTokenizer('(?u)\W+|\$[\d\.]+|\S+')
SPECIAL_CHARS = ['.', ',', '!', '?']
def get_char_count(words):
characters... | 28.447368 | 74 | 0.584181 | [
"MIT"
] | Open-Prose-Metrics/open_prose_metrics_app-core | opm/readability/utils.py | 2,162 | Python |
numeros = [[], []]
for c in range(0, 7):
n = int(input(f'Digite o {c+1}o. número: '))
if n % 2 == 0:
numeros[0].append(n)
elif n % 2 == 1:
numeros[1].append(n)
numeros[0].sort()
numeros[1].sort()
print('='*30)
print(f'Números pares digitados: {numeros[0]}')
print(f'Números ímpares digitados:... | 25.846154 | 49 | 0.568452 | [
"MIT"
] | jotmar/PythonEx | Exercicios/Ex_085.py | 340 | Python |
class Logger(object):
def __init__(self, name):
self.name = name
def debug(self, msg):
print(':: {0} [debug] :: {1}'.format(self.name, msg))
def info(self, msg):
print(':: {0} [info] :: {1}'.format(self.name, msg))
def warn(self, msg):
print(':: {0} [warning] :: {1}'.f... | 26.384615 | 63 | 0.521866 | [
"MIT"
] | ethanlindley/lego.py | util/logger.py | 343 | Python |
import requests
import json
from simplegist.mygist import Mygist
from simplegist.do import Do
from comments import Comments
try:
from simplegist.config import USERNAME, API_TOKEN, BASE_URL, GIST_URL
except:
pass
class Simplegist:
"""
Gist Base Class
This class is to used to instantiate the wrapper and authentica... | 22.981308 | 97 | 0.646604 | [
"MIT"
] | acatiadroid/simplegist | simplegist/simplegist.py | 2,459 | Python |
from pathlib import Path
from urllib.parse import urljoin, urlparse, unquote
def _get_url_file_name(url):
path = urlparse(url).path
try:
path = unquote(path)
except (TypeError, ValueError):
pass
return Path(path).name
def dav_index(context, data):
"""List files in a WebDAV direct... | 29.923077 | 70 | 0.611825 | [
"MIT"
] | Rosencrantz/memorious | memorious/operations/webdav.py | 1,167 | Python |
"""
Name : c9_01_optimize.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : Yuxing Yan
Date : 6/6/2017
email : yany@canisius.edu
paulyxy@hotmail.com
"""
from scipy.optimize import minimize
def myFunction(x):
return (3.2+5*x**2)
x0=100
res =... | 22.333333 | 85 | 0.636816 | [
"MIT"
] | HiteshMah-Jan/Python-for-Finance-Second-Edition | Chapter09/c9_01_optimize.py | 402 | Python |
# coding=utf-8
# Copyright 2020 The Real-World RL Suite 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 appl... | 33.652174 | 77 | 0.74031 | [
"Apache-2.0"
] | Roryoung/realworldrl_suite | realworldrl_suite/utils/evaluators_test.py | 3,096 | Python |
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# 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 applicabl... | 50.336565 | 181 | 0.662383 | [
"Apache-2.0"
] | 21jun/transformers | src/transformers/data/data_collator.py | 36,353 | Python |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 43.711462 | 114 | 0.659011 | [
"BSD-2-Clause",
"MIT"
] | pranavmodx/aiida-core | tests/cmdline/commands/test_group.py | 11,059 | Python |
'''
This module provides little helper functions that interpret
the Handle Server's response codes and the HTTP status codes.
All helpers functions test one possible outcome and return
True or False.
Author: Merret Buurman (DKRZ), 2015-2016
'''
import json
from b2handle.compatibility_helper import decode... | 32.987013 | 122 | 0.71378 | [
"Apache-2.0"
] | EUDAT-B2HANDLE/B2HANDLE | b2handle/hsresponses.py | 2,540 | Python |
"""
auth.blueprints
~~~~~~~~~~~~~~~
"""
from .simpleidp import blueprint as idpblueprint
| 14 | 48 | 0.571429 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | Amsterdam/auth | auth/blueprints/__init__.py | 98 | Python |
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... | 35.802721 | 75 | 0.584458 | [
"Apache-2.0"
] | julienledem/arrow | python/pyarrow/tests/test_convert_builtin.py | 5,264 | Python |
import sys
import argparse
import logging
from ml_crop.version import __version__
from ml_crop.utils_train import train
from ml_crop.utils_predict import predict
logger = logging.getLogger(__name__)
def parse_args(args):
desc = 'ml_crop (v%s)' % __version__
dhf = argparse.ArgumentDefaultsHelpFormatter
p... | 44.314815 | 164 | 0.709987 | [
"MIT"
] | developmentseed/servir-training-notebooks | crop_type_mapping/ml_crop_cli/ml_crop/main.py | 2,393 | Python |
# Most of this code is stolen from myself, but it's an app about pirating so whatev
import os
import sys
import time
import datetime
import subprocess
import pycurl
import spotipy
import spotipy.util
from StringIO import StringIO
from collections import deque
import sys
# If this seems like overkill, that's becaus... | 31.425373 | 112 | 0.513576 | [
"MIT"
] | TylerLeite/autopirate | pirate.py | 12,633 | Python |
import time
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
from torch import optim
from torch.utils import data
from tqdm import tqdm
from networks import LATENT_CODE_SIZE, device
# from train_autoencoder import SDFSampleDataset, save_checkpoint, SIGMA
class SDFNet(nn.Module):
... | 37.347826 | 109 | 0.622352 | [
"MIT"
] | FrankieYin/master_project | networks/sdf_net_decoder.py | 4,295 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.