id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3327606
# -*- coding: utf-8 -*- """ Created on Tue Oct 22 18:46:41 2019 @author: JVM """ import requests, tempfile, os #converter api help http://synbiodex.github.io/SBOL-Validator/?javascript#introduction def DNA_to_GenBank(filename, partname): newfile_url = "http://song.ece.utah.edu/examples/pages/acceptNewFile.php...
StarcoderdataPython
8557
<filename>mpunet/bin/cv_split.py from glob import glob import sys import os import numpy as np import random from mpunet.utils import create_folders import argparse def get_parser(): parser = argparse.ArgumentParser(description="Prepare a data folder for a" "CV exp...
StarcoderdataPython
3302524
from django.shortcuts import render from .models import ShortURL from .forms import CreateNewShortURL from datetime import datetime import random, string # Create your views here. def home(request): return render(request, 'home.html') def redirect(request, url): current_obj = ShortURL.objects.filter(short_ur...
StarcoderdataPython
3242983
<reponame>Fuligor/Uczenie-sie-rekonstrukcji-rozdzielczosci-obrazow-za-pomoca-sieci-glebokich<gh_stars>0 import numpy as np from scipy import signal from PIL import Image def resample(hr_image): return hr_image[range(0, hr_image.shape[0], 2)][:, range(0, hr_image.shape[1], 2)] def downsample(hr_image, kernel): ...
StarcoderdataPython
113560
<reponame>kbiters/infram from time import time, sleep import pyautogui from src.json import config from src.operations.mouse import find_image_click from src.operations.windows import start_brave from src.service.auto_update import latest_version_check from src.service.constants import Config, Image from src.service....
StarcoderdataPython
3317131
# Copyright 2019 Intel, 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,...
StarcoderdataPython
1676935
<reponame>anconaesselmann/LiveUnit<filename>templates/general/functions.py<gh_stars>0 """ @author <NAME> """ from os import sys, path sys.path.append(path.abspath(path.join(__file__, "..", "..", "..", "classes_and_tests"))) try: from src.Std import Std from src.MirroredDirectory import MirroredDirectory excep...
StarcoderdataPython
152166
<gh_stars>0 import cv2 import numpy as np import matplotlib.pylab as plt # 0~158 구간 임의의 수 25 x 2 생성 ---① a = np.random.randint(0,158,(25,2)) # 98~255 구간 임의의 수 25 x 2 생성 ---② b = np.random.randint(98, 255,(25,2)) # a, b를 병합, 50 x 2의 임의의 수 생성 ---③ trainData = np.vstack((a, b)).astype(np.float32) # 0으로 채워진 50개 배열 생성 -...
StarcoderdataPython
1605303
<filename>src/exceptions.py class BaseError(Exception): """ Base error for all application errors. """ STATUS_CODE = 500 class InvalidRequestError(BaseError): """ An error for any invalid API request. """ STATUS_CODE = 400
StarcoderdataPython
84696
<filename>readchar/__init__.py<gh_stars>0 from .readchar import readchar, readkey from . import key __all__ = [readchar, readkey, key] __version__ = '2.0.2'
StarcoderdataPython
15567
<gh_stars>0 #!/bin/env python3 """Handling events as tickets The goal here is, provided a maintenance event, create an event if not a duplicate. To determine if not duplicate, use some combination of values to form a key. Methods to delete, update, and otherwise transform the ticket should be available A base class,...
StarcoderdataPython
90268
<reponame>kamilazdybal/PCAfold import unittest import numpy as np from PCAfold import preprocess from PCAfold import reduction from PCAfold import analysis class Preprocess(unittest.TestCase): def test_preprocess__KernelDensity__allowed_calls(self): X = np.random.rand(100,20) try: ke...
StarcoderdataPython
105940
<reponame>mstim/ms_deisotope<gh_stars>10-100 import unittest from ms_deisotope import processor from ms_deisotope.averagine import glycopeptide, peptide from ms_deisotope.scoring import PenalizedMSDeconVFitter, MSDeconVFitter from ms_deisotope.test.common import datafile class TestScanProcessor(unittest.TestCase): ...
StarcoderdataPython
1761306
<reponame>magikid/UASTrafficLightMk2 #!/usr/bin/python3 print('script start') import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) seq = ['red', 'yellow', 'green', 'yellow',] pins = { 2 : {'name' : 'red', 'state' : GPIO.LOW}, 3 : {'name' : 'green', 'state' : GPIO.LOW}, 4 : {'name' : '...
StarcoderdataPython
4835393
from __future__ import absolute_import from __future__ import division import unittest import pandas as pd from collections import Counter from mock import MagicMock import pyspark.sql from pyspark.sql import Row from affirm.model_interpretation.shparkley.spark_shapley import ( compute_shapley_score, compute_sh...
StarcoderdataPython
1775451
from setuptools import setup, find_packages from setuptools.extension import Extension from glob import glob import numpy from Cython.Distutils import build_ext ext_modules = [ Extension("taggd.core.demultiplex_core_functions", ["taggd/core/demultiplex_core_functions.pyx"]), Extension("taggd.core.demultiplex...
StarcoderdataPython
4809195
<filename>Comments/models.py<gh_stars>1-10 from django.contrib.auth import get_user_model from django.db import models User = get_user_model() class Comments(models.Model): parent_comment = models.ForeignKey('self', null=True, on_delete=models.CASCADE) parent_reply = models.ForeignKey('Reviews.Review', null=...
StarcoderdataPython
4833155
<reponame>hpharmsen/pysimplicate<gh_stars>0 import datetime from beautiful_date import * # Fetches all contracts def contract(self, filter={}): url = '/hrm/contract' fields = {'employee_name': 'employee.name'} result = self.composed_call(url, fields, filter) return result def employee(self, filter={...
StarcoderdataPython
3345774
<reponame>sharonwoo/prophet # 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. import os.path import platform import sys import os from pkg_resources import ( normalize_path, working_set...
StarcoderdataPython
1670340
<filename>tests/models/test_base_operations.py<gh_stars>0 import time import pytest from libdev.gen import generate from . import Base, Attribute from consys.errors import ErrorWrong class ObjectModel(Base): _name = 'tests' meta = Attribute(types=str) delta = Attribute(types=str, default='') extra ...
StarcoderdataPython
90358
<gh_stars>10-100 """ CausalDAG ========= CausalDAG is a Python package for the creation, manipulation, and learning of Causal DAGs. Simple Example -------------- >>> from causaldag import rand, partial_correlation_suffstat, partial_correlation_test, MemoizedCI_Tester, gsp >>> import numpy as np >>> np.random.seed(12...
StarcoderdataPython
12423
# -------------------------------------------------------- # (c) Copyright 2014 by <NAME>. # Licensed under BSD 3-clause licence. # -------------------------------------------------------- import unittest from pymonad.Maybe import Maybe, Just, First, Last, _Nothing, Nothing from pymonad.Reader import curry from pymona...
StarcoderdataPython
3235708
from app import ResponseBuilder, logger from static import strings def handle_help_intent(request): """ Generate response to intent type HelpIntent which presents the available futures to the confused user. :type request AlexaRequest :return: JSON response including introduced capabilities of the skil...
StarcoderdataPython
64466
<gh_stars>10-100 import os import numpy as np import pickle from datetime import date today = date.today() class save_info(object): def __init__(self, assets_dir, exp_num, exp_name, env_name): self.assets_dir = assets_dir self.experiment_num = 'exp-{}'.format(exp_num) #common path ...
StarcoderdataPython
1768216
def enable_dropout(model): for m in model.modules(): if m.__class__.__name__.startswith('Dropout'): m.train() def disable_dropout(model): for m in model.modules(): if m.__class__.__name__.startswith('Dropout'): m.eval()
StarcoderdataPython
3232812
<reponame>szymanskir/Face-Recognition # -*- coding: utf-8 -*- import click import logging import pandas as pd from sklearn.decomposition import PCA def create_pca_model(number_of_components, train_faces): pca = PCA(n_components=number_of_components, random_state=0) pca.fit(train_faces) return(pca) @cli...
StarcoderdataPython
1738012
<gh_stars>0 """ A library of projection bases for Underdamped Langevin Inference. """ import numpy as np def basis_selector(basis,data): is_interacting = False if basis['type'] == 'polynomial': funcs = polynomial_basis(data.d,basis['order']) elif basis['type'] == 'Fourier': funcs = Four...
StarcoderdataPython
185264
<filename>tests/test_pllcalcs.py from unittest import TestCase from pll.pll_calcs import * class TestGeneralFunctions(TestCase): def test_interp_linear_1(self): """ test the linear interpolator with a value within the x array """ test_var = interp_linear([10,20], [1,2], 12) self....
StarcoderdataPython
3288555
import pytest import pdb test_id = f"{'2.3.1':<10} - Profile Validation" test_weight = 25 def test_validation_against(host): assert 0 == 1, "TODO - Write Test"
StarcoderdataPython
66064
<reponame>alod83/versatile-data-kit # Copyright 2021 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 import os import pathlib from click.testing import CliRunner from py._path.local import LocalPath from pytest_httpserver.pytest_plugin import PluginHTTPServer from vdk.internal import test_utils from vdk.internal.co...
StarcoderdataPython
692
<reponame>dzzhvks94vd2/mikan class MikanException(Exception): """Generic Mikan exception""" class ConversionError(MikanException, ValueError): """Cannot convert a string"""
StarcoderdataPython
3200008
class InvalidColor(Exception): pass class InvalidColorType(InvalidColor): pass class InvalidColorValue(InvalidColor): pass class InvalidOpacity(InvalidColor): pass
StarcoderdataPython
3396895
<gh_stars>0 from xmlrpc import client as xmlrpclib import ssl import csv from scriptconfig import URL, DB, UID, PSW, WORKERS socket = xmlrpclib.ServerProxy(URL,context=ssl._create_unverified_context()) input_file = 'files/ivlioh.csv' input_file = csv.DictReader(open(input_file)) all_locations = socket....
StarcoderdataPython
194220
from django.conf import settings from django.contrib import messages from django.contrib.auth import authenticate, login from django.contrib.auth.decorators import login_required from django.http import Http404 from django.shortcuts import redirect, render, get_object_or_404 from django.utils import timezone from djang...
StarcoderdataPython
3255495
<filename>hoodie/templatetags/util.py<gh_stars>1-10 import re from django import template from django.urls import reverse, NoReverseMatch register = template.Library() @register.simple_tag(takes_context=True) def active(context, pattern_or_urlname): try: pattern = "^" + reverse(pattern_or_urlname) + "$"...
StarcoderdataPython
1680022
<reponame>jbeilstenedmands/cctbx_project<gh_stars>0 from __future__ import absolute_import, division, print_function from builtins import range from libtbx import utils from libtbx.test_utils import Exception_expected, approx_equal, show_diff from six.moves import cStringIO as StringIO import warnings import random imp...
StarcoderdataPython
3354858
<filename>九、奇淫巧计类/6.红黑树节点操作.py<gh_stars>1-10 class Node: def __init__(self, key=None, color=None, size=0): self.key = key self.color = color self.size = size self.left = None self.right = None self.p = None class Tree: def __init__(self): self.root = Non...
StarcoderdataPython
4820081
<gh_stars>1-10 # coding=utf-8 """ Copyright 2013 Load Impact 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 ag...
StarcoderdataPython
1631709
# (C) Copyright 2017 Inova Development Inc. # 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 appl...
StarcoderdataPython
13579
# Generated by Django 2.1.10 on 2019-07-19 12:42 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ('cms_content', '0003_auto_20190719_1232'), ] operations ...
StarcoderdataPython
17122
<filename>vitrage/tests/unit/datasources/kubernetes/test_kubernetes_transformer.py # Copyright 2018 - Nokia # # 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/lice...
StarcoderdataPython
1648994
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/02/25 16:30 # @Author : niuliangtao # @Site : # @File : MachineLearninginAction.py # @Software: PyCharm import re import urllib import requests from bs4 import BeautifulSoup github_root = "https://github.com" github_raw = "https://raw.githubuser...
StarcoderdataPython
3356042
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import troposphere as t import yaml from awacs import iam as awscs_iam from troposphere import codebuild from troposphere import codecommit from troposphere import codepipeline from troposphere import iam ...
StarcoderdataPython
3388552
<filename>nm-pso.py<gh_stars>0 import numpy as np from Particle import Particle from mountain_scooter import MountainScooter np.random.seed(11) class InitialPointShapeException(Exception): pass class NM_PSO: """ Class that implement the Nelder-Mead Particle Swarm Optimization algorithm. It take ins...
StarcoderdataPython
74623
<gh_stars>1-10 """ Use the Eratoshenes Algorithm to generate first 1229 prime numbers. """ max = 10000 smax = 100 # sqrt(10000) lst = [] # number list, all True (is prime) at first for i in range(max + 1): # initialization lst.append(True) for i in range(2, smax + 1): # Eratoshenes Algorithm sieve = 2 * i ...
StarcoderdataPython
147426
<gh_stars>1-10 # pyOCD debugger # Copyright (c) 2018-2019 Arm Limited # SPDX-License-Identifier: Apache-2.0 # # 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/licen...
StarcoderdataPython
12767
<gh_stars>10-100 from boa_test.tests.boa_test import BoaTest from boa.compiler import Compiler from neo.Settings import settings from neo.Prompt.Commands.BuildNRun import TestBuild class TestContract(BoaTest): def test_dict1(self): output = Compiler.instance().load('%s/boa_test/example/DictTest1.py' % T...
StarcoderdataPython
3358483
""" Check that a OutputStream can be assigned to sys.stdout. """ import support from java import io import sys o = io.FileOutputStream("test003.out") sys.stdout = o print "hello" f = open("test003.out", "r") s = f.read(-1) f.close() if s != "hello\n": raise support.TestError('Wrong redirected stdout ' + `s`)
StarcoderdataPython
1720286
<filename>ml/ex04/template/least_squares.py # -*- coding: utf-8 -*- """Exercise 3. Least Square """ import numpy as np def least_squares(y, tx): """calculate the least squares.""" #a = tx.T.dot(tx) #b = tx.T.dot(y) #return np.linalg.solve(a, b) w = np.linalg.inv(tx.T @ tx) @ tx.T @ y return 1...
StarcoderdataPython
79034
""" File: booleans.py Copyright (c) 2016 <NAME> License: MIT This code was used to simply gain a better understanding of what different boolean expressions will do. """ C = 41 #There will be no output. This expression is setting the variable 'C' equal to 41. C == 40 #The output will be 'False'. 40 is being compare...
StarcoderdataPython
1773605
<filename>__main__.py import tkinter as tk import os, sys, time, ctypes from scipy.special import gamma from mathgraph3D.core.global_imports import * from mathgraph3D.core.Color import ColorStyle, Styles, Gradient, preset_styles, random_color from mathgraph3D.core.functions.CartesianFunctions import Function2D, Functio...
StarcoderdataPython
1718913
import json from django.conf import settings from django.core.serializers.json import DjangoJSONEncoder from solc import compile_files from solc.utils.string import force_bytes from web3.utils.validation import validate_address from jobboard import utils class MemberInterface: def __init__(self, contract_addres...
StarcoderdataPython
59872
from __future__ import absolute_import from __future__ import division from __future__ import print_function import six import json import os import codecs from collections import Counter import numpy as np import tensorflow as tf from parser.structs.vocabs.base_vocabs import CountVocab from parser.struc...
StarcoderdataPython
100837
from __future__ import annotations from typing import Dict, List, Optional import yaml from base.basic import Circuit from base.block import IBlock from templates.block import BlockType, BlockTemplate, BlockFactory from templates.conn import ConnTemplate __author__ = "<NAME>" __copyright__ = "Copyright 2021" class...
StarcoderdataPython
3348238
<gh_stars>10-100 # -*- coding: UTF-8 -*- ################################################################################ # # Copyright (c) 2021 Baidu.com, Inc. All Rights Reserved # ################################################################################ """ The file used to evaluate the performance of CWatche...
StarcoderdataPython
1606194
from typing import List, Dict import matplotlib.pyplot as plt from datetime import datetime from pandas import DataFrame from kaori.plugins.gacha.engine.core import Card as GameCard, RarityName import seaborn as sns _dist = Dict[RarityName, int] def get_rarity_dist(cards: List[GameCard]) -> _dist: hist = { ...
StarcoderdataPython
3255997
<filename>custom_graphVPR/open3d_semantic-mesh-inspection.py import numpy as np import matplotlib.pyplot as plt import open3d as o3d #version: 0.10.0.0 kimera_ros_path = "../kimera_semantics_ros/" mesh_prefix = "../kimera_semantics_ros/graphVPR_mesh_results/tesse_shubodh_Inspiron_15_7000_Gaming_" def read_cfg_csv(fi...
StarcoderdataPython
1795644
<reponame>noamshemesh/jasper-milight import milight import re PRIORITY = 10 WORDS = ["LIGHT", "LIGHTS", "ON", "OFF", "DIM", "WHITE", "FIRST", "SECOND", "THIRD", "FOURTH", "ALL"] template = re.compile(r'.*\b(turn|all|first|second|third|fourth)\b.*\blights\b.*\b(on|off|white|dim)\b.*', re.IGNORECASE) words_to_numbers ...
StarcoderdataPython
1635050
from django.shortcuts import render, redirect, HttpResponse from django.contrib import messages from .models import User, UserManager import bcrypt def admin(request): #GET REQUEST context = { "all_the_users": User.objects.all(), } return render(request, "login.html", context) def register(request): #...
StarcoderdataPython
6975
<filename>demos/odyssey/dodyssey.py<gh_stars>10-100 #Copyright ReportLab Europe Ltd. 2000-2017 #see license.txt for license details __version__='3.3.0' __doc__='' #REPORTLAB_TEST_SCRIPT import sys, copy, os from reportlab.platypus import * _NEW_PARA=os.environ.get('NEW_PARA','0')[0] in ('y','Y','1') _REDCAP=int(os.env...
StarcoderdataPython
3244582
""" This is an example of a python module that is written to be both a set of tests and a jupyter notebook source, reusing the tests as API usage examples. """ # let's start with something simple: making sure we will see all graphics inline # (the nice thing, btw, is that an empty line will split a text block, and an...
StarcoderdataPython
3336747
"""Online matching net -- an online version of the nearest neighbor algorithm. Author: <NAME> (<EMAIL>) """ from __future__ import (absolute_import, division, print_function, unicode_literals) import tensorflow as tf from fewshot.models.modules.example_memory import ExampleMemory from fewshot...
StarcoderdataPython
3255423
#!/usr/bin/python #---------------------------------------------------------------------- # Be sure to add the python path that points to the LLDB shared library. # # # To use this in the embedded python interpreter using "lldb" just # import it with the full path using the "command script import" # command # (lldb...
StarcoderdataPython
3294535
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
StarcoderdataPython
3238646
# Copyright 2016 Ifwe 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, so...
StarcoderdataPython
3264014
<filename>geco/mips/set_cover/sun.py from networkx.utils import py_random_state from geco.mips.set_cover.generic import set_cover def _sun_costs(n, seed): return [seed.randint(1, 100) for _ in range(n)] def _sun_sets(n, m, seed, initial_sets=None): if not initial_sets: sets = [set() for _ in range(...
StarcoderdataPython
1794217
<filename>tests/project_requirements_test.py<gh_stars>0 import unittest import os, sys test_dir = os.path.dirname(__file__) src_dir = "../" sys.path.insert(0, os.path.abspath(os.path.join(test_dir, src_dir))) from bank.accounts import Accounts, CheckingAccount, SavingsAccount from bank.account_holder import AccountHo...
StarcoderdataPython
1794403
""" <NAME> <EMAIL> @shackoverflow surrender_index_bot.py A Twitter bot that tracks every live game in the NFL, and tweets out the "Surrender Index" of every punt as it happens. Inspired by SB Nation's <NAME> @jon_bois. """ import argparse from base64 import urlsafe_b64encode import chromedriver_autoinstaller from da...
StarcoderdataPython
3379109
import queue from time import sleep from typing import Any, Dict, List, Optional, Tuple import zmq # type: ignore from virtualgrid.base_node import BaseNode from virtualgrid.job import Job from virtualgrid.messages import (JobNotAcceptedMessage, GetLoadMessage, GetStatusMessage, JobAcceptedMessage, ...
StarcoderdataPython
8512
<filename>charlotte/charlotte.py class Config: def __init__(self, config_file_name): self.config_file_name = config_file_name
StarcoderdataPython
1754344
from typing import Type from iioy.core.adapters import BaseAdapter from iioy.core.interfaces import AdapterInterface, AdapterMethod from iioy.movies.models import Person class PersonInterface(AdapterInterface): def __init__(self, adapter_cls: Type[BaseAdapter], external_id): self.external_id = external_i...
StarcoderdataPython
3377026
<filename>code/python/pymir/analytics/key_detection/musicnet/transformations/time_series_split.py from sklearn.model_selection import train_test_split from pymir import settings from pymir.common import EXISTING_KEYS import csv import os import pandas as pd def generate_ds(train_fname, test_fname, test_size=0.2)...
StarcoderdataPython
3220454
""" KNX/IP notification service. For more details about this platform, please refer to the documentation https://home-assistant.io/components/notify.knx/ """ import asyncio import voluptuous as vol from homeassistant.components.knx import DATA_KNX, ATTR_DISCOVER_DEVICES from homeassistant.components.notify import PLA...
StarcoderdataPython
137523
# -*- coding: utf-8 -*- import scrapy class WeixinSpider(scrapy.Spider): name = 'weixin' allowed_domains = ['ershicimi.com'] start_urls = ['http://ershicimi.com/'] def parse(self, response): pass
StarcoderdataPython
3384061
<filename>trace_for_guess/filenames.py # SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>> # # SPDX-License-Identifier: MIT import os import re from trace_for_guess.netcdf_metadata import (get_metadata_from_trace_file, get_metadata_from_trace_files) def get_cru_filenames(): ...
StarcoderdataPython
127799
# -*- coding: utf-8 -*- """ Created on Mon May 14 16:50:33 2018 @author: ADay """ import os import pandas as pd import numpy as np import requests import time import json def get_earliest_date(item): """ Given a crossref works record, find the earliest date. """ tags = ['issued','created','indexed',...
StarcoderdataPython
3338984
<filename>Treasuregram/main_app/views.py<gh_stars>0 # -*- coding: utf-8 -*- """Treasuregram View Configuration""" from __future__ import unicode_literals from django.shortcuts import render from .models import Treasure # from django.http import HttpResponse # Create your views here. def index(request): """ The fu...
StarcoderdataPython
97186
from django.db import models from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver from phonenumber_field.modelfields import PhoneNumberField import datetime as dt import string as str # Create your models here. cla...
StarcoderdataPython
1664316
<reponame>welvin21/pysimt<gh_stars>10-100 from .metric import Metric from .multibleu import BLEUScorer from .sacrebleu import SACREBLEUScorer from .meteor import METEORScorer from .cer import CERScorer from .wer import WERScorer from .simnmt import AVPScorer, AVLScorer, CWMScorer """These metrics can be used in early ...
StarcoderdataPython
1790604
class AliPayException(Exception): def __init__(self, code, message): self.__code = code self.__message = message def to_unicode(self): return "AliPayException: code:{}, message:{}".format(self.__code, self.__message) def __str__(self): return self.to_unicode() def __re...
StarcoderdataPython
3254204
<gh_stars>1-10 from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns from .provider import BitlyProvider urlpatterns = default_urlpatterns(BitlyProvider)
StarcoderdataPython
121723
#!/usr/bin/env python3 with open("input.txt", "r") as f: all_groups = [x.strip().split("\n") for x in f.read().split("\n\n")] anyone = 0 everyone = 0 for group in all_groups: all = set(group[0]) any = set(group[0]) for person in group[1:]: all = all.intersection(person) any.update(*person) everyone += len...
StarcoderdataPython
3330272
import os import io import hashlib from base64 import standard_b64encode from six.moves.urllib.request import urlopen, Request from six.moves.urllib.error import HTTPError from infi.pyutils.contexts import contextmanager from infi.pypi_manager import PyPI, DistributionNotFound from logging import getLogger logger = ...
StarcoderdataPython
40448
#!/usr/bin/env python # -*- coding: utf-8 -*- """ sfftk.unittests.test_readers This testing module should have no side-effects because it only reads. """ from __future__ import division, print_function import glob import os import struct import sys import unittest import numpy import random_words import __init__ a...
StarcoderdataPython
3324693
import scipy.io as sio import numpy as np import os def sensing_method(method_name,specifics): # a function which returns a sensing method with given parameters. a sensing method is a subclass of nn.Module return 1 def computInitMx(Training_labels, specifics): if(specifics['use_universal_matrix'] == True)...
StarcoderdataPython
1741637
#!/usr/bin/env python # 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 "Licen...
StarcoderdataPython
121438
import vcr from botocore.exceptions import ClientError from service import get_entries, handler @vcr.use_cassette() def test_get_entries(): """Reads from the `test_get_entries` cassette and processes the entries. """ entries = get_entries() assert len(entries) == 633 print(entries[0]) expecte...
StarcoderdataPython
34930
#!/usr/bin/env python from setuptools import find_packages, setup with open("README.md", "r", encoding="utf-8") as f: long_description = f.read() setup( name="tplink-wr-api", version="0.2.1", url="https://github.com/n1k0r/tplink-wr-api", author="n1k0r", author_email="<EMAIL>", description=...
StarcoderdataPython
3380167
import repetition
StarcoderdataPython
1745933
# small wrapper script for all cmake calls # to build all C and CUDA libs # supposed to be OS independent import argparse import os from tempfile import mkdtemp from shutil import rmtree parser = argparse.ArgumentParser(description = 'Build C/CUDA libs with cmake and install \ ...
StarcoderdataPython
1714957
# Kimi language interpreter in Python 3 # <NAME> # http://www.github.com/vakila/kimi import special_forms as sf from environments import Environment from errors import * SPECIALS = sf.special_forms() def evaluate(expression, environment): '''Take an expression and environment as dictionaries. Evaluate the ex...
StarcoderdataPython
1740048
<gh_stars>1-10 # Copyright 2020 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publ...
StarcoderdataPython
16670
from Tkinter import * import ttk import BuyBook import BookInformationPage import Message class UserPage(object): def __init__(self, root, color, font, dbConnection, userInfo): for child in root.winfo_children(): child.destroy() self.root = root self.color = color sel...
StarcoderdataPython
3348737
<filename>extensions/aria_extension_tosca/simple_v1_0/misc.py # 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 A...
StarcoderdataPython
1732372
import numpy as np def count_overlaps(*grids): return tuple(np.sum(grid >= 2) for grid in grids) def solve(x): coords = np.array([[coord.split(',') for coord in line.split(' -> ')] for line in x], dtype=int) deltas = coords[:,1] - coords[:,0] signs = np.where(deltas >= 0, 1, -1) grid = np.ze...
StarcoderdataPython
175566
<gh_stars>1-10 import setuptools as st st.setup(name='tracking', version='0.1', author='<NAME>, <NAME>', packages=st.find_packages())
StarcoderdataPython
153177
<gh_stars>0 from rest_framework import serializers from pitanja.models import Test, Pitanje, Odgovor, OdgovorUcenika class TestSerializer(serializers.ModelSerializer): class Meta: model = Test fields = '__all__' class PitanjeSerializer(serializers.ModelSerializer): class Meta: model ...
StarcoderdataPython
3317627
""" .. _`geometry`: """ """Pseudo package for convenient import of geometry classes.""" from openmdao.lib.geometry.geom_data import GeomData from openmdao.lib.geometry.stl_group import STLGroup
StarcoderdataPython
3349104
<reponame>xiaohan2012/capitalization-restoration-train<gh_stars>1-10 import numpy as np import pandas as pds def calc(input, labels=['AL', 'IC']): """ Return: - Label-wise average - Average item accuracy - micro/macro average """ if input.ndim == 2: prf1 = np.zeros(input.shape, dt...
StarcoderdataPython
1770562
<filename>glassnode_files_organizer.py from os import listdir from os.path import isfile, join import os import json import re from pprint import pprint import pandas as pd import os import errno def glassnode_files_organizer(): def make_sure_path_exists(path): try: os.makedirs(path) ...
StarcoderdataPython