id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1788416
__author__ = '<EMAIL>' from threading import Thread, Event, current_thread import threading class SyncThread(Thread): def __init__(self, target): super(SyncThread, self).__init__(target=target, name='SyncThread') self._stop_event = Event() def stop(self): self._stop_event.set() ...
StarcoderdataPython
116019
<reponame>apple/ml-cvnets<gh_stars>100-1000 # # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # from typing import Any import numpy as np def setup_size(size: Any, error_msg="Need a tuple of length 2"): if isinstance(size, int): return size, size i...
StarcoderdataPython
26604
<gh_stars>1-10 try: from zipfile import ZipFile from pyspark import SparkContext, SparkConf from pyspark.sql import SparkSession import pyspark.sql.functions as f import os except Exception as e: print(e) ## http://www.hongyusu.com/imt/technology/spark-via-python-basic-setup-count-lines-and-wor...
StarcoderdataPython
61786
<reponame>OliverLPH/PaddleClas # Copyright (c) 2020 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...
StarcoderdataPython
3242632
import pandas as pd import numpy as np import requests import json ''' Author: <NAME> Purpose: This program will geocode address in downtown detroit to specific x,y coordinates Input: an excel table with address column(s) ADDITIONAL FIELDS: 1. x,y: longitude and latitude OF the GEOCODing result(came from Google API) ...
StarcoderdataPython
130898
<reponame>maruel/swarming #!/usr/bin/env vpython # Copyright 2019 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. import subprocess import sys def run_tests(test_cmds, python3=False): """Run tests sequential...
StarcoderdataPython
3397414
<gh_stars>10-100 #!/usr/bin/env python3 import os os.environ['TF_CPP_MIN_LOG_LEVEL']='2' import numpy as np np.set_printoptions(threshold=np.nan) import tensorflow as tf import time # seeding for debug purposes --- dont forget to remove SEED = 12345 np.random.seed(SEED) tf.set_random_seed(SEED) def convolve_inner_lay...
StarcoderdataPython
1698693
<gh_stars>0 # Lint as: python3 # Copyright 2019 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
StarcoderdataPython
12280
#! /usr/bin/env python """Toolbox for unbalanced dataset in machine learning.""" from setuptools import setup, find_packages import os import sys import setuptools from distutils.command.build_py import build_py if sys.version_info[0] < 3: import __builtin__ as builtins else: import builtins descr = """Tool...
StarcoderdataPython
181091
<filename>src/icupy/number.py<gh_stars>0 """ Module for icu::number namespace """ from .icu.number import * # noqa
StarcoderdataPython
1709295
#ToDo : Write tests for application interface import pytest import os from PyQt4.QtGui import * from PyQt4.QtCore import * from mp3wav.application import Mp3WavApp from mp3wav.exceptions.fileexception import FileTypeException from mp3wav.exceptions.libraryexception import LibraryException from mp3wav.exceptions.filenot...
StarcoderdataPython
3298780
'''Implements the required methods for instruction counting using ARM assembly. ''' from typing import List from asm_analyser import counter from asm_analyser.blocks.code_block import CodeBlock from asm_analyser.blocks.basic_block import BasicBlock class ArmCounter(counter.Counter): '''Implements the Counter clas...
StarcoderdataPython
1722251
<filename>belter/tests/test_entities.py<gh_stars>0 from py2d.Math import Polygon from colortuple import Color from ..entities import create_asteroid, create_ship def test_ship(): actual = create_ship(1, 2) assert actual.x == 1 assert actual.y == 2 assert isinstance(actual.color, Color) assert isin...
StarcoderdataPython
1748366
<filename>MLlib/models.py<gh_stars>0 from optimizers import GradientDescent from utils.misc_utils import generate_weights from utils.decision_tree_utils import partition, find_best_split from utils.decision_tree_utils import Leaf, Decision_Node from utils .knn_utils import get_neighbours from utils.naive_bayes_utils im...
StarcoderdataPython
1729326
<gh_stars>0 import unittest from user import User,Credentials class TestUser(unittest.TestCase): """ Test class that defines test cases for the user class behaviours """ """ Args: unittest.TestCase: TestCase class that helps in creating test cases """ def setUp(self): """ ...
StarcoderdataPython
3321473
import math import numpy as np import pybullet as p def getCameraParametersPush(): params = {} params['imgW'] = 400 params['imgH'] = 400 params['imgW_orig'] = 1024 params['imgH_orig'] = 768 # p.resetDebugVisualizerCamera(0.70, 180, -89, [0.60, 0.0, 0.0]) # 70cm away params['viewMatPanda'] = [-1.0, 0.0, 0.0,...
StarcoderdataPython
1651266
l =[1, 1, 2, 2, 3, 3, 4, 'abc', "abc"] no_duplicate_set = set(l) #print(no_duplicate_set) no_duplicate_list = list(no_duplicate_set) print(no_duplicate_list) #s = {'berry','blueberry'} #s.add('blackberry') #s.add(4) #s.add('berry') #print(s)
StarcoderdataPython
1780796
<gh_stars>0 '''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p, arrays # Code generation uses this from OpenGL.raw.GL import _types as _cs # End users want this... from OpenGL.raw.GL._types import * from OpenGL.raw.GL import _errors from OpenGL.constant import Constant as ...
StarcoderdataPython
3244550
import tensorflow as tf import tensorflow_hub as hub module_url = "https://tfhub.dev/google/universal-sentence-encoder/4" tf.compat.v1.disable_eager_execution() model = hub.Module(module_url) embeddings = model([ "i like green eggs and ham", "would you eat them in a box" ]) with tf.compat.v1.Session() as sess...
StarcoderdataPython
1608445
<reponame>kimjaed/simpeg<filename>tests/base/test_utils.py from __future__ import print_function import unittest import numpy as np import scipy.sparse as sp import os import shutil from SimPEG.Utils import ( sdiag, sub2ind, ndgrid, mkvc, inv2X2BlockDiagonal, inv3X3BlockDiagonal, invPropertyTensor, makeProperty...
StarcoderdataPython
3327121
""" Script base for orlov astarte package. """ import logging import pytest # pylint: disable=E0401 from astarte.script.testcase import Astarte logger = logging.getLogger(__name__) @pytest.mark.usefixtures('conftests_fixture', 'orlov_fixture', 'astarte_fixture') # pylint: disable=E1101, C0302, R0914 class TestArena...
StarcoderdataPython
4833996
<reponame>elliotpeele/pyramid_oauth2_provider # # Copyright (c) <NAME> <<EMAIL>> # # This program is distributed under the terms of the MIT License as found # in a file called LICENSE. If it is not present, the license # is always available at http://www.opensource.org/licenses/mit-license.php. # # This program is dist...
StarcoderdataPython
3226484
<gh_stars>0 import streamlit as st from PIL import Image def app(): st.title("Vegetation Analysis") st.markdown( """ The goal of this task is to discover the use of different vegetation indices to identify the level of desertification in northern Iraq. Indices of interest include NDVI...
StarcoderdataPython
3260916
<reponame>jacobhjkim/amundsendatabuilder # Copyright Contributors to the Amundsen project. # SPDX-License-Identifier: Apache-2.0 import re from typing import List, Optional from databuilder.models.graph_node import GraphNode from databuilder.models.graph_relationship import GraphRelationship from databuilder.models.g...
StarcoderdataPython
3357044
# Generated by Django 3.1.7 on 2021-04-26 08:31 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('order', '0005_remove_order_customer'), ('customer', '0006_customerprofile_gender'), ] operations = [ ...
StarcoderdataPython
1675054
"""Module for Game class""" import time from hangman.dictionary import Dictionary from hangman.cli.screen import Screen from hangman.word import Word from hangman.error import GuessError class Game: """ The primary object responsible for managing game details and flow. """ def __init__(self): ...
StarcoderdataPython
3256723
from OpenPNM.Utilities import misc import scipy as _sp import numpy as _np import os as _os import pickle as _pickle from xml.etree import ElementTree as _ET class VTK(): r""" Class for writing a Vtp file to be read by ParaView """ _TEMPLATE = ''' <?xml version="1.0" ?> <VTKFile byte_order="...
StarcoderdataPython
3370791
CSRF_ENABLED = True #Enables Cross-site Request Forgery. SECRET_KEY is needed when CSRF is enabled, and creates a cryptographic token used to validate a form. SECRET_KEY = 'you-will-never-guess' import os basedir = os.path.abspath(os.path.dirname(__file__)) SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL'] # fo...
StarcoderdataPython
1696555
<filename>test/lmp/util/model/test_load.py<gh_stars>1-10 r"""Test loading utilities for all language models. Test target: - :py:meth:`lmp.util.model.load`. """ import torch import lmp.util.model from lmp.model import GRUModel, LSTMModel, RNNModel from lmp.tknzr import BaseTknzr def test_load_rnn(exp_name: str, tkn...
StarcoderdataPython
1613633
<filename>examples/baseball.py # Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 """ Example: Baseball Batting Average ================================= Original example from Pyro: https://github.com/pyro-ppl/pyro/blob/dev/examples/baseball.py Example has been adapted from [1]. It d...
StarcoderdataPython
3297182
<filename>src/orders/forms.py from django import forms from django.contrib.auth import get_user_model # allows us to use User obj from .models import UserAddress User = get_user_model() class GuestCheckoutForm(forms.Form): email = forms.EmailField() email2 = forms.EmailField(label='Confirm email') de...
StarcoderdataPython
1635972
<filename>EmailTemplate/apps.py from django.apps import AppConfig class EmailtemplateConfig(AppConfig): name = 'EmailTemplate'
StarcoderdataPython
3334024
from telegram import InlineKeyboardMarkup, InlineKeyboardButton from constants import PRICES keyboard = [ [InlineKeyboardButton( text='Спасибо, я пока тут осмотрюсь...', # url='https://card.tochka.com/cjgbrgtye-individualnaia_konsultatsiia', callback_data='Не покупаем подпи...
StarcoderdataPython
1777032
<gh_stars>1-10 #!/usr/bin/env python3 import random import unittest import numpy as np from ml.rl.test.gridworld.gridworld_base import DISCOUNT from ml.rl.test.gridworld.gridworld_continuous import GridworldContinuous from ml.rl.test.gridworld.gridworld_continuous_enum import GridworldContinuousEnum from ml.rl.test.g...
StarcoderdataPython
95628
from socket import * from msgstruct import * #from fcntl import ioctl #from termios import TIOCOUTQ from zlib import compressobj, Z_SYNC_FLUSH import struct ZeroBuffer = struct.pack("i", 0) class SocketMarshaller: def __init__(self, tcpsock, mixer): self.tcpsock = tcpsock self.mixer = mixe...
StarcoderdataPython
3217081
from jax import numpy as np from jax import random from mcx.distributions import constraints from mcx.distributions.distribution import Distribution from mcx.distributions.shapes import broadcast_batch_shape class DiscreteUniform(Distribution): """Random variable with a uniform distribution on a range of integer...
StarcoderdataPython
22843
from os import listdir from os.path import join, isfile import json from random import randint ######################################### ## START of part that students may change from code_completion_baseline import Code_Completion_Baseline training_dir = "./../../programs_800/" query_dir = "./../../programs_200/" m...
StarcoderdataPython
129417
<gh_stars>1-10 # Copyright (c) 2018, The Regents of the University of California # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright ...
StarcoderdataPython
1617801
<gh_stars>0 import unittest from sensor_validate import validate_param_reading from sensorActions import set_sensor_status class SensorValidatorTest(unittest.TestCase): def test_reports_error_when_soc_jumps(self): soc_jump_threshold = 0.05 self.assertFalse( validate_param_reading([0.0, 0.0...
StarcoderdataPython
37693
<filename>scripts/collapse_subtypes.py<gh_stars>10-100 import sys from collections import Counter ## 5 |strains A1:23146 C:377 B1:546 unclassified:211701 A3:133 A2:212 A4:2230 B2:1052 D2:551 D3:3685 D1:30293 |sketch sketchSize=1000 kmer=16 if __name__ == "__main__": for line in sys.stdin: x_d = Counter() ...
StarcoderdataPython
1710422
<reponame>fadhifatah/Fataservice<filename>Fataservice/settings.py """ Django settings for Fataservice project. Generated by 'django-admin startproject' using Django 2.0.2. For more information on this file, see https://docs.djangoproject.com/en/2.0/topics/settings/ For the full list of settings and their values, see...
StarcoderdataPython
3290858
import logging import sys from utils.hustlers_den_exceptions import HustlersDenValidationError logger = logging.getLogger(__name__) class BaseService: def __init__(self): """ Superclass Base Service for Hustlers Den services """ logger.debug( "Func %s begins with dat...
StarcoderdataPython
1730063
# -*- coding: utf-8 -*- ''' Grains for Onyx OS Switches Proxy minions .. versionadded: Neon For documentation on setting up the onyx proxy minion look in the documentation for :mod:`salt.proxy.onyx<salt.proxy.onyx>`. ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals # ...
StarcoderdataPython
48081
<gh_stars>1-10 import numpy as np from rdkit.Chem import AllChem, DataStructs from rdkit import Chem import csv def load_csv(file): # load data expression = [] with open(file, "r") as csv_file: reader = csv.reader(csv_file, dialect='excel') for row in reader: expression.append(r...
StarcoderdataPython
82429
<filename>handlers/basic_commands.py """ The part that has basic commands like start, help, cancel, etc. """ import logging from os import listdir, mkdir from aiogram import types from aiogram.dispatcher import FSMContext from aiogram.dispatcher.filters import Text from loader import dp, input_path, output_path from ...
StarcoderdataPython
3377054
<reponame>USC-CSCI527-Fall2021/autonomous_car_navigation import numpy as np import tensorflow as tf from tensorflow import keras from queue import deque import gym import gym_carla import carla import argparse import tensorflow as tf params = { 'number_of_vehicles': 25, 'number_of_walkers': 20, 'display_size': 250...
StarcoderdataPython
4842436
""" KGX Source for Simple Standard for Sharing Ontology Mappings ("SSSOM") """ import gzip import re import pandas as pd from typing import Optional, Generator, Any, Dict, Tuple import yaml from kgx.prefix_manager import PrefixManager from kgx.config import get_logger from kgx.source import Source from kgx.utils.kgx...
StarcoderdataPython
1727967
#A web scraper to do job searches for Health Leads clients #This code was adapted from https://github.com/Futvin/Web-Scraper-in-Python-with-BeautifulSoup/blob/master/runSimpleScrap.py import re import urllib.request from bs4 import BeautifulSoup from docx import Document from docx.shared import Pt document = Docume...
StarcoderdataPython
3316529
<reponame>TylerDodds/DiceFinding<gh_stars>0 # Copyright 2021 Dice Finding 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/...
StarcoderdataPython
3289235
__version__ = "1.1.0b5"
StarcoderdataPython
50219
from darr.basedatadir import BaseDataDir, create_basedatadir from darr.metadata import MetaData from ._version import get_versions #TODO: required keys for sndinfo class DataDir(BaseDataDir): _classid = 'DataDir' _classdescr = 'object for IO for disk-persistent sounds' _version = get_versions()['version'...
StarcoderdataPython
3238985
<filename>test/integration/ggrc/models/test_clonable.py # Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Integration test for Clonable mixin""" from ggrc import db from ggrc import models from ggrc.snapshotter.rules import Types from integration.ggrc ...
StarcoderdataPython
3266215
from importlib import import_module from unittest import TestCase class TestMigration0137(TestCase): @classmethod def setUpClass(cls): super(TestMigration0137, cls).setUpClass() cls.migration = import_module( 'v1.migrations.0137_migrate_imagetextgroups_to_infounitgroup' ) ...
StarcoderdataPython
1618341
<reponame>cunningham-lab/monotonic-flds<filename>ssm_spline/ssm/models.py from ssm.core import _HMM, _LDS, _SwitchingLDS from ssm.init_state_distns import InitialStateDistribution from ssm.transitions import \ StationaryTransitions, \ StickyTransitions, \ InputDrivenTransitions, \ RecurrentTransitions...
StarcoderdataPython
3373743
<filename>msgs/apps.py from django.apps import AppConfig class MsgsConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'msgs'
StarcoderdataPython
3313052
<filename>mafs/cactus_MAFGeneratorTest.py #!/usr/bin/env python #Copyright (C) 2009-2011 by <NAME> (<EMAIL>) # #Released under the MIT license, see LICENSE.txt import unittest import sys from cactus.shared.test import parseCactusSuiteTestOptions from sonLib.bioio import TestStatus from cactus.shared.test import getC...
StarcoderdataPython
3233602
<reponame>fossabot/drive-sdk-python<gh_stars>0 from __future__ import absolute_import # flake8: noqa # import apis into api package from lusid_drive.api.application_metadata_api import ApplicationMetadataApi
StarcoderdataPython
91318
import pyblish.api import openpype.api from openpype.pipeline import PublishXmlValidationError class ValidateTextureBatchWorkfiles(pyblish.api.InstancePlugin): """Validates that textures workfile has collected resources (optional). Collected resources means secondary workfiles (in most cases). """ ...
StarcoderdataPython
1677032
import crypto_tools import json def elliptic_little_doc(): return "encrypt/decrypt using elliptic algo" def elliptic_full_doc(): return """ It's quite hard but I tried to write self documented so just try to read it and google some additional stuff """ def elliptic_encrypt(data, open_key, r_nu...
StarcoderdataPython
23761
""" First class definition""" class Cat: pass class RaceCar: pass cat1 = Cat() cat2 = Cat() cat3 = Cat()
StarcoderdataPython
1792763
<reponame>Pankti910/laari<filename>laari_wala/test_graph.py #%% #SHOWS TOKEN WITH ITS X AND Y VALUES import json import numpy import json import nltk from nltk.tokenize import word_tokenize from nltk.corpus import stopwords from matplotlib import pyplot as plt common_ts=["The","These","Their","Thought","Though","...
StarcoderdataPython
3249381
<gh_stars>1-10 import os from uuid import uuid4 from datetime import datetime from cassandra.cqlengine.models import Model from cassandra.cqlengine import columns class result(Model): __keyspace__ = os.getenv("CASSANDRA_KEY_SPACE") __table_name__ = "result" id = columns.UUID(primary_key=True, default=uui...
StarcoderdataPython
69610
<reponame>lifning/picotool """The map section of a PICO-8 cart. The map region consists of 4096 bytes. The .p8 representation is 32 lines of 256 hexadecimal digits (128 bytes). The map is 128 tiles wide by 64 tiles high. Each tile is one of the 256 tiles from the spritesheet. Map memory describes the top 32 rows (128...
StarcoderdataPython
1692110
<reponame>EdgarCastillo101/Python # what's a list? lol import copy ages = [20, 25, 20] # this is a list names = ["Edgar, <NAME>"] # this is also a list food = ['chicken', 'pollo', 1738] # did you know that this is also a list print(ages) print(names) print(food) # indexing (again) print(ages[0]) # grabs the first ele...
StarcoderdataPython
3304025
# -*- coding: utf-8 -*- """Support to extract sentences from a text. This module provides functions to extract sentences from a text. Any string of characters that ends with a terminating punctuation mark such as a period, exclamation or question mark followed by a whitespace character is considered to be a sentence, ...
StarcoderdataPython
88222
<reponame>Shukla-G/cray-cogs import datetime import logging import time from collections import Counter from functools import reduce from typing import Dict, Optional import discord from discord.ext import tasks from redbot.core import Config, commands from redbot.core.bot import Red from redbot.core.utils.chat_format...
StarcoderdataPython
1798819
import sys import argparse from typing import List, Optional from .lib import FileHelper from .lib import TerminalStyle from .converter.ConverterInterface import ConverterInterface from .model.IntermediateLocalization import IntermediateLocalization from .model.LocalizationFile import LocalizationFile #------------...
StarcoderdataPython
3368749
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RAnaquin(RPackage): """The project is intended to support the use of sequins (syntheti...
StarcoderdataPython
1749586
<reponame>ricklentz/2dimageto3dmodel """ https://www.haroldserrano.com/blog/quaternions-in-computer-graphics#:~:text=Quaternions%20are%20mainly%20used%20in,sequentially%20as%20matrix%20rotation%20allows.&text=Matrix%20rotations%20suffer%20from%20what%20is%20known%20as%20Gimbal%20Lock. author: <NAME> """ import torch ...
StarcoderdataPython
4801258
from django.utils.translation import ugettext_lazy as _ from django.db import models as ext class Currency(ext.Model): id = ext.IntegerField(_("id"), primary_key=True) iso_code = ext.CharField(_("iso code"), max_length=10, null=True, blank=True) iso_name = ext.CharField(_("iso name"), max_length=10, null=...
StarcoderdataPython
99896
<filename>python/lookout/sdk/service_analyzer_pb2.py<gh_stars>1-10 # Generated by the protocol buffer compiler. DO NOT EDIT! # source: lookout/sdk/service_analyzer.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from goo...
StarcoderdataPython
15571
#!/usr/bin/env python # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
StarcoderdataPython
147843
<filename>rdmo/options/serializers/export.py<gh_stars>0 from rest_framework import serializers from ..models import OptionSet, Option class OptionSerializer(serializers.ModelSerializer): optionset = serializers.CharField(source='optionset.uri', default=None, read_only=True) class Meta: model = Opti...
StarcoderdataPython
1686001
<filename>meme/api_1_0/resources/tasks.py from datetime import datetime from flask_restful import Resource, reqparse from flask import jsonify from meme import db, ma from meme.models import Task, Engineer class TaskSchema(ma.ModelSchema): """Marshmallow "serialization schema for Task db Table""" class Meta: ...
StarcoderdataPython
75501
import pytest from app.api.services import abr_service from app.api.business.errors import AbrError import requests import mock from mock import patch class TestAbrService(): def mocked_find_business_by_abn(self): data = '<ABR><response><stateCode>NSW</stateCode><postcode>2750</postcode>'\ '<...
StarcoderdataPython
3206518
<reponame>shbatm/regenmaschine """Define an object to interact with programs.""" from typing import Any, Awaitable, Callable, Dict, List, cast class Program: """Define a program object.""" def __init__(self, request: Callable[..., Awaitable[Dict[str, Any]]]) -> None: """Initialize.""" self._r...
StarcoderdataPython
1747265
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
StarcoderdataPython
1777716
<gh_stars>100-1000 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See LICENSE in the project root # for license information. import sys import time import pydevd from _pydevd_bundle.pydevd_comm import get_global_debugger from ptvsd.pydevd_hooks import install from ptvsd...
StarcoderdataPython
1709016
<reponame>stefano-bragaglia/DePYsible from unittest import TestCase from assertpy import assert_that from depysible.domain.definitions import Program from depysible.domain.definitions import Rule from depysible.domain.interpretation import Derivation from depysible.domain.interpretation import Interpreter class Tes...
StarcoderdataPython
101687
# This function tells a user whether or not a number is prime def isPrime(number): # this will tell us if the number is prime, set to True automatically # We will set to False if the number is divisible by any number less than it number_is_prime = True # loop over all numbers less than the input numb...
StarcoderdataPython
136163
""" The COCO dataset or other datasets for the YOLOv5 model with using NNRT. """ import logging import os import math from plato.config import Config from plato.datasources import base from nnrt_datasource_yolo_utils import LoadImagesAndLabels def make_divisible(x, divisor): # Returns x evenly divisible by divis...
StarcoderdataPython
87987
<gh_stars>0 """ Add FrameNet lexicon data to a data release folder python add_lexicon_data.py --path_config_json=<path_config_json> --verbose=<verbose> Usage: add_lexicon_data.py --path_config_json=<path_config_json> --verbose=<verbose> Options: --path_config_json=<path_config_json> e.g., ../config/v0.json ...
StarcoderdataPython
3201103
<gh_stars>0 # Literally just shader strings so that the main file isn't so cluttered vertexCode = """#version 330 core layout(location = 0) in vec3 aPos; layout(location = 1) in float aBrightness; layout(location = 2) in vec2 aTexCoords; // Uniforms uniform mat4 modelMatrix; uniform mat4 projectionMatrix; uniform mat...
StarcoderdataPython
1714124
import setuptools with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.setup( name="wagglepy", version="0.0.1", author="<NAME>", author_email="<EMAIL>", description="The wagglepy package consists of a collection of template notebooks and some u...
StarcoderdataPython
95466
<reponame>corner4world/cubeai<filename>uaa-python/app/database/github_user_db.py<gh_stars>0 from app.global_data.global_data import g from app.domain.github_user import GithubUser def create_github_user(github_user): sql = ''' INSERT INTO github_user ( github_login, user_lo...
StarcoderdataPython
3282961
# Generated by Django 2.1.7 on 2020-02-08 03:18 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('scanner', '0017_address_locblock'), ] operations = [ migrations.AddField( model_name='event', ...
StarcoderdataPython
3214540
<filename>calculadora.py #calculadora valorParaOperar1 = float(input("Introduzca el primer valor: ")) operador = int(input("Qué operación quieres realizar?\n 0 - SUMAR\n1 - RESTAR\n2 - MULTIPLICAR\n3 - DIVIDIR: \n")) while (operador!=0 and operador!=1 and operador!=2 and operador!=3): operador = int(input("Valor ...
StarcoderdataPython
3304062
<reponame>pi4alina/rollingpin import datetime import logging import os import time class LogFormatter(logging.Formatter): converter = time.gmtime def format(self, record): formatted = logging.Formatter.format(self, record).decode("utf8") if hasattr(record, "host"): formatted = ("...
StarcoderdataPython
3219518
<reponame>ahojukka5/scikit-fem """Restricting a problem to a subdomain. .. note:: This example requires the external package `pygmsh <https://pypi.org/project/pygmsh/>`_. The `ex17.py` example solved the steady-state heat equation with uniform volumetric heating in a central wire surrounded by an annular insulatin...
StarcoderdataPython
168936
<reponame>mrlooi/maskrcnn-benchmark from torch import nn from torch.nn import functional as F from maskrcnn_benchmark.layers import Conv2d from maskrcnn_benchmark.layers import ConvTranspose2d # from maskrcnn_benchmark.modeling import registry # @registry.ROI_MASK_PREDICTOR.register("MaskRCNNC4Classifier") class Mas...
StarcoderdataPython
3222977
<filename>upsdata/config.py options = { 'unavailable_msg': "Delivery date unavailable, use tracking link for current information" }
StarcoderdataPython
1627463
from .tool.func import * def give_admin_2(conn, name): curs = conn.cursor() owner = admin_check() curs.execute("select acl from user where id = ?", [name]) user = curs.fetchall() if not user: return re_error('/error/2') else: if owner != 1: curs.execute('select...
StarcoderdataPython
57718
import uuid from django.conf import settings from django.db import models from django.utils import timezone class AbstractBase(models.Model): id = models.UUIDField( primary_key=True, default=uuid.uuid4, editable=False ) created_at = models.DateTimeField(default=timezone.now) u...
StarcoderdataPython
1640163
from .main import main __all__ = ["main"] __version__ = '0.1.0'
StarcoderdataPython
3323332
import pandas as pd import numpy as np from sklearn import linear_model import matplotlib.pyplot as plt df = pd.read_csv('homeprices.csv') x = df[['area']] y = df[['price']] # Training our model reg = linear_model.LinearRegression() reg.fit(x, y) print(f'reg score: {reg.score(x,y)}') print(f'predict for 3300 area:...
StarcoderdataPython
1755364
from .normalize import Normalize from .posterize import Posterize from .img_calculator import ImageCalculator
StarcoderdataPython
3386611
<reponame>tobias-fyi/vela<gh_stars>0 """ Blockchain :: Sprint challenge """ import hashlib import random from timeit import default_timer as timer from uuid import uuid4 import sys import requests def proof_of_work(last_proof): """Multi-Ouroboros Proof of Work Algorithm. - Find a number p' such that the las...
StarcoderdataPython
1620209
<filename>third_party/buildbot_8_4p1/buildbot/process/properties.py # This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the ...
StarcoderdataPython
99792
# Copyright 2014 Open Connectome Project (http://openconnecto.me) # # 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 app...
StarcoderdataPython
3363575
# -*- coding:UTF-8 -*- import requests import openpyxl import cookies import random import time import os from bs4 import BeautifulSoup from openpyxl import workbook class Spider(): def __init__(self): print("[INFO]: Maoyan Spider...") print("[Author]: mwteck") self.url = "http://maoyan.c...
StarcoderdataPython