text string | size int64 | token_count int64 |
|---|---|---|
# level design by Michael Abel
schemes=[test_scheme, tron_scheme,candy_scheme, default_scheme,
green_scheme, yellow_scheme, blue_scheme, red_scheme, metal_scheme, bronze_scheme]
# .................................................................................................................
def func_gamma():... | 3,561 | 1,274 |
from __future__ import division
import os
import sys
import numpy as np
import pandas as pd
import tensorflow as tf
from keras import backend as K
from keras.models import load_model
def freeze_session(session, keep_var_names=None, output_names=None, clear_devices=True):
"""
Freezes the state of a session i... | 13,241 | 3,899 |
import pytest
import pandas as pd
import os.path
from sklearn.datasets import make_regression
from sklearn.pipeline import Pipeline
from sklearn.feature_selection import SelectKBest
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from sklearn.feature_selection impo... | 2,405 | 911 |
import scipy.io as sio
import numpy as np
class MatWrapper(object):
def __init__(self,mat_file):
self.mat_fp = mat_file
self.data = None
class NeuroSurgMat(MatWrapper):
def __init__(self, mat_file):
self.mat_fp = mat_file
self.data = None
self._clfp = None
se... | 2,151 | 744 |
a = int(input("Enter the year:"))
print(a,"is leap year") if a%4 == 0 and a%400 == 0 else print(a,"is not a leap year")
| 123 | 54 |
#Tuplas
numeros = [1,2,4,5,6,7,8,9] #lista
usuario = {'Nome':'Mateus' , 'senha':123456789 } #dicionario
pessoa = ('Mateus' , 'Alves' , 16 , 14 , 90) #tupla
print(numeros)
print(usuario)
print(pessoa)
numeros[1] = 8
usuario['senha'] = 4545343
| 245 | 139 |
# Copyright 2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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
#
# Un... | 7,242 | 2,434 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2017 Tuukka Turto
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... | 3,464 | 1,072 |
from abc import ABC, abstractmethod
from copy import copy
import json
import logging
import os
import coreir as pycoreir
from magma.digital import Digital
from magma.array import Array
from magma.bits import Bits
from magma.backend.check_wiring_context import check_wiring_context
from magma.backend.coreir.coreir_util... | 22,595 | 6,644 |
import pytest
import webtest
from dcicutils.qa_utils import notice_pytest_fixtures
from .workbook_fixtures import app_settings, app # are these needed? -kmp 12-Mar-2021
notice_pytest_fixtures(app_settings, app)
pytestmark = [pytest.mark.indexing, pytest.mark.working]
@pytest.fixture(scope='module')
def help_page... | 5,371 | 1,985 |
from django.http import Http404
from django.shortcuts import render
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from api.models import Review
from api.serializers import ReviewSerializer
... | 1,374 | 386 |
#!/usr/bin/env python
import sys
import asyncio
import logging
import unittest
import conf
from os.path import join, realpath
from hummingbot.connector.exchange.altmarkets.altmarkets_user_stream_tracker import AltmarketsUserStreamTracker
from hummingbot.connector.exchange.altmarkets.altmarkets_auth import AltmarketsA... | 1,429 | 485 |
import time
def log():
""" Python dummy logger example.
"""
t = 0
while True:
print(f'time: {t} \t log sent.')
t += 1
time.sleep(1)
if __name__ == '__main__': log() | 209 | 78 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project : StreamlitApp.
# @File : utils
# @Time : 2020/11/3 12:17 下午
# @Author : yuanjie
# @Email : yuanjie@xiaomi.com
# @Software : PyCharm
# @Description : https://share.streamlit.io/daniellewisdl/streamlit-cheat-sheet/app.py
imp... | 1,568 | 546 |
import multiprocessing
from time import sleep
from datetime import datetime, time
from logging import INFO
from vnpy.event import EventEngine
from vnpy.trader.setting import SETTINGS
from vnpy.trader.engine import MainEngine
from vnpy.gateway.hbdm import HbdmGateway
from vnpy.gateway.hbsdm import HbsdmGateway
from vn... | 1,918 | 813 |
# -*- coding: utf-8 -*-
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Script to check if the package(s) have prebuilts.
The script must be run inside the chroot. The output is a json dict mapping ... | 2,928 | 937 |
# Copyright 2016, IBM US, 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... | 23,057 | 5,933 |
#!/usr/bin/env python
# vim: set sw=4 et:
import logging
import json
import time
import threading
import kombu
import socket
from brozzler.browser import BrowserPool, BrowsingException
import brozzler
import urlcanon
class AmqpBrowserController:
"""
Consumes amqp messages representing requests to browse urls,... | 15,547 | 4,100 |
import csv
def carregar_acessos():
dados = []#lado direito
marcacoes =[]#as classificaçoes lado esquerdo
#abrir o arquivo
arquivo = open('acesso.csv', 'r')
#leitor de csv
leitor = csv.reader(arquivo)
#ler cada linha
for acessou_home,acessou_como_funciona,acessou_contato,comprou in le... | 465 | 179 |
import time
import numpy as np
import torch
class Profiler:
def __init__(self, dummy=False, device=None):
self.events = []
self.dummy = dummy
self.device = device if device != torch.device('cpu') else None
self.log('start')
def log(self, name):
if self.dummy:
... | 2,087 | 672 |
import logging
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.models import User
from django.core.cache import cache
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template.conte... | 3,818 | 1,064 |
"""
WLS filter: Edge-preserving smoothing based onthe weightd least squares
optimization framework, as described in Farbman, Fattal, Lischinski, and
Szeliski, "Edge-Preserving Decompositions for Multi-Scale Tone and Detail
Manipulation", ACM Transactions on Graphics, 27(3), August 2008.
Given an input image IN, we see... | 2,603 | 954 |
#!/usr/bin/env python
import sys
sys.path.insert(1, "..")
from SOAPpy.Errors import Error
from SOAPpy.Parser import parseSOAPRPC
original = """<?xml version="1.0"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:... | 881 | 304 |
from typing import Dict, List, Tuple, Union
from collections import OrderedDict
from functools import lru_cache
import warnings
from torch.utils.data import BatchSampler, DataLoader
from catalyst.core.callback import (
Callback,
CallbackWrapper,
IBackwardCallback,
ICriterionCallback,
IOptimizerCal... | 4,864 | 1,442 |
import numpy as np
def place_mirror(im, x1, x2, y1, y2, mr):
""" Place an image mr in specified locations of an image im. The edge locations in im where mr is to be placed are
(x1,y1) and (x2,y2)
Programmer
---------
Manolis K. Georgoulis (JHU/APL, 10/12/05)
"""
nxa = np.zeros(2)
... | 2,013 | 951 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: protobufs/services/team/actions/get_teams.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as... | 4,898 | 1,842 |
# -*- coding: utf-8 -*-
"""
:author: TianMing Xu (徐天明)
:url: http://greyli.com
:copyright: © 2021 TianMing Xu <78703671@qq.com>
:license: MIT, see LICENSE for more details.
"""
from flask import render_template, current_app, request, Blueprint
from albumy.models import User, Photo
user_bp = Blueprint(... | 795 | 304 |
def lin():
print('-' * 35)
# Principal program
lin()
print(' IAN STIGLIANO SILVA ')
lin()
lin()
print(' CURSO EM VÍDEO ')
lin()
lin()
print(' GUSTAVO GUANABARA ')
lin()
| 187 | 87 |
__all__ = [
'describe_number',
'describe_datetime',
'describe_object',
'describe'
]
import pandas as pd
import numpy as np
from scipy import stats
from transparentai import utils
def describe_common(arr):
"""Common descriptive statistics about an array.
Returned statistics:
- Count of ... | 5,304 | 1,644 |
from ..utils.util import ObnizUtil
class ObnizMeasure:
def __init__(self, obniz):
self.obniz = obniz
self._reset()
def _reset(self):
self.observers = []
def echo(self, params):
err = ObnizUtil._required_keys(
params, ["io_pulse", "pulse", "pulse_width", "io_ec... | 1,472 | 448 |
# external dependencies
import unittest
import mock
import os
from unittest.mock import call
import shutil
from mock import MagicMock
from datetime import datetime, timedelta
# internal dependencies
from src.controllers import CompletedDownloadsController
from src.dataTypes.ProgramMode import PROGRAM_MODE
from src.tes... | 7,869 | 2,448 |
#!/usr/bin/python3 -i
#
# Copyright (c) 2020 LunarG, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify... | 14,313 | 3,886 |
from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, cast
import kubernetes
import dagster._check as check
from dagster.config.validate import process_config
from dagster.core.errors import DagsterInvalidConfigError
from dagster.core.storage.pipeline_run import PipelineRun
from dagster.core.utils ... | 8,658 | 2,552 |
#!/usr/bin/env python3
#
# fudge-domain.py
#
# Finds potentially useful domains
# which are visually similar to the
# target domain and ascertains whether
# these domains are currently available
# (not registered). Also checks if any TLDs
# are not registered for the domain.
#
# Usage:
# domain-fudgery.py [options] [d... | 8,809 | 3,604 |
import django_tables2 as tables
from django_tables2.utils import A
from .abstract import BaseBuilder
from .helpers import model_class_form, plural, custom_postfix_url
class TableBuilder(BaseBuilder):
"""
Table builder which returns django_tables2 instance
app : app name
model : model name for which t... | 1,680 | 494 |
from django.test import TestCase
from django.contrib.auth.models import User
from django.urls import reverse
from django.utils import timezone
from sales.models import Fruit, Transaction
from datetime import timedelta
# Create your tests here.
class FruitListViewTest(TestCase):
def setUp(self):
# Cre... | 4,769 | 1,540 |
import random
from src.datastruct.bin_treenode import TreeNode
import unittest
class Solution:
def hasPathSum(self, root: TreeNode, targetSum: int) -> bool:
num = random.randint(0, 1)
d = {
0: self.dfs,
1: self.postorder,
2: self.bfs,
}
return d... | 2,591 | 784 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Alex Loosley <a.loosley@reply.de>"
from setuptools import setup, find_packages
setup(
name='python-highcharts_df',
version='0.1.0',
description='python-highcharts_df wrapper for customizable pretty plotting quickly from pandas dataframes',
a... | 728 | 247 |
# /usr/bin/env python
# -*- coding: utf-8 -*-
import glob
import logging
import os
import shutil
import tarfile
import tempfile
import docker
from flask import Flask, jsonify, request, send_file, abort
app = Flask(__name__)
port = 8765
download_folder = "./debs"
if not os.path.exists(download_folder):
os.mkdir(do... | 4,013 | 1,234 |
from django.db import models
# Description of an object in the arena
class Entity(models.Model):
entityId = models.AutoField(primary_key=True)
entityClass = models.CharField(max_length=30)
entityName = models.CharField(max_length=30, null=True, blank=True)
entityCategory = models.CharField(max_length=... | 3,101 | 971 |
# @Title: 重排链表 (Reorder List)
# @Author: 18015528893
# @Date: 2021-02-12 16:05:36
# @Runtime: 100 ms
# @Memory: 23.9 MB
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def reorderList(self, head:... | 1,134 | 378 |
from JumpScale import j
from .ChangeTrackerClient import ChangeTrackerClient
class ChangeTrackerFactory:
def __init__(self):
self.logenable=True
self.loglevel=5
self._cache={}
def get(self, gitlabName="incubaid"):
name="%s_%s"%(blobclientName,gitlabName)
if gitlabName... | 662 | 213 |
import os
import psycopg2
DATABASE_URL = os.environ.get('DATABASE_URL')
def test_db():
conn = psycopg2.connect(DATABASE_URL)
cur = conn.cursor()
cur.execute("SELECT * FROM country;")
for country in cur:
print(country)
cur.close()
conn.close()
if __name__ == '__main__':
test_db(... | 322 | 119 |
from requests_html import HTMLSession
from sys import argv
if len(argv) != 2:
print("Usage: python3 VanillaGift.py VanillaGift.txt")
else: # VanillaGift card balance checker
for card in reversed(list(open(argv[1]))):
cardNumber, expMonth, expYear, cvv = card.rstrip().split(':')
c = cardNumber + ' ' + expMo... | 1,108 | 503 |
# -*- coding: utf-8 -*-
#
# Testing module for ACME's `ParallelMap` interface
#
# Builtin/3rd party package imports
from multiprocessing import Value
import os
import sys
import pickle
import shutil
import inspect
import subprocess
import getpass
import time
import itertools
import logging
from typing import Type
impo... | 30,069 | 9,381 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the analysis front-end object."""
import unittest
from plaso.frontend import analysis_frontend
from plaso.storage import zip_file as storage_zip_file
from tests.frontend import test_lib
class AnalysisFrontendTests(test_lib.FrontendTestCase):
"""Tests for the... | 766 | 248 |
"""Stores constants used as numbers for readability that are used across all apps"""
class AdminRoles:
""" """
JCRTREASURER = 1
SENIORTREASURER = 2
BURSARY = 3
ASSISTANTBURSAR = 4
CHOICES = (
(JCRTREASURER, 'JCR Treasurer'),
(SENIORTREASURER, 'Senior Treasurer'),
(BURSA... | 388 | 159 |
import numpy as np
from numpy import log
#Se define la función a integrar
def f(x):
return 1 / log(x)
#Implementación del método de Simpson
#Parámetros:
#f es la función a integrar
#a el límite inferior de la integral
#b el límite superior de la integral
#n el número de intervalos
def simpson (f, a... | 647 | 283 |
########
# Copyright (c) 2020 Cloudify Platform Ltd. 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 requi... | 1,517 | 505 |
print 0b1, #1
print 0b10, #2
print 0b11, #3
print 0b100, #4
print 0b101, #5
print 0b110, #6
print 0b111 #7
print "******"
print 0b1 + 0b11
print 0b11 * 0b11
| 169 | 111 |
# from django.shortcuts import render
# import os
# from django.conf import settings
# from goods.models import SKU
# from contents.utils import get_categories
# from goods.utils import get_breadcrumb
#
# def generate_static_sku_detail_html(sku_id):
#
# sku = SKU.objects.get(id=sku_id)
#
# category = sku.catego... | 2,617 | 1,318 |
import os
import joblib
import numpy as np
import pandas as pd
import sklearn_crfsuite
from sklearn_crfsuite import metrics
from chatbot.algorithm.question_answering.utils.ner import collate, sent2features, sent2labels
class MoviesNER:
def __init__(self):
# train_cased = /data/mit_movies_corpus/engtrain... | 1,990 | 692 |
def _check_inplace(trace):
"""Checks that all PythonOps that were not translated into JIT format are out of place.
Should be run after the ONNX pass.
"""
graph = trace.graph()
for node in graph.nodes():
if node.kind() == 'PythonOp':
if node.i('inplace'):
raise R... | 393 | 115 |
import fault.logging
def test_logging_smoke():
fault.logging.info("some info msg")
fault.logging.debug("some debug msg")
fault.logging.warning("some warning msg")
fault.logging.error("some error msg")
| 219 | 65 |
import argparse
import i18n
import logging
import os
import rdflib
import sys
from termcolor import colored
from timeit import default_timer as timer
__VERSION__ = '0.2.0'
__LOG__ = None
FORMATS = ['nt', 'n3', 'turtle', 'rdfa', 'xml', 'pretty-xml']
HEADER_SEP = '='
COLUMN_SEP = '|'
EMPTY_LINE = ''
COLUMN_SPEC = '{:... | 5,600 | 1,899 |
from loguru import logger
from scrapy.crawler import CrawlerProcess
from scrapy.utils.log import DEFAULT_LOGGING
from scrapy.utils.project import get_project_settings
from scrape_magic.spiders.gatherer_spider import GathererSpider
from scrape_magic.spiders.starcity_spider import StarcitySpider
settings = get_project_... | 681 | 228 |
from flask import (
Blueprint, request, jsonify, render_template, session, redirect, url_for
)
from app.models import User
bp = Blueprint('auth', __name__, url_prefix='/auth')
... | 1,842 | 437 |
import json
import pathlib
from src.extract_old_site.extract import run_extraction
from src.generate_new_site.generate import generate_site
if __name__ == "__main__":
script_root_dir = pathlib.Path(__file__).parent
config = None
with open((script_root_dir / "config.json")) as f:
config = json.load... | 1,841 | 531 |
from sklearn.neural_network import MLPClassifier
from commons import variables
from commons import tools
from scipy.stats import mode
def learn(x, y, test_x):
(temp_x, temp_y) = tools.simple_negative_sample(x, y, variables.select_rate_nn)
clf = MLPClassifier(hidden_layer_sizes=(variables.unit_num_nn,), rando... | 671 | 227 |
"""Environments."""
import gin
from alpacka.envs import bin_packing
from alpacka.envs import cartpole
from alpacka.envs import gfootball
from alpacka.envs import octomaze
from alpacka.envs import sokoban
from alpacka.envs.base import *
from alpacka.envs.wrappers import *
# Configure envs in this module to ensure th... | 981 | 351 |
from __future__ import division, absolute_import, print_function
__copyright__ = "Copyright (C) 2015 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without r... | 7,294 | 2,386 |
import os
import numpy as np
import random as rn
from environment import Environment
from keras.models import load_model
os.environ['PYTHONHASHSEED'] = '0'
np.random.seed(42)
rn.seed(12345)
number_actions = 5
direction_boundary = (number_actions - 1) / 2
temperature_step = 1.5
env = Environment(initial_number_users ... | 1,398 | 511 |
# -*- coding: utf-8 -*-
from roomlistwatcher.common import utility
class Topic(utility.AutomatedEnum):
ROOM_FOUND = ()
| 126 | 48 |
******************* PARTE I *******************************
#Instalamos git en la terminal de VSC
$sudo apt-get install git -y
#Revisamos la versión del Git que hemos instalado
$git --version
# Podemos ver también un resumen de las principales funcionalidades de Git
$git
#Creamos una carpeta
$mkdir ChallengePython
#... | 3,992 | 1,209 |
from typing import List, Tuple
import mlflow
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from interpret.glassbox import ExplainableBoostingClassifier, ExplainableBoostingRegressor
from ..OEA_model import OEAModelInterface, ModelType, ExplanationType
from ..modeling_ut... | 11,661 | 3,213 |
# @Title: 旋转数组 (Rotate Array)
# @Author: KivenC
# @Date: 2019-03-14 16:57:56
# @Runtime: 124 ms
# @Memory: 13.4 MB
class Solution:
def rotate(self, nums: List[int], k: int) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
'''
k = k % len(nums)
... | 580 | 231 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections
import time
import copy
from caffe2.python import workspace, core
from caffe2.proto import caffe2_pb2
import logging
import caffe2.python._import_c_ext... | 6,940 | 2,241 |
import os
import sys
from optparse import make_option
from django.core.management import BaseCommand, call_command
from django.conf import settings
def rel(*x):
return os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
m... | 1,346 | 408 |
from .support import HPyTest
class TestCPythonCompatibility(HPyTest):
# One note about the should_check_refcount() in the tests below: on
# CPython, handles are actually implemented as INCREF/DECREF, so we can
# check e.g. after an HPy_Dup the refcnt is += 1. However, on PyPy they
# are implemented i... | 7,341 | 2,352 |
# Generated by Django 3.0.4 on 2020-03-21 05:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0002_auto_20200320_1150'),
]
operations = [
migrations.RemoveField(
model_name='subscribebyblog',
name='user... | 553 | 188 |
from time import sleep
for i in range(10, 0, -1):
print(i)
sleep(1)
print('Yeey!!')
| 92 | 41 |
"""Add contact_details to House
Revision ID: 1f97f799a477
Revises: 2df9ce70bad
Create Date: 2018-08-08 10:58:44.869939
"""
# revision identifiers, used by Alembic.
revision = '1f97f799a477'
down_revision = '2df9ce70bad'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated ... | 631 | 246 |
#! /usr/bin/env python
# coding: utf-8
from JYTools.JYWorker import AsyncRedisWorker
__author__ = 'meisanggou'
class PlusWorker(AsyncRedisWorker):
def handler_task(self, key, params):
print("Enter Plus Worker")
if "a" not in params:
self.set_current_task_invalid("Need a")
if... | 725 | 250 |
import discord
class CaponeServer():
def __init__(self, discord_server):
self._discord_server = discord_server
def get_members(self):
return map(CaponeUser, self._discord_server.members())
def equals(self, other):
return self._discord_server == other._discord_server
class CaponeChannel():
def __init__(se... | 1,336 | 476 |
from random import randint
def longname():
return ''.join(chr(randint(0,143859)) for i in range(10000)).encode('utf-8','ignore').decode()
| 143 | 55 |
"""
This module contains utility functions used in the example scripts. They are
implemented separately because they use scipy and numpy and we want to remove
external dependencies from within the core library.
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ impo... | 3,535 | 1,312 |
from aiohttp import web
from avio.app_builder import AppBuilder
from avio.default_handlers import InfoHandler
def test_create_app():
app = AppBuilder().build_app()
assert isinstance(app, web.Application)
def test_app_config():
builder = AppBuilder({'app_key': 'value'})
app = builder.build_app({'upd... | 1,082 | 339 |
#! /usr/bin/python3
import sys
import numpy
import argparse
import logging
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--output", type=str, help="Where to save numpy array of lengths.", required=True)
args = parser.parse_args()
return args
def main():
args = par... | 665 | 216 |
# -*- coding: utf-8 -*-
# Copyright 2022 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 ... | 2,612 | 885 |
from getters import *
from parsers import *
def main():
data = get_data()
parse_top_players(data, 'data/2020-21')
if __name__ == '__main__':
main()
| 162 | 64 |
#!/usr/bin/env python
from collections import defaultdict
import gzip
import os
import pandas as pd
import sys
import pdb
def collectDataForMatchesToPMProteins(annotated_PM_proteins, blast_directory):
pORF_to_PM_protein_matches = defaultdict(set)
blast_file_columns = ["query", "subject", "perc_ident",... | 2,372 | 894 |
# -*- coding: UTF-8 -*-
import numpy as np
from numpy.testing import assert_array_almost_equal
from spectral_clustering.spectral_embedding_ import spectral_embedding
def assert_first_col_equal(maps):
constant_vec = [1] * maps.shape[0]
assert_array_almost_equal(maps[:, 0] / maps[0, 0], constant_vec)
def test... | 818 | 329 |
from setuptools import setup, find_packages
def readme():
with open('README.md') as f:
return f.read()
setup(
name='pyschemavalidator',
version='1.0.4',
description='Decorator for endpoint inputs on APIs and a dictionary/JSON validator.',
long_description=readme(),
long_description_con... | 1,028 | 325 |
def test1():
arr = [["我", "你好"], ["你在干嘛", "你干啥呢"], ["吃饭呢", "打球呢", "看电视呢"]]
new_arr = []
for i in arr[0]:
print(i)
for j in arr[1]:
new_arr.append(i + j)
print(new_arr)
#
# def test():
# while True:
# test1(arr)
test1()
| 278 | 146 |
###############################################################################
# Utils functions for language models.
#
# NOTE: source from https://github.com/litian96/FedProx
###############################################################################
ALL_LETTERS = "\n !\"&'(),-.0123456789:;>?ABCDEFGHIJKLMNOPQRST... | 1,012 | 337 |
"""
Specification for what parameters are used at what location within
the Cascade.
"""
from os import linesep
from types import SimpleNamespace
import networkx as nx
from cascade.core import getLoggers
from cascade.core.parameters import ParameterProperty, _ParameterHierarchy
from cascade.input_data import InputData... | 12,347 | 3,683 |
import os
import pickle as pickle
import datetime
import time
# from contextlib import contextmanger
import torch
from torch.autograd import Variable
import random
import numpy as np
def time_str(fmt=None):
if fmt is None:
fmt = '%Y-%m-%d_%H:%M:%S'
return datetime.datetime.today().strftime(fmt)
def st... | 8,757 | 2,818 |
from .deco_entries import deco_dict, deco_entries
from .deco_matrix import deco_matrix
from .deco_node import deco
from .deco_vector import deco_vector
| 152 | 52 |
a = str(input())
b = {'0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0}
for i in a:
b[i] = b[i] + 1
for i in range(len(b)):
if b[str(i)] == 0:
continue
print(str(i) + ':' + str(b[str(i)]))
| 239 | 138 |
class ModeIndicator:
LENGTH = 4
TERMINATOR_VALUE = 0x0
NUMERIC_VALUE = 0x1
ALPHANUMERIC_VALUE = 0x2
STRUCTURED_APPEND_VALUE = 0x3
BYTE_VALUE = 0x4
KANJI_VALUE = 0x8
| 194 | 99 |
from discord import Role, Embed, Color
from discord.ext import commands
from discord.utils import get
from sqlite3 import connect
class Setup(commands.Cog, name='Setup'):
"""
Commandes de setup serveur réservées aux admins
"""
def __init__(self, bot):
self.bot = bot
@commands.command(brie... | 3,635 | 1,225 |
from typing import Any, Dict, Iterable, List
from torch import random
from ppq.core import NetworkFramework, is_file_exist
from ppq.IR import BaseGraph, GraphBuilder, Operation, Variable
import onnx
from onnx import helper, mapping, numpy_helper
class OnnxParser(GraphBuilder):
def build_variables(
self... | 5,793 | 1,673 |
from .browser import *
from .cells import *
from .computation import *
from .statutils import *
| 96 | 28 |
from pymoo.core.mutation import Mutation
class NoMutation(Mutation):
def _do(self, problem, X, **kwargs):
return X
| 130 | 47 |
import re
from sys import argv
import sys
script, filename=argv
text=open(filename)
s=text.read()
y= re.split('\s+',s)
'''rite=open("new.txt", 'w')'''
temp=[]
values=[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
stopword1=['with','more','than','for','a','an','the','then','to','I','as','am','and','is']
for word in y:
m=0... | 2,893 | 843 |
import os
import copy
from parser import Parser
import json
import argparse
from tqdm import tqdm
def get_data_paths(ace2005_path):
test_files, dev_files, train_files = [], [], []
with open('./data_list.csv', mode='r') as csv_file:
rows = csv_file.readlines()
for row in rows[1:]:
... | 5,304 | 1,651 |
WORKER_WAIT_FOR_SCHEDULER_TO_START_IN_S = 600
WORKER_WAIT_FOR_NAMESERVER_TO_START_IN_S = 300
SCHEDULER_PING_WORKERS_INTERVAL_IN_S = 10
SCHEDULER_TIMEOUT_WORKER_DISCOVERY_IN_S = 600
# See Explanation in HPOBenchExperimentUtils/__init__.py
try:
from HPOBenchExperimentUtils.optimizer.autogluon_optimizer import _obj_f... | 360 | 165 |
from .contact import Contact
from .project import Project
from .link import Link
from .category import Category
from .project_image import ProjectImage | 155 | 37 |
#!/usr/bin/env python
import sys
import os
import urllib
import requests
import shutil
import json
import datetime
from ftplib import FTP, error_perm, error_reply
API_URL = 'http://localhost/cgi-bin'
TIMEOUT_MINUTES = 15
HOURS_BEFORE_PROCESS = 24
if len(sys.argv) < 4:
sys.stderr.write('Usage : ./main.py FTP_SERV... | 5,061 | 1,645 |
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 6 21:00:25 2018
@author: Vishwesh
"""
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
DATA_DIR = "/tmp/data"
NUM_STEPS=1000
MINIBATCH_SIZE=32
data = input_data.read_data_sets(DATA_DIR,one_hot=True)
x = tf.placeholder... | 1,234 | 525 |