id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
8193844
<reponame>s2t2/tweet-analyzer-py # # A NEAR REPLICA OF BOTCODE VERSION 2 (SEE THE "START" DIR) # import math from collections import defaultdict from operator import itemgetter import time from datetime import datetime import numpy as np import networkx as nx ########################################################...
StarcoderdataPython
1731127
<reponame>pbarton666/virtual_classroom<filename>dkr-py310/docker-student-portal-310/course_files/experimental/py_profile_1.py try: import cProfile as profiler except: import profile as profiler def fib(n): # from http://en.literateprograms.org/Fibonacci_numbers_(Python) if n == 0: return 0 ...
StarcoderdataPython
9723909
#!/usr/bin/env python3 # coding=utf-8 """ Parser that uses the ELEXON API to return the following data types. Production Exchanges Documentation: https://www.elexon.co.uk/wp-content/uploads/2017/06/ bmrs_api_data_push_user_guide_v1.1.pdf """ import os import arrow import logging import requests import datetime as d...
StarcoderdataPython
11209019
# -*- coding:utf-8 -*- from __future__ import unicode_literals import unittest from statik.common import ContentLoadable from statik.markdown_config import MarkdownConfig TEST_MARKDOWN_CONTENT = """--- title: This is a “title” with some non-standard characters --- This is the “Markdown” body with some other non-st...
StarcoderdataPython
9632372
""" settings.py Configuration for Flask app Important: Place your keys in the secret_keys.py module, which should be kept out of version control. """ from google.appengine.api import app_identity import os from secret_keys import * DEBUG_MODE = False # Auto-set debug mode based on App Engine dev env...
StarcoderdataPython
3484820
<reponame>RnoldR/multi_gpu<gh_stars>1-10 """ This module prepares midi file data and feeds it to the neural network for training """ import sys import json import yaml import time import h5py import random import numpy as np import pandas as pd from sklearn.model_selection import train_test_split import keras from kera...
StarcoderdataPython
11366939
<filename>codenames/preprocessing/preprocessor.py from typing import List, TypeVar, Tuple from numpy import ndarray T = TypeVar('T') def flatten(nested_list: List[List[T]]) -> List[T]: return [item for sublist in nested_list for item in sublist] class Preprocessor: def process(self, image: ndarray) -> Lis...
StarcoderdataPython
6463918
<filename>webhook/admin.py # Copyright 2004-present, Facebook. All Rights Reserved. from django.contrib import admin from .models import WebhookNotification admin.site.register(WebhookNotification)
StarcoderdataPython
6591045
from enum import Enum class Category(Enum): GUIDE = 1 CULTURE = 2 EXERCISES = 3
StarcoderdataPython
199092
<filename>botengine/QueryMessage.py import json import requests class Message(object): """ Message request classes Send simple text queries. """ @property def query(self): """ Query parameter can be a string Default equal None, The user should fill this...
StarcoderdataPython
12802977
<gh_stars>1000+ # Copyright 2019 The flink-ai-extended Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
StarcoderdataPython
3527264
<reponame>EhrmannGit/lingvodoc<gh_stars>1-10 from lingvodoc.scripts.dictionary_dialeqt_converter import convert_all from lingvodoc.queue.celery import celery @celery.task def async_convert_dictionary_new(dictionary_client_id, dictionary_object_id, blob_c...
StarcoderdataPython
11353649
<reponame>afaucon/pywindrvmap<filename>windrvmap/__init__.py from .__info__ import __package_name__ from .__info__ import __description__ from .__info__ import __url__ from .__info__ import __version__ from .__info__ import __author__ from .__info__ import __author_email__ from .__info__ import __license__ from .__info...
StarcoderdataPython
3457284
from App.Routes.auth import r_auth from App.Routes.my_profile import my_profile from App.Routes.main import r_main from App.Routes.hosting_services import r_hostingservices from App.Routes.server_managetment import r_servermanagment def registerRoutes(app): app.registerBlueprint(r_auth) app.registerBlueprint(...
StarcoderdataPython
9619401
<filename>tator/transcode/make_thumbnails.py<gh_stars>1-10 #!/usr/bin/env python import argparse import subprocess import os import json import logging import tempfile from PIL import Image from ..util import get_api from ..util._upload_file import _upload_file from .transcode import get_length_info from ..openapi....
StarcoderdataPython
11270414
r""" Affine factorization crystal of type `A` """ #***************************************************************************** # Copyright (C) 2014 <NAME> <anne at math.ucdavis.edu> # # Distributed under the terms of the GNU General Public License (GPL) # http://www.gnu.org/licenses/ #*************...
StarcoderdataPython
4805110
from table import TableUtil import json class NormaliseKraken(): NO_EVENTS = {"lob_events": [], "market_orders": []} ACTIVE_BID_LEVELS = set() ACTIVE_ASK_LEVELS = set() QUOTE_NO = 2 EVENT_NO = 0 ORDER_ID = 0 def __init__(self): # Useful utility functions for quickly creating table ...
StarcoderdataPython
4831541
#!/usr/bin/env python3 from pathlib import Path import numpy as np import pandas as pd import matplotlib.pyplot as plt import subprocess results_dir = Path.cwd() / "example_output" / "data" / "out" def get_airfoil() -> pd.DataFrame: foil_geom_path = results_dir / "airfoil.csv" df = pd.read_csv(foil_geom_path...
StarcoderdataPython
6411659
<filename>tests/test_decorator.py import unittest import unishark import time from unishark.exception import MultipleErrors class DecoratorTestCase(unittest.TestCase): def test_data_driven_json_style(self): @unishark.data_driven(*[{'a': 1, 'b': 2, 'sum': 3}, {'a': 3, 'b': 4, 'sum': 7}]) def mock_t...
StarcoderdataPython
11267460
from colors import Colors class ActionException(Exception): pass class Action: def __init__(self, player, tile): self.player = player self.tile = tile def perform(self): raise NotImplemented class Move(Action): def perform(self): try: self.player.move(s...
StarcoderdataPython
48389
""" Test for act helpers """ import pytest import act.api def test_add_uri_fqdn() -> None: # type: ignore """ Test for extraction of facts from uri with fqdn """ api = act.api.Act("", None, "error") uri = "http://www.mnemonic.no/home" facts = act.api.helpers.uri_facts(api, uri) assert len(fac...
StarcoderdataPython
4819712
<filename>motivation/calc_dedup.py """Takes in the paths of two directories and reads all dump files. Computes md5 hashes of the dumped pages and performs analysis""" import os import sys import hashlib def compute_hash(chunk): hash_obj = hashlib.sha1(chunk) hash = hash_obj.hexdigest() return hash def g...
StarcoderdataPython
6624899
<reponame>timgates42/PokemonGo-Bot from __future__ import print_function import os import sys import importlib import re import requests import zipfile import shutil class PluginLoader(object): folder_cache = [] def _get_correct_path(self, path): extension = os.path.splitext(path)[1] if extension == '.zi...
StarcoderdataPython
11234303
<reponame>granitecrow/OpenCV-Exploration<filename>faces.py import cv2 as cv import numpy as np faceCascade = cv.CascadeClassifier("Resources/haarcascade_frontalface_default.xml") img = cv.imread("Resources/lena.png") imgGray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) faces = faceCascade.detectMultiScale(imgGray, 1.1, 4) ...
StarcoderdataPython
3433813
"""Implementations of various mixture models.""" import abc import numpy as np import torch from torch import nn from torch import distributions import torch.nn.functional as F from pytorch_generative.models import base class MixtureModel(base.GenerativeModel): """Base class inherited by all mixture models in p...
StarcoderdataPython
3228223
<gh_stars>1-10 """hearthstone_api.py file.""" from .hearthstone_game_data_api import HearthstoneGameDataApi class HearthstoneApi: """Hearthstone API class. Attributes: client_id: A string client id supplied by Blizzard. client_secret: A string client secret supplied by Blizzard. """ ...
StarcoderdataPython
8122744
'''Python Script to check image size and resize if any or both of the dimensions is bigger than 1080. This job will replace the old image by the new resized image''' # importing libraries import os from PIL import Image def image_resize(image_file): ''' Check image width and height. If width or/and height are bigg...
StarcoderdataPython
11238273
<reponame>dutradda/sqldataclass import itertools import asynctest import pytest from dbdaora import GeoSpatialQuery from dbdaora.exceptions import EntityNotFoundError @pytest.mark.asyncio async def test_should_get_from_memory( repository, serialized_fake_entity, fake_entity ): await repository.memory_data_s...
StarcoderdataPython
92572
<filename>python/dxa/__init__.py # # DX Library # packaging file # __init__.py # import numpy as np import pandas as pd import datetime as dt # frame from get_year_deltas import get_year_deltas from constant_short_rate import constant_short_rate from market_environment import market_environment from plot_option_stats ...
StarcoderdataPython
3440186
<filename>general/messages.py def help(): msg = """\n**Commands:**\n files -> Displays files options menu\n help -> Displays commands list\n""" return msg def welcome(): msg = "Welcome to GWEN!" print(msg)
StarcoderdataPython
3422777
<filename>simpleAPI/api/v1/serializers.py from django.contrib.auth import get_user_model from rest_framework import serializers from companys.models import Company, News from users.models import Profile User = get_user_model() class NewsSerializer(serializers.ModelSerializer): class Meta: model = News ...
StarcoderdataPython
6498579
<filename>ab_iface.py """ * Copyright © 2020 drewg3r * https://github.com/drewg3r/DM-2 Interface for 'about' window. """ from PyQt5 import QtWidgets import interface from interface.about import Ui_Form class MyFormAbout(QtWidgets.QMainWindow, interface.about.Ui_Form): def __init__(self): super().__ini...
StarcoderdataPython
3512567
""" for bitFlyer """ import pybitflyer import pandas as pd from selenium.webdriver.chrome.options import Options from bs4 import BeautifulSoup from .handler import InvestmentTrustSiteHandler class bitFlyerHandler(InvestmentTrustSiteHandler): """ bitFlyerHandler is a handler for bitFlyer """ __url_hom...
StarcoderdataPython
1774313
"""Brachistochrone example.""" from math import pi ocp = beluga.OCP('missle') # Define independent variables ocp.independent('t', 's') # Define equations of motion ocp.state('n', 'V*cos(psi)*cos(gam)', 'm') \ .state('e', 'V*sin(psi)*cos(gam)', 'm') \ .state('d', '-V*sin(gam)', 'm') \ .state('psi', 'g*tan...
StarcoderdataPython
1630883
<reponame>kristoffer-paulsson/bible-analyzer # # Copyright (c) 2021 by <NAME> <<EMAIL>>. # # Permission to use, copy, modify, and/or distribute this software for any purpose with # or without fee is hereby granted, provided that the above copyright notice and this # permission notice appear in all copies. # # THE SOFTW...
StarcoderdataPython
8000020
<reponame>Daymorn/StealthUO-Scripts from __future__ import division import datetime as _datetime import struct as _struct import time as _time from os import linesep as _linesep from ._datatypes import * from ._protocol import EVENTS_NAMES as _EVENTS_NAMES from ._protocol import ScriptMethod as _ScriptMethod from ._...
StarcoderdataPython
172009
#!/bin/python # Python 2.7 import os stage = (os.getenv("STAGE") or "development").upper() output = "We're running in %s" % stage if stage.startswith("PROD"): output = "DANGER!!! - " + output print(output)
StarcoderdataPython
3485874
<gh_stars>10-100 from moocng.http.exceptions import Http410 from moocng.http.middleware import HttpErrorCaptureMiddleware
StarcoderdataPython
107991
import fiona import numpy as np import pandas as pd import geopandas as gpd import geojson from shapely.geometry import Point, LineString from six import iteritems from six.moves import reduce from itertools import chain, count, permutations import os, sys type_map = dict(MultiLineString="LineString", ...
StarcoderdataPython
8007944
import asyncio import aiohttp import json import math from server import lamps from server import configuration from server.log import log class LeagueApi: """ League of Legends active game API. """ url = 'https://127.0.0.1:2999/liveclientdata/activeplayer' loop = None def __init__(self, loop): self.health = 1...
StarcoderdataPython
6416798
<gh_stars>0 """It’s easy to modify the code for creating k-fold cross-validation to create stratified k-folds. We are only changing from model_selection.KFold to model_selection.StratifiedKFold and in the kf.split(...) function, we specify the target column on which we want to stratify. We assume that our CSV dat...
StarcoderdataPython
234263
default_app_config = 'addons.s3compatb3.apps.S3CompatB3AddonAppConfig'
StarcoderdataPython
8190249
class DUNet(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, filters=[16, 32, 64], layers=3, weight_norm=True, batch_norm=True, activation=nn.ReLU, final_activation=None): super().__init__() assert len(filters) > 0 self.final_activation = final_activ...
StarcoderdataPython
1918627
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import bme280 import smbus2 DEFAULT_ADDRESS = 0x76 DEFAULT_PORT = 1 def to_str(data): return "{},{},{}".format(round(data.temperature), round(data.humidity), round(data.pressure)) def main(): ...
StarcoderdataPython
3252146
<reponame>impastasyndrome/DS-ALGO-OFFICIAL class Solution: def convertToTitle(self, n): """ :type n: int :rtype: str """ result, start = "", ord("A") while n > 0: result, n = chr((n - 1) % 26 + start) + result, (n - 1) // 26 return result
StarcoderdataPython
327078
import math from math import cos, fabs, radians, sin, sqrt import hypothesis.strategies as st import pytest # type: ignore from hypothesis import assume, example, given, note from ppb_vector import Vector from utils import angle_isclose, angles, floats, isclose, vectors data_exact = [ (Vector(1, 1), -90, Vecto...
StarcoderdataPython
5080254
<filename>lib/dramatis/runtime/actor/actor.py<gh_stars>1-10 from __future__ import with_statement from logging import warning from threading import Lock from threading import currentThread from sys import exc_info from traceback import print_exc import dramatis import dramatis.runtime class Actor(object): def ...
StarcoderdataPython
3285495
<filename>project/aat/migrations/0003_auto_20170914_1537.py # -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-09-14 15:37 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('aat', '0002_recognizerpretrained...
StarcoderdataPython
8056405
<gh_stars>0 ''' @Author: ConghaoWong @Date: 2019-12-20 09:38:24 LastEditors: <NAME> LastEditTime: 2020-09-16 16:31:38 @Description: main of Erina ''' import argparse import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # 去除TF输出 import time import numpy as np import tensorflow as tf from matplotlib.axes._axes impo...
StarcoderdataPython
11301418
<reponame>executablebooks/sphinx-jupyterbook-latex import sys from typing import cast from sphinx.application import Sphinx from sphinx.builders.latex import LaTeXBuilder from sphinx.config import Config from sphinx.util import logging from sphinx.util.fileutil import copy_asset_file from . import __version__, theme ...
StarcoderdataPython
6669945
<reponame>Bhclira/NExT # Faça um programa que imprima a soma de todos os números pares entre # dois números informados pelo usuário. num1 = int(input('\nDigite o Primeiro Número: ')) num2 = int(input('Digite o Segundo Número: ')) soma = 0 for i in range (num1, num2): if i%2==0: print(f'{i}', end=' ->...
StarcoderdataPython
3389668
from editor.constants import * class ActionManager: def __init__(self, actns_count): self.undo_list = [] self.redo_list = [] self.max_actions_count = actns_count def undo(self): pass def redo(self): pass
StarcoderdataPython
1940005
from pathlib import Path from fhir.resources.valueset import ValueSet as _ValueSet from oops_fhir.utils import ValueSet from oops_fhir.r4.code_system.medication_knowledge_characteristic_codes import ( medicationKnowledgeCharacteristicCodes as medicationKnowledgeCharacteristicCodes_, ) __all__ = ["medicationKn...
StarcoderdataPython
3356135
<gh_stars>0 from pandapower.plotting.generic_geodata import * from pandapower.plotting.collections import * from pandapower.plotting.colormaps import *
StarcoderdataPython
3470682
<filename>TrainingCNN.py # -*- coding: utf-8 -*- """ Created on Sun Mar 21 18:43:20 2021 @author: <NAME> """ ############################################################################################ import numpy as np import tensorflow as tf from sklearn.model_selection import train_test_split from tensorflow.k...
StarcoderdataPython
3276117
from watchdog.events import FileSystemEvent, FileCreatedEvent, FileDeletedEvent, FileModifiedEvent from os.path import basename from os import stat import logging import requests from hashlib import sha256 class FileEventHandler(object): """ EventHandler class for watchdog. Contains method for interacting with...
StarcoderdataPython
11232845
<gh_stars>10-100 from __future__ import print_function import math import torch.nn as nn import numpy as np import pdb class Loss(object): def __init__(self, name, criterion): self.name = name self.criterion = criterion if not issubclass(type(self.criterion), nn.modules.loss._Loss): ...
StarcoderdataPython
8180915
<filename>perfrunner/helpers/sync.py<gh_stars>10-100 import threading class SyncHotWorkload: def __init__(self, current_hot_load_start, timer_elapse): self.timer = None self.current_hot_load_start = current_hot_load_start self.timer_elapse = timer_elapse def start_timer(self, ws): ...
StarcoderdataPython
5187599
<filename>src/xsd_frontend/base.py from django.views.generic.base import View from django.views.generic.list import ListView from django.shortcuts import redirect from .models import UpdateRequest from .forms import UpdateRequestReply class BaseUpdateRequestList(ListView): model=UpdateRequest template_name="...
StarcoderdataPython
178870
<filename>main.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 4 16:25:33 2021 @author: jay """ import argparse from utils.config import process_config from agents import * from sklearn.model_selection import train_test_split import h5py import numpy as np import torch def main(): # ...
StarcoderdataPython
260524
<reponame>jldantas/leet<filename>leet/backends/cb.py # -*- coding: utf-8 -*- """Implements the Carbon Black Response, using Live Response backend. This module contains the three necessary classes to implement the CB backend: - CBMachine -> Represents a machine to CB - CBSession -> Represents a LR session - Backend ->...
StarcoderdataPython
1907325
# -*- coding: utf-8 -*- from .sign import sign_content __name__ = "uonet-request-signer" __version__ = "1.0.0" __all__ = ["sign_content"]
StarcoderdataPython
6691224
<filename>tief/association/association_rule.py from .apriori import support import pandas as pd import itertools def confidence(_item, next_item): """ Return confidence value _item: list of string, ex ['123'] or ['123', '124'] next_item: list of string, ex ['123'] or ['123', '124'] """ join = _item +...
StarcoderdataPython
362028
<filename>Type Trainer.py import curses from curses import wrapper, initscr, endwin from time import sleep, time from art import text2art import locale from math import log from json import load from os.path import isfile from _thread import start_new_thread as nt from copy import deepcopy if not isfile(...
StarcoderdataPython
6644836
"""Remove EquipmentDataField default_val.""" # pylint: disable=invalid-name from django.db import migrations class Migration(migrations.Migration): """Remove EquipmentDataField default_val.""" dependencies = [ ('IoT_DataMgmt', '0087_delete_EquipmentInstanceDataFieldDailyAgg') ] ...
StarcoderdataPython
1657574
# -*- coding: utf-8 -*- """ This script read USGS streamflow data. Created on Fri Feb 14 00:21:31 2020 @author: <NAME> usage: python swat_plot.py """ import pandas as pd import datetime from sys import version if version > '3': from urllib.request import urlopen else: from urllib2 i...
StarcoderdataPython
3553342
""" This script was made by Nick at 19/07/20. To implement code for inference with your model. """ from argparse import ArgumentParser, Namespace import os import matplotlib.pyplot as plt import numpy as np import pytorch_lightning as pl import torch from src.utils import Config, get_dataloader pl.seed_every...
StarcoderdataPython
8157996
# Generated by Django 3.2.7 on 2022-01-22 10:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('gui', '0018_auto_20220114_2218'), ] operations = [ migrations.AlterField( model_name='channels', name='ar_amt_target...
StarcoderdataPython
3346192
<reponame>APrioriInvestments/object_database<filename>object_database/web/cells_demo/collapsible_panel.py<gh_stars>1-10 # Coyright 2017-2019 Nativepython 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 obtai...
StarcoderdataPython
3450857
__author__ = "arnoldochavez" import random import pygame from . import resources as res from . import constants as const from .components import player from .components import obstacles from .components import backgrounds as back pygame.init() class Control( object ): def __init__( self ): self.gameState = const...
StarcoderdataPython
205225
import torch import torch.nn as nn from typing import List, Union # TODO: allow additional kwargs class CausalConv1d(nn.Conv1d): """ Causal Convolutional 1D layer. A simple nn.Conv1d with causal padding. """ def __init__(self, in_channels, out_channels, ...
StarcoderdataPython
9697071
import re from flaski import app from flask_login import current_user from flask_caching import Cache from flaski.routines import check_session_app import dash from dash.dependencies import Input, Output, State import dash_core_components as dcc import dash_html_components as html import dash_bootstrap_components as db...
StarcoderdataPython
5129753
import asyncio import errno import logging import os import platform import re from functools import wraps, partial from pathlib import Path from stat import S_ISDIR from typing import List IS_WINDOWS = platform.system() == 'Windows' def wrap(func): @wraps(func) async def run(*args, loop=None, executor=None...
StarcoderdataPython
3476689
""" Middleware classes for the main app""" from django.conf import settings from django.utils.deprecation import MiddlewareMixin class CachelessAPIMiddleware(MiddlewareMixin): """ Add Cache-Control header to API responses""" def process_response(self, request, response): """ Add a Cache-Control heade...
StarcoderdataPython
8003214
""" Standard class of HTTP responses """ from enum import Enum from flask import jsonify, make_response INVALID_FIELD_NAME_SENT_422 = { "http_code": 422, "code": "invalidField" } INVALID_INPUT_422 = { "http_code": 422, "code": "invalidInput" } MISSING_PARAMETER_422 = { "http_code": 422, "cod...
StarcoderdataPython
8096513
<filename>comprehension/lab/no_vowels.py<gh_stars>0 vowels = {'a', 'o', 'u', 'e', 'i'} vowels = vowels.union([s.upper() for s in vowels]) input_data = input() result = [s for s in input_data if s not in vowels] print(''.join(result))
StarcoderdataPython
10605
""" sources.chicago =============== Reads a CSV file in the format (as of April 2017) of data available from: - https://catalog.data.gov/dataset/crimes-one-year-prior-to-present-e171f - https://catalog.data.gov/dataset/crimes-2001-to-present-398a4 The default data is loaded from a file "chicago.csv" which should be ...
StarcoderdataPython
3363489
<filename>python/tests/core/conftest.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 information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Vers...
StarcoderdataPython
11283335
<filename>bitmovin_api_sdk/encoding/encodings/muxings/text/customdata/__init__.py from bitmovin_api_sdk.encoding.encodings.muxings.text.customdata.customdata_api import CustomdataApi
StarcoderdataPython
11214311
<filename>Python/benchmarking/req_test_creator.py<gh_stars>0 import os os.chdir("..") from release_creator import build_utility_application """ Create the ReqTest application. """ build_utility_application("Windows", "ReqTest", "Assets/TDWTest/ReqTest.unity", "TEST")
StarcoderdataPython
8020408
"""Add UserParticipation table Revision ID: 017a0dd30585 Revises: <PASSWORD> Create Date: 2018-10-14 11:25:03.460864 """ # revision identifiers, used by Alembic. import sqlalchemy as sa import transaction from alembic import op from dbas.database import DBDiscussionSession revision = '017a0dd30585' down_revision =...
StarcoderdataPython
11393417
from services.yfinance import get_price from .optimizer import get_ebitda_df from .heatmap import esg_data_df, merged_esg_scores import pandas as pd def get_esg_score(request): data = request.get_json() ticker = data["ticker"] esg_df = esg_data_df() single_esg = esg_df.loc[ticker, :] companies_df = pd.read_csv...
StarcoderdataPython
427
# Generated by Django 3.1 on 2020-09-08 07:43 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='OpeningSystem', fields=[ ...
StarcoderdataPython
11273547
<gh_stars>1-10 import pytest import fair from fair.RCPs import rcp3pd, rcp45, rcp6, rcp85, rcp26, rcp60 import numpy as np import os from fair.constants import molwt, radeff, lifetime from fair.tools.constrain import hist_temp from fair.tools.gwp import gwp def test_ten_GtC_pulse(): emissions = np.zeros(250) ...
StarcoderdataPython
11863
__author__ = '<NAME> - www.tonybeltramelli.com' # scripted agents taken from PySC2, credits to DeepMind # https://github.com/deepmind/pysc2/blob/master/pysc2/agents/scripted_agent.py import numpy as np import uuid from pysc2.agents import base_agent from pysc2.lib import actions from pysc2.lib import features _SCREE...
StarcoderdataPython
5182738
def gc_content(seq): if not seq: return 0 gc_cnt = total_chars = 0 for a in seq: if a in 'GC': gc_cnt += 1 total_chars += 1 return round(100.0 * gc_cnt / total_chars, 2)
StarcoderdataPython
6574373
<gh_stars>0 BOARD_LENGTH = 5 VICTORY_STRIKE = 4 DEBUG = False
StarcoderdataPython
1920744
<reponame>another-s347/learning-to-communicate-pytorch<gh_stars>0 """ DRQN-based agent that learns to communicate with other agents to play the Switch game. """ import torch from torch import nn from torch.nn import functional as F from torch.autograd import Variable from pysc2.lib import features import numpy as np ...
StarcoderdataPython
9731825
<reponame>tdiprima/code<filename>recipes/Python/576823_Prints_full_name_all_occurrences_given_filename_/recipe-576823.py """Prints full name of all occurrences of given filename in your PATH. Usage: findinpath.py filename""" import os import sys def main(): if len(sys.argv) < 2: print __doc__ ret...
StarcoderdataPython
151375
<reponame>bossjones/docker-compose-prometheus<filename>contrib/grok-to-regex.py<gh_stars>0 #!/usr/bin/env python import argparse import re from os import walk from os.path import join def get_patterns(patterns_dir): patterns = {} for (dirpath, _, filenames) in walk(patterns_dir): for name in filename...
StarcoderdataPython
4881592
<reponame>vitormiura/django-escola<gh_stars>0 from django.contrib import admin from home.models import Curso, Aluno @admin.register(Curso) class detCurso(admin.ModelAdmin): list_display = ('id',) @admin.register(Aluno) class detAluno(admin.ModelAdmin): list_display = ('id',)
StarcoderdataPython
6452538
from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status from rest_framework import viewsets # Token Authentication: is the type of authentication we use for users to authenticate themselves with our API. # It works by generating a random token string when ...
StarcoderdataPython
4827955
<filename>runme.py #!/usr/bin/env python # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyrig...
StarcoderdataPython
125733
<filename>forum/urls.py from django.urls import path from forum.views import ( new_post_view, ) app_name = 'forum' urlpatterns = [ path('new-post/', new_post_view, name='new_post'), ]
StarcoderdataPython
363888
<reponame>codezero00/codeGenerate import json from jinja2 import Template, Environment, FileSystemLoader import os from utils import str2Hump, str2BigHump, openapiType2pydanticType with open('../dlop_dp.json', 'r', encoding='utf-8') as f: json_str = f.read() struct = json.loads(json_str) info = struct['info'] t...
StarcoderdataPython
3230445
from zope.interface import implementer from twisted.python.components import registerAdapter from nevow import loaders, rend, inevow, tags as T from formless import annotate, webform class Tree(dict): def __init__(self, name, description, *children): self.name = name self.description = descripti...
StarcoderdataPython
6589134
from django.contrib import admin from django.urls import path,re_path from django.conf.urls import url from cronjob import views from django.contrib.auth.views import LoginView,LogoutView from django.contrib.auth import views as auth_views app_name = 'cronjob' urlpatterns = [ url(r'^report/$', views.ProjectDash...
StarcoderdataPython
85827
from xyw_eyes.spider.spider import Spider, Request from lxml import etree
StarcoderdataPython
4902131
def printno(upper): if(upper>0): printno(upper-1) print(upper) upper=int(input("Enter upper limit: ")) printno(upper)
StarcoderdataPython
5071883
# Copyright (c) 2021 PaddlePaddle Authors. All rights reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
StarcoderdataPython