id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3345520
# Copyright (c) Microsoft Corporation # Licensed under the MIT License. from common_utils import ( create_iris_data, create_models_classification, create_adult_census_data, create_kneighbors_classifier) from erroranalysis._internal.error_analyzer import ModelAnalyzer from erroranalysis._internal.surrogate_erro...
StarcoderdataPython
84321
# Create your views here. from fatsecret import Fatsecret from django.http import JsonResponse from django.conf import settings fs = Fatsecret(settings.FATSECRET_ACCESS_KEY, settings.FATSECRET_SECRET_KEY) def foods(request): if request.method == 'GET': search = request.GET["search"] foods_detail =...
StarcoderdataPython
167057
# <NAME> # ADS UNIFIP # Exercicios Com Strings # https://wiki.python.org.br/ExerciciosComStrings ''' Leet spek generator. Leet é uma forma de se escrever o alfabeto latino usando outros símbolos em lugar das letras, como números por exemplo. A própria palavra leet admite muitas variações, como l33t ou 1337. O uso do l...
StarcoderdataPython
3294888
<filename>augment.py #!/usr/bin/python # -------------------------- IMPORTS -------------------------- # import numpy as np import random as rn import scipy import skimage.util import skimage.transform # -------------------------- CROP -------------------------- # # # image: image to be cropped, scale: scale factor, ...
StarcoderdataPython
112302
# coding:utf-8 # --author-- lanhua.zhou import os import json import logging __all__ = ["get_menu_data", "MENU_KEY", "MENU_FILE"] DIRNAME = os.path.dirname(__file__) MENU_DIRNAME = os.path.dirname(os.path.dirname(DIRNAME)) MENU_FILE = "{}/conf/menu.json".format(MENU_DIRNAME) MENU_KEY = ["utility", "modeling", "shadi...
StarcoderdataPython
31382
<gh_stars>0 import numpy as np from spharpy.samplings.helpers import sph2cart from scipy.spatial import cKDTree class Coordinates(object): """Container class for coordinates in a three-dimensional space, allowing for compact representation and convenient conversion into spherical as well as geospatial coor...
StarcoderdataPython
3391326
from services.refresh_attendees import RefreshAttendees from flask_api import status from flask import jsonify class RefreshController: def index(self): response = RefreshAttendees().refresh.run() if response.is_success: return {'status': 'The attendees were refreshed'} else: ...
StarcoderdataPython
1672723
<reponame>ecumene/Automata import re from nextcord.ext import commands import httpx from Plugin import AutomataPlugin BARAB_API = "https://jackharrhy.dev/barab" CODE_BLOCK_REGEX = "```[a-z]*\n(?P<content>[\s\S]*?)\n```" HEADERS = {"Content-Type": "text/plain"} code_block = re.compile(CODE_BLOCK_REGEX) class Verilo...
StarcoderdataPython
1734899
<reponame>vyahello/search-words-puzzle """A test suite contains a set of test cases for the puzzle tool.""" from pathlib import Path import pytest from puzzle.__main__ import ( _random_words, _validate_puzzle_grid_size, _validate_puzzle_word, _validate_puzzle_words_path, ) pytestmark = pytest.mark.un...
StarcoderdataPython
104961
#TODO also test handling of bad input import unittest import test import mapupload import wikibrowser import os, sys from getpass import getpass #LOG_PATH = "mapupload.log" #log = WikiDustLogger(path=LOG_PATH) class MapUploadTest(unittest.TestCase): def __init__(self, url, username, password, error): uni...
StarcoderdataPython
1726023
<gh_stars>1-10 import argparse import os import time import torch import torch.optim as optim import numpy as np import utils import Models.CNNs import Models.NNs from evaluate import evaluate from Models.data_loaders import fetch_dataloader # Set up command line arguments parser = argparse.ArgumentParser() parser.a...
StarcoderdataPython
1641834
""" Copyright (c) 2016-present, Facebook, Inc. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory. """ from lte.protos.mconfig imp...
StarcoderdataPython
1752692
from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('cmsplugin_cascade', '0001_initial'), ] operations = [ migrations.CreateModel( name='Segmentation', fields=[ ('id', models.AutoField(verbose_name='ID'...
StarcoderdataPython
1781389
""" """ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def setup_capnproto(name): version = "0.9.1" http_archive( name = name, build_file = "@caffeine//third_party/capnp:capnproto.BUILD", sha256 = "daf49f794560f715e2f4651c842aaece2d065d4216834c5c3d3254962e35b535"...
StarcoderdataPython
183002
<reponame>Techme2911/HacktoberFest19-Algo # -*- coding: utf-8 -*- """ Created on Wed Mar 27 09:09:36 2019 @author: Dell """ import math as m m.pow(2,6)#returns 2^6 m.factorial(6)#returns 6! m.floor(23.4)#returns an integer lower than the real number #in this case 23 m.floor(23)#here also 23 ...
StarcoderdataPython
3238918
import unittest from src.main.serialization.codec.codec import Codec from src.main.serialization.codec.primitive.intCodec import IntCodec from src.main.serialization.codec.utils.byteIo import ByteIo from src.main.serialization.codec.utils.bytes import to_byte from src.test.serialization.codec.test_codec import TestCod...
StarcoderdataPython
1676680
<filename>gallery/templatetags/random_numbers.py import random from django import template register = template.Library() @register.simple_tag def random_int(a, b=None): if b is None: a, b = 0, a return random.randint(a, b)
StarcoderdataPython
1691981
from rest_framework.authentication import SessionAuthentication, BasicAuthentication from rest_framework.response import Response from rest_framework.permissions import IsAuthenticated from rest_framework.views import APIView from apprest.serializers.container import CalipsoContainerSerializer from apprest.services.co...
StarcoderdataPython
1776545
<filename>scripts/old_gui.py import sys from pyqtgraph import QtCore, QtGui from cognigraph.pipeline import Pipeline from cognigraph.nodes import sources, processors, outputs from cognigraph import TIME_AXIS from cognigraph.gui.window import GUIWindow app = QtGui.QApplication(sys.argv) pipeline = Pipeline() # file...
StarcoderdataPython
4832506
<reponame>METU-KALFA/furniture<gh_stars>0 from env.furniture import FurnitureEnv import env.transform_utils as T from collections import OrderedDict import gym import numpy as np import mujoco_py import os np.set_printoptions(suppress=True) class AssemblyEnv(FurnitureEnv): name = 'assembly' def __init__...
StarcoderdataPython
164812
import numpy as np import matplotlib import pylab as pl import pandas from ae_measure2 import * from feature_extraction import * import glob import os import pandas as pd from sklearn.decomposition import PCA from sklearn.cluster import KMeans from sklearn.metrics import davies_bouldin_score from sklearn.pr...
StarcoderdataPython
169727
import asyncio import aiohttp import datetime import argparse import random import uvloop async def make_request(session, id, port): try: async with session.get('http://localhost:%s' % port) as resp: if resp.status != 200: print("Server error --%s-- returned for request %d" %...
StarcoderdataPython
134756
from setuptools import find_packages from setuptools import setup setup( name="qontract-reconcile", version="0.3.0", license="Apache License 2.0", author="<NAME>", author_email="<EMAIL>", python_requires=">=3.9", description="Collection of tools to reconcile services with their desired " ...
StarcoderdataPython
1750754
<reponame>jacenkow/inside<filename>inside/pipelines/clevr.py # -*- coding: utf-8 -*- # # Copyright (C) 2020 <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/licen...
StarcoderdataPython
1691327
import testtools from barbicanclient import base class TestValidateRef(testtools.TestCase): def test_valid_ref(self): ref = 'http://localhost/ff2ca003-5ebb-4b61-8a17-3f9c54ef6356' self.assertTrue(base.validate_ref(ref, 'Thing')) def test_invalid_uuid(self): ref = 'http://localhost/n...
StarcoderdataPython
1786214
from django.core.management.base import BaseCommand from django.conf import settings from webdnd.player.views.index import UserIndex from optparse import make_option class Command(BaseCommand): help = 'Creates with the search index' option_list = BaseCommand.option_list + ( make_option('--flush', ...
StarcoderdataPython
1729595
<gh_stars>0 # # Nested ellipsoidal sampler implementation. # # This file is part of PINTS (https://github.com/pints-team/pints/) which is # released under the BSD 3-clause license. See accompanying LICENSE.md for # copyright notice and full license details. # # from __future__ import absolute_import, division from __fu...
StarcoderdataPython
3266707
<reponame>DanPorter/Dans_Diffaction """ GUI for MultipleScattering code """ import sys, os import matplotlib.pyplot as plt import numpy as np if sys.version_info[0] < 3: import Tkinter as tk else: import tkinter as tk from .. import functions_general as fg from .. import functions_crystallography as fc from ...
StarcoderdataPython
3371904
<filename>capstone-project/sim_env.py class SIMEnv(object): def __init__(self, proxy_table): """ Initilise the Environment with informations from proxy_table """ pass def step(self, action): """ Take a action, calculate the reward and return these informations """ pass def ...
StarcoderdataPython
1637602
# <NAME>, <EMAIL> # Code for Generating Semester 6 Dates import datetime from collections import defaultdict from num2words import num2words import re MONTHS = ( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September,' 'October', 'November', ...
StarcoderdataPython
3348940
<reponame>dexterchan/DailyChallenge #You are given an array of integers. Return the length of the longest consecutive elements sequence in the array. #For example, the input array [100, 4, 200, 1, 3, 2] has the longest consecutive sequence 1, 2, 3, 4, and thus, you should return its length, 4. #Can you do this in lin...
StarcoderdataPython
1672918
import numpy as np import pytest from bigearthnet_patch_interface.band_interface import Band from bigearthnet_patch_interface.merged_interface import * from bigearthnet_patch_interface.s1_interface import * from bigearthnet_patch_interface.s2_interface import * TEST_BANDS = { "bandVV": random_ben_S1_band(), "...
StarcoderdataPython
1611886
""" Checks a sample if it matches PHE defined recipes for VOC/VUIs. Outputs to stdout a tab delimited list of the following: - PHE name for the matching VOC/VUI. "none" if no match. "multiple" if multiple matches. - pangolin name for the matching VOC/VUI. "none" if no match. "multiple" if multiple matches. - conf...
StarcoderdataPython
154839
<reponame>tomwisniewskiprv/Python_networking<gh_stars>0 # -*- coding: utf-8 -*- # Python 3.6 # Python_networking | remote_machine_ip # 12.07.2017 <NAME> import socket import argparse import sys def get_remote_machine_ip(remote_host): try: print("IP address of {} : {}".format(remote_host, socket.gethostby...
StarcoderdataPython
55988
<filename>tests/example/map_model.py<gh_stars>1-10 # Copyright 2021 Modelyst 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 # # http://www.apache.org/licenses/LICENSE-2.0 #...
StarcoderdataPython
3305471
#!/usr/bin/env python3 import concurrent.futures import time def func(): print('func') time.sleep(1) def main(): with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor: s_time = time.time() for i in range(10): executor.submit(func) print('Took {} [sec]'...
StarcoderdataPython
1728960
import os import csv import time import yaml import shutil import pickle import argparse import numpy as np import tensorflow as tf # import tensorflow.compat.v1 as tf # tf.disable_v2_behavior() import matplotlib.pyplot as plt from sklearn.utils import shuffle SCAN_RANGE = 1.5 * np.pi SCAN_NUM = 720...
StarcoderdataPython
1695024
<filename>filipkin.com/history.py<gh_stars>1-10 #!/usr/bin/env python import json from pprint import pprint import sys import gspread from oauth2client.service_account import ServiceAccountCredentials json = json.load(open('history.json')) scope = [ 'https://spreadsheets.google.com/feeds', 'https://www.googleapis.c...
StarcoderdataPython
1694734
""" Copyright 2009 <NAME> Additional contributors: <NAME> LaTeX2WP version 0.6.2 This file is part of LaTeX2WP, a program that converts a LaTeX document into a format that is ready to be copied and pasted into WordPress. You are free to redistribute and/or modify LaTeX2WP under the terms of the GNU General ...
StarcoderdataPython
1700699
<filename>M3_feature_zone/retipyserver/test/test_vessel_classification_endpoint.py # Retipy - Retinal Image Processing on Python # Copyright (C) 2017 <NAME> # # This program 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 Softwar...
StarcoderdataPython
4837063
#!/usr/bin/env python from ete3 import NCBITaxa from argparse import ArgumentParser import os import pandas as pd import sys import re v_re = re.compile("[0-9].[0-9]") def main(): parser = ArgumentParser() parser.add_argument("namesmap", help="File with ids->names mappings") parser.add_argument("-t", "--t...
StarcoderdataPython
160378
<filename>src/tests/test_trajectory.py import pytest from unittest.mock import MagicMock from data_logger import DataLogger from commands.trajectories import CsvTrajectoryCommand, StateSpaceDriveCommand from robot import Rockslide log_trajectory = True def test_CsvTrajectoryCommand(Notifier, sim_hooks): robot =...
StarcoderdataPython
1757007
<filename>flaskapp/config/debug.py ENV = 'debug' DEBUG = True HOST = False PORT = 5000
StarcoderdataPython
137673
import os import sys import mxnet as mx def cifar100_iterator(cfg, kv): train_rec = os.path.join(cfg.dataset.data_dir, "cifar100_train.rec") val_rec = os.path.join(cfg.dataset.data_dir, "cifar100_test.rec") mean = [129.31, 124.11, 112.4] std = [68.21, 65.41, 70.41] train = mx.io.ImageRecordIter...
StarcoderdataPython
1764533
import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from selenium import webdriver from selenium.webdriver import ActionChains from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from locators.locators import LoginPageLocators from ...
StarcoderdataPython
1635228
<filename>sagemaker-pyspark-sdk/tests/sagemakerestimator_test.py # Copyright 2017 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 # # ht...
StarcoderdataPython
12122
import json import argparse from argus.callbacks import MonitorCheckpoint, \ EarlyStopping, LoggingToFile, ReduceLROnPlateau from torch.utils.data import DataLoader from src.datasets import FreesoundDataset, FreesoundNoisyDataset, RandomDataset from src.datasets import get_corrected_noisy_data, FreesoundCorrecte...
StarcoderdataPython
1714361
import numpy as np def rand_bbox(height, width, lamda): # Size of the cropping region cut_ratio = np.sqrt(1 - lamda) cut_height = np.int(height * cut_ratio) cut_width = np.int(width * cut_ratio) # Coordinates of the center center_width = np.random.randint(width) center_height = np.random....
StarcoderdataPython
3312917
<gh_stars>0 #!/usr/bin/env python3 import notificore_restapi as api # noinspection PyPackageRequirements from tests.settings import API_KEY requester = api.BalanceAPI(config=dict(api_key=API_KEY)) BALANCE_ATTRIBUTES = ['amount', 'currency', 'limit'] def test_api_balance_balance_api(): response =...
StarcoderdataPython
112115
<gh_stars>1-10 #!/usr/bin/env python # # Copyright 2019 DFKI GmbH. # # 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, cop...
StarcoderdataPython
4838789
<gh_stars>0 #/usr/bin/python from __future__ import print_function import random import copy ''' playlist.py Python class that represents a playlist @author: <NAME> <<EMAIL>> ''' __author__ = "<NAME>" class Playlist: ''' Class that represents a playlist to be played by the Pi ''' def __init__(self, id,...
StarcoderdataPython
4829562
# pylint: skip-file from opendbc.can.packer_pyx import CANPacker assert CANPacker
StarcoderdataPython
113852
from collections import deque from constants import section_break_token,line_start_token import os import pickle from pymongo import MongoClient def add_to_trie(trie, tokens, depth): history = deque(maxlen=depth) for leaf_token in tokens: trie[0] += 1 history.append(leaf_token) for i in...
StarcoderdataPython
135793
raio = int(input()) pi = 3.14159 volume = float(4.0 * pi * (raio* raio * raio) / 3) print("VOLUME = %0.3f" %volume)
StarcoderdataPython
3303364
<reponame>joni115/neuralFrame import yaml import tempfile from opennmt.runner import Runner from opennmt.models.model import Model from opennmt.config import load_config, load_model class Neural: """ This class will be wrapped class from openNMT-tf. https://arxiv.org/abs/1701.02810 """ def __ini...
StarcoderdataPython
3344310
# Example program that uses 'setup' and 'cleanup' functions to # initialize/de-initialize global variables on each node before # computations are executed. Computations use data in global variables # instead of reading input for each job. # Under Windows global variables must be serializable, so modules # can't be glo...
StarcoderdataPython
174042
import os import torch import segmentation_models_pytorch as smp import pandas as pd from abc import abstractmethod from pathlib import Path from catalyst.dl.callbacks import AccuracyCallback, EarlyStoppingCallback, \ CheckpointCallback, PrecisionRecallF1ScoreCallback from catalyst.dl...
StarcoderdataPython
103353
<filename>webmap/utils.py import requests from django.conf import settings from django.forms.models import model_to_dict import os from pywebpush import WebPusher def send_slack_log(title, message): slack_url = os.getenv('SLACK_URL') if not slack_url and hasattr(settings, 'SLACK_URL') and settings.SLACK_URL:...
StarcoderdataPython
3322886
<reponame>csdenboer/drf-dynamic-serializers<filename>drf_dynamic_serializers/mixins.py from collections import defaultdict from typing import Callable, List, Tuple, Set from django.utils.functional import cached_property from rest_framework.serializers import ListSerializer, Serializer from rest_framework.request impo...
StarcoderdataPython
3358
<reponame>anobi/django-oauth-api import base64 import binascii from datetime import timedelta from django.contrib.auth import authenticate from django.utils import timezone from oauthlib.oauth2 import RequestValidator from oauth_api.models import get_application_model, AccessToken, AuthorizationCode, RefreshToken, A...
StarcoderdataPython
37396
import errno import os import subprocess import sys from distutils import log from distutils.command.build_ext import build_ext from distutils.errors import DistutilsError def exec_process(cmdline, silent=True, catch_enoent=True, input=None, **kwargs): """Execute a subprocess and returns the returncode, stdout ...
StarcoderdataPython
3362407
<reponame>hanneshapke/pyzillow import requests from xml.etree import cElementTree as ElementTree # for zillow API from .pyzillowerrors import ZillowError, ZillowFail, ZillowNoResults from . import __version__ class ZillowWrapper(object): """This class provides an interface into the Zillow API. An...
StarcoderdataPython
1681748
import Orange data = Orange.data.Table("iris.tab") print("Dataset instances:", len(data)) subset = Orange.data.Table(data.domain, [d for d in data if d["petal length"] > 3.0]) print("Subset size:", len(subset))
StarcoderdataPython
4816794
<filename>ozz/settings.py """ Django settings for ozz project. Generated by 'django-admin startproject' using Django 1.8. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/setting...
StarcoderdataPython
1724016
from __future__ import annotations from unittest import TestCase from typing import List, Dict from datetime import date, datetime, timezone from bson import ObjectId from jsonclasses import jsonclass, types from jsonclasses_pymongo import pymongo from jsonclasses_pymongo.decoder import Decoder class TestDecoder(Test...
StarcoderdataPython
1786964
<reponame>francescolovat/pyam import pytest import logging import numpy as np import pandas as pd from pyam import check_aggregate, IamDataFrame, IAMC_IDX from conftest import TEST_DTS def test_missing_region(check_aggregate_df): # for now, this test makes sure that this operation works as expected exp = ch...
StarcoderdataPython
1711351
<gh_stars>0 import itertools import os import subprocess import numpy as np import time import datetime from hyperopt import hp import pandas as pd HomeDir = os.environ.get('HOME') # os.chdir(os.path.join(HomeDir,"CS3244/DrQA")) os.chdir(os.path.join(HomeDir,"DrQA")) # print(os.getcwd()) top10_result = "validation/top...
StarcoderdataPython
3290841
import fnmatch import string def timeCheck(line): timePhrase = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday', 'january', 'jan', 'february', 'feb', 'march', 'mar', 'april', 'apr', 'may', 'june', 'jun', 'july', 'august', 'au...
StarcoderdataPython
1606761
<reponame>ciwan6521/udemy # -*- coding: utf-8 -*- class ögretmen(): def __init__(self,ad,soyad,telefon,maas,dersler): self.ad = ad self.soyad = soyad self.telefon = telefon self.maas = maas self.ders = dersler def bilgiler(self): print("""...
StarcoderdataPython
192001
# Generated by Django 3.2.dev20200604053612 on 2020-06-07 07:22 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('project', '0007_auto_20200606_1112'), ] operations = [ migrations.AddField( model_name='menu', name=...
StarcoderdataPython
33224
#!/usr/bin/env python3 #=============================================================================== # Copyright (c) 2020 <NAME> # Lab of Dr. <NAME> and Dr. <NAME> # University of Michigan #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation f...
StarcoderdataPython
126311
<gh_stars>1-10 from __future__ import absolute_import from __future__ import print_function import os import json import apiai import requests import base64 import sys import random import uuid import time from timeit import default_timer as timer from flask import request from actions import * class FacebookHandle...
StarcoderdataPython
1618666
<reponame>object-oriented-human/competitive #!/bin/python3 import math import os import random import re import sys # # Complete the 'pangrams' function below. # # The function is expected to return a STRING. # The function accepts STRING s as parameter. # def pangrams(s): alphabet = list("abcdefghijklmnopqrstuv...
StarcoderdataPython
3343903
<filename>src/transformers/trainer_utils.py import random from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Union import numpy as np from .file_utils import is_tf_available, is_torch_available, is_torch_tpu_available from .tokenization_utils_base import ExplicitEnum if is_torch_available(): impor...
StarcoderdataPython
4832937
from common.sql.datetime import DateTime from common.sql.uuid import UUID from common.utils.datetime import get_current_datetime from common.utils.uuid import generate_uuid4 from sqlalchemy import Column, Integer from backend.sql.base import Base class AccountDeltaGroup(Base): __tablename__ = "AccountDeltaGroup"...
StarcoderdataPython
189472
# coding: utf-8 """ Copyright 2015 SmartBear Software 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 applica...
StarcoderdataPython
1627170
<reponame>francois-vincent/clingon<filename>tests/test_clingon.py # -*- coding: utf-8 -*- from __future__ import print_function import mock try: # for py26 import unittest2 as unittest except ImportError: import unittest try: from collections import OrderedDict except ImportError: # for py26 f...
StarcoderdataPython
1744431
#! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import import os import sys sys.dont_write_bytecode = True MISSING_DEPENDENCIES = [] try: from django.conf import settings except ImportError: MISSING_DEPENDENCIES.append("Django\>=1.11") try: from os import scandir except Import...
StarcoderdataPython
3228453
<gh_stars>0 from PyQt4 import QtCore, QtGui, Qt class DragLabel(QtGui.QLabel): def __init__(self, text, parent): super(DragLabel, self).__init__(text, parent) self.setMinimumSize(7 * (len(self.text().encode('utf-8')) + len(self.text())), 30) self.setAlignment(Qt.Qt.AlignCenter) ...
StarcoderdataPython
102478
<filename>regrex1_in_python.py<gh_stars>0 #!/usr/bin/env python # coding: utf-8 # # importing packages # In[22]: import pandas as pd import sklearn import numpy as np import matplotlib.pyplot as plt import sys from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split ...
StarcoderdataPython
103579
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from visdom import Visdom import numpy as np import math import os.path import getpass from sys import platform as _platform from six.moves import urllib vi...
StarcoderdataPython
1745216
<filename>build/setup.py """setuptools.setup() invocation, including all relevant arguments. """ import setuptools def main(): """Main call to setuptools.setup() """ name = "sdsu" with open("README.rst", 'r') as f: long_description = f.read() setuptools.setup( name=name, version="1.0.0", packages=setupto...
StarcoderdataPython
3340074
<gh_stars>10-100 from bs4 import BeautifulSoup from share.transform.chain.links import AbstractLink from share.transform.chain import ChainTransformer class SoupXMLDict: def __init__(self, data=None, soup=None): self.soup = soup or BeautifulSoup(data, 'lxml').html def __getitem__(self, key): ...
StarcoderdataPython
3284626
# pylint: disable=no-self-use,invalid-name,protected-access import torch import pytest import numpy from allennlp.common.testing import AllenNlpTestCase from allennlp.common.checks import ConfigurationError from allennlp.training.metrics import CategoricalAccuracy class CategoricalAccuracyTest(AllenNlpTestCase): ...
StarcoderdataPython
3392103
__author__ = 'naras_mg' # libraries # import matplotlib as plt import json, logging, requests import networkx as nx prefix = 'http://api.iyengarlabs.org/v1/' # own modules import knowledgeTreeModelSmall as ktm def entity_json_dict_list(rows): rowsDictList = [] for row in rows: db_flds = row.__dict__['_...
StarcoderdataPython
3370257
<filename>unit_02/04_object-oriented/3-Advanced_Objects/javascriptobject.py # # Object-Oriented Python: Advanced Objects # Python Techdegree # # Created by <NAME> on 12/15/18. # Copyright (c) 2018 ddApps. All rights reserved. # ------------------------------------------------ # JavaScript Object Class # use javas...
StarcoderdataPython
3340751
from data_prep import * # get user input value from commandline parser = argparse.ArgumentParser() parser.add_argument('data_dir') parser.add_argument('--save_dir') parser.add_argument('--arch') parser.add_argument('--learning_rate') parser.add_argument('--hidden_units') parser.add_argument('--epochs') parser.add_argu...
StarcoderdataPython
4811528
from datetime import datetime from database.db import db class Tweet(db.Model): tweet_id = db.Column(db.Integer, primary_key=True) tweet_text = db.Column(db.String(140)) user = db.Column(db.String(140)) timestamp = db.Column(db.DateTime()) created = db.Column(db.DateTime()) def __init__(self...
StarcoderdataPython
1693450
import functools import logging import random import unittest from datetime import datetime from unittest import TestCase, suite from unittest.mock import patch, MagicMock from coverage.files import os from freezegun import freeze_time from sqlalchemy import create_engine from telegram import Chat, CallbackQuery from ...
StarcoderdataPython
3234498
import numpy as np def sigmaAB(A, uA, B, uB, op='*'): ''' Calculates the uncertainty of two parameters with uncorrolated errors propogated through either multiplication or division. For f = A * B or f = A / B, find sigma_f Parameters: A, B - array-like (assumed to be 1D ar...
StarcoderdataPython
53042
<gh_stars>0 import coords import customers import math import random import main # Test if coods are being created and if their # lats/lons are in radians after creation def test_coords(): for i in range(1000): lat = random.uniform(-90, 90) lon = random.uniform(-180, 180) cds = coords.Coord...
StarcoderdataPython
4817163
"""Interact with Pure Fitness/Yoga service. Usage: pypuregym location <gym-type> <region-id> pypuregym schedule <region-id> <location-id> <date> pypuregym book <region-id> <class-id> <username> <password> [--wait-until <wait>] [--retry <retry>] Options: <gym-type> Can be "fitness" or "yoga". ...
StarcoderdataPython
122203
<filename>stream/feed/__init__.py from .feeds import AsyncFeed, Feed
StarcoderdataPython
131211
<gh_stars>0 # -*- coding: utf-8 -*- """Branch office topology terminate switch | | hosts switch | hosts Hosts consist of PC+Phones, ATMs, Security devices (camers, etc) """ from mininet.topo import Topo from mininet.net import Mininet from mininet...
StarcoderdataPython
1615498
<reponame>Minkov/python-oop<gh_stars>1-10 import functools def log(func): @functools.wraps(func) def wrapper(): print(f'{func.__name__} executed') return func() return wrapper @log def f1(): return 5 print(f1()) def f2(): return 5 f2 = log(f2) print(f2())
StarcoderdataPython
153334
<reponame>kevinastone/generator<filename>generator/util.py import fnmatch def _wildcard_filter(names, *ignore_patterns): for name in names: if any(fnmatch.fnmatchcase(name, pattern) for pattern in ignore_patterns): continue yield name def copy_attributes(source, destination, ignore_p...
StarcoderdataPython
29233
from .item import Item from .entry import Entry from copy import copy class Record(object): """ A Record, the tuple of an entry and it's item Records are useful for representing the latest entry for a field value. Records are serialised as the merged entry and item """ def __init__(self,...
StarcoderdataPython
1679542
# jmx stuff from javax.management.remote import JMXServiceURL from javax.management.remote import JMXConnector from javax.management.remote import JMXConnectorFactory from javax.management import ObjectName from java.lang import String from java.lang import Object from jarray import array from java.io import IOExceptio...
StarcoderdataPython
1702555
<filename>tests/test_sync_tool.py import unittest from nextactions.synctool import SyncTool from nextactions.trello import Trello from nextactions.board import Board from nextactions.list import List from nextactions.config import Config from unittest.mock import MagicMock, call, patch from nextactions.card import Card...
StarcoderdataPython
1625462
# # ------------------------------------------------------------------------- # Copyright (c) 2018 Intel Corporation Intellectual Property # # 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...
StarcoderdataPython