id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
3438827
import sys import numpy as np from functools import partial from PyQt5.QtWidgets import QApplication, QWidget, QSystemTrayIcon, QPushButton, QDesktopWidget, QLabel, QAction, QMainWindow from PyQt5.QtGui import QIcon, QImage, QPainter from PyQt5.QtCore import QPointF, Qt from board import Board, BOARDSIZE from brain imp...
StarcoderdataPython
129964
__all__ = ['BaseController'] import json from pyramid.renderers import render from pyramid.view import view_config from horus.views import BaseController @view_config(http_cache=(0, {'must-revalidate': True}), renderer='templates/embed.txt', route_name='embed') def embed(request, standalone=True): ...
StarcoderdataPython
4952470
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Based on https://github.com/V-E-O/PoC/tree/8c389899e6c4e16b2ddab9ba6d77c2696577366f/CVE-2017-13156 import os import sys import struct import hashlib import zipfile import argparse from zlib import adler32 verbosity = 0 def verbose_log(level, message): if level ...
StarcoderdataPython
5011782
<reponame>yaccri/python-domintell """ :author: <NAME> <<EMAIL>> """ import domintell class Ping(domintell.Command): """ send: &PING message """ def __init__(self): domintell.Command.__init__(self) def command(self): return "&PING"
StarcoderdataPython
11316956
<filename>neurotic/tangles/sandbox.py from io import StringIO import sys def sandbox(code: str, block_globals: bool=False, block_locals: bool=False) -> tuple: """Runs the code-string and captures any errors Args: code: executable string block_globals: if True don't use global namespace ...
StarcoderdataPython
8042113
#!/usr/bin/env python import octavo
StarcoderdataPython
1628259
# -*- coding: UTF-8 -*- # pep8: disable-msg=E501 # pylint: disable=C0301 import os import logging import getpass import tempfile __version__ = '0.0.5' __author__ = '<NAME>' __author_username__ = 'marco.lovato' __author_email__ = '<EMAIL>' __description__ = 'A command-line tool to create projects \ fr...
StarcoderdataPython
11392019
<gh_stars>0 import logging import math import numpy as np def dodi2wt(Do, Di): """Calculate pipe wall thickness from outer diameter and inner diameter. """ return (Do - Di) / 2 def dowt2di(Do, WT): """Calculate pipe inner diameter from outer diameter and wall thickness. """ return Do - 2 * ...
StarcoderdataPython
8127699
from puma.attribute import ThreadAction class SharingAttributeBetweenScopesNotAllowedError(TypeError): def __init__(self, attribute_name: str, scope_type: str, action_type: str) -> None: super().__init__(f"Attribute '{attribute_name}' may not be passed between {scope_type} as its {action_type} is '{Threa...
StarcoderdataPython
4865296
import prep1 as py import pandas as pd from sklearn import preprocessing from sklearn.feature_extraction.text import CountVectorizer import re import nltk from nltk.corpus import stopwords from nltk.stem.porter import PorterStemmer import pickle df=pd.read_csv("youtubedata.csv") df.dropna(axis=0, how="any...
StarcoderdataPython
1628581
import logging import unittest import requests from configcatclient import DataGovernance try: from unittest import mock except ImportError: import mock try: from unittest.mock import Mock, ANY except ImportError: from mock import Mock, ANY from configcatclient.configfetcher import ConfigFetcher log...
StarcoderdataPython
12817337
<reponame>zan73/telstra-smart-modem # Class with helper methods to represent the devices connected to or seen by the modem. # This class is returned from Modem.getDevices() and can't be used by itself. import ipaddress import re import bs4 import json # Compiled regular expressions: re_mac = re.compile(r"(?:[0-9a-f]{...
StarcoderdataPython
4958318
<reponame>DaveLorenz/FlaskDeepLearningHamSpam<filename>Flask application/main.py # load packages import os import flask app = flask.Flask(__name__) from flask import Flask, render_template, request #load model preprocessing import numpy as np import pandas as pd import pickle from keras.preprocessing.text import Toke...
StarcoderdataPython
11322389
<gh_stars>1-10 import os import functools import collections from typing import Optional, List from PIL import Image import torchvision from ..transforms import stack from ..train import SequenceArray, SamplerRandom, SamplerSequential from ..transforms import criteria_feature_name, TransformCompose, TransformResize, ...
StarcoderdataPython
1859332
from auditor.manager import default_manager from event_manager.event_service import EventService class AuditorService(EventService): """An service that just passes the event to author services.""" __all__ = EventService.__all__ + ('log', 'notify', 'track') event_manager = default_manager def __init_...
StarcoderdataPython
1821404
<gh_stars>0 #!/usr/local/bin/python # Copyright 2020 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
StarcoderdataPython
1993010
import sublime import os import sys import json import csv import urllib import pprint import sys import re import time import datetime import base64 import zipfile import shutil import subprocess import webbrowser import xml.dom.minidom from .salesforce.lib import xmlformatter from .salesforce import message from .sa...
StarcoderdataPython
3307909
from django.apps import AppConfig class RouteplannerConfig(AppConfig): name = 'routeplanner'
StarcoderdataPython
1952411
import unittest from bfg9000.builtins.version import bfg9000_required_version, bfg9000_version from bfg9000.versioning import bfg_version, VersionError class TestRequiredVersion(unittest.TestCase): def test_bfg_version(self): bfg9000_required_version('>=0.1.0') self.assertRaises(VersionError, bfg...
StarcoderdataPython
9779450
<gh_stars>1-10 from __future__ import absolute_import, print_function from sentry.db.models import ( BoundedBigIntegerField, Model, sane_repr ) class LatestRelease(Model): """ Tracks the latest release of a given repository for a given environment. """ __core__ = False repository_id = Bounde...
StarcoderdataPython
6655930
""" Given two 2D polygons write a function that calculates the IoU of their areas, defined as the area of their intersection divided by the area of their union. The vertices of the polygons are constrained to lie on the unit circle and you can assume that each polygon has at least 3 vertices, given and in sorted order....
StarcoderdataPython
6513063
<gh_stars>1-10 from cProfile import run from playsound import playsound from gtts import gTTS import speech_recognition as sr import os import time from datetime import date, datetime import random from random import choice import webbrowser import psutil from plyer import notification import time import pywhatkit as k...
StarcoderdataPython
1943840
<gh_stars>1-10 _base_="../base-${shortname}-config.py" # this will merge with the parent model=dict(pretrained='${pretrained}') # epoch related total_iters=${iter} checkpoint_config = dict(interval=total_iters)
StarcoderdataPython
77044
# Keplerian fit configuration file for HIP11915 # 15 Mar 2022 # Packages import pandas as pd import os import numpy as np import radvel import astropy.units as u # Global planetary system and datasets parameters starname = 'HIP11915' nplanets = 2 instnames = ['HARPS-A', 'HARPS-B'] ntels = len(instnames...
StarcoderdataPython
4831423
# Copyright 2020 The Cirq Developers # # 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 applicable law or agreed to in ...
StarcoderdataPython
289627
<reponame>kqtqk88/or-tools<filename>tools/check_python_deps.py<gh_stars>1-10 #!/usr/bin/env python3 """Check user python installation.""" import inspect import logging import optparse import sys # try to import setuptools try: from setuptools import setup # pylint: disable=g-import-not-at-top,unused-import from s...
StarcoderdataPython
8210
<reponame>HuaichenOvO/EIE3280HW import numpy as np import numpy.linalg as lg A_mat = np.matrix([ [0, 1, 1, 1, 0], [1, 0, 0, 0, 1], [1, 0, 0, 1, 1], [1, 0, 1, 0, 1], [0, 1, 1, 1, 0] ]) eigen = lg.eig(A_mat) # return Arr[5] with 5 different linear independent eigen values vec = eigen[1...
StarcoderdataPython
9626280
<reponame>cpostbitbuckets/BucketVision<gh_stars>1-10 # -*- coding: utf-8 -*- """ match Example of matching a template to an image Derived from techniques found at http://www.pyimagesearch.com/2015/01/26/multi-scale-template-matching-using-python-opencv/ Copyright (c) 2017 - RocketRedNeck.com RocketRedNeck.net Rocke...
StarcoderdataPython
5026967
<filename>desktop/core/src/desktop/lib/connectors/types.py #!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you unde...
StarcoderdataPython
3369804
from simulator.util.Vehicle import Vehicle from simulator.UI.Record import EventBag from simulator.util.World import World from simulator.util.Camera import Camera from simulator.util.transform.util import params_from_tansformation import pickle def test_simulate_key(): event_bag = EventBag("../../data/recording.h...
StarcoderdataPython
3416602
<reponame>ratsgib/amazonprice<gh_stars>0 from django.test import TestCase from django.urls import reverse from bs4 import BeautifulSoup from product.models import Product, Price def create_data(product_nums, price_nums): ''' テストデータをnums件登録する。 ''' for num in range(product_nums): p = Product.obj...
StarcoderdataPython
1964889
<filename>animius/Chatbot/CombinedChatbotModel.py import copy import tensorflow as tf import animius as am from .ChatbotModel import ChatbotModel # A chatbot network built upon an intent-ner model, using its embedding tensor and thus saving VRAM. # This model is meant for training. Once training is complete, it is ...
StarcoderdataPython
318534
""" auth.py Auth mongoengine models. """ from mongoengine import Document from mongoengine import fields from werkzeug.security import gen_salt from app.models.user import User class Client(Document): """Auth Client model.""" user_id = fields.IntField(null=False) user = fields.ReferenceField(User) ...
StarcoderdataPython
98209
class TransportModesProvider(object): TRANSPORT_MODES = { '0': None, # High speed train '1': { 'node': [('railway','station'),('train','yes')], 'way': ('railway','rail'), 'relation': ('route','train') }, # Intercity train '2': {...
StarcoderdataPython
3531063
<reponame>dmyersturnbull/chembler<gh_stars>0 from pathlib import Path from typing import Sequence import decorateme import pandas as pd import regex from pocketutils.core.exceptions import ParsingError from typeddfs import TypedDfs from mandos.model.utils.setup import MandosResources, logger def _patterns(self: pd....
StarcoderdataPython
6606004
<reponame>Mhaiyang/iccv<gh_stars>1-10 """ @Time : 1/13/21 20:04 @Author : TaylorMei @Email : <EMAIL> @Project : iccv @File : infer.py @Function: """ import time import datetime import sys sys.path.append("..") import torch from PIL import Image from torch.autograd import Variable from torchvision im...
StarcoderdataPython
12849899
d1 = {} d2 = {'one': 1, 'two': 2 } d3 = dict(one=1, two=2) d4 = dict((1, 2), (3, 4)) d5 = dict({1:2, 3:4})
StarcoderdataPython
1903905
<filename>src/el21uptime.py #!/usr/bin/env python3 # Copyright 2020 Enapter, <NAME> <<EMAIL>> # 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
9690655
from setuptools import find_packages, setup install_requires = [ 'Django>=3.2,<4', 'attrs', 'djangorestframework>=3,<4', 'requests>=2.7', ] docs_require = [ 'sphinx>=1.5.2', ] tests_require = [ 'freezegun==1.1.0', 'pretend==1.0.9', "pytest-cov==2.11.1", "pytest-django==4.1.0", ...
StarcoderdataPython
3517175
import re, json, os, requests import browsercookie import DataConfiguration as data from git import Repo,remote class Hackerrank: HEADERS = { 'x-csrf-token': '', 'cookie': '', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0....
StarcoderdataPython
230413
<reponame>konichar/covidus<gh_stars>0 from django.forms import ModelForm from covidus_main.models import Profile class ProfileForm(forms.ModelForm): class Meta: model = Profile fields = '__all__' def __str__(self): return self.name
StarcoderdataPython
11270100
<gh_stars>100-1000 #!/usr/bin/env python3 import argparse import sys from tabulate import tabulate import yaml import os import generatehelpers config = {} def gen_sig_table(oqslibdocdir): liboqs_sig_docs_dir = os.path.join(oqslibdocdir, 'algorithms', 'sig') liboqs_sigs = {} for root, _, files in os.walk(libo...
StarcoderdataPython
11278239
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse class AlipayEbppAccountBalanceQueryResponse(AlipayResponse): def __init__(self): super(AlipayEbppAccountBalanceQueryResponse, self).__init__() self._account = None ...
StarcoderdataPython
4952388
<filename>neurokernel/version.py import pkg_resources __version__ = pkg_resources.require('neurokernel')[0].version
StarcoderdataPython
6511477
import logging from .base import * DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } for config in LOGGING['loggers'].values(): config['level'] = "WARNING" logging.basicConfig( level=logging.DEBUG, format='%(asctime)s %(name)-12s %(levelna...
StarcoderdataPython
3581554
from typing import List, Union, Dict import os from engine.data_sources.base_db import BaseDB from engine.data_sources.base_source import BaseSource, GUIDMissing from engine.data_sources.base_table import BaseTable from engine.data_sources.local_fs.local_fs_database import LocalFSDatabase from engine.data_sources.loca...
StarcoderdataPython
380839
<gh_stars>0 import os import logging try: from urllib2 import urlopen from urllib2 import URLError except ImportError: from urllib.request import urlopen from urllib.error import URLError from collections import namedtuple from lxml import etree try: from Queue import Queue, Empty except ImportEr...
StarcoderdataPython
278780
# -*- coding: utf-8 -*- from __future__ import division, print_function import os import sys import tempfile import setuptools from setuptools.command.build_ext import build_ext as _build_ext __all__ = ["build_ext"] def has_flag(compiler, flagname): """Return a boolean indicating whether a flag name is support...
StarcoderdataPython
4905181
<reponame>sopherapps/judah """Module containing tests for the quarter based Exports Site data source""" import os from collections import Iterator from datetime import date from typing import Optional from unittest import TestCase, main from unittest.mock import patch, Mock, call from selenium import webdriver from j...
StarcoderdataPython
6440476
#!/usr/bin/env python3 from io import StringIO from gentokenlookup import gentokenlookup # copied from llhttp.h, and stripped trailing spaces and backslashes. SRC = ''' XX(0, DELETE, DELETE) XX(1, GET, GET) XX(2, HEAD, HEAD) XX(3, POST, POST) XX(4, PUT, PUT) XX(5, CONNECT, CONNECT) XX(6, OPTIONS, OPTION...
StarcoderdataPython
9733548
<reponame>sanjaynirmal/blue-marlin<filename>Processes/dlpredictor/tests/test_dlpredictor_system_errors_11/test_dlpredictor_system_errors_11.py # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional inform...
StarcoderdataPython
288267
try: import pygame, os, time except: print('cmd run: pip3 install pygame -i https://mirrors.aliyun.com/pypi/simple') exit() from pygame.locals import * from game import Game from ai import Ai from config import * # config = Development() config = SupperFast() FPS = config.FPS SIZE = config.SIZE DEBUG = co...
StarcoderdataPython
6573795
from django.contrib import admin from .models import Member @admin.register(Member) class MemberAdmin(admin.ModelAdmin): search_fields = ['first_name', 'last_name', 'email', 'website'] list_display = ('first_name', 'last_name', 'email') list_display_links = ('first_name', 'last_name', 'email') field...
StarcoderdataPython
1877054
from .base import BaseModel, Scraper from .popolo import Organization from .schemas.jurisdiction import schema from ..metadata import lookup _name_fixes = { "SouthCarolina": "South Carolina", "NorthCarolina": "North Carolina", "SouthDakota": "South Dakota", "NorthDakota": "North Dakota", "RhodeIsl...
StarcoderdataPython
3344778
<reponame>aarunsai81/netapp<filename>cinder/scheduler/filter_scheduler.py # Copyright (c) 2011 Intel Corporation # Copyright (c) 2011 OpenStack Foundation # 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. Y...
StarcoderdataPython
8060021
from mypastebot import Search # find 10 pastes with the keyword Python pastes = Search.find(term='Python', limit=10) # min limit is 1 and max limit is 15 # print the results print(pastes['results']) # find 10 pastes with the keyword Python sorted by date pastes = Search.find(term='Python', limit=10, sortType='date')...
StarcoderdataPython
11374158
""" Configuration of pytest for agent tests """ from pathlib import Path from textwrap import dedent from unittest.mock import patch import httpx import respx from pytest import fixture from lm_agent.backend_utils import BackendConfigurationRow from lm_agent.config import settings MOCK_BIN_PATH = Path(__file__).pare...
StarcoderdataPython
4842994
<filename>petkit_exporter/petkit.py<gh_stars>0 import datetime import hashlib from collections import namedtuple from typing import Dict, List, Optional import requests PETKIT_API = "http://api.petkt.com" EVENT_TYPES = { 5: "cleaning", 7: "reset", 10: "pet in the litter box", 8: "deorder" } START_R...
StarcoderdataPython
3359768
def hello(): print("Guten Tag! It's me Sivant :)")
StarcoderdataPython
8192005
<reponame>wreiner/Office365-REST-Python-Client class ClientCredential(object): def __init__(self, client_id, client_secret): """ Client credentials :type client_secret: str :type client_id: str """ self.clientId = client_id self.clientSecret = client_secret
StarcoderdataPython
4817735
<reponame>BMeu/Orchard<gh_stars>1-10 # -*- coding: utf-8 -*- """ Unit Test: orchard.system_status.system.cpu """ import subprocess import unittest import mock import orchard import orchard.system_status.system.cpu as cpu class CPUUnitTest(unittest.TestCase): def setUp(self): app = orchard.create_...
StarcoderdataPython
242558
''' Be careful to circular import ''' def init_routes(api): from .helloworld import HelloWorld from .auth import RegisterApi, LoginApi, LogoutApi from .user import UserApi, UserPetApi, UserPpcamApi, UserPadApi from .pet import PetRegisterApi, PetApi from .pet_record import PetRecordApi, PetRecor...
StarcoderdataPython
3427548
<filename>Toolkits/VCS/repology__repology-api/repology-app.py #!/usr/bin/env python3 # # Copyright (C) 2016-2017 <NAME> <<EMAIL>> # # This file is part of repology # # repology 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 Softw...
StarcoderdataPython
6705534
<gh_stars>1-10 from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import # # This file was adapted from https://github.com/venth/aws-adfs. Thanks to https://github.com/venth for his work on # figuring this out # from builtins imp...
StarcoderdataPython
6591810
import re from datetime import date, timedelta from bs4 import BeautifulSoup from .utils.functions import get # public interface ----------------------------------------------------- async def get_cafeteria(when: int): day = (date.today() + timedelta(days=when)).day try: text: str = _cache[day] ...
StarcoderdataPython
1820994
<gh_stars>100-1000 #!/usr/bin/python import os import re import sys from junit_xml import TestSuite, TestCase class Tap2JUnit: """ This class reads a subset of TAP (Test Anything protocol) and writes JUnit XML. Two line formats are read: 1. (not )?ok testnum testname 2. # diagnostic output ...
StarcoderdataPython
6473621
import module_dictionary tmlistfile = open('tm.list', 'r') dict_file = open('mdictionary.py', 'w') dict_list = module_dictionary.modules_dicts for line in tmlistfile: line = line.replace('\n','') new_dict = { 'OPCODE': line, 'NAME': 'null', # could ask for user input here ...
StarcoderdataPython
3554732
class Solution: def splitIntoFibonacci(self, S): """ :type S: str :rtype: List[int] """ def split_to_fib(i, j): "" a = S[:i] b = S[i:j] if self.valid(a) and self.valid(b): a, b = int(a), int(b) an...
StarcoderdataPython
8083740
from __future__ import print_function from mongoalchemy.py3compat import * from nose.tools import * from mongoalchemy.session import Session from mongoalchemy.document import Document, Index, FieldNotRetrieved from mongoalchemy.fields import * from mongoalchemy.query import BadQueryException, Query, BadResultException...
StarcoderdataPython
4864284
# -*- coding:utf-8 -*- f = open(r'stat_smoking.txt','r') #a = list(f) line = f.readline() # 读取第一行 print(line) tu = eval(line) #print(tu['ugcid']) url_list = [] while line: txt_data = eval(line) print(txt_data['ugcid']) url_list.append('https://kg.qq.com/node/play?s=' + txt_data['ugcid']) line = f.read...
StarcoderdataPython
6558902
from fastapi import APIRouter, HTTPException, BackgroundTasks from containers import Managers from domain.models.api_response import ApiResponse from domain.models.dataset_information import DatasetInformation from domain.exceptions.application_error import ApplicationError from domain.models.hyper_parameter_informatio...
StarcoderdataPython
3375809
<reponame>NikitaRastogi/handwritten import os import sys from PIL import Image if not os.path.exists('pages'): print('Creating pages folder') os.makedirs('pages') try: line_count = sys.argv[1] except IndexError: line_count = 20 def make_page(lines, count): images = [Image.open(i) for i in lin...
StarcoderdataPython
1866771
import pandas as pd movie = pd.read_csv('movie.csv') rating = pd.read_csv('rating.csv') df = movie.merge(rating, how="left", on="movieId") df['title'] = df.title.str.replace('(\(\d\d\d\d\))', '') df['title'] = df['title'].apply(lambda x: x.strip()) values_title = pd.DataFrame(df["title"].value_counts()) rare_movies =...
StarcoderdataPython
9778040
# coding: utf-8 """ This module gives some AvailSet class for constructing avail_set component. Also an abstract class is provided for customization. Developers are suggested to extend the class ``AvailSetABC`` and implements all its abstract methods. """ import abc class AvailSetABC: """ Abstract class fo...
StarcoderdataPython
5117527
import hashlib from django.contrib.auth.backends import ModelBackend from django.contrib.auth import get_user_model from django.core.exceptions import ObjectDoesNotExist def hash_token(plaintext): return hashlib.sha256(plaintext.encode('utf-8')).hexdigest() class TokenBackend(ModelBackend): def authenticate(...
StarcoderdataPython
6455847
<gh_stars>0 # Generated by Django 2.2 on 2019-05-12 14:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('moment', '0023_daily_story_file_status'), ] operations = [ migrations.AddField( model_name='daily_story_f...
StarcoderdataPython
4949119
<filename>ACI/aci_endpoints_with_vendor.py #!/usr/bin/env python # # # <NAME> 2018 # # APIC login username: mipetrin # APIC URL: https://10.66.80.242 # APIC Password: <PASSWORD> # """ Simple application to display details about endpoints """ import acitoolkit.acitoolkit as aci from tabulate import tabulate import reque...
StarcoderdataPython
3426432
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage from django.shortcuts import render from django.http import HttpResponse from tse_demo.settings import BASE_DIR import os from importcrdata.models import PatronElectoral,Distelec from . import forms import re # Create your views here. import loggi...
StarcoderdataPython
8178199
'''Homework 4, Computational Photonics, SS 2020: Fourier modal method. ''' import numpy as np from numpy.linalg import eig, solve from scipy.linalg import toeplitz from scipy.fftpack import fft from scipy.sparse import diags def fmm1d_te_layer_modes(perm, period, k_0, k_x, N, dtype=np.complex128): ''...
StarcoderdataPython
1805285
<reponame>CharlesZhong/Mobile-Celluar-Measure<gh_stars>0 # -*- coding: utf-8 -*- """ Copyright (c) 2011, <NAME> <<EMAIL>> 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 c...
StarcoderdataPython
1733519
""" @author: Heerozh (<NAME>) @copyright: Copyright 2019, Heerozh. All rights reserved. @license: Apache 2.0 @email: <EMAIL> """ from collections import defaultdict from typing import Dict import pandas as pd class Calendar: """ Usage: call build() first, get business day calendar. and manually add ho...
StarcoderdataPython
9796720
# 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 agreed to in writing, software # d...
StarcoderdataPython
4820462
#!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import datetime def countingSort(arr): ''' 计数排序: 桶排序的特殊情况, 将数据值的范围作为索引, 反过来进行排序 适合值的范围有限且均为正整数的数据 适用的实际情况:对考试分数排序 1. 非原地排序算法: 需要计数数组, 空间由值的范围确定,一般比较小 需要一个已排序数组, 长度与待排序数组一样, 空间复杂度为O(n) 2. 稳定的:从后向前遍历数组, 后面的元素, 仍然在后面 3. 时间复杂度...
StarcoderdataPython
9630290
<gh_stars>1-10 import numpy as np import argparse from .lib import get_attention parser = argparse.ArgumentParser('parameters') parser.add_argument('path', type=str) parser.add_argument('--test-iter', type=int, default=0) parser.add_argument('--layer', type=int, default=3) parser.add_argument('--block', type=int, def...
StarcoderdataPython
134177
########################################################################## # # Copyright (c) 2014, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistrib...
StarcoderdataPython
3303433
import re texto = """Olá Mundo! Meu nome é <NAME>. Meu numero é (011) 988255673 Meu E-mail é <EMAIL> """ Re_Padrao_Telefone = re.compile(r"\(\d{3}\)\s\d{9}") #Expreção que encontrara nosso numero Resultado = Re_Padrao_Telef...
StarcoderdataPython
3234268
<reponame>leolani/emissor import logging from glob import glob import os from pathlib import Path from types import MappingProxyType from typing import Iterable, Optional, Any, Union, Mapping, Dict, Tuple from emissor.representation.scenario import Scenario, Modality, Signal, AudioSignal, ImageSignal, TextSignal, Sce...
StarcoderdataPython
9654713
class Solution: def solve(self, n): ans = [] n = str(n).rjust(4,"0") ans.append("M"*int(n[0])) if n[1] == "9": ans.append("CM") elif n[1] == "4": ans.append("CD") elif n[1] >= "5": ans.append("D") ans.append("C"*(int(n...
StarcoderdataPython
8188823
<reponame>apcarrik/kaggle<filename>duke-cs671-fall21-coupon-recommendation/outputs/rules/RF/11_features/numtrees_30/rule_19.py<gh_stars>0 def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Age, obj[4]: Education, obj[5]: Occupation, obj[6]: Bar, obj[7]: Coffeehouse, obj[8]: Restaurant20to5...
StarcoderdataPython
3346866
import json import dash import dash_html_components as html from dash.dependencies import Input, Output import imageio from dash_slicer import VolumeSlicer app = dash.Dash(__name__, update_title=None) vol = imageio.volread("imageio:stent.npz") slicer = VolumeSlicer(app, vol) slicer.graph.config["scrollZoom"] = False...
StarcoderdataPython
4847421
''' Author: <NAME> Lang: python3 Github: https://www.github.com/ajaymahar YT: https://www.youtube.com/ajaymaharyt ''' class Sort: def __init__(self): """TODO: Docstring for __init__. :returns: TODO """ pass def partition(self, arr, start, end): """TO...
StarcoderdataPython
3259096
from pathlib import Path p = Path('rootfiles') print(p.is_dir()) # True print(p.is_file()) # False print(p.is_absolute()) # False print(p.resolve()) # /Users/yuto/VS/root_lecture/macros/hamada/rootfiles data1_path = p / 'data1.root' print(data1_path.as_posix()) # rootfiles/data1.root print(data1_path.name) # data1.ro...
StarcoderdataPython
12845546
from distutils.core import setup setup( author='<NAME>', author_email='<EMAIL>', url='https://github.com/mephizzle/python-funkyfunc', name='FunkyFunk', version='0.0.2-dev', packages=['funkyfunc'], license='Apache 2.0', long_description=open('README.txt').read(), )
StarcoderdataPython
53414
""" File: tools.py """ import random import time def getRandomList(n): """Returns a list of unique random numbers in the range 0..n-1""" items = list(range(n)) random.shuffle(items) return items def compare(titleList, functionList, sizeList, dataSet=lambda x: x, counter=None, compar...
StarcoderdataPython
67893
#!/usr/bin/env python # vim: set fileencoding=utf-8 : # <NAME> <<EMAIL>> # # Copyright (C) 2012-2014 Idiap Research Institute, Martigny, Switzerland # # 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 Software Foundat...
StarcoderdataPython
11322894
# Copyright 2018 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 agreed to in writing, soft...
StarcoderdataPython
8196080
import time from timeloop import Timeloop from datetime import timedelta tl = Timeloop() @tl.job(interval=timedelta(seconds=2)) def card_loop(): print ("checking...")
StarcoderdataPython
333973
from django.urls import path, include urlpatterns = [ path('halo/', include('halo.urls')), ]
StarcoderdataPython
5095750
# import files from mesh import MeshingAlg from findNearest import findNearest from redBalltracking import RedBall from faceDetector import FaceDetector from gazeBehaviour import GazeBehaviour # import necessary libraries from collections import deque import numpy as np import cv2 import csv import os import argparse i...
StarcoderdataPython
1673603
# Generated by Django 2.2.4 on 2019-08-09 14:10 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('movies', '0002_auto_20190809_1409'), ] operations = [ migrations.AlterField( model_name='movie', name='year', ...
StarcoderdataPython