id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
1897336
""" This module provides functions for transforming curves to different models. """ from public import public from sympy import FF, symbols, Poly from .coordinates import AffineCoordinateModel from .curve import EllipticCurve from .mod import Mod from .model import ShortWeierstrassModel, MontgomeryModel, TwistedEdward...
StarcoderdataPython
6497755
<gh_stars>0 import sys has_pytest = False #there is the difference between 1.3.4 and 2.0.2 versions #Since version 1.4, the testing tool "py.test" is part of its own pytest distribution. try: import pytest has_pytest = True except: try: import py except: raise NameError("No py.test runner found in sele...
StarcoderdataPython
222447
#!/usr/bin/env python import subprocess from pathlib import Path from os import chdir from sys import exit PARENT_DIR = Path(__file__).resolve().parent.parent EDGE_DIR = PARENT_DIR / 'edge' REQ_DIR = EDGE_DIR / 'requirements' # COMMANDS: # pipenv lock --requirements > requirements/base.txt # echo "-r base.txt" > requ...
StarcoderdataPython
3233158
<reponame>subwaymatch/leetcode<gh_stars>0 class Solution: def maxProfit(self, prices: List[int]) -> int: if len(prices) <= 1: return 0 # Build max_after array max_after = [0] * (len(prices) - 1) max_after[-1] = prices[-1] for idx in reversed(rang...
StarcoderdataPython
5054351
<gh_stars>1-10 import datetime as dt from ..models import CurrDataModel, HistDataModel from .taskManagement import createTasks, runTasks from .utils import fieldsConversion, tickersConversion, VndDate class Vnd: """ Wrapper class to handle inputs and present output """ def __init__(self, defaultForm...
StarcoderdataPython
1776141
<filename>python/kids/line.py import turtle tom = turtle.Turtle() tom.forward(50) turtle.done()
StarcoderdataPython
387582
<reponame>ohad83/pandas<filename>asv_bench/benchmarks/gil.py import numpy as np from pandas import DataFrame, Series, date_range, factorize, read_csv from pandas.core.algorithms import take_1d import pandas.util.testing as tm try: from pandas import ( rolling_median, rolling_mean, rolling_...
StarcoderdataPython
269187
#!/usr/bin/env python # -*- coding: utf-8 -*- """ AIM utility functions. """ # ---------------------------------------------------------------------------- # Imports # ---------------------------------------------------------------------------- # Standard library modules import base64 import pathlib from io import ...
StarcoderdataPython
1725335
""" This script serves to do recurrence analysis on the sv-gene pairs identified We do the following things: 1. From the top 100 of each SV type (so top 400), which genes are there? Which are the top 15 most recurrent? 2. For these genes, also check which other mutations are found in these genes in different...
StarcoderdataPython
4979861
import flask from flask.ext.classy import FlaskView, route, request from annotator_supreme.views.view_tools import * from annotator_supreme import app from annotator_supreme.controllers.dataset_controller import DatasetController from annotator_supreme.controllers.image_controller import ImageController from flask impo...
StarcoderdataPython
8119576
def get_value(hex_str, data): if hex_str[:2] == '01': end = 6 data['temp'] = int(hex_str[2:end], 16) / 10 hex_str = hex_str[end:] elif hex_str[:2] == '02': end = 4 data['humi'] = int(hex_str[2:end], 16) hex_str = hex_str[end:] elif hex_str[:2] == '04': ...
StarcoderdataPython
1603537
<reponame>rkingsbury/MPContribs # -*- coding: utf-8 -*- from hashlib import md5 from flask_mongoengine import DynamicDocument from mongoengine import signals, EmbeddedDocument from mongoengine.fields import StringField, ListField, IntField, EmbeddedDocumentField from mongoengine.queryset.manager import queryset_manager...
StarcoderdataPython
93740
import unittest import pytest import sys import time import hubcheck from webdav import WebdavClient from webdav.Connection import WebdavError,AuthorizationError pytestmark = [ pytest.mark.container, pytest.mark.webdav, pytest.mark.nightly, pytest.mark.reboot ...
StarcoderdataPython
3392935
""" Tests for the future.standard_library module """ from __future__ import absolute_import, print_function from future import standard_library from future import utils from future.tests.base import unittest, CodeHandler, expectedFailurePY2 import sys import tempfile import os import copy import textwrap from subproc...
StarcoderdataPython
4967444
<filename>uproot/behaviors/TParameter.py # BSD 3-Clause License; see https://github.com/scikit-hep/uproot4/blob/main/LICENSE """ This module defines the behavior of ``TParameter<T>``. """ from __future__ import absolute_import class TParameter_3c_boolean_3e_(object): """ Behaviors for ``TParameter<boolean>`...
StarcoderdataPython
1722562
<reponame>ezquire/python-challenges # Enter your code here. Read input from STDIN. Print output to STDOUT class TrieNode(): def __init__(self, char): self.character = char self.children = {} self.endOfWord = False def add(root, word): node = root for char in word: fo...
StarcoderdataPython
1828253
<filename>deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/check_api.py #!/usr/bin/python # # Copyright 2015 Mirantis, 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 Licen...
StarcoderdataPython
9706950
""" Qwiz Model unittests. """ from django.test import TestCase from django.core.exceptions import ValidationError from .models import Tag, Question, Room, Contestant class TagModelTests(TestCase): """ Tag Model test cases. """ def tearDown(self): """ Tag test teardown, removing all c...
StarcoderdataPython
1776402
file_name = "show_ver.out" with open(file_name, "r") as f: output = f.read() if 'Cisco' in output: print "Found Cisco string"
StarcoderdataPython
1725067
import numpy as np import pandas as pd import statsmodels.api as sm import statsmodels.formula.api as smf from stargazer.stargazer import Stargazer from IPython.core.display import HTML from IPython.core.interactiveshell import InteractiveShell from statsmodels.sandbox.regression.gmm import IV2SLS def create_table1...
StarcoderdataPython
6623082
import ntplib import time from ..plugins.base import BasePlugin from ..plugins.doctor import BaseExamination class DoctorTimePlugin(BasePlugin): """ Examinations to check the time on the docker server is roughly correct """ requires = ["doctor"] def load(self): self.add_catalog_item("do...
StarcoderdataPython
3211374
<filename>BRCA_6CNV_testRNA_update.py #june 2014 #determine most common copy number variants in a set of breast cancer patients import csv import math import numpy as np import scipy from scipy import stats import matplotlib.pyplot as plt import math import itertools from itertools import zip_longest import pandas as...
StarcoderdataPython
8148620
<filename>sfsuListings/createPost.py from flask import Flask, flash, redirect, render_template, request, session, abort, g, Blueprint, url_for import logging import base64 import datetime from flask_sqlalchemy import SQLAlchemy from sqlalchemy import DateTime from werkzeug.utils import secure_filename from pathlib imp...
StarcoderdataPython
6574961
<reponame>gglin001/popart # Copyright (c) 2018 Graphcore Ltd. All rights reserved. import sys import os import c10driver import popart import cmdline from popart.torch import torchwriter import torch import numpy as np args = cmdline.parse() nInChans = 3 nOutChans = 8 batchSize = 2 batchesPerStep = 4 anchors = { ...
StarcoderdataPython
11229240
from ._vsm import Vsm
StarcoderdataPython
11286948
# coding: utf-8 def test_Table(): from pycharmers.utils import Table, toBLUE table = Table(enable_colspan=True) table.set_cols([1,2,""], colname="id") table.set_cols([toBLUE("abc"), "", "de"], color="GREEN") table.show() # +----+-------+ # | id | col.2 | # +====+=======+ # | 1 | ...
StarcoderdataPython
6488770
import scrapy from bs4 import BeautifulSoup as bs from scrapy.crawler import CrawlerProcess from scrapy.utils.project import get_project_settings import requests import re #Replace this class spider(scrapy.Spider): def __init__(self): self.name = 'spider' self.allowed_domains = ['en.wikipedia.org'] api_url = 'h...
StarcoderdataPython
8073230
<reponame>hyperonecom/h1-client-python<gh_stars>0 """ HyperOne HyperOne API # noqa: E501 The version of the OpenAPI document: 0.1.0 Generated by: https://openapi-generator.tech """ import unittest import h1 from h1.api.iam_organisation_policy_api import IamOrganisationPolicyApi # noqa: E501 cla...
StarcoderdataPython
6649350
<reponame>ProgressBG-Python-Course/ProgressBG-VC2-Python def user_input(msg): try: usr_input = input(msg) return (usr_input, True) except: print("User Break - 'CTRL+D' is Disabled!!") return ("Not OK", False) # def user_input(msg): # usr_input = input(msg) # if len(usr_...
StarcoderdataPython
363882
import magenta def readfile(path): print("Reading file from " + path) file = open(path,"r") return 0
StarcoderdataPython
5121508
<filename>project6-hy/tests.py<gh_stars>0 from hashtable import Hashtable import time ########################### ########## Tests ########## ########################### some_words = [u'lewes', # => 5 u'mistranscribe', # => 13 u'outbleed', # => 8 u'abstemio...
StarcoderdataPython
3595031
<reponame>FlyingKiwiBird/AioCron import datetime import sys import asyncio sys.path.append("..") from CoroCron.Cron import Cron async def report_time(name="there"): print("Hi {}, it is now {}".format(name, datetime.datetime.now())) if __name__ == '__main__': mins = [x for x in range(0, 59) if x % 2 == 0] ...
StarcoderdataPython
3305977
from django.contrib import admin from .models import Disk, File, FileCopy, Oplog @admin.register(Disk) class DiskAdmin(admin.ModelAdmin): list_display = ('dev_name', 'mount_point', 'is_healthy') @admin.register(File) class FileAdmin(admin.ModelAdmin): list_display = ('__str__', 'size', 'readable_size') ...
StarcoderdataPython
4939929
<reponame>afterloe/LearnOpencv<gh_stars>1-10 #!/usr/bin/env python # coding=utf-8 from __future__ import division import cv2 import Adafruit_PCA9685 import time import numpy as np import threading pwm = Adafruit_PCA9685.PCA9685() pwm.set_pwm_freq(60) #pwm.set_pwm(0, 0, 320) #pwm.set_pwm(1, 0, 240) tim...
StarcoderdataPython
12864665
<reponame>EmmaAlexander/possum-tools #CASA script to create cutouts of fits cubes directoryA = '/Volumes/TARDIS/Work/askap/' directoryB = '/Volumes/NARNIA/pilot_cutouts/' import numpy as np sources=np.loadtxt('/Users/emma/GitHub/possum-tools/DataProcess/pilot_sources.txt',dtype='str') for i in range(0,sources.shape[...
StarcoderdataPython
5108860
<reponame>iconation/scorelib from iconsdk.builder.transaction_builder import DeployTransactionBuilder from tbears.libs.icon_integrate_test import IconIntegrateTestBase, SCORE_INSTALL_ADDRESS from iconsdk.libs.in_memory_zip import gen_deploy_data_content from iconsdk.signed_transaction import SignedTransaction from .uti...
StarcoderdataPython
1881689
import requests from bs4 import BeautifulSoup import re # Importing regular expression module import click import os @click.command() @click.option("--trending",is_flag=True,help='Gives the trending news topics!') @click.option("--read",is_flag=True,help='Reads you out trending news topics!') def cli(trending, read):...
StarcoderdataPython
4842578
"""Find the minimal frame pointer and stack pointer positions from a C6T VM logfile. This will be the lowest depth of the stack. """ from sys import argv from typing import Optional, Tuple def findmin(log: str, fieldpos: int) -> Optional[int]: """Splits and then finds minimum in given split index fieldpos. "...
StarcoderdataPython
8031892
# -*- coding: utf-8 -*- # File: develop.py # Copyright 2021 Dr. <NAME>. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
StarcoderdataPython
64218
<reponame>oswaldo-spadari/Python-Exec # Faça um Programa que peça as quatro notas de 10 alunos, # calcule e armazene num vetor a média de cada aluno, # imprima o número de alunos com média maior ou igual a 7.0. from random import randint boletim = [] alunos = {} notas = [] total = 0 for i in range(1, 11): alunos[...
StarcoderdataPython
3409827
<reponame>NeonOcean/Environment<gh_stars>1-10 import random from sims4.tuning.tunable import HasTunableFactory, AutoFactoryInit, TunablePercent import services class SetFireState(HasTunableFactory, AutoFactoryInit): FACTORY_TUNABLES = {'chance': TunablePercent(description='\n Chance that the fire will t...
StarcoderdataPython
11282047
<reponame>PCIHD/Project_Daydream from rest_framework import serializers from .models import Dream class Dream_serializer(serializers.ModelSerializer): class Meta: model = Dream fields = ['image']
StarcoderdataPython
1687125
<reponame>vt102/eosfactory<filename>pyteos/core/logger.py import enum import re import inspect from textwrap import dedent from termcolor import cprint, colored class Verbosity(enum.Enum): COMMENT = ['green', None, []] INFO = ['blue', None, []] TRACE = ['cyan', None, []] ERROR = ['red', None, ['revers...
StarcoderdataPython
3314563
<reponame>sebastian-software/jasy<filename>jasy/script/clean/Permutate.py<gh_stars>1-10 # # Jasy - Web Tooling Framework # Copyright 2010-2012 Zynga Inc. # Copyright 2013-2014 <NAME> # import jasy.script.parse.Parser as Parser import jasy.core.Console as Console from jasy.script.util import * def __translateToJS(co...
StarcoderdataPython
6572133
#!/usr/bin/python # import os import requests import codecs import logging import argparse import multiprocessing import time GROBID_SERVER = 'http://localhost:8081' GROBID_HANDLER = 'processFulltextDocument' DEFAULT_THREADS = multiprocessing.cpu_count() / 2; DEFAULT_TIMEOUT = 60 # timeout on connection after ...
StarcoderdataPython
3503675
import traceback from typing import ( Any, cast, Dict, Tuple, ) from norfs.fs.base import ( BaseFileSystem, FSObjectPath, FSObjectType, Path, ) class CopyError(Exception): pass class CopyFileSystemObject: _fs: BaseFileSystem _path: Path def __init__(self, fs: BaseF...
StarcoderdataPython
9610954
<reponame>Donglin-Wang2/panda-gym<gh_stars>100-1000 from panda_gym.envs.core import RobotTaskEnv from panda_gym.pybullet import PyBullet from panda_gym.envs.robots import Panda from panda_gym.envs.tasks import Push class PandaPushEnv(RobotTaskEnv): """Push task wih Panda robot. Args: render (bool, op...
StarcoderdataPython
11260230
<reponame>chanzuckerberg/dcp-prototype import unittest import anndata from backend.corpora.common.utils.color_conversion_utils import ( convert_color_to_hex_format, convert_anndata_category_colors_to_cxg_category_colors, ) from backend.corpora.common.utils.http_exceptions import ColorFormatException from test...
StarcoderdataPython
250672
from django.db import models # Create your models here. class TodoIem(models.Model): text = models.TextField(max_length=500) def __str__(self): return self.text
StarcoderdataPython
1961250
<reponame>bitcaster-io/bitcaster import logging from django.contrib import admin from django.contrib.auth.admin import UserAdmin as _UserAdmin from django.utils.translation import gettext_lazy as _ from ..models import ApiAuthToken, ApplicationTriggerKey, User from .forms import UserCreationForm from .inlines import ...
StarcoderdataPython
3371937
import logging import sentry_sdk import sentry_sdk.integrations.aiohttp import sentry_sdk.integrations.logging sentry_logging = sentry_sdk.integrations.logging.LoggingIntegration( level=logging.INFO, event_level=logging.ERROR ) def setup(server_version, dsn): sentry_sdk.init( dsn=dsn, integr...
StarcoderdataPython
11225089
from pubsub import pub from . import portnums_pb2, remote_hardware_pb2 def onGPIOreceive(packet, interface): """Callback for received GPIO responses FIXME figure out how to do closures with methods in python""" hw = packet["decoded"]["remotehw"] print(f'Received RemoteHardware typ={hw["typ"]}, gpio_...
StarcoderdataPython
3595172
import asyncio import datetime from app import app from app.tasks.task_utils import bind_to_service from app.tasks.build_tasks.create_services import create_services async def check_heartbeat(services_dict, timeout): """ Fetches all available services and binds to their ports in order to check if their are u...
StarcoderdataPython
198856
<filename>Roku Network Remote.indigoPlugin/Contents/Server Plugin/RPFramework/dataAccess/indigosql.py #! /usr/bin/env python #///////////////////////////////////////////////////////////////////////////////////////// #///////////////////////////////////////////////////////////////////////////////////////// # IndigoSql b...
StarcoderdataPython
1721719
"""Contains all exception classes used within this library.""" from abc import ABC from amplitude_python_sdk.common.models import BaseAPIError class AmplitudeAPIException(Exception, ABC): error: BaseAPIError def __init__(self, error: BaseAPIError): super().__init__() self.error = error
StarcoderdataPython
9715545
<reponame>csdms/dakotathon<filename>dakotathon/tests/test_responses_base.py<gh_stars>1-10 """Tests for the dakotathon.responses.base module.""" import os, sys from nose.tools import raises, assert_true, assert_false, assert_equal from dakotathon.responses.base import ResponsesBase descriptors = ["a", "b"] class Co...
StarcoderdataPython
3432599
print("hello, I am here to glucosify your life") print("The Potato lords will come for your soul")
StarcoderdataPython
8185868
from __future__ import print_function, division from sympy.core import Mul, sympify, Pow from sympy.strategies import unpack, flatten, condition, exhaust, do_one from sympy.matrices.expressions.matexpr import MatrixExpr, ShapeError def hadamard_product(*matrices): """ Return the elementwise (aka Hadamard) pr...
StarcoderdataPython
5117597
import winreg; from mWindowsSDK import *; gduHive_by_sName = { "HKCR": winreg.HKEY_CLASSES_ROOT, "HKEY_CLASSES_ROOT": winreg.HKEY_CLASSES_ROOT, "HKCU": winreg.HKEY_CURRENT_USER, "HKEY_CURRENT_USER": winreg.HKEY_CURRENT_USER, ...
StarcoderdataPython
4926837
# https://deeplearningcourses.com/c/data-science-natural-language-processing-in-python # https://www.udemy.com/data-science-natural-language-processing-in-python # Author: http://lazyprogrammer.me from __future__ import print_function, division from future.utils import iteritems from builtins import range # Note: you ...
StarcoderdataPython
6400982
import os import yaml from pathlib import Path from extract_data import extract from utils import run_process, is_truthy from settings import ( INPUT_PATH, NISMOD_PATH, RESULTS_PATH, model_to_run, part_of_sos_model, sector_model, timestep, use_generated_scenario, ) def extract_and_run(...
StarcoderdataPython
4962597
<reponame>mqadri93/leetCode-py<gh_stars>0 class Solution(object): def minCut(self, s): """ :type s: str :rtype: int """ def ispalendrome(s): h = len(s)-1 l = 0 while(l<=h): if s[h] != s[l]: return False ...
StarcoderdataPython
11349921
class Window: def __init__(self, size): self.window = [] self.size = size def gate_out(self, data): self.window.append(data) output = '' if self.size <= len(self.window): output = str(self.window) self.window = [] return output.encode('utf...
StarcoderdataPython
6455012
<reponame>PeerHerholz/guideline_jupyter_book<filename>venv/Lib/site-packages/nbdime/args.py # coding: utf-8 # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import argparse import json import logging import os import sys from ._version import __version__ from .conf...
StarcoderdataPython
5087036
<reponame>lifei96/Medium-crawler-with-data-parser # -*- coding: utf-8 -*- import urllib2 import cookielib import re import json import datetime import codecs import os class TopStories(object): def __init__(self): super(TopStories, self).__init__() self.data = { 'date': "", ...
StarcoderdataPython
3513297
<reponame>lilianwaweru/Blog from .import db from werkzeug.security import generate_password_hash,check_password_hash from flask_login import UserMixin from . import login_manager @login_manager.user_loader def load_user(user_id): return User.query.get(int(user_id)) class User(UserMixin,db.Model): __tablename...
StarcoderdataPython
1904797
<gh_stars>0 import luigi import gokart class inherits_config_params: def __init__(self, config_class: luigi.Config): self.config_class: luigi.Config = config_class def __call__(self, task: gokart.TaskOnKart): config_class = self.config_class # wrap task to prevent task name from bei...
StarcoderdataPython
3598899
<filename>maze/maze.py import random import numpy as np import matplotlib.pyplot as plt class Maze(object): def __init__(self, width = 10, height = 5): self.width = 2*width + 1 self.height = 2*height + 1 self.start = None self.end = None self.n_el = self.width * sel...
StarcoderdataPython
1837776
<filename>willie/modules/adminchannel.py # coding=utf8 """ admin.py - Willie Admin Module Copyright 2010-2011, <NAME>, <NAME>, and <NAME> Copyright © 2012, <NAME> <<EMAIL>> Licensed under the Eiffel Forum License 2. http://willie.dftba.net/ """ from __future__ import unicode_literals import re from willie.module imp...
StarcoderdataPython
5151895
from django.urls import include, path from wab.core.export_database.views import ExportPdfView, ExportExcelView, ExportTextView, DownloadFileExportViews, \ ProcessFileExportViews from wab.core.import_database.views import ImportCsvView from wab.core.views import ListOperatorView, ListJoinView, ListRelationView, Li...
StarcoderdataPython
104051
# Generated by Django 3.1.1 on 2020-10-16 09:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('info', '0013_auto_20201009_1912'), ] operations = [ migrations.AlterField( model_name='player', name='points_gained'...
StarcoderdataPython
3500748
<reponame>juxiangwu/image-processing """ Mani experimenting with facial information extraction. This module is used to sort the CK+ dataset. """ import glob from shutil import copyfile # No need to modify this one as it is a helper script. __version__ = "1.0, 01/04/2016" __author__ = "<NAME>, 2016" # Define emotion ...
StarcoderdataPython
1842152
<gh_stars>1-10 from auth import * from message import *
StarcoderdataPython
4815238
<filename>360agent/plugins/process.py #!/usr/bin/env python # -*- coding: utf-8 -*- import psutil import plugins import sys class Plugin(plugins.BasePlugin): __name__ = 'process' def run(self, *unused): process = [] for proc in psutil.process_iter(): try: pinfo = pr...
StarcoderdataPython
8152785
import numpy as np import torch COCO_JOINTS = { 'Right Ankle': 16, 'Right Knee': 14, 'Right Hip': 12, 'Left Hip': 11, 'Left Knee': 13, 'Left Ankle': 15, 'Right Wrist': 10, 'Right Elbow': 8, 'Right Shoulder': 6, 'Left Shoulder': 5, 'Left Elbow': 7, 'Left Wrist': 9, 'Right Ear': 4, 'Left Ear': 3, 'R...
StarcoderdataPython
11351053
<filename>fastflix/encoders/vceencc_avc/settings_panel.py # -*- coding: utf-8 -*- import logging from box import Box from qtpy import QtCore, QtWidgets, QtGui from fastflix.encoders.common.setting_panel import SettingPanel from fastflix.language import t from fastflix.models.encode import VCEEncCAVCSettings from fast...
StarcoderdataPython
5129615
<filename>pcdet/models/backbones_2d/unet.py import torch import torch.nn as nn import torch.nn.functional as F from ..model_utils.seg_loss import FocalLoss class DoubleConv(nn.Module): def __init__(self, in_ch, out_ch, bn=True): super(DoubleConv, self).__init__() if bn: self.conv = nn...
StarcoderdataPython
33398
<gh_stars>1-10 def preprocess(text): text=text.replace('\n', '\n\r') return text def getLetter(): return open("./input/letter.txt", "r").read()
StarcoderdataPython
3237442
import amplitf.interface as atfi import amplitf.likelihood as atfl from amplitf.phasespace.rectangular_phasespace import RectangularPhaseSpace from amplitf.phasespace.combined_phasespace import CombinedPhaseSpace import tfa.plotting as tfp import tfa.optimisation as tfo import tfa.rootio as tfr import tfa.toymc as t...
StarcoderdataPython
376850
<gh_stars>0 from .simple_json import simple_json_from_html_string from .simple_tree import simple_tree_from_html_string __all__ = [ 'simple_json_from_html_string', 'simple_tree_from_html_string', ]
StarcoderdataPython
191315
<reponame>beda-software/cookiecutter-beda-software-stack<filename>{{cookiecutter.project_slug}}/backend/app/gcs.py import datetime import urllib.parse from urllib.parse import urlparse from aiohttp import web from google.cloud import storage from app import config from app.sdk import sdk from app.contrib.google_cloud...
StarcoderdataPython
6551676
<filename>cloud_auto/utils.py<gh_stars>0 import os, socket, re def FileisExist(dirpath, tfilename): filenames = os.listdir(dirpath) for filename in filenames: if tfilename == filename: return True return False def chk_valid_ipv4(addr): try: socket.inet_aton(addr) r...
StarcoderdataPython
271680
# Generated by Django 2.1.3 on 2018-12-12 07:07 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Pizza', fields=[ ...
StarcoderdataPython
37632
<filename>datawinners/submission/request_processor.py import json import logging from django.conf import settings from datawinners.feeds.database import get_feeds_db_for_org from mangrove.transport import TransportInfo from datawinners.accountmanagement.models import TEST_REPORTER_MOBILE_NUMBER, OrganizationSetting fro...
StarcoderdataPython
6459206
<reponame>Lord-of-the-Galaxy/heroku-multi-account import os, sys, time import requests as req import psycopg2 from hma_conf import MASTER_APP, SLAVE_APP, PG_TABLES as TABLES # You shouldn't need to modify anything here DB_URL = os.environ['DATABASE_URL'] SLAVE_URL = f"http://{SLAVE_APP}.herokuapp.com" MASTER_API_...
StarcoderdataPython
6492867
<gh_stars>0 import networkx as nx import torch import matplotlib.pyplot as plt def visualize(h, G, color, epoch = None, loss = None): plt.figure(figsize=(7,7)) plt.xticks([]) plt.yticks([]) if torch.is_tensor(h): h = h.detach().cpu().numpy() plt.scatter(h[:, 0], h[:, 1], s=140, c=color,...
StarcoderdataPython
11274340
<gh_stars>0 #!/usr/bin/env python import urllib,urllib2,re,sys,os,cookielib cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) exheaders = [("User-Agent","Mozilla/4.0 (compatible; MSIE 7.1; Windows NT 5.1; SV1)"),] opener.addheaders=exheaders url_login = 'https://cs.login.cmu.edu...
StarcoderdataPython
9704871
<filename>test_async.py import asyncio from netmiko import ConnectHandler import getpass from pprint import pprint import ipdb import time device_dict = { 'cisco3': { # 'comment': 'Cisco IOS-XE', 'host': 'cisco3.lasthop.io', # 'snmp_port': 161, # 'ssh_port': 22, 'username': 'pyclass', 'passwor...
StarcoderdataPython
394297
<gh_stars>0 """ Helper functions for interacting with the shell, and consuming shell-style parameters provided in config files. """ import os import shlex import subprocess try: from shlex import quote except ImportError: from pipes import quote __all__ = ['WindowsParser', 'PosixParser', 'OpenVMSParser', 'Nati...
StarcoderdataPython
11280676
<reponame>Wirocama/Backend-Proyecto2-IPC1 from publicaciones import publicaciones import json class CRUD_PUBLICACIONES: def __init__(self): self.listaPublicaciones = [] self.listaCategorias = [] self.contador = 0 def agregarpublicacion(self,tipo,url,date,category,idU,usuario): ...
StarcoderdataPython
4896217
import feedparser import urllib2 from config_helper import get_proxies def get_rss_items(url): proxy=urllib2.ProxyHandler(get_proxies()) xmldata = feedparser.parse(url, handlers=[proxy]) return xmldata['entries']
StarcoderdataPython
3376749
from grid_world import standard_grid import numpy as np import sys def print_policy(P, title): print("---------------------------") print(title) for i in range(3): print("---------------------------") for j in range(4): a = P.get((i,j), ' ') print(" %s |" % a, en...
StarcoderdataPython
11382004
from simple_oauth import SimpleSession sess = SimpleSession( client_secrets_path='secrets/secret.json', scope=['https://www.googleapis.com/auth/drive.readonly'], cache="dict") file = sess.get_session().get('https://www.googleapis.com/drive/v3/files') print(file.json())
StarcoderdataPython
1618566
# coding: utf-8 """ OpenLattice API OpenLattice API # noqa: E501 The version of the OpenAPI document: 0.0.1 Contact: <EMAIL> Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import unittest import datetime import openlattice from openlattice.models.asso...
StarcoderdataPython
4827618
<gh_stars>1-10 class Grafo: def __init__(self, nome_arquivo): self.arestas = [] self.caminho = [] self.graus = [] self.n = 0 self.ler_arquivo(nome_arquivo) def ler_arquivo(self, nome_arquivo): arquivo = open(nome_arquivo, 'r') linha = arquivo.readline() ...
StarcoderdataPython
6632837
import dash import numpy as np from dash.dependencies import Input, Output, State from dash.exceptions import PreventUpdate from app import app, dbroot, logger from .multiplexer import MultiplexerOutput from .notifications import _prep_notification def _fill_annotation(adata, cluster_id, value): """ Set the ...
StarcoderdataPython
9688981
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 31 17:08:48 2021 @author: jstout """ from ..bstags import txt_to_tag from ..bstags import write_tagfile import pytest import os # ============================================================================= # Tests # =================...
StarcoderdataPython
3531359
# when comparing Python to Java. Python is far more verbose. Please see Verbosity.java for an example to compare the two dict = {"left": 1, "right": 2, "top": 3, "bottom": 4};
StarcoderdataPython
8179657
from django.contrib.auth.backends import BaseBackend from accounts.models import Customer, ServiceProvider class PhoneNumberPasswordBackend(BaseBackend): def authenticate(self, request, phone_number=None, password=None): try: customer = Customer.objects.get(phone_number=phone_number) ...
StarcoderdataPython
9626077
<reponame>Baughn/nixgan<filename>jax-diffusion/jax-guided-diffusion/diffusion_models/common.py import numpy as np import jax import jax.numpy as jnp import jax.scipy as jsp import jaxtorch from jaxtorch import PRNG, Context, Module, nn, init from dataclasses import dataclass from functools import partial import math #...
StarcoderdataPython