id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1728413
# Copyright 2021 DengBoCong. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
StarcoderdataPython
131112
import time import cv2 import numpy as np from PIL import ImageGrab import win32gui import win32con import win32api import win32com, win32com.client import re from playsound import playsound import jstyleson as json from os import path import sys from collections import deque import builtins as __builtin__ from datetim...
StarcoderdataPython
1729127
<filename>setup.py from setuptools import setup with open("README.md","r") as fh: long_description=fh.read() setup( name='pytwisty', version='0.0.1', description="Solve 1x2x2, 1x2x3, and 2x2x2 Rubik's cube puzzles", py_modules=["pytwisty"], package_dir={'':'src'}, classifiers=[ ...
StarcoderdataPython
129546
<reponame>kbujold/stx-horizon # Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file...
StarcoderdataPython
3242811
<gh_stars>0 import logging from time import time from datetime import datetime, timezone, MAXYEAR from concurrent.futures import ThreadPoolExecutor from azure.cosmosdb.table.tableservice import TableService class AzureTableStorageHandler(logging.Handler): """ A handler class which writes formatted logging rec...
StarcoderdataPython
1672623
import os import ctypes import sys from shutil import move from os import getenv, rmdir from os.path import isfile, isdir from random import choices # from GUI.checking import checkIsWindows, checkIsAdmin path_to_current_file = r"C:\Program Files\Adobe\Adobe Illustrator CC 2018\Support Files\Contents\Windows\AMT\appl...
StarcoderdataPython
141876
######## # Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
StarcoderdataPython
1617330
def exchange_sort(numbers: list[int]) -> list[int]: """ Uses exchange sort to sort a list of numbers. Source: https://en.wikipedia.org/wiki/Sorting_algorithm#Exchange_sort >>> exchange_sort([5, 4, 3, 2, 1]) [1, 2, 3, 4, 5] >>> exchange_sort([-1, -2, -3]) [-3, -2, -1] >>> exchange_sort([1...
StarcoderdataPython
3326149
"""Runtime API.""" import abc from typing import NamedTuple, Any, Dict, List, Tuple, Awaitable import http import json # import os import tornado.concurrent import tornado.ioloop import tornado.web import tornado.platform.asyncio import tornado.httpclient from tornado.escape import json_encode, json_decode from ...
StarcoderdataPython
89663
# Copyright 1997 - 2018 by IXIA Keysight # # 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, p...
StarcoderdataPython
1772869
<gh_stars>0 class Piece: def __init__(self, sign: str, color: str = 'white') -> None: self._sign = sign self._color = color def get_sign(self): return self._sign def get_color(self) -> str: return self._color
StarcoderdataPython
61760
<filename>examples/hubert/simple_kmeans/kmeans_label.py<gh_stars>0 from mpi4py import MPI import os import argparse parser = argparse.ArgumentParser() parser.add_argument('--split', default='train') args = parser.parse_args() comm = MPI.COMM_WORLD rank = comm.Get_rank() size = comm.Get_size() command = "python dump_...
StarcoderdataPython
1789384
from dotenv import load_dotenv # pip install python-dotenv from geopy import distance from googleplaces import GooglePlaces, types, lang import json import os import pgeocode import requests as req load_dotenv() GOOGLE_API_KEY = os.getenv('GOOGLE_API_KEY') google_places = GooglePlaces(GOOGLE_API_KEY) d...
StarcoderdataPython
80807
from __future__ import annotations import asyncio import json import logging import os from typing import Any, Mapping, Optional, Union import aiohttp from aiohttp import hdrs from aiohttp.client import _RequestContextManager from .auth import Auth from .request import ClientRequest from .typedefs import WsBytesHand...
StarcoderdataPython
27828
from functools import wraps from opentracing import global_tracer, tags, logs from contextlib import contextmanager def operation_name(query: str): # TODO: some statement should contain two words. For example CREATE TABLE. query = query.strip().split(' ')[0].strip(';').upper() return 'asyncpg ' + query ...
StarcoderdataPython
4842540
#!/usr/bin/python # Copyright (c) 2010 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import re import pyauto_functional # Must be imported before pyauto import pyauto import test_utils class SearchEnginesTest(pyauto...
StarcoderdataPython
1637007
<gh_stars>0 import requests import csv import time import os import pickle from xml.dom import minidom from pprint import pprint as print import re import itertools from functools import reduce import codecs from datetime import date, datetime from dateutil import parser from collections import defaultdict from django....
StarcoderdataPython
6611
<filename>olctools/accessoryFunctions/metadataprinter.py #!/usr/bin/env python3 import logging import json import os __author__ = 'adamkoziol' class MetadataPrinter(object): def printmetadata(self): # Iterate through each sample in the analysis for sample in self.metadata: # Set the n...
StarcoderdataPython
153635
<gh_stars>1-10 from django.shortcuts import render, get_object_or_404 from django.contrib.auth.decorators import login_required from django.http import HttpResponseRedirect from django.utils import timezone from django.contrib import messages from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from...
StarcoderdataPython
3279243
"""Train for CONLL 2017 UD treebank evaluation. Takes .conllu files, writes .conllu format for development data, allowing the official scorer to be used. """ from __future__ import unicode_literals import plac import attr from pathlib import Path import re import json import spacy import spacy.util from spacy.tokens i...
StarcoderdataPython
4807285
<reponame>wangleye/KOL_marketing<filename>data_preprocessing/generate_KOLs.py import pymysql import numpy as np conn = pymysql.connect(host='127.0.0.1', user='root', passwd='<PASSWORD>', db='all0504') USERS_BY_UID = {} NET = {} class User: def __init__(self, uid, friends, items): self.uid = u...
StarcoderdataPython
3309757
# Declare a variable of boba_shop with an input and a string of "Welcome to the Boba Shop!" # Check if boba_shop is equal to true # Write a print with a string of "Hello" # Declare a variable of beverage with an input and a string of "What kind of boba drink would you like ?" # Declare a...
StarcoderdataPython
103666
import time import numpy as np import tensorflow as tf from dater import reader from modeler.multirnnmodel import MultiRNNModel from trainer.tftrainer import TFTrainer class MutiRNNTrainer(TFTrainer): def __init__(self): self.config = SmallConfig() self.eval_config = SmallConfig() self.e...
StarcoderdataPython
175961
from .numpy_macenko_normalizer import NumpyMacenkoNormalizer from .torch_macenko_normalizer import TorchMacenkoNormalizer # from .tensorflow_macenko_normalizer import TensorFlowMacenkoNormalizer def MacenkoNormalizer(backend='torch'): if backend == 'numpy': return NumpyMacenkoNormalizer() # elif backen...
StarcoderdataPython
3370448
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
StarcoderdataPython
1640811
from math import ceil from multiprocessing import Process, Queue import matplotlib.pyplot as plt from options.pricing.binomial_trees import BinomialTreePricer from options.option import OptionType, Option class OptionPricePlotter: def __init__(self, otype=OptionType.PUT, spot=50, strike=52, rate...
StarcoderdataPython
1722584
import matplotlib.pyplot as plt y = [0.25, 0.15, 0.16, 0.12, 0.09, 0.08, 0.06, 0.07, 0.05, 0.045, 0.052, 0.049, 0.052] labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] plt.scatter(labels, y) plt.ylim(0, 0.3) plt.xticks(labels) plt.ylabel("CoV") plt.xlabel("# iteration") plt.tight_layout() # plt.show() plt.savefig...
StarcoderdataPython
67030
# > \brief \b DROTMG # # =========== DOCUMENTATION =========== # # Online html documentation available at # http://www.netlib.org/lapack/explore-html/ # # Definition: # =========== # # def DROTMG(DD1,DD2,DX1,DY1,DPARAM) # # .. Scalar Arguments .. # DOUBLE PRECISION DD1,DD2,DX1,DY1 # ...
StarcoderdataPython
108652
#!/usr/bin/python import os import subprocess import argparse import time from colorama import init from colorama import Fore, Back, Style import re def atoi(text): return int(text) if text.isdigit() else text def natural_keys(text): return [atoi(c) for c in re.split('(\d+)', text)] class Tester: def...
StarcoderdataPython
123597
# Generated by Django 3.2.11 on 2022-03-25 08:09 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('common', '0016_auto_20220215_1721'), ('staff', '0004_servicerequest'), ] operations = [ migrations...
StarcoderdataPython
3371001
from unittest import TestCase from pyparsing import ParserElement from pydbml.definitions.table_group import table_group ParserElement.setDefaultWhitespaceChars(' \t\r') class TestProject(TestCase): def test_empty(self) -> None: val = 'TableGroup name {}' res = table_group.parseString(val, par...
StarcoderdataPython
149120
# Generated by Django 2.0.3 on 2018-04-27 22:24 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('REST', '0010_auto_20180427_2144'), ] operations = [ migrations.RemoveField( model_name='user', name='username', ), ...
StarcoderdataPython
3365775
<reponame>jabrena/space-math from ce_turtl import * turtle.clear() turtle.pensize(0) turtle.penup() turtle.goto(0, -15) turtle.pendown() for i in range(100): turtle.forward(10+(i/6)*5) turtle.left(60) turtle.show()
StarcoderdataPython
3214818
import requests from requests_oauthlib import OAuth2Session from urllib.parse import urljoin from .models import DayliteData, Contact, Thin_Contact, Company, Opportunity USER_AUTHORISE_URL="https://www.marketcircle.com/account/oauth/authorize" OAUTH_TOKEN_URL="https://www.marketcircle.com/account/oauth/token" AUTH_UR...
StarcoderdataPython
111097
from typing import Sequence import pytest from faker import Faker from overhave.entities import ( FeatureExtractor, FeatureTypeExtractionError, OverhaveFileSettings, ScenariosTestFileNotFound, ) from tests.objects import FeatureTestContainer, get_test_feature_extractor from tests.unit.feature.conftest...
StarcoderdataPython
193590
# -*- coding:utf-8 -*- """ Implements a function for hoisting specially constructed comments in SQL queries and using them to rewrite that query. This is done to support query hints whilst obviating patching Django's ORM in complex ways. """ from __future__ import unicode_literals import operator import re from collec...
StarcoderdataPython
1712746
<reponame>aprimediet/django-keycloak<filename>src/django_keycloak/migrations/0001_initial.py # Generated by Django 2.2.4 on 2019-08-15 08:49 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import uuid class Migration(migrations.Migration): initial = Tru...
StarcoderdataPython
1704663
# MINLP written by GAMS Convert at 04/21/18 13:51:23 # # Equation counts # Total E G L N X C B # 22 1 0 21 0 0 0 0 # # Variable counts # x b i s1s s2s sc ...
StarcoderdataPython
175971
# # Copyright (c) 2008-2015 Citrix Systems, 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 l...
StarcoderdataPython
3273454
<filename>pngrecon/lib/chunk.py<gh_stars>0 from ..util.log import log_stderr as log from ..util.log import fail_hard import struct import zlib from enum import Enum from functools import lru_cache def read_image_stream(stream): ''' Read a PNG from the given stream and return an ordered list of its chunks. If ...
StarcoderdataPython
1663723
import click @click.group() def haproxy(**kwargs): """ Manage haproxy loadbalancer operations """
StarcoderdataPython
3319573
<reponame>ZooAtmosphereGroup/HelloPackages<gh_stars>1-10 import sys USAGE = '''\ python extract-responses.py <log-file> <response-id> [<response-id>] ''' def read_response(filename, _id): recording = False output = '' for line in file(filename): if line.startswith('=' * 40 + 'Response %s ' % _id...
StarcoderdataPython
72979
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
StarcoderdataPython
4815401
class Event(object): pass class Component(object): pass class System(object): def __init__(self): self.registry = None self.listeners = {} self.events = [] def initialize(self): raise NotImplementedError(self.__class__) def on(self, event, callback): if e...
StarcoderdataPython
1692317
<reponame>scenarios/dev _base_ = [ '../_base_/schedules/sgd_tsm_mobilenet_v2_100e.py', '../_base_/default_runtime.py' ] model = dict( type='MixRecognizer2D', backbone=dict( type='MobileNetV2TSM', shift_div=8, num_segments=8, is_shift=True, pretrained=None), c...
StarcoderdataPython
3248866
# Future from __future__ import print_function # warning ignore import warnings warnings.filterwarnings("ignore") import argparse from utils.fast_network_utils import get_network from utils.fast_data_utils import get_fast_dataloader from utils.utils import * # fetch args parser = argparse.ArgumentPars...
StarcoderdataPython
1787579
<filename>Fujitsu/benchmarks/resnet/implementations/implementation_open/mxnet/3rdparty/tvm/python/tvm/relay/grammar/py3/RelayLexer.py # Generated from /home/marisa/Work/tvm/python/tvm/relay/grammar/Relay.g4 by ANTLR 4.7.1 from antlr4 import * from io import StringIO from typing.io import TextIO import sys def seriali...
StarcoderdataPython
171862
# -*- coding: utf-8 -*- """ Created on Wed Jun 17 17:05:02 2020 @author: fcosta """
StarcoderdataPython
65642
<filename>management_api.py<gh_stars>0 #!/usr/bin/env python3 import os, sys, subprocess, time, json, urllib.request, ssl from http.server import BaseHTTPRequestHandler, HTTPServer api_file = open("/home/ec2-user/.api_key", "r") API_KEY = api_file.read().strip() api_file.close() def runLocally(commandString): p = ...
StarcoderdataPython
3357190
# This file is part of DagAmendment, the reference implementation of: # # <NAME> and <NAME> (2021). # DAG Amendment for Inverse Control of Parametric Shapes # ACM Transactions on Graphics (Proc. SIGGRAPH 2021), 173:1-173:14. # # Copyright (c) 2020-2021 -- Télécom Paris (<NAME> <<EMAIL>>) # # The MIT license: # P...
StarcoderdataPython
128510
from app import app from flask import render_template from .request import get_newss @app.route('/') def index(): items = get_newss('sources') title = 'Top Headlines' return render_template('index.html',title = title,sources=items)
StarcoderdataPython
1734491
<reponame>melonora/UNETs<gh_stars>0 from mics.segment.models.unet_parts import * import torch.nn as nn import torch.nn.functional as F class UNET(nn.Module): """ Implementation of UNET model as per the paper of Ronneberg when using default values. In case of skip being True the feature maps are passed through...
StarcoderdataPython
99048
"""HTML related implementations. Mainly following interfaces are defined: - remove_first_selector_symbol_char : Remove first selector symbol (`.` or `#`) from string. - append_html_to_str : Add html string to another string with line break and specified number's indentation. - append_indent_to_each_sc...
StarcoderdataPython
1647659
#/usr/bin/python3 try: from pymoab import core, types except ImportError as err: raise err('PyMoab not found, Reactor.export_h5m method not available') import numpy as np class dagmcGeom: def __init__(self, pygmsh): # create pymoab instance self.mb = core.Core() self.tags = dict() ...
StarcoderdataPython
110819
<filename>linkedlist/palindrome.py # https://leetcode.com/problems/palindrome-linked-list/submissions/ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution(object): def isPalindrome(self, head): ...
StarcoderdataPython
84607
import sys import re import datefinder #finds the first ID found in a string def find_id(message): result = re.search('<@!(.+?)>', message) if(result): return result.group(1) return None #finds the first date in a string def find_date(message): result = list(datefinder.find_date...
StarcoderdataPython
168251
import logging from logging import handlers import re from src.utils import config import jieba import json from tqdm import tqdm # jieba.enable_parallel(4) import pandas as pd import time from functools import partial, wraps from datetime import timedelta tqdm.pandas() def timethis(func=None, log=logging.getLogger(...
StarcoderdataPython
117011
import pandas as pd dfcsv=pd.read_csv('gruppen-zeitslots-vers3.csv') dfcsv.T.to_json('gruppen-zeitslots.json')
StarcoderdataPython
1633864
""" https://sourcemaking.com/design_patterns/builder """ class Car: def __init__(self, name, color): self._name = name self._color = color def __str__(self): return f"{self._name}:{self._color}" class CarBuilder: def __init__(self): self._name = "" self._color = ...
StarcoderdataPython
101006
<reponame>Bugato/Fullstack_Trading_App import sqlite3 import config import alpaca_trade_api as tradeapi from datetime import date,timedelta import yfinance as yf import email_notif from timezone import is_dst current_date = date.today() + timedelta(days=-1) api = tradeapi.REST(config.API_KEY, config.SECRET_K...
StarcoderdataPython
13021
<gh_stars>100-1000 import FWCore.ParameterSet.Config as cms from CondCore.DBCommon.CondDBCommon_cfi import * PoolDBESSourceMistag110118 = cms.ESSource("PoolDBESSource", CondDBCommon, toGet = cms.VPSet( # # working points # cms.PSet( recor...
StarcoderdataPython
4823517
import unittest import six import re from functools import partial from insultgenerator import words, phrases class TestWords(unittest.TestCase): def do_test_get_word(self, callee): adjective = callee() self.assertTrue(isinstance(adjective, six.string_types), "Returned adjective is not a string") self.assertTru...
StarcoderdataPython
3336199
<reponame>cristianrasch/title_grabber<gh_stars>1-10 import csv import os from pathlib import Path import tempfile import unittest from title_grabber.__main__ import TitleGrabber class TitleGrabberTest(unittest.TestCase): def setUp(self): os.environ['TESTING'] = '1' self.out_path = Path('test_outpu...
StarcoderdataPython
4814366
from django.apps import AppConfig class ExerciseConfig(AppConfig): name = 'exercise'
StarcoderdataPython
122734
<reponame>Surya2709/voice-based-mailing-system-for-blinds<gh_stars>1-10 import os import pyttsx3 def speak(text): engine = pyttsx3.init() engine.setProperty('rate', 150) engine.setProperty('volume',1.0) engine.say(text) engine.runAndWait()
StarcoderdataPython
3287059
<filename>virtnet_yaml.py """ PROGRAM_NAME: virtnet_creator FILE_NAME: main.py AUTHOR: <NAME> PROGRAM_DESCRIPTION: This program is a GUI application for users to build or load network topologies that have a SDN controller at their center. The original code tied into a Xen loadout used to clone, startup, and operate...
StarcoderdataPython
4821595
""" Credits: Copyright (c) 2018-2019 <NAME> (GeoVille) Copyright (c) 2017-2022 <NAME>, <NAME>, <NAME>, <NAME> (Sinergise) This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from datetime import datetime import copy import numpy as np from numpy....
StarcoderdataPython
1713456
<gh_stars>0 # Copyright 2015 UniMOOC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
StarcoderdataPython
3262977
<reponame>DillonHammill/autospill #! /usr/bin/env python2 # convert_spillover_to_flowjo.r # # Copyright (c) 2020 VIB (Belgium) & Babraham Institute (United Kingdom) # # Software written by <NAME>, as research funded by the European Union. # # This software may be modified and distributed under the terms of the MIT # l...
StarcoderdataPython
3392916
from database import CursorFromConnectionFromPool class User: def __init__(self, email, first_name, last_name, oauth_token, oauth_token_secret, id): self.email = email self.first_name = first_name self.last_name = last_name self.oauth_token = oauth_token self.oauth_token_se...
StarcoderdataPython
154748
<gh_stars>0 _MARK_TYPE_NAME = "HAS_STATE_METHODS" import classier.decorators.has_state_decorator.has_state as has_state
StarcoderdataPython
3259104
from utils import * import pickle import time from tqdm import tqdm import argparse import numpy as np import pickle import tensorflow as tf from tensorflow.contrib import learn from tflearn.data_utils import to_categorical, pad_sequences from loguru import logger class URLNet: def __init__(self, data_dir:...
StarcoderdataPython
1708692
import os import sys import numpy as np from .config import config class Model: def __init__(self, n_feature, n_tag): self.n_tag = n_tag self.n_feature = n_feature self.n_transition_feature = n_tag * (n_feature + n_tag) if config.random: self.w = np.random.random(size...
StarcoderdataPython
3310497
import heapq class Solution(object): def nthSuperUglyNumber(self, n, primes): """ :type n: int :type primes: List[int] :rtype: int """ dp = [0] * (n + 1) dp[1] = 1 heap = [] indexes = [1] * len(primes) for i in xrange(0, len...
StarcoderdataPython
3276808
<reponame>Matheus-Pontes/Curso-Python-3<filename>aula_6/ex04.py # Dissecando uma variavel x = input("Digite algo: ") #Devolve em [true] or [false] print("O tipo primitivo é", type(x)) #tipo da variavel print("Só tem espaço?", x.isspace()) #Se tem só espaço print("É um número?", x.isnumeric()) #Se é um número print("...
StarcoderdataPython
195242
<filename>gs_quant/test/api/test_risk_models.py<gh_stars>1-10 """ Copyright 2018 <NAME>. 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...
StarcoderdataPython
3351907
<reponame>roberto-arista/cam-simulator #!/usr/bin/env python3 # ------------- # # CAM Simulator # # ------------- # # -- Modules -- # from math import radians from vanilla import FloatingWindow, TextBox, EditText, Button, HorizontalLine, CheckBox from mojo.roboFont import OpenWindow from mojo.subscriber import Wind...
StarcoderdataPython
1712632
<filename>gitlog2changelog.py<gh_stars>1-10 """gitlog2changelog.py Usage: gitlog2changelog.py (-h | --help) gitlog2changelog.py --version gitlog2changelog.py --beginning=<tag> --repo=<repo> Options: -h --help Show this screen. --version Show version. --beginning=<tag> Where in the History to begin...
StarcoderdataPython
1779121
# # Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. # # # Sandesh Connection # import gevent import os from transport import TTransport from protocol import TXMLProtocol from sandesh_session import SandeshSession, SandeshReader from sandesh_state_machine import SandeshStateMachine, Event from sandesh_u...
StarcoderdataPython
1774064
<gh_stars>0 #!/usr/bin/env python from django.contrib.auth.forms import AuthenticationForm, UserCreationForm from django.forms import widgets from django.conf import settings from django.contrib.auth import get_user_model from django.core.exceptions import ValidationError class LoginForm(AuthenticationForm): def...
StarcoderdataPython
57953
<filename>clinja/__init__.py<gh_stars>0 from .clinja import ClinjaDynamic, ClinjaStatic __version__ = "1.1.0" __author__ = "<NAME> <<EMAIL>>"
StarcoderdataPython
3305048
<filename>api/applications/migrations/0038_goodonapplication_end_use_control.py<gh_stars>1-10 # Generated by Django 2.2.16 on 2020-10-23 16:52 import django.contrib.postgres.fields from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("applications", "0037_aut...
StarcoderdataPython
3263131
from contextlib import contextmanager from copy import deepcopy import numpy as np from numpy import linalg as npl from meshpy import tet from scipy.spatial import cKDTree from mesh_sphere_packing import logger, TOL @contextmanager def redirect_tetgen_output(fname='./tet.log'): """Context manager to redirect st...
StarcoderdataPython
3222614
<filename>core/migrations/0047_backfill_country_slugs.py<gh_stars>1-10 # Generated by Django 2.2.14 on 2021-01-11 12:16 from django.db import migrations from django.utils.text import slugify def forwards(apps, schema_editor): Country = apps.get_model('core', 'Country') for country in Country.objects.all(): ...
StarcoderdataPython
1794010
array[5] Boolean c = True Int a = 2 Int b = 3 Potencia(){ for(Int i = 0; 5>i; Int i = i + 1 ){ read(a) array[i] = a } for(Int i = 4; i>=0; Int i = i - 1){ Int a = array[i] write a Int b = 2*a } } run()
StarcoderdataPython
114621
<reponame>dimitra-maoutsa/DeterministicParticleFlowControl # -*- coding: utf-8 -*- """ Created on Wed Jan 19 01:52:59 2022 @author: maout """ from typing import Union import numpy as np import torch __all__ = ['RBF'] class RBF: """ RBF kernel class for pytorch implementation. """ ...
StarcoderdataPython
3284395
import re from colors import print_color, format_string def set_connection(): ip = '' port = 0 while True: input_server = input(f'\nSERVER IP [press enter to use default]: ') if input_server == 'localhost': ip = input_server break elif input_server != '': ...
StarcoderdataPython
3237380
"""Digital Port ================= Instances of :mod:`~pymoa.device.port` that represent Digital devices. """ import random import trio import time from typing import Optional, Iterable, Dict from pymoa.device.port import Channel, Port __all__ = ( 'DigitalChannel', 'DigitalPort', 'RandomDigitalChannel', 'Ran...
StarcoderdataPython
188556
import cv2 import numpy as np import pyrealsense2 as rs class DepthFiltering(): def __init__(self, temporal_smoothing=5): self.temporal_smoothing = temporal_smoothing self.dec_filter = rs.decimation_filter() # Decimation - reduces depth frame density self.spat_filter = rs.spatial_filter()...
StarcoderdataPython
3379995
# -*- coding: utf-8 -*- ''' Created on 31.10.2014 @author: <NAME> ''' import xml.etree.ElementTree as ET import requests from ordered_set import OrderedSet from utilities import utils from utilities.configloader import ConfigLoader from utilities.retry import retry from vocabularybase import VocabularyBase class ...
StarcoderdataPython
64059
# https://oj.leetcode.com/problems/interleaving-string/ # DP Time O(n*m); Space O(n*m) class Solution: # @return a boolean def isInterleave(self, s1, s2, s3): n, m = len(s1), len(s2) if n + m != len(s3): return False # don't use [[False] * (m+1)] * (n+1) table = [[False] * (m+1) for i in xra...
StarcoderdataPython
44686
1. SHUFFLE AN ARRAY: class Solution: def __init__(self, nums): self.array = nums self.original = list(nums) def reset(self): self.array = self.original self.original = list(self.original) return self.array def shuffle(self): aux = list(s...
StarcoderdataPython
111770
<filename>src/main.py """ FableMe.com A LittleLite Web Application (c) 2013-15 main.py """ import logging import webapp2 import fableme.pages import fableme.services import fableme.printer config = {'webapp2_extras.sessions': { 'secret_key': 'bludream', }} logging.getLogger().setLevel(logging.DEBUG) APP...
StarcoderdataPython
3245495
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-06-29 06:04 from __future__ import unicode_literals import datetime from django.db import migrations, models from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('iiits', '0043_auto_20160624_1728'), ]...
StarcoderdataPython
126543
"""Módulo donde se guardan todas las clases para el juego""" from .game import Game
StarcoderdataPython
1602740
import numpy as np import xml.etree.ElementTree as ET import chainer from chainercv.utils import read_image from os import listdir from os.path import isfile, join from chainercv.datasets import voc_bbox_label_names LABEL_NAMES = ('other', 'berlinerdom', 'brandenburgertor', ...
StarcoderdataPython
122088
#!/usr/bin/env python3 # # pyIBGE: A module to access data from the Brazilian Institute of Geography and Statistics (IBGE) # (c) 2016 <NAME> [<EMAIL>] from .extra_routines import state_to_id, period_to_date from .query import IBGEQuery
StarcoderdataPython
113154
import torch import torch.nn as nn class RNN(nn.Module): def __init__(self, rnn_layer, vocab_size): super(RNN, self).__init__() self.rnn = rnn_layer self.hidden_size = rnn_layer.hidden_size * (2 if rnn_layer.bidirectional else 1) self.vocab_size = vocab_size self.dense = nn....
StarcoderdataPython
4807342
<filename>Machine_Learning/HW1/hw1_2.py<gh_stars>1-10 import numpy as np import matplotlib.pyplot as plt def distance2(p1,p2): return np.sum((p1-p2)**2) def min_distance(p,l): min_dist = distance2(p,l[0]) index = 0 for i in range(1,len(l)): distance = distance2(p,l[i]) if (distance < ...
StarcoderdataPython
3270783
import os import logging from flask import Flask from flask_restful import Api from jaeger_client import Config from flask_opentracing import FlaskTracer from tracingexample.tracer_helper2 import TracerHelper2 logging.getLogger('').handlers = [] logging.basicConfig(format='%(message)s', level=logging.DEBUG) flask_app...
StarcoderdataPython