id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
8084341
""" Copyright (c) 2018-present. <NAME> All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. """ import subprocess import numpy as np # BenA: # the constant values here reflect the values in original FastT...
StarcoderdataPython
6480804
# -*- coding: utf-8 -*- """ Created on Wed May 30 13:27:02 2012 @author: hlampesberger """ from data.dataset import Dataset, AnnotatedDataset from learning.regular.ktestable import build_ktestable_DFA from base import Result from regular.ops import write_graphviz import cProfile def run(): # labelspath = "../t...
StarcoderdataPython
1781993
import numpy as np import matplotlib.pyplot as plt import os def main(): # define parameters of class 1 a_1 = 0 b_1 = 1 # define parameters of class 2 a_2 = 1 b_2 = 2 # x axis x = np.arange(-10, 10, 0.5) # generate y function y = -np.divide(np.abs(x - a_1), b_1) + np.divide(n...
StarcoderdataPython
8003354
import math # WGS84 ellipsoid semi-major axis WGS84_ELLIPSOID_SEMI_MAJOR_AXIS = 6378137. EARTH_EQUATORIAL_PERIMETER = 2. * math.pi * WGS84_ELLIPSOID_SEMI_MAJOR_AXIS SEP = ";" T_MIN = 180 L_MAX = 15 def degrees_to_meters(res): return (res / 360.0) * EARTH_EQUATORIAL_PERIMETER def res_table(): table = [] ...
StarcoderdataPython
8165024
# List all of the images available for recovering purposes from oneandone.client import OneAndOneService client = OneAndOneService('675fbe491b27896b57e76867604f8255') recovery_appliances = client.list_recovery_images() # Retrieve a specific appliance from oneandone.client import OneAndOneService client = OneAndOneS...
StarcoderdataPython
1753466
from rest_framework import serializers from talentmap_api.common.serializers import PrefetchedSerializer, StaticRepresentationField from talentmap_api.position.models import Position, Grade, Skill, SkillCone, CapsuleDescription, Classification, Assignment, PositionBidStatistics from talentmap_api.language.serializers...
StarcoderdataPython
1990311
''' 编写一个程序,找出第 n 个丑数。 丑数就是质因数只包含 2, 3, 5 的正整数。 示例: 输入: n = 10 输出: 12 解释: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 是前 10 个丑数。 说明:   1 是丑数。 n 不超过1690。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/ugly-number-ii ''' class Ugly: def __init__(self): self.nums = nums = [1,] i2 = i3 = i5 = 0 for...
StarcoderdataPython
1826969
<filename>api_comm.py from requests import Request, Session class ApiComm: """HTTP Client""" def __init__(self, base_url, token=None, token_type=None, headers=None): """Prepare the client.""" self.session = Session() if headers is not None: self.session.headers.update(head...
StarcoderdataPython
1675533
from calendar_layout import * #from update import * from Tkinter import * import sqlite3 import matrices import numpy as np import auto import export import random import datetime as datetime import urllib2 from bs4 import BeautifulSoup import csv import sys import globalvars # Menu and Frame Functions def doNothing...
StarcoderdataPython
223741
#!/usr/bin/env python # # Adapted from an example by <NAME> at: # # http://www.michael-noll.com/wiki/Writing_An_Hadoop_MapReduce_Program_In_Python # ''' import sys, urllib, re import numpy as np # Read pairs as lines of input from STDIN #for line in sys.stdin: # We assume that we are fed a series of URLs, one per l...
StarcoderdataPython
203115
<gh_stars>100-1000 # Dash packages import dash_bootstrap_components as dbc import dash_html_components as html from app import app ############################################################################### ########### PAGE 2 LAYOUT ########### ####################################################################...
StarcoderdataPython
113766
<reponame>Tongjilibo/bert4torch import math from typing import Callable, Iterable, Optional, Tuple, Union import torch from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR def get_linear_schedule_with_warmup(optimizer, num_warmup_steps, num_training_steps, last_epoch=-1): """ 带war...
StarcoderdataPython
3509048
<reponame>CityPulse/dynamic-bus-scheduling<gh_stars>10-100 #!/usr/local/bin/python # -*- coding: utf-8 -*- """ - LICENCE The MIT License (MIT) Copyright (c) 2016 <NAME> Ericsson AB (EU FP7 CityPulse Project) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated ...
StarcoderdataPython
1902411
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- """ Build pattern out of signatures. List of tools designed to create signatures for allocations. That should allow to do reverse guesswork of patterns (pointers) and therefore identify similar record types allocations. """ import logging import argparse impor...
StarcoderdataPython
210560
from sbi.radio_device.net_device import RadioNetDevice __author__ = "<NAME>, <NAME>" __copyright__ = "Copyright (c) 2015, Technische Universitat Berlin" __version__ = "0.1.0" __email__ = "{<EMAIL>, <EMAIL>" class LteNetDevice(RadioNetDevice): ''' Base Class for LTE Network Device ''' def configure_mi...
StarcoderdataPython
6438032
<gh_stars>0 import turtle as tt tl = tt.Screen() st = tt.RawTurtle(tl) cont = 0 ps = [0, 1, 2, 3, 4, 5, 6, 7] st.speed(0) st.width(5) st.color('yellow', 'red') st.ht() st.up() st.goto(-50, -100) for i in range(1,9): st.fd(60) ps[cont] = st.pos() # st.write(cont) cont += 1 st.fd(60) # st.write(...
StarcoderdataPython
66187
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
StarcoderdataPython
263670
<gh_stars>100-1000 """interactive SNMP tool""" __author__ = '<NAME>' __email__ = '<EMAIL>' try: from snimpy._version import __version__ # nopep8 except ImportError: __version__ = '0.0~dev'
StarcoderdataPython
210374
""" ----------------------------------------------------------------- RecSys Challenge 2018 - Team Latte _..,---,.._ .-;'-.,___,.-'; <NAME> [<EMAIL>] (( | | 2018.07.01 ` \ / _ `,.___.,'- ( '-----' ) ...
StarcoderdataPython
1741492
''' Created on May 23, 2012 @author: <NAME> ''' N = 8 def bin2gray(n): return n ^ (n >> 1) def gray2bin(n): i = 1 << (N - 2) while(i > 0): n = (n ^ (n >> 1)) & i | (n & ~i) i >>= 1 return n def printGray(n): ''' Print a range of gray code recu...
StarcoderdataPython
4836509
from enum import Enum class ExchangeType(Enum): """Defines all possible exchange types """ DIRECT = "direct" """direct exchange""" FANOUT = "fanout" """fanout exchange""" TOPIC = "topic" """topic exchange""" HEADERS = "headers" """headers exchange"""
StarcoderdataPython
9668305
<reponame>Nano2PlastProject/InteractiveFullMulti # -*- coding: utf-8 -*- """ Created on Fri Jan 15 14:07:59 2021 @author: PradoDomercq """ import numpy as np #Create vector of compartmet volumes per RS for each species def volumesVector(Clist,compartments_prop): sp_RScomp_vol_m3=[] for sp3 in Clist: ...
StarcoderdataPython
4971251
from aip import AipNlp """ 你的 APPID AK SK """ APP_ID = '15437508' API_KEY = 'N0U7NIVsKu1IOuwlij9azsv4' SECRET_KEY = '<KEY>' client = AipNlp(APP_ID, API_KEY, SECRET_KEY)
StarcoderdataPython
3569886
"""DuckDB backend.""" from __future__ import annotations from pathlib import Path import duckdb import sqlalchemy as sa import ibis.expr.schema as sch from ibis.backends.base.sql.alchemy import BaseAlchemyBackend from .compiler import DuckDBSQLCompiler class Backend(BaseAlchemyBackend): name = "duckdb" c...
StarcoderdataPython
1793068
#!/usr/bin/env python # coding=utf-8 # Stan 2012-03-10 from __future__ import (division, absolute_import, print_function, unicode_literals) import logging from sqlalchemy import MetaData from ...reg import reg_object1 from ...reg.result import * from .stuff.backwardcompat import * from .stuf...
StarcoderdataPython
3356744
# 누적합 def solution(board, skill): cum_board = [[0] * (len(board[0]) + 1) for _ in range(len(board) + 1)] for ele in skill: t, r1, c1, r2, c2, d = ele if t == 1: d = -d cum_board[r1][c1] += d cum_board[r2+1][c2+1] += d cum_board[r1][c2+1] -= d ...
StarcoderdataPython
3405169
import hashlib def md5_string(string_input: str) -> str: m = hashlib.md5() m.update(string_input) return m.hexdigest()
StarcoderdataPython
1981338
<filename>version.py short_name="godot" name="Godot Engine" major=2 minor=0 status="alpha"
StarcoderdataPython
6479982
"""This package is divided into submodules, but everything is imported in the root.""" # flake8: noqa from .hydrator import * from .manager import * from .manager_factory import * from .relation import * from .repository import * from .request import * from .resource import * __version__ = '0.1.0'
StarcoderdataPython
4890355
<gh_stars>0 # Copyright 2022 <NAME>. # # This file is part of a4's bookgen. # a4's bookgen is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, either version 2 of the License, or (at your option) any # late...
StarcoderdataPython
9667578
<reponame>1067511899/tornado-learn import numpy as np import matplotlib.pyplot as plt ###########1.数据生成部分########## def f(x1, x2): y = 0.5 * np.sin(x1) + 0.5 * np.cos(x2) + 3 + 0.1 * x1 return y def load_data(): x1_train = np.linspace(0, 50, 500) x2_train = np.linspace(-10, 10, 500) data_train ...
StarcoderdataPython
9687220
import uuid from dataclasses import dataclass, asdict, field @dataclass class User(): username: str id: uuid.UUID = field(default_factory=uuid.uuid4) follows: list = field(default_factory=list) @classmethod def from_dict(self, d): return self(**d) if isinstance(d, dict) else None ...
StarcoderdataPython
6641569
from django.http import JsonResponse def index(request): return JsonResponse({'error': 'sup hacker'})
StarcoderdataPython
1936376
<filename>openshift_tools/monitoring/dockerutil.py<gh_stars>0 #!/usr/bin/env python2 # vim: expandtab:tabstop=4:shiftwidth=4 ''' wrapper for interfacing with docker ''' # Adding the ignore because it does not like the naming of the script # to be different than the class name # pylint: disable=invalid-name from...
StarcoderdataPython
9736955
#!/usr/bin/env python3 #--coding:utf-8 -- """ findTargets.py cLoops2 loops-centric analysis module. Find the target genes for a set of regions, such as loops anchors or SNPs. - [] """ #sys #3rd import pandas as pd import networkx as nx from tqdm import tqdm #cLoops2 from cLoops2.ds import Peak from cLoops2.io imp...
StarcoderdataPython
3442276
<reponame>Raghav714/compiler-programs from collections import OrderedDict def reverse_dict(dictx): reverse_dict = OrderedDict() key_list = [] for key in dictx: key_list.append(key) key_list.reverse() for key in key_list: reverse_dict[key] =dictx[key] return reverse_dict def first(grammar,terminal): first_dic...
StarcoderdataPython
1809431
#!/usr/bin/env python3 # Copyright (C) 2015-2018 <NAME> # All rights reserved. # # This software may be modified and distributed under the terms # of the BSD license. See the LICENSE file for details. import sys, platform # Automatically download setuptools if not available try: from setuptools import * except I...
StarcoderdataPython
11373764
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Built with code/inspiration from MapFish, OpenLayers & <NAME> # import sys sys.path.append("./") # For JS import getopt import jsmin, mergejs # For CSS import re # For file moves import shutil import os def mergeCSS(inputFilenames, outputFilename): output = ""...
StarcoderdataPython
255820
<reponame>dmmoura/PAA-2021<gh_stars>0 from paa191t1.dijkstra.datastructs.vector import Vector from paa191t1.tests.dijkstra.test_dijkstra import TestDijkstraBase class TestDijkstraVector(TestDijkstraBase): def setUp(self): self.struct = Vector()
StarcoderdataPython
4953779
# This is a troll indeed ffs *facepalm* # Ported from xtra-telegram by @heyworld import asyncio from telethon.tl.functions.users import GetFullUserRequest from telethon.tl.types import ChannelParticipantsAdmins from userbot import CMD_HANDLER as cmd from userbot import CMD_HELP, bot, owner from userbot.utils import e...
StarcoderdataPython
8101485
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest from selenium import webdriver class NewVisitorTest(unittest.TestCase): def setUp(self): self.browser = webdriver.Chrome() def tearDown(self): self.browser.quit() def test_title(self): self.browser.get('http://local...
StarcoderdataPython
249831
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """CSI ratioB: Plot CSI ratio of two antennas in real time(Linux 802.11n CSI Tool) Usage: 1. python3 csiratioB.py 2. python3 csiserver.py ../material/5300/dataset/sample_0x5_64_3000.dat 3000 10000 Note: 1. this is just a demo, because it's too slow :( 2....
StarcoderdataPython
4901509
# -*- coding:utf-8 -*- # # Copyright 2018, Couchbase, 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 re...
StarcoderdataPython
8001682
<filename>worsecrossbars/utilities/auth_dropbox.py<gh_stars>0 """auth_dropbox: An internal module used to establish a secure connection to Dropbox and authenticate against a Dropbox App. Uses OAuth 2. """ import json import os import sys from pathlib import Path from dropbox import Dropbox from dropbox import DropboxO...
StarcoderdataPython
1640571
import re import string from typing import List, Tuple from nltk.corpus import words ALPHABET = string.ascii_lowercase def get_wordbase(num_letters) -> List[str]: import nltk nltk.download("words") word_base = [word for word in words.words() if len(word) == num_letters] return word_base def co...
StarcoderdataPython
1915024
# -*- coding: utf-8 -*- from qcloudsdkcore.request import Request class GenerateLogListRequest(Request): def __init__(self): super(GenerateLogListRequest, self).__init__( 'cdn', 'qcloudcliV1', 'GenerateLogList', 'cdn.api.qcloud.com') def get_endDate(self): return self.get_params(...
StarcoderdataPython
6589394
<filename>code/server/test_code_works.py import re import json import time import subprocess import shlex import platform from pathlib import Path from operator import itemgetter import pytest WIN = platform.system() == 'Windows' HOST = f"{platform.node() if WIN else '0.0.0.0'}:8080" SYSTEM_SUFFIXES = ('_win.txt', ...
StarcoderdataPython
1891438
<filename>celery_progress/__init__.py from django.conf import settings # from django.utils.module_loading import import_by_path from django.utils.module_loading import import_string BACKEND = getattr(settings, 'CELERY_PROGRESS_BACKEND', 'celery_progress.backends.CeleryBackend') def get_backend(): ...
StarcoderdataPython
9663751
<filename>src/managementgroups/azext_managementgroups/_client_factory.py<gh_stars>1-10 # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for lice...
StarcoderdataPython
4997082
<reponame>Endurance-Robotics/ChatBots # -*- coding: utf-8 -*- # File: responses.py # Description: Responses module for processing Botlibre response-lists # Author: ValV import re, errno, json from os import makedirs from os.path import join from math import log10, floor from urllib.request import urlope...
StarcoderdataPython
315712
import os import json from json import JSONEncoder class ClassEncoder(JSONEncoder): def default(o): return o.__dict__ class PersistenceHanlder: relative_path_root = r'C:\Users\Utente 39\Documents\temp\github\projects\bank_managment_system_pro\Data' def __write_on_file__(self, value, path): ...
StarcoderdataPython
8088651
<gh_stars>10-100 import re import unicodedata def validate_label(label): label = unicodedata.normalize('NFKC', label) if re.search(r"[0-9]", label) is not None: return None if '*' in label: return None skip_foreign_chars = [ 'い', 'た', 'つ', 'ぬ', ...
StarcoderdataPython
1856042
<reponame>julianlore/RedCogs<filename>owin/owin.py import aiohttp import discord from redbot.core import Config, commands class Owin(commands.Cog): """Display Overwatch wins/losses and relative changes since last refresh.""" __author__ = ["julianlore"] __version__ = "1.0.0" def __init__(self, bot): ...
StarcoderdataPython
5086057
<filename>shaded_libraries/third_party_flink_ai_extended/flink-ml-tensorflow/src/test/python/global_step_direct.py<gh_stars>1000+ from __future__ import print_function from datetime import datetime import tensorflow as tf import sys import time import json from tensorflow.python.summary.writer.writer_cache import FileW...
StarcoderdataPython
313768
import turtle from BackOfPC import PC_BACK from Apple_Logo import AppleLogo from General_Drawing import generalDrawing from Progress_Bar import ProgressBar import time from Image import Image turtle.colormode(255) class PC(generalDrawing): def __init__(self, size, topLeft, topRight, bottomRight, bottomLeft ): ...
StarcoderdataPython
6508131
<gh_stars>0 import RPi.GPIO as GPIO from time import sleep #inpired by instructable https://www.instructables.com/id/Ultimate-Arduino-Paper-Piano/ #buzzer pin BUZZER_PIN=25 #key pins NOTE_F_PIN=2 NOTE_FS_PIN=3 NOTE_G_PIN=4 NOTE_GS_PIN=7 NOTE_A_PIN=9 NOTE_AS_PIN=10 NOTE_B_PIN=11 NOTE_C_PIN=17 NOTE_CS_PIN=22 NOTE_D_PI...
StarcoderdataPython
6593871
<gh_stars>1-10 from django.contrib import admin from datatrans.models import KeyValue class KeyValueAdmin(admin.ModelAdmin): list_display = ( "content_type", "object_id", "field", "value", "language", "edited", "fuzzy", ) ordering = ("digest", "lang...
StarcoderdataPython
9774159
<reponame>filimor/uri-online-judge import math for i in range(int(input())): (pa, pb, g1, g2) = map(float, input().split(' ')) g1 /= 100 g2 /= 100 tempo = 'Mais de 1 seculo.' for j in range(1, 101): pa += math.floor(pa * g1) pb += math.floor(pb * g2) if pa > pb: ...
StarcoderdataPython
9607884
"""Some small utility functions.""" from __future__ import annotations import functools import itertools import logging import os import re import time import unicodedata from pathlib import Path from typing import Any from typing import Callable from typing import Generator from typing import Iterable from typing imp...
StarcoderdataPython
6685657
import numpy as np # equivalent to MATLAB sph2cart & cart2sph def cart2sph(x,y,z): azimuth = np.arctan2(y,x) elevation = np.arctan2(z,np.sqrt(x**2 + y**2)) r = np.sqrt(x**2 + y**2 + z**2) return azimuth, elevation, r def sph2cart(azimuth,elevation,r): x = r * np.cos(elevation) * np.cos(azimuth) ...
StarcoderdataPython
11346779
import json import re from django.conf import settings from django.shortcuts import render, redirect from django.views.decorators.cache import never_cache from django.views.generic import TemplateView from django.contrib.auth import logout from django_countries import countries from core.models import TransientUser fr...
StarcoderdataPython
4928841
<reponame>GabrielRojas74/Talleres-AyP<filename>Taller estructuras/punto#12.py<gh_stars>0 """ entradad nota_tarea1_mates-->int-->num nota_tarea2_mates-->int-->ndm nota_tarea3_mates-->int-->ntm examen_mates-->float-->xm nota_tarea1_fisik-->int-->nuf nota_tarea2_fisik-->int-->ndf examen_f-->float-->xf nota_tarea1_q-->int-...
StarcoderdataPython
6512308
<reponame>ankitmlive/sign-up-api from django.dispatch import Signal # New user has registered. user_registered = Signal(providing_args=["user", "request"]) # User has activated his or her account. user_activated = Signal(providing_args=["user", "request"])
StarcoderdataPython
12837790
<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('core', '0001_initial'), ('legislative', '0001_initial'), ] operations = [ migrations.CreateModel( ...
StarcoderdataPython
1798828
<filename>dnnv/_manage/linux/verifiers/mipverify.py from __future__ import annotations import subprocess as sp from ..environment import ( Environment, Dependency, HeaderDependency, LibraryDependency, ProgramDependency, Installer, GNUInstaller, GurobiInstaller, ) from ...errors import ...
StarcoderdataPython
8124978
<reponame>rafiberlin/clp-sose21-pm-vision """ Avatar action routines """ from avatar_sgg.config.util import get_config from avatar_sgg.dataset.ade20k import get_preprocessed_image_graphs_for_map_world from avatar_sgg.game_avatar_abstract import Avatar from avatar_sgg.image_retrieval.scene_graph_similarity_model im...
StarcoderdataPython
1758357
import os import tensorflow as tf from meta import Meta from evaluator import Evaluator from train import read_h5py_file tf.app.flags.DEFINE_string('data_dir_test', './data', 'Directory to read TFRecords files') tf.app.flags.DEFINE_string('checkpoint_dir', './logs/train', 'Directory to read checkpoint files') tf.app.fl...
StarcoderdataPython
5033716
import tempfile import os import subprocess from flask import request, make_response, jsonify from Classes.Services.RDF_Service import TripleStore_Service class Service: def __init__(self, request_data, id): self.request = request_data # request sent to the api self.id = id # id of TD and graph ...
StarcoderdataPython
5035872
#!/usr/bin/env python from __future__ import print_function from __future__ import absolute_import import argparse import sys from pgsanity import sqlprep from pgsanity import ecpg def get_config(argv=sys.argv[1:]): parser = argparse.ArgumentParser(description='Check syntax of SQL for PostgreSQL') parser.add...
StarcoderdataPython
12864984
# -*- coding: utf-8 -*- ''' Docer ~~~~~~ A document viewing platform. :copyright: (c) 2015 by Docer.Org. :license: MIT, see LICENSE for more details. ''' from flask import Flask from flask.ext.mongoengine import MongoEngine from app.frontend import frontend as frontend_blueprint from app.backend import backend a...
StarcoderdataPython
219993
<reponame>kfortin/buttchan import discord, time, json, sys, shlex, asyncio from hashlib import sha256 from random import choice, randrange from math import floor def stringtime(secs): amts = {1: "second", 60: "minute", 3600: "hour"} times = [] for i in sorted(amts)[::-1]: amt = floor(secs / i) secs -= amt * i ...
StarcoderdataPython
5157996
from __future__ import unicode_literals from django import forms from django.contrib.auth.models import User from django.utils.translation import ugettext_lazy as _ from django.contrib import auth class UserCreationFormNew(forms.ModelForm): """ A form that creates a user, with no privileges, from the given use...
StarcoderdataPython
3432304
<reponame>chandrakant100/Python-Project<filename>Challenges-5/over9000.py # Challenge 7 : Create a function named over_nine_thousand() that takes a list of numbers named lst as a parameter. # The function should sum the elements of the list until the sum is greater than 9000. # When this ha...
StarcoderdataPython
5029959
from toee import * from utilities import * from InventoryRespawn import * from py00439script_daemon import record_time_stamp, get_v, set_v, tsc, within_rect_by_corners from combat_standard_routines import * def san_dialog( attachee, triggerer ): if (attachee.map == 5074): # Found them in the wilderness attachee....
StarcoderdataPython
4902439
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2020 Alibaba Group Holding Ltd. # # 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-...
StarcoderdataPython
1634699
'评论应用模型' from django.db import models from django.contrib.auth.models import User # 从别的app中导入文章模型 from stocks.models import BKDetail class BaseComment(models.Model): '基础评论模型' content = models.TextField('评论', max_length=500) time = models.DateTimeField('评论时间', auto_now_add=True) user = models.ForeignKey...
StarcoderdataPython
3318322
from root import MEASURE_RESULTS import confmeasure import measure_helpers as util from measure_helpers import ( GUEST_JAVDEV, GUEST_QEMUBLK, GUEST_QEMU9P, GUEST_JAVDEV_MOUNT, GUEST_QEMUBLK_MOUNT, HOST_SSD, run, ) from qemu import QemuVm from typing import List, Any, Optional, Callable, Tup...
StarcoderdataPython
362201
<reponame>yelircaasi/manim import click from cloup import option, option_group ease_of_access_options = option_group( "Ease of access options", option( "--progress_bar", default="display", show_default=True, type=click.Choice( ["display", "leave", "none"], ...
StarcoderdataPython
4978838
#! /usr/bin/env python3 # import math from numpy import * from numpy import bitwise_xor import datetime def i4_bit_hi1(n): # *****************************************************************************80 # ## I4_BIT_HI1 returns the position of the high 1 bit base 2 in an I4. # # Discussion: ...
StarcoderdataPython
6496636
# Author: <NAME> (<EMAIL>) import argparse import dynet as dy import matplotlib.pyplot as plt import numpy as np import random from core.information_theory import InformationTheory def main(args): random.seed(args.seed) np.random.seed(args.seed) info = InformationTheory() num_points_except_end = args....
StarcoderdataPython
3318693
<reponame>barni2000/Ion<filename>ionlib/launch.py<gh_stars>1-10 """ Launch a game from Steam """ from . import wine from . import setup from .logger import log from .cmdline import args from .game import Game def get_path(): """ Returns the wine path (native or compat) """ command = ['winepath', args.path] ...
StarcoderdataPython
3532684
class Command: def __init__(self): self.cmd = 'H' self.target = None self.atk = [] self.sup = [] def __repr__(self): return '%s (%s vs %s)' % (self.cmd, self.atk, self.sup) countries = {1: "Russia", 2: "England", 3: "Germany", 4: ...
StarcoderdataPython
3422091
from scgapi.Scg import Scg import scgapi.MessageRequest import scgapi.Contact import scgapi.ContactGroup import argparse def send_sms(api, config, bob_mdn, alice_mdn, senderid): # Construct an instance of the authentication object # with authentication data from a json file (auth.json) auth = scgapi.AuthI...
StarcoderdataPython
178820
import PandasPatch from iago import * import cp2k from Analyser import Analyser
StarcoderdataPython
3254320
<filename>tensorflow_datasets/text/unifiedqa/unifiedqa_test.py # coding=utf-8 # Copyright 2022 The TensorFlow Datasets 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://...
StarcoderdataPython
6419676
<reponame>igg-bioinfo/CKG ############################################ # REFLECT ontologies - DO, BTO, STITCH, GO # ############################################ def parser(files, filters, qtype = None): """ Parses and extracts relevant data from REFLECT ontologies: Disease Ontology, Tissues, STITCH and \ G...
StarcoderdataPython
3464205
############################################################################# # Copyright (c) 2018 <NAME>. 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...
StarcoderdataPython
1839149
# ====================================================================================================================== # KIV auxiliary functions: based on matlab codes of the authors # https://github.com/r4hu1-5in9h/KIV # ==============================================================================================...
StarcoderdataPython
12810699
from typing import Callable, Optional, Type, TypeVar import punq T = TypeVar("T") class Container: """ Implements a configurable DI container. """ def __init__( self, configure: Callable[["Container"], None] = lambda _: None ) -> None: self._impl: Optional[punq.Container] = None...
StarcoderdataPython
1883804
from django.contrib.auth import login, authenticate from django.contrib.auth.forms import UserCreationForm from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.db import transaction import datetime as dt import si...
StarcoderdataPython
5129128
#coding:utf-8 # 向量搜索 暴力算法 import numpy as np import time from scipy.spatial.distance import cosine from sklearn.metrics.pairwise import cosine_similarity from sklearn.metrics.pairwise import pairwise_distances # 把字向量转化为句向量,简单相加 def seg_vector (txt, dict_vector, emb_size=768): seg_v = np.zeros(emb_size) for w i...
StarcoderdataPython
1852399
<reponame>LorbusChris/packit """ This is the official python interface for source-git. This is used exclusively in the CLI. """ import logging import os from functools import lru_cache from typing import Any, Dict import requests from packit.fed_mes_consume import Consumerino from packit.sync import Synchronizer fro...
StarcoderdataPython
4988332
<gh_stars>0 import cv2 from talking_color.camera.camera import Camera, CAMERA_WIDTH, CAMERA_HEIGHT class Webcam(Camera): """ Adapted from OpenCV-Python Tutorials https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html """ def __init__(se...
StarcoderdataPython
1748160
import json import os import random import string from pathlib import Path from eth_typing import ChecksumAddress from eth_utils import to_checksum_address PATH_CONFIG = Path("/opt/synapse/config/synapse.yaml") PATH_CONFIG_TEMPLATE = Path("/opt/synapse/config/synapse.template.yaml") PATH_MACAROON_KEY = Path("/opt/syna...
StarcoderdataPython
1934407
""" QSS style sheets. """
StarcoderdataPython
3215891
<reponame>mohnbroetchen2/cykel_jenarad # Generated by Django 2.2.4 on 2020-03-17 19:42 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ("bikesharing", "0018_auto_20200204_2147"), ] operations = [ migration...
StarcoderdataPython
8114294
import random import cv2 import numpy as np from augraphy.base.augmentation import Augmentation class PageBorder(Augmentation): """Add border effect to sides of input image. :param side: One of the four sides of page i:e top,right,left,bottom. By default it is "left" :type side: string ...
StarcoderdataPython
11211034
from mesa import Model from mesa.space import ContinuousSpace from mesa.time import BaseScheduler from mesa.datacollection import DataCollector import random import numpy as np import Midge import Target import Trap import Deer import Egg import BiomeCell import csv class WorldModel(Model): def __init__(self, Num...
StarcoderdataPython
1773423
<gh_stars>0 # # Copyright (c) nexB Inc. and others. All rights reserved. # VulnerableCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. # See https://github.com/nexB/vulnerablecode for support or download. # See https://aboutcode...
StarcoderdataPython
4931520
<filename>locomotion_analysis/src/angle_analysis.py import math import numpy as np class ProjectionVector(object): """ Computes the projection vector from an input segment Input must be in the form: ((x0,y0),(x1,y1)) """ def __init__(self, lineA): self.lineA = lineA self.vector = self.find_projection() self...
StarcoderdataPython