id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
4802577
<filename>tests/utils/factories.py import string from django.contrib.auth.models import User from cms.models import Placeholder from djangocms_versioning.models import Version from djangocms_versioning.test_utils.factories import ( AbstractVersionFactory, PageVersionFactory, ) import factory from djangocms_...
StarcoderdataPython
4835231
<gh_stars>0 #!/usr/bin/env python3 from dataclasses import dataclass from elftools.elf.elffile import ELFFile from elftools.elf.sections import Section, SymbolTableSection from typing import List, Tuple, Dict, Generator, Union, Set from collections import defaultdict import os, sys import json ## Configuration: # sec...
StarcoderdataPython
1843384
import json import os from nose.tools import * from lxml import etree as ET from mets_dnx import factory as mdf CURRENT_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__))) mets_dnx_nsmap = { 'mets': 'http://www.loc.gov/METS/', 'dnx': 'http://www.exlibrisgroup.com/dps/dnx' } def test_mets_dnx()...
StarcoderdataPython
9600816
# -*- coding: utf-8 -*- from app.constants import S_OK, S_ERR import random import math import base64 import time import ujson as json import pymongo from app.constants import * from app import cfg from app import util def g_taipei_city_dig_point_next_dig_point_handler(): db_results = util.db_find_it('roadDB', ...
StarcoderdataPython
1814835
<filename>sentinel_linear_search.py def sentinel_linear_search(sequence, target): sequence.append(target) index = 0 while sequence[index] != target: index += 1 sequence.pop() if index == len(sequence): return None return index if __name__ == "__main__": arr = [0...
StarcoderdataPython
5074682
# -*- coding: utf-8 -*- import json import unittest from mlcomp.report import Container, ReportObject, default_report_types class MyReport(ReportObject): def __init__(self, value): super(MyReport, self).__init__() self.value = value class MyTestCase(unittest.TestCase): def test_ChildrenFla...
StarcoderdataPython
9720126
<reponame>mabrahamdevops/python_notebooks import glob from ipywidgets import widgets import os import re import shutil from collections import defaultdict from IPython.core.display import HTML from IPython.display import display import pandas as pd import subprocess from __code.file_handler import make_ascii_file_from...
StarcoderdataPython
6470259
<filename>vine/updateLocal.py import option import os import grapeGit as git import grapeConfig import utility # update the repo from the remote using the PyGitUp module class UpdateLocal(option.Option): """ grape up Updates the current branch and any public branches. Usage: grape-up [--public=<branc...
StarcoderdataPython
1795740
<filename>desertbot/user.py<gh_stars>1-10 from typing import Optional class IRCUser(object): def __init__(self, nick: str, ident: Optional[str] = None, host: Optional[str] = None): self.nick = nick self.ident = ident self.host = host self.gecos = None self.server = None ...
StarcoderdataPython
6566299
<reponame>zvelo/zvelo-web-page-replay<gh_stars>1-10 #!/usr/bin/env python # Copyright 2010 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www...
StarcoderdataPython
1849267
<gh_stars>10-100 from django.contrib.auth import get_user_model from rest_framework import serializers User = get_user_model() class LoginUserSerializer(serializers.Serializer): """ used to serialize authentication request credentials """ email = serializers.EmailField(max_length=255, required=True) ...
StarcoderdataPython
6690187
<reponame>Biancaa-R/CompetitiveProgrammingQuestionBank #palindrome check loop method: #divide the string into 2 parts def palindrome(): value=input("Enter the word") value=value.lower() l=len(value) mid=l//2 rev=-1 for num in range(mid): if value[num]==value[rev]: ...
StarcoderdataPython
8193661
<reponame>data301-2020-winter1/course-project-solo_108<gh_stars>0 import json import pandas as pd import seaborn as sns def generate_players(matches_df): # Generate players from matches players = [] for _, match in matches_df.iterrows(): game_players = match['players'] for player in game_...
StarcoderdataPython
11379778
from .mtSC import * __version__ = '1.1'
StarcoderdataPython
1936422
<filename>melime/explainers/local_models/local_model_base.py from abc import ABC, abstractmethod import copy import numpy as np from sklearn.preprocessing import StandardScaler class LocalModelBase(ABC): """ Base class to implement the local models. """ def __init__( self, x_explain, ...
StarcoderdataPython
1868648
<gh_stars>1-10 from statistics import mean, stdev from pydes.core.metrics.accumulator import WelfordAccumulator from pydes.core.metrics.confidence_interval import get_interval_estimation from pydes.core.metrics.measurement import Measure class BatchedMeasure(Measure): """ A measure that has an instantaneous ...
StarcoderdataPython
4896776
<gh_stars>0 from collections import defaultdict, deque from typing import Deque, Dict, Iterator, List, Optional from ai_traineree.buffers import ReferenceBuffer from ai_traineree.types.state import BufferState from . import BufferBase, Experience class RolloutBuffer(BufferBase): type = "Rollout" def __ini...
StarcoderdataPython
4903805
# SPDX-FileCopyrightText: Copyright (c) 2021 <NAME> # # SPDX-License-Identifier: MIT """These tests are run with a sensor connected to confirm that the correct responses are received from the sensor. The try - except clauses and an if __name__ == "__main__" allow the code to be run with pytest on a Raspberry Pi or as ...
StarcoderdataPython
1952148
from django.urls import path, include from rest_framework.routers import DefaultRouter from api.search.application import views # Create a router and register our viewsets with it. router = DefaultRouter() router.register(r"search", views.ApplicationDocumentView, basename="application_search") urlpatterns = [ ...
StarcoderdataPython
1745102
''' Brian 2.0 ''' __docformat__ = "restructuredtext en" __version__ = '2.0dev' __release_date__ = 'notyet' # Check basic dependencies import sys missing = [] try: import numpy except ImportError as ex: sys.stderr.write('Importing numpy failed: %s\n' % ex) missing.append('numpy') try: ...
StarcoderdataPython
6523462
from django.conf import settings from business_register.models.company_models import CompanyType from data_converter.email_utils import send_template_mail def send_new_company_type_message(company_type: CompanyType): send_template_mail( to=settings.DEVELOPER_EMAILS, subject='Новий тип компанії до...
StarcoderdataPython
1953085
import seaborn as sns import matplotlib.pyplot as plt import numpy as np import sys from scipy import stats import matplotlib.cm as cm from decimal import Decimal # Parameters for finding K: MIN_CLUSTERS = 1 MAX_CLUSTERS = 10 N_REFS = 4 # (Optional) Colors used for the graphs. COLOR_PALETTE = ["#FFC107", "#1E88E5",...
StarcoderdataPython
11276970
<reponame>fresh-professor/DiverseCont from abc import ABC, abstractmethod import torch import torch.nn as nn import torch.nn.functional as F from utils import NTXentLoss, SelfSupTransform class Component(nn.Module, ABC): def __init__(self, config, feature_extractor: nn.Module): super().__init__()...
StarcoderdataPython
3317914
from gate.and_gate import And from gate.not_gate import Not from gate.or_gate import Or from multiplexer.multiplexer import Multiplexer class Mux2x1(Multiplexer): DEBUGMODE = False def __init__(self, inputs, selectors, name="Mux2x1"): super().__init__(inputs, selectors, name) def build(self): ...
StarcoderdataPython
3349154
# Copyright 2017 The Armada Authors. # # 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 w...
StarcoderdataPython
12845761
#!/bin/python import re import sys import os class Config: def __init__(self): options = self.__parseOptions() self.projectFileName = options.project self.sourcesPerFile = options.number self.mkFileName = options.makefile self.mkProjectFileName = options.mkproject self.destinationFolder = os.path.basen...
StarcoderdataPython
3535261
<filename>localstorage.py # https://stackabuse.com/saving-text-json-and-csv-to-a-file-in-python/ # https://www.programiz.com/python-programming/variables-constants-literals # https://pythonbasics.org/read-json-file/ # https://www.w3schools.com/python/python_try_except.asp import json import settings def save(url): ...
StarcoderdataPython
11207610
<filename>bul_cbp_app/settings_app.py # -*- coding: utf-8 -*- import json, os README_URL = os.environ['BUL_CBP__README_URL'] SUPER_USERS = json.loads( os.environ['BUL_CBP__SUPER_USERS_JSON'] ) STAFF_USERS = json.loads( os.environ['BUL_CBP__STAFF_USERS_JSON'] ) # can use admin STAFF_GROUP = os.environ['BUL_CBP__S...
StarcoderdataPython
1806745
''' Copyright (c) 2021, <NAME> Basic Triplet Network, slightly deeper and without dropout ''' import numpy as np import keras.backend as K from Models.Triplet.BaseTripletModel import BaseTripletModel from keras.layers import Input, Reshape, Dense, Flatten, concatenate from keras.layers import Activation, Conv2D, Ma...
StarcoderdataPython
8030010
import ctypes import os import time import cv2 def change_bg(image_path): SPI_SETDESKWALLPAPER = 20 ctypes.windll.user32.SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, image_path, 3) def show_video_bg(video): Cap = cv2.VideoCapture(video) while True: ret, frame = Cap.read() if ret i...
StarcoderdataPython
5084362
import re from bot.services.base.lookup_service import LookupService class PlayerService(LookupService): def __init__(self): super().__init__() def get_player_opgg_profile(self, message): profile_name = self.lookup(message) return self.base_url + profile_name
StarcoderdataPython
9698981
<filename>pj/study/urls.py from django.urls import path, include from . import views urlpatterns = [ path('question/<slug:kinds>', views.viewQuestion, name='question'), path('', views.StudyHome, name='study'), ]
StarcoderdataPython
4887990
#!/usr/bin/env python # -*- coding: UTF-8 -*- from obscmd.cmds.configure.cmd import ConfigureCommand from obscmd.cmds.obs.cmd import ObsCommand from obscmd.cmds.commands import HelpCommand cmd_table = { 'obs': ObsCommand, 'configure': ConfigureCommand, 'help': HelpCommand, }
StarcoderdataPython
11203434
load("//scala:scala.bzl", "scala_binary", "scala_library") load( "//scala:scala_cross_version.bzl", "default_maven_server_urls", ) load("//third_party/repositories:repositories.bzl", "repositories") def jmh_repositories( maven_servers = default_maven_server_urls(), overriden_artifacts = {}): ...
StarcoderdataPython
11247772
<filename>archivematica/microfilm-sips.py<gh_stars>10-100 # Prep digitized microfilm files for ingest into Archivematica import argparse import os from shutil import copy2 parser = argparse.ArgumentParser(description='Copies TIFF and PDF files.') parser.add_argument( 'sip_directory', help='Path to the directo...
StarcoderdataPython
3414013
<gh_stars>0 from __future__ import division, print_function import numpy as np import pandas as pd import matplotlib.pyplot as plt import progressbar from mlfromscratch.utils import train_test_split, standardize, to_categorical from mlfromscratch.utils import mean_squared_error, accuracy_score, Plot from mlfromscratch...
StarcoderdataPython
3554491
<filename>mecode/tests/test_scad.py #import sys #sys.path.append("..") import math import numpy as np import numpy.linalg as la import os from mecode import GMatrix #from matrix import GMatrix g = GMatrix() def angle(v1,v2): cosang = np.dot(v1,v2) sinang = la.norm(np.cross(v1,v2)) return np.arctan2(sinang...
StarcoderdataPython
3370675
<gh_stars>1-10 ''' Launches multiple simulations (simulation.py) in parallel. Each simulation is configured using command line arguments. Configurations are generated based on factor matrices. A factor matrix is specified by extending CommandBuilder and implementing all required methods. Parameters: [output file n...
StarcoderdataPython
82575
""" External repositories used in this workspace. """ load("@bazel_gazelle//:deps.bzl", "go_repository") def go_repositories(): go_repository( name = "co_honnef_go_tools", importpath = "honnef.co/go/tools", sum = "h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=", version = "v0.0.0-...
StarcoderdataPython
4908849
<gh_stars>0 #lang.py admins_ls = ['286381231', '773859044'] butt_main_get = 'Список объектов' butt_create = 'Создать' butt_free_key_list = 'Список свободных ключей' butt_key_list = 'Список всех ключей' butt_del_key = 'Удалить ключ' butt_choose_worker = 'Выбрать исполнителя' butt_back = 'Назад' butt_next = ...
StarcoderdataPython
1829080
# -*- coding: utf-8 -*- # Generated by Django 1.11.1 on 2017-05-17 15:14 from __future__ import unicode_literals from django.db import migrations, models import extensions.modelutils class Migration(migrations.Migration): dependencies = [ ('collector', '0002_auto_20170517_1440'), ] operations =...
StarcoderdataPython
3365872
class Customer: def __init__(self, name, last_name, email, interests): self.name = name, self.last_name = last_name, self.email = email, self.interests = interests # ------------setters-------------------------------------- def set_name(self, name): self.name = nam...
StarcoderdataPython
3301855
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <codecell> #!/usr/bin/env python # #The MIT CorrelX Correlator # #https://github.com/MITHaystack/CorrelX #Contact: <EMAIL> #Project leads: <NAME>, <NAME> Project developer: <NAME> # #Copyright 2017 MIT Haystack Observatory # #Permission is hereby granted, free of c...
StarcoderdataPython
71276
<filename>autotest/gcore/vsiaz.py #!/usr/bin/env pytest ############################################################################### # $Id$ # # Project: GDAL/OGR Test Suite # Purpose: Test /vsiaz # Author: <NAME> <even dot rouault at spatialys dot com> # ##########################################################...
StarcoderdataPython
8142215
<filename>graalpython/com.oracle.graal.python.test/src/tests/test_random.py # Copyright (c) 2018, Oracle and/or its affiliates. # Copyright (C) 1996-2017 Python Software Foundation # # Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 import unittest import random import time class TestBasicOps: de...
StarcoderdataPython
3314081
# Copyright 2020 DeepMind Technologies Limited. # # 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 ag...
StarcoderdataPython
3419
import pytest from duckql.properties import Null @pytest.fixture(scope="module") def valid_instance() -> Null: return Null() def test_string(valid_instance: Null): assert str(valid_instance) == 'NULL' def test_obj(valid_instance: Null): assert valid_instance.obj == 'properties.Null' def test_json_p...
StarcoderdataPython
4950200
# Mark the package as a namespace package. __import__('pkg_resources').declare_namespace(__name__)
StarcoderdataPython
316001
"""Test cases for the __main__ module.""" import responses from PIL import Image from .common import LEGEND_BDSA_URL, basemap_response, legend_response, station_response def test_script_succeeds(script_runner, tmp_path) -> None: with responses.RequestsMock() as rsps: rsps = station_response(rsps) ...
StarcoderdataPython
9657560
<gh_stars>1-10 # -*- coding: utf-8 -*- ''' Script file for the initialization and run of the differential evolution optimizer. ''' clear all import deopt F_VTR = -1000000 # "Value To Reach" (stop when ofunc < F_VTR) I_D = 5 # number of parameters of the objective function # FVr_minbound,FVr_maxbound vector of lo...
StarcoderdataPython
8197884
<filename>orderprocessing/constants/__init__.py from .global_constants import GlobalConstants
StarcoderdataPython
8147544
import os import shutil from distutils.dir_util import copy_tree from base import PaymentChannelBase # Use this recipe when checking out a tagged version locally and you wish to use it in your projects # on the stable channel. Source will be copied to cache from local folder # do not upload the recipie if you don't wa...
StarcoderdataPython
8138018
<filename>src/crumhorn/configuration/userdata.py # coding=utf-8 import base64 import itertools from crumhorn.platform.compatibility.gzip import compress def as_userdata_string(machine_configuration): return '\n'.join(itertools.chain(['#cloud-config'], _as_userdata_parts(machine_configuration))) def _titled_lis...
StarcoderdataPython
322969
<filename>terra/translate_tweets.py __author__ = 'robertk' def read_phrase(phrase_path, thresh=0.33): if phrase_path is None: return None phrase_table = dict() probs = dict() phrase_file = open(phrase_path) phrase_lines = phrase_file.readlines() for line in phrase_lines: data =...
StarcoderdataPython
3575347
<filename>flod_auth/app.py #!/usr/bin/env python # -*- coding: utf-8 -*- import os from logging import StreamHandler, INFO import copy from datetime import timedelta from flask import Flask from api.api_bootstrap import create_api from database import init_db import default_settings CFG_HOSTNAME = 'HOSTNAME' CFG_P...
StarcoderdataPython
6452060
''' XlPy/Spectra/parse __________________ Links the proper spectral scans file with the parsing engine, and intializes the parsers. :copyright: (c) 2015 The Regents of the University of California. :license: GNU GPL, see licenses/GNU GPLv3.txt for more details. ''' # load future from __future...
StarcoderdataPython
269037
<filename>common/configs/proxies.py # -*- coding: utf-8 -*- __author__ = 'yijingping' from .models import Proxy class MysqlProxyBackend(object): def __init__(self): proxy = Proxy.objects.filter(kind=Proxy.KIND_DOWNLOAD, status=Proxy.STATUS_SUCCESS).order_by('?').first() if proxy: self.u...
StarcoderdataPython
9707138
# -*- coding: utf-8 -*- import os import ctypes from threading import Thread import time import numpy as np import cv2 from mss import mss from win32api import GetSystemMetrics import config from repositories import detector_repo from repositories import fishing_repo from repositories import render_repo config.PID = ...
StarcoderdataPython
3314195
# Generated by Django 2.1.2 on 2018-12-06 13:32 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('partners', '0003_auto_20181206_1233'), ] operations = [ migrations.AlterField( model_name='partner', name='image_hei...
StarcoderdataPython
6441076
from steganograpy import decode_img decoded = decode_img('image.png') print(decoded)
StarcoderdataPython
5160724
<filename>tests/test_cli.py import plumes.cli as pc def test_check_config(): pc.check_config() def test_friends(): pc.friends(limit=10) def test_followers(): pc.followers(limit=10) def test_tweets(): pc.tweets(limit=10) def test_favorites(): pc.favorites(limit=10) def test_init(tmp_path)...
StarcoderdataPython
1881528
<filename>pipelineDealsWrapper/__init__.py import requests as rq from authenticator import pipelineDeals from objects import removeNonesDictionary from objects import pipelineDealsObject from objects import activities from objects import companies from objects import customFieldCompanyGroups from objects import customF...
StarcoderdataPython
3346742
import uuid from django.conf import settings from django.core.validators import FileExtensionValidator from django.db import models from apps.core.constants import MAX_DATASET_SIZE, MAX_TRAINING_COST from apps.core.models import Timestampable from .utils import file_directory_path from .validators import validate_si...
StarcoderdataPython
238119
<reponame>yonradz/sirwalter<filename>oh.py #!/usr/bin/env python print "Oh Hello there!"
StarcoderdataPython
9717348
<reponame>pn11/benkyokai S = input() l = len(S) min_ = 753 for i in range(l-2): number = int(S[i]) * 100 + int(S[i+1])*10 + int(S[i+2]) min_ = min(abs(number-753), min_) print(min_)
StarcoderdataPython
1669446
<gh_stars>0 # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render from django.http import JsonResponse # import all api models from api.models import * #for django rest framework from django.contrib.auth.models import User, Group from rest_framework import viewsets, filt...
StarcoderdataPython
3385331
<filename>fs/base.py """ fs.base ======== PyFilesystem base class """ from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import abc import os import threading import time from functools import partial from contextlib import closing import itertools...
StarcoderdataPython
1721204
from setuptools import setup setup( name='htchirp', version='1.0', description='Pure Python Chirp client for HTCondor', keywords='htcondor chirp', url='https://github.com/htcondor/htchirp', author='<NAME>', author_email='<EMAIL>', license='ASL 2.0', packages=['htchirp'], zip_saf...
StarcoderdataPython
8102516
import sys def main(filepath): with open(filepath, 'r') as f: for line in f.readlines(): if line: line = line.strip() for char in line: if line.count(char) == 1: print char break ...
StarcoderdataPython
11273146
<gh_stars>10-100 ## This file imports items from the wx package into the wxPython package for ## backwards compatibility. Some names will also have a 'wx' added on if ## that is how they used to be named in the old wxPython package. import wx.lib.colourdb __doc__ = wx.lib.colourdb.__doc__ getColourInfoList = wx.li...
StarcoderdataPython
1854047
from pydantic import BaseModel class EncryptionKey(BaseModel): kms_key_id: str alias: str
StarcoderdataPython
4924373
<reponame>advanced-security/codeql-queries import os import sys import argparse # os i1 = os.environ["INPUT"] i2 = os.environ.get("INPUT2") i3 = os.environ.get("INPUT3", "default") # sys i4 = sys.argv[1] # input i5 = input("INPUT5: ") # argparse parser = argparse.ArgumentParser() parser.add_argument("-i", "--input...
StarcoderdataPython
3286697
#!/usr/bin/env python # encoding: utf-8 from setuptools import setup import illumiprocessor setup( name="illumiprocessor", version=illumiprocessor.__version__, description="Automated Illumina read trimming using trimmomatic", url="https://github.com/faircloth-lab/illumiprocessor", author="<NAME>",...
StarcoderdataPython
6490202
<filename>advanced/part10-08_simple_date/src/simple_date.py # TEE RATKAISUSI TÄHÄN: class SimpleDate: def __init__(self, date: int, month: int, year: int): self.date = date self.month = month self.year = year def __str__(self) -> str: return f"{self.date}.{self.month}.{self...
StarcoderdataPython
1771142
<reponame>avanwinkle/mpf-examples from mpfmc.core.scriptlet import Scriptlet class DemoDriver(Scriptlet): def on_load(self): self.current_slide_index = 1 self.total_slides = 30 self.mc.demo_driver = self self.mc.events.add_handler('next_slide', self.next_slide) self.mc.ev...
StarcoderdataPython
139246
# Generated by Django 3.2.5 on 2021-07-08 20:09 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('circle', '0008_auto_20210708_2008'), ] operations = [ migrations.AlterField( model_name='messag...
StarcoderdataPython
3377596
#!/usr/bin/env python # # Copyright 2014 cloudysunny14. # # 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...
StarcoderdataPython
3474887
#!/usr/bin/env python """ Squidpeek - Per-URL Squid Logfile Metrics <NAME> <<EMAIL>> """ __license__ = """ Copyright (c) 2006-2013 <NAME> <<EMAIL>> 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 Softwa...
StarcoderdataPython
8198243
<reponame>Abdulhalik/T3-Python-Egitimi # coding=utf-8 from Orta import ortalama # Orta kütüphanesinden metot import ettik myList = [] deger = int(input("Ogrenci adeti giriniz: ")) while deger != 0: notlar = int(input("not giriniz: ")) myList.append(notlar) deger = deger - 1 print("ortalama: ", ortalama(...
StarcoderdataPython
4820603
import ctypes import random from DAD.DAD import DAD from Mocks.Mitsuba import Mitsuba from Mocks.Proton1 import Proton1 from Mocks.Orion import Orion from Mocks.Steering import AuxSteering import time import threading # Configure DAD board to emmulate the CAN bus emulator = DAD() emulator.CAN_init(baudRate=500e3) # Tu...
StarcoderdataPython
4830592
<gh_stars>0 # code from https://jvns.ca/blog/2021/09/10/hashmaps-make-things-fast/ import sys def quadratic_intersection(l1, l2): """ getting the intersection of 2 lists of numbers e.g. intersect([1, 2, 3], [2, 4, 5]) returns 2 """ result = [] for x in l1: for y in l2: ...
StarcoderdataPython
1913686
<reponame>mementum/brython import re from browser import html letters = 'abcdefghijklmnopqrstuvwxyz' letters += letters.upper()+'_' digits = '0123456789' builtin_funcs = """abs|dict|help|min|setattr| all|dir|hex|next|slice| any|divmod|id|object|sorted| ascii|enumerate|input|oct|staticmethod| bin|eval|int|open|str| b...
StarcoderdataPython
11216195
<reponame>mactanxin/leetcodeblog #!/usr/bin/env python # -*- coding: utf-8 -*- def get_client_ip(request): x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR') if x_forwarded_for: ip = x_forwarded_for.split(',')[0] else: ip = request.META.get('REMOTE_ADDR') return ip def get_la...
StarcoderdataPython
183510
#!/usr/bin/python3 import os import sys # Checking for puremagic try: import puremagic as pr except: print("Error: >puremagic< module not found.") sys.exit(1) # Checking for colorama try: from colorama import Fore, Style except: print("Error: >colorama< not found.") sys.exit(1) # Checking fo...
StarcoderdataPython
11335077
from django import forms from.models import PatientMedicalRecord class MedicalRecordForm(forms.ModelForm): """A form for creating patient medical records """ class Meta: model = PatientMedicalRecord fields = ('first_name', 'surname', 'next_kin', 'start_date', 'allegie...
StarcoderdataPython
5014786
# -*- coding: utf-8 -*- from collections import Counter import pytest import numpy from eznlp.io import ConllIO, PostIO class TestConllIO(object): """ References ---------- [1] Huang et al. 2015. Bidirectional LSTM-CRF models for sequence tagging. [2] <NAME>. 2016. Named entity recognition with ...
StarcoderdataPython
4967958
<reponame>adamstauffer/reactiontime from flask import ( current_app, g, request, redirect, url_for, render_template, flash, abort, ) from flask.ext.babel import gettext from flask.ext.login import login_required, current_user from app.user.models import User from ..timetrial import timetrial import flask_sijax cl...
StarcoderdataPython
3451383
# DO NOT EDIT: File is generated by code generator. from pokepay_partner_python_sdk.pokepay.response.response import PokepayResponse class CashtrayAttempt(PokepayResponse): def __init__(self, response, response_body): super().__init__(response, response_body) self.account = response_body['account...
StarcoderdataPython
3306716
"""A CLI program for interacting with proquints.""" import argparse from secrets import randbits import uuid from proquint import Proquint parser = argparse.ArgumentParser() g = parser.add_mutually_exclusive_group() g.add_argument("-g", "--generate", dest="generate", default=False, action="store_true") g.add_argume...
StarcoderdataPython
11361898
import random import torch import os from concurrent.futures import ProcessPoolExecutor from tqdm import tqdm from note_seq.protobuf.music_pb2 import NoteSequence def load_sequence(fname): with open(fname, 'rb') as f: ns = NoteSequence() ns.ParseFromString(f.read()) # type: ignore return ...
StarcoderdataPython
6461871
"""uRLs base """ # Django Library from django.urls import path # Localfolder Library from ..views.cron import ( CronCreateView, CronDeleteView, CronDetailView, CronListView, CronUpdateView) app_name = 'PyCron' urlpatterns = [ path('', CronListView.as_view(), name='list'), path('add/', CronCreateView....
StarcoderdataPython
6548993
<filename>setup.py """Setup file for PermutationImportance""" from setuptools import setup with open("README.md", "r") as fh: long_description = fh.read() PACKAGE_NAMES = ['PermutationImportance'] KEYWORDS = [ 'predictor importance', 'variable importance', 'model evaluation'] SHORT_DESCRIPTION = ( 'Impor...
StarcoderdataPython
8034487
<filename>lib/python2.7/site-packages/pyscope/multicall.py #!/usr/bin/env python ''' Mix this class in with yours to give the ability to make multiple calls with one function call. Optionally, you can define the methods initMultiCall and finalizeMultiCall to be called before and after the sequence of individual calls....
StarcoderdataPython
218494
from copy import deepcopy import matplotlib.pyplot as plt import numpy as np import wandb from src.utils.threshold import * from scipy.stats import norm from sklearn.calibration import calibration_curve from sklearn.metrics import (auc, average_precision_score, det_curve, matthews_corrcoef...
StarcoderdataPython
6533869
<reponame>moisesmayet/ovu from django.apps import AppConfig class CoreConfig(AppConfig): name = 'ovu.core'
StarcoderdataPython
3565126
<gh_stars>0 # © 2019, <NAME>, all rights reserved import random art = ''' ____ ,dP9CGG88@b, ,IP _ Y888@@b, dIi (_) G8888@b dCII (_) G8888@@b GCCIi ,GG8888@@@ GGCCCCCCCGGG88888@@@ GGGGCCCGGGG88888@@@@... Y8GGGGGG8888888@@@@P..... Y88888888888@@@@@P...... `Y8888888@@@@@@@P'...... `@@@@...
StarcoderdataPython
119621
<reponame>zhiqiang-hu/bl_iot_sdk<filename>toolchain/riscv/MSYS/python/Lib/symbol.py #! /usr/bin/env python3 """Non-terminal symbols of Python grammar (from "graminit.h").""" # This file is automatically generated; please don't muck it up! # # To update the symbols in this file, 'cd' to the top directory of #...
StarcoderdataPython
4811042
# MLP for Pima Indians Dataset with grid search via sklearn from keras.models import Sequential from keras.layers import Dense, Dropout from keras.wrappers.scikit_learn import KerasClassifier from sklearn.model_selection import GridSearchCV import numpy # Function to create model, required for KerasClassifier def crea...
StarcoderdataPython
6660633
import sys class intermediate_from_subdir1: print('Hi, this is intermediate_from_subdir1 FILE')
StarcoderdataPython
3577504
<gh_stars>0 # coding: utf-8 import dateutil.parser import datetime from pycti.utils.constants import CustomProperties from pycti.utils.opencti_stix2 import SPEC_VERSION class StixSighting: def __init__(self, opencti): self.opencti = opencti self.properties = """ id stix_id...
StarcoderdataPython