id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
26409
# Generated by Django 3.1 on 2020-09-01 17:57 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('application', '0001_initial'), ] operations = [ migrations.AlterField( model_name='client', name='link', f...
StarcoderdataPython
3250671
from os import path import cv2 import dlib import numpy as np from trash import filter class dlibTracker: """ Tracks faces in video frames, extracts facial features """ def _iter_predict(self, prediction, start, end): for p in range(start, end): yield (int(prediction[p, 0]), int...
StarcoderdataPython
4805508
<filename>tests/pandas/validation/test_pandas_validator_invalid_values.py<gh_stars>10-100 import pytest import pandas as pd from collections import ChainMap import datetime from arize.pandas.logger import Schema from arize.pandas.validation.validator import Validator import arize.pandas.validation.errors as err def ...
StarcoderdataPython
3281181
#!/usr/bin/env python # Copyright 2016 Cisco Systems, 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....
StarcoderdataPython
1600007
<filename>server/app/schema.py """GraphQL Schema Module""" from datetime import datetime import graphene from graphene_sqlalchemy import SQLAlchemyObjectType, SQLAlchemyConnectionField from database.model_questions import QuestionModel from database.model_users import UserModel, CourseModel from database.base import ...
StarcoderdataPython
1757172
import io import sys from glob import iglob from os import makedirs, path, remove, removedirs from pprint import pformat import nbformat from mkdocs.config import config_options from mkdocs.plugins import BasePlugin from mkdocs.structure.files import File from mkdocs.utils import log from nbconvert import MarkdownExpo...
StarcoderdataPython
165915
<filename>nbpresent/tasks/requirejs.py<gh_stars>0 from subprocess import Popen import sys from ._env import ( SRC, join, node_bin, IS_WIN, ) def main(**opts): args = [ node_bin("r.js{}".format(".cmd" if IS_WIN else "")), "-o", join(SRC, "js", "build.js"), ] + opts.get("require...
StarcoderdataPython
1766661
<gh_stars>0 import unittest from unittest.mock import MagicMock from lxml import html from naotomori.cogs.source.manga.mangadex import MangaDex class TestMangaDex(unittest.TestCase): """Tests for the MangaDex""" def setUp(self): self.mangadex = MangaDex() def test_findMangaElements(self): ...
StarcoderdataPython
3226869
from .conf import * from gym_electric_motor.physical_systems import * from gym_electric_motor.utils import make_module, set_state_array from gym_electric_motor import ReferenceGenerator, RewardFunction, PhysicalSystem, ElectricMotorVisualization, \ ConstraintMonitor from gym_electric_motor.physical_systems import P...
StarcoderdataPython
118702
import unittest from pybox.math import util class MathUtilTest(unittest.TestCase): def test_dot(self): l1 = [1, 2, 3] l2 = [3, 4, 6] self.assertEqual(util.dot(l1, l2), 29) if __name__ == '__main__': unittest.main()
StarcoderdataPython
176396
__version__ = "1.12.0" __version_info__ = ( 1, 12, 0 )
StarcoderdataPython
146444
<filename>main/watchlist_app/migrations/0005_alter_movielist_streaming_platform.py # Generated by Django 3.2.4 on 2021-08-24 15:51 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('watchlist_app', '0004_alter_movielist_str...
StarcoderdataPython
1612329
# This file is part of the Reproducible and Reusable Data Analysis Workflow # Server (flowServ). # # Copyright (C) 2019-2021 NYU. # # flowServ is free software; you can redistribute it and/or modify it under the # terms of the MIT License; see LICENSE file for more details. """Methods to render input forms for the dif...
StarcoderdataPython
135495
<gh_stars>100-1000 from contextlib import contextmanager import torch import torch.nn as nn import torch.nn.functional as F @contextmanager def save_sample_grads(model: nn.Module): handles = [] for module in model.children(): params = list(module.parameters()) params = [p for p in params if ...
StarcoderdataPython
3214503
#!/usr/bin/env python # # Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at # # http://aws.amazon.com/apache2.0/ # # or in...
StarcoderdataPython
95445
#encoding:utf8 import requests def func1(): r = requests.get(url='http://www.itwhy.org') # 最基本的GET请求 print(r.status_code) # 获取返回状态 r = requests.get(url='http://dict.baidu.com/s', params={'wd': 'python'}) # 带参数的GET请求 print(r.url) print type(r.text), len(r.text) #, r.text print (u'中国') wi...
StarcoderdataPython
1714568
<reponame>jadamowi/docs_automations<gh_stars>0 from pathlib import Path import PyPDF2 def pdfencryption(inpath, outpath, pdfpass): """ Function loops through the given path looking for PDF files, encrypts them and save in a given folder. :param inpath: Path to th...
StarcoderdataPython
1791248
from aspen.config import config # Docker-compose environment config class DockerComposeConfig(config.Config): @config.flaskproperty def DEBUG(self) -> bool: return True @config.flaskproperty def SESSION_COOKIE_SECURE(self) -> bool: return False @config.flaskproperty def SESSI...
StarcoderdataPython
1799911
# coding: utf-8 import sys from PyQt5.QtCore import Qt from PyQt5.QtWidgets import (QWidget, QApplication, QFrame, QVBoxLayout, QSplitter, QDesktopWidget) from .params import Params from .introduction import Introduction from .type_of_task import TypeOfTask from .set_file import S...
StarcoderdataPython
157966
<gh_stars>1000+ """ Example that shows how to receive updates on discovered chromecasts. """ # pylint: disable=invalid-name import argparse import logging import time import zeroconf import pychromecast parser = argparse.ArgumentParser( description="Example on how to receive updates on discovered chromecasts." ...
StarcoderdataPython
22391
<filename>abcvoting/preferences.py """ Dichotomous (approval) preferences and preference profiles Voters are indexed by 0, ..., len(profile) Candidates are indexed by 0, ..., profile.num_cand """ from abcvoting.misc import str_candset from collections import OrderedDict class Profile(object): """ Preference...
StarcoderdataPython
135385
<gh_stars>1-10 from django.db import models from django.contrib.auth.models import User from rules.contrib.models import RulesModel import rules @rules.predicate def is_alarm_creator(user, alarm): return alarm.creator == user rules.add_rule('can_edit_alarm',is_alarm_creator) rules.add_perm('alarm.edit_alarm', is_a...
StarcoderdataPython
3364063
<reponame>Mahesh1822/evalml<filename>evalml/utils/logger.py<gh_stars>100-1000 """Logging functions.""" import logging import sys import time def get_logger(name): """Get the logger with the associated name. Args: name (str): Name of the logger to get. Returns: The logger object with the ...
StarcoderdataPython
3233937
<reponame>bcongdon/agdq-2017-schedule-analysis<gh_stars>1-10 import requests from bs4 import BeautifulSoup import pandas as pd import json from scrape_genres import get_game_genres def get_games_list(): req = requests.get('https://gamesdonequick.com/schedule') soup = BeautifulSoup(req.text) table = soup.f...
StarcoderdataPython
1782766
import argparse import math import random import pandas as pd import numpy as np import matplotlib.pyplot as plt T = 10 def weak_learner(temp_X, temp_y, D): m, d = temp_X.shape F_star, theta_star, j_star = float('inf'), 0, 0 for j in range(d): sorted_indexes = temp_X[:, j].argsort() xj ...
StarcoderdataPython
28293
<reponame>AaronFriel/pulumi-google-native # coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Unio...
StarcoderdataPython
3387037
# Celery workers import base64 import json import time from enum import Enum, auto from typing import Dict import requests from celery import Celery from celery.result import AsyncResult from celery.task import periodic_task from backend.blueprints.spa_api.service_layers.leaderboards import Leaderboards from backend....
StarcoderdataPython
128542
<filename>examples/driving.py from __future__ import division import pygame import rabbyt from math import cos, sin, radians import random import os.path rabbyt.data_directory = os.path.dirname(__file__) class Car(rabbyt.Sprite): boost_particles = set() dust_particles = set() def __init__(self, name): ...
StarcoderdataPython
1662220
from ttictoc import TicToc import db.connections_manager as conn_mng from utils.algorithms import extract_added_words from clf.wiki_classifier import WikiClassifier from clf.classifier_manager import reload_classifier from lang.langs import Lang from jobs.base_job import BaseJob class AddRevsJob(BaseJob): """ ...
StarcoderdataPython
3337676
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2021, <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,...
StarcoderdataPython
61983
<filename>flaskapp/app/craft/network.py import json import keras_ocr import os import pickle from app import root_dir from app.config import Config from pathlib import Path import tensorflow as tf # from app.rc_ocr.rc_stream import weights_from_s3, coder_from_s3 data_dir = Path(root_dir) class CRAFT(): def __in...
StarcoderdataPython
3323627
<reponame>xylar/cdat import os, sys, cdms2, vcs, vcs.testing.regression as regression dataset = cdms2.open(os.path.join(vcs.sample_data,"clt.nc")) data = dataset("clt") canvas = regression.init() boxfill = canvas.createboxfill() boxfill.color_1 = 242 boxfill.color_2 = 250 boxfill.colormap = "classic" canvas.plot(d...
StarcoderdataPython
1625790
#!/usr/bin/env python import sys sys.path.insert(0, '../..') from app import app, create_tables create_tables() app.run()
StarcoderdataPython
3280940
from typing import Optional from src.data.mongo.secret import get_random_key def get_access_token(access_token: Optional[str] = None) -> str: if access_token is not None: return access_token return get_random_key()
StarcoderdataPython
3227526
<reponame>HaozhengAN/PaddleFlow<gh_stars>0 """ Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. 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....
StarcoderdataPython
1660842
<reponame>junekim00/ITP115 # <NAME> # ITP115, Fall 2019 # Final Project Part 1 # <EMAIL> # This program will define the MenuItem class for the final program. class MenuItem: # set proper classes for different aspects of class def __init__(self, name, itemType, price, description): self.name ...
StarcoderdataPython
1763880
<reponame>ceprio/xl_vb2py #!/usr/bin/python """ __version__ = "$Revision: 1.10 $" __date__ = "$Date: 2005/12/13 11:13:22 $" """ """ use a comma separated value file as a database Author: <NAME> eMail: <EMAIL> Date: 21-Mar-02 """ import PythonCard from PythonCard import dialog, model configFile = 'custdb.ini' colu...
StarcoderdataPython
3303766
"""Run sickle. The trimmers are specified using the TRIMMOMATIC_TRIMMERS environment variable, e.g.: export TRIMMOMATIC_TRIMMERS="ILLUMINACLIP:TruSeq3-PE.fa:2:30:10 LEADING:3 TRAILING:3 SLIDINGWINDOW:4:15 MINLEN:36" """ import os from smarttoolbase import SmartTool, Command, parse_args from dtoolcore.utils import ...
StarcoderdataPython
3213692
<reponame>Setti7/Stardew-Web import json import random from datetime import datetime, timedelta from django.db.models import Sum, Avg, Max from django.shortcuts import render from rest_framework.authtoken.models import Token from .models import UserData, Profile def home_page(request): return render(request, 'D...
StarcoderdataPython
3394637
#!/usr/bin/python """This test tries to open and create a file in multiple modes If any errors occur the test displays a "FAILED" message""" import os import subprocess import sys import pysec import pysec.io import pysec.io.fcheck import pysec.io.fd import pysec.io.fs import pysec.io.temp FILE_NAME = '/tmp/__pysec_o...
StarcoderdataPython
1600556
import sys import numpy as np from scipy.stats import describe import os import time import matplotlib import pandas as pd from sklearn.base import ClassifierMixin, BaseEstimator import warnings import scipy import sklearn from sklearn.model_selection import train_test_split from sklearn.decomposition import PCA import...
StarcoderdataPython
1747542
from pydantic.main import BaseModel from morpho.rest.models import ( ListServicesResponse, ServiceInfo, TransformDocumentPipeRequest, TransformDocumentPipeResponse, TransformDocumentRequest, TransformDocumentResponse, ) from morpho.util import decode_base64, encode_base64 class TestTransformDo...
StarcoderdataPython
3291331
# -*- coding: utf-8 -*- def main(): n, m, d = map(int, input().split()) # KeyInsight # 期待値の線形性 # See: # https://img.atcoder.jp/soundhound2018-summer-qual/editorial.pdf # https://mathtrain.jp/expectation # 気がつけた点 # 愚直解を書き出した # 隣り合う2項がm - 1通りある # 解答までのギャップ ...
StarcoderdataPython
3281774
<reponame>unicornis/pybrreg # -*- coding: utf-8 -*- from __future__ import unicode_literals import base64 from io import BytesIO from zipfile import ZipFile from .new_inquiry import BrregNewInquiry from .manifest import BrregManifest from .recipients import BrregRecipientList class BrregPackage(object): """ ...
StarcoderdataPython
3254528
<gh_stars>10-100 # Generated by Django 3.0.8 on 2020-07-12 14:41 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auctions', '0011_closedbid'), ] operations = [ migrations.AddField( model_name='closedbid', name='d...
StarcoderdataPython
152765
<gh_stars>1-10 import mock from requests import ConnectionError from slumber.exceptions import HttpClientError from django.test.testcases import SimpleTestCase from django.conf import settings from ..backend import get_backend, ClaBackend from . import base class TestClaBackend(ClaBackend): zone_name = base.D...
StarcoderdataPython
95961
# -*- coding: utf-8 -*- """ Main model architecture. reference: https://github.com/andy840314/QANet-pytorch- """ import math import torch import torch.nn as nn import torch.nn.functional as F from .modules.cnn import DepthwiseSeparableConv # revised two things: head set to 1, d_model set to 96 device = torch.device(...
StarcoderdataPython
3339819
import time import random import pygame from syslogic import CGGPYG from cggframe import cggframe class linetest(cggframe): def __init__(self): self.cgg=CGGPYG("") self.gamestate="play" """x1,y1:startpoint x2,y2:endpoint of line""" self.x1=100 self.x2=400...
StarcoderdataPython
3380832
<gh_stars>0 from flask import Flask,render_template, request,redirect, session import backend import os from datetime import date import smtplib from email.message import EmailMessage import random app = Flask(__name__) app.secret_key = os.urandom(24) backend.connect() def get_fname(s): n = '...
StarcoderdataPython
162311
<reponame>melwinmpk/Django_RestAPI<gh_stars>1-10 from django.contrib.auth.models import User,auth from django.shortcuts import render, redirect from django.contrib import messages from testsetup.models import SubjectDefinition,Questions,QuestionDefinition import json import random import base64 class testsetup: ...
StarcoderdataPython
57654
from .elasticsearch_connector import * from .index_handler import * from .policy_handler import *
StarcoderdataPython
4819307
<gh_stars>0 # -*- coding: utf-8 -*- import urllib.parse import asyncio import aiohttp import lxml.html import lxml.html.clean class BaseAsyncScraper(object): def __init__(self, concurrency: int=10): self.urls = [] self.concurrency = concurrency self.pages = [] @staticmethod def ...
StarcoderdataPython
130768
#! /usr/bin/env python3 """ run_sim.py Run FPGA simulations via Icarus, NCVerilog, Modelsim or Isim. """ import json import os import shlex import subprocess import sys import argparse import string def which(program): """ Find the path to an executable program """ def is_exe(fpath): """ ...
StarcoderdataPython
108843
"""Logical optimization, composition, and transformation rules. """ import json from pyfpm.matcher import Matcher from .. import util from .. import operators as _op from ..operators import PhysicalOperator # required for the physical planning rules to compile from .symbols import * __pop__ = PhysicalOperator # this...
StarcoderdataPython
3217486
<filename>p99/python3/p22.py # create a list containing all integers within a given range def rng(i, k): return list(range(i, k+1)) def test_rng(): assert rng(4, 9) == [4, 5, 6, 7, 8, 9]
StarcoderdataPython
1746443
import random import json import os import shutil def initiate_files(gossip_activated): for filename in os.listdir('temporary'): file_path = os.path.join('temporary', filename) try: if os.path.isfile(file_path) or os.path.islink(file_path): os.unlink(file_pat...
StarcoderdataPython
1683075
<gh_stars>1-10 from collectors.spiders.committee_event import CommitteeEventSpider from collectors.spiders.committee_speech import CommitteeSpeechSpider
StarcoderdataPython
3216180
<reponame>SpleefDinamix/SoftuniPythonProgrammingBasics inches = float(input("Inches = ")) centimeters = inches * 2.54 print("Centimeters =", centimeters)
StarcoderdataPython
1654319
<reponame>netbofia/WindowsAccessLogger from kivy.app import App from kivy.uix.label import Label from kivy.uix.gridlayout import GridLayout from kivy.uix.textinput import TextInput from kivy.uix.button import Button from kivy.uix.popup import Popup from kivy.uix.switch import Switch from kivy.uix.progressbar import Pr...
StarcoderdataPython
4819586
from app.search.SearchQuery import SearchQuery, BadQueryException from app import app from app.search import SearchForm from app.provider import Provider from flask import Blueprint, render_template, jsonify, request from flask_api import status # Create a search blueprint searchbp = Blueprint("searchbp", __name__...
StarcoderdataPython
3258535
from django import forms from stocks.models import PartsMaster from .models import IndentMaster, IndentTransactions from django.forms.models import inlineformset_factory from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Field, Fieldset, Div, HTML, ButtonHolder, Submit from .custom_layou...
StarcoderdataPython
135982
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 from datetime import datetime import os from unittest import TestCase from unittest.mock import patch, MagicMock, call with patch("boto3.client") as boto_client_mock: from functions.usergamedata.UpdateItem i...
StarcoderdataPython
19039
<reponame>webguru001/Python-Django-Web<filename>Francisco_Trujillo/Assignments/registration/serverre.py from flask import Flask, render_template, request, redirect, session, flash import re EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$') app = Flask(__name__) app.secret_key = 'irtndvieurnvi...
StarcoderdataPython
166462
<filename>pramp/diff_between_two_strings.py def diff_strings_rec(source, target, dp={}): dp_key = (source, target) if dp_key in dp: return dp[dp_key] if not source and not target: result = [] dp[dp_key] = (0, result) return dp[dp_key] if not source: result = ["+" ...
StarcoderdataPython
135551
<filename>tools/train_lanenet.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Time : 19-4-24 下午9:33 # @Author : MaybeShewill-CV # @Site : https://github.com/MaybeShewill-CV/lanenet-lane-detection # @File : train_lanenet.py # @IDE: PyCharm """ Train lanenet script """ import argparse import math import os...
StarcoderdataPython
4821776
import unittest import test.testdata.original_pb2 as original_version import test.testdata.update_pb2 as update_version from src.comparator.field_comparator import FieldComparator from src.findings.finding_container import FindingContainer from src.findings.utils import FindingCategory class FieldComparatorTest(unitte...
StarcoderdataPython
1722410
<filename>Uche Clare/Phase 2/String/Day 31/Task 6.py<gh_stars>1-10 #Write a Python program to display formatted text (width=50) as output. import textwrap text = """ Rather than attempting to seek out Python 3-specific recipes, the topics of this book are merely inspired by existing code and techniques. Using...
StarcoderdataPython
3216539
import torch import torch.nn as nn import torch.nn.functional as F from modeling.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d from modeling.aspp import build_aspp from modeling.decoder import build_decoder_kinematic, build_decoder from modeling.backbone import build_backbone from modeling.kinematic_graph imp...
StarcoderdataPython
3202595
import copy from django.core.exceptions import ValidationError from django.db import models from django.forms import widgets from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers from rest_framework.utils import model_meta from ..core.validators import validate_password clas...
StarcoderdataPython
117111
<filename>grammar.py # author: <NAME> import re from stanfordcorenlp import StanfordCoreNLP def subjectVerbAgreement(text): nlp = StanfordCoreNLP(r'..\stanford-corenlp-full-2018-02-27') text = re.sub('[^A-Za-z0-9]+', ' ', text) tags = [] pos_tags = nlp.pos_tag(text) # print(len(pos_tags)) fo...
StarcoderdataPython
197127
from cement import ex from .tet_controller import TetController import json class Applications(TetController): class Meta: label = 'applications' stacked_type = 'nested' help= 'Interact with ADM Application from Tetration Cluster' @ex(help='list applications', arguments=[ ...
StarcoderdataPython
4837806
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
StarcoderdataPython
3363265
def iterative_levenshtein(s, t): """ iterative_levenshtein(s, t) -> ldist ldist is the Levenshtein distance between the strings s and t. For all i and j, dist[i,j] will contain the Levenshtein distance between the first i characters of s and the first j characters of t. Credit: https://www.p...
StarcoderdataPython
3330918
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Mon Dec 10 18:00:43 2018 """ import numpy as np import cv2 from matplotlib import pyplot as plt imgSrc = cv2.imread('C:\\Users\\praxis\\Documents\\Cours\\2018-2019\\VR-RA\\correct\\animauxFantastiques.jpg',cv2.IMREAD_UNCHANGED ) imgDest = cv2.imread('C:\\Us...
StarcoderdataPython
16571
<reponame>jdvelasq/techMiner from collections import Counter import pandas as pd import ipywidgets as widgets import techminer.core.dashboard as dash from techminer.core import ( CA, Dashboard, TF_matrix, TFIDF_matrix, add_counters_to_axis, clustering, corpus_filter, exclude_terms, ) ...
StarcoderdataPython
186411
# coding: utf-8 """ Copyright (c) 2014 <NAME> Check LICENSE for details. """ from .jlink import ExecJLinkScriptCommand class Erase(ExecJLinkScriptCommand): SCRIPT = "erase.jlink" def execute(self): return super(Erase, self).execute(self.SCRIPT)
StarcoderdataPython
1721025
# License: BSD 3 clause import io, unittest import numpy as np import pickle from scipy.sparse import csr_matrix from tick.solver.tests import TestSolver from tick.prox import ProxL1 from tick.linear_model import ModelLinReg, SimuLinReg from tick.linear_model import ModelLogReg, SimuLogReg from tick.linear_model im...
StarcoderdataPython
4826843
import random class biasedrandom(): def brandrangenum(self, start: int, stop: int, biasednumbers: list, biaschance: int): if biaschance > 100: raise ValueError('biaschance cannot be bigger that 100.') for i in biasednumbers: if int(i) > stop or int(i) < start: ...
StarcoderdataPython
3308888
<gh_stars>1-10 from app import db, login_manager from flask_login import UserMixin from werkzeug.security import generate_password_hash, check_password_hash @login_manager.user_loader def load_user(id): return User.query.get(int(id)) class User(UserMixin, db.Model): id = db.Column(db.Integer, primary_key = Tr...
StarcoderdataPython
49586
<filename>botc/gamemodes/sectsandviolets/Oracle.py """Contains the Oracle Character class""" import json from botc import Character, Townsfolk from ._utils import SectsAndViolets, SnVRole with open('botc/gamemodes/sectsandviolets/character_text.json') as json_file: character_text = json.load(json_file)[SnVRole.or...
StarcoderdataPython
115534
<filename>setup.py import os import sys import re import subprocess import shlex try: from setuptools import setup from setuptools.command.install import install except ImportError: from distutils.core import setup from distutils.command.install import install VERSION = '0.4.1' def get_tag_version(...
StarcoderdataPython
93218
<reponame>amsks/SMARTS import math import numpy as np import pybullet import pybullet_utils.bullet_client as bc import pytest from smarts.core.coordinates import Heading, Pose from smarts.core.chassis import AckermannChassis @pytest.fixture def bullet_client(): client = bc.BulletClient(pybullet.DIRECT) yiel...
StarcoderdataPython
1793075
<reponame>simiotics/djangorestframework-queryfields<gh_stars>100-1000 from rest_framework.test import APIClient from tests.utils import decode_content def test_model_list_response_unfiltered(): response = APIClient().get('/snippets/') expected = [ { 'id': 1, 'title': 'Fork bom...
StarcoderdataPython
3373860
<reponame>mikephelan/opendp-ux """ Methods for retrieving custom fonts """ from pathlib import Path from os.path import abspath, dirname, join from borb.pdf.canvas.font.simple_font.true_type_font import TrueTypeFont FONT_DIR = join(dirname(abspath(__file__)), 'static', 'fonts') FONT_DIR_OPEN_SANS = join(FONT_DIR, 'Ope...
StarcoderdataPython
4817501
<gh_stars>0 # Copyright (c) 2017 <NAME> # Software is licensed under the MIT License # complete license can be found at https://github.com/karreric1/rms/ import numpy as np import pandas as pd import decimal import matplotlib.pyplot as plt def exp_generator(samples, mean): '''generates a list of exp...
StarcoderdataPython
3282093
<filename>kon/model/ctr_model/model/models.py # _*_ coding:utf-8 _*_ '''================================= @Author :tix_hjq @Date :2020/5/3 上午9:13 @File :models.py =================================''' from kon.utils.data_prepare import data_prepare, InputFeature from kon.model.ctr_model.layer.behavior_layer.behavior...
StarcoderdataPython
1635757
import torch import torch.nn as nn import torch.nn.functional as F class MethEncoder(nn.Module): def __init__(self, feature_size, embedding_size): super(MethEncoder, self).__init__() self.embeddings = nn.Parameter(torch.randn(feature_size, embedding_size, requires_grad=True)) def forward(self...
StarcoderdataPython
1652884
<gh_stars>0 import tensorflow as tf x = tf.Variable(tf.constant(2)) y = tf.Variable(tf.constant(3)) z = x * y init = tf.initialize_all_variables() session = tf.Session() session.run(init) print(session.run(z))
StarcoderdataPython
1623397
<reponame>ParadoxARG/Recognizers-Text<filename>Python/libraries/recognizers-number/recognizers_number/number/japanese/extractors.py from typing import List from enum import Enum from recognizers_number.number.extractors import ReVal, BaseNumberExtractor from recognizers_text.utilities import RegExpUtility from recogni...
StarcoderdataPython
1732658
# Databricks notebook source import pandas as pd import math import matplotlib.pyplot as plt import numpy as np # COMMAND ---------- # MAGIC %md # MAGIC #REGRESSION MODEL NOTES # MAGIC ## We Can Conduct a few different version of this regression model by changing the dependent and independent variables # MAGIC **Depe...
StarcoderdataPython
3381453
<gh_stars>0 """Zarządzanie całym zachowaniem statku obcych.""" import pygame from pygame.sprite import Sprite class Alien(Sprite): """Klasa przedstawiająca pojedynczego obcego we flocie.""" def __init__(self, ai_settings, screen): """Inicjalizacja obcego i zdefiniowanie jego położenia początkowego.""...
StarcoderdataPython
1696347
<gh_stars>10-100 import dask.dataframe as dd import holoviews as hv import geoviews as gv from bokeh.models import Slider, Button from bokeh.layouts import layout from bokeh.io import curdoc from bokeh.models import WMTSTileSource from holoviews.operation.datashader import datashade, aggregate, shade from holoviews.p...
StarcoderdataPython
180093
from __future__ import annotations from pathlib import Path from typer import echo from ..resolvers import clone_github, clone_local from .resolver import Resolver from .runner import Runner from .variables import get_variables, read_variables class NooCore: def __init__(self, allow_shell: bool = False) -> Non...
StarcoderdataPython
3258908
import os import copy import unittest import jsonschema from yggdrasil.tests import assert_equal from yggdrasil.communication import new_comm from yggdrasil.communication.tests import test_CommBase as parent def test_wait_for_creation(): r"""Test FileComm waiting for creation.""" msg_send = b'Test message\n' ...
StarcoderdataPython
79041
<reponame>acatwithacomputer/proteus<gh_stars>0 from glob import * from os import * files = glob('*2D*_n.py') for f in files: nf = f.lower() words = nf.split('_') nf=words[0] for sb in words[1:-2]: if sb != '2d': nf += '_'+sb nf += '_2d' nf += '_'+words[-2]+'_'+words[-1] #...
StarcoderdataPython
1761337
n = [3, 5, 7] def list_extender(lst): lst.append(9) return lst print list_extender(n)
StarcoderdataPython
3206974
<reponame>edugonza/pm4py-source<filename>pm4py/visualization/dfg/factory.py<gh_stars>0 from pm4py.visualization.dfg.versions import simple_visualize import os, shutil from pm4py.visualization.common.save import * FREQUENCY = "frequency" PERFORMANCE = "performance" VERSIONS = {FREQUENCY: simple_visualize.apply_frequen...
StarcoderdataPython
142619
<reponame>armandomeeuwenoord/freight<filename>freight/notifiers/base.py<gh_stars>100-1000 from freight.models import Deploy, TaskStatus from freight import http __all__ = ["Notifier", "NotifierEvent"] class NotifierEvent(object): TASK_STARTED = 0 TASK_FINISHED = 1 TASK_QUEUED = 2 class Notifier(object)...
StarcoderdataPython
194202
<filename>tests/unit/test_auth_sigv4.py<gh_stars>1000+ # Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.ama...
StarcoderdataPython
3347175
<reponame>b-whitman/TwitOff from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate import os from dotenv import load_dotenv from twitoff.models import db, User, Tweet, migrate from twitoff.routes import my_routes from twitoff.twitter_service import twitter_api_client load_do...
StarcoderdataPython